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
8aa8d31769aa7065b7fdcf6ba9e1cc01c1da8bf1
f49656cdb1d78b36b603e5a2a27267ad36e910f2
/src/test/java/junit/org/rapidpm/vaadin/helloworld/server/junit5/extensions/pageobject/PageObjectExtension.java
7376579102615153c263ac50703e66f048472b2d
[ "Apache-2.0" ]
permissive
Java-Publications/vaadin-012-helloworld-10
1c71e4e4e89939ec7b31d04d74d8e0ce94249874
fdddf1416471ee5f14c3cd756983c9c44f7041bf
refs/heads/master
2021-01-21T23:09:09.362521
2017-11-29T04:34:35
2017-11-29T04:34:35
95,197,494
1
0
null
null
null
null
UTF-8
Java
false
false
1,647
java
package junit.org.rapidpm.vaadin.helloworld.server.junit5.extensions.pageobject; import static junit.org.rapidpm.vaadin.helloworld.server.junit5.extensions.ExtensionFunctions.ipSupplierLocalIP; import static junit.org.rapidpm.vaadin.helloworld.server.junit5.extensions.testcontainers.TestcontainersExtension.webdriver; import static junit.org.rapidpm.vaadin.helloworld.server.junit5.vaadin.VaadinPageObject.KEY_VAADIN_SERVER_IP; import java.util.function.Supplier; import org.junit.jupiter.api.extension.BeforeAllCallback; import org.junit.jupiter.api.extension.ContainerExtensionContext; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.ParameterContext; import org.junit.jupiter.api.extension.ParameterResolutionException; import org.junit.jupiter.api.extension.ParameterResolver; import junit.org.rapidpm.vaadin.helloworld.server.myui.MyUIPageObject; /** * */ public class PageObjectExtension implements ParameterResolver, BeforeAllCallback { @Override public boolean supports(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException { return parameterContext.getParameter().isAnnotationPresent(PageObject.class); } @Override public Supplier<MyUIPageObject> resolve(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException { return () -> new MyUIPageObject(webdriver().apply(extensionContext).get()); } @Override public void beforeAll(ContainerExtensionContext context) throws Exception { System.setProperty(KEY_VAADIN_SERVER_IP, ipSupplierLocalIP.get()); } }
38108b012c33f41a5365ca541f81e17ba4deaf82
e659ad084acfc684e996083e142a3f2a143fc818
/src/main/java/MegaBean.java
34aea4c53a559d64010be266a0ec2d61660e75b6
[]
no_license
ils007/Spring-lessons
dc93ca9af8b3637fa4ce054057fef2f62350d8ae
b4be7503a19b15e12137430504f933b4c1a708cc
refs/heads/master
2020-04-08T19:43:01.134493
2018-11-29T13:08:29
2018-11-29T13:08:29
159,667,794
0
0
null
null
null
null
UTF-8
Java
false
false
396
java
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class MegaBean { @Autowired private TestBean testBeaninside; public TestBean getTestBeaninside() { return testBeaninside; } public void setTestBeaninside(TestBean testBeaninside) { this.testBeaninside = testBeaninside; } }
d0a2f0939a89b8c47f7fd8ac520448bd364eb6ae
f9bda72cae8045ffcb7c6f45a0f2c419430c4fe2
/sample_hera_based_app/src/test/java/com/paypal/hera/integration/sampleapp/HeraIntegratedSpringApplicationTests.java
1090d8ad2eefcae8a5850f5a084bff5e50becd66
[ "Apache-2.0" ]
permissive
paypal/hera
eec28fe9bfa73865df17608e1bd5ae8707e9db6a
af6bc1d04dfc16241f851ef25ca925df1cd839a8
refs/heads/main
2023-09-04T03:12:27.165889
2023-08-31T18:49:30
2023-08-31T18:49:30
184,614,293
284
119
Apache-2.0
2023-09-14T19:12:32
2019-05-02T16:24:38
Go
UTF-8
Java
false
false
1,881
java
package com.paypal.hera.integration.sampleapp; import com.paypal.hera.conf.HeraClientConfigHolder; import com.paypal.hera.conn.HeraTLSConnection; import com.paypal.hera.conn.HeraTLSConnectionFactory; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.util.Assert; import java.sql.*; import java.util.Properties; @SpringBootTest class HeraIntegratedSpringApplicationTests { @Test void testConnection() throws SQLException { String message = ""; try { Boolean disableSSL = false; String sslEnv = System.getenv("HERA_DISABLE_SSL"); if (sslEnv != null && sslEnv.equalsIgnoreCase("true")) disableSSL = true; String host = "1:127.0.0.1:10102"; Properties props = new Properties(); System.setProperty("javax.net.ssl.trustStore", "src/main/resources/cert/hera.jks"); System.setProperty("javax.net.ssl.trustStorePassword", "herabox"); if(!disableSSL) props.setProperty(HeraClientConfigHolder.CONNECTION_FACTORY_PROPERTY, HeraTLSConnectionFactory.class.getCanonicalName()); props.setProperty(HeraClientConfigHolder.RESPONSE_TIMEOUT_MS_PROPERTY, "3000"); Connection dbConn = DriverManager.getConnection("jdbc:hera:" + host, props); // do standard JDBC PreparedStatement pst = dbConn.prepareStatement("select * from employee"); ResultSet rs = pst.executeQuery(); if (rs.next()) { message += "testRead : " + rs.getString(1); } }catch (Exception e) { e.printStackTrace(); message += "Exception: " + e.getMessage(); System.out.println(message); throw e; } System.out.println(message); } }
f08763b604d346babfda2cf1f0278cb2aa31c220
e60a371fdbfe269e69a0a1281856f7db83d088c6
/src/main/java/org/belemkadem/accouchement/service/util/RandomUtil.java
495f56754860fb0195aa293ec7e9691fbfbd2bbf
[]
no_license
belemkadem/testAccouchement
96cdce6e89e62521a3048c906c580991dc1f3741
30a40f72f59559ead3d0bcb765515f5a4d30e73e
refs/heads/master
2023-05-14T21:24:53.449138
2019-05-03T22:33:27
2019-05-03T22:33:27
196,832,178
0
0
null
2023-05-06T07:12:58
2019-07-14T12:10:26
Java
UTF-8
Java
false
false
1,472
java
package org.belemkadem.accouchement.service.util; import org.apache.commons.lang3.RandomStringUtils; /** * Utility class for generating random Strings. */ public final class RandomUtil { private static final int DEF_COUNT = 20; private RandomUtil() { } /** * Generate a password. * * @return the generated password */ public static String generatePassword() { return RandomStringUtils.randomAlphanumeric(DEF_COUNT); } /** * Generate an activation key. * * @return the generated activation key */ public static String generateActivationKey() { return RandomStringUtils.randomNumeric(DEF_COUNT); } /** * Generate a reset key. * * @return the generated reset key */ public static String generateResetKey() { return RandomStringUtils.randomNumeric(DEF_COUNT); } /** * Generate a unique series to validate a persistent token, used in the * authentication remember-me mechanism. * * @return the generated series data */ public static String generateSeriesData() { return RandomStringUtils.randomAlphanumeric(DEF_COUNT); } /** * Generate a persistent token, used in the authentication remember-me mechanism. * * @return the generated token data */ public static String generateTokenData() { return RandomStringUtils.randomAlphanumeric(DEF_COUNT); } }
9b2defd28e2da5351998a5ed9f42ee5f16acdf30
6faca3dc105413cb293f5b180c53fe1cfeb3d00d
/src/main/java/vms/models/groups/Response.java
0337637b8a19756331ffdf98f0f595e981b5a689
[]
no_license
VMS-TM/VMS-core
79e7ae1f24e0f1756b1d31da60ec5f6493709cb2
16f11321c01f280ff3dfc354c81c5099513a196c
refs/heads/master
2021-01-19T23:40:40.824804
2017-07-15T10:08:33
2017-07-15T10:08:33
89,009,122
0
1
null
2017-05-29T16:36:33
2017-04-21T17:42:05
Java
UTF-8
Java
false
false
474
java
package vms.models.groups; import org.codehaus.jackson.annotate.JsonProperty; import java.util.ArrayList; public class Response { @JsonProperty("count") private int count; public int getCount() { return this.count; } public void setCount(int count) { this.count = count; } @JsonProperty("items") private ArrayList<Group> items; public ArrayList<Group> getItems() { return this.items; } public void setItems(ArrayList<Group> items) { this.items = items; } }
14062b2a2d017124b8f4c7a301ac02e1f8fa9e9a
c39d844858450918f4fc0f5bad6e79c364e30da5
/DontTouchTheFloor/Run.java
3330cedd61c2375ddf0ba96cfb0c1ce3358d7af3
[]
no_license
KatrinaCassar/Games
d6cd72e5d252c6ebb07171e37cbc193a62ee6a14
4651e6ff9533bf6627f2975a98108f073c48629d
refs/heads/master
2021-01-19T14:22:28.650464
2017-04-18T12:00:56
2017-04-18T12:00:56
88,155,544
0
0
null
null
null
null
UTF-8
Java
false
false
417
java
import javax.swing.JFrame; public class Run{ public static void main(String[] args){ runGame(); } public static void runGame(){ Frame frame = new Frame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(1000, 700); frame.setResizable(false); frame.setLocationRelativeTo(null); frame.setVisible(true); } }
335b638c93a7f753cd052a58850cff05bd9be49a
95a2123118649b3a7835ac6064ce31e8fcbdc90b
/src/main/java/com/relesee/service/ForeignAccService.java
c3fb37e266b02c7c3d5acec2d787a03da01f5604
[]
no_license
JanderCol/czbank
1c5ad0bfd7c1040b955ce362907893477420361a
dfee7c0d7960d200bfd89c317f50622e1ab8a580
refs/heads/master
2022-01-23T23:52:32.545333
2019-04-23T07:33:50
2019-04-23T07:33:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
18,850
java
package com.relesee.service; import com.alibaba.fastjson.JSON; import com.relesee.constant.ForeignApplicationStatus; import com.relesee.dao.AmazonEUdao; import com.relesee.dao.AmazonUSdao; import com.relesee.dao.EbayApplicationDao; import com.relesee.domains.*; import com.relesee.utils.FileUtil; import org.apache.log4j.Logger; import org.apache.shiro.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import java.util.List; @Service public class ForeignAccService { private static final Logger logger = Logger.getLogger(ForeignAccService.class); @Value("#{projectProperties['output.rootpath']}")//projectProperties是在spring的配置文件中配置的一个bean private String OUTPUT_ROOT_PATH; @Autowired EbayApplicationDao ebayApplicationDao; @Autowired AmazonUSdao amazonUSdao; @Autowired AmazonEUdao amazonEUdao; /** * 将上传的两个文件保存在:OUTPUT_ROOT_PATH/files/ebay/{uuid}文件夹内,名字保持原名即可。 * 先将文件写到磁盘后再将模板信息存入数据库 * @param ebayApplication * @return */ @Transactional(propagation=Propagation.REQUIRED,rollbackForClassName="Exception") public Result<String> ebayAcc(EbayApplication ebayApplication, String realpath){ String uuid = FileUtil.uuid(); //手动注入uuid ebayApplication.setId(uuid); String DIRECTORY = realpath+"/files/ebay/"+uuid; MultipartFile applicationFile = ebayApplication.getApplicationFile(); MultipartFile transactionRecord = ebayApplication.getTransactionRecord(); boolean fileWriteSuccess = false; try { FileUtil.createDirIfNotExist(DIRECTORY); ebayApplication.setApplicationFileName(applicationFile.getOriginalFilename()); FileUtil.writeInputStreamToDirectory(applicationFile.getInputStream(), DIRECTORY+"/"+applicationFile.getOriginalFilename()); if (transactionRecord != null){ ebayApplication.setTransactionRecordName(transactionRecord.getOriginalFilename()); FileUtil.writeInputStreamToDirectory(transactionRecord.getInputStream(), DIRECTORY+"/"+transactionRecord.getOriginalFilename()); } fileWriteSuccess = true; } catch (Exception e){ e.printStackTrace(); logger.error("ebay文件上传出错",e); fileWriteSuccess = false; } int count = 0; if (fileWriteSuccess){ count = ebayApplicationDao.insertApplication(ebayApplication); } Result<String> result = new Result(); if (count == 1){ result.setFlag(true); result.setMessage("申请已提交"); } else { result.setMessage("申请提交失败"); result.setFlag(false); } return result; } @Transactional(propagation=Propagation.REQUIRED,rollbackForClassName="Exception") public Result amazonUSacc(AmazonUSapplication amazonUS, String realpath){ String uuid = FileUtil.uuid(); //手动注入uuid amazonUS.setId(uuid); String DIRECTORY = realpath+"/files/amazon/us/"+uuid; MultipartFile applicationFile = amazonUS.getApplicationFile(); MultipartFile transactionRecord = amazonUS.getTransactionRecord(); boolean fileWriteSuccess = false; try { FileUtil.createDirIfNotExist(DIRECTORY); amazonUS.setApplicationFileName(applicationFile.getOriginalFilename()); FileUtil.writeInputStreamToDirectory(applicationFile.getInputStream(), DIRECTORY+"/"+applicationFile.getOriginalFilename()); if (transactionRecord != null){ amazonUS.setTransactionRecordName(transactionRecord.getOriginalFilename()); FileUtil.writeInputStreamToDirectory(transactionRecord.getInputStream(), DIRECTORY+"/"+transactionRecord.getOriginalFilename()); } fileWriteSuccess = true; } catch (Exception e){ e.printStackTrace(); logger.error("Amazon US文件上传出错",e); fileWriteSuccess = false; } int count = 0; if (fileWriteSuccess){ count = amazonUSdao.insertApplication(amazonUS); } Result<String> result = new Result(); if (count == 1){ result.setFlag(true); result.setMessage("申请已提交"); } else { result.setMessage("申请提交失败"); result.setFlag(false); } return result; } @Transactional(propagation=Propagation.REQUIRED,rollbackForClassName="Exception") public Result amazonEUacc(AmazonEUapplication amazonEU, String realpath){ String uuid = FileUtil.uuid(); //手动注入uuid amazonEU.setId(uuid); String DIRECTORY = realpath+"/files/amazon/eu/"+uuid; MultipartFile applicationFile = amazonEU.getApplicationFile(); boolean fileWriteSuccess = false; try { FileUtil.createDirIfNotExist(DIRECTORY); amazonEU.setApplicationFileName(applicationFile.getOriginalFilename()); FileUtil.writeInputStreamToDirectory(applicationFile.getInputStream(), DIRECTORY+"/"+applicationFile.getOriginalFilename()); fileWriteSuccess = true; } catch (Exception e){ e.printStackTrace(); logger.error("Amazon EU文件上传出错",e); fileWriteSuccess = false; } int count = 0; if (fileWriteSuccess){ count = amazonEUdao.insertApplication(amazonEU); } Result<String> result = new Result(); if (count == 1){ result.setFlag(true); result.setMessage("申请已提交"); } else { result.setMessage("申请提交失败"); result.setFlag(false); } return result; } @Transactional(isolation = Isolation.SERIALIZABLE, propagation=Propagation.REQUIRED,rollbackForClassName="Exception") public Result<EbayApplication> getOneEbayApplication(){ User user = (User) SecurityUtils.getSubject().getPrincipal(); Result<EbayApplication> result = new Result(); EbayApplication temp = new EbayApplication(); temp.setStatus(ForeignApplicationStatus.LOCKED.getCode()); temp.setAuditor(user.getUserId()); EbayApplication locked = ebayApplicationDao.selectLocked(temp); if (locked == null){ EbayApplication resultDo = ebayApplicationDao.selectOneEbayApplication(); if (resultDo == null){ result.setFlag(false); result.setMessage("没有可以处理的申请"); } else { resultDo.setAuditor(user.getUserId()); resultDo.setStatus(ForeignApplicationStatus.LOCKED.getCode()); System.out.println(JSON.toJSONString(resultDo)); ebayApplicationDao.updateStatus(resultDo); ebayApplicationDao.updateAuditor(resultDo); result.setFlag(true); result.setMessage("获取申请成功,即将加载"); result.setResult(resultDo); } } else { result.setFlag(true); result.setMessage("您有锁定的申请未处理,即将加载"); result.setResult(locked); } return result; } @Transactional(isolation = Isolation.SERIALIZABLE, propagation=Propagation.REQUIRED,rollbackForClassName="Exception") public Result ebayPassed(EbayApplication input, String realpath){ User user = (User) SecurityUtils.getSubject().getPrincipal(); input.setAuditor(user.getUserId()); Result result = new Result(); input.setStatus(ForeignApplicationStatus.SUBMITTED.getCode()); //新增的打包下载功能 /*String uuid = input.getId(); String forderPath = realpath+"/files/amazon/us/"+uuid;*/ int count = ebayApplicationDao.updateStatus(input); if (count == 1){ result.setFlag(true); result.setMessage("通过申请成功,即将打包下载"); } else { result.setFlag(false); result.setMessage("通过申请失败"); } return result; } @Transactional(isolation = Isolation.SERIALIZABLE, propagation=Propagation.REQUIRED,rollbackForClassName="Exception") public Result ebayRefused(EbayApplication input){ User user = (User) SecurityUtils.getSubject().getPrincipal(); input.setAuditor(user.getUserId()); Result result = new Result(); input.setStatus(ForeignApplicationStatus.RETREAT.getCode()); int count = ebayApplicationDao.updateStatus(input); if (count == 1){ result.setFlag(true); result.setMessage("申请已拒绝"); } else { result.setFlag(false); result.setMessage("申请拒绝失败"); } return result; } @Transactional(isolation = Isolation.SERIALIZABLE, propagation=Propagation.REQUIRED,rollbackForClassName="Exception") public Result updateEbayApplication(EbayApplication input){ Result result = new Result(); int count = ebayApplicationDao.updateApplication(input); if (count == 1){ result.setFlag(true); result.setMessage("更新ebay申请信息成功"); } else { result.setFlag(false); result.setMessage("更新ebay申请信息出错"); } return result; } @Transactional(isolation = Isolation.SERIALIZABLE, propagation=Propagation.REQUIRED,rollbackForClassName="Exception") public Result<AmazonUSapplication> getOneAmazonUSapplication(){ User user = (User) SecurityUtils.getSubject().getPrincipal(); Result<AmazonUSapplication> result = new Result(); AmazonUSapplication temp = new AmazonUSapplication(); temp.setStatus(ForeignApplicationStatus.LOCKED.getCode()); temp.setAuditor(user.getUserId()); AmazonUSapplication locked = amazonUSdao.selectLocked(temp); if (locked == null){ AmazonUSapplication resultDo = amazonUSdao.selectOneApplication(); if (resultDo == null){ result.setFlag(false); result.setMessage("没有可以处理的申请"); } else { resultDo.setAuditor(user.getUserId()); resultDo.setStatus(ForeignApplicationStatus.LOCKED.getCode()); amazonUSdao.updateStatus(resultDo); amazonUSdao.updateAuditor(resultDo); result.setFlag(true); result.setMessage("获取申请成功,即将加载"); result.setResult(resultDo); } } else { result.setFlag(true); result.setMessage("您有锁定的申请未处理,即将加载"); result.setResult(locked); } return result; } //TODO 别忘了把下面4个的auditor的id设置好 @Transactional(isolation = Isolation.SERIALIZABLE, propagation=Propagation.REQUIRED,rollbackForClassName="Exception") public Result amazonUSpassed(AmazonUSapplication input){ User user = (User) SecurityUtils.getSubject().getPrincipal(); input.setAuditor(user.getUserId()); Result result = new Result(); input.setStatus(ForeignApplicationStatus.SUBMITTED.getCode()); int count = amazonUSdao.updateStatus(input); if (count == 1){ result.setFlag(true); result.setMessage("通过申请成功,即将打包下载"); } else { result.setFlag(false); result.setMessage("通过申请失败"); } return result; } @Transactional(isolation = Isolation.SERIALIZABLE, propagation=Propagation.REQUIRED,rollbackForClassName="Exception") public Result amazonUSrefused(AmazonUSapplication input){ User user = (User) SecurityUtils.getSubject().getPrincipal(); input.setAuditor(user.getUserId()); Result result = new Result(); input.setStatus(ForeignApplicationStatus.RETREAT.getCode()); int count = amazonUSdao.updateStatus(input); if (count == 1){ result.setFlag(true); result.setMessage("申请已拒绝"); } else { result.setFlag(false); result.setMessage("申请拒绝失败"); } return result; } @Transactional(isolation = Isolation.SERIALIZABLE, propagation=Propagation.REQUIRED,rollbackForClassName="Exception") public Result updateAmazonUSapplication(AmazonUSapplication input){ Result result = new Result(); int count = amazonUSdao.updateApplication(input); if (count == 1){ result.setFlag(true); result.setMessage("更新AmazonUS申请信息成功"); } else { result.setFlag(false); result.setMessage("更新AmazonUS申请信息失败"); } return result; } @Transactional(isolation = Isolation.SERIALIZABLE, propagation=Propagation.REQUIRED,rollbackForClassName="Exception") public Result getOneAmazonEUapplication(){ User user = (User) SecurityUtils.getSubject().getPrincipal(); Result<AmazonEUapplication> result = new Result(); AmazonEUapplication temp = new AmazonEUapplication(); temp.setStatus(ForeignApplicationStatus.LOCKED.getCode()); temp.setAuditor(user.getUserId()); AmazonEUapplication locked = amazonEUdao.selectLocked(temp); if (locked == null){ AmazonEUapplication resultDo = amazonEUdao.selectOneApplication(); if (resultDo == null){ result.setFlag(false); result.setMessage("没有可以处理的申请"); } else { resultDo.setAuditor(user.getUserId()); resultDo.setStatus(ForeignApplicationStatus.LOCKED.getCode()); amazonEUdao.updateStatus(resultDo); amazonEUdao.updateAuditor(resultDo); result.setFlag(true); result.setMessage("获取申请成功,即将加载"); result.setResult(resultDo); } } else { result.setFlag(true); result.setMessage("您有锁定的申请未处理,即将加载"); result.setResult(locked); } return result; } @Transactional(isolation = Isolation.SERIALIZABLE, propagation=Propagation.REQUIRED,rollbackForClassName="Exception") public Result amazonEUpassed(AmazonEUapplication input){ User user = (User) SecurityUtils.getSubject().getPrincipal(); input.setAuditor(user.getUserId()); Result result = new Result(); input.setStatus(ForeignApplicationStatus.SUBMITTED.getCode()); int count = amazonEUdao.updateStatus(input); if (count == 1){ result.setFlag(true); result.setMessage("通过申请成功,即将打包下载"); } else { result.setFlag(false); result.setMessage("通过申请失败"); } return result; } @Transactional(isolation = Isolation.SERIALIZABLE, propagation=Propagation.REQUIRED,rollbackForClassName="Exception") public Result amazonEUrefused(AmazonEUapplication input){ User user = (User) SecurityUtils.getSubject().getPrincipal(); input.setAuditor(user.getUserId()); Result result = new Result(); input.setStatus(ForeignApplicationStatus.RETREAT.getCode()); int count = amazonEUdao.updateStatus(input); if (count == 1){ result.setFlag(true); result.setMessage("申请已拒绝"); } else { result.setFlag(false); result.setMessage("申请拒绝失败"); } return result; } @Transactional(isolation = Isolation.SERIALIZABLE, propagation=Propagation.REQUIRED,rollbackForClassName="Exception") public Result updateAmazonEUapplication(AmazonEUapplication input){ input.valueFormat(); Result result = new Result(); int count = amazonEUdao.updateApplication(input); if (count == 1){ result.setFlag(true); result.setMessage("更新AmazonEU申请信息成功"); } else { result.setFlag(false); result.setMessage("更新AmazonEU申请信息失败"); } return result; } public LayTableResult<List<EbayApplication>> getEbayHistory(int begin, int size){ LayTableResult<List<EbayApplication>> result = new LayTableResult(); List<EbayApplication> list = ebayApplicationDao.selectPageHistory(begin, size); int count = ebayApplicationDao.selectCount(); result.setCount(count); result.setMsg("获取数据成功"); result.setCode(0); result.setData(list); return result; } public List<EbayApplication> searchEbayHistory(String key){ return ebayApplicationDao.selectSearchHistory(key); } public LayTableResult<List<AmazonUSapplication>> getAmazonUShistory(int begin, int size){ LayTableResult<List<AmazonUSapplication>> result = new LayTableResult(); List<AmazonUSapplication> list = amazonUSdao.selectPageHistory(begin, size); int count = amazonUSdao.selectCount(); result.setCount(count); result.setMsg("获取数据成功"); result.setCode(0); result.setData(list); return result; } public List<AmazonUSapplication> searchAmazonUShistory(String key){ return amazonUSdao.selectSearchHistory(key); } public LayTableResult<List<AmazonEUapplication>> getAmazonEUhistory(int begin, int size){ LayTableResult<List<AmazonEUapplication>> result = new LayTableResult(); List<AmazonEUapplication> list = amazonEUdao.selectHistory(begin, size); int count = amazonEUdao.selectCount(); result.setCount(count); result.setMsg("获取数据成功"); result.setCode(0); result.setData(list); return result; } public List<AmazonEUapplication> searchAmazonEUhistory(String key){ return amazonEUdao.selectSearchHistory(key); } }
c7120ce55952425be7e793b64fd6543f4d430ef2
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/24/24_c8ea0220163684231c3b4280bbfce97c9d492a19/ICEntityCannon/24_c8ea0220163684231c3b4280bbfce97c9d492a19_ICEntityCannon_s.java
c7350e273e894049427fb13641f91200b668f6c8
[]
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
4,726
java
package com.bukkit.gemo.FalseBook.IC.ICs.worldedit; import com.bukkit.gemo.FalseBook.IC.ICs.BaseChip; import com.bukkit.gemo.FalseBook.IC.ICs.BaseIC; import com.bukkit.gemo.FalseBook.IC.ICs.ICGroup; import com.bukkit.gemo.FalseBook.IC.ICs.InputState; import com.bukkit.gemo.utils.ICUtils; import com.bukkit.gemo.utils.SignUtils; import net.minecraft.server.EntityAnimal; import net.minecraft.server.EntityArrow; import net.minecraft.server.EntityPig; import net.minecraft.server.World; import org.bukkit.Location; import org.bukkit.block.Sign; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.event.block.SignChangeEvent; import org.bukkit.util.Vector; public class ICEntityCannon extends BaseIC { public ICEntityCannon() { this.ICName = "ENTITY CANNON"; this.ICNumber = "ic.entitycannon"; setICGroup(ICGroup.WORLDEDIT); this.chipState = new BaseChip(true, false, false, "Clock", "", ""); this.chipState.setOutputs("", "", ""); this.chipState.setLines("", ""); this.ICDescription = ""; } public void checkCreation(SignChangeEvent event) { String type = event.getLine(1) + event.getLine(2); String speed = event.getLine(3); try { Float speedValue = Float.parseFloat(speed); if(speedValue < 1.0f) { speedValue = 1.0f; } if(speedValue > 32.0f) { speedValue = 32.0f; } event.setLine(3, speedValue.toString()); } catch (NumberFormatException e) { SignUtils.cancelSignCreation(event, "Type is 2nd line. Speed is 3rd line."); return; } try { EntityType et = null; for(EntityType t : EntityType.values()) { if(type.compareToIgnoreCase(t.toString()) == 0) { et = t; break; } } if(et == null) { String types = ""; for(EntityType t : EntityType.values()) { types = types + t.toString() + " "; } SignUtils.cancelSignCreation(event, "Valid types are: " + types); return; } } catch (Exception e) { String types = ""; for(EntityType t : EntityType.values()) { types = types + t.toString() + " "; } SignUtils.cancelSignCreation(event, "Valid types are: " + types); return; } } public void Execute(Sign signBlock, InputState currentInputs, InputState previousInputs) { if ((currentInputs.isInputOneHigh()) && (previousInputs.isInputOneLow())) { int dir = SignUtils.getDirection(signBlock); Location location = ICUtils.getLeverPos(signBlock).clone(); location.setX(location.getX() + 0.5d); location.setY(location.getY() + 0.5d); location.setZ(location.getZ() + 0.5d); String speed = signBlock.getLine(3); Float speedValue = Float.parseFloat(speed); Vector velocity = new Vector(0.0f, speedValue, 0.0f); if (dir == 1) { velocity = new Vector(0.0f, 0.0f, -speedValue); } else if (dir == 2) { velocity = new Vector(-speedValue, 0.0f, 0.0f); } else if (dir == 3) { velocity = new Vector(0.0f, 0.0f, speedValue); } else if (dir == 4) { velocity = new Vector(speedValue, 0.0f, 0.0f); } CraftWorld world = (CraftWorld)location.getWorld(); String type = signBlock.getLine(1) + signBlock.getLine(2); EntityType et = null; for(EntityType t : EntityType.values()) { if(type.compareToIgnoreCase(t.toString()) == 0) { et = t; break; } } final Entity ent = (Entity)world.spawnCreature(location, et); final Vector vel = velocity; ent.setVelocity(vel); this.core.getServer().getScheduler().scheduleSyncDelayedTask(this.core, new Runnable() { public void run() { ent.setVelocity(vel); } }, 2); } } }
ce7e6e6e6c1b31f2d324230ef0dc260a75d1140d
285e3924dcbeb8958388ee0116494aaa2462dae8
/app/src/main/java/com/example/covidmonitoringapp/ResultActivity.java
9e051df6e0d2acff4717bb5c52a58618eabac812
[]
no_license
Manojms1997/CovidMonitoring
c09950cd4aa1a43a45c0bad9868d479895e4d594
dd6cce2ab740a6895c814bb31f180fc7d61523c8
refs/heads/master
2023-08-20T01:59:50.592549
2021-10-27T02:43:16
2021-10-27T02:43:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,807
java
package com.example.covidmonitoringapp; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.os.Environment; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.TextView; import com.example.covidmonitoringapp.data.MyDbHandler; import com.example.covidmonitoringapp.data.model.PatientDetails; import org.json.JSONObject; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.util.ArrayList; public class ResultActivity extends AppCompatActivity { private TextView results; private Button goBackButton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_result); String patientName = getIntent().getExtras().getString("name"); results = (TextView) findViewById(R.id.results); goBackButton = (Button) findViewById(R.id.goBackButton); goBackButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(ResultActivity.this,MainActivity.class); startActivity(intent); } }); MyDbHandler myDbHandler = new MyDbHandler(this); String baseDir = Environment.getExternalStorageDirectory().getAbsolutePath(); String fileName = "JsonFolder/valuesJSON.json"; File file = new File(baseDir+"/"+fileName); JSONObject jsonContents = getJsonFileContents(file); try { double obtainedHeartRateValue = jsonContents.getDouble("heart_rate"); double obtainedRespiratoryRateValue = jsonContents.getDouble("respiratory_rate"); // String obtainedSymptoms = jsonContents.getString("symptoms"); Double obtainedFeverValue = jsonContents.getDouble("fever_value"); Boolean obtainedFever = jsonContents.getBoolean("fever"); Boolean obtainedNausea = jsonContents.getBoolean("nausea"); Boolean obtainedHeadache = jsonContents.getBoolean("headache"); Boolean obtainedDiarrhea = jsonContents.getBoolean("diarrhea"); Boolean obtainedSoarThroat = jsonContents.getBoolean("soar_throat"); Boolean obtainedMuscleAche = jsonContents.getBoolean("muscle_ache"); Boolean obtainedlsat = jsonContents.getBoolean("lsat"); Boolean obtaineCough = jsonContents.getBoolean("cough"); Boolean obtainedSob = jsonContents.getBoolean("sob"); Boolean obtainedFeelingTired = jsonContents.getBoolean("feeling_tired"); //logic to add new content in json to database PatientDetails newPatient = new PatientDetails( patientName, obtainedHeartRateValue, obtainedRespiratoryRateValue, obtainedFeverValue, obtainedFever, obtainedNausea, obtainedHeadache, obtainedDiarrhea, obtainedSoarThroat, obtainedMuscleAche, obtainedlsat, obtaineCough, obtainedSob, obtainedFeelingTired ); myDbHandler.addPatientDetails(newPatient); } catch(Exception e) { } // logic to retrive data from database and display it ArrayList<PatientDetails> patients = myDbHandler.getAllPatientsName(); String output = ""; for(int i=0;i<patients.size();i++) { Log.d("patients:",patients.get(i).getName()); output += "Name: "+patients.get(i).getName()+" |HeartRate: "+patients.get(i).getHeart_rate()+" |" + " RespiratoryRate: "+patients.get(i).getRespiratory_rate()+" \n"; } results.setText(output); } public JSONObject getJsonFileContents(File jsonFile) { JSONObject jsonObject = null; try { FileReader fileReader = new FileReader(jsonFile); BufferedReader bufferedReader = new BufferedReader(fileReader); StringBuilder stringBuilder = new StringBuilder(); String line = bufferedReader.readLine(); while (line != null){ stringBuilder.append(line).append("\n"); line = bufferedReader.readLine(); } bufferedReader.close(); String response = stringBuilder.toString(); jsonObject = new JSONObject(response); } catch (Exception e) { e.printStackTrace(); } return jsonObject; } }
91dfd93898b44f2fb149e72146281a8a97223d72
e90a6626427539a61543ad40551d325a98cdf925
/src/main/java/com/sambhar/sambharappreport/rest/interceptor/AuthenticationInterceptor.java
e76f727a23aabb88c422ea1a2d01a899cb9cbfbc
[]
no_license
turfaa/sambhar
d0d82e0244a7e3535fc4ca7a67de47e0b309fadf
18e498dca941acbc00468244c0143b48585cd7b9
refs/heads/master
2020-04-27T21:05:51.745102
2019-03-09T11:10:35
2019-03-09T11:10:35
174,684,008
1
0
null
null
null
null
UTF-8
Java
false
false
986
java
package com.sambhar.sambharappreport.rest.interceptor; import com.sambhar.sambharappreport.data.SambharConstant; import com.sambhar.sambharappreport.data.UserSharedPref; import com.sambhar.sambharappreport.event.LogoutEvent; import java.io.IOException; import javax.inject.Inject; import okhttp3.Interceptor; import okhttp3.Interceptor.Chain; import okhttp3.Response; import org.greenrobot.eventbus.EventBus; public class AuthenticationInterceptor implements Interceptor { UserSharedPref mUserSharedPref; @Inject public AuthenticationInterceptor(UserSharedPref userSharedPref) { this.mUserSharedPref = userSharedPref; } public Response intercept(Chain chain) throws IOException { Response proceed = chain.proceed(chain.request()); if (proceed.code() == SambharConstant.API_UNAUTHORIZE) { this.mUserSharedPref.clearSession(); EventBus.getDefault().post(new LogoutEvent()); } return proceed; } }
85ae298a7f2b975129a3ce2fe3830ed5d017cf9d
e8430a086e39f397696ac794f58d3ba546ff1574
/JDBC/JDBCTestQuery.java
02dcf8bf011024b66c46b5301d183f29692e974b
[]
no_license
eyulcao/eyulcao_repo
3b9cbc4bd331bb02da917c9142a2e950f3c4f407
859c7c0680d15c841653835f5f680fdef66383e4
refs/heads/master
2021-01-01T17:53:52.955833
2017-07-25T15:09:16
2017-07-25T15:09:16
98,192,351
0
0
null
null
null
null
GB18030
Java
false
false
1,678
java
import java.sql.*; public class JDBCTestQuery { public static void main(String[] args) { String driver = "oracle.jdbc.OracleDriver"; String url = "jdbc:oracle:thin:@localhost:1521:orcl"; String user = "c##root"; String password = "root"; String str = "select * from dept"; //1)finally里的rs等也要认识,所以在开头定义 Connection conn = null; Statement stmt = null; ResultSet rs = null; //2)使用try..catch..捕获异常,代替throws exception try { //Class.forName("oracle.jdbc.OracleDriver").newInstance(); //new oracle.jdbc.OracleDriver(); Class.forName(driver); conn = DriverManager.getConnection(url,user,password); stmt = conn.createStatement(); rs = stmt.executeQuery(str); while(rs.next()){ //rs.getString(1):第一列的结果转换成String类型 System.out.println("DEPTNO: " + rs.getString(1)); //System.out.println("DEPTNO: " + rs.getInt("deptno")); } // 返回int值表示执行结果 // stmt.executeUpdate("update dept set loc='60' where deptno=60"); } catch (ClassNotFoundException e) { //3)最好能够记录日志log4j e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } finally { try { //4)保证rs.close不发生异常 //5)不管发不发生异常,保证close //6)面试体现,方便垃圾收集器收集,其实rs.close()已自动将rs设置成null if(rs!=null){ rs.close(); rs=null;} if(stmt!=null){ stmt.close(); stmt=null;} if(conn!=null){ conn.close(); conn=null;} } catch (SQLException e) { e.printStackTrace(); } } } }
130569af2413c29b9c45d8b13cb15464a23ea7f6
e69faeaa04a87461b81cbc0d5f95f0772a09a7ad
/food/src/main/java/pack/food/model/min/QnaImpl.java
f6b869fff6e488c101ca44b4547e082e2ad7d7df
[]
no_license
lsgsg/menuchoice_spring
a8dbcb71ca173fd7144a9b89b507c546ca16d1e5
c589f0d1b417390ce91b69658ad48d1a33e58aa3
refs/heads/master
2020-04-14T11:53:44.024622
2019-01-02T10:15:58
2019-01-02T10:15:58
163,825,609
0
0
null
null
null
null
UTF-8
Java
false
false
960
java
package pack.food.model.min; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import pack.food.controller.min.QnaBean; @Repository public class QnaImpl { @Autowired private QnaInter qnaInter; public List<QnaDto> getUser(String id){ return qnaInter.getUser(id); } QnaDto getContent(String no) { return qnaInter.getContent(no); } public List<QnaDto> getQnaAll(){ return qnaInter.getQnaAll(); } public boolean insertData(QnaBean bean) { return qnaInter.insertData(bean); } public boolean replyData(QnaBean bean) { return qnaInter.replyData(bean); } public int getMaxNo() { return qnaInter.getMaxNo(); } public int readCntUp(String no) { return qnaInter.readCntUp(no); } public int deleteData(String no) { return qnaInter.deleteData(no); } public int updateData(QnaBean bean) { return qnaInter.updateData(bean); } }
a8c80638c00abac06cf16a275d0a4a6e1a814181
54f352a242a8ad6ff5516703e91da61e08d9a9e6
/Source Codes/AtCoder/abc056/B/4578509.java
d7e1d62d050b580a128fbdea163ca4909d7a79c1
[]
no_license
Kawser-nerd/CLCDSA
5cbd8a4c3f65173e4e8e0d7ed845574c4770c3eb
aee32551795763b54acb26856ab239370cac4e75
refs/heads/master
2022-02-09T11:08:56.588303
2022-01-26T18:53:40
2022-01-26T18:53:40
211,783,197
23
9
null
null
null
null
UTF-8
Java
false
false
624
java
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int w = sc.nextInt(); int a = sc.nextInt(); int b = sc.nextInt(); int ans = 0; if (a < b) { if (a + w >= b) { ans = 0; } else { ans = b - (a + w); } } else { if (b + w >= a) { ans = 0; } else { ans = a - (b + w); } } System.out.println(ans); sc.close(); } }
108a97bd858d9854b3f5709e81e83df92c3798f8
a23dcf1af8a27e9f8ae5ddd648250fc968b3d28c
/spring-security-oauth/src/main/java/org/springframework/security/oauth2/provider/OAuth2ExceptionHandlerFilter.java
a88db91476b9cec85a8e783e83c4e0788e75eefd
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
thaingo/spring-security-oauth
c6bf9437a3a98ee08328ac0533cdaeb015100170
58f9e599ee8526a59cd0db0493fe17ff63e74f49
refs/heads/master
2021-01-21T00:18:03.585635
2011-08-10T08:34:53
2011-08-10T08:34:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,974
java
package org.springframework.security.oauth2.provider; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.AccessDeniedException; import org.springframework.security.core.AuthenticationException; import org.springframework.security.oauth2.common.DefaultOAuth2SerializationService; import org.springframework.security.oauth2.common.DefaultThrowableAnalyzer; import org.springframework.security.oauth2.common.exceptions.OAuth2Exception; import org.springframework.security.oauth2.common.OAuth2SerializationService; import org.springframework.security.web.util.ThrowableAnalyzer; import org.springframework.web.filter.GenericFilterBean; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; /** * Filter for handling OAuth2-specific exceptions. * * @author Ryan Heaton */ public class OAuth2ExceptionHandlerFilter extends GenericFilterBean { private OAuth2SerializationService serializationService = new DefaultOAuth2SerializationService(); private ThrowableAnalyzer throwableAnalyzer = new DefaultThrowableAnalyzer(); public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) req; HttpServletResponse response = (HttpServletResponse) res; try { chain.doFilter(request, response); if (logger.isDebugEnabled()) { logger.debug("Chain processed normally"); } } catch (IOException ex) { throw ex; } catch (Exception ex) { // Try to extract a SpringSecurityException from the stacktrace Throwable[] causeChain = getThrowableAnalyzer().determineCauseChain(ex); RuntimeException ase = (AuthenticationException) getThrowableAnalyzer().getFirstThrowableOfType(AuthenticationException.class, causeChain); if (ase == null) { ase = (AccessDeniedException) getThrowableAnalyzer().getFirstThrowableOfType(AccessDeniedException.class, causeChain); } if (ase != null) { handleSecurityException(request, response, chain, ase); } else { // Rethrow ServletExceptions and RuntimeExceptions as-is if (ex instanceof ServletException) { throw (ServletException) ex; } else if (ex instanceof RuntimeException) { throw (RuntimeException) ex; } // Wrap other Exceptions. These are not expected to happen throw new RuntimeException(ex); } } } protected void handleSecurityException(HttpServletRequest request, HttpServletResponse response, FilterChain chain, RuntimeException ase) throws IOException { if (ase instanceof OAuth2Exception) { if (logger.isDebugEnabled()) { logger.debug("OAuth error.", ase); } String serialization = getSerializationService().serialize((OAuth2Exception) ase); response.setStatus(((OAuth2Exception) ase).getHttpErrorCode()); response.setHeader("Cache-Control", "no-store"); response.setContentType("application/json"); response.getWriter().write(serialization); response.flushBuffer(); return; } //we don't care about anything but oauth exceptions. throw ase; } public ThrowableAnalyzer getThrowableAnalyzer() { return throwableAnalyzer; } @Autowired ( required = false ) public void setThrowableAnalyzer(ThrowableAnalyzer throwableAnalyzer) { this.throwableAnalyzer = throwableAnalyzer; } public OAuth2SerializationService getSerializationService() { return serializationService; } public void setSerializationService(OAuth2SerializationService serializationService) { this.serializationService = serializationService; } }
0f551ec677c659dda55a3c10c73f1adb2fefe242
55c0cfb10cc22821857ce3e07335c698c1c338c2
/Rapmedix/app/src/androidTest/java/khusaki/com/rapmedix/ApplicationTest.java
33efa01484ab307a3473146831b2174d6770a35c
[]
no_license
srinivasp94/certification
60935c2ddfb3951efb1e591d4d256042d39ba03f
0846f2d1d1d5543281587c80c808402d68aba6ae
refs/heads/master
2021-07-11T13:41:08.379860
2018-09-28T11:43:23
2018-09-28T11:43:23
129,745,976
0
0
null
null
null
null
UTF-8
Java
false
false
351
java
package khusaki.com.rapmedix; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
2aa52f0ee1f5e3fd2f9572a79a3092ed3e81fafe
71e60d32b2d3faae321e1fdd85c07d9de12ff211
/FinalProjectMain.java
650f87d909648592a504ae2fab876b90a56c0914
[]
no_license
dys0602/What-To-Eat-Today
daa3da7b969bbdbeb76473c9a69cc961feefdf30
fac831a6347f758ebfe300b4949c7c9f2e6a04b4
refs/heads/main
2023-08-22T17:04:44.771928
2021-10-09T06:23:48
2021-10-09T06:23:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
128
java
public class FinalProjectMain{ public static void main(String[] args) { new PageOne_Login(); } }
f3817123ce911debe6e83bc834865ab168ed1cef
725b41fcd3179ec09b0d25a4fb5c8afdc95c0186
/Queues/src/QueueUse.java
fb15ad5aecacbe55224fd15b90714d1cf5ff38ef
[]
no_license
rawalmaharshi/JavaQuestions
a58971d093440b7fe57f82cefc80a5b4ae52e19a
9963796abc3533945c8a87316bec9b69d786a9f3
refs/heads/master
2020-04-04T13:58:05.019045
2019-01-02T08:05:35
2019-01-02T08:05:35
155,980,295
0
0
null
null
null
null
UTF-8
Java
false
false
535
java
public class QueueUse { public static void main(String[] args) throws QueueEmptyException, QueueFullException { QueueUsingArray queue = new QueueUsingArray(); for (int i = 1; i <= 50; i++) { try { queue.enqueue(i); } catch (QueueFullException e) { // TODO Auto-generated catch block e.printStackTrace(); } } while (!queue.isEmpty()) { try { System.out.println(queue.deque()); } catch (QueueEmptyException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }
3fd3e99bcc64d1e4e7b625fd2029b621cf0d4414
833f2340a1bff6dd4004e7d114eb85ab33fed34c
/android/FunnyPlayer/src/com/funnyplayer/ui/fragment/PlaylistFragment.java
0870593b7829e947ea2f5f450b012d06c85614aa
[]
no_license
sunriver/projects
4fa1df0faa87594ef1f12a20ddc4783e6b070352
52493eb1c0c2ee57f6377589129295d97db256ec
refs/heads/master
2021-01-22T09:33:20.969985
2014-11-21T02:58:09
2014-11-21T02:58:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,667
java
package com.funnyplayer.ui.fragment; import java.util.ArrayList; import java.util.List; import com.funnyplayer.R; import com.funnyplayer.cache.lrc.LrcProvider; import com.funnyplayer.service.MusicInfo; import com.funnyplayer.ui.adapter.PlaylistAdapter; import com.funnyplayer.util.Consts; import com.funnyplayer.util.MusicUtil; import android.support.v4.app.Fragment; import android.support.v4.app.LoaderManager.LoaderCallbacks; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.provider.BaseColumns; import android.provider.MediaStore.Audio; import android.provider.MediaStore.MediaColumns; import android.provider.MediaStore.Audio.AudioColumns; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ListView; import android.widget.AdapterView.OnItemClickListener; public class PlaylistFragment extends Fragment implements IFragment, OnItemClickListener, LoaderCallbacks<Cursor> { private final static String TAG = "PlaylistFragment"; private ListView mPlayListView; private Cursor mCursor; private PlaylistAdapter mAdapter; private int mMediaIdIndex; private int mTitleIndex; private int mArtistIndex; private LrcProvider mLrcProvider; private String mPlayItemPath; @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mPlayListView = (ListView) getView().findViewById(R.id.playListView); mAdapter = new PlaylistAdapter(getActivity(), R.layout.playlist_item); mPlayListView.setAdapter(mAdapter); mPlayListView.setOnItemClickListener(this); mLrcProvider = LrcProvider.getInstance(getActivity().getApplicationContext()); mPlayItemPath = Consts.TYPE.PLAYLIST.getIndex() + ":" + 0; mAdapter.setPlayItemPath(mPlayItemPath); // Important! getLoaderManager().initLoader(0, null, this); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.inflate(R.layout.playlist, container, false); return root; } private void addPlaylist() { Cursor cursor = mAdapter.getCursor(); if (null == cursor) { return; } List<MusicInfo> infoList = new ArrayList<MusicInfo>(); for (boolean hasNext = cursor.moveToFirst(); hasNext; hasNext = cursor .moveToNext()) { String title = cursor.getString(mTitleIndex); String artist = cursor.getString(mArtistIndex); long mediaId = cursor.getLong(mMediaIdIndex); infoList.add(new MusicInfo(artist, title, mediaId, mPlayItemPath)); } MusicUtil.addPlaylist(getActivity(), infoList); } @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (!mPlayItemPath.equals(MusicUtil.getPlayItemPath())) { MusicUtil.setPlayItemPath(mPlayItemPath); addPlaylist(); MusicUtil.start(getActivity(), position, true); } else { MusicUtil.start(getActivity(), position); } // mAdapter.setSelectItem(position); } @Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { StringBuilder where = new StringBuilder(); where.append(AudioColumns.IS_MUSIC + "=1").append( " AND " + MediaColumns.TITLE + " != ''"); String[] projection = new String[] { BaseColumns._ID, MediaColumns.TITLE, AudioColumns.ALBUM, AudioColumns.ARTIST }; Uri uri = Audio.Media.EXTERNAL_CONTENT_URI; String sortOrder = Audio.Media.DEFAULT_SORT_ORDER; sortOrder = Audio.Media.TRACK + ", " + sortOrder; return new CursorLoader(getActivity(), uri, projection, where.toString(), null, sortOrder); } @Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { // Check for database errors if (data == null) { return; } mMediaIdIndex = data.getColumnIndexOrThrow(BaseColumns._ID); mTitleIndex = data.getColumnIndexOrThrow(MediaColumns.TITLE); mArtistIndex = data.getColumnIndexOrThrow(AudioColumns.ARTIST); mAdapter.setPlaylistIdIndex(mMediaIdIndex); mAdapter.setPlaylistNameIndex(mTitleIndex); mAdapter.setPlaylistArtistIndex(mArtistIndex); mAdapter.changeCursor(data); mCursor = data; } @Override public void onLoaderReset(Loader<Cursor> loader) { if (mAdapter != null) { mAdapter.changeCursor(null); } } @Override public void selectItem(int gridIndex, int itemIndex) { if (null != mPlayListView) { mPlayListView.smoothScrollToPosition(itemIndex); // mPlayListView.setSelection(itemIndex); // mAdapter.setSelectItem(itemIndex); mAdapter.notifyDataSetChanged(); } } }
9f19a2bc592c19deabcc94bb7182bfbe780764fb
3bc16308f1a4740ba4d3458b75f50332146f0c46
/src/main/java/com/rayt/iqs/config/DateTimeFormatConfiguration.java
d8f23d7e9761fe4117614d45327be840fe81261d
[]
no_license
raytabuan/jhipster-iqs-1
65f1b345e79ef0d6ab61f080d62c3c54a5d70fd5
125e186b004ef759f350b757f4d468dde2d82478
refs/heads/master
2021-07-22T17:38:58.704863
2019-10-12T17:14:15
2019-10-12T17:14:15
214,685,481
0
0
null
2020-09-04T00:22:58
2019-10-12T17:14:01
Java
UTF-8
Java
false
false
719
java
package com.rayt.iqs.config; import org.springframework.context.annotation.Configuration; import org.springframework.format.FormatterRegistry; import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; /** * Configure the converters to use the ISO format for dates by default. */ @Configuration public class DateTimeFormatConfiguration implements WebMvcConfigurer { @Override public void addFormatters(FormatterRegistry registry) { DateTimeFormatterRegistrar registrar = new DateTimeFormatterRegistrar(); registrar.setUseIsoFormat(true); registrar.registerFormatters(registry); } }
85ea9f6fc5918883cf8c2aff71ed684e27111f98
7e160416a566a0c7f2de8c3b7bb899db85c5acf2
/comxjtu/src/main/java/com/algorithom4/ch2/InsertSort.java
cc1a5fe27dfc4687b13532f3cd27cef7d5fd1d17
[]
no_license
JayVae/Algorithms-java
03ced94484442a3909c58baff55378b8718cba93
01efc96aaafb48e405d252e126734d16ea421661
refs/heads/master
2023-08-04T09:06:31.025758
2023-07-20T03:15:54
2023-07-20T03:15:54
133,602,614
4
2
null
2022-04-28T10:00:40
2018-05-16T03:01:17
Java
UTF-8
Java
false
false
980
java
package com.algorithom4.ch2; import java.util.Random; /** * @Author: Jay * @Date: Created in 8:51 2018/5/21 * @Modified By: */ public class InsertSort extends BaseSort{ public static void sort(Comparable[] a){ int N = a.length; for (int i = 1; i < N; i++) { for (int j = i; j > 0 && less(a[j],a[j-1]); j--) { exch(a,j,j-1); } } } public static void main(String[] args){ long startTime = System.currentTimeMillis(); Integer[] a= new Integer[500]; Random rand = new Random(); for (int i = 0; i < a.length; i++) { a[i] = rand.nextInt(5000); } assert isSorted(a); show(a); sort(a); assert isSorted(a); show(a); long endTime = System.currentTimeMillis(); //获取结束时间 System.out.println("程序运行时间:" + (endTime - startTime) + "ms"); //输出程序运行时间 } }
10bf562fb15c7100657b2c3ccdf4037ca025aa36
d6de50b783257220adf2612462c164a71000409f
/src/main/java/com/samcancode/dto/IngredientDto.java
840f738472fac3d33063f39e404de3be203aa471
[]
no_license
batspike/spring5-mongo-recipe-app
c2f3b1f66a00884242ba749a0ed5696c0bc9cdcf
1421171eeb84acf529054f17bdf0d805d8025c6c
refs/heads/master
2022-12-07T20:06:36.334275
2020-08-27T01:39:43
2020-08-27T01:39:43
290,233,373
0
0
null
null
null
null
UTF-8
Java
false
false
352
java
package com.samcancode.dto; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import java.math.BigDecimal; @Getter @Setter @NoArgsConstructor public class IngredientDto { private String id; private String recipeId; private String description; private BigDecimal amount; private UnitOfMeasureDto uom; }
892f402c5ecd68b05df3130187038d91ddd9f005
ae21cb4b9759581840e76b05ede4712644937829
/P3/src/Aula4/Cliente.java
07df712240d0b2098636313de60fe413b35b395b
[]
no_license
DanielaSimoes/P3
06c586e7438d0356be544c5b931433d54c5c697f
2fdbfda33fa2afeec78c5da33e6b49b03cb2046d
refs/heads/master
2020-12-11T05:33:57.535087
2016-01-05T16:38:30
2016-01-05T16:38:30
46,982,747
0
0
null
null
null
null
ISO-8859-10
Java
false
false
339
java
package Aula4; public class Cliente extends Pessoa { private static int numSocioAtual = 1; private int numSocio; public Cliente(String nome, int cc, Data dataNasc){ super(nome, cc, dataNasc); this.numSocio = this.numSocioAtual++; } public String toString(){ return super.toString() + " Nž Socio: " + this.numSocio; } }
c4baf089dbfc9d875c97814f6ec5610a5aa73a7b
8a194ad28f11bc74b45482fb0d2a1e5500928624
/src/main/java/com/redhat/brmsdemo/model/Child.java
f4b176502836926e564243e8a0f498454fec4c97
[]
no_license
rafachies/brmsforpartners
8396995e9abc7a0c904164c405c5cc65943aadee
e2af39501d47e64e27618490f0357b6bdc95f866
refs/heads/master
2021-01-25T10:44:06.794509
2013-08-08T13:46:37
2013-08-08T13:46:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
220
java
package com.redhat.brmsdemo.model; public class Child { private Integer parentId; public Integer getParentId() { return parentId; } public void setParentId(Integer parentId) { this.parentId = parentId; } }
5520dfca84c33f0dd56a41d835cf725a1ef2d973
a8ed92e23e5c0462e89ff7b481f7ee6fe0028550
/src/main/java/com/kirana/dao/ShopDaoImpl.java
460a740f0ee4cfd070cfafd37f569f9289a444de
[]
no_license
KiranaServices/KiranaService
683e43a083aa348269ac3c2b493bade0cf558c94
cebc4da592ce4787fb642ecc68cfbea5280ea06b
refs/heads/master
2021-06-03T20:26:17.530213
2015-08-02T15:04:12
2015-08-02T15:04:12
38,926,759
0
1
null
2018-01-05T04:25:55
2015-07-11T13:34:51
JavaScript
UTF-8
Java
false
false
3,299
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.kirana.dao; import com.kirana.model.Shop; import com.kirana.model.User; import java.util.List; import org.apache.log4j.Logger; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.springframework.beans.factory.annotation.Autowired; /** * * @author nikhilvs */ public class ShopDaoImpl implements ShopDao { private static final Logger log = Logger.getLogger(ShopDaoImpl.class); @Autowired SessionFactory sessionFactory; Session session = null; Transaction tx = null; @Override public boolean addEntity(Shop shop) throws Exception { session = sessionFactory.openSession(); tx = session.beginTransaction(); session.save(shop); tx.commit(); session.close(); return false; } @Override public Shop getEntityById(long id) throws Exception { session = sessionFactory.openSession(); Shop shop = (Shop) session.get(Shop.class, new Long(id)); tx = session.getTransaction(); session.beginTransaction(); tx.commit(); session.close(); return shop; } @Override public List<Shop> getEntityList() throws Exception { session = sessionFactory.openSession(); tx = session.beginTransaction(); List<Shop> shopList = session.createCriteria(Shop.class).list(); tx.commit(); session.close(); return shopList; } @Override public boolean deleteEntity(long id) throws Exception { session = sessionFactory.openSession(); Object o = session.load(Shop.class, id); tx = session.getTransaction(); session.beginTransaction(); session.delete(o); tx.commit(); session.close(); return true; } /** * * @param o * @return * @throws Exception */ @Override public boolean updateEntity(Shop o) throws Exception { session = sessionFactory.openSession(); boolean success=false; try { tx = session.beginTransaction(); session.update(o); tx.commit(); success=true; } catch(Exception e) { if (tx!=null) tx.rollback(); throw e; } finally{ session.close(); } return success; } @Override public Shop getShopExistByName(String name) throws Exception { session = sessionFactory.openSession(); Shop shop=null; try { String hql = "FROM Shop where name=:username"; Query query = session.createQuery(hql); query.setParameter("username",name); List u = query.list(); try { shop = (Shop)u.get(0); } catch(IndexOutOfBoundsException ex) { log.warn(ex); } } finally { session.close(); } return shop; } }
006e2b874c604203e97224536558bc512fd4cd65
a22a14404a79c570ebb77386e7962552e7ff022d
/SU_Avinash/src/ams/controller/TakeAttendance.java
c8020239f10f06dd5ebf94f621309caf82ca3b6d
[]
no_license
avinashdash94/College-Management-System
c6c53dabb1835615cf7deed7f83b76c11c43ce96
4dd850be58f7ead324a3c31d6301082365081d34
refs/heads/master
2020-05-22T00:36:06.551717
2019-05-11T19:56:08
2019-05-11T19:56:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,266
java
package ams.controller; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import ams.db.Student; import ams.model.AdminDao; import ams.model.StudentDao; @WebServlet("/ams.controller.TakeAttendance") public class TakeAttendance extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String attendancedate = request.getParameter("attendancedate"); HttpSession session = request.getSession(); session.setAttribute("attendancedate", attendancedate); session.setAttribute("semester", request.getParameter("semester")); session.setAttribute("subject", request.getParameter("subject")); session.setAttribute("branch", request.getParameter("branch")); System.out.println(request.getParameter("attendancedate")); System.out.println(request.getParameter("semester")); System.out.println(request.getParameter("subject")); System.out.println(request.getParameter("branch")); response.sendRedirect("attendance2.jsp"); } }
79b413f9fe38311b2f8e514662a2243bec3a3d4e
db247e947b04928d9a2b10690055621e0b8acae2
/vista-server/web-server/src/main/java/com/lhh/vista/web/common/CORSFilter.java
02830e13f67dde67e1151a8acac93c458aff82b4
[]
no_license
IversonJay/vistaMovie
b86adb237f5142d5fb5fb113c863136293bf3ecf
c2fd451f9207ca62262f2c837cf7e1123f548556
refs/heads/master
2021-05-10T07:37:02.118201
2018-01-25T07:38:53
2018-01-25T07:38:53
118,844,299
0
0
null
null
null
null
UTF-8
Java
false
false
1,356
java
package com.lhh.vista.web.common; import javax.servlet.*; import javax.servlet.http.HttpServletResponse; import java.io.IOException; /** * Created by liu on 2016/12/23. */ public class CORSFilter implements Filter { public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { HttpServletResponse response = (HttpServletResponse) res; // response.setHeader("Access-Control-Allow-Origin", "http://vistacinemas.cn/"); // response.setHeader("Access-Control-Allow-Origin", "*"); response.setHeader("Access-Control-Allow-Origin", "*"); // response.setHeader("Access-Control-Allow-Origin", "http://192.168.31.153:9911"); // response.setHeader("Access-Control-Allow-Origin", "http://192.168.0.115:9911"); //response.setHeader("Access-Control-Allow-Origin", "http://192.168.0.106:9911"); response.setHeader("-Allow-MeAccess-Controlthods", "POST, GET"); response.setHeader("Access-Control-Max-Age", "3600"); response.addHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); response.setHeader("Access-Control-Allow-Credentials", "true"); chain.doFilter(req, res); } public void init(FilterConfig filterConfig) { } public void destroy() { } }
77244b7a59d1ce5bb97f3ea2f7cd154d5046ef5d
669bb51cf055bc067fe22fece111911f6898cb79
/src/main/java/e73/E73ProductMain.java
092973946938ae349bfe3f09a0ae9336a3cd60f4
[]
no_license
nurulatiqah/ExerciseWeek1
e504c913e0b5a630d5d8adfdb65a0844462ef076
b7a198a8018f03ed484f4ae464c6d124c05b3d26
refs/heads/master
2021-01-17T07:32:17.746004
2017-03-03T04:13:23
2017-03-03T04:13:23
83,756,304
0
0
null
null
null
null
UTF-8
Java
false
false
215
java
package e73; /** * @author nurulatiqahali * */ public class E73ProductMain { public static void main(String[] args) { E73Product products = new E73Product("Banana", 1.1, 13); products.printProduct(); } }
b16c9587fc672a2fcf403b82479fc4373499d2f4
5cc4122d11db3cf36f68cbf3e5717ea6e15c1e5a
/presto-spark-base/src/test/java/com/facebook/presto/spark/TestPrestoSparkAbstractTestAggregations.java
b64152460a898efb8859cc86a422dd11dc20cd89
[ "Apache-2.0" ]
permissive
twitter-forks/presto
109cfc4b1e06ad1dd18e13d27bd1c3dc9e349ef9
4d927e42ac480f159c9958dcd40e565d21a1cfd1
refs/heads/twitter-master
2023-06-24T01:48:12.691854
2020-09-17T07:46:55
2020-10-01T05:42:14
41,683,679
26
19
Apache-2.0
2023-06-16T23:36:50
2015-08-31T15:28:01
Java
UTF-8
Java
false
false
992
java
/* * 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.facebook.presto.spark; import com.facebook.presto.tests.AbstractTestAggregations; import static com.facebook.presto.spark.PrestoSparkQueryRunner.createHivePrestoSparkQueryRunner; public class TestPrestoSparkAbstractTestAggregations extends AbstractTestAggregations { public TestPrestoSparkAbstractTestAggregations() { super(PrestoSparkQueryRunner::createHivePrestoSparkQueryRunner); } }
1d4ae653c576467b0d63a2c9249b0f5ff89ac837
298fc1ca8939ce06477213c1421a7d1e6bdbd78c
/src/ladder/binarysearch/FindMinimumInRotatedSortedArrayII.java
211902529d0aa328a2833ab9d34fc5159abd7782
[]
no_license
AndyLi07/JavaALG
a081bdff829d3f942164e704eacdf66ab50bcb03
79bd29bfdce5dae523b477a4d67d7a041a454ff5
refs/heads/master
2021-01-17T07:15:46.177180
2016-06-02T15:32:40
2016-06-02T15:32:40
54,170,137
0
0
null
null
null
null
UTF-8
Java
false
false
1,118
java
package ladder.binarysearch; /** * Suppose a sorted array is rotated at some pivot unknown to you beforehand. * (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). * * Find the minimum element. * The array may contain duplicates. * * Given [4,4,5,6,7,0,1,2] return 0 */ public class FindMinimumInRotatedSortedArrayII { /** * @param num: a rotated sorted array * @return: the minimum number in the array */ public int findMin(int[] num) { // write your code here if (num == null || num.length == 0) { return -1; } // worst case: 1, 1, 1, 1, 0, 1, 1, 1 cannot use binary search, have to go through all element => O(n), same as using for loop int min = num[0]; for (int i = 1; i < num.length; i++) { if (num[i] < min) { min = num[i]; } } return min; } public static void main(String[] args) { int[] num = {4,4,5,6,7,0,1,2}; FindMinimumInRotatedSortedArrayII sol = new FindMinimumInRotatedSortedArrayII(); System.out.println(sol.findMin(num)); } }
6cc0d09ce81857af0b32c41ec56dc01dab700e65
bc6bf660e51540e01cae2816bc4a7d3d82e6c51f
/References/Core/GUI/Source/mjs/core/components/IDGenerator.java
fc4c47b61ece4b61c4d643bbedf68034d63e38ca
[]
no_license
mjshoemake/shoemake-home
1c0296c7b0756251f88d4ab2922310302c096cf5
6b8624264c2f62e8a6a9066dd4b81872a4fd7d19
refs/heads/master
2021-01-24T06:36:00.149632
2012-11-19T20:22:49
2012-11-19T20:22:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,277
java
// // file: WSIDGenerator.java // desc: // proj: ER 6.1 // // $Archive: N:/REPOS/Archives/eQuality/web/java/com/witsys/common/core/components/IDGenerator.java-arc $ // $Author:Mike Shoemake$ // $Revision:7$ // // Copyright (c) 2000 by Witness Systems, Inc. // All rights reserved. // ///////////////////////////////////////////////////////////////////////////// package mjs.core.components; // Java imports import java.util.*; // Witness imports import mjs.core.messages.Message; import mjs.core.messages.MessageDialogHandler; import mjs.core.messages.MessageFactory; import mjs.core.strings.InternationalizationStrings; import mjs.core.utils.ComponentUtils; /** * WSIDGenerator generates unique IDs for the baseclass components. * The unique IDs are generated based on the current time and a 4-digit random number. * @author Roshen Chandran * @version 1.1 * @date 1/18/2000 */ public class IDGenerator { /** * The calendar object. This ID generated will be based on the current date and time. */ private static Calendar calendar = Calendar.getInstance(); /** * The most recent ID that was generated. */ private static long lPreviousId = 0; /** * The upper limit. This is used by the random number generator. */ private static final int UPPER_LIMIT_INT = 999; /** * Generate the randomizer. */ private static Random random = new Random(calendar.getTime().getTime()); /** * Generate the ID. */ public static long generateID() { long lNewId = -1; calendar = Calendar.getInstance(); try { // Get numeric representation of the year, month, day, hour, minute, and second. int nYear = calendar.get(Calendar.YEAR); int nMonth = calendar.get(Calendar.MONTH); int nDay = calendar.get(Calendar.DAY_OF_MONTH); int nHour = calendar.get(Calendar.HOUR_OF_DAY); int nMin = calendar.get(Calendar.MINUTE); int nSec = calendar.get(Calendar.SECOND); lPreviousId += 1; if (lPreviousId > UPPER_LIMIT_INT) { // Reset the counter. lPreviousId = 0; } // Get a String representation of the day, hour, minute, and second. String sYear = Integer.toString(nYear); String sMonth = Integer.toString(nMonth); String sDay = Integer.toString(nDay); String sHour = Integer.toString(nHour); String sMin = Integer.toString(nMin); String sSec = Integer.toString(nSec); String sPrev = Long.toString(lPreviousId); // Concatonate the String values. String id = sYear + sMonth + sDay + sHour + sMin + sSec + sPrev; // Convert the new ID to a long. lNewId = Long.parseLong(id); return lNewId; } catch (java.lang.Exception e) { // Create message object Message message = MessageFactory.createMessage( 10410, "Balance", "Evaluations", e.getMessage(), Message.INTERNAL, InternationalizationStrings.COMMON_RESOURCE_CLASS, mjs.core.utils.ComponentUtils.getLocale() ); // Display message MessageDialogHandler.showMessage( message, null, "IDGenerator" ); } return lNewId; } /** * Generate the new number. */ public static long getRandomNumber() { // Get a random number less than 10,000 calendar = Calendar.getInstance(); random = new Random(calendar.getTime().getTime()); return random.nextInt(UPPER_LIMIT_INT); } // TOGETHER DIAGRAM DEPENDENCIES. // PLEASE DO NOT REMOVE. /** * @link dependency */ /*# MessageDialogHandler lnkMessageDialogHandler; */ /** * @link dependency */ /*# InternationalizationStrings lnkInternationalizationStrings; */ }
d65a20c0a60b398a454fcd383fadfea957c1f8fc
59d698b3477aa50242412f9b50ffdcbd9d1b0517
/1730 Shortest Path to Get Food .java
cf6ee578001cf28f99f1680b1a0fc172048cbb65
[]
no_license
sanjibbaral435/LeetcodePractice
d76006159af58e7f3c70fe27fa98f46a2d228ae5
54248ca96f87dddd4a73e0376473bd49bc103e6e
refs/heads/master
2021-10-27T21:35:36.800297
2021-10-26T01:22:19
2021-10-26T01:22:19
133,789,030
0
0
null
null
null
null
UTF-8
Java
false
false
1,735
java
class Solution { public int getFood(char[][] grid) { if(grid.length == 0) return 0; int row = grid.length; int col = grid[0].length; boolean[][] dp = new boolean[row][col]; int[] xRows = new int[]{0,1,0,-1}; int[] yRows = new int[]{1,0,-1,0}; Queue<int[]> q = new LinkedList<>(); q.add(findStart(grid)); int step = 0; while(!q.isEmpty()) { // do a BFS from the queue elements int len = q.size(); for(int i=0; i<len; i++) { int[] item = q.poll(); int x = item[0]; int y = item[1]; if(grid[x][y] == '#') return step; for(int j=0; j<4; j++) { // traverse in all directions int xInd = x + xRows[j]; int yInd = y + yRows[j]; if(isValid(grid, xInd, yInd) && !dp[xInd][yInd]) { dp[xInd][yInd] = true; q.offer(new int[]{xInd, yInd}); } } } step++; // in each bfs level increase step 1, that's the distance we cover in each round } return -1; } private int[] findStart(char[][] grid){ for(int i=0; i < grid.length; i++){ for(int j=0; j < grid[0].length; j++){ if(grid[i][j] == '*'){ return new int[]{i, j}; } } } throw new RuntimeException(); } private boolean isValid(char[][] grid, int i, int j){ return i >= 0 && i < grid.length && j >= 0 && j < grid[0].length && grid[i][j] != 'X'; } }
83325a957777cb19080da78c218c7ad58fe329f6
7276bf166be74ee9244bbaf6b02330e2d33bd0ca
/osa03-Osa03_32.SanatRiveittain/src/main/java/SanatRiveittain.java
9bc98fc7326ab1c83744e477471fdd3d2513b9b7
[]
no_license
mjHarakka/JavaMOOC_2019
35a01cd8f609ba3699f3fafbd50708e13fcd695f
45a11fc71829fbb5104e342917cec5e47a80dd5f
refs/heads/master
2020-04-23T04:14:28.577050
2019-05-15T20:44:27
2019-05-15T20:44:27
170,902,584
1
0
null
null
null
null
UTF-8
Java
false
false
481
java
import java.util.Scanner; public class SanatRiveittain { public static void main(String[] args) { Scanner lukija = new Scanner(System.in); while (true) { String syote = lukija.nextLine(); if (syote.equals("")) { break; } String[] sanat = syote.split(" "); for (String sana: sanat) { System.out.println(sana); } } } }
2389bf40f5c034939f4c834bf88a4317c1e6bb27
9d13742df806e06f6548063a17bd67a9cad03468
/src/main/java/com/snake1999/remix/ballgame/math/GameBoundingBox.java
2e216a2378eca05f7b9d62d89043f8e52e25f7bf
[]
no_license
Snake1999/CrankyCrazyCrasher
6ec00e09fb289a2bb08b901278770b90877c28e2
28dc0836a521d1b168794bbd0dadc6639ad08b2b
refs/heads/master
2021-01-17T17:52:25.846296
2016-09-30T03:56:19
2016-09-30T03:56:19
69,531,191
0
0
null
null
null
null
UTF-8
Java
false
false
184
java
package com.snake1999.remix.ballgame.math; /** * Created by Lin Mulan on 2016/9/29 0029. */ public interface GameBoundingBox { boolean isCollidedWith(GameBoundingBox other); }
ff7c2ea17406dde135482d5c4a97cda636a1bff4
e4df275bb068565f6a20a886f59b05b3bd1323f0
/jornada_parent/jornada_commons/src/main/java/com/winston/jornada/entity/MotoristaAfastamento.java
fc03e3430fb0ddaab01410069ee7dd9f181c4c56
[]
no_license
winstontransp/jornada
c333211b3fffbe585e713b59748376651e40d622
3a18bd7023f1494200345d2e30d7e47288611508
refs/heads/master
2016-09-16T13:29:27.656348
2015-09-14T12:05:50
2015-09-14T12:05:50
35,241,469
1
0
null
null
null
null
UTF-8
Java
false
false
3,867
java
package com.winston.jornada.entity; import java.util.Date; import javax.persistence.Access; import javax.persistence.AccessType; 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.ManyToOne; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import org.apache.myfaces.extensions.validator.crossval.annotation.RequiredIf; import org.apache.myfaces.extensions.validator.crossval.annotation.RequiredIfType; import org.hibernate.annotations.ForeignKey; import com.powerlogic.jcompany.commons.config.stereotypes.SPlcEntity; import com.powerlogic.jcompany.domain.validation.PlcValGroupEntityList; @SPlcEntity @Entity @Table(name = "MOTORISTA_AFASTAMENTO") @SequenceGenerator(name = "SE_MOTORISTA_AFASTAMENTO", sequenceName = "SE_MOTORISTA_AFASTAMENTO") @Access(AccessType.FIELD) @NamedQueries({ @NamedQuery(name="MotoristaAfastamento.querySelLookup", query="select id as id, inicio as inicio from MotoristaAfastamento where id = ? order by id asc"), @NamedQuery(name="MotoristaAfastamento.querySelByFaixa", query="select f.id as id, f.inicio as inicio, f.termino as termino, f.motorista as motorista, f.motivo as motivo from MotoristaAfastamento f where f.sitHistoricoPlc = 'A' and (" + "(:inicio <= inicio and termino <= :termino) or " + "(:inicio >= inicio and termino <= :termino) or " + "(:inicio <= inicio and termino >= :termino) or " + "(:inicio >= inicio and termino >= :termino)) ")}) public class MotoristaAfastamento extends AppBaseEntity { @Id @GeneratedValue(strategy = GenerationType.AUTO, generator = "SE_MOTORISTA_AFASTAMENTO") private Long id; @ManyToOne(targetEntity = Motorista.class, fetch = FetchType.LAZY) @ForeignKey(name = "FK_MOTORISTAFERIAS_MOTORISTA") private Motorista motorista; @NotNull(groups = PlcValGroupEntityList.class) @RequiredIf(valueOf = "id", is = RequiredIfType.not_empty) @Temporal(TemporalType.TIMESTAMP) private Date inicio; @NotNull(groups = PlcValGroupEntityList.class) @RequiredIf(valueOf = "inicio", is = RequiredIfType.not_empty) @Temporal(TemporalType.TIMESTAMP) private Date termino; @Enumerated(EnumType.STRING) @NotNull @Column(length = 1) private MotivoAfastamento motivo; @NotNull @Size(max = 1) private String sitHistoricoPlc = "A"; public MotoristaAfastamento() { } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Date getInicio() { return inicio; } public void setInicio(Date inicio) { this.inicio = inicio; } public Date getTermino() { return termino; } public void setTermino(Date termino) { this.termino = termino; } public Motorista getMotorista() { return motorista; } public void setMotorista(Motorista motorista) { this.motorista = motorista; } public MotivoAfastamento getMotivo() { return motivo; } public void setMotivo(MotivoAfastamento motivo) { this.motivo = motivo; } @Override public String toString() { return getInicio().toString(); } @Transient private String indExcPlc = "N"; public void setIndExcPlc(String indExcPlc) { this.indExcPlc = indExcPlc; } public String getIndExcPlc() { return indExcPlc; } public String getSitHistoricoPlc() { return sitHistoricoPlc; } public void setSitHistoricoPlc(String sitHistoricoPlc) { this.sitHistoricoPlc = sitHistoricoPlc; } }
81682ccd35f1a6d320949860c9f4bf0320712d9c
3247360ea20edce37f6f2ab727a403644bd44497
/bitcamp-java-basic/src/main/java/ch22/c/ex3/Test03_3.java
0ca74f1e609a74779a5d0b296de7f7910973c484
[]
no_license
choitaehoon1998/bitcamp-java-20190527
57b1774d50f245b0b77016f0ae541710233010b6
2450c3042642df3eae2fc896e12c376c7d27b048
refs/heads/master
2020-06-13T20:17:08.537015
2019-10-15T12:30:20
2019-10-15T12:30:20
194,775,340
0
0
null
2020-04-30T11:45:18
2019-07-02T02:41:02
Java
UTF-8
Java
false
false
1,000
java
// 데코레이터를 여러 개 연결하기 package ch22.c.ex3; import java.io.FileOutputStream; public class Test03_3 { public static void main(String[] args) { // 데코레이터 디자인 패턴의 장점은 // => 기능을 붙이고 떼기가 쉽다. // try (FileOutputStream out = new FileOutputStream("data.bin"); // 버퍼 데코레이터를 붙인다. => 출력 속도 빨라진다. BufferedOutputStream out1 = new BufferedOutputStream(out); // primitive type 변환 데코레이터를 붙인다 => 특정 타입의 값을 출력하기 편하다. DataOutputStream out2 = new DataOutputStream(out1)) { int no = 200; String name = "ABC가각간갇갈"; int age = 30; out2.writeInt(no); out2.writeUTF(name); out2.writeInt(age); out2.flush(); } catch (Exception e) { e.printStackTrace(); } System.out.println("출력 완료!"); } }
7ec1cfce8930b6748738d7c89eeaa78e9731389b
082edb7b6553d0c12cfdb7658efee2a22bad68e7
/src/notepad/Developer.java
c0eb8f46040528f8a757b7d03517a017d7eac499
[]
no_license
YodiYanwar/SimpleNotepadApp
e06124a51d0d4d95324fbb18f144628c163a9687
e8a16c5ecd0764baf12a3af67fcc48c0f022dc0a
refs/heads/master
2020-04-06T07:07:17.282595
2014-05-25T12:12:40
2014-05-25T12:12:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
16,375
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 notepad; //<editor-fold defaultstate="collapsed" desc="import Class"> import java.awt.Desktop; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import javax.swing.ImageIcon; //</editor-fold> /** * * @author YODI YANWAR */ public class Developer extends javax.swing.JFrame { /** * Creates new form Developer */ //<editor-fold defaultstate="collapsed" desc="Constructor"> public Developer() { icon(); initComponents(); setLocationRelativeTo(this); } //</editor-fold> /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); facebook = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); setTitle("Me"); setAlwaysOnTop(true); setResizable(false); jPanel1.setBackground(new java.awt.Color(255, 255, 255)); jLabel1.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N jLabel1.setText("Find me on"); facebook.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/facebook (1).png"))); // NOI18N facebook.setToolTipText("Facebook"); facebook.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { facebookMouseClicked(evt); } }); jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/github.png"))); // NOI18N jLabel3.setToolTipText("Github"); jLabel3.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel3MouseClicked(evt); } }); jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/twitter.png"))); // NOI18N jLabel4.setToolTipText("Twitter"); jLabel4.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel4MouseClicked(evt); } }); jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/g+ 128X128.png"))); // NOI18N jLabel5.setToolTipText("Google+"); jLabel5.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel5MouseClicked(evt); } }); jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/pinterest_alt.png"))); // NOI18N jLabel6.setToolTipText("Pinterest"); jLabel6.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel6MouseClicked(evt); } }); jLabel7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Tumblr alt.png"))); // NOI18N jLabel7.setToolTipText("Tumblr"); jLabel7.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel7MouseClicked(evt); } }); jLabel8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/128x128-linkedin.png"))); // NOI18N jLabel8.setToolTipText("LinkedIn"); jLabel8.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel8MouseClicked(evt); } }); jLabel9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/digg.png"))); // NOI18N jLabel9.setToolTipText("Digg"); jLabel9.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel9MouseClicked(evt); } }); jLabel10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/flickr2.png"))); // NOI18N jLabel10.setToolTipText("Flickr"); jLabel10.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel10MouseClicked(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(21, 21, 21) .addComponent(jLabel1)) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(17, 17, 17) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel6)) .addGap(10, 10, 10) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(15, 15, 15) .addComponent(jLabel8)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel7) .addGap(10, 10, 10) .addComponent(jLabel10)))) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addComponent(facebook) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel4) .addGap(10, 10, 10) .addComponent(jLabel5))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel1) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel4) .addComponent(facebook)) .addGap(15, 15, 15) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGap(18, 18, 18) .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel10) .addComponent(jLabel7))))) .addComponent(jLabel8))) .addComponent(jLabel5)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void facebookMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_facebookMouseClicked // TODO add your handling code here: String linkFb = "https://www.facebook.com/yodieys.yodzz"; link(linkFb); }//GEN-LAST:event_facebookMouseClicked private void jLabel4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel4MouseClicked // TODO add your handling code here: String linkTwitter = "https://twitter.com/yodieys13"; link(linkTwitter); }//GEN-LAST:event_jLabel4MouseClicked private void jLabel5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel5MouseClicked // TODO add your handling code here: String linkgplus = "https://plus.google.com/100527086498542086726/posts"; link(linkgplus); }//GEN-LAST:event_jLabel5MouseClicked private void jLabel3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel3MouseClicked // TODO add your handling code here: String linkGitHub = "https://github.com/YodiYanwar"; link(linkGitHub); }//GEN-LAST:event_jLabel3MouseClicked private void jLabel6MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel6MouseClicked // TODO add your handling code here: String linkPinterest = "http://www.pinterest.com/semutpintaryodi/"; link(linkPinterest); }//GEN-LAST:event_jLabel6MouseClicked private void jLabel8MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel8MouseClicked // TODO add your handling code here: String linkLinkedIn = "http://www.linkedin.com/profile/view?id=324979333&trk=nav_responsive_tab_profile"; link(linkLinkedIn); }//GEN-LAST:event_jLabel8MouseClicked private void jLabel9MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel9MouseClicked // TODO add your handling code here: String linkDigg = "digg.com"; link(linkDigg); }//GEN-LAST:event_jLabel9MouseClicked private void jLabel10MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel10MouseClicked // TODO add your handling code here: String linkTumblr = "https://www.tumblr.com/blog/yodieys"; link(linkTumblr); }//GEN-LAST:event_jLabel10MouseClicked private void jLabel7MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel7MouseClicked // TODO add your handling code here: String linkFlickr = "https://www.flickr.com/photos/124102218@N07/"; link(linkFlickr); }//GEN-LAST:event_jLabel7MouseClicked /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Developer.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Developer.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Developer.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Developer.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Developer().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel facebook; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel1; // End of variables declaration//GEN-END:variables //<editor-fold defaultstate="collapsed" desc="Method icon()"> public void icon(){ ImageIcon ico = new ImageIcon("src/images/comments.png"); setIconImage(ico.getImage()); } //</editor-fold> //<editor-fold defaultstate="collapsed" desc="Method link()"> private void link(String hyperlink) { if (Desktop.isDesktopSupported()) { Desktop desktop = Desktop.getDesktop(); try { URI uri = new URI(hyperlink); desktop.browse(uri); } catch (IOException ex) { ex.printStackTrace(); } catch (URISyntaxException ex) { ex.printStackTrace(); } } } //</editor-fold> }
12ba14102a92e8e29ba636a170e555fb7615d549
1a32d704493deb99d3040646afbd0f6568d2c8e7
/BOOT-INF/lib/org/springframework/web/context/annotation/ApplicationScope.java
6f8371e5ee3e70cf9d6eb4fc4755d8163f70e681
[]
no_license
yanrumei/bullet-zone-server-2.0
e748ff40f601792405143ec21d3f77aa4d34ce69
474c4d1a8172a114986d16e00f5752dc019cdcd2
refs/heads/master
2020-05-19T11:16:31.172482
2019-03-25T17:38:31
2019-03-25T17:38:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
989
java
package org.springframework.web.context.annotation; import java.lang.annotation.Annotation; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.ScopedProxyMode; import org.springframework.core.annotation.AliasFor; @Target({java.lang.annotation.ElementType.TYPE, java.lang.annotation.ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @Documented @Scope("application") public @interface ApplicationScope { @AliasFor(annotation=Scope.class) ScopedProxyMode proxyMode() default ScopedProxyMode.TARGET_CLASS; } /* Location: C:\Users\ikatwal\Downloads\bullet-zone-server-2.0.jar!\BOOT-INF\lib\spring-web-4.3.14.RELEASE.jar!\org\springframework\web\context\annotation\ApplicationScope.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
b329b67971e2b68aeab85b7edf21f20327870896
19df1fd3cddd8be96d24fb2c06a222dc73af5f2f
/src/Graph/model/Ring.java
a8331ffd07e3c6c8c2b31a7b6d9e2941f1f441fb
[]
no_license
HDDung/Consensus
5edec1b09096179390aa9202ad2ca76f8cdaf2b2
a914fb94ab4b02035423ccdea6d6022fba71475f
refs/heads/master
2021-01-13T03:37:24.619805
2016-12-24T10:56:50
2016-12-24T10:56:50
77,279,098
0
1
null
null
null
null
UTF-8
Java
false
false
549
java
package Graph.model; import Graph.Graph; import Graph.GraphNode; public class Ring extends Graph { private GraphNode[] Rings; public Ring(int NumbNodes){ Rings = new GraphNode[NumbNodes]; GraphNode node = Rings[0] = new GraphNode(); for (int i = 1; i < NumbNodes; i++) { GraphNode next = new GraphNode(); node.Add(next); Rings[i] = node = next; } node.Add(Rings[0]); SetCentralNode(Rings[0]); Invalidate(); SetName("Ring graph " + NumbNodes); } public GraphNode MapAt(int index) { return Rings[index]; } }
[ "1qsc$ESZAWdx" ]
1qsc$ESZAWdx
a987f7e5009c73e236a5bf4dfac2fba66241320e
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/11/11_dfbc217fdc7651b6ec1ea1acaa60121b4cf8e427/ConstraintBasedConsumer/11_dfbc217fdc7651b6ec1ea1acaa60121b4cf8e427_ConstraintBasedConsumer_s.java
dc92dbb6b960d780eaa2ce4c38636329949b4229
[]
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
2,327
java
/* * Copyright (C) 2012 Fabian Hirschmann <[email protected]> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package com.github.fhirschmann.clozegen.lib.component.api; import com.github.fhirschmann.clozegen.lib.constraint.api.ConstraintProvider; import com.github.fhirschmann.clozegen.lib.util.UIMAUtils; import org.apache.uima.analysis_engine.AnalysisEngineProcessException; import org.apache.uima.cas.FSMatchConstraint; import org.apache.uima.jcas.JCas; import org.uimafit.component.JCasAnnotator_ImplBase; import org.uimafit.component.JCasConsumer_ImplBase; import org.uimafit.descriptor.ExternalResource; /** * This is equal to {@link AbstractAnnotator}, except that this class extends * {@link JCasConsumer_ImplBase} instead of {@link JCasAnnotator_ImplBase}. * * @author Fabian Hirschmann <[email protected]> */ public abstract class ConstraintBasedConsumer extends JCasConsumer_ImplBase implements ConstraintProvider, GapProcessor { /** * <em>[mandatory]</em> * * A constraint which limits the words the generator is called for. * * @see com.github.fhirschmann.clozegen.lib.constraint */ public static final String CONSTRAINT_KEY = "Constraint"; @ExternalResource(key = CONSTRAINT_KEY, mandatory = true) private ConstraintProvider constraint; @Override public void process(final JCas aJCas) throws AnalysisEngineProcessException { UIMAUtils.annotationCaller(aJCas, getConstraint(), this); } @Override public FSMatchConstraint getConstraint() { return constraint.getConstraint(); } }
33e2ff5627834e96df528c9345440eae3b60b266
aafaa1433f8f369a60eeb85569204ced8d195c8b
/src/main/java/br/com/felipe/login/web/rest/handler/ApplicationExceptionHandler.java
7ed34fe1437432c639d64fcdd9f988b578c833af
[]
no_license
DanSilva41/login
bcc557d8dabba197595f15a0753d16537ddcc9ec
eb63067b0fd46fee2f5cb08227e10b1ecef7ff7a
refs/heads/master
2023-02-27T01:40:26.405674
2021-02-03T16:18:46
2021-02-03T16:18:46
335,681,901
0
0
null
null
null
null
UTF-8
Java
false
false
6,092
java
package br.com.felipe.login.web.rest.handler; import br.com.felipe.login.support.enums.ApplicationMessageCode; import br.com.felipe.login.support.exception.BadRequestException; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NonNull; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.exception.ExceptionUtils; import org.springframework.context.MessageSource; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.http.converter.HttpMessageNotReadableException; import org.springframework.validation.BindingResult; import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.context.request.WebRequest; import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; import javax.validation.ConstraintViolationException; import java.util.ArrayList; import java.util.Collections; import java.util.List; @Slf4j @AllArgsConstructor @ControllerAdvice public class ApplicationExceptionHandler extends ResponseEntityExceptionHandler { private final MessageSource messageSource; @Override protected ResponseEntity<Object> handleHttpMessageNotReadable(HttpMessageNotReadableException ex, @NonNull HttpHeaders headers, @NonNull HttpStatus status, @NonNull WebRequest request) { String userMessage = messageSource.getMessage(ApplicationMessageCode.INVALID_REQUEST.toString(), null, LocaleContextHolder.getLocale()); String developerMessage = ex.getCause() != null ? ex.getCause().toString() : ex.toString(); List<ApiError> apiErrors = Collections.singletonList(new ApiError(userMessage, developerMessage)); return handleExceptionInternal(ex, apiErrors, headers, HttpStatus.BAD_REQUEST, request); } @Override protected ResponseEntity<Object> handleMethodArgumentNotValid(MethodArgumentNotValidException ex, @NonNull HttpHeaders headers, @NonNull HttpStatus status, @NonNull WebRequest request) { List<ApiError> errors = createListErrors(ex.getBindingResult()); return handleExceptionInternal(ex, errors, headers, HttpStatus.BAD_REQUEST, request); } @ExceptionHandler(ConstraintViolationException.class) ResponseEntity<Object> handleConstraintViolationException(ConstraintViolationException ex, WebRequest request) { String userMessage = messageSource.getMessage(ApplicationMessageCode.INVALID_REQUEST.toString(), null, LocaleContextHolder.getLocale()); String developerMessage = ex.toString(); List<ApiError> apiErrors = Collections.singletonList(new ApiError(userMessage, developerMessage)); return handleExceptionInternal(ex, apiErrors, new HttpHeaders(), HttpStatus.NOT_FOUND, request); } @ExceptionHandler({EmptyResultDataAccessException.class}) public ResponseEntity<Object> handleEmptyResultDataAccessException(EmptyResultDataAccessException ex, WebRequest request) { String userMessage = messageSource.getMessage(ApplicationMessageCode.INVALID_REQUEST.toString(), null, LocaleContextHolder.getLocale()); String developerMessage = ex.toString(); List<ApiError> apiErrors = Collections.singletonList(new ApiError(userMessage, developerMessage)); return handleExceptionInternal(ex, apiErrors, new HttpHeaders(), HttpStatus.NOT_FOUND, request); } @ExceptionHandler({DataIntegrityViolationException.class}) public ResponseEntity<Object> handleDataIntegrityViolationException(DataIntegrityViolationException ex, WebRequest request) { log.info("Throw exception:\n {0}", ex); String userMessage = messageSource.getMessage(ApplicationMessageCode.INVALID_REQUEST.toString(), null, LocaleContextHolder.getLocale()); String developerMessage = ExceptionUtils.getRootCauseMessage(ex); List<ApiError> apiErrors = Collections.singletonList(new ApiError(userMessage, developerMessage)); return handleExceptionInternal(ex, apiErrors, new HttpHeaders(), HttpStatus.BAD_REQUEST, request); } @ExceptionHandler({BadRequestException.class}) public ResponseEntity<Object> handleBadRequestException(BadRequestException ex, WebRequest request) { log.info("Throw exception:\n {0}", ex); String userMessage = ex.getMessage(); String developerMessage = ExceptionUtils.getRootCauseMessage(ex); List<ApiError> apiErrors = Collections.singletonList(new ApiError(userMessage, developerMessage)); return handleExceptionInternal(ex, apiErrors, new HttpHeaders(), HttpStatus.BAD_REQUEST, request); } private List<ApiError> createListErrors(BindingResult bindingResult) { List<ApiError> apiErrors = new ArrayList<>(0); bindingResult.getFieldErrors().forEach(fieldError -> { String userMessage = messageSource.getMessage(fieldError, LocaleContextHolder.getLocale()); String developerMessage = fieldError.toString(); apiErrors.add(new ApiError(userMessage, developerMessage)); }); return apiErrors; } @Getter public static class ApiError { private final String userMessage; private final String developerMessage; ApiError(String userMessage, String mensagemDesenvolvimento) { this.userMessage = userMessage; this.developerMessage = mensagemDesenvolvimento; } } }
c3fbebf63d7a13cf7021a2c325df8127c17002cd
79347441fd200f2a4af039598aaa8e45702ad879
/homework02/StringStuffTester.java
0e5ed34acf810623ceacba4ce8c3a97724e06798
[]
no_license
kevinusername/CMSI_186_Projects
68b9ca0cf99c6f43f33f8baab444e47aba95c816
675bbc8f037101561d5a1d78c9712e57e2962541
refs/heads/master
2021-09-13T23:53:09.827916
2018-05-06T04:57:55
2018-05-06T04:57:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
21,824
java
/** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * File name : StringStuffTester.java * Purpose : A test harness file for testing out the methods in the "StringStuff.java" class * Author : B.J. Johnson * Date : 2017-01-25 * Description : This file provides the "test harness" for checking out the methods which are part of * the homework02 assignment. It also provides examples of proper documentation, and * uses the source file header template as specified in the "Greeter.java" template file * for use in CMSI 186, Spring 2017. * Notes : TEMPLATE FILE ONLY: Your job is to fill in as many test cases as you think are needed * to thoroughly and completely test your StringStuff class. * Warnings : None * Exceptions : None * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Revision History * ---------------- * Rev Date Modified by: Reason for change/modification * ----- ---------- ------------ ----------------------------------------------------------- * @version 1.0.0 2017-01-25 B.J. Johnson Initial writing and release * @version 2.0.0 2017-02-08 B.J. Johnson Added code to run tests, based on CalendareStuffTester.java * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ public class StringStuffTester { /** * the main method which calls all of the test methods in the class * @param args String[] array containing command line parameters * @return void */ public static void main ( String [] args ) { System.out.println( "\nA TOTAL OF SIXTY-SEVEN TESTS TO CHECK OPERATION OF THE STRINGSTUFF CLASS METHODS"); test_containsVowel(); // fourteen tests test_isPalindrome(); // eight tests test_evensOnly(); // fill in how many tests test_oddsOnly(); // fill in how many tests test_evensOnlyNoDupes(); // fill in how many tests test_oddsOnlyNoDupes(); // fill in how many tests test_reverse(); // fill in how many tests //test_removeDupes(); // fill in how many tests } /** * test method to test out the operation of the containsVowel method */ public static void test_containsVowel() { System.out.println( "\nFIFTEEN TESTS FOR containsVowel():" ); System.out.print( " Test for all lowercase vowels: " ); try { System.out.println( StringStuff.containsVowel( "The quick brown fox." ) ? "true" : "false" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Test for all uppercase vowels: " ); try { System.out.println( StringStuff.containsVowel( "JUMPED OVER THE LAZY DOG." ) ? "true" : "false" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Test for detecting lowercase 'a': " ); try { System.out.println( StringStuff.containsVowel( "a" ) ? "true" : "false" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Test for detecting uppercase 'A': " ); try { System.out.println( StringStuff.containsVowel( "A" ) ? "true" : "false" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Test for detecting lowercase 'e': " ); try { System.out.println( StringStuff.containsVowel( "e" ) ? "true" : "false" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Test for detecting uppercase 'E': " ); try { System.out.println( StringStuff.containsVowel( "E" ) ? "true" : "false" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Test for detecting lowercase 'i': " ); try { System.out.println( StringStuff.containsVowel( "i" ) ? "true" : "false" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Test for detecting uppercase 'I': " ); try { System.out.println( StringStuff.containsVowel( "I" ) ? "true" : "false" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Test for detecting lowercase 'o': " ); try { System.out.println( StringStuff.containsVowel( "o" ) ? "true" : "false" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Test for detecting uppercase 'O': " ); try { System.out.println( StringStuff.containsVowel( "O" ) ? "true" : "false" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Test for detecting lowercase 'u': " ); try { System.out.println( StringStuff.containsVowel( "u" ) ? "true" : "false" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Test for detecting uppercase 'U': " ); try { System.out.println( StringStuff.containsVowel( "U" ) ? "true" : "false" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Test for detecting lowercase 'y': " ); try { System.out.println( StringStuff.containsVowel( "y" ) ? "true" : "false" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Test for detecting uppercase 'Y': " ); try { System.out.println( StringStuff.containsVowel( "Y" ) ? "true" : "false" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Test for detecting there are none: " ); try { System.out.println( StringStuff.containsVowel( "bdBDBDbd" ) ? "true" : "false" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Test for string containing numbers and symbols with 'a' at the end: " ); try { System.out.println( StringStuff.containsVowel( "1234567890!@#$%^&*()a" ) ? "true" : "false" ); } catch( Exception e ) { System.out.println ( false ); } } /** * test method to test out the operation of the isPalindrome method */ public static void test_isPalindrome() { System.out.println( "\nTEN TESTS FOR isPalindrome():" ); System.out.print( " Testing 'a' should return true: " ); try { System.out.println( StringStuff.isPalindrome( "a" ) ? "true" : "false" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'ab' should return false: " ); try { System.out.println( StringStuff.isPalindrome( "ab" ) ? "true" : "false" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'aba' should return true: " ); try { System.out.println( StringStuff.isPalindrome( "aba" ) ? "true" : "false" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'amanaplanacanalpanama' should return true: " ); try { System.out.println( StringStuff.isPalindrome( "amanaplanacanalpanama" ) ? "true" : "false" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'ABBA' should return true: " ); try { System.out.println( StringStuff.isPalindrome( "ABBA" ) ? "true" : "false" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'RaCeCaR' should return true: " ); try { System.out.println( StringStuff.isPalindrome( "RaCeCaR" ) ? "true" : "false" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'madamiamadam' should return false: " ); try { System.out.println( StringStuff.isPalindrome( "madamiamadam" ) ? "true" : "false" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'abcdefghigfedcba' should return false: " ); try { System.out.println( StringStuff.isPalindrome( "abcdefghigfedcba" ) ? "true" : "false" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'abcdefgh gfedcba' should return false: " ); try { System.out.println( StringStuff.isPalindrome( "abcdefgh gfedcba" ) ? "true" : "false" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing '1!2@3#4$5%5$4#3@2!1' should return true: " ); try { System.out.println( StringStuff.isPalindrome( "1!2@3#4$5%5$4#3@2!1" ) ? "true" : "false" ); } catch( Exception e ) { System.out.println ( false ); } } /** * test method to test out the operation of the evensOnly method */ public static void test_evensOnly() { System.out.println( "\nNINE TESTS FOR evensOnly():" ); System.out.print( " Testing 'REHEARSALSZ' should return RHRLZ: " ); try { System.out.println( (0 == StringStuff.evensOnly( "REHEARSALSZ" ).compareTo( "RHRLZ" )) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'REhearSALsz' should return RhrLz: " ); try { System.out.println( (0 == StringStuff.evensOnly( "REhearSALsz" ).compareTo("RhrLz")) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' should return BDFHJLNPRTVXZ: " ); try { System.out.println( (0 == StringStuff.evensOnly( "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ).compareTo("BDFHJLNPRTVXZ")) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'abcdefghijklmnopqrstuvwxyz' should return bdfhjlnprtvxz: " ); try { System.out.println( (0 == StringStuff.evensOnly( "abcdefghijklmnopqrstuvwxyz" ).compareTo("bdfhjlnprtvxz")) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'AbCdEfGhIjKlMnOpQrStUvWxYz' should return bdfhjlnprtvxz: " ); try { System.out.println( (0 == StringStuff.evensOnly( "AbCdEfGhIjKlMnOpQrStUvWxYz" ).compareTo("bdfhjlnprtvxz")) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'ACEGIKMOQSUWY' should return empty string: " ); try { System.out.println( (0 == StringStuff.evensOnly( "ACEGIKMOQSUWY" ).compareTo("")) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'acegikmoqsuwy' should return empty string: " ); try { System.out.println( (0 == StringStuff.evensOnly( "acegikmoqsuwy" ).compareTo("")) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing empty string should return empty string: " ); try { System.out.println( (0 == StringStuff.evensOnly( "" ).compareTo("")) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'REhe12ar^^SALsz' should return RhrLz: " ); try { System.out.println( (0 == StringStuff.evensOnly( "REhe12ar^^SALsz" ).compareTo("RhrLz")) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } } /** * test method to test out the operation of the oddsOnly method */ public static void test_oddsOnly() { System.out.println( "\nNINE TESTS FOR oddsOnly():" ); System.out.print( " Testing 'xylophones' should return yooes: " ); try { System.out.println( (0 == StringStuff.oddsOnly( "xylophones" ).compareTo( "yooes" )) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'XYloPHonES' should return YooES: " ); try { System.out.println( (0 == StringStuff.oddsOnly( "XYloPHonES" ).compareTo("YooES")) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' should return ACEGIKMOQSUWY: " ); try { System.out.println( (0 == StringStuff.oddsOnly( "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ).compareTo("ACEGIKMOQSUWY")) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'abcdefghijklmnopqrstuvwxyz' should return bdfhjlnprtvxz: " ); try { System.out.println( (0 == StringStuff.oddsOnly( "abcdefghijklmnopqrstuvwxyz" ).compareTo("acegikmoqsuwy")) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'AbCdEfGhIjKlMnOpQrStUvWxYz' should return bdfhjlnprtvxz: " ); try { System.out.println( (0 == StringStuff.oddsOnly( "AbCdEfGhIjKlMnOpQrStUvWxYz" ).compareTo("ACEGIKMOQSUWY")) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'BDFHJLNPRTVXZ' should return empty string: " ); try { System.out.println( (0 == StringStuff.oddsOnly( "BDFHJLNPRTVXZ" ).compareTo("")) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'bdfhjlnprtvxz' should return empty string: " ); try { System.out.println( (0 == StringStuff.oddsOnly( "bdfhjlnprtvxz" ).compareTo("")) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing empty string should return empty string: " ); try { System.out.println( (0 == StringStuff.oddsOnly( "" ).compareTo("")) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'xy$%lo23ph((on97es' should return yooes: " ); try { System.out.println( (0 == StringStuff.oddsOnly( "xylophones" ).compareTo( "yooes" )) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } } /** * test method to test out the operation of the evensOnlyNoDupes method */ public static void test_evensOnlyNoDupes() { System.out.println( "\nEIGHT TESTS FOR evensOnlyNoDupes():" ); System.out.print( " Testing 'xylophones' should return xlphn: " ); try { System.out.println( (0 == StringStuff.evensOnlyNoDupes( "xylophones" ).compareTo( "xlphn" )) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'XYloPHonES' should return XlPHn: " ); try { System.out.println( (0 == StringStuff.evensOnlyNoDupes( "XYloPHonES" ).compareTo("XlPHn")) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'AAAABBBBAAAA' should return B: " ); try { System.out.println( (0 == StringStuff.evensOnlyNoDupes( "AAAABBBBAAAA" ).compareTo("B")) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'shshshshshshshsh' should return h: " ); try { System.out.println( (0 == StringStuff.evensOnlyNoDupes( "shshshshshshshsh" ).compareTo("h")) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'AAbbAAbbCCddCCdd' should return bd: " ); try { System.out.println( (0 == StringStuff.evensOnlyNoDupes( "AAbbAAbbCCddCCdd" ).compareTo( "bd" )) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing empty string should return empty string: " ); try { System.out.println( (0 == StringStuff.evensOnlyNoDupes( "" ).compareTo("")) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'California' should return lfrn: " ); try { System.out.println( (0 == StringStuff.evensOnlyNoDupes( "California" ).compareTo("lfrn")) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'ACEGIKMOQSUWYACEGIKMOQSUWY' should return the empty string: " ); try { System.out.println( (0 == StringStuff.evensOnlyNoDupes( "ACEGIKMOQSUWYACEGIKMOQSUWY" ).compareTo("")) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } } /** * test method to test out the operation of the oddsOnlyNoDupes method */ public static void test_oddsOnlyNoDupes() { System.out.println( "\nEIGHT TESTS FOR oddsOnlyNoDupes():" ); System.out.print( " Testing 'xylophones' should return yoes: " ); try { System.out.println( (0 == StringStuff.oddsOnlyNoDupes( "xylophones" ).compareTo( "yoes" )) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'XYloPHonES' should return YoES: " ); try { System.out.println( (0 == StringStuff.oddsOnlyNoDupes( "XYloPHonES" ).compareTo("YoES")) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'AAAABBBBAAAA' should return A: " ); try { System.out.println( (0 == StringStuff.oddsOnlyNoDupes( "AAAABBBBAAAA" ).compareTo("A")) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'shshshshshshshsh' should return h: " ); try { System.out.println( (0 == StringStuff.oddsOnlyNoDupes( "shshshshshshshsh" ).compareTo("s")) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'AAbbAAbbCCddCCdd' should return bd: " ); try { System.out.println( (0 == StringStuff.oddsOnlyNoDupes( "AAbbAAbbCCddCCdd" ).compareTo( "AC" )) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing empty string should return empty string: " ); try { System.out.println( (0 == StringStuff.oddsOnlyNoDupes( "" ).compareTo("")) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'California' should return aio: " ); try { System.out.println( (0 == StringStuff.oddsOnlyNoDupes( "California" ).compareTo("Caio")) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'BDFHJLNPRTVXBDFHJLNPRTVX' should return the empty string: " ); try { System.out.println( (0 == StringStuff.oddsOnlyNoDupes( "BDFHJLNPRTVXBDFHJLNPRTVX" ).compareTo("")) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } } /** * test method to test out the operation of the reverse method */ public static void test_reverse() { System.out.println( "\nFOUR TESTS FOR reverse():" ); System.out.print( " Testing 'xylophones' should return senohpolyx: " ); try { System.out.println( (0 == StringStuff.reverse( "xylophones" ).compareTo( "senohpolyx" )) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'XYloPHonES' should return SEnoHPolYX: " ); try { System.out.println( (0 == StringStuff.reverse( "XYloPHonES" ).compareTo("SEnoHPolYX")) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'AmanAplanAcAnalpAnamA' should return AmanAplanAcAnalpAnamA: " ); try { System.out.println( (0 == StringStuff.reverse( "AmanAplanAcAnalpAnamA" ).compareTo("AmanAplanAcAnalpAnamA")) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } System.out.print( " Testing 'shut the front door 1234567890' should return 0987654321 rood tnorf eht tuhs: " ); try { System.out.println( (0 == StringStuff.reverse( "shut the front door 1234567890" ).compareTo("0987654321 rood tnorf eht tuhs")) ? "got it" : "don't got it" ); } catch( Exception e ) { System.out.println ( false ); } } /** * test method to test out the operation of the removeDupes method */ //public static void test_removeDupes() { // System.out.println( "\nFOUR TESTS FOR removeDupes():" ); // System.out.print( " Testing 'xylophones' should return xylophnes: " ); // try { System.out.println( (0 == StringStuff.removeDupes( "xylophones" ).compareTo( "xylophnes" )) ? "got it" : "don't got it" ); } // catch( Exception e ) { System.out.println ( false ); } // System.out.print( " Testing 'XYloPHonES' should return XYloPHnES: " ); // try { System.out.println( (0 == StringStuff.removeDupes( "XYloPHonES" ).compareTo("XYloPHnES")) ? "got it" : "don't got it" ); } // catch( Exception e ) { System.out.println ( false ); } // System.out.print( " Testing 'AmanAplanAcAnalpAnamA' should return Amanplc: " ); // try { System.out.println( (0 == StringStuff.removeDupes( "AmanAplanAcAnalpAnamA" ).compareTo("Amanplc")) ? "got it" : "don't got it" ); } // catch( Exception e ) { System.out.println ( false ); } // System.out.print( " Testing 'shutTheFrontDoor11233455677890' should return shutTeFronD1234567890: " ); // try { System.out.println( (0 == StringStuff.removeDupes( "shutTheFrontDoor11234567890" ).compareTo("shutTeFronD1234567890")) ? "got it" : "don't got it" ); } // catch( Exception e ) { System.out.println ( false ); } //} }
3555748cdf6f8f04fa9377795b4ac1c1904ee74a
baeeb0ba250b58649c4d2b9e4c106a1760bbb16a
/src/main/java/spring/react/jwt/service/impl/GameServiceImpl.java
3d3a930652149f66c0b4dab34d4d57366a1e7520
[]
no_license
yanko1601/spring_react
fa70357f7f4ba223a7effeccfd6cb2ae2e4d8819
8256a6e932fe67241bf744377398767fa7b528dc
refs/heads/main
2023-03-29T13:42:40.988755
2021-04-14T13:05:37
2021-04-14T13:05:37
353,807,246
0
0
null
null
null
null
UTF-8
Java
false
false
5,860
java
package spring.react.jwt.service.impl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import spring.react.jwt.model.entities.City; import spring.react.jwt.model.entities.Court; import spring.react.jwt.model.entities.Game; import spring.react.jwt.model.entities.Player; import spring.react.jwt.model.view.GameFinishedOutputView; import spring.react.jwt.model.view.GameOutputView; import spring.react.jwt.repositories.ChallengeRepository; import spring.react.jwt.repositories.CourtRepository; import spring.react.jwt.repositories.GameRepository; import spring.react.jwt.repositories.PlayerRepository; import spring.react.jwt.service.GameService; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.NoSuchElementException; import java.util.Random; @Service public class GameServiceImpl implements GameService { private final GameRepository gameRepository; private final ChallengeRepository challengeRepository; private final PlayerRepository playerRepository; private final CourtRepository courtRepository; @Autowired public GameServiceImpl(GameRepository gameRepository, ChallengeRepository challengeRepository, PlayerRepository playerRepository, CourtRepository courtRepository) { this.gameRepository = gameRepository; this.challengeRepository = challengeRepository; this.playerRepository = playerRepository; this.courtRepository = courtRepository; } @Override public Game findGameByPlayersIdAndNotFinished(Long firstId, Long secondId) { return this.gameRepository.findGameByPlayersIdAndNotFinished(firstId, secondId); } @Override public void gameCreate(Long firstPlayerId, Long secondPlayerId) { Player playerOne = this.playerRepository.findPlayerById(firstPlayerId); Player playerTwo = this.playerRepository.findPlayerById(secondPlayerId); City city = playerOne.getCity(); List<Court>allCourtsInTheCity = this.courtRepository.findAllCourtsByCity(city.getName()); Court court = allCourtsInTheCity.get(new Random().nextInt(allCourtsInTheCity.size())); Game game = new Game(); game.setFirstPlayer(playerOne); game.setSecondPlayer(playerTwo); game.setWinnerGames(0); game.setLooserGames(0); game.setCourt(court); game.setFinished(false); game.setDateTime(LocalDateTime.now().plusDays(2)); this.gameRepository.save(game); } @Override public List<GameOutputView> getAllGamesNotFinished() { List<Game>allGames = this.gameRepository.getAllGamesNotFinished(); List<GameOutputView>resultGames = new ArrayList<>(); allGames.forEach(g -> { GameOutputView outputGame = new GameOutputView(); outputGame.setId(g.getId()); outputGame.setFirstPlayerFullName(String.format("%s %s", g.getFirstPlayer().getName(), g.getFirstPlayer().getLastName())); outputGame.setSecondPlayerFullName(String.format("%s %s", g.getSecondPlayer().getName(), g.getSecondPlayer().getLastName())); outputGame.setCity(g.getFirstPlayer().getCity().getName()); outputGame.setPlace(String.format("%s - %d", g.getCourt().getComplex(), g.getCourt().getCourtNumber())); outputGame.setTime(String.format("%d-%d-%d %d:00" ,g.getDateTime().getDayOfMonth() ,g.getDateTime().getMonthValue() ,g.getDateTime().getYear() ,g.getDateTime().getHour())); resultGames.add(outputGame); }); return resultGames; } @Override public List<GameFinishedOutputView> getAllGamesFinished() { List<Game>allGames = this.gameRepository.getAllGamesFinished(); List<GameFinishedOutputView>resultfinGames = new ArrayList<>(); allGames.forEach(g -> { GameFinishedOutputView outputGame = new GameFinishedOutputView(); outputGame.setId(g.getId()); outputGame.setFirstPlayerFullName(String.format("%s %s", g.getFirstPlayer().getName(), g.getFirstPlayer().getLastName())); outputGame.setSecondPlayerFullName(String.format("%s %s", g.getSecondPlayer().getName(), g.getSecondPlayer().getLastName())); outputGame.setFirstGames(g.getWinnerGames()); outputGame.setSecondGames(g.getLooserGames()); resultfinGames.add(outputGame); }); return resultfinGames; } @Override public void setResult(Long id) { Game game = this.gameRepository.findGameByid(id); if(new Random().nextInt(2) > 0) { game.setWinner(game.getSecondPlayer()); game.setLooser(game.getFirstPlayer()); game.setWinnerGames(6); game.setLooserGames(new Random().nextInt(5)); game.setFinished(true); handleWinner(game.getSecondPlayer(), game.getFirstPlayer()); }else { game.setWinner(game.getFirstPlayer()); game.setLooser(game.getSecondPlayer()); game.setWinnerGames(6); game.setLooserGames(new Random().nextInt(5)); game.setFinished(true); handleWinner(game.getFirstPlayer(), game.getSecondPlayer()); } this.gameRepository.save(game); } private void handleWinner(Player winner, Player looser) { if(winner.getRank() > looser.getRank()) { int temp = winner.getRank(); winner.setRank(looser.getRank()); looser.setRank(temp); this.playerRepository.save(winner); this.playerRepository.save(looser); } } }
207e064b66d1eb32cf540f2639f9c037ca6a8b31
a9c0521a97f7b04cdf1280c77c3d621a468eb58c
/src/com/action/LoginAction.java
92e20d796f0155a941a881b6b02cc163fd909d38
[]
no_license
wyjsxty/ajax01
554c1f8be129aeab90cf05ea59f7acc5edc490b5
abe2253bf21c7f0df551e263686a1e6d876d5d65
refs/heads/master
2021-01-13T02:15:11.085379
2014-09-17T13:36:00
2014-09-17T13:36:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
632
java
package com.action; import com.opensymphony.xwork2.Action; public class LoginAction implements Action { private String username; private String password; public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } @Override public String execute() throws Exception { System.out.println(username); if("admin".equals(username)){ return SUCCESS; }else{ return ERROR; } } }
14e20d8fb3306a41e2db16dc2e3afb3ea2a74db1
ae791732f84abf28dc5eb4059a4d224265ca242a
/src/main/java/kea/kino/demo/model/Actor.java
dd70c7d7e49359dccec7954e87796a11c1f53984
[]
no_license
KEA-Data-Science/Kino
ea5ef43907ee3612d87ee0b04e9188774d3158da
f212148298556c749eee7ab5114e667337a25405
refs/heads/master
2022-12-26T01:08:27.867077
2020-10-07T11:02:51
2020-10-07T11:02:51
299,259,616
1
3
null
null
null
null
UTF-8
Java
false
false
932
java
package kea.kino.demo.model; import javax.persistence.*; import java.util.Set; @Entity public class Actor { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) public int actor_id; public Actor(int actor_id, String name){ } public Actor(){ } @ManyToMany(mappedBy = "actors") public Set<Film> films; public String name; public Set<Film> getFilms(){ return films; } public void setFilms(Set<Film> films){ this.films = films; } public int getId() { return actor_id; } public void setId(int id) { this.actor_id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public String toString() { return "Actor{" + "actor_id=" + actor_id + ", name='" + name + '\'' + '}'; } }
e047a054b5bf5312271536ef7db6300fade979af
618ee263627f95816328bee01363a6c5a14dc27b
/src/forbs/queue/StockQueue.java
f7e89044052350011c4518342108e672021d98b4
[]
no_license
kdanwoo/algorithmEx
73d9b8e15707c1ce13300119452f9b205492c941
a8d1f2bcb152facf5958c1d08ddb4ac71d1f702f
refs/heads/master
2023-06-24T07:01:39.061712
2021-07-29T09:08:20
2021-07-29T09:08:20
380,156,615
0
0
null
null
null
null
UTF-8
Java
false
false
1,240
java
package forbs.queue; import javax.print.attribute.standard.QueuedJobCount; import java.util.Arrays; import java.util.LinkedList; import java.util.Queue; public class StockQueue { static class Solution { Queue<Integer> stockQueue; int min; public int[] solution(int[] prices) { int[] answer = new int[prices.length]; stockQueue = new LinkedList<>(); min = prices[0]; for(int i=0; i<prices.length; i++){ if(min> prices[i]){ min = prices[i]; } stockQueue.offer(prices[i]); } while(!stockQueue.isEmpty()){ int i = 0; //answer[i] = stockAnalysis(stockQueue.poll()); i++; } return answer; } // // private int stockAnalysis(Queue<Integer> queue){ // Queue<Integer> temp = queue; // // int tempval = temp.poll(); // return null; // } } public static void main(String[] args) { Solution solution = new Solution(); int[] arr = {1, 2, 3, 2, 3}; System.out.println(Arrays.toString(solution.solution(arr))); } }
6c6f78e7f8c3474a40b0fe38f943f4fe9519366a
c45ade161ebe00229b1725ad3e756646e126be98
/app/src/main/java/com/interstellarstudios/note_ify/models/Collection.java
d0af07dce7d0d18b4be98eac6c065d368007927f
[]
no_license
midhajatin/Noteify
b50e510804132061bffb53b6963a603cede717a6
ab680b90d0d1a71c3c218003c40147ff8fd77bab
refs/heads/master
2020-12-21T21:02:50.717811
2019-12-19T08:20:50
2019-12-19T08:20:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
471
java
package com.interstellarstudios.note_ify.models; public class Collection { private String folder; private String folderDate; public Collection() { //empty constructor needed } public Collection(String folder, String folderDate) { this.folder = folder; this.folderDate = folderDate; } public String getFolder() { return folder; } public String getFolderDate() { return folderDate; } }
8e97883974062ca8a5500a1effb81474d5ec9f30
dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9
/data_defect4j/preprossed_method_corpus/Math/26/org/apache/commons/math3/analysis/integration/gauss/LegendreHighPrecisionRuleFactory_computeRule_65.java
aae0a6b8b888bd4db0b2efb73c5cf4946011f15d
[]
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
4,103
java
org apach common math3 analysi integr gauss factori creat gauss type quadratur rule legendr polynomi implement lower upper bound natur interv integr legendr polynomi evalu recurr relat present href http wikipedia org wiki abramowitz stegun abramowitz stegun version legendr high precis rule factori legendrehighprecisionrulefactori base rule factori baserulefactori big decim bigdecim inherit doc inheritdoc overrid pair big decim bigdecim big decim bigdecim comput rule computerul number point numberofpoint number point numberofpoint break recurs pair big decim bigdecim big decim bigdecim big decim bigdecim big decim bigdecim big decim bigdecim previou rule comput trigger recurs call method big decim bigdecim previou point previouspoint rule intern getruleintern number point numberofpoint getfirst comput rule big decim bigdecim point big decim bigdecim number point numberofpoint big decim bigdecim weight big decim bigdecim number point numberofpoint find root bracket max imax number point numberofpoint max imax lower bound interv big decim bigdecim minu minuson previou point previouspoint upper bound interv big decim bigdecim max imax big decim bigdecim previou point previouspoint big decim bigdecim pma big decim bigdecim big decim bigdecim big decim bigdecim pmb big decim bigdecim big decim bigdecim number point numberofpoint big decim bigdecim big decim bigdecim context mcontext big decim bigdecim big decim bigdecim context mcontext big decim bigdecim big decim bigdecim context mcontext comput ppa pma big decim bigdecim tmp1 multipli context mcontext tmp1 multipli tmp1 context mcontext big decim bigdecim tmp2 pma multipli context mcontext big decim bigdecim ppa tmp1 subtract tmp2 context mcontext ppa ppa divid context mcontext comput ppb pmb tmp1 multipli context mcontext tmp1 multipli tmp1 context mcontext tmp2 pmb multipli context mcontext big decim bigdecim ppb tmp1 subtract tmp2 context mcontext ppb ppb divid context mcontext pma ppa pmb ppb pma hold middl interv big decim bigdecim add context mcontext multipli half onehalf context mcontext big decim bigdecim pmc big decim bigdecim big decim bigdecim big decim bigdecim tmp1 subtract context mcontext big decim bigdecim tmp2 ulp multipli big decim bigdecim ten context mcontext tmp1 compar compareto tmp2 pmc big decim bigdecim number point numberofpoint big decim bigdecim big decim bigdecim context mcontext big decim bigdecim big decim bigdecim context mcontext big decim bigdecim big decim bigdecim context mcontext comput tmp1 multipli context mcontext tmp1 multipli tmp1 context mcontext tmp2 pmc multipli context mcontext big decim bigdecim ppc tmp1 subtract tmp2 context mcontext ppc ppc divid context mcontext pmc ppc pmc signum signum pmb pmc pma pmc add context mcontext multipli half onehalf context mcontext big decim bigdecim big decim bigdecim number point numberofpoint context mcontext big decim bigdecim tmp1 pmc subtract multipli context mcontext context mcontext tmp1 tmp1 multipli tmp1 tmp1 pow context mcontext big decim bigdecim tmp2 pow context mcontext tmp2 big decim bigdecim subtract tmp2 context mcontext tmp2 tmp2 multipli context mcontext tmp2 tmp2 divid tmp1 context mcontext point weight tmp2 idx number point numberofpoint point idx negat context mcontext weight idx tmp2 number point numberofpoint odd root number point numberofpoint big decim bigdecim pmc big decim bigdecim number point numberofpoint big decim bigdecim big decim bigdecim context mcontext big decim bigdecim big decim bigdecim context mcontext pmc pmc pmc pmc multipli context mcontext pmc pmc divid context mcontext pmc pmc negat context mcontext pow number point numberofpoint pmc big decim bigdecim big decim bigdecim number point numberofpoint context mcontext big decim bigdecim tmp1 pmc multipli context mcontext tmp1 tmp1 pow context mcontext big decim bigdecim tmp2 divid tmp1 context mcontext point max imax big decim bigdecim weight max imax tmp2 pair big decim bigdecim big decim bigdecim point weight
43ef409578a4c14864f6f5bc653f215f8464ec5c
d1304c6d30231fbdc567e09d3ab748eac931fdff
/src/main/java/com/sha/springbootbookseller/service/PurchaseHistoryService.java
1ac7a8bd564c8b0d5008a33e8e13aebf6e276a7c
[]
no_license
kudretbatuhan/spring-boot-book-seller
c0810c7c69630a5a7cca8ab429a4bf04da07d7b3
579cc703f81d6190fe95262ed147c365cdd9ebb8
refs/heads/master
2023-08-22T14:58:43.582210
2021-10-14T12:52:08
2021-10-14T12:52:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,142
java
package com.sha.springbootbookseller.service; import com.sha.springbootbookseller.model.PurchaseHistory; import com.sha.springbootbookseller.repository.IPurchaseHistoryRepository; import com.sha.springbootbookseller.repository.projection.IPurchaseItem; import org.springframework.stereotype.Service; import java.time.LocalDateTime; import java.util.List; /** * @author sa * @date 3.07.2021 * @time 18:14 */ @Service public class PurchaseHistoryService implements IPurchaseHistoryService { private final IPurchaseHistoryRepository purchaseHistoryRepository; public PurchaseHistoryService(IPurchaseHistoryRepository purchaseHistoryRepository) { this.purchaseHistoryRepository = purchaseHistoryRepository; } @Override public PurchaseHistory savePurchaseHistory(PurchaseHistory purchaseHistory) { purchaseHistory.setPurchaseTime(LocalDateTime.now()); return purchaseHistoryRepository.save(purchaseHistory); } @Override public List<IPurchaseItem> findPurchasedItemsOfUser(Long userId) { return purchaseHistoryRepository.findAllPurchasesOfUser(userId); } }
e32394edaa80598fa1b5abc1212a61bad0b33b25
e1d9a09280e90448a39463716a39f000bab74d11
/src/test/Test02.java
f158ab67737a3353edd81bfe16faffdbbf9b6085
[]
no_license
MyCoderxx/myproject
8f721c26ebc31454d9041b0407dbeb63941aec7e
b09e1f1f39e58d576693eada52a57f162ea7d246
refs/heads/master
2023-08-11T11:34:26.198335
2021-09-17T15:41:20
2021-09-17T15:41:20
367,869,230
0
0
null
null
null
null
UTF-8
Java
false
false
91
java
package test; public class Test02 { public static void main(String[] args) { } }
d9ea905f6461fff4f47d89c8cc2acaaf04869009
cfc2a198ef5560daf8484d9fe36a8d9762ae6ccc
/cortado/src/main/java/cortado/NotCompletable.java
58980a5acd19b626830c1e9a556ce2aaf087c49b
[ "Apache-2.0" ]
permissive
satish-svu/cortado
2a47128544565c0af96bc9e94aeeecceebc98d54
795db7605f8787ad011cadc61035738249d68754
refs/heads/master
2021-01-21T11:03:44.778642
2017-02-28T11:18:56
2017-02-28T11:18:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,917
java
/* * Copyright 2017 Bartosz Lipinski * * 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 cortado; import android.support.annotation.IdRes; import android.support.annotation.StringRes; import android.support.test.espresso.matcher.ViewMatchers; import android.view.View; public abstract class NotCompletable<T> implements Matching<T> { private final Cortado cortado; NotCompletable(Cortado cortado) { this.cortado = cortado; } abstract T returned(); @Override public final T isAssignableFrom(Class<? extends View> clazz) { cortado.isAssignableFrom(clazz); return returned(); } @Override public final T withClassName(org.hamcrest.Matcher<String> classNameMatcher) { cortado.withClassName(classNameMatcher); return returned(); } @Override public final T isDisplayed() { cortado.isDisplayed(); return returned(); } @Override public final T isCompletelyDisplayed() { cortado.isCompletelyDisplayed(); return returned(); } @Override public final T isDisplayingAtLeast(int areaPercentage) { cortado.isDisplayingAtLeast(areaPercentage); return returned(); } @Override public final T isEnabled() { cortado.isEnabled(); return returned(); } @Override public final T isFocusable() { cortado.isFocusable(); return returned(); } @Override public final T hasFocus() { cortado.hasFocus(); return returned(); } @Override public final T isSelected() { cortado.isSelected(); return returned(); } @Override public final T hasSibling(org.hamcrest.Matcher<View> siblingMatcher) { cortado.hasSibling(siblingMatcher); return returned(); } @Override public final T hasSibling(Matcher siblingMatcher) { cortado.hasSibling(siblingMatcher); return returned(); } @Override public final T withContentDescription(@StringRes int resourceId) { cortado.withContentDescription(resourceId); return returned(); } @Override public final T withContentDescription(String text) { cortado.withContentDescription(text); return returned(); } @Override public final T withContentDescription(org.hamcrest.Matcher<? extends CharSequence> charSequenceMatcher) { cortado.withContentDescription(charSequenceMatcher); return returned(); } @Override public final T withId(@IdRes int id) { cortado.withId(id); return returned(); } @Override public final T withId(org.hamcrest.Matcher<Integer> integerMatcher) { cortado.withId(integerMatcher); return returned(); } @Override public final T withResourceName(String name) { cortado.withResourceName(name); return returned(); } @Override public final T withResourceName(org.hamcrest.Matcher<String> stringMatcher) { cortado.withResourceName(stringMatcher); return returned(); } @Override public final T withTagKey(int key) { cortado.withTagKey(key); return returned(); } @Override public final T withTagKey(int key, org.hamcrest.Matcher<Object> objectMatcher) { cortado.withTagKey(key, objectMatcher); return returned(); } @Override public final T withTagValue(org.hamcrest.Matcher<Object> tagValueMatcher) { cortado.withTagValue(tagValueMatcher); return returned(); } @Override public final T withText(String text) { cortado.withText(text); return returned(); } @Override public final T withText(org.hamcrest.Matcher<String> stringMatcher) { cortado.withText(stringMatcher); return returned(); } @Override public final T withText(@StringRes int resourceId) { cortado.withText(resourceId); return returned(); } @Override public final T withHint(String hintText) { cortado.withHint(hintText); return returned(); } @Override public final T withHint(org.hamcrest.Matcher<String> stringMatcher) { cortado.withHint(stringMatcher); return returned(); } @Override public final T withHint(@StringRes int resourceId) { cortado.withHint(resourceId); return returned(); } @Override public final T isChecked() { cortado.isChecked(); return returned(); } @Override public final T isNotChecked() { cortado.isNotChecked(); return returned(); } @Override public final T hasContentDescription() { cortado.hasContentDescription(); return returned(); } @Override public final T hasDescendant(org.hamcrest.Matcher<View> descendantMatcher) { cortado.hasDescendant(descendantMatcher); return returned(); } @Override public final T hasDescendant(Matcher descendantMatcher) { cortado.hasDescendant(descendantMatcher); return returned(); } @Override public final T isClickable() { cortado.isClickable(); return returned(); } @Override public final T isDescendantOfA(org.hamcrest.Matcher<View> ancestorMatcher) { cortado.isDescendantOfA(ancestorMatcher); return returned(); } @Override public final T isDescendantOfA(Matcher ancestorMatcher) { cortado.isDescendantOfA(ancestorMatcher); return returned(); } @Override public final T withEffectiveVisibility(ViewMatchers.Visibility visibility) { cortado.withEffectiveVisibility(visibility); return returned(); } @Override public final T withParent(org.hamcrest.Matcher<View> parentMatcher) { cortado.withParent(parentMatcher); return returned(); } @Override public final T withParent(Matcher parentMatcher) { cortado.withParent(parentMatcher); return returned(); } @Override public final T withChild(org.hamcrest.Matcher<View> childMatcher) { cortado.withChild(childMatcher); return returned(); } @Override public final T withChild(Matcher childMatcher) { cortado.withChild(childMatcher); return returned(); } @Override public final T isRoot() { cortado.isRoot(); return returned(); } @Override public final T supportsInputMethods() { cortado.supportsInputMethods(); return returned(); } @Override public final T hasImeAction(int imeAction) { cortado.hasImeAction(imeAction); return returned(); } @Override public final T hasImeAction(org.hamcrest.Matcher<Integer> imeActionMatcher) { cortado.hasImeAction(imeActionMatcher); return returned(); } @Override public final T hasLinks() { cortado.hasLinks(); return returned(); } @Override public final T withSpinnerText(@StringRes int resourceId) { cortado.withSpinnerText(resourceId); return returned(); } @Override public final T withSpinnerText(org.hamcrest.Matcher<String> stringMatcher) { cortado.withSpinnerText(stringMatcher); return returned(); } @Override public final T withSpinnerText(String text) { cortado.withSpinnerText(text); return returned(); } @Override public final T isJavascriptEnabled() { cortado.isJavascriptEnabled(); return returned(); } @Override public final T hasErrorText(org.hamcrest.Matcher<String> stringMatcher) { cortado.hasErrorText(stringMatcher); return returned(); } @Override public final T hasErrorText(String expectedError) { cortado.hasErrorText(expectedError); return returned(); } @Override public final T withInputType(int inputType) { cortado.withInputType(inputType); return returned(); } @Override public T matching(org.hamcrest.Matcher<View> matcher) { cortado.matching(matcher); return returned(); } @Override public T matching(Matcher matcher) { cortado.matching(matcher); return returned(); } }
f3ddd672b0458e64d130db8686d9f99683e226e6
8c9b743f156307cfb8781f95d2039f3697305b78
/src/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGTextContentElement.java
db10bd1cf39e19501bbe6458c33019b0b4a34dcf
[]
no_license
jiafenggit/HtmlUnitTao
f8fbd9065b03b6cd0f3a4ce1db6b4fbfd4941000
ede3e10603d16f022b60798ea340c392f57495f7
refs/heads/master
2021-04-28T23:46:58.642674
2016-03-15T08:08:02
2016-03-15T08:08:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,068
java
/* * Copyright (c) 2002-2015 Gargoyle Software Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.gargoylesoftware.htmlunit.javascript.host.svg; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.CHROME; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxConstant; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxConstructor; import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser; /** * A JavaScript object for {@code SVGTextContentElement}. * * @version $Revision: 10726 $ * @author Ahmed Ashour */ @JsxClass(browsers = { @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) public class SVGTextContentElement extends SVGGraphicsElement { /** The constant {@code LENGTHADJUST_UNKNOWN}. */ @JsxConstant public static final int LENGTHADJUST_UNKNOWN = 0; /** The constant {@code LENGTHADJUST_SPACING}. */ @JsxConstant public static final int LENGTHADJUST_SPACING = 1; /** The constant {@code LENGTHADJUST_SPACINGANDGLYPHS}. */ @JsxConstant public static final int LENGTHADJUST_SPACINGANDGLYPHS = 2; /** * Creates an instance. */ @JsxConstructor({ @WebBrowser(CHROME), @WebBrowser(FF) }) public SVGTextContentElement() { } }
271dcc9bb94a07544a2d17b72985e9731284898a
f6dfb92a53472bd6980dc3cd4bb44bb5c4e9437d
/apps/SlimLauncher/src/com/slim/slimlauncher/FirstFrameAnimatorHelper.java
b6ba9af4431a64b36ceb88cbfa7c04c1aeafa377
[ "Apache-2.0" ]
permissive
tuxafgmur/DhollmenK_packages
5d52da8ba58c60b7f4a0e92bf7b8818bba724d26
9a11d8225f07353ce3711f9e326b18e28c453fa5
refs/heads/master
2020-12-31T07:54:45.423581
2015-06-18T00:09:23
2015-06-18T00:09:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,987
java
/* * Copyright (C) 2013 The Android Open Source Project * * 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.slim.slimlauncher; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.util.Log; import android.view.View; import android.view.ViewPropertyAnimator; import android.view.ViewTreeObserver; /* * This is a helper class that listens to updates from the corresponding animation. * For the first two frames, it adjusts the current play time of the animation to * prevent jank at the beginning of the animation */ public class FirstFrameAnimatorHelper extends AnimatorListenerAdapter implements ValueAnimator.AnimatorUpdateListener { private static final boolean DEBUG = false; private static final int MAX_DELAY = 1000; private static final int IDEAL_FRAME_DURATION = 16; private View mTarget; private long mStartFrame; private long mStartTime = -1; private boolean mHandlingOnAnimationUpdate; private boolean mAdjustedSecondFrameTime; private static ViewTreeObserver.OnDrawListener sGlobalDrawListener; private static long sGlobalFrameCounter; private static boolean sVisible; public FirstFrameAnimatorHelper(ValueAnimator animator, View target) { mTarget = target; animator.addUpdateListener(this); } public FirstFrameAnimatorHelper(ViewPropertyAnimator vpa, View target) { mTarget = target; vpa.setListener(this); } // only used for ViewPropertyAnimators public void onAnimationStart(Animator animation) { final ValueAnimator va = (ValueAnimator) animation; va.addUpdateListener(FirstFrameAnimatorHelper.this); onAnimationUpdate(va); } public static void setIsVisible(boolean visible) { sVisible = visible; } public static void initializeDrawListener(View view) { if (sGlobalDrawListener != null) { view.getViewTreeObserver().removeOnDrawListener(sGlobalDrawListener); } sGlobalDrawListener = new ViewTreeObserver.OnDrawListener() { private long mTime = System.currentTimeMillis(); public void onDraw() { sGlobalFrameCounter++; if (DEBUG) { long newTime = System.currentTimeMillis(); Log.d("FirstFrameAnimatorHelper", "TICK " + (newTime - mTime)); mTime = newTime; } } }; view.getViewTreeObserver().addOnDrawListener(sGlobalDrawListener); sVisible = true; } public void onAnimationUpdate(final ValueAnimator animation) { final long currentTime = System.currentTimeMillis(); if (mStartTime == -1) { mStartFrame = sGlobalFrameCounter; mStartTime = currentTime; } if (!mHandlingOnAnimationUpdate && sVisible && // If the current play time exceeds the duration, the animation // will get finished, even if we call setCurrentPlayTime -- therefore // don't adjust the animation in that case animation.getCurrentPlayTime() < animation.getDuration()) { mHandlingOnAnimationUpdate = true; long frameNum = sGlobalFrameCounter - mStartFrame; // If we haven't drawn our first frame, reset the time to t = 0 // (give up after MAX_DELAY ms of waiting though - might happen, for example, if we // are no longer in the foreground and no frames are being rendered ever) if (frameNum == 0 && currentTime < mStartTime + MAX_DELAY) { // The first frame on animations doesn't always trigger an invalidate... // force an invalidate here to make sure the animation continues to advance mTarget.getRootView().invalidate(); animation.setCurrentPlayTime(0); // For the second frame, if the first frame took more than 16ms, // adjust the start time and pretend it took only 16ms anyway. This // prevents a large jump in the animation due to an expensive first frame } else if (frameNum == 1 && currentTime < mStartTime + MAX_DELAY && !mAdjustedSecondFrameTime && currentTime > mStartTime + IDEAL_FRAME_DURATION) { animation.setCurrentPlayTime(IDEAL_FRAME_DURATION); mAdjustedSecondFrameTime = true; } else { if (frameNum > 1) { mTarget.post(new Runnable() { public void run() { animation.removeUpdateListener(FirstFrameAnimatorHelper.this); } }); } if (DEBUG) print(animation); } mHandlingOnAnimationUpdate = false; } else { if (DEBUG) print(animation); } } public void print(ValueAnimator animation) { float flatFraction = animation.getCurrentPlayTime() / (float) animation.getDuration(); Log.d("FirstFrameAnimatorHelper", sGlobalFrameCounter + "(" + (sGlobalFrameCounter - mStartFrame) + ") " + mTarget + " dirty? " + mTarget.isDirty() + " " + flatFraction + " " + this + " " + animation); } }
c98b0e0b20a5a01fafb6460f3236377cd07f0ca6
4ea0aa3627ef0ceb9a9285a285e76b0e6793f16c
/src/cn/xm/libandroid/AndroidUtils/AndroidSetting.java
4fa398cbaa39f0f2ac6976e1d1eb7369803d52b3
[]
no_license
yesunsong/LibAndroid
b18252322d9593e5b4a5d6dccc536c8d54ae68d5
7537d1af9b40ddd960e21fb6a4c851f05e28dc15
refs/heads/master
2020-06-21T05:54:48.323379
2016-12-01T12:49:15
2016-12-01T12:49:15
74,801,248
0
2
null
null
null
null
UTF-8
Java
false
false
1,981
java
package cn.xm.libandroid.AndroidUtils; import android.app.Activity; import android.view.Window; import android.view.WindowManager; /** * Android常用设置 * * @author yesunsong * */ public class AndroidSetting { private static AndroidSetting androidSetting; private static Activity activity; private AndroidSetting() { } public static AndroidSetting getInstance() { if (androidSetting == null) { androidSetting = new AndroidSetting(); } return androidSetting; } public static void init(Activity activity) { AndroidSetting.activity = activity; } // <<===============================>> /** 设置屏幕全屏【要在setContentView(textView)之前】 */ public void setFullScreen() { activity.requestWindowFeature(Window.FEATURE_NO_TITLE); activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); } /** 窗口可见时,屏幕常亮[在初始化完onCreate()之后使用] */ public void setScreenAlawaysBright() { activity.getWindow().addFlags( WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } /* * Android OS中,如果你去按手机上的调节音量的按钮,会分两种情况, * 一种是调整手机本身的铃声音量,一种是调整游戏,软件,音乐播放的音量 当我们在游戏中的时候 ,总是想调整游戏的音量而不是手机的铃声音量, * 可是烦人的问题又来了,我在开发中发现,只有游戏中有声音在播放的时候 ,你才能去调整游戏的音量,否则就是手机的音量. * 设定调整音量为媒体音量,当暂停播放的时候调整音量就不会再默认调整铃声音量了 */ /**控制 媒体流的音量*/ public void setVolumeControlStream(int streamType){ activity.setVolumeControlStream(streamType); } /**设置 屏幕方向*/ public void setRequestedOrientation(int screenOrientation) { activity.setRequestedOrientation(screenOrientation); } }
4aa9572320e29f984aa68dd001be51763dcee3ee
7ad80da82cf5a817f6333b97e0f7d19c75330cb5
/4Practice/src/pkg/GettersnSettersMethod.java
0ad1c251611069b03bb5a245480a9bc14a1c2bad
[]
no_license
RajivAutomation/JavaPrograms
c43c3e977cf03de05e16a058f7541df0c76b1cb6
630fcfeb11d72318f0c91c68065429ad969bfb0a
refs/heads/master
2023-07-18T22:36:30.046765
2021-09-26T23:06:15
2021-09-26T23:06:15
301,703,635
0
0
null
null
null
null
UTF-8
Java
false
false
307
java
package pkg; public class GettersnSettersMethod { private String Color; // Getter Method public String getColor(){ return Color; } //Setter Method public void setColor(String c){ this.Color=c;//whatever String c we are passing would be stored in Color } }
75299125a2941553908b0541dc217766994811dd
27ce4797e526bfe546ac1dd90ff2d2dececc14fb
/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/TestFSConfigToCSConfigConverter.java
070bd646613318280345e7baf0f86ccb222694f5
[ "Apache-2.0", "LicenseRef-scancode-unknown", "BSD-3-Clause", "BSD-2-Clause", "MIT", "LicenseRef-scancode-unknown-license-reference", "CC0-1.0", "CC-BY-3.0", "EPL-1.0", "Classpath-exception-2.0", "CC-PDDC", "GCC-exception-3.1", "CDDL-1.0", "GPL-2.0-only", "LicenseRef-scancode-public-domain", "LGPL-2.1-only", "LicenseRef-scancode-other-permissive", "CDDL-1.1", "LicenseRef-scancode-jdom" ]
permissive
dragonXinLi/hadoop
ad95e16cd5291c8a4c3c0411647ca8a8f3f61756
a3f5a1df23fa86b4afb223845256cf1b83803719
refs/heads/trunk
2023-02-17T04:01:37.708393
2021-01-19T05:58:32
2021-01-19T05:58:32
315,542,924
0
1
Apache-2.0
2021-01-19T05:58:34
2020-11-24T06:46:21
null
UTF-8
Java
false
false
27,245
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.converter; import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration.PREFIX; import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.converter.FSConfigToCSConfigRuleHandler.DYNAMIC_MAX_ASSIGN; import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.converter.FSConfigToCSConfigRuleHandler.MAX_CAPACITY_PERCENTAGE; import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.converter.FSConfigToCSConfigRuleHandler.MAX_CHILD_CAPACITY; import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.converter.FSConfigToCSConfigRuleHandler.QUEUE_AUTO_CREATE; import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.converter.FSConfigToCSConfigRuleHandler.RESERVATION_SYSTEM; import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.converter.FSConfigToCSConfigRuleHandler.SPECIFIED_NOT_FIRST; import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.converter.FSConfigToCSConfigRuleHandler.USER_MAX_APPS_DEFAULT; import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.converter.FSConfigToCSConfigRuleHandler.USER_MAX_RUNNING_APPS; import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.converter.FSConfigToCSConfigRuleHandler.RuleAction.ABORT; import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.converter.FSConfigToCSConfigRuleHandler.RuleAction.WARNING; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; import java.util.Map; import org.apache.commons.io.FileUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.service.ServiceStateException; import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.server.resourcemanager.placement.PlacementManager; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.placement.schema.MappingRulesDescription; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairSchedulerConfiguration; import org.apache.hadoop.yarn.util.resource.DominantResourceCalculator; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import com.fasterxml.jackson.databind.ObjectMapper; /** * Unit tests for FSConfigToCSConfigConverter. * */ @RunWith(MockitoJUnitRunner.class) public class TestFSConfigToCSConfigConverter { private static final String CLUSTER_RESOURCE_STRING = "vcores=20, memory-mb=240"; private static final Resource CLUSTER_RESOURCE = Resource.newInstance(16384, 16); private static final String FILE_PREFIX = "file:"; private static final String FAIR_SCHEDULER_XML = prepareFileName("fair-scheduler-conversion.xml"); private static final String FS_INVALID_PLACEMENT_RULES_XML = prepareFileName("fair-scheduler-invalidplacementrules.xml"); private static final String FS_ONLY_FAIR_POLICY_XML = prepareFileName("fair-scheduler-onlyfairpolicy.xml"); private static final String FS_MIXED_POLICY_XML = prepareFileName("fair-scheduler-orderingpolicy-mixed.xml"); private static final String FS_NO_PLACEMENT_RULES_XML = prepareFileName("fair-scheduler-noplacementrules.xml"); private static final String FS_MAX_AM_SHARE_DISABLED_XML = prepareFileName("fair-scheduler-defaultMaxAmShareDisabled.xml"); @Mock private FSConfigToCSConfigRuleHandler ruleHandler; @Mock private DryRunResultHolder dryRunResultHolder; @Mock private QueuePlacementConverter placementConverter; private FSConfigToCSConfigConverter converter; private Configuration config; @Rule public ExpectedException expectedException = ExpectedException.none(); private FSConfigConverterTestCommons converterTestCommons; private static String prepareFileName(String f) { return FILE_PREFIX + new File("src/test/resources/" + f).getAbsolutePath(); } private static final String FAIR_SCHEDULER_XML_INVALID = prepareFileName("fair-scheduler-invalid.xml"); private static final String YARN_SITE_XML = prepareFileName("yarn-site-with-allocation-file-ref.xml"); private static final String YARN_SITE_XML_NO_REF_TO_FS_XML = prepareFileName("yarn-site.xml"); private static final String YARN_SITE_XML_INVALID = prepareFileName("yarn-site-with-invalid-allocation-file-ref.xml"); private static final String CONVERSION_RULES_FILE = new File("src/test/resources/conversion-rules.properties") .getAbsolutePath(); private ConversionOptions createDefaultConversionOptions() { return new ConversionOptions(new DryRunResultHolder(), false); } @Before public void setup() throws IOException { config = new Configuration(false); config.set(FairSchedulerConfiguration.ALLOCATION_FILE, FAIR_SCHEDULER_XML); config.setBoolean(FairSchedulerConfiguration.MIGRATION_MODE, true); config.setBoolean(FairSchedulerConfiguration.USER_AS_DEFAULT_QUEUE, true); createConverter(); converterTestCommons = new FSConfigConverterTestCommons(); converterTestCommons.setUp(); } @After public void tearDown() { converterTestCommons.tearDown(); } private void createConverter() { converter = new FSConfigToCSConfigConverter(ruleHandler, createDefaultConversionOptions()); converter.setClusterResource(CLUSTER_RESOURCE); converter.setConvertPlacementRules(false); } private FSConfigToCSConfigConverterParams.Builder createDefaultParamsBuilder() { return FSConfigToCSConfigConverterParams.Builder.create() .withYarnSiteXmlConfig(YARN_SITE_XML) .withOutputDirectory(FSConfigConverterTestCommons.OUTPUT_DIR); } private FSConfigToCSConfigConverterParams.Builder createParamsBuilder(String yarnSiteConfig) { return FSConfigToCSConfigConverterParams.Builder.create() .withYarnSiteXmlConfig(yarnSiteConfig) .withOutputDirectory(FSConfigConverterTestCommons.OUTPUT_DIR); } @Test public void testDefaultMaxAMShare() throws Exception { converter.convert(config); Configuration conf = converter.getCapacitySchedulerConfig(); String maxAmShare = conf.get(CapacitySchedulerConfiguration. MAXIMUM_APPLICATION_MASTERS_RESOURCE_PERCENT); assertEquals("Default max AM share", "0.16", maxAmShare); assertEquals("root.admins.alice max-am-resource-percent", "0.15", conf.get(PREFIX + "root.admins.alice.maximum-am-resource-percent")); assertNull("root.users.joe maximum-am-resource-percent should be null", conf.get(PREFIX + "root.users.joe maximum-am-resource-percent")); } @Test public void testDefaultMaxAMShareDisabled() throws Exception { FSConfigToCSConfigConverterParams params = createDefaultParamsBuilder() .withClusterResource(CLUSTER_RESOURCE_STRING) .withFairSchedulerXmlConfig(FS_MAX_AM_SHARE_DISABLED_XML) .build(); converter.convert(params); Configuration conf = converter.getCapacitySchedulerConfig(); // -1.0 means disabled ==> 1.0 in CS assertEquals("Default max-am-resource-percent", "1.0", conf.get(CapacitySchedulerConfiguration. MAXIMUM_APPLICATION_MASTERS_RESOURCE_PERCENT)); // root.admins.bob -1.0 equals to the default -1.0 assertNull("root.admins.bob maximum-am-resource-percent should be null", conf.get(PREFIX + "root.admins.bob.maximum-am-resource-percent")); // root.admins.alice 0.15 != -1.0 assertEquals("root.admins.alice max-am-resource-percent", "0.15", conf.get(PREFIX + "root.admins.alice.maximum-am-resource-percent")); // root.users.joe is unset, inherits -1.0 assertNull("root.users.joe maximum-am-resource-percent should be null", conf.get(PREFIX + "root.users.joe.maximum-am-resource-percent")); } @Test public void testConvertACLs() throws Exception { converter.convert(config); Configuration conf = converter.getCapacitySchedulerConfig(); // root assertEquals("root submit ACL", "alice,bob,joe,john hadoop_users", conf.get(PREFIX + "root.acl_submit_applications")); assertEquals("root admin ACL", "alice,bob,joe,john hadoop_users", conf.get(PREFIX + "root.acl_administer_queue")); // root.admins.bob assertEquals("root.admins.bob submit ACL", "bob ", conf.get(PREFIX + "root.admins.bob.acl_submit_applications")); assertEquals("root.admins.bob admin ACL", "bob ", conf.get(PREFIX + "root.admins.bob.acl_administer_queue")); // root.admins.alice assertEquals("root.admins.alice submit ACL", "alice ", conf.get(PREFIX + "root.admins.alice.acl_submit_applications")); assertEquals("root.admins.alice admin ACL", "alice ", conf.get(PREFIX + "root.admins.alice.acl_administer_queue")); // root.users.john assertEquals("root.users.john submit ACL", "john ", conf.get(PREFIX + "root.users.john.acl_submit_applications")); assertEquals("root.users.john admin ACL", "john ", conf.get(PREFIX + "root.users.john.acl_administer_queue")); // root.users.joe assertEquals("root.users.joe submit ACL", "joe ", conf.get(PREFIX + "root.users.joe.acl_submit_applications")); assertEquals("root.users.joe admin ACL", "joe ", conf.get(PREFIX + "root.users.joe.acl_administer_queue")); } @Test public void testDefaultQueueMaxParallelApps() throws Exception { converter.convert(config); Configuration conf = converter.getCapacitySchedulerConfig(); assertEquals("Default max parallel apps", 15, conf.getInt(PREFIX + "max-parallel-apps", -1)); } @Test public void testSpecificQueueMaxParallelApps() throws Exception { converter.convert(config); Configuration conf = converter.getCapacitySchedulerConfig(); assertEquals("root.admins.alice max parallel apps", 2, conf.getInt(PREFIX + "root.admins.alice.max-parallel-apps", -1)); } @Test public void testDefaultUserMaxParallelApps() throws Exception { converter.convert(config); Configuration conf = converter.getCapacitySchedulerConfig(); int userMaxParallelApps = conf.getInt( PREFIX + "user.max-parallel-apps", -1); assertEquals("Default user max parallel apps", 10, userMaxParallelApps); } @Test public void testSpecificUserMaxParallelApps() throws Exception { converter.convert(config); Configuration conf = converter.getCapacitySchedulerConfig(); assertEquals("Max parallel apps for alice", 30, conf.getInt(PREFIX + "user.alice.max-parallel-apps", -1)); assertNull("Max parallel apps should be undefined for user bob", conf.get(PREFIX + "user.bob.max-parallel-apps")); assertNull("Max parallel apps should be undefined for user joe", conf.get(PREFIX + "user.joe.max-parallel-apps")); assertNull("Max parallel apps should be undefined for user john", conf.get(PREFIX + "user.john.max-parallel-apps")); } @Test public void testQueueMaxChildCapacityNotSupported() throws Exception { expectedException.expect(UnsupportedPropertyException.class); expectedException.expectMessage("test"); Mockito.doThrow(new UnsupportedPropertyException("test")) .when(ruleHandler).handleMaxChildCapacity(); converter.convert(config); } @Test public void testReservationSystemNotSupported() throws Exception { expectedException.expect(UnsupportedPropertyException.class); expectedException.expectMessage("maxCapacity"); Mockito.doThrow(new UnsupportedPropertyException("maxCapacity")) .when(ruleHandler).handleMaxChildCapacity(); config.setBoolean(YarnConfiguration.RM_RESERVATION_SYSTEM_ENABLE, true); converter.convert(config); } @Test public void testConvertFSConfigurationClusterResource() throws Exception { FSConfigToCSConfigConverterParams params = createDefaultParamsBuilder() .withClusterResource(CLUSTER_RESOURCE_STRING) .build(); converter.convert(params); assertEquals("Resource", Resource.newInstance(240, 20), converter.getClusterResource()); } @Test public void testConvertFSConfigPctModeUsedAndClusterResourceDefined() throws Exception { FSConfigToCSConfigConverterParams params = createDefaultParamsBuilder() .withClusterResource(CLUSTER_RESOURCE_STRING) .build(); converter.convert(params); assertEquals("Resource", Resource.newInstance(240, 20), converter.getClusterResource()); } @Test public void testConvertFSConfigurationClusterResourceInvalid() throws Exception { FSConfigToCSConfigConverterParams params = createDefaultParamsBuilder() .withClusterResource("vcores=20, memory-mb=240G") .build(); expectedException.expect(ConversionException.class); expectedException.expectMessage("Error while parsing resource"); converter.convert(params); } @Test public void testConvertFSConfigurationClusterResourceInvalid2() throws Exception { FSConfigToCSConfigConverterParams params = createDefaultParamsBuilder() .withClusterResource("vcores=20, memmmm=240") .build(); expectedException.expect(ConversionException.class); expectedException.expectMessage("Error while parsing resource"); converter.convert(params); } @Test public void testConvertFSConfigurationRulesFile() throws Exception { ruleHandler = new FSConfigToCSConfigRuleHandler( createDefaultConversionOptions()); createConverter(); FSConfigToCSConfigConverterParams params = createDefaultParamsBuilder() .withConversionRulesConfig(CONVERSION_RULES_FILE) .withClusterResource("vcores=20, memory-mb=2400") .build(); try { converter.convert(params); fail("Should have thrown UnsupportedPropertyException!"); } catch (UnsupportedPropertyException e) { //need to catch exception so we can check the rules } ruleHandler = converter.getRuleHandler(); Map<String, FSConfigToCSConfigRuleHandler.RuleAction> actions = ruleHandler.getActions(); assertEquals("maxCapacityPercentage", ABORT, actions.get(MAX_CAPACITY_PERCENTAGE)); assertEquals("maxChildCapacity", ABORT, actions.get(MAX_CHILD_CAPACITY)); assertEquals("userMaxRunningApps", ABORT, actions.get(USER_MAX_RUNNING_APPS)); assertEquals("userMaxAppsDefault", ABORT, actions.get(USER_MAX_APPS_DEFAULT)); assertEquals("dynamicMaxAssign", ABORT, actions.get(DYNAMIC_MAX_ASSIGN)); assertEquals("specifiedNotFirstRule", ABORT, actions.get(SPECIFIED_NOT_FIRST)); assertEquals("reservationSystem", ABORT, actions.get(RESERVATION_SYSTEM)); assertEquals("queueAutoCreate", ABORT, actions.get(QUEUE_AUTO_CREATE)); } @Test public void testConvertFSConfigurationWithoutRulesFile() throws Exception { ruleHandler = new FSConfigToCSConfigRuleHandler( createDefaultConversionOptions()); createConverter(); FSConfigToCSConfigConverterParams params = createDefaultParamsBuilder() .withClusterResource(CLUSTER_RESOURCE_STRING) .build(); converter.convert(params); ruleHandler = converter.getRuleHandler(); Map<String, FSConfigToCSConfigRuleHandler.RuleAction> actions = ruleHandler.getActions(); assertEquals("maxCapacityPercentage", WARNING, actions.get(MAX_CAPACITY_PERCENTAGE)); assertEquals("maxChildCapacity", WARNING, actions.get(MAX_CHILD_CAPACITY)); assertEquals("userMaxRunningApps", WARNING, actions.get(USER_MAX_RUNNING_APPS)); assertEquals("userMaxAppsDefault", WARNING, actions.get(USER_MAX_APPS_DEFAULT)); assertEquals("dynamicMaxAssign", WARNING, actions.get(DYNAMIC_MAX_ASSIGN)); assertEquals("specifiedNotFirstRule", WARNING, actions.get(SPECIFIED_NOT_FIRST)); assertEquals("reservationSystem", WARNING, actions.get(RESERVATION_SYSTEM)); assertEquals("queueAutoCreate", WARNING, actions.get(QUEUE_AUTO_CREATE)); } @Test public void testConvertFSConfigurationUndefinedYarnSiteConfig() throws Exception { FSConfigToCSConfigConverterParams params = FSConfigToCSConfigConverterParams.Builder.create() .withYarnSiteXmlConfig(null) .withOutputDirectory(FSConfigConverterTestCommons.OUTPUT_DIR) .build(); expectedException.expect(PreconditionException.class); expectedException.expectMessage( "yarn-site.xml configuration is not defined"); converter.convert(params); } @Test public void testConvertCheckOutputDir() throws Exception { FSConfigToCSConfigConverterParams params = createDefaultParamsBuilder() .withClusterResource(CLUSTER_RESOURCE_STRING) .withConvertPlacementRules(true) .withPlacementRulesToFile(true) .build(); converter.convert(params); Configuration conf = getConvertedCSConfig(FSConfigConverterTestCommons.OUTPUT_DIR); File capacityFile = new File(FSConfigConverterTestCommons.OUTPUT_DIR, "capacity-scheduler.xml"); assertTrue("Capacity file exists", capacityFile.exists()); assertTrue("Capacity file length > 0", capacityFile.length() > 0); assertTrue("No. of configuration elements > 0", conf.size() > 0); File yarnSiteFile = new File(FSConfigConverterTestCommons.OUTPUT_DIR, "yarn-site.xml"); assertTrue("Yarn site exists", yarnSiteFile.exists()); assertTrue("Yarn site length > 0", yarnSiteFile.length() > 0); File mappingRulesFile = new File(FSConfigConverterTestCommons.OUTPUT_DIR, "mapping-rules.json"); assertTrue("Mapping rules file exists", mappingRulesFile.exists()); assertTrue("Mapping rules file length > 0", mappingRulesFile.length() > 0); } @Test public void testFairSchedulerXmlIsNotDefinedNeitherDirectlyNorInYarnSiteXml() throws Exception { FSConfigToCSConfigConverterParams params = createParamsBuilder(YARN_SITE_XML_NO_REF_TO_FS_XML) .withClusterResource(CLUSTER_RESOURCE_STRING) .build(); expectedException.expect(PreconditionException.class); expectedException.expectMessage("fair-scheduler.xml is not defined"); converter.convert(params); } @Test public void testInvalidFairSchedulerXml() throws Exception { FSConfigToCSConfigConverterParams params = createDefaultParamsBuilder() .withClusterResource(CLUSTER_RESOURCE_STRING) .withFairSchedulerXmlConfig(FAIR_SCHEDULER_XML_INVALID) .build(); expectedException.expect(RuntimeException.class); converter.convert(params); } @Test public void testInvalidYarnSiteXml() throws Exception { FSConfigToCSConfigConverterParams params = createParamsBuilder(YARN_SITE_XML_INVALID) .withClusterResource(CLUSTER_RESOURCE_STRING) .build(); expectedException.expect(RuntimeException.class); converter.convert(params); } @Test public void testConversionWithInvalidPlacementRules() throws Exception { config = new Configuration(false); config.set(FairSchedulerConfiguration.ALLOCATION_FILE, FS_INVALID_PLACEMENT_RULES_XML); config.setBoolean(FairSchedulerConfiguration.MIGRATION_MODE, true); expectedException.expect(ServiceStateException.class); converter.convert(config); } @Test public void testConversionWhenInvalidPlacementRulesIgnored() throws Exception { FSConfigToCSConfigConverterParams params = createDefaultParamsBuilder() .withClusterResource(CLUSTER_RESOURCE_STRING) .withFairSchedulerXmlConfig(FS_INVALID_PLACEMENT_RULES_XML) .build(); ConversionOptions conversionOptions = createDefaultConversionOptions(); conversionOptions.setNoTerminalRuleCheck(true); converter = new FSConfigToCSConfigConverter(ruleHandler, conversionOptions); converter.convert(params); // expected: no exception } @Test public void testConversionWhenOnlyFairPolicyIsUsed() throws Exception { FSConfigToCSConfigConverterParams params = createDefaultParamsBuilder() .withClusterResource(CLUSTER_RESOURCE_STRING) .withFairSchedulerXmlConfig(FS_ONLY_FAIR_POLICY_XML) .build(); converter.convert(params); Configuration convertedConfig = converter.getYarnSiteConfig(); assertEquals("Resource calculator class shouldn't be set", null, convertedConfig.getClass( CapacitySchedulerConfiguration.RESOURCE_CALCULATOR_CLASS, null)); } @Test public void testConversionWhenMixedPolicyIsUsed() throws Exception { FSConfigToCSConfigConverterParams params = createDefaultParamsBuilder() .withClusterResource(CLUSTER_RESOURCE_STRING) .withFairSchedulerXmlConfig(FS_MIXED_POLICY_XML) .build(); converter.convert(params); Configuration convertedConfig = converter.getYarnSiteConfig(); assertEquals("Resource calculator type", DominantResourceCalculator.class, convertedConfig.getClass( CapacitySchedulerConfiguration.RESOURCE_CALCULATOR_CLASS, null)); } @Test public void testUserAsDefaultQueueWithPlacementRules() throws Exception { testUserAsDefaultQueueAndPlacementRules(true); } @Test public void testUserAsDefaultQueueWithoutPlacementRules() throws Exception { testUserAsDefaultQueueAndPlacementRules(false); } private void testUserAsDefaultQueueAndPlacementRules( boolean hasPlacementRules) throws Exception { config = new Configuration(false); config.setBoolean(FairSchedulerConfiguration.MIGRATION_MODE, true); if (hasPlacementRules) { config.set(FairSchedulerConfiguration.ALLOCATION_FILE, FAIR_SCHEDULER_XML); } else { config.set(FairSchedulerConfiguration.ALLOCATION_FILE, FS_NO_PLACEMENT_RULES_XML); } config.setBoolean(FairSchedulerConfiguration.USER_AS_DEFAULT_QUEUE, true); converter.setConvertPlacementRules(true); converter.setConsoleMode(true); converter.convert(config); String json = converter.getCapacitySchedulerConfig() .get(CapacitySchedulerConfiguration.MAPPING_RULE_JSON); MappingRulesDescription description = new ObjectMapper() .reader() .forType(MappingRulesDescription.class) .readValue(json); if (hasPlacementRules) { // fs.xml defines 5 rules assertEquals("Number of rules", 5, description.getRules().size()); } else { // by default, FS internally creates 2 rules assertEquals("Number of rules", 2, description.getRules().size()); } } @Test public void testPlacementRulesConversionDisabled() throws Exception { FSConfigToCSConfigConverterParams params = createDefaultParamsBuilder() .withClusterResource(CLUSTER_RESOURCE_STRING) .withFairSchedulerXmlConfig(FAIR_SCHEDULER_XML) .withConvertPlacementRules(false) .build(); converter.setPlacementConverter(placementConverter); converter.convert(params); verifyZeroInteractions(placementConverter); } @Test public void testPlacementRulesConversionEnabled() throws Exception { FSConfigToCSConfigConverterParams params = createDefaultParamsBuilder() .withClusterResource(CLUSTER_RESOURCE_STRING) .withFairSchedulerXmlConfig(FAIR_SCHEDULER_XML) .withConvertPlacementRules(true) .build(); converter.setPlacementConverter(placementConverter); converter.convert(params); verify(placementConverter).convertPlacementPolicy( any(PlacementManager.class), any(FSConfigToCSConfigRuleHandler.class), any(CapacitySchedulerConfiguration.class)); } @Test public void testConversionWhenAsyncSchedulingIsEnabled() throws Exception { boolean schedulingEnabledValue = testConversionWithAsyncSchedulingOption(true); assertTrue("Asynchronous scheduling should be true", schedulingEnabledValue); } @Test public void testConversionWhenAsyncSchedulingIsDisabled() throws Exception { boolean schedulingEnabledValue = testConversionWithAsyncSchedulingOption(false); assertEquals("Asynchronous scheduling should be the default value", CapacitySchedulerConfiguration.DEFAULT_SCHEDULE_ASYNCHRONOUSLY_ENABLE, schedulingEnabledValue); } private boolean testConversionWithAsyncSchedulingOption(boolean enabled) throws Exception { FSConfigToCSConfigConverterParams params = createDefaultParamsBuilder() .withClusterResource(CLUSTER_RESOURCE_STRING) .withFairSchedulerXmlConfig(FAIR_SCHEDULER_XML) .build(); ConversionOptions conversionOptions = createDefaultConversionOptions(); conversionOptions.setEnableAsyncScheduler(enabled); converter = new FSConfigToCSConfigConverter(ruleHandler, conversionOptions); converter.convert(params); Configuration convertedConfig = converter.getYarnSiteConfig(); return convertedConfig.getBoolean(CapacitySchedulerConfiguration.SCHEDULE_ASYNCHRONOUSLY_ENABLE, CapacitySchedulerConfiguration.DEFAULT_SCHEDULE_ASYNCHRONOUSLY_ENABLE); } private Configuration getConvertedCSConfig(String dir) throws IOException { File capacityFile = new File(dir, "capacity-scheduler.xml"); ByteArrayInputStream input = new ByteArrayInputStream(FileUtils.readFileToByteArray(capacityFile)); Configuration conf = new Configuration(false); conf.addResource(input); return conf; } }
aaa67377f263cf7acfae4b3f869824f9b43f8ac1
f553ee5889c9876d3c1356ce6461651dcf26bcc9
/_ASSETS/_BACKUP/v0.3.4/src_lib/de/christopherstock/lib/ViewSet.java
cc82082585aa56a25c8c510073a4a5c9c3ceda6f
[]
no_license
christopherstock/GC_LWJGL_J2SE_3dShooter
08885a706d35b5c317aea327c24b66510ec8c15e
2741f26820f9d7f4ac5738088138055917b20b05
refs/heads/master
2021-05-16T03:15:16.607331
2018-03-14T07:27:50
2018-03-14T07:27:50
34,397,885
1
0
null
null
null
null
UTF-8
Java
false
false
200
java
/* $Id: ViewSet.java 572 2011-04-16 20:52:37Z jenetic.bytemare $ * ======================================================================================= */ package de.christopherstock.lib;
ed195d92978d701cda17395f78585521a1e81143
d8162e1211aa83e93fc4e640b0fbb462ba4df126
/src/main/java/tjoker/server/core/Request.java
97a5d714b0f9fc7bca7a6184cce024286eabe086
[]
no_license
Tjoker-cell/webserver
696775bb76c6c73407e2fee71f4ae20e31ca3ff7
ec987c0b9a9515b0817d0922b49a69fe95a9b98b
refs/heads/master
2023-02-03T23:06:27.660699
2020-12-21T02:20:09
2020-12-21T02:20:09
323,200,182
1
0
null
null
null
null
UTF-8
Java
false
false
4,442
java
package tjoker.server.core; import com.sun.security.ntlm.Client; import tjoker.server.core.util.CloseUtil; import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.net.Socket; import java.util.*; /** * @program: server * @description: 封装请求:请求method、url、参数 * @author: 十字街头的守候 * @create: 2020-12-19 22:09 **/ public class Request { //请求方式 private String method; //请求资源 private String url; //请求参数 private Map<String, List<String>> paramMap=new HashMap<>(); // private ; private final String CRLF="\r\n"; private String requestInfo; private InputStream is; public Request(Socket client) throws IOException { this(client.getInputStream()); } public Request(InputStream is){ this.is=is; //获取请求协议 byte[] datas=new byte[1024*1024]; int len= 0; try { len = is.read(datas); requestInfo=new String(datas,0,len); } catch (IOException e) { e.printStackTrace(); return; } //分解字符串 parseRequestInfo(); } /** * 分析请求信息 */ private void parseRequestInfo() { String paramString =""; //接收请求参数 System.out.println("----分解开始-----"); if(requestInfo==null||(requestInfo=requestInfo.trim()).equals("")){ return ; } //获取请求方式 String firstLine=requestInfo.substring(0,requestInfo.indexOf(CRLF)); // /的位置 int idx=firstLine.indexOf("/"); method=firstLine.substring(0,idx).trim(); //获取请求url和参数 String urlStr=firstLine.substring(idx+1,firstLine.indexOf("HTTP/")).trim(); //判断方法是get 还是 post if(method.equalsIgnoreCase("post")){ url=urlStr; //请求参数 paramString=requestInfo.substring(requestInfo.lastIndexOf(CRLF)).trim(); }else if(method.equalsIgnoreCase("get")){ //是否含有参数 if(urlStr.contains("?")){ url=urlStr.substring(0,urlStr.indexOf("?")); paramString=urlStr.substring(urlStr.indexOf("?")+1).trim(); }else { url=urlStr; } } //不存在请求参数 if(paramString.equals("")){ return ; } //将请求参数封装到Map parseParams(paramString); } /** * 将请求参数封装到Map * @param paramString */ private void parseParams(String paramString) { //分割 将字符产转成数组 StringTokenizer token = new StringTokenizer(paramString, "&"); while(token.hasMoreTokens()){ String keyValue=token.nextToken(); String[] split = keyValue.split("="); split = Arrays.copyOf(split, 2); //获取key value String key=split[0]; String value=split[1]==null?null:decode(split[1],"utf-8"); //存储到map中 if(!paramMap.containsKey(key)){ paramMap.put(key,new ArrayList<String>()); } paramMap.get(key).add(value); } } /** * 通过name 获取多个值value * @param key * @return */ public String[] getParameterValues(String key){ if(!paramMap.containsKey(key)){ return null; } List<String> values=paramMap.get(key); return values.toArray(new String[0]); } private String decode(String value,String code) { try { return java.net.URLDecoder.decode(value,code); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return null; } /** * 通过name 获取一个值value * @param key * @return */ public String getParameterValue(String key){ String[] values = getParameterValues(key); return values==null?null:values[0]; } /** * 关闭资源 */ public void close(){ CloseUtil.closeIo(is); } public String getMethod() { return method; } public String getUrl() { return url; } public Map<String, List<String>> getParamMap() { return paramMap; } }
b201af724abd3e26e5f1123a8f743e57875cd81c
8d969f1d7455170e116b4ee1ec57f53d7b1aaf2b
/src/main/java/in/muthukumari/dao/RecipientDAO.java
76771dbdd9ae3009965d8dced4e2887eafbb5c52
[]
no_license
csys-fresher-batch-2021/paymentgateway-muthukumari
6051f60da7f28b8b240396140b6f9cebbc2a0e14
062f94d2c17528476ba5072b83857ce4ce65763c
refs/heads/main
2023-06-07T18:03:18.838728
2021-06-25T05:47:10
2021-06-25T05:47:10
364,485,565
1
0
null
2021-06-22T14:07:07
2021-05-05T06:47:39
Java
UTF-8
Java
false
false
3,214
java
package in.muthukumari.dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import in.muthukumari.exception.DBException; import in.muthukumari.model.Recipient; import in.muthukumari.util.ConnectionUtil; public class RecipientDAO { private RecipientDAO() { // Default Construtor } /** * This method used to add the recipient bank details to the DB * * @param recipient * @throws DBException */ public static void addRecipientDetail(Recipient recipient) throws DBException { Connection connection = null; PreparedStatement pst = null; try { // To Get the connection connection = ConnectionUtil.getConnection(); // Query String sql = "INSERT INTO recipientdetails(recipient_bankname,recipient_accnum, balance_amount, sender_accnum) VALUES(?,?,?,?)"; // To Execute pst = connection.prepareStatement(sql); pst.setString(1, recipient.getReceiverbank()); pst.setLong(2, recipient.getReceiverAccNum()); pst.setDouble(3, recipient.getTransferAmount()); pst.setLong(4, recipient.getSenderAccNum()); pst.executeUpdate(); } catch (ClassNotFoundException | SQLException e) { throw new DBException("Sorry! Something went wrong, Unable to add recipient details"); } finally { // Release the connection ConnectionUtil.close(pst, connection); } } /** * This method used to check if the account number is exists or not * * @return * @throws DBException */ public static boolean isRepeatedAccountNumber(long accountNum) throws DBException { Connection connection = null; PreparedStatement pst = null; ResultSet rs = null; boolean isRepeated = false; try { // To establish connection connection = ConnectionUtil.getConnection(); // SQl commands String sql = "select recipient_accnum from recipientdetails where recipient_accnum=?"; // Execute query pst = connection.prepareStatement(sql); pst.setLong(1, accountNum); rs = pst.executeQuery(); if (rs.next()) { isRepeated = true; } } catch (ClassNotFoundException | SQLException e) { throw new DBException("Sorry! Unable to get Account number"); } finally { // Close the connection ConnectionUtil.close(rs, pst, connection); } return isRepeated; } /** * This method used to get the balance amount for the recipient account number * * @param accNum * @return * @throws DBException */ public static double getBalanceAmount(long accNum) throws DBException { Connection con = null; ResultSet rs = null; PreparedStatement pst = null; String sql; double amount = 0; try { // Step 1: Get Connection con = ConnectionUtil.getConnection(); // Step 2: Query sql = "select balance_amount from recipientdetails where recipient_accnum=?"; pst = con.prepareStatement(sql); pst.setLong(1, accNum); rs = pst.executeQuery(); if (rs.next()) { amount = rs.getDouble("balance_amount"); } } catch (ClassNotFoundException | SQLException e) { throw new DBException("Unable to get the balance amount"); } finally { // Step 5: Release the connection ConnectionUtil.close(pst, con); } return amount; } }
dd379e45259bffa6cf22248a13eb727db80456a0
a13bcc186f507987d75cc318196766a36a3f5ab9
/client/Voluntinder/app/src/main/java/edu/upc/carlota/hacks/voluntinder/Utils/Helpers.java
71cc7859d9d3139846392a8397e33f24293ca37c
[]
no_license
paualos3/voluntinder-server
6edd7531e1d2b72fdfb61f22a6c7fa87ad60b820
8a0259e7fb0c7e73b5d2d0791d34e4deed31ea15
refs/heads/master
2021-04-09T13:43:12.393073
2018-03-18T07:10:35
2018-03-18T07:10:35
125,614,277
0
0
null
null
null
null
UTF-8
Java
false
false
2,573
java
package edu.upc.carlota.hacks.voluntinder.Utils; import android.util.Log; import android.widget.ImageView; import org.json.JSONObject; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import edu.upc.carlota.hacks.voluntinder.R; public class Helpers { public static String iStreamToString(InputStream is1) { BufferedReader rd = new BufferedReader(new InputStreamReader(is1), 4096); String line; StringBuilder sb = new StringBuilder(); try { while ((line = rd.readLine()) != null) { sb.append(line); } rd.close(); } catch (IOException e) { e.printStackTrace(); } return sb.toString(); } public static String showDate(JSONObject d){ Log.i("date",""); return ""; } public static String showDate(String d) { String[] res = d.split("T")[0].split("-"); if (res.length == 3) { return "" + res[2] + "/" + res[1] + "/" + res[0]; }else{ return "dd/MM/yyyy"; } } public static void changeFlag(ImageView canviidioma) { switch (Constants.Idioma) { case "ca": //canviidioma.setImageResource(R.drawable.rep); break; case "es": //canviidioma.setImageResource(R.drawable.spa); break; case "en": //canviidioma.setImageResource(R.drawable.ing); break; } } public static String getBarrio(Integer zona) { String barrio = ""; switch (zona) { case 0: barrio = "Ciutat Vella"; break; case 1: barrio = "Eixample"; break; case 2: barrio = "Sants-Montjuic"; break; case 3: barrio = "Les Corts"; break; case 4: barrio = "Sarrià-Sant Gervasi"; break; case 5: barrio = "Gràcia"; break; case 6: barrio = "Horta-Guinardó"; break; case 7: barrio = "Nou Barris"; break; case 8: barrio = "San Andreu"; break; case 9: barrio = "San Martí"; break; } return barrio; } }
8f5d477d47dce07f5348918e30b9fe0fba1912ba
0d0332a5861a2e5e66d6a0ab3928a980603365e0
/src/main/java/fr/xebia/xke/repository/query/ProductRepositoryQuery.java
db0b849d2af7a679791cf47ce936b367ae0bcd54
[]
no_license
jlrigau/refactoring-with-guava
e2a2dfcef47baa3b9f77d23f3d2967809a412c09
27a6798daf392e0653097a5fca87b00a6bce72ef
refs/heads/master
2021-01-20T05:29:24.546636
2013-06-28T12:08:23
2013-06-28T12:10:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,177
java
package fr.xebia.xke.repository.query; public final class ProductRepositoryQuery { public static final String GET_SALES_TRADER_ALL_PRODUCTS_QUERY = "" + "SELECT product.id ID, product.name NAME, product.nominal NOMINAL, sales.name SALES,\n" + " pricer.name PRICER, swaptrader.name SWAPTRADER\n" + "FROM product product\n" + " left join user sales on sales.id = product.sales_id\n" + " left join user pricer on pricer.id = product.pricer_id\n" + " left join user swaptrader on swaptrader.id = product.swaptrader_id,\n" + " user initUser\n" + " inner join user_role initUserRole on initUserRole.user_id = initUser.id\n" + " inner join role initRole on initRole.id = initUserRole.roles_id\n" + " inner join team_members_by_user members on members.user_id = initUser.id\n" + " inner join user member on member.id = members.member_id\n" + " inner join user_role memberUserRole on memberUserRole.user_id = member.id\n" + " inner join role memberRole on memberRole.id = memberUserRole.roles_id\n" + "WHERE initUser.id = :userId\n" + " AND ((initRole.name IN ('Sales', 'Sales-Analyst') AND memberRole.name = 'Sales' AND (product.sales_id = member.id OR product.salesinitiator_id = member.id))\n" + " OR (initRole.name = 'Trader' AND memberRole.name = 'Trader' AND (product.cdstrader_id = member.id OR product.xccytrader_id = member.id OR product.swaptrader_id = member.id)))\n"; public static final String GET_ALL_PRODUCTS_QUERY = "" + "SELECT product.id ID, product.name NAME, product.nominal NOMINAL, sales.name SALES,\n" + " pricer.name PRICER, swaptrader.name SWAPTRADER\n" + "FROM product product\n" + " left join user sales on sales.id = product.sales_id\n" + " left join user pricer on pricer.id = product.pricer_id\n" + " left join user swaptrader on swaptrader.id = product.swaptrader_id\n"; }
5fc7818056f45bc01f8770325b7a5670d4b43857
fd7685cd3779b68b48611b6f66133b00660a099c
/src/main/java/com/ds/week2/IntersectionOfArrays.java
ef3658bbf88d6fb8a55cd1a98ee3abd8729fb6be
[]
no_license
Haja49/DataStructuresPractice
02e8d3735d2ed659b29425e733a612678040c7ae
cf29e675dbc1cac778d785e3ba342b97dc1be34e
refs/heads/master
2023-08-10T19:08:59.026656
2021-09-23T02:16:08
2021-09-23T02:16:08
383,140,293
0
0
null
null
null
null
UTF-8
Java
false
false
4,957
java
package com.ds.week2; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.junit.Assert; import org.junit.Test; public class IntersectionOfArrays { /* * 2) Given two integer arrays nums1 and nums2, return an array of their intersection. * Each element in the result must appear as many times as it shows in both arrays and * you may return the result in any order */ /* * 1) Did I understand the problem? Yes * -> If yes, go to next step !! * * What is the input(s)? int[] * What is the expected output? int[] * Do I have constraints to solve the problem? 1 <= nums1.length, nums2.length <= 1000 * 0 <= nums1[i], nums2[i] <= 1000 * Do I have all informations to go to next step!! * How big is your test data set will be? * * 2) Test data set * * Minimum of 3 data set !! Positive, Edge, Negative * Validate with the interviewer if the data set is fine by his/her assumptions * * 3) Do I know how to solve it? * * Yes - great, is there an alternate? * * 4) Ask for hint (If you do not know how to solve) * * 5) Do I know alternate solutions as well? No * * No - That is still fine, proceed to solve by what you know !! * * 6) If you know alternate solutions -> find out the O Notations (Performance) * * Then, explain either both or the best (depends on the time) * * Approach 1: Start with worst -> Improve (Optimize) -> End up with the best * Approach 2: Write down the options and benefits and code the best * * 7) Start always with Psuedo code * * 8) Implement them in the code (editor) * * 9) Test against the different data set * * 10) If it fails, debug them to solve it !! * */ @Test public void test1() { int[] input1 = { 1, 2, 2, 1 }; int[] input2 = { 2, 2 }; Assert.assertArrayEquals(intersection(input1, input2), new int[] { 2, 2 }); } @Test public void test2() { int[] input1 = { 1, 2, 3 }; int[] input2 = { 4, 5, 6 }; Assert.assertArrayEquals(intersection(input1, input2), new int[] { }); } @Test public void test3() { int[] input1 = {}; int[] input2 = { 1, 2, 3 }; Assert.assertArrayEquals(intersection(input1, input2), new int[] {}); } @Test public void test4() { int[] input1 = { 1, 2, 3, 2 }; int[] input2 = { 1, 2, 3, 2 }; Assert.assertArrayEquals(intersection(input1, input2), new int[] { 1, 2, 3, 2 }); } @Test public void test5() { int[] input1 = { 1, 2, 2, 1 }; int[] input2 = { 2 }; Assert.assertArrayEquals(intersection(input1, input2), new int[] { 2 }); } /* * 1. Sort the Given input arrays * 2. Initialize a list * 3. Initialize 2 pointers for the 2 arrays * 4. while the length of either of array is less than pointer value, * a) If the value of both pointer elements are equal * i) add the value to list and increment both pointers * b) Else if 1st pointer element is less than 2nd pointer element * i) increment 1st pointer * c) Else increment 2nd pointer * 5. Convert the list to array and return it */ // Time Complexity ==> O(nlogn) // Space Complexity ==> O(n) public int[] intersectionUsingTwoPointers(int[] nums1, int[] nums2) { if (nums1.length == 0 || nums2.length == 0) { return new int[] {}; } Arrays.sort(nums1); Arrays.sort(nums2); int[] output = new int[Math.min(nums1.length, nums2.length)]; int left1 = 0; int left2 = 0; int count = 0; // List<Integer> list = new ArrayList<Integer>(); while (left1 < nums1.length && left2 < nums2.length) { if (nums1[left1] == nums2[left2]) { // list.add(nums1[i++]); output[count++] = nums1[left1++]; left2++; } else if (nums1[left1] < nums2[left2]) { left1++; } else { left2++; } } /* int[] output = new int[list.size()]; for (int i = 0; i < list.size(); i++) { output[i] = list.get(i); } return output*/ return Arrays.copyOf(output, count); } /* * 1. If the size of any input is 0, return empty array * 2. Initialize an empty array with size of minimum length of both arrays. * 3. Compare the array elements and add it to the output array * 4. Finally return the output array with only the size based on the list */ /* * Time Complexity - O(n^2) * Space Complexity - O(n) */ private int[] intersection(int[] nums1, int[] nums2) { if (nums1.length == 0 || nums2.length == 0) return new int[] {}; int[] output = new int[Math.min(nums1.length, nums2.length)]; int count = 0; for (int i = 0; i < nums1.length; i++) { for (int j = 0; j < nums2.length; j++) { if (nums1[i] == nums2[j]) { output[count++] = nums1[i]; break; } } } return Arrays.copyOf(output, count); } }
986f1db37b4d0d0370f5f634c1972d35c1dbcd0a
11646ed0207187f909bebb3e86bd979e2bf804c5
/src/main/java/com/dto/RegistrationDTO.java
cd5053edad4c3d887f1925c8f3403ca00443b5ab
[]
no_license
rim-D/202101_platnsShop
8e941dfeecb79c78356b1dfa81700734e0d4a657
5662f962c14327e1fd1be2bfbd540b382e1a3065
refs/heads/master
2023-02-28T04:54:54.703175
2021-02-08T05:19:09
2021-02-08T05:19:09
336,968,178
0
0
null
null
null
null
UTF-8
Java
false
false
1,963
java
package com.dto; import java.util.ArrayList; import org.apache.ibatis.type.Alias; @Alias("registrationDTO") public class RegistrationDTO { private String id; private String pw; private String name; private String birth; private String phone; private String post; private String addr1; private String addr2; private ArrayList<String> agree; public RegistrationDTO() {} public RegistrationDTO(String id, String pw, String name, String birth, String phone, String post, String addr1, String addr2, ArrayList<String> agree) { super(); this.id = id; this.pw = pw; this.name = name; this.birth = birth; this.phone = phone; this.post = post; this.addr1 = addr1; this.addr2 = addr2; this.agree = agree; } @Override public String toString() { return "RegistrationDTO [id=" + id + ", pw=" + pw + ", name=" + name + ", birth=" + birth + ", phone=" + phone + ", post=" + post + ", addr1=" + addr1 + ", addr2=" + addr2 + ", agree=" + agree + "]"; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getPw() { return pw; } public void setPw(String pw) { this.pw = pw; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getBirth() { return birth; } public void setBirth(String birth) { this.birth = birth; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getPost() { return post; } public void setPost(String post) { this.post = post; } public String getAddr1() { return addr1; } public void setAddr1(String addr1) { this.addr1 = addr1; } public String getAddr2() { return addr2; } public void setAddr2(String addr2) { this.addr2 = addr2; } public ArrayList<String> getAgree() { return agree; } public void setAgree(ArrayList<String> agree) { this.agree = agree; } }
7534b54ab4326547bad6b606c0f8021b91113884
b6dc2e4581f6567b2dcc0d9073e4b0e2d5a1e98f
/src/virtualpetsamok/OrganicDog.java
c13fd7ee919b1c9145712e6224236bdad0b8e617
[]
no_license
programmerjee/virtual-pets-amok
2941c6a15e41b8020c791bcf7e76d062778eabcf
45b6952cf0fcf9bd608a84021a95a9a756715235
refs/heads/master
2021-07-12T21:05:56.349868
2017-10-17T21:07:39
2017-10-17T21:07:39
105,821,635
1
0
null
null
null
null
UTF-8
Java
false
false
766
java
package virtualpetsamok; public class OrganicDog extends Dog implements Organic { int hunger = 10; int thirst = 10; int cleanliness = 10; public OrganicDog(String name, int happiness, int health, int hunger, int thirst, int cleanliness) { super(name, happiness, health); this.hunger = hunger; this.thirst = thirst; this.cleanliness = cleanliness; } @Override public void tick() { petHappiness -=1; hunger -= 1; thirst -= 1; cleanliness -= 1; if (hunger <= 0 || thirst <=0 || cleanliness <=0 || petHappiness<=0) { petHealth-=1; } } public void feed() { hunger += 5; } public void water() { thirst += 5; } public void walk() { super.walk(); cleanliness += 5; } public void cleanCages() { cleanliness += 5; } }
011c4e061c02ec6266dc86d351389738be30dfda
e26c34f949a78e4c7125556a5d2abcd8ae120d33
/src/test/java/net/unit8/solr/jdbc/SelectQueryTest.java
c7957c3470615f9bc151cb15cb4d52ccf6965939
[ "Apache-2.0" ]
permissive
solrcn/solr-jdbc
1e142493798dec70c16ea15260885e61b2e3d842
88172e4699ca71b3c1a55222187449c542f6556d
refs/heads/master
2021-01-23T21:11:41.356686
2015-03-22T06:36:11
2015-03-22T06:36:11
32,619,481
0
1
null
2015-03-21T04:09:24
2015-03-21T04:09:23
null
UTF-8
Java
false
false
9,669
java
package net.unit8.solr.jdbc; import net.unit8.solr.jdbc.message.ErrorCode; import org.junit.After; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import java.sql.*; import static org.junit.Assert.*; public class SelectQueryTest { Connection conn; @Before public void setUp() throws Exception { conn = DriverManager.getConnection("jdbc:solr:s"); } @After public void tearDown() throws Exception { conn.close(); } @Test public void testStatement() throws SQLException { String[][] expected = {{"高橋慶彦"},{"山崎隆造"},{"衣笠祥雄"},{"山本浩二"},{"ランディーバース"}}; verifyStatement("SELECT player_name FROM player ORDER BY player_id", expected); } @Test public void testStatementLimit() throws SQLException { String[][] expected = {{"山崎隆造"},{"衣笠祥雄"},{"山本浩二"}}; verifyStatement("SELECT player_name FROM player ORDER BY player_id LIMIT 3 OFFSET 1", expected); } @Test public void testStatementOrderBy() throws SQLException { Object[][] expected = {{"ランディーバース"},{"山本浩二"},{"衣笠祥雄"},{"山崎隆造"},{"高橋慶彦"}}; verifyStatement("SELECT player_name FROM player ORDER BY player_id DESC", expected); } @Test public void testStatementCondition() throws SQLException { Object[][] expected1 = {{"山崎隆造"}}; verifyStatement("SELECT player_name FROM player WHERE player_id > 1 AND player_id < 3", expected1); Object[][] expected2 = {{"高橋慶彦"}, {"山崎隆造"}, {"衣笠祥雄"}}; verifyStatement("SELECT player_name FROM player WHERE player_id >= 1 AND player_id <= 3", expected2); } @Test public void testStatementOr() throws SQLException { Object[][] expected1 = {{"ランディーバース"}}; Object[] params = {"阪神"}; verifyPreparedStatement( "SELECT player_name FROM player WHERE (player_id = 1 OR player_id = 5) AND team=?", params, expected1); } @Test public void testStatementCount() throws SQLException { Object[][] expected = {{"5"}}; verifyStatement("SELECT count(*) FROM player", expected); } @Test public void testStatementGroupBy() throws SQLException { Object[][] expected = {{"カープ", "4"}, {"阪神", "1"}}; verifyStatement("SELECT team, count(*) FROM player GROUP BY team", expected); } @Test public void testStatementIn() throws SQLException { Object[][] expected = {{"山崎隆造"}, {"衣笠祥雄"}, {"ランディーバース"}}; Object[] params = {"一塁手", "二塁手"}; verifyPreparedStatement( "SELECT player_name FROM player WHERE position in (?,?) order by player_id", params, expected); } @Test public void testLike() throws SQLException { Object[][] expected = {{"衣笠祥雄"}}; Object[] params = {"衣笠%"}; verifyPreparedStatement( "SELECT player_name FROM player WHERE player_name like ?", params, expected); } @Test public void testLikeForText() throws SQLException { Object[][] expected = {{"高橋慶彦"}}; Object[] params = {"%三拍子%"}; verifyPreparedStatement( "SELECT player_name FROM player WHERE comment like ?", params, expected); } @Test public void testStartsForText() throws SQLException { Object[][] expected = {{"高橋慶彦"}}; Object[] params = {"走攻守%"}; verifyPreparedStatement( "SELECT player_name FROM player WHERE comment like ?", params, expected); } @Test public void testBetween() throws SQLException { Object[][] expected = {{"山崎隆造"}, {"衣笠祥雄"}}; Object[] params = {2,3}; verifyPreparedStatement( "SELECT player_name FROM player WHERE player_id BETWEEN ? AND ?", params, expected); } @Test public void testBoolean() throws SQLException { Object[][] expected = {{"山本浩二"}, {"ランディーバース"}}; Object[] params = {true}; verifyPreparedStatement("SELECT player_name FROM player WHERE was_homerun_king=?", params, expected); } /** * メタキャラクタを含んだクエリのテスト * エラーにならないこと * * @throws SQLException */ @Test public void testQueryContainsMetachar() throws SQLException { Object[][] expected = {}; Object[] params = {";&?"}; verifyPreparedStatement("SELECT player_name FROM player WHERE player_name=?", params, expected); } @Test public void testStatementTableNotFound() { try { conn.prepareStatement("select * from prayer"); fail("No Exception"); } catch (SQLException e) { assertEquals("TableOrViewNotFound", ErrorCode.TABLE_OR_VIEW_NOT_FOUND, e.getErrorCode()); } } @Test public void testStatementColumnNotFound() throws SQLException { PreparedStatement stmt = null; try { stmt = conn.prepareStatement("select prayer_name from player"); fail("No Exception"); } catch (SQLException e) { assertEquals("ColumnNotFound", ErrorCode.COLUMN_NOT_FOUND, e.getErrorCode()); } finally { if(stmt != null) stmt.close(); } } /** * get resultSet by column name */ @Test public void testGetColumnLabel() throws SQLException { Statement stmt = null; try { stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("Select player_name from player where player_id=3"); assertTrue(rs.next()); assertEquals("player_name", rs.getMetaData().getColumnLabel(1)); assertEquals("衣笠祥雄", rs.getString("player_name")); } finally { if (stmt != null) stmt.close(); } } private void verifyStatement(String selectQuery, Object[][] expected) throws SQLException{ Statement stmt = null; try { stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(selectQuery); int i=0; while(rs.next()) { for(int j=0; j<expected[i].length; j++) { assertEquals(expected[i][j], rs.getString(j+1)); } i+=1; } assertEquals("件数が正しい", expected.length, i); } catch(SQLException e) { e.printStackTrace(); fail("SQLException:" + e.getMessage()); } finally { if (stmt != null) { stmt.close(); } } } private void verifyPreparedStatement(String selectQuery, Object[] params, Object[][] expected) throws SQLException { PreparedStatement stmt = null; try { stmt = conn.prepareStatement(selectQuery); for(int i=0; i<params.length; i++) { stmt.setObject(i+1, params[i]); } ResultSet rs = stmt.executeQuery(); int i=0; while(rs.next()) { for(int j=0; j<expected[i].length; j++) { assertEquals(expected[i][j], rs.getString(j+1)); } i+=1; } assertEquals("件数が正しい", expected.length, i); } catch(SQLException e) { e.printStackTrace(); fail("SQLException:" + e.getMessage()); } finally { if(stmt != null) stmt.close(); } } @BeforeClass public static void init() throws SQLException, ClassNotFoundException { Class.forName(SolrDriver.class.getName()); Connection setUpConn = DriverManager.getConnection("jdbc:solr:s"); try { PreparedStatement dropStmt = setUpConn.prepareStatement("DROP TABLE player"); try { dropStmt.executeUpdate(); } catch(SQLException ignore) { ignore.printStackTrace(); } finally { dropStmt.close(); } PreparedStatement stmt = setUpConn.prepareStatement( "CREATE TABLE player (player_id number, team varchar(10), " + " player_name varchar(50), position varchar(10) ARRAY, " + " was_homerun_king boolean, comment TEXT," + " registered_at DATE)"); try { stmt.executeUpdate(); } finally { stmt.close(); } PreparedStatement insStmt = setUpConn.prepareStatement("INSERT INTO player Values (?,?,?,?,?,?,?)"); try { insStmt.setInt(1, 1); insStmt.setString(2, "カープ"); insStmt.setString(3, "高橋慶彦"); insStmt.setObject(4, new String[]{"遊撃手"}); insStmt.setBoolean(5, false); insStmt.setString(6, "走攻守の三拍子そろった切込隊長"); insStmt.setDate(7, new Date(System.currentTimeMillis())); insStmt.executeUpdate(); insStmt.setInt(1, 2); insStmt.setString(2, "カープ"); insStmt.setString(3, "山崎隆造"); insStmt.setObject(4, new String[]{"遊撃手","二塁手"}); insStmt.setBoolean(5, false); insStmt.setString(6, "ベストナイン3回、ゴールデングラブ賞4回"); insStmt.setDate(7, new Date(System.currentTimeMillis())); insStmt.executeUpdate(); insStmt.setInt(1, 3); insStmt.setString(2, "カープ"); insStmt.setString(3, "衣笠祥雄"); insStmt.setObject(4, new String[]{"一塁手","三塁手"}); insStmt.setBoolean(5, false); insStmt.setString(6, "鉄人。国民栄誉賞"); insStmt.setDate(7, new Date(System.currentTimeMillis())); insStmt.executeUpdate(); insStmt.setInt(1, 4); insStmt.setString(2, "カープ"); insStmt.setString(3, "山本浩二"); insStmt.setObject(4, new String[]{"外野手"}); insStmt.setBoolean(5, true); insStmt.setString(6, "ミスター赤ヘル"); insStmt.setDate(7, new Date(System.currentTimeMillis())); insStmt.executeUpdate(); insStmt.setInt(1, 5); insStmt.setString(2, "阪神"); insStmt.setString(3, "ランディーバース"); insStmt.setObject(4, new String[]{"一塁手","外野手"}); insStmt.setBoolean(5, true); insStmt.setString(6, "三冠王"); insStmt.setDate(7, new Date(System.currentTimeMillis())); insStmt.executeUpdate(); } finally { insStmt.close(); } setUpConn.commit(); } finally { setUpConn.close(); } } }
41d43aeec64cf1de4b9723049681a7ad91a7cce5
7ef661cd9e66dd2e9179c61aed28c5ffb6f13a68
/app/src/main/java/com/example/marwa/listapp/Cake.java
5df716b8a8a299c8a39a99b8d12720c91e01a5ea
[]
no_license
marwaHisham/Android-listview
bdd0b427b5dea944863bf277a6d8ec21a877ed90
61cd66d5a810b7ed21ff68069b67a04060c51c04
refs/heads/master
2020-03-17T19:36:47.983597
2018-05-17T21:30:33
2018-05-17T21:30:33
133,870,366
0
0
null
null
null
null
UTF-8
Java
false
false
811
java
package com.example.marwa.listapp; /** * Created by marwa on 17/03/18. */ public class Cake { int imgId; String headerTxt; String Desc; public Cake(String header, String desc, int thumb) { imgId = thumb; Desc = desc; headerTxt = header; } public int getImgId() { return imgId; } public void setImgId(int thumbnailID) { this.imgId = thumbnailID; } public String getHeaderTxt() { return headerTxt; } public void setHeaderTxt(String headerText) { this.headerTxt = headerText; } public String getDesc() { return Desc; } public void setDesc(String descText) { this.Desc = descText; } @Override public String toString() { return headerTxt; } }
c7cb1614ecfa98ad6803bdd4fe42a69f28173650
9b4a476d16288c9d65998edd2a7415124f7e613d
/wapp/src/main/java/com/isep/javaeeproject/service/tweets/TweeterApiConnectorService.java
2c594aaad6c3b34594d162fe547d0394b34ea246
[]
no_license
eboulben/isep-rest-project
88ed8f8a8873cb2486679083497b7f7b1e310907
a0c5d2feb61efd8b2a1eb7483d53c2787b7a9830
refs/heads/master
2020-05-17T03:15:22.565506
2015-02-08T20:19:10
2015-02-08T20:19:10
27,352,011
0
0
null
null
null
null
UTF-8
Java
false
false
248
java
package com.isep.javaeeproject.service.tweets; import com.isep.javaeeproject.dto.tweet.TweetDto; import java.util.List; public interface TweeterApiConnectorService { public List<TweetDto> getTweetsFromApiByAuthors(List<String> authors); }
f6eef43a9d1c6b303ceb1fb5dc9900d87312b824
e1ca052d40dff45495abb5d927c28f26215cd9cc
/data-filter/src/main/java/tuwien/filters/utils/Filter.java
576c69d096cb463282e5524a51b599322259639e
[]
no_license
lucamoroz/iot-blockchain-data-integration
5ca12dd7f823fad92bfa5d542dc0e81626f740f8
a853bd27c2f63bf7e4a247af2e461e0ae05968a7
refs/heads/master
2023-06-11T11:59:20.844756
2021-07-07T09:35:38
2021-07-07T09:35:38
334,104,004
2
1
null
null
null
null
UTF-8
Java
false
false
734
java
package tuwien.filters.utils; public class Filter { public static boolean isNumberConstraintValid(NumberConstraint constraint, Number number) { double constraintValue = constraint.getValue().doubleValue(); double value = number.doubleValue(); switch (constraint.getComparison()) { case LESS: return value < constraintValue; case LESS_OR_EQUAL: return value <= constraintValue; case EQUAL: return value == constraintValue; case GREATER_OR_EQUAL: return value >= constraintValue; case GREATER: return value > constraintValue; } return true; } }
80976aa63d2d13d4c3ea8df9c901f7f2d4f62c8f
e3c4870c8e8192df2c5735b0c27f51c22e059720
/src/sun/awt/datatransfer/ClassLoaderObjectInputStream.java
80657944aae91461a7858b4b8dab30aaff169758
[]
no_license
xiangtch/Java
fec461aee7fd1dfd71dd21a482a75022ce35af9d
64440428d9af03779ba96b120dbb4503c83283b1
refs/heads/master
2020-07-14T01:23:46.298973
2019-08-29T17:49:18
2019-08-29T17:49:18
205,199,738
0
0
null
null
null
null
UTF-8
Java
false
false
5,080
java
/* */ package sun.awt.datatransfer; /* */ /* */ import java.io.IOException; /* */ import java.io.InputStream; /* */ import java.io.ObjectInputStream; /* */ import java.io.ObjectStreamClass; /* */ import java.lang.reflect.Proxy; /* */ import java.util.HashSet; /* */ import java.util.Map; /* */ import java.util.Set; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ final class ClassLoaderObjectInputStream /* */ extends ObjectInputStream /* */ { /* */ private final Map<Set<String>, ClassLoader> map; /* */ /* */ ClassLoaderObjectInputStream(InputStream paramInputStream, Map<Set<String>, ClassLoader> paramMap) /* */ throws IOException /* */ { /* 154 */ super(paramInputStream); /* 155 */ if (paramMap == null) { /* 156 */ throw new NullPointerException("Null map"); /* */ } /* 158 */ this.map = paramMap; /* */ } /* */ /* */ protected Class<?> resolveClass(ObjectStreamClass paramObjectStreamClass) throws IOException, ClassNotFoundException /* */ { /* 163 */ String str = paramObjectStreamClass.getName(); /* */ /* 165 */ HashSet localHashSet = new HashSet(1); /* 166 */ localHashSet.add(str); /* */ /* 168 */ ClassLoader localClassLoader = (ClassLoader)this.map.get(localHashSet); /* 169 */ if (localClassLoader != null) { /* 170 */ return Class.forName(str, false, localClassLoader); /* */ } /* 172 */ return super.resolveClass(paramObjectStreamClass); /* */ } /* */ /* */ /* */ protected Class<?> resolveProxyClass(String[] paramArrayOfString) /* */ throws IOException, ClassNotFoundException /* */ { /* 179 */ HashSet localHashSet = new HashSet(paramArrayOfString.length); /* 180 */ for (int i = 0; i < paramArrayOfString.length; i++) { /* 181 */ localHashSet.add(paramArrayOfString[i]); /* */ } /* */ /* 184 */ ClassLoader localClassLoader1 = (ClassLoader)this.map.get(localHashSet); /* 185 */ if (localClassLoader1 == null) { /* 186 */ return super.resolveProxyClass(paramArrayOfString); /* */ } /* */ /* */ /* 190 */ ClassLoader localClassLoader2 = null; /* 191 */ int j = 0; /* */ /* */ /* 194 */ Class[] arrayOfClass = new Class[paramArrayOfString.length]; /* 195 */ for (int k = 0; k < paramArrayOfString.length; k++) { /* 196 */ Class localClass = Class.forName(paramArrayOfString[k], false, localClassLoader1); /* 197 */ if ((localClass.getModifiers() & 0x1) == 0) { /* 198 */ if (j != 0) { /* 199 */ if (localClassLoader2 != localClass.getClassLoader()) { /* 200 */ throw new IllegalAccessError("conflicting non-public interface class loaders"); /* */ } /* */ } /* */ else { /* 204 */ localClassLoader2 = localClass.getClassLoader(); /* 205 */ j = 1; /* */ } /* */ } /* 208 */ arrayOfClass[k] = localClass; /* */ } /* */ try { /* 211 */ return Proxy.getProxyClass(j != 0 ? localClassLoader2 : localClassLoader1, arrayOfClass); /* */ } /* */ catch (IllegalArgumentException localIllegalArgumentException) /* */ { /* 215 */ throw new ClassNotFoundException(null, localIllegalArgumentException); /* */ } /* */ } /* */ } /* Location: E:\java_source\rt.jar!\sun\awt\datatransfer\ClassLoaderObjectInputStream.class * Java compiler version: 8 (52.0) * JD-Core Version: 0.7.1 */
[ "imsmallmouse@gmail" ]
imsmallmouse@gmail
406d2d55c2b13140d6d7c6d5751eb239b472b486
ef25601135eb01e280d762098e3c428c43965320
/src/main/java/backend/DAO/interfaces/PointDao.java
6f43dd4e5a55973d7a72cf01a4675a369c8cbffb
[]
no_license
Belinracle/Lab4
7f4fcf294c105c8484870a01882e0bf00bb0e18f
0cb38fca5b4a5f0af1d2064f4340ac796a2228a6
refs/heads/master
2023-05-07T11:01:19.509312
2021-01-14T13:50:46
2021-01-14T13:50:46
312,396,876
2
0
null
null
null
null
UTF-8
Java
false
false
252
java
package backend.DAO.interfaces; import backend.entity.Point; import backend.entity.User; import java.util.List; public interface PointDao { List<Point> getPoints(User user); Point insertPoint(Point point); void deletePoints(User user); }
ff0b4cfc8c9853e732660fd8dc820bf12caa417a
73d4f7d1f6d51be34b13d3363bb08e03ab49383b
/src/main/java/com/aaa/controller/ProviderController.java
0c79d566e5c8087dab3217ebc65192129d7d5bb4
[]
no_license
pjxwalker/JXC
c7cdd4c56f012abce50c809d3cee7ec217f63265
750cc482a26e442298cea50c4b5a5468055b13a9
refs/heads/master
2022-06-27T14:15:00.941384
2019-11-04T06:31:44
2019-11-04T06:31:44
219,432,515
0
0
null
2020-07-02T01:10:12
2019-11-04T06:29:17
Java
UTF-8
Java
false
false
3,044
java
package com.aaa.controller; import com.aaa.entity.ProviderInfo; import com.aaa.service.ProviderInfoService; import com.aaa.util.ResultMap; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.HashMap; import java.util.List; import java.util.Map; @Controller @RequestMapping("/provider") public class ProviderController { @Resource public ProviderInfoService providerInfoService; @RequestMapping("/getProviderInfoList") @ResponseBody public Object getProviderInfoList(@RequestParam(value="page",required = false)Integer page, @RequestParam(value="limit",required = false)Integer limit, @RequestParam(value="proName",required = false)String proName) { Map<String,Object> map=new HashMap<>(); map.put("start",(page-1)*limit); map.put("limit",limit); map.put("proName",proName); List<Map> mapList=providerInfoService.getProviderInfoList(map); int count=providerInfoService.getProviderCount(map); return new ResultMap<List<Map>>("",mapList,0,count); } @RequestMapping("/toAddProvider") public String toAddProviderInfo(){ return "provider/addprovider"; } @RequestMapping("/addprovider") @ResponseBody public Object saveAddProviderInfo(ProviderInfo providerInfo){ boolean flag=providerInfoService.addProviderInfo(providerInfo); if (flag){ return "true"; } return "false"; } //加载商品详细信息页面 @RequestMapping(value = "/showProviderInfo/{proId}") public String showProviderInfo(Model model,@PathVariable("proId") int proId){ ProviderInfo provider=providerInfoService.getProviderInfoById(proId); model.addAttribute("provider",provider); return "provider/showprovider"; } @RequestMapping("/deleteProvider") @ResponseBody public Object deleteProviderInfo(int proId){ boolean flag=providerInfoService.deleteProciderInfo(proId); if (flag){ return "true"; } return "false"; } @RequestMapping("/toModifyProvider/{proId}") public String toModifyProviderInfo(Model model,@PathVariable int proId){ ProviderInfo provider=providerInfoService.getProviderInfoById(proId); model.addAttribute("provider",provider); return "provider/modifyprovider"; } @RequestMapping("/modifyProvider") @ResponseBody public Object modifyProviderInfo(ProviderInfo providerInfo){ boolean flag=providerInfoService.modifyProviderInfo(providerInfo); if (flag){ return "true"; } return "false"; } }
54ac185bfe48e4d269c7a28ac6c0a5bd7ee330de
9623f83defac3911b4780bc408634c078da73387
/powercraft_15/src/minecraft/mods/betterworld/CB/BWCB_TileEntityBlockGlass.java
af64080a21aac2ca5ed26b9749e83502afd4d102
[]
no_license
BlearStudio/powercraft-legacy
42b839393223494748e8b5d05acdaf59f18bd6c6
014e9d4d71bd99823cf63d4fbdb65c1b83fde1f8
refs/heads/master
2021-01-21T21:18:55.774908
2015-04-06T20:45:25
2015-04-06T20:45:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,541
java
package mods.betterworld.CB; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.INetworkManager; import net.minecraft.network.packet.Packet; import net.minecraft.network.packet.Packet132TileEntityData; import net.minecraft.tileentity.TileEntity; public class BWCB_TileEntityBlockGlass extends TileEntity { private int blockDamageID; private String userName; private boolean incomplete; private int lightValue; private boolean blockLocked; public BWCB_TileEntityBlockGlass() { } @Override public void readFromNBT(NBTTagCompound par1nbtTagCompound) { super.readFromNBT(par1nbtTagCompound); blockDamageID = par1nbtTagCompound.getInteger("type"); userName = par1nbtTagCompound.getString("UName"); lightValue = par1nbtTagCompound.getInteger("LightValue"); blockLocked = par1nbtTagCompound.getBoolean("BlockLocked"); } @Override public void writeToNBT(NBTTagCompound par1nbtTagCompound) { super.writeToNBT(par1nbtTagCompound); par1nbtTagCompound.setInteger("type", blockDamageID); par1nbtTagCompound.setString("UName", userName); par1nbtTagCompound.setInteger("LightValue", lightValue); par1nbtTagCompound.setBoolean("BlockLocked", blockLocked); } @Override public Packet getDescriptionPacket() { NBTTagCompound nbt = new NBTTagCompound(); nbt.setInteger("type", blockDamageID); nbt.setString("UName", userName); nbt.setInteger("LightValue", lightValue); nbt.setBoolean("BlockLocked", blockLocked); return new Packet132TileEntityData(xCoord, yCoord, zCoord, 0, nbt); } @Override public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt) { blockDamageID = pkt.customParam1.getInteger("type"); userName = pkt.customParam1.getString("UName"); lightValue = pkt.customParam1.getInteger("LightValue"); blockLocked = pkt.customParam1.getBoolean("BlockLocked"); } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public int getBlockDamageID() { System.out.println("Gesendet: " + blockDamageID); return blockDamageID; } public void setBlockDamageID(int i) { blockDamageID = i; } public int getLightValue() { return lightValue; } public void setLightValue(int lightValue) { this.lightValue = lightValue; } public boolean isBlockLocked() { return blockLocked; } public void setBlockLocked(boolean blockLocked) { this.blockLocked = blockLocked; } }
[ "[email protected]@ed9f5d1b-00bb-0f29-faab-e8ebad1a710c" ]
[email protected]@ed9f5d1b-00bb-0f29-faab-e8ebad1a710c
73ce7d976a38dc1d2badf2efa2d1202d3b1efccc
14d5e5db1c8737d0f8681b6bd80773652c42e224
/finshine_client/gen/android/support/v7/appcompat/R.java
87aa777bf52df652828acfb5cba5ef8b6512dc60
[]
no_license
tangtom/finshine
811517a52a9aeadf261729b182a5cf609d38e143
200f40224f6686281e8aaf3d9654b602958f6cc7
refs/heads/master
2021-01-01T16:50:39.027805
2014-11-18T08:01:03
2014-11-18T08:01:03
26,798,530
1
0
null
null
null
null
UTF-8
Java
false
false
39,549
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package android.support.v7.appcompat; public final class R { public static final class anim { public static final int abc_fade_in = 0x7f040000; public static final int abc_fade_out = 0x7f040001; public static final int abc_slide_in_bottom = 0x7f040002; public static final int abc_slide_in_top = 0x7f040003; public static final int abc_slide_out_bottom = 0x7f040004; public static final int abc_slide_out_top = 0x7f040005; } public static final class attr { public static final int actionBarDivider = 0x7f01000b; public static final int actionBarItemBackground = 0x7f01000c; public static final int actionBarSize = 0x7f01000a; public static final int actionBarSplitStyle = 0x7f010008; public static final int actionBarStyle = 0x7f010007; public static final int actionBarTabBarStyle = 0x7f010004; public static final int actionBarTabStyle = 0x7f010003; public static final int actionBarTabTextStyle = 0x7f010005; public static final int actionBarWidgetTheme = 0x7f010009; public static final int actionButtonStyle = 0x7f010012; public static final int actionDropDownStyle = 0x7f010043; public static final int actionLayout = 0x7f01004a; public static final int actionMenuTextAppearance = 0x7f01000d; public static final int actionMenuTextColor = 0x7f01000e; public static final int actionModeBackground = 0x7f010038; public static final int actionModeCloseButtonStyle = 0x7f010037; public static final int actionModeCloseDrawable = 0x7f01003a; public static final int actionModeCopyDrawable = 0x7f01003c; public static final int actionModeCutDrawable = 0x7f01003b; public static final int actionModeFindDrawable = 0x7f010040; public static final int actionModePasteDrawable = 0x7f01003d; public static final int actionModePopupWindowStyle = 0x7f010042; public static final int actionModeSelectAllDrawable = 0x7f01003e; public static final int actionModeShareDrawable = 0x7f01003f; public static final int actionModeSplitBackground = 0x7f010039; public static final int actionModeStyle = 0x7f010036; public static final int actionModeWebSearchDrawable = 0x7f010041; public static final int actionOverflowButtonStyle = 0x7f010006; public static final int actionProviderClass = 0x7f01004c; public static final int actionViewClass = 0x7f01004b; public static final int activityChooserViewStyle = 0x7f010068; public static final int background = 0x7f01002b; public static final int backgroundSplit = 0x7f01002d; public static final int backgroundStacked = 0x7f01002c; public static final int buttonBarButtonStyle = 0x7f010014; public static final int buttonBarStyle = 0x7f010013; public static final int customNavigationLayout = 0x7f01002e; public static final int disableChildrenWhenDisabled = 0x7f010050; public static final int displayOptions = 0x7f010024; public static final int divider = 0x7f01002a; public static final int dividerHorizontal = 0x7f010017; public static final int dividerPadding = 0x7f010052; public static final int dividerVertical = 0x7f010016; public static final int dropDownListViewStyle = 0x7f01001d; public static final int dropdownListPreferredItemHeight = 0x7f010044; public static final int expandActivityOverflowButtonDrawable = 0x7f010067; public static final int height = 0x7f010022; public static final int homeAsUpIndicator = 0x7f01000f; public static final int homeLayout = 0x7f01002f; public static final int icon = 0x7f010028; public static final int iconifiedByDefault = 0x7f010056; public static final int indeterminateProgressStyle = 0x7f010031; public static final int initialActivityCount = 0x7f010066; public static final int isLightTheme = 0x7f010055; public static final int itemPadding = 0x7f010033; public static final int listChoiceBackgroundIndicator = 0x7f010048; public static final int listPopupWindowStyle = 0x7f01001e; public static final int listPreferredItemHeight = 0x7f010018; public static final int listPreferredItemHeightLarge = 0x7f01001a; public static final int listPreferredItemHeightSmall = 0x7f010019; public static final int listPreferredItemPaddingLeft = 0x7f01001b; public static final int listPreferredItemPaddingRight = 0x7f01001c; public static final int logo = 0x7f010029; public static final int navigationMode = 0x7f010023; public static final int paddingEnd = 0x7f010035; public static final int paddingStart = 0x7f010034; public static final int panelMenuListTheme = 0x7f010047; public static final int panelMenuListWidth = 0x7f010046; public static final int popupMenuStyle = 0x7f010045; public static final int popupPromptView = 0x7f01004f; public static final int progressBarPadding = 0x7f010032; public static final int progressBarStyle = 0x7f010030; public static final int prompt = 0x7f01004d; public static final int queryHint = 0x7f010057; public static final int searchDropdownBackground = 0x7f010058; public static final int searchResultListItemHeight = 0x7f010061; public static final int searchViewAutoCompleteTextView = 0x7f010065; public static final int searchViewCloseIcon = 0x7f010059; public static final int searchViewEditQuery = 0x7f01005d; public static final int searchViewEditQueryBackground = 0x7f01005e; public static final int searchViewGoIcon = 0x7f01005a; public static final int searchViewSearchIcon = 0x7f01005b; public static final int searchViewTextField = 0x7f01005f; public static final int searchViewTextFieldRight = 0x7f010060; public static final int searchViewVoiceIcon = 0x7f01005c; public static final int selectableItemBackground = 0x7f010015; public static final int showAsAction = 0x7f010049; public static final int showDividers = 0x7f010051; public static final int spinnerDropDownItemStyle = 0x7f010054; public static final int spinnerMode = 0x7f01004e; public static final int spinnerStyle = 0x7f010053; public static final int subtitle = 0x7f010025; public static final int subtitleTextStyle = 0x7f010027; public static final int textAllCaps = 0x7f010069; public static final int textAppearanceLargePopupMenu = 0x7f010010; public static final int textAppearanceListItem = 0x7f01001f; public static final int textAppearanceListItemSmall = 0x7f010020; public static final int textAppearanceSearchResultSubtitle = 0x7f010063; public static final int textAppearanceSearchResultTitle = 0x7f010062; public static final int textAppearanceSmallPopupMenu = 0x7f010011; public static final int textColorSearchUrl = 0x7f010064; public static final int title = 0x7f010021; public static final int titleTextStyle = 0x7f010026; public static final int windowActionBar = 0x7f010000; public static final int windowActionBarOverlay = 0x7f010001; public static final int windowSplitActionBar = 0x7f010002; } public static final class bool { public static final int abc_action_bar_embed_tabs_pre_jb = 0x7f060000; public static final int abc_action_bar_expanded_action_views_exclusive = 0x7f060001; public static final int abc_config_actionMenuItemAllCaps = 0x7f060005; public static final int abc_config_allowActionMenuItemTextWithIcon = 0x7f060004; public static final int abc_config_showMenuShortcutsWhenKeyboardPresent = 0x7f060003; public static final int abc_split_action_bar_is_narrow = 0x7f060002; } public static final class color { public static final int abc_search_url_text_holo = 0x7f0700e5; public static final int abc_search_url_text_normal = 0x7f070000; public static final int abc_search_url_text_pressed = 0x7f070002; public static final int abc_search_url_text_selected = 0x7f070001; } public static final class dimen { public static final int abc_action_bar_default_height = 0x7f080002; public static final int abc_action_bar_icon_vertical_padding = 0x7f080003; public static final int abc_action_bar_progress_bar_size = 0x7f08000a; public static final int abc_action_bar_stacked_max_height = 0x7f080009; public static final int abc_action_bar_stacked_tab_max_width = 0x7f080001; public static final int abc_action_bar_subtitle_bottom_margin = 0x7f080007; public static final int abc_action_bar_subtitle_text_size = 0x7f080005; public static final int abc_action_bar_subtitle_top_margin = 0x7f080006; public static final int abc_action_bar_title_text_size = 0x7f080004; public static final int abc_action_button_min_width = 0x7f080008; public static final int abc_config_prefDialogWidth = 0x7f080000; public static final int abc_dropdownitem_icon_width = 0x7f080010; public static final int abc_dropdownitem_text_padding_left = 0x7f08000e; public static final int abc_dropdownitem_text_padding_right = 0x7f08000f; public static final int abc_panel_menu_list_width = 0x7f08000b; public static final int abc_search_view_preferred_width = 0x7f08000d; public static final int abc_search_view_text_min_width = 0x7f08000c; } public static final class drawable { public static final int abc_ab_bottom_solid_dark_holo = 0x7f020000; public static final int abc_ab_bottom_solid_light_holo = 0x7f020001; public static final int abc_ab_bottom_transparent_dark_holo = 0x7f020002; public static final int abc_ab_bottom_transparent_light_holo = 0x7f020003; public static final int abc_ab_share_pack_holo_dark = 0x7f020004; public static final int abc_ab_share_pack_holo_light = 0x7f020005; public static final int abc_ab_solid_dark_holo = 0x7f020006; public static final int abc_ab_solid_light_holo = 0x7f020007; public static final int abc_ab_stacked_solid_dark_holo = 0x7f020008; public static final int abc_ab_stacked_solid_light_holo = 0x7f020009; public static final int abc_ab_stacked_transparent_dark_holo = 0x7f02000a; public static final int abc_ab_stacked_transparent_light_holo = 0x7f02000b; public static final int abc_ab_transparent_dark_holo = 0x7f02000c; public static final int abc_ab_transparent_light_holo = 0x7f02000d; public static final int abc_cab_background_bottom_holo_dark = 0x7f02000e; public static final int abc_cab_background_bottom_holo_light = 0x7f02000f; public static final int abc_cab_background_top_holo_dark = 0x7f020010; public static final int abc_cab_background_top_holo_light = 0x7f020011; public static final int abc_ic_ab_back_holo_dark = 0x7f020012; public static final int abc_ic_ab_back_holo_light = 0x7f020013; public static final int abc_ic_cab_done_holo_dark = 0x7f020014; public static final int abc_ic_cab_done_holo_light = 0x7f020015; public static final int abc_ic_clear = 0x7f020016; public static final int abc_ic_clear_disabled = 0x7f020017; public static final int abc_ic_clear_holo_light = 0x7f020018; public static final int abc_ic_clear_normal = 0x7f020019; public static final int abc_ic_clear_search_api_disabled_holo_light = 0x7f02001a; public static final int abc_ic_clear_search_api_holo_light = 0x7f02001b; public static final int abc_ic_commit_search_api_holo_dark = 0x7f02001c; public static final int abc_ic_commit_search_api_holo_light = 0x7f02001d; public static final int abc_ic_go = 0x7f02001e; public static final int abc_ic_go_search_api_holo_light = 0x7f02001f; public static final int abc_ic_menu_moreoverflow_normal_holo_dark = 0x7f020020; public static final int abc_ic_menu_moreoverflow_normal_holo_light = 0x7f020021; public static final int abc_ic_menu_share_holo_dark = 0x7f020022; public static final int abc_ic_menu_share_holo_light = 0x7f020023; public static final int abc_ic_search = 0x7f020024; public static final int abc_ic_search_api_holo_light = 0x7f020025; public static final int abc_ic_voice_search = 0x7f020026; public static final int abc_ic_voice_search_api_holo_light = 0x7f020027; public static final int abc_item_background_holo_dark = 0x7f020028; public static final int abc_item_background_holo_light = 0x7f020029; public static final int abc_list_divider_holo_dark = 0x7f02002a; public static final int abc_list_divider_holo_light = 0x7f02002b; public static final int abc_list_focused_holo = 0x7f02002c; public static final int abc_list_longpressed_holo = 0x7f02002d; public static final int abc_list_pressed_holo_dark = 0x7f02002e; public static final int abc_list_pressed_holo_light = 0x7f02002f; public static final int abc_list_selector_background_transition_holo_dark = 0x7f020030; public static final int abc_list_selector_background_transition_holo_light = 0x7f020031; public static final int abc_list_selector_disabled_holo_dark = 0x7f020032; public static final int abc_list_selector_disabled_holo_light = 0x7f020033; public static final int abc_list_selector_holo_dark = 0x7f020034; public static final int abc_list_selector_holo_light = 0x7f020035; public static final int abc_menu_dropdown_panel_holo_dark = 0x7f020036; public static final int abc_menu_dropdown_panel_holo_light = 0x7f020037; public static final int abc_menu_hardkey_panel_holo_dark = 0x7f020038; public static final int abc_menu_hardkey_panel_holo_light = 0x7f020039; public static final int abc_search_dropdown_dark = 0x7f02003a; public static final int abc_search_dropdown_light = 0x7f02003b; public static final int abc_spinner_ab_default_holo_dark = 0x7f02003c; public static final int abc_spinner_ab_default_holo_light = 0x7f02003d; public static final int abc_spinner_ab_disabled_holo_dark = 0x7f02003e; public static final int abc_spinner_ab_disabled_holo_light = 0x7f02003f; public static final int abc_spinner_ab_focused_holo_dark = 0x7f020040; public static final int abc_spinner_ab_focused_holo_light = 0x7f020041; public static final int abc_spinner_ab_holo_dark = 0x7f020042; public static final int abc_spinner_ab_holo_light = 0x7f020043; public static final int abc_spinner_ab_pressed_holo_dark = 0x7f020044; public static final int abc_spinner_ab_pressed_holo_light = 0x7f020045; public static final int abc_tab_indicator_ab_holo = 0x7f020046; public static final int abc_tab_selected_focused_holo = 0x7f020047; public static final int abc_tab_selected_holo = 0x7f020048; public static final int abc_tab_selected_pressed_holo = 0x7f020049; public static final int abc_tab_unselected_pressed_holo = 0x7f02004a; public static final int abc_textfield_search_default_holo_dark = 0x7f02004b; public static final int abc_textfield_search_default_holo_light = 0x7f02004c; public static final int abc_textfield_search_right_default_holo_dark = 0x7f02004d; public static final int abc_textfield_search_right_default_holo_light = 0x7f02004e; public static final int abc_textfield_search_right_selected_holo_dark = 0x7f02004f; public static final int abc_textfield_search_right_selected_holo_light = 0x7f020050; public static final int abc_textfield_search_selected_holo_dark = 0x7f020051; public static final int abc_textfield_search_selected_holo_light = 0x7f020052; public static final int abc_textfield_searchview_holo_dark = 0x7f020053; public static final int abc_textfield_searchview_holo_light = 0x7f020054; public static final int abc_textfield_searchview_right_holo_dark = 0x7f020055; public static final int abc_textfield_searchview_right_holo_light = 0x7f020056; } public static final class id { public static final int action_bar = 0x7f05002f; public static final int action_bar_activity_content = 0x7f050015; public static final int action_bar_container = 0x7f05002e; public static final int action_bar_overlay_layout = 0x7f050032; public static final int action_bar_root = 0x7f05002d; public static final int action_bar_subtitle = 0x7f050036; public static final int action_bar_title = 0x7f050035; public static final int action_context_bar = 0x7f050030; public static final int action_menu_divider = 0x7f050016; public static final int action_menu_presenter = 0x7f050017; public static final int action_mode_close_button = 0x7f050037; public static final int activity_chooser_view_content = 0x7f050038; public static final int always = 0x7f05000b; public static final int beginning = 0x7f050011; public static final int checkbox = 0x7f050040; public static final int collapseActionView = 0x7f05000d; public static final int default_activity_button = 0x7f05003b; public static final int dialog = 0x7f05000e; public static final int disableHome = 0x7f050008; public static final int dropdown = 0x7f05000f; public static final int edit_query = 0x7f050043; public static final int end = 0x7f050013; public static final int expand_activities_button = 0x7f050039; public static final int expanded_menu = 0x7f05003f; public static final int home = 0x7f050014; public static final int homeAsUp = 0x7f050005; public static final int icon = 0x7f05003d; public static final int ifRoom = 0x7f05000a; public static final int image = 0x7f05003a; public static final int listMode = 0x7f050001; public static final int list_item = 0x7f05003c; public static final int middle = 0x7f050012; public static final int never = 0x7f050009; public static final int none = 0x7f050010; public static final int normal = 0x7f050000; public static final int progress_circular = 0x7f050018; public static final int progress_horizontal = 0x7f050019; public static final int radio = 0x7f050042; public static final int search_badge = 0x7f050045; public static final int search_bar = 0x7f050044; public static final int search_button = 0x7f050046; public static final int search_close_btn = 0x7f05004b; public static final int search_edit_frame = 0x7f050047; public static final int search_go_btn = 0x7f05004d; public static final int search_mag_icon = 0x7f050048; public static final int search_plate = 0x7f050049; public static final int search_src_text = 0x7f05004a; public static final int search_voice_btn = 0x7f05004e; public static final int shortcut = 0x7f050041; public static final int showCustom = 0x7f050007; public static final int showHome = 0x7f050004; public static final int showTitle = 0x7f050006; public static final int split_action_bar = 0x7f050031; public static final int submit_area = 0x7f05004c; public static final int tabMode = 0x7f050002; public static final int title = 0x7f05003e; public static final int top_action_bar = 0x7f050033; public static final int up = 0x7f050034; public static final int useLogo = 0x7f050003; public static final int withText = 0x7f05000c; } public static final class integer { public static final int abc_max_action_buttons = 0x7f090000; } public static final class layout { public static final int abc_action_bar_decor = 0x7f030000; public static final int abc_action_bar_decor_include = 0x7f030001; public static final int abc_action_bar_decor_overlay = 0x7f030002; public static final int abc_action_bar_home = 0x7f030003; public static final int abc_action_bar_tab = 0x7f030004; public static final int abc_action_bar_tabbar = 0x7f030005; public static final int abc_action_bar_title_item = 0x7f030006; public static final int abc_action_bar_view_list_nav_layout = 0x7f030007; public static final int abc_action_menu_item_layout = 0x7f030008; public static final int abc_action_menu_layout = 0x7f030009; public static final int abc_action_mode_bar = 0x7f03000a; public static final int abc_action_mode_close_item = 0x7f03000b; public static final int abc_activity_chooser_view = 0x7f03000c; public static final int abc_activity_chooser_view_include = 0x7f03000d; public static final int abc_activity_chooser_view_list_item = 0x7f03000e; public static final int abc_expanded_menu_layout = 0x7f03000f; public static final int abc_list_menu_item_checkbox = 0x7f030010; public static final int abc_list_menu_item_icon = 0x7f030011; public static final int abc_list_menu_item_layout = 0x7f030012; public static final int abc_list_menu_item_radio = 0x7f030013; public static final int abc_popup_menu_item_layout = 0x7f030014; public static final int abc_search_dropdown_item_icons_2line = 0x7f030015; public static final int abc_search_view = 0x7f030016; public static final int support_simple_spinner_dropdown_item = 0x7f0300e8; } public static final class string { public static final int abc_action_bar_home_description = 0x7f0a0001; public static final int abc_action_bar_up_description = 0x7f0a0002; public static final int abc_action_menu_overflow_description = 0x7f0a0003; public static final int abc_action_mode_done = 0x7f0a0000; public static final int abc_activity_chooser_view_see_all = 0x7f0a000a; public static final int abc_activitychooserview_choose_application = 0x7f0a0009; public static final int abc_searchview_description_clear = 0x7f0a0006; public static final int abc_searchview_description_query = 0x7f0a0005; public static final int abc_searchview_description_search = 0x7f0a0004; public static final int abc_searchview_description_submit = 0x7f0a0007; public static final int abc_searchview_description_voice = 0x7f0a0008; public static final int abc_shareactionprovider_share_with = 0x7f0a000c; public static final int abc_shareactionprovider_share_with_application = 0x7f0a000b; } public static final class style { public static final int TextAppearance_AppCompat_Base_CompactMenu_Dialog = 0x7f0b0063; public static final int TextAppearance_AppCompat_Base_SearchResult = 0x7f0b006d; public static final int TextAppearance_AppCompat_Base_SearchResult_Subtitle = 0x7f0b006f; public static final int TextAppearance_AppCompat_Base_SearchResult_Title = 0x7f0b006e; public static final int TextAppearance_AppCompat_Base_Widget_PopupMenu_Large = 0x7f0b0069; public static final int TextAppearance_AppCompat_Base_Widget_PopupMenu_Small = 0x7f0b006a; public static final int TextAppearance_AppCompat_Light_Base_SearchResult = 0x7f0b0070; public static final int TextAppearance_AppCompat_Light_Base_SearchResult_Subtitle = 0x7f0b0072; public static final int TextAppearance_AppCompat_Light_Base_SearchResult_Title = 0x7f0b0071; public static final int TextAppearance_AppCompat_Light_Base_Widget_PopupMenu_Large = 0x7f0b006b; public static final int TextAppearance_AppCompat_Light_Base_Widget_PopupMenu_Small = 0x7f0b006c; public static final int TextAppearance_AppCompat_Light_SearchResult_Subtitle = 0x7f0b0035; public static final int TextAppearance_AppCompat_Light_SearchResult_Title = 0x7f0b0034; public static final int TextAppearance_AppCompat_Light_Widget_PopupMenu_Large = 0x7f0b0030; public static final int TextAppearance_AppCompat_Light_Widget_PopupMenu_Small = 0x7f0b0031; public static final int TextAppearance_AppCompat_SearchResult_Subtitle = 0x7f0b0033; public static final int TextAppearance_AppCompat_SearchResult_Title = 0x7f0b0032; public static final int TextAppearance_AppCompat_Widget_ActionBar_Menu = 0x7f0b001a; public static final int TextAppearance_AppCompat_Widget_ActionBar_Subtitle = 0x7f0b0006; public static final int TextAppearance_AppCompat_Widget_ActionBar_Subtitle_Inverse = 0x7f0b0008; public static final int TextAppearance_AppCompat_Widget_ActionBar_Title = 0x7f0b0005; public static final int TextAppearance_AppCompat_Widget_ActionBar_Title_Inverse = 0x7f0b0007; public static final int TextAppearance_AppCompat_Widget_ActionMode_Subtitle = 0x7f0b001e; public static final int TextAppearance_AppCompat_Widget_ActionMode_Subtitle_Inverse = 0x7f0b0020; public static final int TextAppearance_AppCompat_Widget_ActionMode_Title = 0x7f0b001d; public static final int TextAppearance_AppCompat_Widget_ActionMode_Title_Inverse = 0x7f0b001f; public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Menu = 0x7f0b0054; public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Subtitle = 0x7f0b0056; public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Subtitle_Inverse = 0x7f0b0058; public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Title = 0x7f0b0055; public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Title_Inverse = 0x7f0b0057; public static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Subtitle = 0x7f0b0051; public static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Subtitle_Inverse = 0x7f0b0053; public static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Title = 0x7f0b0050; public static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Title_Inverse = 0x7f0b0052; public static final int TextAppearance_AppCompat_Widget_Base_DropDownItem = 0x7f0b0061; public static final int TextAppearance_AppCompat_Widget_DropDownItem = 0x7f0b0021; public static final int TextAppearance_AppCompat_Widget_PopupMenu_Large = 0x7f0b002e; public static final int TextAppearance_AppCompat_Widget_PopupMenu_Small = 0x7f0b002f; public static final int TextAppearance_Widget_AppCompat_Base_ExpandedMenu_Item = 0x7f0b0062; public static final int TextAppearance_Widget_AppCompat_ExpandedMenu_Item = 0x7f0b0028; public static final int Theme_AppCompat = 0x7f0b0077; public static final int Theme_AppCompat_Base_CompactMenu = 0x7f0b0081; public static final int Theme_AppCompat_Base_CompactMenu_Dialog = 0x7f0b0082; public static final int Theme_AppCompat_CompactMenu = 0x7f0b007a; public static final int Theme_AppCompat_CompactMenu_Dialog = 0x7f0b007b; public static final int Theme_AppCompat_Light = 0x7f0b0078; public static final int Theme_AppCompat_Light_DarkActionBar = 0x7f0b0079; public static final int Theme_Base = 0x7f0b007c; public static final int Theme_Base_AppCompat = 0x7f0b007e; public static final int Theme_Base_AppCompat_Light = 0x7f0b007f; public static final int Theme_Base_AppCompat_Light_DarkActionBar = 0x7f0b0080; public static final int Theme_Base_Light = 0x7f0b007d; public static final int Widget_AppCompat_ActionBar = 0x7f0b0000; public static final int Widget_AppCompat_ActionBar_Solid = 0x7f0b0002; public static final int Widget_AppCompat_ActionBar_TabBar = 0x7f0b0011; public static final int Widget_AppCompat_ActionBar_TabText = 0x7f0b0017; public static final int Widget_AppCompat_ActionBar_TabView = 0x7f0b0014; public static final int Widget_AppCompat_ActionButton = 0x7f0b000b; public static final int Widget_AppCompat_ActionButton_CloseMode = 0x7f0b000d; public static final int Widget_AppCompat_ActionButton_Overflow = 0x7f0b000f; public static final int Widget_AppCompat_ActionMode = 0x7f0b001b; public static final int Widget_AppCompat_ActivityChooserView = 0x7f0b0038; public static final int Widget_AppCompat_AutoCompleteTextView = 0x7f0b0036; public static final int Widget_AppCompat_Base_ActionBar = 0x7f0b003a; public static final int Widget_AppCompat_Base_ActionBar_Solid = 0x7f0b003c; public static final int Widget_AppCompat_Base_ActionBar_TabBar = 0x7f0b0045; public static final int Widget_AppCompat_Base_ActionBar_TabText = 0x7f0b004b; public static final int Widget_AppCompat_Base_ActionBar_TabView = 0x7f0b0048; public static final int Widget_AppCompat_Base_ActionButton = 0x7f0b003f; public static final int Widget_AppCompat_Base_ActionButton_CloseMode = 0x7f0b0041; public static final int Widget_AppCompat_Base_ActionButton_Overflow = 0x7f0b0043; public static final int Widget_AppCompat_Base_ActionMode = 0x7f0b004e; public static final int Widget_AppCompat_Base_ActivityChooserView = 0x7f0b0075; public static final int Widget_AppCompat_Base_AutoCompleteTextView = 0x7f0b0073; public static final int Widget_AppCompat_Base_DropDownItem_Spinner = 0x7f0b005d; public static final int Widget_AppCompat_Base_ListPopupWindow = 0x7f0b0065; public static final int Widget_AppCompat_Base_ListView_DropDown = 0x7f0b005f; public static final int Widget_AppCompat_Base_ListView_Menu = 0x7f0b0064; public static final int Widget_AppCompat_Base_PopupMenu = 0x7f0b0067; public static final int Widget_AppCompat_Base_ProgressBar = 0x7f0b005a; public static final int Widget_AppCompat_Base_ProgressBar_Horizontal = 0x7f0b0059; public static final int Widget_AppCompat_Base_Spinner = 0x7f0b005b; public static final int Widget_AppCompat_DropDownItem_Spinner = 0x7f0b0024; public static final int Widget_AppCompat_Light_ActionBar = 0x7f0b0001; public static final int Widget_AppCompat_Light_ActionBar_Solid = 0x7f0b0003; public static final int Widget_AppCompat_Light_ActionBar_Solid_Inverse = 0x7f0b0004; public static final int Widget_AppCompat_Light_ActionBar_TabBar = 0x7f0b0012; public static final int Widget_AppCompat_Light_ActionBar_TabBar_Inverse = 0x7f0b0013; public static final int Widget_AppCompat_Light_ActionBar_TabText = 0x7f0b0018; public static final int Widget_AppCompat_Light_ActionBar_TabText_Inverse = 0x7f0b0019; public static final int Widget_AppCompat_Light_ActionBar_TabView = 0x7f0b0015; public static final int Widget_AppCompat_Light_ActionBar_TabView_Inverse = 0x7f0b0016; public static final int Widget_AppCompat_Light_ActionButton = 0x7f0b000c; public static final int Widget_AppCompat_Light_ActionButton_CloseMode = 0x7f0b000e; public static final int Widget_AppCompat_Light_ActionButton_Overflow = 0x7f0b0010; public static final int Widget_AppCompat_Light_ActionMode_Inverse = 0x7f0b001c; public static final int Widget_AppCompat_Light_ActivityChooserView = 0x7f0b0039; public static final int Widget_AppCompat_Light_AutoCompleteTextView = 0x7f0b0037; public static final int Widget_AppCompat_Light_Base_ActionBar = 0x7f0b003b; public static final int Widget_AppCompat_Light_Base_ActionBar_Solid = 0x7f0b003d; public static final int Widget_AppCompat_Light_Base_ActionBar_Solid_Inverse = 0x7f0b003e; public static final int Widget_AppCompat_Light_Base_ActionBar_TabBar = 0x7f0b0046; public static final int Widget_AppCompat_Light_Base_ActionBar_TabBar_Inverse = 0x7f0b0047; public static final int Widget_AppCompat_Light_Base_ActionBar_TabText = 0x7f0b004c; public static final int Widget_AppCompat_Light_Base_ActionBar_TabText_Inverse = 0x7f0b004d; public static final int Widget_AppCompat_Light_Base_ActionBar_TabView = 0x7f0b0049; public static final int Widget_AppCompat_Light_Base_ActionBar_TabView_Inverse = 0x7f0b004a; public static final int Widget_AppCompat_Light_Base_ActionButton = 0x7f0b0040; public static final int Widget_AppCompat_Light_Base_ActionButton_CloseMode = 0x7f0b0042; public static final int Widget_AppCompat_Light_Base_ActionButton_Overflow = 0x7f0b0044; public static final int Widget_AppCompat_Light_Base_ActionMode_Inverse = 0x7f0b004f; public static final int Widget_AppCompat_Light_Base_ActivityChooserView = 0x7f0b0076; public static final int Widget_AppCompat_Light_Base_AutoCompleteTextView = 0x7f0b0074; public static final int Widget_AppCompat_Light_Base_DropDownItem_Spinner = 0x7f0b005e; public static final int Widget_AppCompat_Light_Base_ListPopupWindow = 0x7f0b0066; public static final int Widget_AppCompat_Light_Base_ListView_DropDown = 0x7f0b0060; public static final int Widget_AppCompat_Light_Base_PopupMenu = 0x7f0b0068; public static final int Widget_AppCompat_Light_Base_Spinner = 0x7f0b005c; public static final int Widget_AppCompat_Light_DropDownItem_Spinner = 0x7f0b0025; public static final int Widget_AppCompat_Light_ListPopupWindow = 0x7f0b002a; public static final int Widget_AppCompat_Light_ListView_DropDown = 0x7f0b0027; public static final int Widget_AppCompat_Light_PopupMenu = 0x7f0b002c; public static final int Widget_AppCompat_Light_Spinner_DropDown_ActionBar = 0x7f0b0023; public static final int Widget_AppCompat_ListPopupWindow = 0x7f0b0029; public static final int Widget_AppCompat_ListView_DropDown = 0x7f0b0026; public static final int Widget_AppCompat_ListView_Menu = 0x7f0b002d; public static final int Widget_AppCompat_PopupMenu = 0x7f0b002b; public static final int Widget_AppCompat_ProgressBar = 0x7f0b000a; public static final int Widget_AppCompat_ProgressBar_Horizontal = 0x7f0b0009; public static final int Widget_AppCompat_Spinner_DropDown_ActionBar = 0x7f0b0022; } public static final class styleable { public static final int[] ActionBar = { 0x7f010021, 0x7f010022, 0x7f010023, 0x7f010024, 0x7f010025, 0x7f010026, 0x7f010027, 0x7f010028, 0x7f010029, 0x7f01002a, 0x7f01002b, 0x7f01002c, 0x7f01002d, 0x7f01002e, 0x7f01002f, 0x7f010030, 0x7f010031, 0x7f010032, 0x7f010033 }; public static final int[] ActionBarLayout = { 0x010100b3 }; public static final int ActionBarLayout_android_layout_gravity = 0; public static final int[] ActionBarWindow = { 0x7f010000, 0x7f010001, 0x7f010002 }; public static final int ActionBarWindow_windowActionBar = 0; public static final int ActionBarWindow_windowActionBarOverlay = 1; public static final int ActionBarWindow_windowSplitActionBar = 2; public static final int ActionBar_background = 10; public static final int ActionBar_backgroundSplit = 12; public static final int ActionBar_backgroundStacked = 11; public static final int ActionBar_customNavigationLayout = 13; public static final int ActionBar_displayOptions = 3; public static final int ActionBar_divider = 9; public static final int ActionBar_height = 1; public static final int ActionBar_homeLayout = 14; public static final int ActionBar_icon = 7; public static final int ActionBar_indeterminateProgressStyle = 16; public static final int ActionBar_itemPadding = 18; public static final int ActionBar_logo = 8; public static final int ActionBar_navigationMode = 2; public static final int ActionBar_progressBarPadding = 17; public static final int ActionBar_progressBarStyle = 15; public static final int ActionBar_subtitle = 4; public static final int ActionBar_subtitleTextStyle = 6; public static final int ActionBar_title = 0; public static final int ActionBar_titleTextStyle = 5; public static final int[] ActionMenuItemView = { 0x0101013f }; public static final int ActionMenuItemView_android_minWidth = 0; public static final int[] ActionMenuView = { }; public static final int[] ActionMode = { 0x7f010022, 0x7f010026, 0x7f010027, 0x7f01002b, 0x7f01002d }; public static final int ActionMode_background = 3; public static final int ActionMode_backgroundSplit = 4; public static final int ActionMode_height = 0; public static final int ActionMode_subtitleTextStyle = 2; public static final int ActionMode_titleTextStyle = 1; public static final int[] ActivityChooserView = { 0x7f010066, 0x7f010067 }; public static final int ActivityChooserView_expandActivityOverflowButtonDrawable = 1; public static final int ActivityChooserView_initialActivityCount = 0; public static final int[] CompatTextView = { 0x7f010069 }; public static final int CompatTextView_textAllCaps = 0; public static final int[] LinearLayoutICS = { 0x7f01002a, 0x7f010051, 0x7f010052 }; public static final int LinearLayoutICS_divider = 0; public static final int LinearLayoutICS_dividerPadding = 2; public static final int LinearLayoutICS_showDividers = 1; public static final int[] MenuGroup = { 0x0101000e, 0x010100d0, 0x01010194, 0x010101de, 0x010101df, 0x010101e0 }; public static final int MenuGroup_android_checkableBehavior = 5; public static final int MenuGroup_android_enabled = 0; public static final int MenuGroup_android_id = 1; public static final int MenuGroup_android_menuCategory = 3; public static final int MenuGroup_android_orderInCategory = 4; public static final int MenuGroup_android_visible = 2; public static final int[] MenuItem = { 0x01010002, 0x0101000e, 0x010100d0, 0x01010106, 0x01010194, 0x010101de, 0x010101df, 0x010101e1, 0x010101e2, 0x010101e3, 0x010101e4, 0x010101e5, 0x0101026f, 0x7f010049, 0x7f01004a, 0x7f01004b, 0x7f01004c }; public static final int MenuItem_actionLayout = 14; public static final int MenuItem_actionProviderClass = 16; public static final int MenuItem_actionViewClass = 15; public static final int MenuItem_android_alphabeticShortcut = 9; public static final int MenuItem_android_checkable = 11; public static final int MenuItem_android_checked = 3; public static final int MenuItem_android_enabled = 1; public static final int MenuItem_android_icon = 0; public static final int MenuItem_android_id = 2; public static final int MenuItem_android_menuCategory = 5; public static final int MenuItem_android_numericShortcut = 10; public static final int MenuItem_android_onClick = 12; public static final int MenuItem_android_orderInCategory = 6; public static final int MenuItem_android_title = 7; public static final int MenuItem_android_titleCondensed = 8; public static final int MenuItem_android_visible = 4; public static final int MenuItem_showAsAction = 13; public static final int[] MenuView = { 0x010100ae, 0x0101012c, 0x0101012d, 0x0101012e, 0x0101012f, 0x01010130, 0x01010131, 0x0101040c }; public static final int MenuView_android_headerBackground = 4; public static final int MenuView_android_horizontalDivider = 2; public static final int MenuView_android_itemBackground = 5; public static final int MenuView_android_itemIconDisabledAlpha = 6; public static final int MenuView_android_itemTextAppearance = 1; public static final int MenuView_android_preserveIconSpacing = 7; public static final int MenuView_android_verticalDivider = 3; public static final int MenuView_android_windowAnimationStyle = 0; public static final int[] SearchView = { 0x0101011f, 0x01010220, 0x01010264, 0x7f010056, 0x7f010057 }; public static final int SearchView_android_imeOptions = 2; public static final int SearchView_android_inputType = 1; public static final int SearchView_android_maxWidth = 0; public static final int SearchView_iconifiedByDefault = 3; public static final int SearchView_queryHint = 4; public static final int[] Spinner = { 0x010100af, 0x01010175, 0x01010176, 0x01010262, 0x010102ac, 0x010102ad, 0x7f01004d, 0x7f01004e, 0x7f01004f, 0x7f010050 }; public static final int Spinner_android_dropDownHorizontalOffset = 4; public static final int Spinner_android_dropDownSelector = 1; public static final int Spinner_android_dropDownVerticalOffset = 5; public static final int Spinner_android_dropDownWidth = 3; public static final int Spinner_android_gravity = 0; public static final int Spinner_android_popupBackground = 2; public static final int Spinner_disableChildrenWhenDisabled = 9; public static final int Spinner_popupPromptView = 8; public static final int Spinner_prompt = 6; public static final int Spinner_spinnerMode = 7; public static final int[] Theme = { 0x7f010043, 0x7f010044, 0x7f010045, 0x7f010046, 0x7f010047, 0x7f010048 }; public static final int Theme_actionDropDownStyle = 0; public static final int Theme_dropdownListPreferredItemHeight = 1; public static final int Theme_listChoiceBackgroundIndicator = 5; public static final int Theme_panelMenuListTheme = 4; public static final int Theme_panelMenuListWidth = 3; public static final int Theme_popupMenuStyle = 2; public static final int[] View = { 0x010100da, 0x7f010034, 0x7f010035 }; public static final int View_android_focusable = 0; public static final int View_paddingEnd = 2; public static final int View_paddingStart = 1; } }
7300922c8413838823cac1b00cd63dbc14510f47
e147107604a2f1f6115fba13c055e3c481dc3f14
/PowerOfFive.java
fc6e6a064ce0687269f011eb8fe4830e5fb08b4e
[]
no_license
varshneyjyoti02/Tani
3cc7eb6e516d5fd2a417df3360419dc9b5bf36cd
b041e7acc8ed6991d5b72bbfc3d835f4e83fd9dc
refs/heads/master
2020-04-18T01:47:53.363194
2019-01-24T10:16:38
2019-01-24T10:16:38
167,134,607
0
0
null
null
null
null
UTF-8
Java
false
false
343
java
import java.util.Scanner; public class PowerOfFive { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int n; n = sc.nextInt(); while(n%5==0) { n = n/5; } if(n!=1) System.out.println("Not"); else System.out.println("Yes"); } }
09a5cbcdaa7126be3f9fb5f6eaff5f80fdb34238
30052658cbb71373a16443e5900a973ce975c097
/Test Tank Drive/TankDrive/src/main/java/frc/robot/subsystems/Drive_Subsystem.java
6657dcf07e246278908a42d5e4e4bc493de3d3aa
[]
no_license
3204robotics/Tank-Drive1
062382c8a57f3fbee0abf5f31f64d52af6ea7ff1
ddc8172a6dcea64fb49bb4921a04501b30d8d6ae
refs/heads/master
2020-04-17T02:17:03.069411
2019-01-16T23:33:40
2019-01-16T23:33:40
166,127,338
0
0
null
null
null
null
UTF-8
Java
false
false
1,219
java
package org.usfirst.frc.team3204.robot.subsystems; import org.usfirst.frc.team6637.robot.commands.TeleopDrive_Command; //import com.ctre.phoenix.motorcontrol.can.TalonSRX; import com.ctre.phoenix.motorcontrol.can.VictorSPX; import edu.wpi.first.wpilibj.DMC60; import edu.wpi.first.wpilibj.command.Subsystem; import edu.wpi.first.wpilibj.drive.DifferentialDrive; import org.usfirst.frc.team3204.robot.RobotMap; /** * */ public class Drive_Subsystem extends Subsystem { // Put methods for controlling this subsystem // here. Call these from Commands. VictorSPX leftMaster = new VictorSPX(RobotMap.leftMaster); VictorSPX leftSlave = new VictorSPX(RobotMap.leftSlave); DMC60 rightMaster = new DMC60(RobotMap.rightMaster); DMC60 rightSlave = new DMC60(RobotMap.rightSlave); DifferentialDrive drive = new DifferentialDrive(leftMaster, rightMaster); public Drive_Subsystem() { leftSlave.follow(leftMaster); rightSlave.follow(rightMaster); } public void teleopDrive(double move, double turn) { drive.arcadeDrive(move, turn); } public void initDefaultCommand() { // Set the default command for a subsystem here. setDefaultCommand(new TeleopDrive_Command()); } }
5aa6d27f790e2f90722c54bd0acfdf6b082b45ab
ec8dcbfb8e9465d30d2fa984aebfaba6be959bf0
/src/main/java/com/misino/template/mail/AccountActivationMailTemplate.java
3531eb9d1016b65591a4c682b95c7549f55c06aa
[]
no_license
preeteshmishra/springBasic
2bf829f866631c20416a921f9c91b01fdd79534b
3ca7c331f4aa40be47d5ff1432994bf15faa34f8
refs/heads/master
2021-01-02T09:28:31.681334
2014-06-17T23:07:18
2014-06-17T23:07:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,185
java
package com.misino.template.mail; import com.misino.controller.AuthenticationController; import org.thymeleaf.context.Context; import java.util.Locale; public class AccountActivationMailTemplate implements MailTemplate { private Context templateContext; private String recipient; private String pageUrl = "http://localhost:8081"; public AccountActivationMailTemplate(String recipientEmail, String accountActivationKey, Locale locale) { this.recipient = recipientEmail; this.templateContext = new Context(locale); String activationLink = pageUrl + AuthenticationController.LINK_AUTH_CONTROLLER +AuthenticationController.LINK_ACTIVATION + "?email="+recipientEmail+"&key="+accountActivationKey; templateContext.setVariable("activationLink", activationLink); } public String getTemplatePath() { return "accountActivation"; } public Context getTemplateContext() { return templateContext; } public String getRecipient() { return recipient; } public boolean isMultipart() { return false; } public String getSubject() { return "email.registerSuccess.subject"; } }
53e3ee4e4df39bed0fef16a204751b8a2c9a6601
49bcaf6c2ed4dfa05a065cb97ff07439bf5d4518
/kodilla-spring/src/test/java/com/kodilla/spring/SpringRunnerTestSuite.java
0f109fce31d36b5e5dfeaa6b05b6c92220c5de7c
[]
no_license
MDBoski/MateuszDziubinskiKodillaJava
c8c287e096c959442be0fe899ca7f06c74c58ab1
29f9b362501f667be93aadd56bb394e66052cae0
refs/heads/master
2020-04-17T15:09:28.908823
2019-05-06T19:26:26
2019-05-06T19:26:26
166,687,235
0
0
null
null
null
null
UTF-8
Java
false
false
1,403
java
package com.kodilla.spring; import com.kodilla.spring.com.kodilla.spring.shape.Circle; import com.kodilla.spring.com.kodilla.spring.shape.Shape; import com.kodilla.spring.com.kodilla.spring.shape.Triangle; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class SpringRunnerTestSuite { @Test public void testCircleLoadedIntoContainer() { //Given ApplicationContext context = new AnnotationConfigApplicationContext("com.kodilla.spring"); Shape shape = context.getBean(Circle.class); //When String name = shape.getShapeName(); //Then Assert.assertEquals("This is a circle.", name); } @Test public void testTriangleLoadedIntoContainer() { //Given ApplicationContext context = new AnnotationConfigApplicationContext("com.kodilla.spring"); Shape shape = context.getBean(Triangle.class); //When String name = shape.getShapeName(); //Then Assert.assertEquals("This is a triangle.", name); } }
268538a786e6aeb8c3eb8e67c48f98c63b7533d9
3606becb896eeaf2b03bb43e5ac7b0d3d2fb4467
/app/src/main/java/com/example/super_yu/myexample/shijun/ofo/count/CountDownView.java
2d8a4590d4981648dffb1416f64600f2be449637
[]
no_license
whsgzcy/DEMOS_TO_MySelf_Android
6d64db4840c5f08883f0f72a7761b1cb89e1b519
d3e3d13efe8e55d4e69da2a006067fb1aa608fbd
refs/heads/master
2021-09-17T12:53:03.828617
2018-07-02T02:52:55
2018-07-02T02:52:55
93,822,977
6
0
null
null
null
null
UTF-8
Java
false
false
8,517
java
package com.example.super_yu.myexample.shijun.ofo.count; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ValueAnimator; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.RectF; import android.support.annotation.Nullable; import android.support.v4.content.ContextCompat; import android.text.TextUtils; import android.util.AttributeSet; import android.util.Log; import android.view.View; import android.view.animation.LinearInterpolator; import com.example.super_yu.myexample.R; /** * Created by Administrator on 2017/10/17. * 启动页停留n秒动画view */ public class CountDownView extends View { private Context mContext;//上下文 private Paint mPaintBackGround;//背景画笔 private Paint mPaintArc;//圆弧画笔 private Paint mPaintText;//文字画笔 private int mRetreatType;//圆弧绘制方式(增加和减少) private float mPaintArcWidth;//最外层圆弧的宽度 private int mCircleRadius;//圆圈的半径 private int mPaintArcColor = Color.parseColor("#3C3F41");//初始值 private int mPaintBackGroundColor = Color.parseColor("#55B2E5");//初始值 private int mLoadingTime;//时间,单位秒 private String mLoadingTimeUnit = "";//时间单位 private int mTextColor = Color.BLACK;//字体颜色 private int mTextSize;//字体大小 private int location;//从哪个位置开始 private float startAngle;//开始角度 private float mmSweepAngleStart;//起点 private float mmSweepAngleEnd;//终点 private float mSweepAngle;//扫过的角度 private String mText = "";//要绘制的文字 private int mWidth; private int mHeight; public CountDownView(Context context) { this(context, null); } public CountDownView(Context context, @Nullable AttributeSet attrs) { this(context, attrs, 0); } public CountDownView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mContext = context; TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.CountDownView); mRetreatType = array.getInt(R.styleable.CountDownView_cd_retreat_type, 1); location = array.getInt(R.styleable.CountDownView_cd_location, 1); mCircleRadius = (int) array.getDimension(R.styleable.CountDownView_cd_circle_radius, dip2px(context, 25));//默认25dp mPaintArcWidth = array.getDimension(R.styleable.CountDownView_cd_arc_width, dip2px(context, 3));//默认3dp mPaintArcColor = array.getColor(R.styleable.CountDownView_cd_arc_color, mPaintArcColor); mTextSize = (int) array.getDimension(R.styleable.CountDownView_cd_text_size, dip2px(context, 14));//默认14sp mTextColor = array.getColor(R.styleable.CountDownView_cd_text_color, mTextColor); mPaintBackGroundColor = array.getColor(R.styleable.CountDownView_cd_bg_color, mPaintBackGroundColor); mLoadingTime = array.getInteger(R.styleable.CountDownView_cd_animator_time, 3);//默认3秒 mLoadingTimeUnit = array.getString(R.styleable.CountDownView_cd_animator_time_unit);//时间单位 if (TextUtils.isEmpty(mLoadingTimeUnit)) { mLoadingTimeUnit = ""; } array.recycle(); init(); } private void init() { //背景设为透明,然后造成圆形View的视觉错觉 this.setBackground(ContextCompat.getDrawable(mContext, android.R.color.transparent)); mPaintBackGround = new Paint(); mPaintBackGround.setStyle(Paint.Style.FILL); mPaintBackGround.setAntiAlias(true); mPaintBackGround.setColor(mPaintBackGroundColor); mPaintArc = new Paint(); mPaintArc.setStyle(Paint.Style.STROKE); mPaintArc.setAntiAlias(true); mPaintArc.setColor(mPaintArcColor); mPaintArc.setStrokeWidth(mPaintArcWidth); mPaintText = new Paint(); mPaintText.setStyle(Paint.Style.STROKE); mPaintText.setAntiAlias(true); mPaintText.setColor(mTextColor); mPaintText.setTextSize(mTextSize); if (mLoadingTime < 0) { mLoadingTime = 3; } if (location == 1) {//默认从左侧开始 startAngle = -180; } else if (location == 2) { startAngle = -90; } else if (location == 3) { startAngle = 0; } else if (location == 4) { startAngle = 90; } if (mRetreatType == 1) { mmSweepAngleStart = 0f; mmSweepAngleEnd = 360f; } else { mmSweepAngleStart = 360f; mmSweepAngleEnd = 0f; } } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); //获取view宽高 mWidth = w; mHeight = h; } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); //因为必须是圆形的view,所以在这里重新赋值 setMeasuredDimension(mCircleRadius * 2, mCircleRadius * 2); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); //画北景园 canvas.drawCircle(mWidth / 2, mHeight / 2, mWidth / 2 - mPaintArcWidth, mPaintBackGround); //画圆弧 RectF rectF = new RectF(0 + mPaintArcWidth / 2, 0 + mPaintArcWidth / 2 , mWidth - mPaintArcWidth / 2, mHeight - mPaintArcWidth / 2); canvas.drawArc(rectF, startAngle, mSweepAngle, false, mPaintArc); //画文字 float mTetxWidth = mPaintText.measureText(mText, 0, mText.length()); float dx = mWidth / 2 - mTetxWidth / 2; Paint.FontMetricsInt fontMetricsInt = mPaintText.getFontMetricsInt(); float dy = (fontMetricsInt.bottom - fontMetricsInt.top) / 2 - fontMetricsInt.bottom; float baseLine = mHeight / 2 + dy; canvas.drawText(mText, dx, baseLine, mPaintText); } public void start() { ValueAnimator animator = ValueAnimator.ofFloat(mmSweepAngleStart, mmSweepAngleEnd); animator.setInterpolator(new LinearInterpolator()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { mSweepAngle = (float) valueAnimator.getAnimatedValue(); //获取到需要绘制的角度,重新绘制 invalidate(); } }); //这里是时间获取和赋值 ValueAnimator animator1 = ValueAnimator.ofInt(mLoadingTime, 0); Log.d("aaa","倒计时"+mLoadingTime); animator1.setInterpolator(new LinearInterpolator()); animator1.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { int time = (int) valueAnimator.getAnimatedValue(); mText = time + mLoadingTimeUnit+"跳过"; } }); AnimatorSet set = new AnimatorSet(); set.playTogether(animator, animator1); set.setDuration(mLoadingTime * 1000); set.setInterpolator(new LinearInterpolator()); set.start(); set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); clearAnimation(); if (loadingFinishListener != null) { loadingFinishListener.finish(); } } }); } private OnLoadingFinishListener loadingFinishListener; public void setOnLoadingFinishListener(OnLoadingFinishListener listener) { this.loadingFinishListener = listener; } public interface OnLoadingFinishListener { void finish(); } /** * 根据手机的分辨率从 dp 的单位 转成为 px(像素) */ public static int dip2px(Context context, float dpValue) { final float scale = context.getResources().getDisplayMetrics().density; return (int) (dpValue * scale + 0.5f); } }
916fae2bc56b90d2a41ea13f325a63f31d004122
1e8d513e635130c9658897e6767a15556194f312
/src/main/java/se/zeroplusx/musicapi/dto/RelationUrl.java
b2c45f77e74544fb3e3c2c317a88b6d9a28519ec
[]
no_license
makotovh/musicapi
0a3b32af73f60c8a81d1dac47ccd5013ea408c94
0e05ad724a3e160ca8f4d39addc49a28ac5c7e1f
refs/heads/master
2022-05-08T02:50:02.056593
2022-04-23T16:52:20
2022-04-23T16:52:20
152,436,308
1
0
null
null
null
null
UTF-8
Java
false
false
176
java
package se.zeroplusx.musicapi.dto; import lombok.Data; import java.io.Serializable; @Data public class RelationUrl implements Serializable { private String resource; }
4437c146b75e7973fb7357e341397ccf91f7fb9b
92f7ba1ebc2f47ecb58581a2ed653590789a2136
/src/com/infodms/dms/bean/TmVsAddressBean.java
61c7d92e18c75d48f0de0fa83b11c1d8301adedd
[]
no_license
dnd2/CQZTDMS
504acc1883bfe45842c4dae03ec2ba90f0f991ee
5319c062cf1932f8181fdd06cf7e606935514bf1
refs/heads/master
2021-01-23T15:30:45.704047
2017-09-07T07:47:51
2017-09-07T07:47:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,257
java
package com.infodms.dms.bean; import java.util.Date; public class TmVsAddressBean{ private String myAddress; private Long dealerId; private Long updateBy; private String tel; private Date updateDate; private String address; private Long id; private Long createBy; private String remark; private Date createDate; private Integer status; private String linkMan; private String addCode; private String mobilePhone;//手机 public String getMobilePhone() { return mobilePhone; } public void setMobilePhone(String mobilePhone) { this.mobilePhone = mobilePhone; } public String getMyAddress() { return myAddress; } public void setMyAddress(String myAddress) { this.myAddress = myAddress; } public Long getDealerId() { return dealerId; } public void setDealerId(Long dealerId) { this.dealerId = dealerId; } public Long getUpdateBy() { return updateBy; } public void setUpdateBy(Long updateBy) { this.updateBy = updateBy; } public String getTel() { return tel; } public void setTel(String tel) { this.tel = tel; } public Date getUpdateDate() { return updateDate; } public void setUpdateDate(Date updateDate) { this.updateDate = updateDate; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getCreateBy() { return createBy; } public void setCreateBy(Long createBy) { this.createBy = createBy; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public Date getCreateDate() { return createDate; } public void setCreateDate(Date createDate) { this.createDate = createDate; } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } public String getLinkMan() { return linkMan; } public void setLinkMan(String linkMan) { this.linkMan = linkMan; } public String getAddCode() { return addCode; } public void setAddCode(String addCode) { this.addCode = addCode; } }
855105d1219280e1c3ce011efa397528d2cefbf4
d22be67af1387d2f582da57f337862ed9a0e4aad
/leetcode/src/string/_36Decimal.java
a7b5228d062a8dbb2dd21b2c93e2bbead5c7a29d
[]
no_license
androidZzT/LeetCode-java
66095225ff1e7164af4590424f306a6cd682e0df
7ddcb6a0486af9c1b6488cf432656d745d2c5168
refs/heads/master
2021-08-18T04:12:17.497957
2021-07-31T05:38:03
2021-07-31T08:10:04
207,045,235
0
0
null
null
null
null
UTF-8
Java
false
false
2,034
java
package string; import java.util.Arrays; import java.util.List; public class _36Decimal { private static List<Character> tableList; static { Character[] table = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}; tableList = Arrays.asList(table); } public static void main(String[] args) { String a1 = "10"; String a2 = "11"; System.out.println(thirtySixDecimal(a1, a2)); } private static String thirtySixDecimal(String a, String b) { int i = a.length() - 1; int j = b.length() - 1; StringBuilder ansBuilder = new StringBuilder(); int carry = 0; while(i >= 0 && j >= 0) { int num1 = tableList.indexOf(a.charAt(i)); int num2 = tableList.indexOf(b.charAt(j)); int sum = num1 + num2 + carry; if (sum >= 36) { carry = 1; ansBuilder.append(tableList.get(sum % 36)); } else { carry = 0; ansBuilder.append(tableList.get(sum)); } i--; j--; } while (i >= 0) { int sum = tableList.indexOf(a.charAt(i)) + carry; if (sum >= 36) { carry = 1; ansBuilder.append(tableList.get(sum % 36)); } else { carry = 0; ansBuilder.append(tableList.get(sum)); } } while (j >= 0) { int sum = tableList.indexOf(b.charAt(j)) + carry; if (sum >= 36) { carry = 1; ansBuilder.append(tableList.get(sum % 36)); } else { carry = 0; ansBuilder.append(tableList.get(sum)); } } if (carry > 0) { ansBuilder.append('1'); } return ansBuilder.reverse().toString(); } }
69394dd503573daa1a567359e528e380674a3154
ad1d80ae560ba88ccba2ce5b70099f20a3ea6bb4
/src/main/java/com/wdeath/game/evol01/mind/command/Fission.java
3af77dcb317aeea6299a71fa4c00e51f7ae9a784
[]
no_license
Wladimir134679/Evol01
6d063630a1872ac7b25a1ea6e0f900b298474db3
bcb02f7bcd4273e5e8ff8beeea2a71a893ee00ac
refs/heads/master
2020-05-03T12:57:43.045403
2019-03-31T04:10:40
2019-03-31T04:10:40
178,640,711
0
0
null
null
null
null
UTF-8
Java
false
false
1,176
java
package com.wdeath.game.evol01.mind.command; import com.wdeath.game.evol01.PulBot; import com.wdeath.game.evol01.mind.CommandMind; import com.wdeath.game.evol01.mind.IMind; import com.wdeath.game.evol01.mind.MindEngine; import com.wdeath.game.evol01.world.Bot; @IMind(id = 7) public class Fission implements CommandMind { @Override public void process(MindEngine mind) { Bot bot = mind.getBot(); int dir = mind.getCommand(mind.getUTK() + 1) % 8; mind.next(); int[] dirsV = bot.getDirLocal(dir); int x = bot.getWorld().getXW(bot.getX() + dirsV[0]); int y = bot.getWorld().getYW(bot.getY() + dirsV[1]); if(!bot.getWorld().isFreeCellAll(x, y)) return; bot.setFood(bot.getFood() - 50); bot.setHealth(bot.getHealth() - 10); if(bot.getFood() <= 0 || bot.getHealth() <= 0) { mind.stop(); return; } Bot b = PulBot.getInstance(); b.setFood(5); b.setHealth(10); mind.cloneMind(b.getMind(), 0.25f); b.setX(x); b.setY(y); bot.getWorld().addBot(b, bot.getWorld().getIndexBot(bot) + 1); } }
70c5ff510dcda2b849115ec3664e494034d1786d
ee703411e6621505ca962513f6976b9f37ff6f21
/app/src/main/java/com/example/mytasksapp/adapters/AddListAdapter.java
0f8e3fe91b7efe5bda840a4b34a4c12eb28f789a
[]
no_license
Auridel/MyTasksApp
25891d1a62ce10b890ee351b4a4c7f16b12bdb4d
69d5097db2a4b8f8484167cc5e13dbe5632d2d51
refs/heads/main
2023-03-31T07:51:18.727952
2021-03-29T20:55:30
2021-03-29T20:55:30
345,653,245
0
0
null
null
null
null
UTF-8
Java
false
false
2,044
java
package com.example.mytasksapp.adapters; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.recyclerview.widget.RecyclerView; import com.example.mytasksapp.R; import com.example.mytasksapp.pojo.MyList; import java.util.ArrayList; import java.util.List; public class AddListAdapter extends RecyclerView.Adapter<AddListAdapter.AddListViewHolder>{ private List<MyList> myListList; public AddListAdapter() { this.myListList = new ArrayList<>(); } class AddListViewHolder extends RecyclerView.ViewHolder { private TextView textViewTitle; private ConstraintLayout constraintLayoutDeleteList; public AddListViewHolder(@NonNull View itemView) { super(itemView); textViewTitle = itemView.findViewById(R.id.textViewTitle); constraintLayoutDeleteList = itemView.findViewById(R.id.deleteListItem); } } @NonNull @Override public AddListViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.add_list_item, parent, false); return new AddListViewHolder(view); } @Override public void onBindViewHolder(@NonNull AddListViewHolder holder, int position) { MyList list = myListList.get(position); holder.textViewTitle.setText(list.getTitle()); holder.constraintLayoutDeleteList.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.i("testrun", "clicked delete"); } }); } @Override public int getItemCount() { return myListList.size(); } public void setMyListList(List<MyList> myListList) { this.myListList = myListList; notifyDataSetChanged(); } }
f4014c6b02b0d5cb0bb87d650d17a8b887d9e835
7098f2d71cb0699a46a11c2db96e76285d35727c
/dss-src/apps/tlmanager/tlmanager-app/src/main/java/eu/europa/ec/markt/tlmanager/view/multivalue/content/AnyUriContent.java
6a0b4dcaa52943e5a3ef36b3695043848cdb3b0a
[]
no_license
p4535992/sd-dss-3.0.3
4344521a309efaacd1798ed4bd7e7ef37a69f874
b2fa77670267732daca5d86a5e46a9f71bd16247
refs/heads/master
2021-08-30T11:07:59.383832
2017-12-17T15:07:14
2017-12-17T15:07:14
112,770,373
0
0
null
null
null
null
UTF-8
Java
false
false
2,430
java
/* * DSS - Digital Signature Services * * Copyright (C) 2011 European Commission, Directorate-General Internal Market and Services (DG MARKT), B-1049 Bruxelles/Brussel * * Developed by: 2011 ARHS Developments S.A. (rue Nicolas Bové 2B, L-1253 Luxembourg) http://www.arhs-developments.com * * This file is part of the "DSS - Digital Signature Services" project. * * "DSS - Digital Signature Services" is free software: you can redistribute it and/or modify it under the terms of * the GNU Lesser General Public License as published by the Free Software Foundation, either version 2.1 of the * License, or (at your option) any later version. * * DSS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with * "DSS - Digital Signature Services". If not, see <http://www.gnu.org/licenses/>. */ package eu.europa.ec.markt.tlmanager.view.multivalue.content; import eu.europa.ec.markt.tlmanager.view.panel.AnyUriModel; import eu.europa.ec.markt.tlmanager.view.panel.AnyUriPanel; import java.awt.*; /** * Management of an <code>AnyUriPanel</code> for a <code>MultiContent</code>. * * * @version $Revision: 2519 $ - $Date: 2013-09-10 17:26:58 +0200 (mar., 10 sept. 2013) $ */ public class AnyUriContent extends MultiContent<AnyUriModel> { private AnyUriPanel anyUriPanel; /** * Instantiates a new AnyUriContent. */ public AnyUriContent() { anyUriPanel = new AnyUriPanel(); } /** {@inheritDoc} */ @Override public Component getComponent() { return anyUriPanel; } /** {@inheritDoc} */ @Override protected AnyUriModel retrieveComponentValue(boolean clearOnExit) { AnyUriModel model = anyUriPanel.retrieveCurrentValues(); if (clearOnExit) { anyUriPanel.clearModel(); } if (model.isEmpty()) { return null; } return model; } /** {@inheritDoc} */ @Override protected void updateValue() { AnyUriModel value = getValue(currentKey); if (value != null) { anyUriPanel.updateCurrentValues(value); } else { anyUriPanel.clearModel(); } } }
2122e7b3ded18df8b1af03d2aa4d93dad6824f5b
9e6276b51e7b0f80abd30d45d4442660fe5e287d
/parcelMicroservice/src/main/java/com/parcel/parcelMicroservice/service/impl/ParcelServiceImpl.java
ddac81d369459e9a236802c40749574a11b4a967
[]
no_license
rosa-ya/GuestParcelTracking
0a6636a7e61390af859c7f1a3659ed60713998a1
bd9b92a34cde38e7def24ea836f7ada5ffc479ce
refs/heads/master
2023-03-09T04:40:35.884960
2021-03-01T20:11:31
2021-03-01T20:11:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,750
java
package com.parcel.parcelMicroservice.service.impl; import com.parcel.parcelMicroservice.errors.ErrorCreation; import com.parcel.parcelMicroservice.model.dto.ParcelDto; import com.parcel.parcelMicroservice.model.mapper.ParcelMapper; import com.parcel.parcelMicroservice.repository.ParcelRepository; import com.parcel.parcelMicroservice.service.ParcelService; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import java.util.List; /** * @author Rose */ @Service @AllArgsConstructor @Slf4j public class ParcelServiceImpl implements ParcelService { ParcelRepository parcelRepository; ParcelMapper parcelMapper; @Override public ParcelDto addParcel(ParcelDto parcelDto) { return parcelMapper.mapEntityToDto(parcelRepository.save(parcelMapper.mapDtoToEntity(parcelDto))); } @Override public List<ParcelDto> findAndUpdateParcels(long guestId) { List<ParcelDto> parcelDtos = findParcelsByGuestId(guestId); if (parcelDtos.isEmpty()) { throw ErrorCreation.THERE_IS_NO_PARCEL.ErrorCreation(); } parcelDtos.forEach(parcelDto -> { parcelDto.setDelivered(true); log.info("Parcel {} delivered to guest {}", parcelDto.getParcelCode(), guestId); }); return parcelMapper.mapEntityToDtoList(parcelRepository.saveAll(parcelMapper.mapDtoToEntityList(parcelDtos))); } @Override public List<ParcelDto> findParcelsByGuestId(long guestId) { List<ParcelDto> parcelDtos = parcelMapper.mapEntityToDtoList(parcelRepository.findByGuestId(guestId)); log.info("Parcel for {} is {} ", guestId, parcelDtos.toString()); return parcelDtos; } }
2ff2f043b8582a066a949ee4650874d8be3b7a82
d336e0822bfb50f1ce63aa5a41c8d1d4af6944db
/core/src/main/java/com/draniksoft/ome/utils/JsonUtils.java
5587dcd6dccc2497ae6d7c812297d114366f2c5c
[]
no_license
dranikpg/OME
cad52a8b1e44e4c5867f961c9c11677b6eab541c
35988239fd218e23e3d802732bb1ffd3e9c68fd6
refs/heads/master
2021-09-11T13:22:40.576750
2018-04-07T16:16:33
2018-04-07T16:16:33
100,270,204
1
0
null
null
null
null
UTF-8
Java
false
false
3,844
java
package com.draniksoft.ome.utils; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.JsonValue; import com.badlogic.gdx.utils.ObjectSet; import com.draniksoft.ome.utils.lang.BiLangText; import com.draniksoft.ome.utils.lang.I18NText; import com.draniksoft.ome.utils.lang.PlainText; import com.draniksoft.ome.utils.lang.Text; import com.draniksoft.ome.utils.stringmatch.AllMatcher; import com.draniksoft.ome.utils.stringmatch.Matcher; import com.draniksoft.ome.utils.stringmatch.StartsWithMatcher; public class JsonUtils { private static final String tag = "JsonUtils"; public static JsonValue createIntV(int i) { JsonValue v = new JsonValue(JsonValue.ValueType.longValue); v.set(i, null); return v; } public static JsonValue createIntV(String n, int i) { JsonValue v = createIntV(i); v.setName(n); return v; } public static JsonValue createStringV(String s) { JsonValue v = new JsonValue(JsonValue.ValueType.stringValue); v.set(s); return v; } public static JsonValue createStringV(String n, String val) { JsonValue v = createStringV(val); v.setName(n); return v; } public static JsonValue createStringArrV(Array<String> ar) { JsonValue v = new JsonValue(JsonValue.ValueType.array); for (String s : ar) { v.addChild(JsonUtils.createStringV(s)); } return v; } public static JsonValue createStringArrV(ObjectSet<String> ar) { JsonValue v = new JsonValue(JsonValue.ValueType.array); for (String s : ar) { v.addChild(JsonUtils.createStringV(s)); } return v; } public static JsonValue createBoolV(boolean b) { JsonValue v = new JsonValue(JsonValue.ValueType.booleanValue); v.set(b); return v; } public static <T> T getVal(Class<T> c, JsonValue v) { if (c == Boolean.class) { return (T) new Boolean(v.asBoolean()); } else if (c == Integer.class) { return (T) new Integer(v.asInt()); } else if (c == String.class) { return (T) v.asString(); } return null; } public static Object parseTpye(String kS, Class confT) { if (confT == Boolean.class) { return Boolean.parseBoolean(kS); } else if (confT == String.class) { return kS; } else if (confT == Integer.class) { return Integer.valueOf(kS); } return null; } public static Text parseText(JsonValue v) { return parseText(v, true); } public static Text parseText(JsonValue v, boolean emptyMessage) { if (v == null) return emptyMessage ? new PlainText("*ERROR*") : null; if (v.type() == JsonValue.ValueType.stringValue) { String s = v.asString(); if (s.startsWith(":@")) { return new I18NText(s.substring(2)); } else { return new PlainText(s); } } else if (v.hasChild("en") && v.hasChild("ru")) { return new BiLangText( v.getString("en"), v.getString("ru")); } return emptyMessage ? new PlainText("*ERROR*") : null; } public static Matcher parseMatcher(JsonValue v) { if (!v.has("type")) { return new AllMatcher(); } String t = v.getString("type"); if (t.equals("stsw")) { StartsWithMatcher m = new StartsWithMatcher(); m.load(v); return m; } else { return new AllMatcher(); } } public static Class parseClass(JsonValue v) { if (!v.isString()) return null; String s = v.asString(); if (s.startsWith("#")) s = "com.draniksoft.ome." + s.substring(1); else if (s.startsWith(":")) s = "com.draniksoft.ome.editor." + s.substring(1); Class c; try { c = Class.forName(s); } catch (ClassNotFoundException e) { Gdx.app.debug("", "Not found " + s); return null; } return c; } }
ff364c4d2e63e3e91eb1d68b08f0cce93eb564c7
722ff6b6ab7039ee4136df8637ab3edfb4349b92
/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/configurationmetadata/annotationprocessor/automaticmetadatageneration/MyServerProperties.java
e5193aa70e06c6f249c60b41ead4a7eea019a5b6
[ "Apache-2.0" ]
permissive
BradOselo/spring-boot
77ee69e549032a73c183a1983b1840dc07b4c65e
8a0bfef9bbf3ab94998fb9a1d3470c8648bdf916
refs/heads/main
2023-05-30T00:21:54.593214
2021-06-10T18:18:29
2021-06-10T18:18:29
375,946,993
3
0
Apache-2.0
2021-06-11T07:51:57
2021-06-11T07:51:56
null
UTF-8
Java
false
false
1,451
java
/* * Copyright 2012-2021 the original author or 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.boot.docs.configurationmetadata.annotationprocessor.automaticmetadatageneration; import org.springframework.boot.context.properties.ConfigurationProperties; @ConfigurationProperties(prefix = "my.server") public class MyServerProperties { /** * Name of the server. */ private String name; /** * IP address to listen to. */ private String ip = "127.0.0.1"; /** * Port to listener to. */ private int port = 9797; // @fold:on // getters/setters ... public String getName() { return this.name; } public void setName(String name) { this.name = name; } public String getIp() { return this.ip; } public void setIp(String ip) { this.ip = ip; } public int getPort() { return this.port; } public void setPort(int port) { this.port = port; } // fold:off }
63d8bf609a032781f01048c2ebad89d10a357616
c2f7dd387d3a457e5e167b32b7546dccd0234226
/src/Console/Interpreter.java
f3e6a02c6fabf523bea0bfcccb5f6dd4df23fd67
[]
no_license
adabirtocian/Toy_Language_Interpreter
beaad17255ea1509fb705fcba57401f92422ff02
be425c451cd4683839249e36756e4468054801c5
refs/heads/master
2023-03-23T08:21:53.820525
2021-03-22T07:09:54
2021-03-22T07:09:54
313,592,780
0
0
null
null
null
null
UTF-8
Java
false
false
24,309
java
package Console; public class Interpreter { public static void main(String[] args) { // IStack<IStatement> exeStack1 = new MyStack<>(); // IDictionary<String, IValue> symbolTable1 = new Dictionary<>(); // IDictionary<StringValue, BufferedReader> fileTable1 = new FileTable<>(); // IList<IValue> out1 = new List<>(); // IHeapTable<Integer, IValue> heapTable1 = new HeapTable<>(); // // // string varf; varf = "test.txt"; open(varf); int varc; readRFile(varf, varc); print(varc); readRFile(varf, varc); print(varc); close(varf) // IStatement program1 = new CompStatement( // new VarDeclarationStatement("varf", new StringType()), // new CompStatement( // new AssignStatement("varf", new ValueExpression(new StringValue("test.txt"))), // new CompStatement( // new OpenRFileStatement(new VarExpression("varf")), // new CompStatement( // new VarDeclarationStatement("varc", new IntType()), // new CompStatement( // new ReadFileStatement(new VarExpression("varf"), "varc"), // new CompStatement( // new PrintStatement(new VarExpression("varc")), // new CompStatement( // new ReadFileStatement(new VarExpression("varf"), "varc"), // new CompStatement( // new PrintStatement(new VarExpression("varc")), // new CloseRFileStatement(new VarExpression("varf")))))))))); // ProgramState programState1 = new ProgramState(exeStack1, symbolTable1, out1, program1, fileTable1, heapTable1); // IRepository repository1 = new Repository("log1.txt"); // Controller controller1 = new Controller(repository1); // controller1.addProgram(programState1); // // IStack<IStatement> exeStack2 = new MyStack<>(); // IDictionary<String, IValue> symbolTable2 = new Dictionary<>(); // IDictionary<StringValue, BufferedReader> fileTable2 = new FileTable<>(); // IList<IValue> out2 = new List<>(); // IHeapTable<Integer, IValue> heapTable2 = new HeapTable<>(); // // // string varf; varf=test.txt; openfile(varf); int varc; int a; readfile(varf,varc); print(varc); readfile(varf,a); if (a>varc) then (print(a) else print(varc); closefile(varf) // IStatement program2 = new CompStatement( // new VarDeclarationStatement("varf", new StringType()), // new CompStatement( // new AssignStatement("varf", new ValueExpression(new StringValue("test.txt"))), // new CompStatement( // new OpenRFileStatement(new VarExpression("varf")), // new CompStatement( // new VarDeclarationStatement("varc", new IntType()), // new CompStatement( // new VarDeclarationStatement("a", new IntType()), // new CompStatement( // new ReadFileStatement(new VarExpression("varf"), "varc"), // new CompStatement( // new PrintStatement(new VarExpression("varc")), // new CompStatement( // new ReadFileStatement(new VarExpression("varf"), "a"), // new CompStatement( // new IfStatement( // new RelationalExpression( // new VarExpression("a"), // new VarExpression("varc"), // ">"), // new PrintStatement(new VarExpression("a")), // new PrintStatement(new VarExpression("varc"))), // new CloseRFileStatement(new VarExpression("varf"))))))))))); // // ProgramState programState2 = new ProgramState(exeStack2, symbolTable2, out2, program2, fileTable2, heapTable2); // IRepository repository2 = new Repository("log2.txt"); // Controller controller2 = new Controller(repository2); // controller2.addProgram(programState2); // // IStack<IStatement> exeStack3 = new MyStack<>(); // IDictionary<String, IValue> symbolTable3 = new Dictionary<>(); // IDictionary<StringValue, BufferedReader> fileTable3 = new FileTable<>(); // IList<IValue> out3 = new List<>(); // IHeapTable<Integer, IValue> heapTable3 = new HeapTable<>(); // // // string varf; varf=test.txt; openfile(varf); int a; readfile(varf,a); if (10>a) then print(a less than 10) else print(a greater than 10); closefile(varf) // IStatement program3 = new CompStatement( // new VarDeclarationStatement("varf", new StringType()), // new CompStatement( // new AssignStatement("varf", new ValueExpression(new StringValue("test.txt"))), // new CompStatement( // new OpenRFileStatement(new VarExpression("varf")), // new CompStatement( // new VarDeclarationStatement("a", new IntType()), // new CompStatement( // new ReadFileStatement(new VarExpression("varf"), "a"), // new CompStatement( // new IfStatement( // new RelationalExpression( // new ValueExpression(new IntValue(10)), // new VarExpression("a"), // ">"), // new PrintStatement(new ValueExpression(new StringValue("a less than 10"))), // new PrintStatement(new ValueExpression(new StringValue("a greater than 10")))), // new CloseRFileStatement(new VarExpression("varf")))))))); // // ProgramState programState3 = new ProgramState(exeStack3, symbolTable3, out3, program3, fileTable3, heapTable3); // IRepository repository3 = new Repository("log3.txt"); // Controller controller3 = new Controller(repository3); // controller3.addProgram(programState3); // // // // int a; int b; string file; file="test.txt"; open(file); readRFile(file, a), readRFile(file, b); a=a*2; b=a+1; print(a); print(b); close(file) // IStack<IStatement> exeStack4 = new MyStack<>(); // IDictionary<String, IValue> symbolTable4 = new Dictionary<>(); // IDictionary<StringValue, BufferedReader> fileTable4 = new FileTable<>(); // IList<IValue> out4 = new List<>(); // IHeapTable<Integer, IValue> heapTable4 = new HeapTable<>(); // // IStatement program4 = new CompStatement( // new VarDeclarationStatement("a", new IntType()), // new CompStatement( // new VarDeclarationStatement("b", new IntType()), // new CompStatement( // new VarDeclarationStatement("file", new StringType()), // new CompStatement( // new AssignStatement("file", new ValueExpression(new StringValue("test.txt"))), // new CompStatement( // new OpenRFileStatement(new VarExpression("file")), // new CompStatement( // new ReadFileStatement(new VarExpression("file"), "a"), // new CompStatement( // new ReadFileStatement(new VarExpression("file"), "b"), // new CompStatement( // new AssignStatement("a", // new ArithmeticExpression( // new VarExpression("a"), // new ValueExpression(new IntValue(2)), // '*')), // new CompStatement( // new AssignStatement("b", // new ArithmeticExpression( // new ValueExpression(new IntValue(1)), // new VarExpression("a"), // '+')), // new CompStatement( // new PrintStatement(new VarExpression("a")), // new CompStatement( // new PrintStatement(new VarExpression("b")), // new CloseRFileStatement(new VarExpression("file"))))))))))))); // // ProgramState programState4 = new ProgramState(exeStack4, symbolTable4, out4, program4, fileTable4, heapTable4); // IRepository repository4 = new Repository("log4.txt"); // Controller controller4 = new Controller(repository4); // controller4.addProgram(programState4); // // // // IStack<IStatement> exeStack5 = new MyStack<>(); // IDictionary<String, IValue> symbolTable5 = new Dictionary<>(); // IDictionary<StringValue, BufferedReader> fileTable5 = new FileTable<>(); // IList<IValue> out5 = new List<>(); // IHeapTable<Integer, IValue> heapTable5 = new HeapTable<>(); // // // Ref int v;new(v,20);print(rH(v)); wH(v,30);print(rH(v)+5); // IStatement program5 = new CompStatement( // new VarDeclarationStatement("v", new ReferenceType(new IntType())), // new CompStatement( // new NewStatement("v", new ValueExpression(new IntValue(20))), // new CompStatement( // new PrintStatement(new HeapReadingExpression(new VarExpression("v"))), // new CompStatement( // new HeapWritingStatement("v", new ValueExpression(new IntValue(30))), // new PrintStatement( // new ArithmeticExpression( // new HeapReadingExpression(new VarExpression("v")), // new ValueExpression(new IntValue(5)), // '+') // // // ) // ) // ) // )); // // ProgramState programState5 = new ProgramState(exeStack5, symbolTable5, out5, program5, fileTable5, heapTable5); // IRepository repository5 = new Repository("log5.txt"); // Controller controller5 = new Controller(repository5); // controller5.addProgram(programState5); // // // IStack<IStatement> exeStack6 = new MyStack<>(); // IDictionary<String, IValue> symbolTable6 = new Dictionary<>(); // IDictionary<StringValue, BufferedReader> fileTable6 = new FileTable<>(); // IList<IValue> out6 = new List<>(); // IHeapTable<Integer, IValue> heapTable6 = new HeapTable<>(); // // //Ref int v;new(v,20);Ref Ref int a; new(a,v); writeheap(v,30);print(rH(rH(a))) // IStatement program6 = new CompStatement( // new VarDeclarationStatement("v", new ReferenceType(new IntType())), // new CompStatement( // new NewStatement("v", new ValueExpression(new IntValue(20))), // new CompStatement( // new VarDeclarationStatement("a", new ReferenceType(new ReferenceType(new IntType()))), // new CompStatement( // new NewStatement("a", new VarExpression("v")), // new CompStatement( // new HeapWritingStatement("v", new ValueExpression(new IntValue(30))), // new PrintStatement(new HeapReadingExpression( // new HeapReadingExpression(new VarExpression("a"))))))))); // // ProgramState programState6 = new ProgramState(exeStack6, symbolTable6, out6, program6, fileTable6, heapTable6); // IRepository repository6 = new Repository("log6.txt"); // Controller controller6 = new Controller(repository6); // controller6.addProgram(programState6); // // // IStack<IStatement> exeStack7 = new MyStack<>(); // IDictionary<String, IValue> symbolTable7 = new Dictionary<>(); // IDictionary<StringValue, BufferedReader> fileTable7 = new FileTable<>(); // IList<IValue> out7 = new List<>(); // IHeapTable<Integer, IValue> heapTable7 = new HeapTable<>(); // // //int v; v=4; (while (v>0) print(v);v=v-1);print(v) // IStatement program7 = new CompStatement( // new VarDeclarationStatement("v", new IntType()), // new CompStatement( // new AssignStatement("v", new ValueExpression(new IntValue(4))), // new CompStatement( // new WhileStatement( // new RelationalExpression(new VarExpression("v"), new ValueExpression(new IntValue(0)), ">"), // new CompStatement( // new PrintStatement(new VarExpression("v")), // new AssignStatement("v", // new ArithmeticExpression(new VarExpression("v"), new ValueExpression(new IntValue(1)), '-')) // ) // ), // new PrintStatement(new VarExpression("v")) // ) // ) // // ); // ProgramState programState7 = new ProgramState(exeStack7, symbolTable7, out7, program7, fileTable7, heapTable7); // IRepository repository7 = new Repository("log7.txt"); // Controller controller7 = new Controller(repository7); // controller7.addProgram(programState7); // // // // IStack<IStatement> exeStack8 = new MyStack<>(); // IDictionary<String, IValue> symbolTable8 = new Dictionary<>(); // IDictionary<StringValue, BufferedReader> fileTable8 = new FileTable<>(); // IList<IValue> out8 = new List<>(); // IHeapTable<Integer, IValue> heapTable8 = new HeapTable<>(); // // // int v; Ref int a; v=10;new(a,22); fork(wH(a,30);v=32;print(v);print(rH(a))); print(v);print(rH(a)) // IStatement program8 = new CompStatement( // new VarDeclarationStatement("v", new IntType()), // new CompStatement( // new VarDeclarationStatement("a", new ReferenceType(new IntType())), // new CompStatement( // new AssignStatement("v", new ValueExpression(new IntValue(10))), // new CompStatement( // new NewStatement("a", new ValueExpression(new IntValue(22))), // new CompStatement( // new ForkStatement( // new CompStatement( // new HeapWritingStatement("a", new ValueExpression(new IntValue(30))), // new CompStatement( // new AssignStatement("v", new ValueExpression(new IntValue(32))), // new CompStatement( // new PrintStatement(new VarExpression("v")), // new PrintStatement(new HeapReadingExpression(new VarExpression("a"))) // ) // ) // ) // ), // new CompStatement( // new PrintStatement(new VarExpression("v")), // new PrintStatement(new HeapReadingExpression(new VarExpression("a"))) // ) // ) // ) // ))); // // ProgramState programState8 = new ProgramState(exeStack8, symbolTable8, out8, program8, fileTable8, heapTable8); // IRepository repository8 = new Repository("log8.txt"); // Controller controller8 = new Controller(repository8); // controller8.addProgram(programState8); // // // error in type checker // IStack<IStatement> exeStack9 = new MyStack<>(); // IDictionary<String, IValue> symbolTable9 = new Dictionary<>(); // IDictionary<StringValue, BufferedReader> fileTable9 = new FileTable<>(); // IList<IValue> out9 = new List<>(); // IHeapTable<Integer, IValue> heapTable9 = new HeapTable<>(); // // IStatement program9 = new CompStatement( // new VarDeclarationStatement("v", new IntType()), // new CompStatement( // new VarDeclarationStatement("a", new ReferenceType(new IntType())), // new CompStatement( // new AssignStatement("v", new ValueExpression(new BoolValue(true))), // new CompStatement( // new NewStatement("a", new ValueExpression(new IntValue(22))), // new CompStatement( // new ForkStatement( // new CompStatement( // new HeapWritingStatement("a", new ValueExpression(new IntValue(30))), // new CompStatement( // new AssignStatement("v", new ValueExpression(new IntValue(32))), // new CompStatement( // new PrintStatement(new VarExpression("v")), // new PrintStatement(new HeapReadingExpression(new VarExpression("a"))) // ) // ) // ) // ), // new CompStatement( // new PrintStatement(new VarExpression("v")), // new PrintStatement(new HeapReadingExpression(new VarExpression("a"))) // ) // ) // ) // ))); // // ProgramState programState9 = new ProgramState(exeStack9, symbolTable9, out9, program9, fileTable9, heapTable9); // IRepository repository9 = new Repository("log9.txt"); // Controller controller9 = new Controller(repository9); // controller9.addProgram(programState9); // // // TextMenu menu = new TextMenu(); // menu.addCommand(new ExitCommand("0", "exit")); // menu.addCommand(new RunExampleCommand("1", program1.toString(), controller1)); // menu.addCommand(new RunExampleCommand("2", program2.toString(), controller2)); // menu.addCommand(new RunExampleCommand("3", program3.toString(), controller3)); // menu.addCommand(new RunExampleCommand("4", program4.toString(), controller4)); // menu.addCommand(new RunExampleCommand("5", program5.toString(), controller5)); // menu.addCommand(new RunExampleCommand("6", program6.toString(), controller6)); // menu.addCommand(new RunExampleCommand("7", program7.toString(), controller7)); // menu.addCommand(new RunExampleCommand("8", program8.toString(), controller8)); // menu.addCommand(new RunExampleCommand("9", program9.toString(), controller9)); // menu.show(); } }
a45b339f0d9f47e2e02e5d77d9165700861f163c
918710d333fed171c23ab71d21449deb5b6eed03
/src/main/java/com/eqinov/recrutement/repository/SiteRepository.java
d4413962e0c3c096ed66a5bf27398e05434dee40
[]
no_license
guisimon28/eqinov-java-test
5a3fdfd98ae75d405c017ed8cb61abd2256af896
f34011ffa907aa489b5b6c693bf7f189ecb7bb20
refs/heads/master
2023-04-08T06:32:59.165106
2020-01-27T09:51:56
2021-10-27T07:30:44
236,456,071
0
2
null
2023-09-08T12:20:21
2020-01-27T09:27:22
Java
UTF-8
Java
false
false
218
java
package com.eqinov.recrutement.repository; import org.springframework.data.jpa.repository.JpaRepository; import com.eqinov.recrutement.data.Site; public interface SiteRepository extends JpaRepository<Site, Long> { }
9c43f8497fe3eb85acc95dee91753dce137da72a
45a63c8db05ba39e24ea921fdcae6240cbd3b25d
/app/src/main/java/com/moolu/framework/ActivityCallback.java
3f47d33312fb09b9478639e8fddee914bb1dea81
[]
no_license
befairyliu/MooLu
c6a1faf4ff4eaacbb351447bde7ae2aceb46ac18
5418f10db888464c221eb5442e6130aaecd812fc
refs/heads/master
2016-09-06T05:16:58.038761
2015-04-17T09:11:12
2015-04-17T09:11:12
30,058,877
1
0
null
null
null
null
UTF-8
Java
false
false
928
java
package com.moolu.framework; /** * This classes purpose is to allow a {@link AsyncTaskWithCallback} to callback to an * {@link android.app.Activity} implementing this interface with an instance of its self * when the task completes. */ public interface ActivityCallback { /** * If an instance of {@link AsyncTaskWithCallback} has been created with no ref argument, * when the owning implementation of {@link ActivityCallback) is called, this will be the ref argument. */ public static int NO_REF = -1; /** * This method should be implemented to handle a callback from a {@link AsyncTaskWithCallback}, this method will be called from the UI * thread once the task completes, from its implementation of onPostExecute). * * @param ref * @param task */ @SuppressWarnings("rawtypes") public void handleCallback(final AsyncTaskWithCallback task, final int ref); }
5457f76b6eb141a80cf9d318792ad3687bf4b1fa
f60d91838cc2471bcad3784a56be2aeece101f71
/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainer.java
9b136eab2c8f2bfa639eff2f70c49e824f8604a5
[ "Apache-2.0" ]
permissive
fisher123456/spring-boot-1.5.11.RELEASE
b3af74913eb1a753a20c3dedecea090de82035dc
d3c27f632101e8be27ea2baeb4b546b5cae69607
refs/heads/master
2023-01-07T04:12:02.625478
2019-01-26T17:44:05
2019-01-26T17:44:05
167,649,054
0
0
Apache-2.0
2022-12-27T14:50:58
2019-01-26T04:21:05
Java
UTF-8
Java
false
false
10,529
java
/* * Copyright 2012-2018 the original author or 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 org.springframework.boot.context.embedded.tomcat; import java.util.HashMap; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; import javax.naming.NamingException; import org.apache.catalina.Container; import org.apache.catalina.Context; import org.apache.catalina.Engine; import org.apache.catalina.Lifecycle; import org.apache.catalina.LifecycleEvent; import org.apache.catalina.LifecycleException; import org.apache.catalina.LifecycleListener; import org.apache.catalina.LifecycleState; import org.apache.catalina.Service; import org.apache.catalina.connector.Connector; import org.apache.catalina.startup.Tomcat; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.naming.ContextBindings; import org.springframework.boot.context.embedded.EmbeddedServletContainer; import org.springframework.boot.context.embedded.EmbeddedServletContainerException; import org.springframework.util.Assert; /** * {@link EmbeddedServletContainer} that can be used to control an embedded Tomcat server. * Usually this class should be created using the * {@link TomcatEmbeddedServletContainerFactory} and not directly. * * @author Phillip Webb * @author Dave Syer * @see TomcatEmbeddedServletContainerFactory */ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer { private static final Log logger = LogFactory .getLog(TomcatEmbeddedServletContainer.class); private static final AtomicInteger containerCounter = new AtomicInteger(-1); private final Object monitor = new Object(); private final Map<Service, Connector[]> serviceConnectors = new HashMap<Service, Connector[]>(); private final Tomcat tomcat; private final boolean autoStart; private volatile boolean started; /** * Create a new {@link TomcatEmbeddedServletContainer} instance. * @param tomcat the underlying Tomcat server */ public TomcatEmbeddedServletContainer(Tomcat tomcat) { this(tomcat, true); } /** * Create a new {@link TomcatEmbeddedServletContainer} instance. * @param tomcat the underlying Tomcat server * @param autoStart if the server should be started */ public TomcatEmbeddedServletContainer(Tomcat tomcat, boolean autoStart) { Assert.notNull(tomcat, "Tomcat Server must not be null"); this.tomcat = tomcat; this.autoStart = autoStart; initialize(); } private void initialize() throws EmbeddedServletContainerException { TomcatEmbeddedServletContainer.logger .info("Tomcat initialized with port(s): " + getPortsDescription(false)); synchronized (this.monitor) { try { addInstanceIdToEngineName(); try { final Context context = findContext(); context.addLifecycleListener(new LifecycleListener() { @Override public void lifecycleEvent(LifecycleEvent event) { if (context.equals(event.getSource()) && Lifecycle.START_EVENT.equals(event.getType())) { // Remove service connectors so that protocol // binding doesn't happen when the service is // started. removeServiceConnectors(); } } }); // Start the server to trigger initialization listeners this.tomcat.start(); // We can re-throw failure exception directly in the main thread rethrowDeferredStartupExceptions(); try { ContextBindings.bindClassLoader(context, getNamingToken(context), getClass().getClassLoader()); } catch (NamingException ex) { // Naming is not enabled. Continue } // Unlike Jetty, all Tomcat threads are daemon threads. We create a // blocking non-daemon to stop immediate shutdown startDaemonAwaitThread(); } catch (Exception ex) { containerCounter.decrementAndGet(); throw ex; } } catch (Exception ex) { stopSilently(); throw new EmbeddedServletContainerException( "Unable to start embedded Tomcat", ex); } } } private Context findContext() { for (Container child : this.tomcat.getHost().findChildren()) { if (child instanceof Context) { return (Context) child; } } throw new IllegalStateException("The host does not contain a Context"); } private void addInstanceIdToEngineName() { int instanceId = containerCounter.incrementAndGet(); if (instanceId > 0) { Engine engine = this.tomcat.getEngine(); engine.setName(engine.getName() + "-" + instanceId); } } private void removeServiceConnectors() { for (Service service : this.tomcat.getServer().findServices()) { Connector[] connectors = service.findConnectors().clone(); this.serviceConnectors.put(service, connectors); for (Connector connector : connectors) { service.removeConnector(connector); } } } private void rethrowDeferredStartupExceptions() throws Exception { Container[] children = this.tomcat.getHost().findChildren(); for (Container container : children) { if (container instanceof TomcatEmbeddedContext) { Exception exception = ((TomcatEmbeddedContext) container).getStarter() .getStartUpException(); if (exception != null) { throw exception; } } if (!LifecycleState.STARTED.equals(container.getState())) { throw new IllegalStateException(container + " failed to start"); } } } private void startDaemonAwaitThread() { Thread awaitThread = new Thread("container-" + (containerCounter.get())) { @Override public void run() { TomcatEmbeddedServletContainer.this.tomcat.getServer().await(); } }; awaitThread.setContextClassLoader(getClass().getClassLoader()); awaitThread.setDaemon(false); awaitThread.start(); } @Override public void start() throws EmbeddedServletContainerException { synchronized (this.monitor) { if (this.started) { return; } try { addPreviouslyRemovedConnectors(); Connector connector = this.tomcat.getConnector(); if (connector != null && this.autoStart) { startConnector(connector); } checkThatConnectorsHaveStarted(); this.started = true; TomcatEmbeddedServletContainer.logger .info("Tomcat started on port(s): " + getPortsDescription(true)); } catch (ConnectorStartFailedException ex) { stopSilently(); throw ex; } catch (Exception ex) { throw new EmbeddedServletContainerException( "Unable to start embedded Tomcat servlet container", ex); } finally { Context context = findContext(); ContextBindings.unbindClassLoader(context, getNamingToken(context), getClass().getClassLoader()); } } } private void checkThatConnectorsHaveStarted() { for (Connector connector : this.tomcat.getService().findConnectors()) { if (LifecycleState.FAILED.equals(connector.getState())) { throw new ConnectorStartFailedException(connector.getPort()); } } } private void stopSilently() { try { stopTomcat(); } catch (LifecycleException ex) { // Ignore } } private void stopTomcat() throws LifecycleException { if (Thread.currentThread() .getContextClassLoader() instanceof TomcatEmbeddedWebappClassLoader) { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); } this.tomcat.stop(); } private void addPreviouslyRemovedConnectors() { Service[] services = this.tomcat.getServer().findServices(); for (Service service : services) { Connector[] connectors = this.serviceConnectors.get(service); if (connectors != null) { for (Connector connector : connectors) { service.addConnector(connector); if (!this.autoStart) { stopProtocolHandler(connector); } } this.serviceConnectors.remove(service); } } } private void stopProtocolHandler(Connector connector) { try { connector.getProtocolHandler().stop(); } catch (Exception ex) { TomcatEmbeddedServletContainer.logger.error("Cannot pause connector: ", ex); } } private void startConnector(Connector connector) { try { for (Container child : this.tomcat.getHost().findChildren()) { if (child instanceof TomcatEmbeddedContext) { ((TomcatEmbeddedContext) child).deferredLoadOnStartup(); } } } catch (Exception ex) { TomcatEmbeddedServletContainer.logger.error("Cannot start connector: ", ex); throw new EmbeddedServletContainerException( "Unable to start embedded Tomcat connectors", ex); } } Map<Service, Connector[]> getServiceConnectors() { return this.serviceConnectors; } @Override public void stop() throws EmbeddedServletContainerException { synchronized (this.monitor) { boolean wasStarted = this.started; try { this.started = false; try { stopTomcat(); this.tomcat.destroy(); } catch (LifecycleException ex) { // swallow and continue } } catch (Exception ex) { throw new EmbeddedServletContainerException( "Unable to stop embedded Tomcat", ex); } finally { if (wasStarted) { containerCounter.decrementAndGet(); } } } } private String getPortsDescription(boolean localPort) { StringBuilder ports = new StringBuilder(); for (Connector connector : this.tomcat.getService().findConnectors()) { ports.append(ports.length() == 0 ? "" : " "); int port = (localPort ? connector.getLocalPort() : connector.getPort()); ports.append(port + " (" + connector.getScheme() + ")"); } return ports.toString(); } @Override public int getPort() { Connector connector = this.tomcat.getConnector(); if (connector != null) { return connector.getLocalPort(); } return 0; } /** * Returns access to the underlying Tomcat server. * @return the Tomcat server */ public Tomcat getTomcat() { return this.tomcat; } private Object getNamingToken(Context context) { try { return context.getNamingToken(); } catch (NoSuchMethodError ex) { // Use the context itself on Tomcat 7 return context; } } }
6fb68a8ef8069aefdb58bd096c84bbbba4389e25
314791156e08b97f0e26e97649bffbbb4113f42d
/src/com/spring/org/testFactory/Dog.java
b80fcf91420c1f493aa260072eb2583dc743509b
[]
no_license
laijinchuan/springWeb
1ab8e65a10ae8d936f2ef6e6e5c784f3829ce2c4
368634e482173610f252aee5135a90134547d143
refs/heads/master
2020-04-23T13:11:56.765685
2019-02-27T11:12:16
2019-02-27T11:12:16
171,195,595
0
0
null
null
null
null
UTF-8
Java
false
false
445
java
package com.spring.org.testFactory; public class Dog implements Being { private String name; private int age; public void setAge(int age) { this.age = age; } public void setName(String name) { this.name = name; } @Override public void testBing() { System.out.println("实现"); } @Override public void demoBing() { System.out.println("这是一个狗" + name + "年龄是:" + age); } }
[ "ThinkPad@DESKTOP-L8N9VQP" ]
ThinkPad@DESKTOP-L8N9VQP
401581ac4b9ddf5be86f70d299fb37be28c1a060
4ac8838e6a4fec424894b4caa39e77d91b2ecb90
/Lotto/src/main/java/co/park/pj/LottoArrary.java
0116bea3cf07def543a80bf23e088fda718b3b14
[]
no_license
PGParkJeonguk/2021-09-29
ae52a93245db4d33607b2d4dd8220bffeb843329
4d14a853dd8e8f9808a943349c5b251d2ff90b39
refs/heads/master
2023-08-05T20:16:20.561077
2021-09-29T14:49:12
2021-09-29T14:49:12
411,606,257
0
0
null
null
null
null
UHC
Java
false
false
1,833
java
package co.park.pj; import java.util.Arrays; import java.util.Scanner; public class LottoArrary { int lotto[] = new int[6]; private static Scanner scn = new Scanner(System.in); private void LottoMenu() { while (true) { mainMenu(); int key = scn.nextInt(); scn.nextLine(); if (key == 1) { InSertLotto(); } else if (key == 2) { endMenu(); break; } else { System.out.println("잘못입력하셨습니다."); } } } private void mainMenu() { System.out.println("====================="); System.out.println("여기는 메인메뉴입니다."); System.out.println("1. 얼마를 지를건가요?"); System.out.println("2. 종료입니다."); System.out.println("====================="); } private void InSertLotto() { System.out.println("로또를 살 금액을 입력해 주세요."); int coin = scn.nextInt(); int change = coin % 1000; // 1234원 = 1000 -> 234 // 1234 % 1000 = 몫이 1이 나오고 나머지가 234 scn.nextLine(); for (int i = 0; i < coin / 1000; i++) { if(i%5==0) { System.out.println("====================="); } LottoRandomNumber(); } System.out.println("====================="); System.out.println("잔돈은 " + change + "원이 반환되었습니다."); } private void LottoRandomNumber() { for (int i = 0; i < 6; i++) { lotto[i] = (int) (Math.random() * 45) + 1; for (int j = 0; j < i; j++) { if (lotto[i] == lotto[j]) { i--; break; } } } Arrays.sort(lotto); for (int i = 0; i < 6; i++) { System.out.print(lotto[i] + " "); } System.out.println(""); } private void endMenu() { System.out.println("종료하겠습니다."); } public void run() { LottoMenu(); scn.close(); } }
[ "admin@YD02-22" ]
admin@YD02-22
1b00428e8f3af6860f4f2ed1b37efedc960ab0dd
b63b797ee76c4b8d85297c08ef7d15dec38bb336
/spring-demo/src/main/java/com/cognizant/spring_demo/hasadependency/TestDependancy.java
5dab5879c8c1e439fd189e01f80770ac5aff76aa
[]
no_license
sarishbiswas/projects
408a01e79801b9ecd470669bf54e37842860a0ce
4a82c851fd1b3818022ca6a1291f593519b0b192
refs/heads/master
2022-06-18T10:14:16.608104
2020-03-18T09:25:29
2020-03-18T09:25:29
247,945,628
0
0
null
2022-05-25T07:10:58
2020-03-17T10:52:02
Java
UTF-8
Java
false
false
581
java
package com.cognizant.spring_demo.hasadependency; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class TestDependancy { public static void main(String[] args) { ApplicationContext ctx = new ClassPathXmlApplicationContext("com/cognizant/spring_demo/hasadependency/config.xml"); Employee emp = (Employee)ctx.getBean("employee"); System.out.println(emp.hashCode()); Employee emp1 = (Employee)ctx.getBean("employee"); System.out.println(emp1.hashCode()); } }
c3ac3389c7af2564ba9522939a0aa5bf0ddd166d
4329a7297b6d52672aa88fde3417bc792190f833
/TestTraining/src/model/FastFoodRegistry.java
bcf7fd8751b180c79568860be9c80490eb63d904
[]
no_license
sebastianRebolledo/TrainingEndava
db45b81c6311fffaeca8c5a26e1deff2db0238aa
c0b9675da524e7eb270d2db941d1e6342a9fa882
refs/heads/main
2023-07-04T01:36:43.373304
2021-07-26T18:16:45
2021-07-26T18:16:45
388,869,843
0
0
null
null
null
null
UTF-8
Java
false
false
285
java
package model; public class FastFoodRegistry { public FastFoodRegistry() { } public FastFood registerFaastFood(String nameProduct, double price,int typeFastFood) { FastFood newFastFood = new FastFood(nameProduct, price, typeFastFood); return newFastFood; } }
ed5fdca4686c4948c8fd1b5776e84385ce89df26
4e385807c38ab595ec49bd1d4960e03924c4417a
/JavaDemos/src/main/java/com/java/demo/generic/classdemo/GenericClass.java
29be6afd9b2a7cbbc5faa6e05aee45fa6f24da2c
[]
no_license
fangshanshangithub/DemoSpaces
25ac69e5d6e488759ac037d9282d7e3f2b2ca19c
6c81eed999ee3d4a24e38f47225332336dc804ce
refs/heads/master
2020-03-07T03:14:03.413869
2018-11-09T10:47:48
2018-11-09T10:47:48
127,121,472
0
0
null
null
null
null
UTF-8
Java
false
false
1,419
java
package com.java.demo.generic.classdemo; /** * 泛型方法定义类. * * 泛型有效期只是在编译的时候起作用. * * @Auther: FangSS * @Date: 2018/6/1 0001 16:12 * @Description: */ public class GenericClass<rr> { private rr key; // E 是一个标示[只能放字母,个数不限,E,EE,大小写无关],随便什么都可以T,R,T ....... /** * 构造方法. * @param key 泛型参数,参数类型E可以是任何的类(自定义的类也可) */ public GenericClass(rr key) { this.key = key; } public rr getKey() { return key; } } /** * 泛型,即“参数化类型”。一提到参数,最熟悉的就是定义方法时有形参,然后调用此方法时传递实参。那么参数化类型怎么理解呢?顾名思义, * 就是将类型由原来的具体的类型参数化,类似于方法中的变量参数,此时类型也定义成参数形式(可以称之为类型形参),然后在使用/调用时传入具体的类型(类型实参)。 * 泛型的本质是为了参数化类型(在不创建新的类型的情况下,通过泛型指定的不同类型来控制形参具体限制的类型)。也就是说在泛型使用过程中, * 操作的数据类型被指定为一个参数,这种参数类型可以用在类、接口和方法中,分别被称为泛型类、泛型接口、泛型方法。 * */
3b17e531a059f69e055c7efa17610e5eae982bca
b30131fae31bc54ea216ac50b69cb9a143adcd04
/tutorial_java_se/day21/Teacher.java
0556c085e282544501b41c476b17a7a05a698789
[]
no_license
ShengzhenFu/javase_tutorial
2b93815991481e9fcb2a89c8d92db78294625f6c
9698754f654e58e407c62c1d185ea1195bc6cb91
refs/heads/master
2020-05-20T20:57:54.931029
2019-10-07T13:44:22
2019-10-07T13:44:22
185,752,566
0
0
null
null
null
null
UTF-8
Java
false
false
732
java
package day21; import java.io.Serializable; public class Teacher implements Serializable { private String name; private int age; private String school; public Teacher(String name, int age, String school) { super(); this.name = name; this.age = age; this.school = school; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public String getSchool() { return school; } public void setSchool(String school) { this.school = school; } @Override public String toString() { return "Teacher [name=" + name + ", age=" + age + ", school=" + school + "]"; } }
59d855eb18eb937feceddfe5bed3fcbcef9fd4b2
cd07a51e863627dcb5106f1669d8ee34931dfa83
/src/main/java/crw/bishe/teamup01/controller/UnitInfoController.java
ddeaa21aecd8ac7245878dfc2aa83de69bf7cff6
[]
no_license
hellocrw/teamup-01
3035163ee059c8713789593543031ab98071f469
8e1720cb87708452192bac0e4b26e612e940630b
refs/heads/master
2023-03-09T21:44:10.757818
2019-12-19T10:08:10
2019-12-19T10:08:10
228,576,516
0
0
null
null
null
null
UTF-8
Java
false
false
156
java
package crw.bishe.teamup01.controller; import org.springframework.web.bind.annotation.RestController; @RestController public class UnitInfoController { }
addc7ba31c234e221d51964905a2eb0d40ef6b4f
e8fbca7a6851b82c9ae3f805234c840e11f7c261
/modules/asc/src/java/macromedia/asc/util/NamespacesTable.java
c5793dfbdff6ff49bf369c65417f46f22e96ecc4
[ "LicenseRef-scancode-proprietary-license", "Apache-2.0", "MPL-1.1", "MPL-1.0", "BSD-3-Clause" ]
permissive
teramura/flex-sdk
6772f7c729bb5fde5a080f5bed4df53280043024
c281c4f248f9adc8f10910be5e070149477d9216
refs/heads/develop
2023-05-13T21:26:18.785749
2023-04-28T15:10:59
2023-04-28T15:10:59
91,769,399
0
0
Apache-2.0
2018-06-27T10:44:03
2017-05-19T05:38:06
ActionScript
UTF-8
Java
false
false
1,589
java
/* * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package macromedia.asc.util; import java.util.HashMap; import macromedia.asc.semantics.ObjectValue; public class NamespacesTable extends HashMap<Namespaces,Namespaces> { private ObjectList<ObjectValue> list = new ObjectList<ObjectValue>(1); public NamespacesTable() { list.add(null); } /** * fast intern lookup of one namespace * @param ns * @return */ public Namespaces intern(ObjectValue ns) { list.set(0, ns); Namespaces n = this.get(list); if(n == null) { n = new Namespaces(ns); put(n,n); } return n; } /** * fast intern lookup of one namespace * @param ns * @return */ public Namespaces intern(Namespaces ns) { Namespaces n = get(ns); if(n == null) { put(ns,ns); n = ns; } return n; } }
0dd74c7a5029a34b61187c70c211a7d126a2d77b
dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9
/data_defect4j/preprossed_method_corpus/Math/25/org/apache/commons/math3/optimization/linear/SimplexSolver_solvePhase1_199.java
3f618c9e91dc441f338293e72e9ed9ce812bc31a
[]
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,075
java
org apach common math3 optim linear solv linear problem phase simplex method version simplex solver simplexsolv abstract linear optim abstractlinearoptim solv phase simplex method param tableau simpl tableau problem max count exceed except maxcountexceededexcept maxim iter count exceed unbound solut except unboundedsolutionexcept model found bound solut feasibl solut except nofeasiblesolutionexcept feasibl solut solv phase1 solvephase1 simplex tableau simplextableau tableau max count exceed except maxcountexceededexcept unbound solut except unboundedsolutionexcept feasibl solut except nofeasiblesolutionexcept make phase tableau num artifici variabl getnumartificialvari tableau optim isoptim iter doiter tableau feasibl solut precis equal tableau entri getentri tableau rh offset getrhsoffset epsilon feasibl solut except nofeasiblesolutionexcept
c47b84aa5137d0e64d9000443e01b23539b0822c
ecc9587bdad023e6b2843ed82fd7f9937b9756ff
/app/src/main/java/com/youthlive/youthlive/CameraActivity.java
852c13897eac5628a0b10b830d0b726f99ebcf66
[]
no_license
mukulraw/youthlive
5636da7d3dcbc7973315ddfd99acbbd5946a379a
9393d2f4f55c1267bcee58ece1e7ceefbb766ef3
refs/heads/master
2021-08-08T22:29:46.568934
2017-11-11T12:48:04
2017-11-11T12:48:04
109,986,134
0
0
null
null
null
null
UTF-8
Java
false
false
3,683
java
package com.youthlive.youthlive; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.SurfaceView; import com.bambuser.broadcaster.BroadcastStatus; import com.bambuser.broadcaster.Broadcaster; import com.bambuser.broadcaster.CameraError; import com.bambuser.broadcaster.ConnectionError; import android.view.View; import android.view.WindowManager; import android.widget.Button; public class CameraActivity extends AppCompatActivity { Broadcaster mBroadcaster; SurfaceView mPreviewSurface; private static final String APPLICATION_ID = "9Nl68X4uVmi5mu5REY3SxA"; Button mBroadcastButton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_camera); mPreviewSurface = (SurfaceView) findViewById(R.id.PreviewSurfaceView); mBroadcaster = new Broadcaster(this, APPLICATION_ID, mBroadcasterObserver); mBroadcaster.setRotation(getWindowManager().getDefaultDisplay().getRotation()); mBroadcaster.setTitle("Test broadcast #testing"); mBroadcaster.setAuthor("John Smith"); mBroadcaster.setSendPosition(true); mBroadcaster.setCustomData("any custom metadata you want to attach and parse later"); mBroadcaster.setSaveOnServer(false); mBroadcastButton = (Button)findViewById(R.id.BroadcastButton); mBroadcastButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mBroadcaster.canStartBroadcasting()) mBroadcaster.startBroadcast(); else mBroadcaster.stopBroadcast(); } }); } private Broadcaster.Observer mBroadcasterObserver = new Broadcaster.Observer() { @Override public void onConnectionStatusChange(BroadcastStatus broadcastStatus) { if (broadcastStatus == BroadcastStatus.STARTING) getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); if (broadcastStatus == BroadcastStatus.IDLE) getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); mBroadcastButton.setText(broadcastStatus == BroadcastStatus.IDLE ? "Broadcast" : "Disconnect"); Log.i("Mybroadcastingapp", "Received status change: " + broadcastStatus); } @Override public void onStreamHealthUpdate(int i) { } @Override public void onConnectionError(ConnectionError connectionError, String s) { Log.w("Mybroadcastingapp", "Received connection error: " + connectionError + ", " + s); } @Override public void onCameraError(CameraError cameraError) { } @Override public void onChatMessage(String s) { } @Override public void onResolutionsScanned() { } @Override public void onCameraPreviewStateChanged() { } @Override public void onBroadcastInfoAvailable(String s, String s1) { } @Override public void onBroadcastIdAvailable(String s) { } }; @Override public void onDestroy() { super.onDestroy(); mBroadcaster.onActivityDestroy(); } @Override public void onPause() { super.onPause(); mBroadcaster.onActivityPause(); } @Override public void onResume() { super.onResume(); mBroadcaster.setCameraSurface(mPreviewSurface); mBroadcaster.onActivityResume(); } }