blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
ea847ec9745c9287c84404bd624c6cdff726c921
24840424e6e62a781e3da578beaa5ec37fc63d56
/pointscard/src/products/model/ProductService.java
dfba15b02bc6f05200cff6029fba8ef0a2eb4793
[]
no_license
sparrow1002/HappyGo
cb16c5662466364a584fe83a837610187709032e
690681c9c08e7ab17331b35e31488a647569b5d8
refs/heads/master
2021-01-21T13:15:05.143219
2016-05-01T12:28:24
2016-05-01T12:28:24
55,118,734
0
1
null
null
null
null
UTF-8
Java
false
false
67
java
package products.model; public class ProductService { }
[ "tc101fubonzack@gmail.com" ]
tc101fubonzack@gmail.com
4d80684b9fc5c4ad05e6721a715582fbcbe131c7
40240a672f5c2454e6ed354eba9fdb897aa1b101
/jy-admin-biz/src/main/java/org/loxf/jyadmin/biz/util/TencentVideoV2.java
87f6ccc21bfdaa150752615315299dc3e25b7acf
[]
no_license
loxf/jyadmin
805a79120e985cacd01fb52fadea09638f6fffc0
cd1533de81666dc42e0d449b1e9f3e7bad3f2550
refs/heads/master
2018-09-28T01:27:34.620200
2018-02-26T14:30:49
2018-02-26T14:30:49
117,438,370
0
0
null
2018-02-26T14:30:50
2018-01-14T14:41:37
Java
UTF-8
Java
false
false
7,513
java
package org.loxf.jyadmin.biz.util; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import org.apache.commons.lang3.StringUtils; import org.loxf.jyadmin.base.constant.BaseConstant; import org.loxf.jyadmin.base.exception.BizException; import org.loxf.jyadmin.base.util.HttpsUtil; import org.loxf.jyadmin.base.util.encryption.Base64Util; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.util.HashMap; import java.util.Random; public class TencentVideoV2 { private static Logger logger = LoggerFactory.getLogger(TencentVideoV2.class); private static final String HMAC_ALGORITHM = "HmacSHA1"; private static String cloudApiUrl = "https://vod.api.qcloud.com/v2/index.php"; private static String URL_PATH = "vod.api.qcloud.com/v2/index.php"; public static int SUCCESS = 0; private static String DeleteVodFile = "DeleteVodFile"; private static String ModifyVodInfo = "ModifyVodInfo"; public static JSONObject delVideo(String fileId){ HashMap params = getCommonParam("DeleteVodFile", "gz"); params.put("fileId", fileId); params.put("priority", 0); params.put("isFlushCdn", 1); return dealGetUrl(params); } public static JSONObject modifyVideoInfo(String fileId, String fileName){ HashMap params = getCommonParam("ModifyVodInfo", "gz"); params.put("fileId", fileId); params.put("fileName", fileName); return dealGetUrl(params); } /** * @param fileId * @param infoFilters 备选项:basicInfo(基础信息)、元信息(metaData)、加密信息(drm)、transcodeInfo(转码结果信息)、imageSpriteInfo(雪碧图信息)、snapshotByTimeOffsetInfo(指定时间点截图信息)、sampleSnapshotInfo(采样截图信息)。 * @return */ public static JSONObject queryVideoInfo(String fileId, String[] infoFilters){ HashMap params = getCommonParam("GetVideoInfo", "gz"); params.put("fileId", fileId); if(infoFilters!=null&&infoFilters.length>0) { for(int i=0; i<infoFilters.length; i++) { params.put("infoFilter."+i, infoFilters[i]); } } return dealGetUrl(params); } private static JSONObject dealGetUrl(HashMap params){ try { String reqUrl = cloudApiUrl ; reqUrl += "?" + generateSign(params, "GET", true); String result = HttpsUtil.doHttpsGet(reqUrl, null, null); logger.info("腾讯云视频请求链接:{}, 返回结果:{}", reqUrl, result); JSONObject jsonObject = JSON.parseObject(result); return jsonObject; } catch (Exception e) { logger.error("腾讯云视频处理失败", e); throw new BizException("腾讯云视频处理失败", e); } } public static String getSecretId(){ return ConfigUtil.getConfig(BaseConstant.CONFIG_TYPE_RUNTIME, "TC_VIDEO_SECRET_ID").getConfigValue(); } public static String getSecretKey(){ return ConfigUtil.getConfig(BaseConstant.CONFIG_TYPE_RUNTIME, "TC_VIDEO_SECRET_KEY").getConfigValue(); } public static String getUploadSign(String contextStr) throws InvalidKeyException, UnsupportedEncodingException, NoSuchAlgorithmException { Mac mac = Mac.getInstance(HMAC_ALGORITHM); SecretKeySpec secretKeySpec = new SecretKeySpec(TencentVideoV2.getSecretKey().getBytes("UTF-8"), mac.getAlgorithm()); mac.init(secretKeySpec); byte[] hash = mac.doFinal(contextStr.getBytes("UTF-8")); byte[] sigBuf = byteMerger(hash, contextStr.getBytes("utf8")); String strSign = Base64Util.encode(sigBuf); // strSign = strSign.replace(" ", "").replace("\n", "").replace("\r", ""); return strSign; } public static String getSign(String contextStr) throws InvalidKeyException, UnsupportedEncodingException, NoSuchAlgorithmException { Mac mac = Mac.getInstance(HMAC_ALGORITHM); SecretKeySpec secretKeySpec = new SecretKeySpec(TencentVideoV2.getSecretKey().getBytes("UTF-8"), mac.getAlgorithm()); mac.init(secretKeySpec); byte[] hash = mac.doFinal(contextStr.getBytes("UTF-8")); String strSign = Base64Util.encode(hash); return strSign; } /** * 构造云视频Sign * * @param params 参数 * @param method POST/GET * @param needParams 是否需要其他参数拼接? true:需要 false:只要签名 * @return string * @throws Exception */ public static String generateSign(HashMap<Object, Object> params, String method, boolean needParams) throws Exception { Object[] array = params.keySet().toArray(); java.util.Arrays.sort(array);// 字典序 String keyStr = ""; String keyStrEncode = ""; for (int i = 0; i < array.length; i++) { String key = array[i].toString(); String value = String.valueOf(params.get(key));// 1、“参数值” 为原始值而非url编码后的值。 key = key.replaceAll("_", ".");// 2、若输入参数的Key中包含下划线,则需要将其转换为“.” // 然后将格式化后的各个参数用"&"拼接在一起 if(StringUtils.isNotBlank(keyStr)){ keyStr += "&" + key + "=" + value; keyStrEncode += "&" + key + "=" + URLEncoder.encode(value, "utf-8"); } else { keyStr += key + "=" + value; keyStrEncode += "&" + key + "=" + URLEncoder.encode(value, "utf-8"); } } /*签名原文串的拼接规则为: 请求方法 + 请求主机 +请求路径 + ? + 请求字符串*/ String origin = method + URL_PATH + "?" + keyStr; String sign = getSign(origin); if(!needParams) { return sign; } else { // 生成的签名串并不能直接作为请求参数,需要对其进行 URL 编码。 // 如果用户的请求方法是GET,则对所有请求参数的参数值均需要做URL编码;此外,部分语言库会自动对URL进行编码,重复编码会导致签名校验失败。 return keyStrEncode + "&Signature=" + URLEncoder.encode(sign, "utf-8"); } } /** * 构造云视频Sign * * @return string * @throws Exception */ public static String generateSign(HashMap<Object, Object> params) throws Exception { return generateSign(params, "GET", false); } private static HashMap getCommonParam(String action, String region){ HashMap params = new HashMap(); params.put("Action", action); params.put("Region", region); params.put("SecretId", getSecretId()); params.put("Timestamp", System.currentTimeMillis()/1000); params.put("Nonce", new Random().nextInt(java.lang.Integer.MAX_VALUE)); return params; } static byte[] byteMerger(byte[] byte1, byte[] byte2) { byte[] byte3 = new byte[byte1.length + byte2.length]; System.arraycopy(byte1, 0, byte3, 0, byte1.length); System.arraycopy(byte2, 0, byte3, byte1.length, byte2.length); return byte3; } }
[ "myself35335@163.com" ]
myself35335@163.com
5ac2a6d1916938f22706aeaea6abded475091020
3e3425141a64fa77d908b8916aa0a7e655a104e9
/src/main/java/com/web/sales/services/PurchaseOrderService.java
c7ffba890fa82ae86048b7209bb26a638e58148c
[]
no_license
shizuka0723/Spring_0117_Case
0dd01576b125e1690e6c9c3766cc6c949754a18d
c7c9bdc9153f95b7dfd7552114f76869f94e6238
refs/heads/master
2022-12-20T20:00:11.217973
2020-03-09T13:39:28
2020-03-09T13:39:28
242,124,318
0
0
null
2022-12-16T10:02:33
2020-02-21T11:31:59
Java
UTF-8
Java
false
false
1,043
java
package com.web.sales.services; import com.web.sales.dao.PurchaseOrderRepository; import com.web.sales.models.PurchaseOrder; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class PurchaseOrderService { @Autowired private PurchaseOrderRepository dao; public void add(PurchaseOrder entity){ dao.save(entity); } public PurchaseOrder get(Integer id){ return dao.findById(id).get(); } public boolean exisit(Integer id){ return dao.existsById(id); } public List<PurchaseOrder> query(){ List<PurchaseOrder> list = new ArrayList<>(); dao.findAll().forEach(data -> list.add(data)); return list; } public void delete(Integer id){ dao.deleteById(id); } public void update(PurchaseOrder entity){ dao.update(entity); } }
[ "student@192.168.1.116" ]
student@192.168.1.116
84b0a12884bfd70ae9cd4f13082f0555680593c6
fd5bfa0ab2e612510e3081c2a8dc23c84a7f352f
/src/main/java/com/patterns/timer/SimpleProgramaticTimer4.java
1bd12c2e78e604b3663d3a19ee46fbfaf2ab666b
[]
no_license
PavelTsekhanovich/DesignPatterns
9919a326edae630d5d00d0da9136df09864fd8a2
2aa163cb70fe457b6cc2632c147303f11b4404ec
refs/heads/master
2021-08-09T00:19:13.512266
2017-11-11T17:49:08
2017-11-11T17:49:08
109,133,148
0
0
null
null
null
null
UTF-8
Java
false
false
750
java
package com.patterns.timer; import javax.annotation.Resource; import javax.ejb.ScheduleExpression; import javax.ejb.Timeout; import javax.ejb.Timer; import javax.ejb.TimerService; import javax.ejb.TransactionAttribute; import javax.ejb.TransactionAttributeType; public class SimpleProgramaticTimer4 { @Resource TimerService timerService; public void setTimer() { ScheduleExpression expression = new ScheduleExpression(); expression.second("*/10").minute("*").hour("*"); Timer timer = timerService.createCalendarTimer(new ScheduleExpression() .second("*/10").minute("*").hour("*")); } @Timeout @TransactionAttribute(TransactionAttributeType.REQUIRED) public void performTask() { System.out.println("Simple Task performed"); } }
[ "p.tsekhanovich93@gmail.com" ]
p.tsekhanovich93@gmail.com
2cd0630e28ed38963180be82b11c6085053a1d52
1a7ce58fb736ce8c656cba4d68c76480e737341f
/src/main/java/eu/linkedtv/keywords/v1/indexers/DutchKeywordsIndexer.java
1cf609163d25bb9eeef000bd6fdb1f199bf84bcb
[ "Apache-2.0" ]
permissive
KIZI/KeywordExtraction
a3ff796f4ae1e6752051685316859bf0d30671de
148755fc2f598ce88c5c8c9a2a558b756b0b9a1e
refs/heads/master
2016-09-06T09:57:18.720684
2015-11-13T23:06:42
2015-11-13T23:06:42
21,124,309
0
0
null
null
null
null
UTF-8
Java
false
false
3,081
java
package eu.linkedtv.keywords.v1.indexers; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; import eu.linkedtv.keywords.v1.dao.DaoException; import eu.linkedtv.keywords.v1.dao.KeywordsDao; import eu.linkedtv.keywords.v1.dao.KeywordsOccurrencesDao; import eu.linkedtv.keywords.v1.models.DutchKeyword; import eu.linkedtv.keywords.v1.models.DutchKeywordsOccurrence; import eu.linkedtv.keywords.v1.models.DutchTextFile; @Component public class DutchKeywordsIndexer extends KeywordsIndexer<DutchTextFile> { @Autowired @Qualifier("dutchKeywordsDao") protected KeywordsDao<DutchKeyword> keywordsDao; @Autowired @Qualifier("dutchKeywordsOccurrencesDao") protected KeywordsOccurrencesDao<DutchKeywordsOccurrence, DutchKeyword, DutchTextFile> keywordsOccurrencesDao; private static final Set<String> DUTCH_ARTICLES; static { DUTCH_ARTICLES = new HashSet<String>(); DUTCH_ARTICLES.add("de"); DUTCH_ARTICLES.add("het"); DUTCH_ARTICLES.add("een"); } @Override public void indexTextFile(DutchTextFile textFile, String text) throws IndexingException { String[] words = splitPat.split(text); Map<String, Integer> wordOccurrences = new HashMap<String, Integer>(); boolean prevArticle = false; for (String word : words) { word = word.trim(); if ((!isStopWord(word)) && (!word.equals("sil")) && (word.length() > 0)) { if (prevArticle) { Integer wordCount = wordOccurrences.get(word); if (wordCount == null) { wordOccurrences.put(word, 1); } else { wordOccurrences.put(word, wordCount + 1); } } } if (DUTCH_ARTICLES.contains(word.toLowerCase())) prevArticle = true; else prevArticle = false; } for (Entry<String, Integer> entry : wordOccurrences.entrySet()) { try { DutchKeyword keyword = keywordsDao.getKeyword(entry.getKey()); logger.info("Setting Occurrence Count " + keyword.getWord() + ", " + textFile.getName() + ", " + entry.getValue()); keywordsOccurrencesDao.setOccurrenceCount(keyword, textFile, entry.getValue()); } catch (DaoException e) { throw new IndexingException("Unable to index keyword " + entry.getKey(), e); } } keywordsDao.updateIdf(); keywordsOccurrencesDao.updateTf(); logger.info("File " + textFile.getName() + " indexed"); } public int updateIdf() { return keywordsDao.updateIdf(); } }
[ "prozeman@gmail.com" ]
prozeman@gmail.com
86098193d2df657b0115b6cca8f30650ca2cda9c
2dab71c9c1d814dc751ca0c150b366439872f1e5
/src/main/java/com/pulkit/datastructures_algorithms/done/arrays/MergeIntervals.java
2c486c7c49a8171db3359d32d57b5fb44d3b0541
[]
no_license
pulkitent/data-structures-algorithms-design-patterns
e2327d04d32ed9304e34e60f2bf6b60b3df0226f
d59dcd3cac159a7f13fabe1d4fa67b2cfabf6831
refs/heads/master
2021-06-24T17:33:17.423307
2021-04-05T08:26:17
2021-04-05T08:26:17
219,177,463
0
0
null
null
null
null
UTF-8
Java
false
false
2,699
java
package com.pulkit.datastructures_algorithms.done.arrays; import java.util.*; import static java.lang.System.out; public class MergeIntervals { public static void main(String[] args) { Interval interval1 = new Interval(1, 5); List<Interval> intervals = Arrays.asList(interval1, new Interval(3, 7), new Interval(4, 6), new Interval(6, 8)); //Another Test case //Interval interval1 = new Interval(1, 5); //List<Interval> intervals = Arrays.asList(interval1, new Interval(3, 7), new Interval(6, 8), // new Interval(10, 12), new Interval(11, 15)); //Another Test case //Interval interval1 = new Interval(2, 10); //Interval interval2 = new Interval(4, 12); //Interval interval3 = new Interval(13, 16); //Interval interval4 = new Interval(19, 20); //Interval pair5 = new Interval(20, 24); //List<Interval> intervals = Arrays.asList(interval1, interval2, interval3, interval4, pair5); //Another Test case //Interval interval1 = new Interval(1, 10); //Interval interval2 = new Interval(2, 9); //Interval interval3 = new Interval(3, 8); //Interval interval4 = new Interval(4, 7); //Interval interval5 = new Interval(5, 6); //Interval interval6 = new Interval(6, 6); //List<Interval> intervals = Arrays.asList(interval1, interval2, interval3, interval4, interval5, interval6); intervals.sort(new IntervalComparator()); ArrayList mergedList = new ArrayList(); int mergedIntervalStart = interval1.start; int mergedIntervalEnd = interval1.end; for (Interval interval : intervals) { if (mergedIntervalEnd >= interval.start) { if (mergedIntervalEnd < interval.end) { mergedIntervalEnd = interval.end; } } else { mergedList.add(new Interval(mergedIntervalStart, mergedIntervalEnd)); mergedIntervalStart = interval.start; mergedIntervalEnd = interval.end; } } mergedList.add(new Interval(mergedIntervalStart, mergedIntervalEnd)); mergedList.forEach(out::println); } } class Interval { int start; int end; Interval(int start, int end) { this.start = start; this.end = end; } @Override public String toString() { return start + " " + end; } } class IntervalComparator implements Comparator<Interval> { @Override public int compare(Interval o1, Interval o2) { if (o1.start > o2.start) { return 1; } return -1; } }
[ "pulkit.gupta@thoughtworks.com" ]
pulkit.gupta@thoughtworks.com
be14571c500da58654984c75bbc40588109570cf
e796ae92a3266bd80bbab6c49f53d5de2a2106a6
/springBootLearn/spring-boot/src/main/java/com/le/springboot/Application.java
2faece2349a5a0c741cc8609f4ba225fae3deb3a
[]
no_license
ljyyt/test
b404c6eb87b5c07d4f7a0e299cff005bc5957527
7a4c3beb5d9e0c690538ad8838b9607c2dc0baba
refs/heads/master
2022-11-26T06:03:00.834420
2020-07-20T03:31:04
2020-07-20T03:31:04
280,904,533
0
0
null
null
null
null
UTF-8
Java
false
false
426
java
package com.le.springboot; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ImportResource; //@ImportResource(locations = {"classpath:bean.xml"}) @SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
[ "2556369780@qq.com" ]
2556369780@qq.com
6a81ba2bdfc6be677711d31ee04246bf7e828afc
ee17edc7902291e44caf3ddbba86d209e3409681
/src/blur-mapred/src/main/java/com/nearinfinity/blur/mapreduce/lib/Utils.java
daf7d993cc905ec830bd61ed6a62f448e9a9c70b
[]
no_license
gaogen123/blur
1daf78a1b3545f5302ab08c47eb8c96f72f77469
6c6a2723a56172cc731b648c051c80e8f374e0db
refs/heads/master
2022-12-28T03:44:32.399530
2012-09-20T14:36:36
2012-09-20T14:36:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,486
java
package com.nearinfinity.blur.mapreduce.lib; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.List; import org.apache.hadoop.conf.Configuration; import org.apache.lucene.index.CorruptIndexException; import org.apache.lucene.index.IndexCommit; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.SegmentInfo; import org.apache.lucene.index.SegmentInfos; import org.apache.lucene.index.SegmentReader; import org.apache.lucene.store.Directory; public class Utils { // public static void main(String[] args) throws IOException { // Directory dir = FSDirectory.open(new File("/tmp/small-multi-seg-index")); // IndexCommit commit = findLatest(dir); // List<String> segments = getSegments(dir,commit); // for (String segment : segments) { // IndexReader reader = openSegmentReader(dir, commit, segment, 128); // System.out.println(segment + "=" + reader.numDocs()); // reader.close(); // } // } public static int getTermInfosIndexDivisor(Configuration conf) { return 128; } public static IndexCommit findLatest(Directory dir) throws IOException { Collection<IndexCommit> listCommits = IndexReader.listCommits(dir); if (listCommits.size() == 1) { return listCommits.iterator().next(); } throw new RuntimeException("Multiple commit points not supported yet."); } public static List<String> getSegments(Directory dir, IndexCommit commit) throws CorruptIndexException, IOException { SegmentInfos infos = new SegmentInfos(); infos.read(dir, commit.getSegmentsFileName()); List<String> result = new ArrayList<String>(); for (SegmentInfo info : infos) { result.add(info.name); } return result; } public static IndexReader openSegmentReader(Directory directory, IndexCommit commit, String segmentName, int termInfosIndexDivisor) throws CorruptIndexException, IOException { SegmentInfos infos = new SegmentInfos(); infos.read(directory, commit.getSegmentsFileName()); SegmentInfo segmentInfo = null; for (SegmentInfo info : infos) { if (segmentName.equals(info.name)) { segmentInfo = info; break; } } if (segmentInfo == null) { throw new RuntimeException("SegmentInfo for [" + segmentName + "] not found in directory [" + directory + "] for commit [" + commit + "]"); } return SegmentReader.get(true, segmentInfo, termInfosIndexDivisor); } }
[ "amccurry@gmail.com" ]
amccurry@gmail.com
d34297dcd2fe03f383025d27ca4c750592f367c6
781a8f556f39bba0d5e58ec64f6add3565699d8b
/src/devdojo/maratonajava/javacore/o/exception/error/test/StackOverflow.java
24b02c89d8b57d6453f56b77aaf324be3506a85e
[]
no_license
arnonrdp/Curso-Java
7f62dbaf85fb79cba45fa17d817d50c4f95a17b3
8b0cfff4a8db8ba8504d844e901a58b5739e5b5c
refs/heads/main
2023-08-29T22:43:20.328842
2021-11-07T19:51:00
2021-11-07T19:51:00
409,269,613
0
0
null
null
null
null
UTF-8
Java
false
false
243
java
package devdojo.maratonajava.javacore.o.exception.error.test; public class StackOverflow { public static void main(String[] args) { recursividade(); } public static void recursividade() { recursividade(); } }
[ "arnonrdp@gmail.com" ]
arnonrdp@gmail.com
335247ff95de30e0c52f48b52f02ffb0d601cd87
76850bd6354b67085d4b57cc55b4851cda00afb8
/app/src/androidTest/java/com/raid/jordi/raidfinder/ExampleInstrumentedTest.java
87729bd327266fce154e14f5ad37273a4d9f0f4e
[]
no_license
quaantax/raidFinder
54c36d4607aba1aef4fac8208ab1210f720bd1dc
853fc005d24e5152006391897ad74ae3ba4ef76a
refs/heads/master
2021-04-06T08:58:48.416132
2018-06-07T20:46:43
2018-06-07T20:46:43
124,519,626
0
0
null
null
null
null
UTF-8
Java
false
false
751
java
package com.raid.jordi.raidfinder; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.raid.jordi.raidfinder", appContext.getPackageName()); } }
[ "jordijedi@gmail.com" ]
jordijedi@gmail.com
27ad989572208f08132e438be184be3ccfda690e
a947a21357b7b4712cc2b1e828e57dc7fc959f81
/src/main/java/demo/bedoreH/demo0919/demo11.java
8bf72e87767d91061cf07cb99b255f06db0dd690
[]
no_license
zzw-echo/DailyLearning
c103f0a2d43148a89fc6a36a4904cb89a33bca8c
50f2a72aafe929cfe41558ac0dad8c665dd665ec
refs/heads/master
2021-12-27T09:03:59.418919
2021-09-12T09:11:03
2021-09-12T09:11:03
243,429,154
0
0
null
2020-10-14T00:06:07
2020-02-27T04:19:11
Java
UTF-8
Java
false
false
149
java
package demo.bedoreH.demo0919; /** * 作者 : 张泽文 * 邮箱 : zzw.me@qq.com * 时间 : 2020/9/21 14:44 */ public class demo11 { }
[ "zzw.me@qq.com" ]
zzw.me@qq.com
829aaf9ac4e8a1ae409f977944992a21976d7878
c735871098ca6d17e90e349b5c70de390ebaebc9
/src/test/java/net/sagati/springboot/recipe/SpringBootRecipeApplicationTests.java
7f8d343afa34d59e7bf54e39c6cda2a2d9ed07fb
[ "Apache-2.0" ]
permissive
ecmpractitioner/spring-boot-recipe
97414ace94bd67d4a2feb5596fa41c3cef905c26
0dadbfe9e4c671df2b0f5b79050f07150363ace8
refs/heads/master
2021-03-20T09:09:54.947127
2020-03-14T02:57:20
2020-03-14T02:57:20
247,196,706
0
0
null
null
null
null
UTF-8
Java
false
false
239
java
package net.sagati.springboot.recipe; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class SpringBootRecipeApplicationTests { @Test void contextLoads() { } }
[ "manjum_kar@yahoo.co.in" ]
manjum_kar@yahoo.co.in
eeee51e6f1fc41ad905f070e94a10c8ff580341b
bf5cd2ad1edeb2daf92475d95a380ddc66899789
/springboot2/spring-security/src/main/java/com/microwu/cxd/controller/ValidateController.java
82dfc04784a9b693b233c02d902f01d18415fc61
[]
no_license
MarsGravitation/demo
4ca7cb8d8021bdc3924902946cc9bb533445a31e
53708b78dcf13367d20fd5c290cf446b02a73093
refs/heads/master
2022-11-27T10:17:18.130657
2022-04-26T08:02:59
2022-04-26T08:02:59
250,443,561
0
0
null
null
null
null
UTF-8
Java
false
false
1,910
java
package com.microwu.cxd.controller; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.Random; /** * Description: * * @Author: chengxudong chengxudong@microwu.com * Date: 2020/1/14 14:54 * Copyright: 北京小悟科技有限公司 http://www.microwu.com * Update History: * Author Time Content */ @RestController public class ValidateController { public static final Logger logger = LoggerFactory.getLogger(ValidateController.class); @Autowired private RedisTemplate redisTemplate; private String source = "23456789ABCDEFGHJKMNPQRSTUVWXYZ"; @GetMapping("/image") public void createImage(HttpServletRequest request, HttpServletResponse response) { String generate = generate(4, source); logger.info("图形验证码 {}", generate); redisTemplate.opsForValue().set("image", generate); } @GetMapping("/sms") public void createSms(String mobile) { String generate = generate(4, source); logger.info("短信验证码 {}", generate); redisTemplate.opsForValue().set("mobile", generate); } public static String generate(int verifySize, String sources) { int codesLen = sources.length(); Random rand = new Random(System.currentTimeMillis()); StringBuilder verifyCode = new StringBuilder(verifySize); for (int i = 0; i < verifySize; i++) { verifyCode.append(sources.charAt(rand.nextInt(codesLen - 1))); } return verifyCode.toString(); } }
[ "18435202728@163.com" ]
18435202728@163.com
15d930939eb56aa18d7b6e416cbf6993a38049a3
35445a940e619a24f06ed026c12de35616b9bdfa
/src/SBrokerWorker.java
31548cf10ff671e89e0973a35408fd95af6f7ba7
[]
no_license
ByeongUnSon/MessageBroker
adf49fcbb890a8a6214593e576193707af5178f2
377444e3e4a7b92412cf3ca68f3c6d36d84dc969
refs/heads/master
2020-06-08T11:52:17.810720
2012-12-20T04:49:51
2012-12-20T04:49:51
7,125,552
1
0
null
null
null
null
UTF-8
Java
false
false
779
java
package team.broker; import java.io.IOException; import lempel.blueprint.base.concurrent.JobQueue; import lempel.blueprint.base.concurrent.Worker; public class SBrokerWorker extends Worker<SBrokerSession> { public SBrokerWorker(final JobQueue<SBrokerSession> jobQueue) { super(jobQueue); } /* * Worker<SBrokerSession>의 추상클래스 * process(T clientObject) 메서드를 오버라이딩 한다. * 이 메서드는 WorkerGroup 클래스에서 * SBrokerSession클래스의 객체 client가 추가 되면 실행되는 메서드이다. */ @Override protected void process (final SBrokerSession client) { try { client.execute(); client.close(); } catch (IOException e) { e.printStackTrace(); } } }
[ "lcson@ink.co.kr" ]
lcson@ink.co.kr
1725114d92117ee50f4d08e08dfde7df94a0c53e
18b0556c2150fbd75d4dea2f0bb8d6fdf55108c3
/src/test/java/com/userregistration/EmailValidationSampleTest.java
71ccc4d22796d2b5f4374fa7ef05054726a5caa4
[]
no_license
vishal-patil01/UserRegistrationJUnit
ff056275a40f24100984220d6dc465073c945585
98adbf04bbdc37f92c51c42330a873d6dabc5b15
refs/heads/master
2021-01-05T16:02:48.812883
2020-02-18T13:50:36
2020-02-18T13:50:36
241,065,713
0
0
null
null
null
null
UTF-8
Java
false
false
1,846
java
package com.userregistration; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import java.util.Arrays; import java.util.Collection; @RunWith(Parameterized.class) public class EmailValidationSampleTest { private UserRegistration userRegistration; private String emailId; private boolean expectedResult; public EmailValidationSampleTest(String emailId,boolean expectedResult) { super(); this.emailId = emailId; this.expectedResult = expectedResult; } @Before public void initialize(){ userRegistration = new UserRegistration(); } @Parameterized.Parameters public static Collection data(){ return Arrays.asList(new Object[][] { {"abc@yahoo.com",true}, {"abc-100@yahoo.com",true}, {"abc.100@yahoo.com",true}, {"abc111@abc.com",true}, {"abc-100@abc.net",true}, {"abc.100@abc.com.au",true}, {"abc@1.com",true}, {"abc@gmail.com.com",true}, {"abc-gmail.com",false}, {"abc@.com.my",false}, {"abc123@gmail.a",false}, {"abc123@.com",false}, {"abc123@.com.com",false}, {".abc@abc.com",false}, {"abc()*@gmail.com",false}, {"abc@%*.com",false}, {"abc..2002@gmail.com",false}, {"abc.@gmail.com",false}, {"abc@abc@gmail.com",false}, {"abc@gmail.com.1a",false}, {"abc@gmail.com.aa.au",false}}); } @Test public void testUserEmailId() { Assert.assertEquals(expectedResult,userRegistration.validateEmailId(emailId)); } }
[ "vishalpatil01@hotmail.com" ]
vishalpatil01@hotmail.com
f1d5da5efd59da61fba960c5e5ce258522bfa0d2
8377007918087f9afafc7d6925699163a15c25ff
/src/neuralnet/NeuralNet.java
3e16fc4f41c9fa90aa85c00777b7f3e6a20a78c6
[]
no_license
yuannan/NeuralNetwork
794aa80ee19a8d8a4ff7b6ed4dd148054d15c9aa
ae67a751c0af86f215b9bd91a80782e8536b1bc7
refs/heads/master
2021-09-07T08:57:21.738771
2018-02-20T18:01:56
2018-02-20T18:01:56
111,728,094
0
0
null
null
null
null
UTF-8
Java
false
false
2,127
java
package neuralnet; /** * * @author blakk */ import java.util.Scanner; import java.util.ArrayList; public class NeuralNet { static String version = "1.0.0"; public Network net = new Network(2,3,1); public static void main(String[] args) { Interface face = new Interface(); face.setTitle("Neural Network 9001 V"+version); face.setVisible(true); //Scanner sc = new Scanner(System.in); //2:3:1 network for boolean logic //layer 0 inputs /* manual inputs int inputSize = 2; double[] inputLayer = new double[inputSize]; //input inputs for(int in = 0; in < inputSize; in++){ System.out.println("Input node "+in); inputLayer[in] = sc.nextDouble(); } */ //random network //custom network /*double[][] iwHidden = {{0,0,0},{0,0,0}}; //2x3 of 0 double[][] iwOutput = {{0},{0},{0}}; //3x1 of 0 Matrix hiddenWeightMatrix = new Matrix(iwHidden); Matrix outputWeightMatrix = new Matrix(iwOutput); Network net = new Network(hiddenWeightMatrix, outputWeightMatrix, 2,3,1); */ /* ### WORKING CLI NETWORK Network net = new Network(2,3,1); //training for an AND gate ArrayList<double[]> ANDin = new ArrayList(); ArrayList<Double> ANDout = new ArrayList(); for(int i = 0; i < 2; i++){ for(int j = 0; j < 2; j++){ double[] inputArray = {i,j}; double output = i & j; //System.out.println(output); ANDin.add(inputArray); ANDout.add(output); } } System.out.println("Turns:"); for(int turns = sc.nextInt();turns > 0; turns--){ if(ANDin.size() == ANDout.size()){ for (int set = 0; set < ANDin.size(); set ++){ net.train(ANDin.get(set),ANDout.get(set)); } } } */ } }
[ "yuannan@live.com" ]
yuannan@live.com
1f53434a8f53a0f7b8f402c85062375668dedd58
911c58f406af73d73e1a14ec974446cc27a80e0b
/src/bmi/view/BMIView.java
49e82c896817a56e5553ce5ec0081241799f8cd6
[]
no_license
maharjanabin/BMI-Analyzer-in-MVC-Pattern
12789ad31b02743fbcbbf9620f382154775f1404
e55a9b764fac29eaf177c3f3aba233517cbab719
refs/heads/master
2022-02-12T03:11:54.942550
2019-08-08T12:31:00
2019-08-08T12:31:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
23,452
java
package bmi.view; import bmi.controller.BMIController; import bmi.controller.IView; import bmi.model.BMIModel; import bmi.model.Update; import bmi.model.data.Record; import java.sql.SQLException; import java.util.Observable; import java.util.Observer; import java.util.concurrent.TimeUnit; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JOptionPane; public class BMIView extends javax.swing.JFrame implements IView, Observer { //attributes BMIModel m; BMIController c; String msg; Boolean flag = false; //creates new BMIView public BMIView(BMIModel m, BMIController c) { super("BMI Analyser"); initComponents(); disableNext(); disablePrevious(); setVisible(true); setSize(500,400); setResizable(false); this.c = c; m.addObserver(this); } //Observer interface implementation @Override public void update(Observable obs, Object obj){ Update update = (Update) obj; Record r = update.getRecord(); String msg = update.getMessage(); if(r == null){ nextButton.setEnabled(false); previousButton.setEnabled(false); subjectTextField.setText(""); heightTextField.setText(""); weightTextField.setText(""); bmiTextField.setText(""); categoryTextField.setText(""); messageTextArea.setText(" There are no records! \n Please try again!"); return; } subjectTextField.setText("" + r.getSubjectID()); heightTextField.setText("" + r.getHeight()); weightTextField.setText("" + r.getWeight()); bmiTextField.setText("" + r.getBmi()); categoryTextField.setText("" + r.getCategory()); messageTextArea.setText(msg); }//end of override method update /** * 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() { browseLabel = new javax.swing.JLabel(); subjectLabel = new javax.swing.JLabel(); heightLabel = new javax.swing.JLabel(); weightLabel = new javax.swing.JLabel(); bmiLabel = new javax.swing.JLabel(); categoryLabel = new javax.swing.JLabel(); subjectTextField = new javax.swing.JTextField(); heightTextField = new javax.swing.JTextField(); weightTextField = new javax.swing.JTextField(); bmiTextField = new javax.swing.JTextField(); categoryTextField = new javax.swing.JTextField(); messagesLabel = new javax.swing.JLabel(); nextButton = new javax.swing.JButton(); previousButton = new javax.swing.JButton(); clearButton = new javax.swing.JButton(); allRecordsButton = new javax.swing.JButton(); recordsInRangeButton = new javax.swing.JButton(); calculateButton = new javax.swing.JButton(); exitButton = new javax.swing.JButton(); lowerRangeTextField = new javax.swing.JTextField(); upperRangeTextField = new javax.swing.JTextField(); jScrollPane1 = new javax.swing.JScrollPane(); messageTextArea = new javax.swing.JTextArea(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); browseLabel.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N browseLabel.setText("Browse"); subjectLabel.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N subjectLabel.setText("Subject"); heightLabel.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N heightLabel.setText("Height (m)"); weightLabel.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N weightLabel.setText("Weight (kg)"); bmiLabel.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N bmiLabel.setText("BMI"); categoryLabel.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N categoryLabel.setText("Category"); messagesLabel.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N messagesLabel.setText("Messages"); nextButton.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N nextButton.setText("Next"); nextButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { nextButtonActionPerformed(evt); } }); previousButton.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N previousButton.setText("Previous"); previousButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { previousButtonActionPerformed(evt); } }); clearButton.setText("Clear"); clearButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { clearButtonActionPerformed(evt); } }); allRecordsButton.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N allRecordsButton.setText("All Records"); allRecordsButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { allRecordsButtonActionPerformed(evt); } }); recordsInRangeButton.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N recordsInRangeButton.setText("Records In Range"); recordsInRangeButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { recordsInRangeButtonActionPerformed(evt); } }); calculateButton.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N calculateButton.setText("Calculate BMI"); calculateButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { calculateButtonActionPerformed(evt); } }); exitButton.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N exitButton.setText("Exit"); exitButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { exitButtonActionPerformed(evt); } }); messageTextArea.setColumns(20); messageTextArea.setRows(5); jScrollPane1.setViewportView(messageTextArea); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(browseLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(messagesLabel) .addGap(80, 80, 80)) .addGroup(layout.createSequentialGroup() .addGap(10, 10, 10) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(previousButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(nextButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(clearButton)) .addGroup(layout.createSequentialGroup() .addComponent(calculateButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(exitButton)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(allRecordsButton) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(subjectLabel) .addComponent(heightLabel) .addComponent(weightLabel) .addComponent(bmiLabel) .addComponent(categoryLabel)) .addGap(31, 31, 31) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(categoryTextField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(subjectTextField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE) .addComponent(heightTextField, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(weightTextField, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(bmiTextField, javax.swing.GroupLayout.Alignment.LEADING))))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 52, Short.MAX_VALUE) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addComponent(recordsInRangeButton) .addGap(18, 18, 18) .addComponent(lowerRangeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(upperRangeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap()))) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(browseLabel) .addComponent(messagesLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(subjectLabel) .addComponent(subjectTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(heightLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(heightTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(weightLabel) .addComponent(weightTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(bmiLabel) .addComponent(bmiTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(categoryLabel) .addComponent(categoryTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addComponent(jScrollPane1)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(clearButton) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(previousButton) .addComponent(nextButton))) .addGap(37, 37, 37) .addComponent(allRecordsButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(recordsInRangeButton) .addComponent(lowerRangeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(upperRangeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(calculateButton) .addComponent(exitButton)) .addContainerGap(50, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void allRecordsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_allRecordsButtonActionPerformed c.browseAllRecords(); }//GEN-LAST:event_allRecordsButtonActionPerformed private void recordsInRangeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_recordsInRangeButtonActionPerformed int lower; int upper; //calling method to check the lower and upper bounds int check = validatingInputs(getLowerRangeTextField(), getUpperRangeTextField()); //switch case for different cases of inputs from user switch(check){ case 0: break; case 1: lower = 0; upper = Integer.parseInt(getUpperRangeTextField()); c.browseRecordsInRange(lower, upper); break; case 2: lower = Integer.parseInt(getLowerRangeTextField()); upper = lower; c.browseRecordsInRange(lower, upper); break; case 3: lower = Integer.parseInt(getLowerRangeTextField()); upper = Integer.parseInt(getUpperRangeTextField()); c.browseRecordsInRange(lower, upper); break; } }//GEN-LAST:event_recordsInRangeButtonActionPerformed private void calculateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_calculateButtonActionPerformed try { c.updateAllRecords(); } catch (SQLException ex) { Logger.getLogger(BMIView.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_calculateButtonActionPerformed private void nextButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nextButtonActionPerformed c.nextRecord(); }//GEN-LAST:event_nextButtonActionPerformed private void previousButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_previousButtonActionPerformed c.previousRecord(); }//GEN-LAST:event_previousButtonActionPerformed private void exitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitButtonActionPerformed try { c.closeConnection(); } catch (SQLException ex) { Logger.getLogger(BMIView.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_exitButtonActionPerformed private void clearButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearButtonActionPerformed nextButton.setEnabled(false); previousButton.setEnabled(false); subjectTextField.setText(""); heightTextField.setText(""); weightTextField.setText(""); bmiTextField.setText(""); categoryTextField.setText(""); messageTextArea.setText(""); }//GEN-LAST:event_clearButtonActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton allRecordsButton; private javax.swing.JLabel bmiLabel; private javax.swing.JTextField bmiTextField; private javax.swing.JLabel browseLabel; private javax.swing.JButton calculateButton; private javax.swing.JLabel categoryLabel; private javax.swing.JTextField categoryTextField; private javax.swing.JButton clearButton; private javax.swing.JButton exitButton; private javax.swing.JLabel heightLabel; private javax.swing.JTextField heightTextField; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTextField lowerRangeTextField; private javax.swing.JTextArea messageTextArea; private javax.swing.JLabel messagesLabel; private javax.swing.JButton nextButton; private javax.swing.JButton previousButton; private javax.swing.JButton recordsInRangeButton; private javax.swing.JLabel subjectLabel; private javax.swing.JTextField subjectTextField; private javax.swing.JTextField upperRangeTextField; private javax.swing.JLabel weightLabel; private javax.swing.JTextField weightTextField; // End of variables declaration//GEN-END:variables //method to display message if there are no records //within the range of bmi the user input @Override public void display(String s){ this.msg = s; clear(); messageTextArea.setText(msg); }//end of override method display //method to browse the records //by enabling next and previous button @Override public void browsing(boolean flag){ if(flag==true){ enableNext(); enablePrevious(); } }// end of override method browsing //methods for enabling and disabling Next and Previous Buttons public void enableNext(){ nextButton.setEnabled(true); } public void disableNext(){ nextButton.setEnabled(false); } public void enablePrevious(){ previousButton.setEnabled(true); } public void disablePrevious(){ previousButton.setEnabled(false); } //getter for upper bound and lower bound of BMI public String getLowerRangeTextField() { return lowerRangeTextField.getText(); } public String getUpperRangeTextField() { return upperRangeTextField.getText(); } public void clear(){ nextButton.setEnabled(false); previousButton.setEnabled(false); subjectTextField.setText(""); heightTextField.setText(""); weightTextField.setText(""); bmiTextField.setText(""); categoryTextField.setText(""); messageTextArea.setText(""); }// end of method clear public void showMessageDialog(String s1, String s2){ JOptionPane.showMessageDialog(this, s1, s2, JOptionPane.PLAIN_MESSAGE); }//end of method showMessageDialog //method for validating the inputs for getting the records in range //return 0 means break //return 1 means there is no input in lower bound of bmi //return 2 means there is no input in upper bound of bmi //return 3 means the given inputs for range of bmi is ok public int validatingInputs(String lower, String upper){ String lowerbound = lower; String upperbound = upper; if(("".equals(lowerbound)) && ("".equals(upperbound))){ clear(); messageTextArea.setText("Please Enter the inputs for range of bmi"); return 0; } else if(lowerbound.equals("")){ lower=null; return 1; } else if(upperbound.equals("")){ upper = lower; return 2; } else if(Integer.parseInt(lowerbound)>Integer.parseInt(upperbound)){ clear(); messageTextArea.setText(" Please enter lower bound of bmi \n smaller than the upper bound \n of bmi"); return 0; } else{ return 3; } }//end of method validatingInputs }
[ "maharjanabin40@gmail.com" ]
maharjanabin40@gmail.com
d7b4083ea58f93f96fb5603d7317eabfde4aa423
cce9e1a7f25d15f47a1acaff22d967f7110f5172
/src/main/java/com/ceamback/project/goods/service/impl/BrandServiceImpl.java
b20fd0e32c7ae08a58d061224f1d11ed4bb4921a
[]
no_license
CeaMYHBK/hous
aabc4f42a2d978ce2511009a1098afbacc4b16de
814366033d8d265600b118b2a5ec7231a1bafc9d
refs/heads/master
2023-03-03T07:01:08.405232
2021-01-25T02:25:51
2021-01-25T02:25:51
332,355,562
0
0
null
null
null
null
UTF-8
Java
false
false
1,647
java
package com.ceamback.project.goods.service.impl; import com.ceamback.common.constant.UserConstants; import com.ceamback.project.goods.domain.Brand; import com.ceamback.project.goods.mapper.BrandMapper; import com.ceamback.project.goods.service.BrandService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class BrandServiceImpl implements BrandService { private static final Logger log = LoggerFactory.getLogger(BrandServiceImpl.class); @Autowired private BrandMapper brandMapper; @Override public List<Brand> selectBrandList(Brand brand) { return brandMapper.selectBrandList(brand); } @Override public Brand selectBrandById(Long brandId) { return brandMapper.selectBrandById(brandId); } @Override public int insertBrand(Brand brand) { return brandMapper.insertBrand(brand); } @Override public int updateBrand(Brand brand) { return brandMapper.updateBrand(brand); } @Override public String checkBrandNameUnique(String brandName) { int count = brandMapper.checkBrandNameUnique(brandName); if (count > 0) { return UserConstants.NOT_UNIQUE; } return UserConstants.UNIQUE; } @Override public int deleteBrandById(Long brandId) { return brandMapper.deleteBrandById(brandId); } @Override public int deleteBrandByIds(Long[] brandIds) { return brandMapper.deleteBrandByIds(brandIds); } }
[ "50481972+CeaMYHBK@users.noreply.github.com" ]
50481972+CeaMYHBK@users.noreply.github.com
33d5025fc2d562dffd65f905a3c8fabb8ac54dab
4ed8a261dc1d7a053557c9c0bcec759978559dbd
/cnd/cnd.completion/src/org/netbeans/modules/cnd/completion/csm/CsmStatementResolver.java
cbb9a6bc7382c20ff4465d0bdad1c1798c5c6f62
[ "Apache-2.0" ]
permissive
kaveman-/netbeans
0197762d834aa497ad17dccd08a65c69576aceb4
814ad30e2d0a094f4aa3813bcbb5323a95a0b1d6
refs/heads/master
2021-01-04T06:49:41.139015
2020-02-06T15:13:37
2020-02-06T15:13:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
23,610
java
/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved. * * Oracle and Java are registered trademarks of Oracle and/or its affiliates. * Other names may be trademarks of their respective owners. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common * Development and Distribution License("CDDL") (collectively, the * "License"). You may not use this file except in compliance with the * License. You can obtain a copy of the License at * http://www.netbeans.org/cddl-gplv2.html * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the * specific language governing permissions and limitations under the * License. When distributing the software, include this License Header * Notice in each file and include the License file at * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the GPL Version 2 section of the License file that * accompanied this code. If applicable, add the following below the * License Header, with the fields enclosed by brackets [] replaced by * your own identifying information: * "Portions Copyrighted [year] [name of copyright owner]" * * Contributor(s): * * The Original Software is NetBeans. The Initial Developer of the Original * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun * Microsystems, Inc. All Rights Reserved. * * If you wish your version of this file to be governed by only the CDDL * or only the GPL Version 2, indicate your decision by adding * "[Contributor] elects to include this software in this distribution * under the [CDDL or GPL Version 2] license." If you do not indicate a * single choice of license, a recipient has the option to distribute * your version of this file under either the CDDL, the GPL Version 2 or * to extend the choice of license to its licensees as provided above. * However, if you add GPL Version 2 code and therefore, elected the GPL * Version 2 license, then the option applies only if the new code is * made subject to such option by the copyright holder. */ package org.netbeans.modules.cnd.completion.csm; import java.util.List; import org.netbeans.modules.cnd.api.model.*; import org.netbeans.modules.cnd.api.model.deep.*; import org.netbeans.modules.cnd.api.model.util.CsmKindUtilities; import org.netbeans.modules.cnd.modelutil.CsmUtilities; import org.netbeans.modules.cnd.utils.MutableObject; /** * utility class * used to find innermost statement inside CsmDeclaration and it's * context chain */ public class CsmStatementResolver { /** Creates a new instance of CsmStatementResolver */ private CsmStatementResolver() { } /* * finds inner object for given offset and update context */ public static boolean findInnerObject(CsmStatement stmt, int offset, CsmContext context) { if( stmt == null ) { if (CsmUtilities.DEBUG) { System.out.println("STATEMENT is null"); //NOI18N } return false; } if (!CsmOffsetUtilities.isInObject(stmt, offset)) { if (CsmUtilities.DEBUG) { System.out.println("Offset " + offset+ " is not in statement " + stmt); //NOI18N } return false; } // update context of passed statements CsmContextUtilities.updateContext(stmt, offset, context); CsmStatement.Kind kind = stmt.getKind(); boolean found = true; switch (kind) { case COMPOUND: found = findInnerCompound((CsmCompoundStatement) stmt, offset, context); break; case IF: found = findInnerIf((CsmIfStatement) stmt, offset, context); break; case TRY_CATCH: found = findInnerTry((CsmTryCatchStatement) stmt, offset, context); break; case CATCH: found = findInnerCatch((CsmExceptionHandler) stmt, offset, context); break; case DECLARATION: found = findInnerDeclaration((CsmDeclarationStatement) stmt, offset, context); break; case WHILE: case DO_WHILE: found = findInnerWhile((CsmLoopStatement) stmt, offset, context); break; case FOR: found = findInnerFor((CsmForStatement) stmt, offset, context); break; case RANGE_FOR: found = findInnerRange((CsmRangeForStatement) stmt, offset, context); break; case SWITCH: found = findInnerSwitch((CsmSwitchStatement) stmt, offset, context); break; case EXPRESSION: found = findInnerExpression(((CsmExpressionStatement) stmt).getExpression(), offset, context); break; case RETURN: found = findInnerExpression(((CsmReturnStatement) stmt).getReturnExpression(), offset, context); break; case BREAK: case CASE: case CONTINUE: case DEFAULT: case GOTO: case LABEL: break; default: if (CsmUtilities.DEBUG) { System.out.println("unexpected statement kind"); //NOI18N } break; } return found; } private static boolean findInnerCompound(CsmCompoundStatement stmt, int offset, CsmContext context) { assert (CsmOffsetUtilities.isInObject(stmt, offset)) : "we must be in statement when called"; //NOI18N if (stmt != null) { for (CsmStatement curSt : stmt.getStatements()) { if (findInnerObject(curSt, offset, context)) { return true; } } } return false; } private static boolean findInnerTry(CsmTryCatchStatement stmt, int offset, CsmContext context) { assert (CsmOffsetUtilities.isInObject(stmt, offset)) : "we must be in statement when called"; if (findInnerObject(stmt.getTryStatement(), offset, context)) { return true; } for (CsmExceptionHandler handler : stmt.getHandlers()) { if (findInnerObject(handler, offset, context)) { return true; } } return false; } private static boolean findInnerCatch(CsmExceptionHandler stmt, int offset, CsmContext context) { assert (CsmOffsetUtilities.isInObject(stmt, offset)) : "we must be in statement when called"; return findInnerCompound((CsmCompoundStatement) stmt, offset, context); } private static boolean findInnerIf(CsmIfStatement stmt, int offset, CsmContext context) { assert (CsmOffsetUtilities.isInObject(stmt, offset)) : "we must be in statement when called"; if (!CsmOffsetUtilities.sameOffsets(stmt, stmt.getCondition()) && CsmOffsetUtilities.isInObject(stmt.getCondition(), offset)) { if (CsmUtilities.DEBUG) { System.out.println("in CONDITION of if statement "); //NOI18N } CsmContextUtilities.updateContextObject(stmt.getCondition(), offset, context); findInnerExpression(stmt.getCondition().getExpression(), offset, context); return true; } if (findInnerObject(stmt.getThen(), offset, context)) { if (CsmUtilities.DEBUG) { System.out.println("in THEN: "); //NOI18N } return true; } if (findInnerObject(stmt.getElse(), offset, context)) { if (CsmUtilities.DEBUG) { System.out.println("in ELSE: "); //NOI18N } return true; } return false; } private static boolean findInnerDeclaration(CsmDeclarationStatement stmt, int offset, CsmContext context) { assert (CsmOffsetUtilities.isInObject(stmt, offset)) : "we must be in declaration statement when called"; //NOI18N List<CsmDeclaration> decls = stmt.getDeclarators(); CsmDeclaration decl = CsmOffsetUtilities.findObject(decls, context, offset); if (decl != null && (decls.size() == 1 || !CsmOffsetUtilities.sameOffsets(stmt, decl))) { if (CsmUtilities.DEBUG) { System.out.println("we have declarator " + decl); //NOI18N } if (CsmKindUtilities.isTypedef(decl) || CsmKindUtilities.isTypeAlias(decl)) { CsmClassifier classifier = ((CsmTypedef)decl).getType().getClassifier(); if (CsmOffsetUtilities.isInObject(decl, classifier) && !CsmOffsetUtilities.sameOffsets(decl, classifier)) { decl = classifier; } } if (CsmKindUtilities.isEnum(decl)) { findInnerEnum((CsmEnum)decl, offset, context); } else if (CsmKindUtilities.isClass(decl)) { findInnerClass((CsmClass)decl, offset, context); } else if (CsmKindUtilities.isFunction(decl)) { CsmFunction fun = (CsmFunction) decl; // check if offset in parameters CsmFunctionParameterList paramList = fun.getParameterList(); if (paramList != null) { CsmParameter param = CsmOffsetUtilities.findObject(paramList.getParameters(), context, offset); if (CsmOffsetUtilities.isInObject(paramList, offset) || (param != null && !CsmOffsetUtilities.sameOffsets(fun, param))) { context.add(fun); if (param != null) { CsmType type = param.getType(); if (!CsmOffsetUtilities.sameOffsets(param, type) && CsmOffsetUtilities.isInObject(type, offset)) { context.setLastObject(type); } else { context.setLastObject(param); } } } } if (CsmKindUtilities.isFunctionDefinition(fun) || CsmKindUtilities.isLambda(fun)) { CsmFunctionDefinition funDef = (CsmFunctionDefinition)fun; CsmCompoundStatement body = funDef.getBody(); if ((!CsmOffsetUtilities.sameOffsets(funDef, body) || body.getStartOffset() != body.getEndOffset()) && CsmOffsetUtilities.isInObject(body, offset)) { CsmContextUtilities.updateContext(fun, offset, context); // offset is in body, try to find inners statement if (CsmStatementResolver.findInnerObject(body, offset, context)) { CsmContextUtilities.updateContext(body, offset, context); // if found exact object => return it, otherwise return last found scope CsmObject found = context.getLastObject(); if (!CsmOffsetUtilities.sameOffsets(body, found)) { context.setLastObject(found); return true; } } } } } else if (CsmKindUtilities.isVariable(decl)) { findInnerExpression(((CsmVariable)decl).getInitialValue(), offset, context); } return true; } return false; } private static boolean findInnerEnum(CsmEnum enumm, int offset, CsmContext context) { CsmContextUtilities.updateContext(enumm, offset, context); CsmEnumerator enumerator = CsmOffsetUtilities.findObject(enumm.getEnumerators(), context, offset); if (enumerator != null && !CsmOffsetUtilities.sameOffsets(enumm, enumerator)) { CsmContextUtilities.updateContext(enumerator, offset, context); } return true; } private static boolean findInnerClass(CsmClass clazz, int offset, CsmContext context) { CsmContextUtilities.updateContext(clazz, offset, context); CsmMember member = CsmOffsetUtilities.findObject(clazz.getMembers(), context, offset); if (!CsmOffsetUtilities.sameOffsets(clazz, member)) { if (CsmKindUtilities.isClass(member)) { findInnerClass((CsmClass)member, offset, context); } else if (CsmKindUtilities.isFunctionDefinition(member)) { CsmContextUtilities.updateContext(member, offset, context); CsmCompoundStatement body = ((CsmFunctionDefinition)member).getBody(); if (!CsmOffsetUtilities.sameOffsets(member, body)) { findInnerObject(body, offset, context); } } } return true; } private static boolean findInnerWhile(CsmLoopStatement stmt, int offset, CsmContext context) { assert (CsmOffsetUtilities.isInObject(stmt, offset)) : "we must be in statement when called"; //NOI18N if (!CsmOffsetUtilities.sameOffsets(stmt, stmt.getCondition()) && CsmOffsetUtilities.isInObject(stmt.getCondition(), offset)) { if (CsmUtilities.DEBUG) { System.out.println("in condition of loop statement isPostCheck()=" + stmt.isPostCheck()); //NOI18N } CsmContextUtilities.updateContextObject(stmt.getCondition(), offset, context); findInnerExpression(stmt.getCondition().getExpression(), offset, context); return true; } return findInnerObject(stmt.getBody(), offset, context); } private static boolean findInnerFor(CsmForStatement stmt, int offset, CsmContext context) { assert (CsmOffsetUtilities.isInObject(stmt, offset)) : "we must be in statement when called"; //NOI18N if (findInnerObject(stmt.getInitStatement(), offset, context)) { if (CsmUtilities.DEBUG) { System.out.println("in INIT of for statement"); //NOI18N } return true; } if (CsmOffsetUtilities.isInObject(stmt.getIterationExpression(), offset)) { if (CsmUtilities.DEBUG) { System.out.println("in ITERATION of for statement"); //NOI18N } CsmExpression iterationExpression = stmt.getIterationExpression(); CsmContextUtilities.updateContextObject(iterationExpression, offset, context); if(findInnerExpression(iterationExpression, offset, context)) { return true; } return true; } if (CsmOffsetUtilities.isInObject(stmt.getCondition(), offset)) { if (CsmUtilities.DEBUG) { System.out.println("in CONDITION of for statement "); //NOI18N } CsmCondition condition = stmt.getCondition(); CsmContextUtilities.updateContextObject(condition, offset, context); if(findInnerExpression(condition.getExpression(), offset, context)) { return true; } return true; } return findInnerObject(stmt.getBody(), offset, context); } private static boolean findInnerRange(CsmRangeForStatement stmt, int offset, CsmContext context) { assert (CsmOffsetUtilities.isInObject(stmt, offset)) : "we must be in statement when called"; //NOI18N if (findInnerObject(stmt.getDeclaration(), offset, context)) { return true; } if (CsmOffsetUtilities.isInObject(stmt.getInitializer(), offset)) { CsmExpression initializerExpression = stmt.getInitializer(); CsmContextUtilities.updateContextObject(initializerExpression, offset, context); if(findInnerExpression(initializerExpression, offset, context)) { return true; } return true; } return findInnerObject(stmt.getBody(), offset, context); } private static boolean findInnerSwitch(CsmSwitchStatement stmt, int offset, CsmContext context) { assert (CsmOffsetUtilities.isInObject(stmt, offset)) : "we must be in statement when called"; //NOI18N if (!CsmOffsetUtilities.sameOffsets(stmt, stmt.getCondition()) && CsmOffsetUtilities.isInObject(stmt.getCondition(), offset)) { CsmContextUtilities.updateContextObject(stmt.getCondition(), offset, context); return true; } return findInnerObject(stmt.getBody(), offset, context); } /*package*/ static boolean findInnerExpression(CsmExpression expr, int offset, CsmContext context) { if(expr != null) { for (CsmStatement csmStatement : expr.getLambdas()) { CsmDeclarationStatement lambda = (CsmDeclarationStatement)csmStatement; if ((!CsmOffsetUtilities.sameOffsets(expr, lambda) || lambda.getStartOffset() != lambda.getEndOffset()) && CsmOffsetUtilities.isInObject(lambda, offset)) { // offset is in body, try to find inners statement if (CsmStatementResolver.findInnerObject(lambda, offset, context)) { // if found exact object => return it, otherwise return last found scope CsmObject found = context.getLastObject(); if (!CsmOffsetUtilities.sameOffsets(lambda, found)) { CsmContextUtilities.updateContextObject(found, offset, context); return true; } } } } } return false; } public static <T extends CsmStatement> T findStatement(CsmStatement root, Class<T> stmtClass) { final MutableObject<T> result = new MutableObject<>(); walkImpl(root, (stmt) -> { if (stmtClass.isAssignableFrom(stmt.getClass())) { result.value = (T) stmt; return StatementsWalker.Action.STOP; } return StatementsWalker.Action.CONTINUE; }); return result.value; } private static StatementsWalker.Action walkImpl(CsmStatement stmt, StatementsWalker walker) { if (stmt == null) { return StatementsWalker.Action.CONTINUE; } CsmStatement.Kind kind = stmt.getKind(); StatementsWalker.Action act = walker.visit(stmt); if (needStop(act)) { return act; } act = StatementsWalker.Action.CONTINUE; switch (kind) { case COMPOUND: act = walkCompound((CsmCompoundStatement) stmt, walker); break; case IF: act = walkIf((CsmIfStatement) stmt, walker); break; case TRY_CATCH: act = walkTry((CsmTryCatchStatement) stmt, walker); break; case CATCH: act = walkCatch((CsmExceptionHandler) stmt, walker); break; case DECLARATION: act = walkDeclaration((CsmDeclarationStatement) stmt, walker); break; case WHILE: case DO_WHILE: act = walkWhile((CsmLoopStatement) stmt, walker); break; case FOR: act = walkFor((CsmForStatement) stmt, walker); break; case RANGE_FOR: act = walkRange((CsmRangeForStatement) stmt, walker); break; case SWITCH: act = walkSwitch((CsmSwitchStatement) stmt, walker); break; case EXPRESSION: case RETURN: case BREAK: case CASE: case CONTINUE: case DEFAULT: case GOTO: case LABEL: break; default: if (CsmUtilities.DEBUG) { System.out.println("unexpected statement kind"); //NOI18N } break; } // Stop on 'full stop' if (act == StatementsWalker.Action.STOP) { return act; } // Continue on 'stop branch' or 'continue' return StatementsWalker.Action.CONTINUE; } private static StatementsWalker.Action walkCompound(CsmCompoundStatement stmt, StatementsWalker walker) { if (stmt != null) { for (CsmStatement curSt : stmt.getStatements()) { StatementsWalker.Action act = walkImpl(curSt, walker); if (needStop(act)) { return act; } } } return StatementsWalker.Action.CONTINUE; } private static StatementsWalker.Action walkTry(CsmTryCatchStatement stmt, StatementsWalker walker) { StatementsWalker.Action act = walkImpl(stmt.getTryStatement(), walker); if (needStop(act)) { return act; } for (CsmExceptionHandler handler : stmt.getHandlers()) { act = walkImpl(handler, walker); if (needStop(act)) { return act; } } return StatementsWalker.Action.CONTINUE; } private static StatementsWalker.Action walkCatch(CsmExceptionHandler stmt, StatementsWalker walker) { return walkCompound((CsmCompoundStatement) stmt, walker); } private static StatementsWalker.Action walkIf(CsmIfStatement stmt, StatementsWalker walker) { StatementsWalker.Action act = walkImpl(stmt.getThen(), walker); if (needStop(act)) { return act; } return walkImpl(stmt.getElse(), walker); } private static StatementsWalker.Action walkDeclaration(CsmDeclarationStatement stmt, StatementsWalker walker) { return StatementsWalker.Action.CONTINUE; } private static StatementsWalker.Action walkWhile(CsmLoopStatement stmt, StatementsWalker walker) { return walkImpl(stmt.getBody(), walker); } private static StatementsWalker.Action walkFor(CsmForStatement stmt, StatementsWalker walker) { StatementsWalker.Action act = walkImpl(stmt.getInitStatement(), walker); if (needStop(act)) { return act; } return walkImpl(stmt.getBody(), walker); } private static StatementsWalker.Action walkRange(CsmRangeForStatement stmt, StatementsWalker walker) { StatementsWalker.Action act = walkImpl(stmt.getDeclaration(), walker); if (needStop(act)) { return act; } return walkImpl(stmt.getBody(), walker); } private static StatementsWalker.Action walkSwitch(CsmSwitchStatement stmt, StatementsWalker walker) { return walkImpl(stmt.getBody(), walker); } private static boolean needStop(StatementsWalker.Action act) { return act == StatementsWalker.Action.STOP_BRANCH || act == StatementsWalker.Action.STOP; } @FunctionalInterface private static interface StatementsWalker { Action visit(CsmStatement stmt); public static enum Action { CONTINUE, STOP_BRANCH, STOP } } }
[ "geertjan@apache.org" ]
geertjan@apache.org
c40275521e044c338311c87d979c5b594e69bc31
02dac2e048be62075606aa6e3753d805b6aaebaf
/services/acc_hunter/src/com/acc_hunter_web/acc_hunter/service/LelangSkDetailService.java
5c2fb1bc9e51d9107161b5f198edbdf4bb1a1c18
[]
no_license
dre21/acc_hunter_web
1aa6bb6586531a9b918685834fa3368ff63bc61e
886fbdac8178d79d3cca4b9ae8c7873424b8b2e7
refs/heads/master
2022-04-06T05:28:25.881862
2020-01-30T13:57:40
2020-01-30T13:57:40
237,223,528
0
0
null
null
null
null
UTF-8
Java
false
false
10,214
java
/*Copyright (c) 2019-2020 deltadatamandiri.com All Rights Reserved. This software is the confidential and proprietary information of deltadatamandiri.com You shall not disclose such Confidential Information and shall use it only in accordance with the terms of the source code license agreement you entered into with deltadatamandiri.com*/ package com.acc_hunter_web.acc_hunter.service; /*This is a Studio Managed File. DO NOT EDIT THIS FILE. Your changes may be reverted by Studio.*/ import java.io.OutputStream; import java.util.List; import java.util.Map; import javax.validation.Valid; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import com.wavemaker.runtime.data.exception.EntityNotFoundException; import com.wavemaker.runtime.data.export.DataExportOptions; import com.wavemaker.runtime.data.export.ExportType; import com.wavemaker.runtime.data.expression.QueryFilter; import com.wavemaker.runtime.data.model.AggregationInfo; import com.wavemaker.runtime.file.model.Downloadable; import com.acc_hunter_web.acc_hunter.LelangSkDetail; import com.acc_hunter_web.acc_hunter.LelangSkDetailImages; import com.acc_hunter_web.acc_hunter.LelangSkParticipants; /** * Service object for domain model class {@link LelangSkDetail}. */ public interface LelangSkDetailService { /** * Creates a new LelangSkDetail. It does cascade insert for all the children in a single transaction. * * This method overrides the input field values using Server side or database managed properties defined on LelangSkDetail if any. * * @param lelangSkDetail Details of the LelangSkDetail to be created; value cannot be null. * @return The newly created LelangSkDetail. */ LelangSkDetail create(@Valid LelangSkDetail lelangSkDetail); /** * Returns LelangSkDetail by given id if exists. * * @param lelangskdetailId The id of the LelangSkDetail to get; value cannot be null. * @return LelangSkDetail associated with the given lelangskdetailId. * @throws EntityNotFoundException If no LelangSkDetail is found. */ LelangSkDetail getById(Integer lelangskdetailId); /** * Find and return the LelangSkDetail by given id if exists, returns null otherwise. * * @param lelangskdetailId The id of the LelangSkDetail to get; value cannot be null. * @return LelangSkDetail associated with the given lelangskdetailId. */ LelangSkDetail findById(Integer lelangskdetailId); /** * Find and return the list of LelangSkDetails by given id's. * * If orderedReturn true, the return List is ordered and positional relative to the incoming ids. * * In case of unknown entities: * * If enabled, A null is inserted into the List at the proper position(s). * If disabled, the nulls are not put into the return List. * * @param lelangskdetailIds The id's of the LelangSkDetail to get; value cannot be null. * @param orderedReturn Should the return List be ordered and positional in relation to the incoming ids? * @return LelangSkDetails associated with the given lelangskdetailIds. */ List<LelangSkDetail> findByMultipleIds(List<Integer> lelangskdetailIds, boolean orderedReturn); /** * Find and return the LelangSkDetail for given agreementNo if exists. * * @param agreementNo value of agreementNo; value cannot be null. * @return LelangSkDetail associated with the given inputs. * @throws EntityNotFoundException if no matching LelangSkDetail found. */ LelangSkDetail getByAgreementNo(String agreementNo); /** * Updates the details of an existing LelangSkDetail. It replaces all fields of the existing LelangSkDetail with the given lelangSkDetail. * * This method overrides the input field values using Server side or database managed properties defined on LelangSkDetail if any. * * @param lelangSkDetail The details of the LelangSkDetail to be updated; value cannot be null. * @return The updated LelangSkDetail. * @throws EntityNotFoundException if no LelangSkDetail is found with given input. */ LelangSkDetail update(@Valid LelangSkDetail lelangSkDetail); /** * Partially updates the details of an existing LelangSkDetail. It updates only the * fields of the existing LelangSkDetail which are passed in the lelangSkDetailPatch. * * This method overrides the input field values using Server side or database managed properties defined on LelangSkDetail if any. * * @param lelangskdetailId The id of the LelangSkDetail to be deleted; value cannot be null. * @param lelangSkDetailPatch The partial data of LelangSkDetail which is supposed to be updated; value cannot be null. * @return The updated LelangSkDetail. * @throws EntityNotFoundException if no LelangSkDetail is found with given input. */ LelangSkDetail partialUpdate(Integer lelangskdetailId, Map<String, Object> lelangSkDetailPatch); /** * Deletes an existing LelangSkDetail with the given id. * * @param lelangskdetailId The id of the LelangSkDetail to be deleted; value cannot be null. * @return The deleted LelangSkDetail. * @throws EntityNotFoundException if no LelangSkDetail found with the given id. */ LelangSkDetail delete(Integer lelangskdetailId); /** * Deletes an existing LelangSkDetail with the given object. * * @param lelangSkDetail The instance of the LelangSkDetail to be deleted; value cannot be null. */ void delete(LelangSkDetail lelangSkDetail); /** * Find all LelangSkDetails matching the given QueryFilter(s). * All the QueryFilter(s) are ANDed to filter the results. * This method returns Paginated results. * * @deprecated Use {@link #findAll(String, Pageable)} instead. * * @param queryFilters Array of queryFilters to filter the results; No filters applied if the input is null/empty. * @param pageable Details of the pagination information along with the sorting options. If null returns all matching records. * @return Paginated list of matching LelangSkDetails. * * @see QueryFilter * @see Pageable * @see Page */ @Deprecated Page<LelangSkDetail> findAll(QueryFilter[] queryFilters, Pageable pageable); /** * Find all LelangSkDetails matching the given input query. This method returns Paginated results. * Note: Go through the documentation for <u>query</u> syntax. * * @param query The query to filter the results; No filters applied if the input is null/empty. * @param pageable Details of the pagination information along with the sorting options. If null returns all matching records. * @return Paginated list of matching LelangSkDetails. * * @see Pageable * @see Page */ Page<LelangSkDetail> findAll(String query, Pageable pageable); /** * Exports all LelangSkDetails matching the given input query to the given exportType format. * Note: Go through the documentation for <u>query</u> syntax. * * @param exportType The format in which to export the data; value cannot be null. * @param query The query to filter the results; No filters applied if the input is null/empty. * @param pageable Details of the pagination information along with the sorting options. If null exports all matching records. * @return The Downloadable file in given export type. * * @see Pageable * @see ExportType * @see Downloadable */ Downloadable export(ExportType exportType, String query, Pageable pageable); /** * Exports all LelangSkDetails matching the given input query to the given exportType format. * * @param options The export options provided by the user; No filters applied if the input is null/empty. * @param pageable Details of the pagination information along with the sorting options. If null exports all matching records. * @param outputStream The output stream of the file for the exported data to be written to. * * @see DataExportOptions * @see Pageable * @see OutputStream */ void export(DataExportOptions options, Pageable pageable, OutputStream outputStream); /** * Retrieve the count of the LelangSkDetails in the repository with matching query. * Note: Go through the documentation for <u>query</u> syntax. * * @param query query to filter results. No filters applied if the input is null/empty. * @return The count of the LelangSkDetail. */ long count(String query); /** * Retrieve aggregated values with matching aggregation info. * * @param aggregationInfo info related to aggregations. * @param pageable Details of the pagination information along with the sorting options. If null exports all matching records. * @return Paginated data with included fields. * * @see AggregationInfo * @see Pageable * @see Page */ Page<Map<String, Object>> getAggregatedValues(AggregationInfo aggregationInfo, Pageable pageable); /* * Returns the associated lelangSkDetailImageses for given LelangSkDetail id. * * @param id value of id; value cannot be null * @param pageable Details of the pagination information along with the sorting options. If null returns all matching records. * @return Paginated list of associated LelangSkDetailImages instances. * * @see Pageable * @see Page */ Page<LelangSkDetailImages> findAssociatedLelangSkDetailImageses(Integer id, Pageable pageable); /* * Returns the associated lelangSkParticipantses for given LelangSkDetail id. * * @param id value of id; value cannot be null * @param pageable Details of the pagination information along with the sorting options. If null returns all matching records. * @return Paginated list of associated LelangSkParticipants instances. * * @see Pageable * @see Page */ Page<LelangSkParticipants> findAssociatedLelangSkParticipantses(Integer id, Pageable pageable); }
[ "marketing@deltadatamandiri.com" ]
marketing@deltadatamandiri.com
bd911792123520c3c4c0ab97fdc587b8b1886a74
de3cdd1f48a22d053cfef977ef9f9cd19902be04
/app/src/main/java/com/kks/portfolio_android/adapter/Adapter_favorite.java
ece417702c052b9eb263fb935f025a0181db6dc5
[]
no_license
Discoonect/Portfolio-android
41b5279b225e02e5d3259386672a423616d30004
44017fb3a6af5ce468a6c0f65cff4325d0406f71
refs/heads/master
2023-04-14T01:12:12.404686
2021-04-20T15:08:40
2021-04-20T15:08:40
287,303,269
0
1
null
null
null
null
UTF-8
Java
false
false
4,384
java
package com.kks.portfolio_android.adapter; import android.content.Context; import android.content.Intent; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.Glide; import com.kks.portfolio_android.R; import com.kks.portfolio_android.activity.CommentActivity; import com.kks.portfolio_android.activity.PageActivity; import com.kks.portfolio_android.activity.PostingActivity; import com.kks.portfolio_android.model.Alram; import com.kks.portfolio_android.model.Items; import com.kks.portfolio_android.model.Posting; import com.kks.portfolio_android.util.Util; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Locale; import java.util.TimeZone; public class Adapter_favorite extends RecyclerView.Adapter<Adapter_favorite.ViewHolder> { Context context; List<Items> itemsList; public Adapter_favorite(Context context, List<Items> itemsList) { this.context = context; this.itemsList = itemsList; } @NonNull @Override public Adapter_favorite.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()) .inflate(R.layout.favorite_row, parent, false); return new Adapter_favorite.ViewHolder(view); } @Override public void onBindViewHolder(@NonNull Adapter_favorite.ViewHolder holder, int position) { Items items = itemsList.get(position); if(items.getPhoto_url()!=null) { Glide.with(context).load(Util.IMAGE_PATH+items.getPhoto_url()).into(holder.ff_img_postImg); }else{ holder.ff_img_postImg.setVisibility(View.GONE); } if(items.getUser_profilephoto()!=null){ Glide.with(context).load(Util.IMAGE_PATH+items.getUser_profilephoto()).into(holder.ff_profile); }else{ holder.ff_profile.setImageResource(R.drawable.ic_baseline_account_circle_24); } holder.ff_txt_content.setText(items.getCreated_at()); } @Override public int getItemCount() { return itemsList.size(); } public class ViewHolder extends RecyclerView.ViewHolder{ ImageView ff_profile; ImageView ff_img_postImg; TextView ff_txt_content; public ViewHolder(@NonNull View itemView) { super(itemView); ff_profile = itemView.findViewById(R.id.ff_profile); ff_img_postImg = itemView.findViewById(R.id.ff_img_postImg); ff_txt_content = itemView.findViewById(R.id.ff_txt_content); ff_profile.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Items items = itemsList.get(getBindingAdapterPosition()); Intent i = new Intent(context,PageActivity.class); i.putExtra("user_id",items.getUser_id()); context.startActivity(i); } }); ff_txt_content.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Items items = itemsList.get(getBindingAdapterPosition()); if(items.getComment()==null && items.getPost_id()==null){ Intent i = new Intent(context, PageActivity.class); i.putExtra("user_id",items.getUser_id()); context.startActivity(i); }else if(items.getPost_id()!=null && items.getComment()==null){ Intent i = new Intent(context, PostingActivity.class); i.putExtra("post_id",items.getPost_id()); context.startActivity(i); }else{ Intent i = new Intent(context, CommentActivity.class); i.putExtra("post_id",items.getPost_id()); context.startActivity(i); } } }); } } }
[ "67423146+Discoonect@users.noreply.github.com" ]
67423146+Discoonect@users.noreply.github.com
4c177349bc65dcec99e4c3fafda1221a30262ae7
a5f0938897c04584fdca72a47aa23e71961ee7ad
/myblog/src/main/java/xyz/dsvshx/blog/utils/AliyunOSSUtil.java
787e207d7bfb4fdc0c82bb9b0321289d37d3edec
[]
no_license
dongzhonghua/dzh-java
5fb9ffed4095178ffee0ac92673af63ccc0ec725
575826a657ba351f62d1bf05bd50401d31d91843
refs/heads/master
2023-03-02T11:32:17.564708
2021-01-09T08:30:45
2021-01-09T08:30:45
209,758,899
0
0
null
2023-02-22T08:16:09
2019-09-20T09:52:08
JavaScript
UTF-8
Java
false
false
3,778
java
package xyz.dsvshx.blog.utils; import com.aliyun.oss.*; import com.aliyun.oss.model.CannedAccessControlList; import com.aliyun.oss.model.CreateBucketRequest; import com.aliyun.oss.model.PutObjectRequest; import com.aliyun.oss.model.PutObjectResult; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.web.multipart.MultipartFile; import xyz.dsvshx.blog.config.AliOSSConfig; import java.io.File; import java.io.FileOutputStream; import java.text.SimpleDateFormat; import java.util.Date; import java.util.UUID; @Component @Slf4j(topic = "AliyunOSSUtil") public class AliyunOSSUtil { @Autowired private AliOSSConfig aliOSSConfig; private String endpoint = "oss-cn-beijing.aliyuncs.com"; private String accessKeyId = "LTAI4FjACkPyL82MPkFpxagu"; private String accessKeySecret = "LDqgwj1fXJlN8slwlHVdM7DEMkHK6d"; private String fileHost = "file"; private String bucketName = "dsvshx"; /** * 上传文件 */ public String upLoad(File file) { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); String dateStr = format.format(new Date()); // 判断文件 if (file == null) { return null; } String fileUrl = null; OSS client = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret); try { // 判断容器是否存在,不存在就创建 if (!client.doesBucketExist(bucketName)) { client.createBucket(bucketName); CreateBucketRequest createBucketRequest = new CreateBucketRequest(bucketName); createBucketRequest.setCannedACL(CannedAccessControlList.PublicRead); client.createBucket(createBucketRequest); } // 设置文件路径和名称 fileUrl = fileHost + "/" + (dateStr + "/" + UUID.randomUUID().toString().replace("-", "") + "-" + file.getName()); // 上传文件 PutObjectResult result = client.putObject(new PutObjectRequest(bucketName, fileUrl, file)); // 设置权限(公开读) client.setBucketAcl(bucketName, CannedAccessControlList.PublicRead); } catch (OSSException oe) { oe.getMessage(); } catch (ClientException ce) { ce.getErrorMessage(); } finally { if (client != null) { client.shutdown(); } } String fileurl = bucketName + "." + endpoint + "/" + fileUrl; log.info("图片上传成功"+fileUrl); return fileurl; } public String upLoadFile(MultipartFile multipartFile) { File newFile = null; String url = null; try { String filename = multipartFile.getOriginalFilename(); if (multipartFile != null) { if (!"".equals(filename.trim())) { newFile = new File(filename); FileOutputStream os = new FileOutputStream(newFile); os.write(multipartFile.getBytes()); os.close(); multipartFile.transferTo(newFile); url = upLoad(newFile); newFile.delete(); } } } catch (Exception ex) { ex.printStackTrace(); } return url; } public void deleteFile(String filePath) { OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret); boolean exist = ossClient.doesObjectExist(bucketName, filePath); ossClient.deleteObject(bucketName, filePath); ossClient.shutdown(); } }
[ "1518943695@qq.com" ]
1518943695@qq.com
bc1b41282ee3ab6a5631944fe8763a66ed699e0a
3413ba43672655874301050c0feca0fb45d723b4
/src/javax/servlet/annotation/WebInitParam.java
feff4bef5d4b8f4bda6447d09dbc4ebf3731f1a4
[]
no_license
takedatmh/CBIDAU_tsukuba
44e13d35107e05f922d227bbd9401c3cea5bcb39
b9ef8377fcd3fa10f29383c59676c81a4dc95966
refs/heads/master
2020-07-30T06:51:13.900841
2020-06-29T16:37:04
2020-06-29T16:37:04
210,117,863
1
0
null
null
null
null
UTF-8
Java
false
false
2,009
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 javax.servlet.annotation; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * The annotation used to declare an initialization parameter on a * {@link javax.servlet.Servlet} or {@link javax.servlet.Filter}, within a * {@link javax.servlet.annotation.WebFilter} or * {@link javax.servlet.annotation.WebServlet} annotation.<br> * <br> * * E.g. * <code>&amp;#064;WebServlet(name="TestServlet", urlPatterns={"/test"},initParams={&amp;#064;WebInitParam(name="test", value="true")}) * public class TestServlet extends HttpServlet { ... </code><br> * * @since Servlet 3.0 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface WebInitParam { /** * @return name of the initialization parameter */ String name(); /** * @return value of the initialization parameter */ String value(); /** * @return description of the initialization parameter */ String description() default ""; }
[ "takedatmh@gmail.com" ]
takedatmh@gmail.com
5f9dfb86dde6b33330d6e340b40b570f17c74cbd
55ba6bb1459c3e6a3e94a4fcea2ffabc547f5356
/September/RecurMatrixRecreateMethod2.java
9242a435e0083ce219ad8627459cf80d5cfab2a8
[]
no_license
swkarlekar/APCS
de460841f41bc6899239e24cc23d7b1b50132169
63b2346c212eea3a5e258fb452252beabf31213e
refs/heads/master
2021-01-10T03:11:27.580951
2016-04-06T04:02:40
2016-04-06T04:02:40
55,571,637
2
0
null
null
null
null
UTF-8
Java
false
false
1,986
java
else { //System.out.println("IM HERE!"); /*if((sumUpArrayCol(m, col) < colcount[col]) && (sumUpArrayRow(m, row) < rowcount[row]) && m[row][col] == 0) { m[row][col] = 1; display(m, rowcount, colcount); System.out.println("IM HERE!"); }*/ if(row < (m.length-1) && (sumUpArrayCol(m, col) != colcount[col]) && (sumUpArrayRow(m, row) != rowcount[row]) && m[row][col] == 0) { display(m, rowcount, colcount); System.out.println("IM HERE!*" + " " + row + " " + col); m[row][col] = 1; recur(m, rowcount, colcount, (row+1), col); m[row][col] = 0; } if(row > 0 && (sumUpArrayCol(m, col) != colcount[col]) && (sumUpArrayRow(m, row) != rowcount[row]) && m[row][col] == 0) { display(m, rowcount, colcount); System.out.println("IM HERE!**" + " " + row + " " + col); m[row][col] = 1; recur(m, rowcount, colcount, (row-1), col); m[row][col] = 0; } if(col < (m[0].length-1) && (sumUpArrayCol(m, col) != colcount[col]) && (sumUpArrayRow(m, row) != rowcount[row]) && m[row][col] == 0) { display(m, rowcount, colcount); System.out.println("IM HERE!***" + " " + row + " " + col); m[row][col] = 1; recur(m, rowcount, colcount, row, (col+1)); m[row][col] = 0; } if(col > 0 && (sumUpArrayCol(m, col) != colcount[col]) && (sumUpArrayRow(m, row) != rowcount[row]) && m[row][col] == 0) { display(m, rowcount, colcount); System.out.println("IM HERE!****" + " " + row + " " + col); m[row][col] = 1; recur(m, rowcount, colcount, row, (col-1)); m[row][col] = 0; } }
[ "sweta.karlekar@hotmail.com" ]
sweta.karlekar@hotmail.com
d86ff4a040a9b5b7e3891a5766ea3e03889fee1e
21bf8a09675eda58099c3ab042b8298d9495dea8
/src/main/java/com/newrelic/shopjava/repo/ProductRepository.java
7ea65e0577653d44e0aa7ef3539440ce207aee3f
[]
no_license
RobertTTaylor9517/NewRelicTestApp
87d0412615e0c291f05ddeae38f00ede76c89636
58876169f75e94e778ed257eb36b26285e598415
refs/heads/master
2022-12-03T13:14:56.137478
2020-08-21T19:30:26
2020-08-21T19:30:26
289,166,722
0
0
null
null
null
null
UTF-8
Java
false
false
258
java
package com.newrelic.shopjava.repo; import org.springframework.data.jpa.repository.JpaRepository; import com.newrelic.shopjava.entities.Product; public interface ProductRepository extends JpaRepository<Product, Long> { Product findByName(String name); }
[ "robertt.taylor9517@gmail.com" ]
robertt.taylor9517@gmail.com
bfb5541e1ac64b35fc9fd81455d59e9718b0f35d
f83342c1b6cb117f95b4f7daa4de079989ccad5a
/app/src/main/java/io/github/tonyshkurenko/animationssetup/MainActivity.java
6f03f464871e20f31cab0e35254e0722a7a6da08
[]
no_license
antonshkurenko/AnimationsSetup
adb3f34a769d7be57b90d5af3eb68e6fbfd89c83
4d868485361b264af7f8ca2243f678ca307a8f78
refs/heads/master
2022-09-19T10:31:39.274948
2016-07-06T12:00:10
2016-07-06T12:00:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,444
java
package io.github.tonyshkurenko.animationssetup; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.ArrayAdapter; import android.widget.ListView; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnItemClick; import io.github.tonyshkurenko.animationssetup.examples.ActivityTransitionsActivity; import io.github.tonyshkurenko.animationssetup.examples.AnimationActivity; import io.github.tonyshkurenko.animationssetup.examples.AnimationDrawableActivity; import io.github.tonyshkurenko.animationssetup.examples.FragmentTransitionsActivity; import io.github.tonyshkurenko.animationssetup.examples.ObjectAnimatorActivity; import io.github.tonyshkurenko.animationssetup.examples.VectorAnimationActivity; import io.github.tonyshkurenko.animationssetup.examples.ViewPropertyAnimatorActivity; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity { private static final List<Demo> EXAMPLES = new ArrayList<Demo>() {{ add(new Demo("AnimationDrawable", AnimationDrawableActivity.class)); add(new Demo("Animation", AnimationActivity.class)); add(new Demo("ObjectAnimator", ObjectAnimatorActivity.class)); add(new Demo("ViewPropertyAnimator", ViewPropertyAnimatorActivity.class)); add(new Demo("VectorAnimation", VectorAnimationActivity.class)); add(new Demo("FragmentTransition", FragmentTransitionsActivity.class)); add(new Demo("ActivityTransition", ActivityTransitionsActivity.class)); }}; @BindView(R.id.list_view_chooser) ListView mListViewChooser; private ArrayAdapter<Demo> mAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); mAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, android.R.id.text1, EXAMPLES); mListViewChooser.setAdapter(mAdapter); } @OnItemClick(R.id.list_view_chooser) void onExampleSelected(int position) { startActivity(new Intent(this, mAdapter.getItem(position).activity)); } private static final class Demo { final String name; final Class activity; public Demo(String name, Class activity) { this.name = name; this.activity = activity; } @Override public String toString() { return name; } } }
[ "tonyshkurenko@gmail.com" ]
tonyshkurenko@gmail.com
b9a2f32c7f505a826f6a4d019dff6e16e56b0632
5e3235edf3de262f4d10b9e9e1fcc3bd13d6b8b1
/Code Snippet Repository/Roller/Roller788.java
f6de8ebd7337b114907408f38981abea3c4ad392
[]
no_license
saber13812002/DeepCRM
3336a244d4852a364800af3181e03e868cf6f9f5
be3e5e50e34a042d5ba7259ff5ff75c08ab32bb9
refs/heads/master
2023-03-16T00:08:06.473699
2018-04-18T05:29:50
2018-04-18T05:29:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,541
java
private boolean _jspx_meth_tiles_005finsertAttribute_005f0(javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // tiles:insertAttribute org.apache.tiles.jsp.taglib.InsertAttributeTag _jspx_th_tiles_005finsertAttribute_005f0 = (org.apache.tiles.jsp.taglib.InsertAttributeTag) _005fjspx_005ftagPool_005ftiles_005finsertAttribute_0026_005fname_005fnobody.get(org.apache.tiles.jsp.taglib.InsertAttributeTag.class); _jspx_th_tiles_005finsertAttribute_005f0.setPageContext(_jspx_page_context); _jspx_th_tiles_005finsertAttribute_005f0.setParent(null); // /WEB-INF/jsps/tiles/tiles-installpage.jsp(26,6) name = name type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_tiles_005finsertAttribute_005f0.setName("head"); int _jspx_eval_tiles_005finsertAttribute_005f0 = _jspx_th_tiles_005finsertAttribute_005f0.doStartTag(); if (_jspx_th_tiles_005finsertAttribute_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005ftiles_005finsertAttribute_0026_005fname_005fnobody.reuse(_jspx_th_tiles_005finsertAttribute_005f0); return true; } _005fjspx_005ftagPool_005ftiles_005finsertAttribute_0026_005fname_005fnobody.reuse(_jspx_th_tiles_005finsertAttribute_005f0); return false; }
[ "Qing.Mi@my.cityu.edu.hk" ]
Qing.Mi@my.cityu.edu.hk
0d21e4c437237b3f6040bf1f2f8a1d141dc94e76
b2760cd7d0e08abe22136c6df9e11c59d04615f7
/LibraryManagement/src/com/library/dao/LibMgmtDao.java
297b827f6bf47222552720d86a5cefc9b6627d60
[]
no_license
Rawata112/akr
f2999db7c7b9a8ffb011724e0849873d8c27f010
d71da84adb3b3cdbfbf612c8a8cee50308d5d54a
refs/heads/master
2020-04-17T16:47:02.668906
2019-01-28T14:31:30
2019-01-28T14:31:30
166,755,570
0
0
null
null
null
null
UTF-8
Java
false
false
64
java
package com.library.dao; public interface LibMgmtDao { }
[ "noreply@github.com" ]
Rawata112.noreply@github.com
dc1dbd29579e6ca10a555375ad5f1262d307de2d
178bf400e43c90d5601ae29f04095362aeb307d9
/app/src/main/java/com/qb/easy_bo/model/media/ILocalMusicModelImpl.java
f7ab861155ff6fc039b95b7df61f1ca08899bbd0
[]
no_license
qianbin01/Easy-bo
f8a1aabfd23c907852eb5e97b59b42f55282d57a
5ac29490d8aed06697cebbed44d816fc763abd02
refs/heads/master
2020-07-05T18:08:11.277021
2016-11-23T08:49:32
2016-11-23T08:49:32
73,987,289
12
0
null
null
null
null
UTF-8
Java
false
false
2,880
java
package com.qb.easy_bo.model.media; import android.content.ContentResolver; import android.content.Context; import android.database.Cursor; import android.provider.MediaStore.Audio; import com.qb.easy_bo.bean.LocalMusic; import java.util.ArrayList; import java.util.List; import rx.Observable; import rx.Subscriber; import rx.android.schedulers.AndroidSchedulers; import rx.schedulers.Schedulers; public class ILocalMusicModelImpl implements ILocalModel<LocalMusic> { private Context mContext; private List<LocalMusic> list = new ArrayList<>(); public ILocalMusicModelImpl(Context context) { this.mContext = context; } @Override public void onLoadLocal(final OnLoadCallback callback) { Observable.create(new Observable.OnSubscribe<List<LocalMusic>>() { @Override public void call(Subscriber<? super List<LocalMusic>> subscriber) { initData(); if (list.size() == 0) { subscriber.onError(new Throwable()); } else { subscriber.onNext(list); } } }) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(new Subscriber<List<LocalMusic>>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { callback.OnFailure("1"); } @Override public void onNext(List<LocalMusic> localMusics) { callback.OnSuccess(list); } }); } private void initData() { ContentResolver resolver = mContext.getContentResolver(); Cursor cursor = resolver.query(Audio.Media.EXTERNAL_CONTENT_URI, null, null, null, null); if (cursor != null) { while (cursor.moveToNext()) { LocalMusic music = new LocalMusic(); // music.setId(cursor.getInt(cursor.getColumnIndex(Audio.Media._ID))); //获取唯一id music.setMusicPath(cursor.getString(cursor.getColumnIndex(Audio.Media.DATA))); //文件路径 // music.setMusicName(cursor.getString(cursor.getColumnIndex(Audio.Media.DISPLAY_NAME))); //文件名 music.setArtist(cursor.getString(cursor.getColumnIndex(Audio.Media.ARTIST))); music.setLength(cursor.getInt(cursor.getColumnIndex(Audio.Media.DURATION))); music.setTitle(cursor.getString(cursor.getColumnIndex(Audio.Media.TITLE))); music.setSize(cursor.getLong(cursor.getColumnIndex(Audio.Media.SIZE))); list.add(music); } cursor.close(); } } }
[ "236490794@qq.com" ]
236490794@qq.com
42c413e2fc246d9fa9fbe66a285a226e12753875
577f6f6ad5f143758503013f468f4d33ef6478e4
/springcloud2020/gateway/src/main/java/com/xiaoyao/gateway/GatewayApplication.java
8f56af30948cc10e102fc3fb50f6bd41f398968b
[]
no_license
xiaoyaoll/cloud
509be34aae3751620cb8002d28be52bfedf0eb9e
2011fdc5bedd7b350840cf5120d4160264a9911a
refs/heads/master
2021-05-16T21:02:31.925929
2020-11-05T01:57:08
2020-11-05T01:57:08
250,468,140
0
0
null
null
null
null
UTF-8
Java
false
false
314
java
package com.xiaoyao.gateway; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class GatewayApplication { public static void main(String[] args) { SpringApplication.run(GatewayApplication.class, args); } }
[ "2624612838@qq.com" ]
2624612838@qq.com
d4b08eca0796b1ce5c57a7f77d1100503dca15ed
01d4fed89c2eb6f181dc67e4b02d09908a912ba6
/src/operations.java
07fa924c2c987d0292342b7be0678234b7a00692
[]
no_license
priya-tarkar/BinarySearchTree
c83603e3535e8598fdbeb853e69028457bd8a347
a22b0ee14f5beeff5232bb94adaf55bd6c594513
refs/heads/master
2023-04-04T16:50:40.006875
2021-04-12T20:12:18
2021-04-12T20:12:18
357,326,305
0
0
null
null
null
null
UTF-8
Java
false
false
4,416
java
//Coding through iterative method // 1 :Insertion operation public class operations { Node root; public operations() { root=null; } void insertion(int data) { Node node=new Node(data); if(root==null) { root=node; } else { Node temp=root; Node parent=null; while(temp!=null) { parent=temp; if(data<temp.data) { temp=temp.left; } else { temp=temp.right; } } if(parent.data>data) { parent.left=node; } else { parent.right=node; } } } // 2: Searching operation public boolean SearchNode(int data) { boolean response=false; Node temp=root; while(temp!=null) { if(temp.data==data) { response=true; break; } else if(data<temp.data) { temp=temp.left; } else { temp=temp.right; } } return response; } // 3 : Deletion of Node void delete(int data) { if(SearchNode(data)) { Node temp=root; Node parent=null; while(temp!=null && temp.data!=data) { parent=temp; if(temp.data==data) { break; } else if(data<temp.data) { temp=temp.left; } else { temp=temp.right; } } if(temp!=null) { // Deletion of leaf node if (isleaf(temp)) { if (parent.data > data) { parent.left = null; } else { parent.right = null; } } //deletion of node having single child else if (temp.left != null && temp.right == null) { if (parent.data > data) { parent.left = SingleChild(temp); } else { parent.right = SingleChild(temp); } } else if (temp.right != null && temp.left == null) { if (parent.data > data) { parent.left = SingleChild(temp); } else { parent.right = SingleChild(temp); } } //deletion of node having two children else { Node successor = ChildSuccesor(temp); delete(successor.data); successor.left = temp.left; successor.right = temp.right; if (parent.data > temp.data) { parent.left = successor; } else { parent.right = successor; } } } else { System.out.println("element not present"); } } } private Node ChildSuccesor(Node temp) { Node response=null; temp=temp.right; while(temp!=null) { response=temp; temp=temp.left; } return response; } private boolean isleaf(Node temp) { if(temp.left==null && temp.right==null) { return true; } else { return false; } } private Node SingleChild(Node temp) { if(temp.left!=null && temp.right==null) { return temp.left; } else { return temp.right; } } void InOrder(Node node) { if(node==null) { return; } else { InOrder(node.left); System.out.print(node.data+" "); InOrder(node.right); } } }
[ "priya.gla_cs19@gla.ac.in" ]
priya.gla_cs19@gla.ac.in
add2963e02ca45761ae9d7e747ac725efb3ae101
c8f713a9e6a522425b2dcf1e97f53b723b291496
/Edat p06 - 30-03-2020/tst/es/ubu/gii/edat/sesion06/TraductorTest.java
44b7a52927be7884ad349f3ca0d8a4601a8332ae
[]
no_license
JorgeRuizDev/UBU-Edat
88948dab8152dc5ed7378dfb9f833b786e69150a
016c15e2be63740b33ef2b9c4cf36abc694b770f
refs/heads/master
2022-10-28T14:03:12.454975
2020-06-12T12:07:03
2020-06-12T12:07:03
239,587,954
0
0
null
null
null
null
UTF-8
Java
false
false
1,229
java
package es.ubu.gii.edat.sesion06; import static org.junit.Assert.*; import org.junit.Before; import org.junit.Test; import es.ubu.gii.edat.sesion06.Traductor; public class TraductorTest { Traductor traduccion; @Before public void setUp(){ traduccion = new Traductor(); } @Test public void testCargaIdiomas() { String[] idiomaConsulta = {"free", "dog", "cat", "keyboard", "data structures", "A", "hopefully"}; String[] idiomaRespuesta = {"libre", "perro", "gato", "teclado", "estructuras de datos", "sobresaliente", "con optimismo"}; assertEquals(7, traduccion.cargaDiccionario(idiomaConsulta, idiomaRespuesta)); } @Test public void testBuscaTraduccionDirecta() { testCargaIdiomas(); assertEquals("perro", traduccion.buscaTraduccion("dog")); assertEquals("gato", traduccion.buscaTraduccion("cat")); assertEquals("estructuras de datos", traduccion.buscaTraduccion("data structures")); } @Test public void testBuscaTraduccionInversa() { testCargaIdiomas(); assertEquals("dog", traduccion.buscaTraduccion("perro")); assertEquals("cat", traduccion.buscaTraduccion("gato")); assertEquals("data structures", traduccion.buscaTraduccion("estructuras de datos")); } }
[ "jorgelinirg@gmail.com" ]
jorgelinirg@gmail.com
ff626b0602117e1c435422a516d2d21f056ef91f
888f1a7afb4afe5f022364924ef365f2f8fe3390
/src/tp7_Observer_Ej2_EncuentrosDeportivos/Notificador.java
108236c51473f1afa50042d4ec684a485472d785
[]
no_license
NFGarilli/unqui-po2-garilli
9bb7dbf12bcb0374c1723c83bc5aa3ecd6b10f7a
5fbb85c26a9a9222d1fc627a0353bd381c0db547
refs/heads/main
2023-06-21T18:48:33.559545
2021-07-05T07:05:26
2021-07-05T07:05:26
360,402,916
0
0
null
null
null
null
UTF-8
Java
false
false
578
java
package tp7_Observer_Ej2_EncuentrosDeportivos; import java.util.ArrayList; import java.util.List; public class Notificador { List<ResultadoPartido> partidos; List<IListener> listeners; public Notificador() { this.partidos = new ArrayList<ResultadoPartido>(); this.listeners = new ArrayList<IListener>(); } public void agregarPartido(ResultadoPartido partido) { partidos.add(partido); this.notify(partido); } public void notify(ResultadoPartido partido) { this.listeners.stream().filter(listener -> listener.estaInteresado(partido)); } }
[ "garillinicolas@hotmail.com" ]
garillinicolas@hotmail.com
a8c3dbb48c7b7d349917e175397b490ceb401296
4a00c4c349dfe9eab4be5d8208089dcf6fdb60ce
/app/src/main/java/com/avantir/wpos/activity/admin/NetworkConfigActivity.java
468ebd63e9f702182bb172aaedf59b7fa1a40d26
[]
no_license
scalpovich/wpos
1c158a2935d6f01e1d46bb0e060a67b3d367f6aa
b59932998450782100b8d06ef0490a48dadc7f06
refs/heads/master
2023-03-16T12:44:23.006548
2018-08-02T21:18:28
2018-08-02T21:18:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,057
java
package com.avantir.wpos.activity.admin; import android.content.Context; import android.os.Bundle; import android.view.View; import android.view.Window; import android.view.inputmethod.InputMethodManager; import android.widget.*; import com.avantir.wpos.R; import com.avantir.wpos.activity.BaseActivity; import com.avantir.wpos.utils.GlobalData; /** * Created by lekanomotayo on 24/01/2018. */ public class NetworkConfigActivity extends BaseActivity implements View.OnFocusChangeListener{ private String TAG = "NetworkConfigActivity"; String host = ""; String ip = ""; int port = 0; int timeout = 0; boolean isSSL = false; GlobalData globalData; @Override public void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_ctms_config); findViewById(R.id.titleBackImage).setVisibility(View.GONE); findViewById(R.id.titleSettingsImage).setVisibility(View.GONE); super.onCreate(savedInstanceState); } //@Override protected void initView() { //Top title bar ((ImageView) findViewById(R.id.titleBackImage)).setOnClickListener(this); ((EditText) findViewById(R.id.terminalIdText)).setOnFocusChangeListener(this); ((EditText) findViewById(R.id.hostnameText)).setOnFocusChangeListener(this); ((EditText) findViewById(R.id.hostIPText)).setOnFocusChangeListener(this); ((EditText) findViewById(R.id.portText)).setOnFocusChangeListener(this); ((EditText) findViewById(R.id.timeoutText)).setOnFocusChangeListener(this); ((Button) findViewById(R.id.cancel_host_btn)).setOnClickListener(this); ((Button) findViewById(R.id.save_host_btn)).setOnClickListener(this); ((LinearLayout) findViewById(R.id.host_page)).setOnClickListener(this); } @Override protected void initData() { globalData = GlobalData.getInstance(); EditText terminalIdEditText = (EditText) findViewById(R.id.terminalIdText); terminalIdEditText.setText(globalData.getTerminalId(), TextView.BufferType.EDITABLE); EditText hostnameEditText = (EditText) findViewById(R.id.hostnameText); hostnameEditText.setText(globalData.getCTMSHost(), TextView.BufferType.EDITABLE); EditText hostIPEditText = (EditText) findViewById(R.id.hostIPText); hostIPEditText.setText(globalData.getCTMSIP(), TextView.BufferType.EDITABLE); EditText portEditText = (EditText) findViewById(R.id.portText); portEditText.setText(String.valueOf(globalData.getCTMSPort()), TextView.BufferType.EDITABLE); EditText timeoutEditText = (EditText) findViewById(R.id.timeoutText); timeoutEditText.setText(String.valueOf(globalData.getCTMSTimeout()), TextView.BufferType.EDITABLE); CheckBox sslCheckbox = (CheckBox) findViewById(R.id.sslText); sslCheckbox.setChecked(globalData.getIfCTMSSSL()); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.titleBackImage: finish(); skipActivityAnim(-1); break; case R.id.host_page: InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(v.getWindowToken(), 0); break; case R.id.cancel_host_btn: finish(); skipActivityAnim(-1); break; case R.id.save_host_btn: saveHostData(); break; default: break; } } @Override public void onFocusChange(View v, boolean hasFocus){ //if(!hasFocus) { // InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); // imm.hideSoftInputFromWindow(v.getWindowToken(), 0); //} } private void saveHostData(){ try{ String terminalId = ((EditText) findViewById(R.id.terminalIdText)).getText().toString(); host = ((EditText) findViewById(R.id.hostnameText)).getText().toString(); ip = ((EditText) findViewById(R.id.hostIPText)).getText().toString(); port = Integer.parseInt(((EditText) findViewById(R.id.portText)).getText().toString()); timeout = Integer.parseInt(((EditText) findViewById(R.id.timeoutText)).getText().toString()); isSSL = ((CheckBox) findViewById(R.id.sslText)).isChecked(); globalData.setTerminalId(terminalId); globalData.setCTMSHost(host); globalData.setCTMSIP(ip); globalData.setCTMSPort(port); globalData.setCTMSTimeout(timeout); globalData.setIfCTMSSSL(isSSL); showToast("Saved TMS config!"); finish(); skipActivityAnim(-1); } catch(Exception ex){ showToast("Error saving TMS config!"); } } }
[ "lekkie.aydot@gmail.com" ]
lekkie.aydot@gmail.com
b100874bb1947b3d409693c33833232f62329f90
2f1c5c0d41229c4bbf0ce54430c1b55296f2a0c2
/app/src/main/java/com/mobiles/msm/fragments/SaleFragment.java
e165b45f8037c9f988a7fef0c1a154b3d46a959f
[]
no_license
029vaibhav/Mkshop
78774b057e2ac8dfa1ebfa19bcdc124d6642b717
c49a5ee0c4230bcd80e57e3ca969c84e7c97cbca
refs/heads/master
2021-01-18T17:26:44.743736
2016-11-20T19:01:18
2016-11-20T19:01:18
39,672,492
0
0
null
null
null
null
UTF-8
Java
false
false
19,929
java
package com.mobiles.msm.fragments; import android.app.Activity; import android.app.Dialog; import android.app.ProgressDialog; import android.content.Intent; import android.content.pm.PackageManager; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.Button; import android.widget.EditText; import android.widget.ListView; import android.widget.RadioGroup; import android.widget.TextView; import com.google.common.base.Predicate; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import com.mobiles.msm.R; import com.mobiles.msm.activities.NavigationMenuActivity; import com.mobiles.msm.adapters.CustomAdapter; import com.mobiles.msm.application.Client; import com.mobiles.msm.application.MyApplication; import com.mobiles.msm.contentprovider.ProductHelper; import com.mobiles.msm.pojos.enums.ProductType; import com.mobiles.msm.pojos.models.Product; import com.mobiles.msm.pojos.models.Sales; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; import static com.mobiles.msm.application.MyApplication.toast; public class SaleFragment extends Fragment implements /*ScannerCallback, */View.OnClickListener, RadioGroup.OnCheckedChangeListener { // TODO: Rename parameter arguments, choose names that match public static String TAG = "Sales"; ProgressDialog materialDialog; private RadioGroup radiogroup; private TextView brand, accessoryType, modelNo, imeitextview, starCustomerName, starMobileNo, startImei; EditText quantity, price, other, customerName, imei, mobile; Button submit; List<Product> modelSalesList, productTypeList, salesList; List<String> brandList, modelList, accessoryTypeList; Dialog brandModelDialog; // Scanner picker; String stringBrand = null, stringProductType = ProductType.Mobile.name(), stringAccessory = null, stringModel = null; TextView dialogTitle, scanImage; ListView dialogListView; public static SaleFragment newInstance(String brand, String model) { SaleFragment fragment = new SaleFragment(); if (brand != null) { Bundle args = new Bundle(); args.putString("brand", brand); args.putString("model", model); fragment.setArguments(args); } return fragment; } public SaleFragment() { // Required empty public constructor } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { stringBrand = getArguments().getString("brand"); stringModel = getArguments().getString("model"); } } @Override public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment MyApplication.SCRREN = "SaleFragment"; ViewGroup v = (ViewGroup) inflater.inflate(R.layout.fragment_sale, container, false); initViews(v); if (getArguments() != null) { brand.setText(stringBrand); modelNo.setText(stringModel); } listInit(); brand.setOnClickListener(this); accessoryType.setOnClickListener(this); modelNo.setOnClickListener(this); submit.setOnClickListener(this); radiogroup.setOnCheckedChangeListener(this); scanImage.setOnClickListener(this); return v; } private void listInit() { brandList = new ArrayList<>(); productTypeList = new ArrayList<>(); accessoryTypeList = new ArrayList<>(); modelSalesList = new ArrayList<>(); modelList = new ArrayList<>(); salesList = ProductHelper.getAllProducts(getActivity().getContentResolver());; try { productTypeList = Lists.newArrayList(Iterables.filter(salesList, new Predicate<Product>() { @Override public boolean apply(Product input) { return (input.getType().equalsIgnoreCase(stringProductType)); } })); } catch (Exception e) { Log.e("Err", e.getMessage()); } Set<String> brands = new HashSet(); for (int i = 0; i < productTypeList.size(); i++) { brands.add(productTypeList.get(i).getBrand()); } brandList.addAll(brands); } private void initViews(ViewGroup v) { materialDialog = NavigationMenuActivity.materialDialog; radiogroup = (RadioGroup) v.findViewById(R.id.radiogroup); brand = (TextView) v.findViewById(R.id.brandtext); accessoryType = (TextView) v.findViewById(R.id.accessoryType); modelNo = (TextView) v.findViewById(R.id.modeltext); quantity = (EditText) v.findViewById(R.id.quantityEdit); price = (EditText) v.findViewById(R.id.priceEdit); other = (EditText) v.findViewById(R.id.otheredit); submit = (Button) v.findViewById(R.id.submit); imeitextview = (TextView) v.findViewById(R.id.imeitextview); customerName = (EditText) v.findViewById(R.id.customerName); mobile = (EditText) v.findViewById(R.id.mobile); imei = (EditText) v.findViewById(R.id.imei); starCustomerName = (TextView) v.findViewById(R.id.star_customer_name); starMobileNo = (TextView) v.findViewById(R.id.star_mobile_no); startImei = (TextView) v.findViewById(R.id.star_imei); scanImage = (TextView) v.findViewById(R.id.scan_image); // picker = new Scanner(); // picker.setStyle(DialogFragment.STYLE_NO_TITLE, R.style.AppTheme); // picker.setCallBack(SaleFragment.this); brandModelDialog = new Dialog(getActivity(), android.R.style.Theme_Holo_Light_NoActionBar); brandModelDialog.setContentView(R.layout.dialog_layout); dialogTitle = (TextView) brandModelDialog.findViewById(R.id.dialogtitle); dialogListView = (ListView) brandModelDialog.findViewById(R.id.dialoglist); } // @Override // public void setIMEI(String imeiNumber) { // // if (imeiNumber != null) // imei.setText(imeiNumber); // picker.dismiss(); // // } @Override public void onClick(View v) { int id = v.getId(); switch (id) { case R.id.brandtext: brandClickListener(); break; case R.id.modeltext: modelClickListener(); break; case R.id.accessoryType: accessoryClickListener(); break; case R.id.submit: submitClickListener(); break; case R.id.scan_image: boolean b = appInstalledOrNot(getString(R.string.zing_package)); if (b) { Intent intent = new Intent(getString(R.string.zing_package) + ".SCAN"); intent.setPackage(getString(R.string.zing_package)); startActivityForResult(intent, 0); } else { MyApplication.toast(getActivity(), "please install this app"); final String appPackageName = getString(R.string.zing_package);// getPackageName() from Context or Activity object try { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName))); } catch (android.content.ActivityNotFoundException anfe) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName))); } } // picker.show(getFragmentManager(), "imei scanner"); break; } } private boolean appInstalledOrNot(String uri) { PackageManager pm = getActivity().getPackageManager(); boolean app_installed; try { pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES); app_installed = true; } catch (PackageManager.NameNotFoundException e) { app_installed = false; } return app_installed; } public void onActivityResult(int requestCode, int resultCode, Intent intent) { if (requestCode == 0) { if (resultCode == Activity.RESULT_OK) { String contents = intent.getStringExtra("SCAN_RESULT"); String format = intent.getStringExtra("SCAN_RESULT_FORMAT"); imei.setText(contents); // Handle successful scan } else if (resultCode == Activity.RESULT_CANCELED) { // Handle cancel } } } private void submitClickListener() { if (stringProductType.equalsIgnoreCase(ProductType.Accessory.name()) && stringAccessory == null) { toast(getActivity(), "please select accessory type"); } else if (stringBrand == null) { toast(getActivity(), "please select brand"); } else if (modelNo.getText().length() == 0 || modelNo.getText().toString().equalsIgnoreCase("other") && other.getText().toString().length() == 0) { toast(getActivity(), "please select model"); } else if (price.getText().length() <= 0 || price.getText().length() > 7) { toast(getActivity(), "please enter correct price"); } else if (stringProductType.equalsIgnoreCase(ProductType.Mobile.name()) && customerName.getText().length() <= 0) { toast(getActivity(), "please enter customer name"); } else if (stringProductType.equalsIgnoreCase(ProductType.Mobile.name()) && mobile.getText().length() != 10) { toast(getActivity(), "mobile no should be 10 digit"); } else if (stringProductType.equalsIgnoreCase(ProductType.Mobile.name()) && imei.getText().length() == 0) { toast(getActivity(), "please enter imei"); } else { if (stringModel.equalsIgnoreCase("other")) { stringModel = other.getText().toString(); } new SendData().execute(); } } private void accessoryClickListener() { dialogTitle.setText("Accessory "); CustomAdapter customAdapter = new CustomAdapter(getActivity(), accessoryTypeList); dialogListView.setAdapter(customAdapter); dialogListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view2, int position, long id) { stringAccessory = accessoryTypeList.get(position); brandModelDialog.dismiss(); accessoryType.setText(stringAccessory); List<Product> newArrayList = Lists.newArrayList(Iterables.filter(productTypeList, new Predicate<Product>() { @Override public boolean apply(Product input) { return (input.getType().equalsIgnoreCase(stringProductType) && input.getAccessoryType().equalsIgnoreCase(stringAccessory)); } })); Set<String> brand = new HashSet(); for (int i = 0; i < newArrayList.size(); i++) { brand.add(newArrayList.get(i).getBrand()); } brandList.addAll(brand); } }); brandModelDialog.show(); } private void modelClickListener() { if (stringBrand == null) { toast(getActivity(), "please select brand"); } else { dialogTitle.setText("Model no"); CustomAdapter customAdapter = new CustomAdapter(getActivity(), modelList); dialogListView.setAdapter(customAdapter); dialogListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view2, int position, long id) { stringModel = modelList.get(position); brandModelDialog.dismiss(); if (stringModel.equalsIgnoreCase("other")) { other.setVisibility(View.VISIBLE); } else { other.setVisibility(View.GONE); other.getText().clear(); } modelNo.setText(stringModel); } }); brandModelDialog.show(); } } private void brandClickListener() { dialogTitle.setText("Brand"); CustomAdapter customAdapter = new CustomAdapter(getActivity(), brandList); dialogListView.setAdapter(customAdapter); dialogListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view2, int position, long id) { stringBrand = brandList.get(position); brandModelDialog.dismiss(); brand.setText(stringBrand); modelSalesList = Lists.newArrayList(Iterables.filter(productTypeList, new Predicate<Product>() { @Override public boolean apply(Product input) { if (stringAccessory == null) return (input.getBrand().equalsIgnoreCase(stringBrand)); else return (input.getBrand().equalsIgnoreCase(stringBrand) && input.getAccessoryType().equalsIgnoreCase(stringAccessory)); } })); modelList = new ArrayList<String>(); for (int i = 0; i < modelSalesList.size(); i++) { modelList.add(modelSalesList.get(i).getModel()); } modelList.add("other"); } }); brandModelDialog.show(); } @Override public void onCheckedChanged(RadioGroup group, int checkedId) { switch (checkedId) { case R.id.radiomobile: accessoryType.setVisibility(View.GONE); stringProductType = ProductType.Mobile.name(); accessoryType.setText(""); brand.setText(""); modelNo.setText(""); other.setText(""); quantity.getText().clear(); price.getText().clear(); other.setVisibility(View.GONE); stringModel = null; stringAccessory = null; stringBrand = null; imeitextview.setVisibility(View.VISIBLE); imei.setVisibility(View.VISIBLE); starCustomerName.setVisibility(View.VISIBLE); starMobileNo.setVisibility(View.VISIBLE); startImei.setVisibility(View.VISIBLE); scanImage.setVisibility(View.VISIBLE); modelSalesList.clear(); productTypeList.clear(); modelList.clear(); accessoryTypeList.clear(); brandList.clear(); productTypeList = Lists.newArrayList(Iterables.filter(salesList, new Predicate<Product>() { @Override public boolean apply(Product input) { return (input.getType().equalsIgnoreCase(stringProductType)); } })); Set<String> brandStrings = new HashSet(); for (int i = 0; i < productTypeList.size(); i++) { brandStrings.add(productTypeList.get(i).getBrand()); } brandList.addAll(brandStrings); break; case R.id.radioAccessory: accessoryType.setVisibility(View.VISIBLE); stringProductType = ProductType.Accessory.name(); accessoryType.setText(""); brand.setText(""); modelNo.setText(""); other.setText(""); quantity.getText().clear(); price.getText().clear(); other.setVisibility(View.GONE); stringModel = null; stringAccessory = null; stringBrand = null; imeitextview.setVisibility(View.GONE); imei.setVisibility(View.GONE); starCustomerName.setVisibility(View.GONE); starMobileNo.setVisibility(View.GONE); startImei.setVisibility(View.GONE); scanImage.setVisibility(View.GONE); modelSalesList.clear(); productTypeList.clear(); modelList.clear(); accessoryTypeList.clear(); brandList.clear(); productTypeList = Lists.newArrayList(Iterables.filter(salesList, new Predicate<Product>() { @Override public boolean apply(Product input) { return (input.getType().equalsIgnoreCase(stringProductType)); } })); Set<String> accessoryStrings = new HashSet(); for (int i = 0; i < productTypeList.size(); i++) { accessoryStrings.add(productTypeList.get(i).getAccessoryType()); } accessoryTypeList.addAll(accessoryStrings); } } private class SendData extends AsyncTask<Void, Void, Void> { Sales sales; @Override protected void onPreExecute() { super.onPreExecute(); materialDialog.show(); sales = new Sales(); sales.setProductType(ProductType.valueOf(stringProductType)); sales.setBrand(stringBrand); sales.setModel(stringModel); if (stringAccessory == null) sales.setAccessoryType(""); else sales.setAccessoryType(stringAccessory); sales.setQuantity("1"); sales.setPrice(price.getText().toString()); sales.setUsername(MyApplication.Username); sales.setCustomerName(customerName.getText().toString()); sales.setMobile(mobile.getText().toString()); if (imei.getText().length() == 0) sales.setImei(""); else sales.setImei(imei.getText().toString()); } @Override protected Void doInBackground(Void... params) { Client.INSTANCE.sales(MyApplication.AUTH, sales).enqueue(new Callback<Void>() { @Override public void onResponse(Call<Void> call, Response<Void> response) { MyApplication.toast(getActivity(), getString(R.string.success_message)); if (materialDialog != null && materialDialog.isShowing()) materialDialog.dismiss(); submit.setEnabled(false); } @Override public void onFailure(Call<Void> call, Throwable t) { if (materialDialog != null && materialDialog.isShowing()) materialDialog.dismiss(); MyApplication.toast(getActivity(), t.getMessage()); submit.setEnabled(true); } }); return null; } } }
[ "vaibs4007@rediff.com" ]
vaibs4007@rediff.com
6d124a324d40233f03fd22493a3cbc364b2bd5af
a2cd3cb0aac4e9303e72971f343a01295d8cd2ca
/src/com/javase/oop/exercs/Towers.java
f574789d542582d9d3eef252a5af5c80a6473700
[]
no_license
iliaaa/Java-SE
aaac5977c7d617d880d74eaab53c0f7519b349e3
82834a02708b3e092be1c08a54fc0408d29f37f1
refs/heads/master
2020-07-26T09:48:40.486506
2020-01-30T18:57:59
2020-02-06T11:04:42
208,607,987
0
0
null
null
null
null
UTF-8
Java
false
false
441
java
package com.javase.oop.exercs; public class Towers { public static void main(String[] args) { Towers towers = new Towers(); towers.run(); } private void run() { } /* Напишите алгоритм решения задачи Ханойских башен. https://en.wikipedia.org/wiki/Tower_of_Hanoi Используйте рекурсивный алгоритм. */ }
[ "ikirpichny@mail.ru" ]
ikirpichny@mail.ru
b06c4878908b16a08dcdf37b61b4eb7ab4c68b72
766a8acd25624fbef1c42993cb35c68cf8a90fab
/gen/src/main/java/nightmare/util/LongHashMap.java
9c3f2b25ccd73a710d2be724af8e7f6584dc6ce6
[]
no_license
WawKei/RPG
854650ea410d69891edc340446abd194cd86cbed
f2b033a98f4beb3040fae2f7c980871a0a385631
refs/heads/master
2020-04-01T12:23:22.148353
2018-12-28T07:11:25
2018-12-28T07:11:25
153,204,932
2
0
null
null
null
null
UTF-8
Java
false
false
6,709
java
package nightmare.util; public class LongHashMap<V> { private transient Entry<V>[] hashArray = new Entry[4096]; private transient int numHashElements; private int mask; private int capacity = 3072; private final float percentUseable = 0.75F; private transient volatile int modCount; public LongHashMap() { this.mask = this.hashArray.length - 1; } private static int getHashedKey(long originalKey) { return hash((int)(originalKey ^ originalKey >>> 32)); } private static int hash(int integer) { integer = integer ^ integer >>> 20 ^ integer >>> 12; return integer ^ integer >>> 7 ^ integer >>> 4; } private static int getHashIndex(int p_76158_0_, int p_76158_1_) { return p_76158_0_ & p_76158_1_; } public int getNumHashElements() { return this.numHashElements; } public V getValueByKey(long p_76164_1_) { int i = getHashedKey(p_76164_1_); for (Entry<V> entry = this.hashArray[getHashIndex(i, this.mask)]; entry != null; entry = entry.nextEntry) { if (entry.key == p_76164_1_) { return entry.value; } } return (V)null; } public boolean containsItem(long p_76161_1_) { return this.getEntry(p_76161_1_) != null; } final Entry<V> getEntry(long p_76160_1_) { int i = getHashedKey(p_76160_1_); for (Entry<V> entry = this.hashArray[getHashIndex(i, this.mask)]; entry != null; entry = entry.nextEntry) { if (entry.key == p_76160_1_) { return entry; } } return null; } public void add(long p_76163_1_, V p_76163_3_) { int i = getHashedKey(p_76163_1_); int j = getHashIndex(i, this.mask); for (Entry<V> entry = this.hashArray[j]; entry != null; entry = entry.nextEntry) { if (entry.key == p_76163_1_) { entry.value = p_76163_3_; return; } } ++this.modCount; this.createKey(i, p_76163_1_, p_76163_3_, j); } private void resizeTable(int p_76153_1_) { Entry<V>[] entry = this.hashArray; int i = entry.length; if (i == 1073741824) { this.capacity = Integer.MAX_VALUE; } else { Entry<V>[] entry1 = new Entry[p_76153_1_]; this.copyHashTableTo(entry1); this.hashArray = entry1; this.mask = this.hashArray.length - 1; this.capacity = (int)((float)p_76153_1_ * this.percentUseable); } } private void copyHashTableTo(Entry<V>[] p_76154_1_) { Entry<V>[] entry = this.hashArray; int i = p_76154_1_.length; for (int j = 0; j < entry.length; ++j) { Entry<V> entry1 = entry[j]; if (entry1 != null) { entry[j] = null; while (true) { Entry<V> entry2 = entry1.nextEntry; int k = getHashIndex(entry1.hash, i - 1); entry1.nextEntry = p_76154_1_[k]; p_76154_1_[k] = entry1; entry1 = entry2; if (entry2 == null) { break; } } } } } public V remove(long p_76159_1_) { Entry<V> entry = this.removeKey(p_76159_1_); return (V)(entry == null ? null : entry.value); } final Entry<V> removeKey(long p_76152_1_) { int i = getHashedKey(p_76152_1_); int j = getHashIndex(i, this.mask); Entry<V> entry = this.hashArray[j]; Entry<V> entry1; Entry<V> entry2; for (entry1 = entry; entry1 != null; entry1 = entry2) { entry2 = entry1.nextEntry; if (entry1.key == p_76152_1_) { ++this.modCount; --this.numHashElements; if (entry == entry1) { this.hashArray[j] = entry2; } else { entry.nextEntry = entry2; } return entry1; } entry = entry1; } return entry1; } private void createKey(int p_76156_1_, long p_76156_2_, V p_76156_4_, int p_76156_5_) { Entry<V> entry = this.hashArray[p_76156_5_]; this.hashArray[p_76156_5_] = new Entry(p_76156_1_, p_76156_2_, p_76156_4_, entry); if (this.numHashElements++ >= this.capacity) { this.resizeTable(2 * this.hashArray.length); } } static class Entry<V> { final long key; V value; Entry<V> nextEntry; final int hash; Entry(int p_i1553_1_, long p_i1553_2_, V p_i1553_4_, Entry<V> p_i1553_5_) { this.value = p_i1553_4_; this.nextEntry = p_i1553_5_; this.key = p_i1553_2_; this.hash = p_i1553_1_; } public final long getKey() { return this.key; } public final V getValue() { return this.value; } public final boolean equals(Object p_equals_1_) { if (!(p_equals_1_ instanceof LongHashMap.Entry)) { return false; } else { Entry<V> entry = (Entry)p_equals_1_; Object object = Long.valueOf(this.getKey()); Object object1 = Long.valueOf(entry.getKey()); if (object == object1 || object != null && object.equals(object1)) { Object object2 = this.getValue(); Object object3 = entry.getValue(); if (object2 == object3 || object2 != null && object2.equals(object3)) { return true; } } return false; } } public final int hashCode() { return LongHashMap.getHashedKey(this.key); } public final String toString() { return this.getKey() + "=" + this.getValue(); } } }
[ "nightmare3832@yahoo.co.jp" ]
nightmare3832@yahoo.co.jp
35ca7964d2ebe7daedf15cab0f69d39e1b61d68f
a080c9ec28613c957ed8b1c63b67b77f40189fea
/src/main/java/com/anthonywoodard/keyshed/util/ReadCSV.java
6cf3b2a649310eb25c2c92f291d1a0d78bb0aa6b
[]
no_license
anthonywoodard/keyshed
ab84557c1deadbfc33a95779324a317a31f7d7e9
85921b58068fbe0cc6ca46fd1fc85d84a567666a
refs/heads/master
2021-01-10T20:22:10.473754
2014-12-12T20:28:54
2014-12-12T20:28:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
958
java
package com.anthonywoodard.keyshed.util; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; /** * * @author Anthony Woodard */ public class ReadCSV { BufferedReader br = null; String line = ""; String cvsSplitBy = ","; public List<String[]> run(String csvFile) { List<String[]> rows = new ArrayList(); try { br = new BufferedReader(new FileReader(csvFile)); while ((line = br.readLine()) != null) { // use comma as separator String[] row = line.split(cvsSplitBy); rows.add(row); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (br != null) { try { br.close(); } catch (IOException e) { } } } return rows; } }
[ "anthony.woodard@gmail.com" ]
anthony.woodard@gmail.com
6226603ea37845a544de96d20cf4b074f99d2c81
5590c6aa9f6d09a844e5728aa7cf1fc8fde239ce
/Tombola/src/main/java/com/mycompany/tombola/Tombola.java
843094f40b543419366b27c7b480e346ee765e3d
[]
no_license
oscarfc/pr_salt_1
abee827053fabab6f37752e2b426c38ca3ae7cc0
8e6a17ef2ff17670b0059a5ef9ea33d924758907
refs/heads/master
2022-12-05T18:00:08.743727
2020-09-01T16:46:11
2020-09-01T16:46:11
292,058,625
0
0
null
null
null
null
UTF-8
Java
false
false
5,972
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.mycompany.tombola; import java.util.ArrayList; import java.util.List; /** * * @author oscar.favero */ public class Tombola { private final static int NUMERO_ESTRAZINONI = 30; private Cartella[] cartelle = new Cartella[30]; private int[] archivioEstratti = new int[90]; int numeroEstratti = 0; public static void main(String[] args) { Tombola tombola = new Tombola(); int ultimoEstratto; List<Integer> listaCartelleTrovate; boolean amboDaTrovare = true; boolean ternoDaTrovare = false; boolean quaternaDaTrovare = false; boolean cinquinaDaTrovare = false; boolean tombolaDaTrovare = false; tombola.creaCartelle(); tombola.stampaCartelle(); for (int i = 0; i < NUMERO_ESTRAZINONI; i++) { ultimoEstratto = tombola.estraiNumero(); tombola.segnaEstratto(ultimoEstratto); if (amboDaTrovare && (listaCartelleTrovate = tombola.verificaAmbo()) != null) { amboDaTrovare = false; ternoDaTrovare = true; for (Integer id : listaCartelleTrovate) { System.out.println("Ambo nella Cartella " + (id + 1)); } } else if (ternoDaTrovare && (listaCartelleTrovate = tombola.verificaTerno()) != null) { ternoDaTrovare = false; quaternaDaTrovare = true; for (Integer id : listaCartelleTrovate) { System.out.println("Terno nella Cartella " + (id + 1)); } } else if (quaternaDaTrovare && (listaCartelleTrovate = tombola.verificaQuaterna()) != null) { quaternaDaTrovare = false; cinquinaDaTrovare = true; for (Integer id : listaCartelleTrovate) { System.out.println("Quaterna nella Cartella " + (id + 1)); } } else if (cinquinaDaTrovare && (listaCartelleTrovate = tombola.verificaCinquina()) != null) { cinquinaDaTrovare = false; for (Integer id : listaCartelleTrovate) { System.out.println("Cinquina nella Cartella " + (id + 1)); } } } tombola.stampaListaEstratti(); tombola.stampaCartelle(); } private void creaCartelle() { for (int i = 0; i < cartelle.length; i++) { cartelle[i] = new Cartella(); } } private void stampaCartelle() { for (int i = 0; i < cartelle.length; i++) { System.out.println("Cartella numero: " + (i + 1)); System.out.println(cartelle[i].getFirstRow()); System.out.println(cartelle[i].getSecondRow()); System.out.println(cartelle[i].getThirdRow()); } } private int generaNumero() { int numero = (int) (Math.round((Math.random() * 90))); if (numero == 0) { numero++; } return numero; } private int estraiNumero() { int estratto; do { estratto = generaNumero(); } while (controllaEstratti(estratto)); archivioEstratti[numeroEstratti] = estratto; numeroEstratti++; return estratto; } private boolean controllaEstratti(int estratto) { boolean giaEstratto = false; for (int i = 0; i < numeroEstratti; i++) { if (archivioEstratti[i] == estratto) { giaEstratto = true; break; } } return giaEstratto; } private void segnaEstratto(int ultimoEstratto) { for (Cartella cartella : cartelle) { cartella.segnaEstratto(ultimoEstratto); } } private List<Integer> verificaAmbo() { List<Integer> cartelleConAmbo = new ArrayList(); for (int i = 0; i < 30; i++) { if (cartelle[i].verificaAmbo()) { cartelleConAmbo.add(i); } } if (cartelleConAmbo.isEmpty()) { return null; } else { return cartelleConAmbo; } } private List<Integer> verificaTerno() { List<Integer> cartelleConTerno = new ArrayList(); for (int i = 0; i < 30; i++) { if (cartelle[i].verificaTerno()) { cartelleConTerno.add(i); } } if (cartelleConTerno.isEmpty()) { return null; } else { return cartelleConTerno; } } private List<Integer> verificaQuaterna() { List<Integer> cartelleConQuaterna = new ArrayList(); for (int i = 0; i < 30; i++) { if (cartelle[i].verificaQuaterna()) { cartelleConQuaterna.add(i); } } if (cartelleConQuaterna.isEmpty()) { return null; } else { return cartelleConQuaterna; } } private List<Integer> verificaCinquina() { List<Integer> cartelleConCinquina = new ArrayList(); for (int i = 0; i < 30; i++) { if (cartelle[i].verificaCinquina()) { cartelleConCinquina.add(i); } } if (cartelleConCinquina.isEmpty()) { return null; } else { return cartelleConCinquina; } } private void stampaListaEstratti() { String estratti = ""; for (int i = 0; i < NUMERO_ESTRAZINONI; i++) { estratti += archivioEstratti[i] + ", "; } System.out.println("Elenco numeri Estratti: " + estratti); } }
[ "oscar.faverocosta@mensa.it" ]
oscar.faverocosta@mensa.it
53a28fe3a7a66d1adf779e07d1dcba108f4fb415
4e05bcd2b9d95e52564423fb34c6f83f1c6dca74
/example/src/main/java/com/github/gfx/android/orma/example/tool/TypeAdapters.java
3edccba18b1eb3d8951e7c04804e827a5d944bc4
[ "Apache-2.0", "MIT" ]
permissive
TakumaHarada/Android-Orma
3f8b75d38f66ef24ebe3cc2a95859ff08e4197b8
40408cccc2d146f32d7c41136dd4bb8e03ee04ee
refs/heads/master
2020-08-17T23:51:13.467371
2019-10-24T06:45:26
2019-10-24T06:45:26
215,725,687
0
0
NOASSERTION
2019-10-17T07:05:51
2019-10-17T07:05:51
null
UTF-8
Java
false
false
1,818
java
/* * Copyright (c) 2015 FUJI Goro (gfx). * * 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.github.gfx.android.orma.example.tool; import com.github.gfx.android.orma.annotation.StaticTypeAdapter; import com.github.gfx.android.orma.annotation.StaticTypeAdapters; import org.threeten.bp.LocalDateTime; import org.threeten.bp.ZonedDateTime; @StaticTypeAdapters({ @StaticTypeAdapter( targetType = ZonedDateTime.class, serializedType = String.class, serializer = "serializeZonedDateTime", deserializer = "deserializeZonedDateTime" ), @StaticTypeAdapter( targetType = LocalDateTime.class, serializedType = String.class, serializer = "serializeLocalDateTime", deserializer = "deserializeLocalDateTime" ) }) public class TypeAdapters { public static String serializeZonedDateTime(ZonedDateTime time) { return time.toString(); } public static ZonedDateTime deserializeZonedDateTime(String serialized) { return ZonedDateTime.parse(serialized); } public static String serializeLocalDateTime(LocalDateTime time) { return time.toString(); } public static LocalDateTime deserializeLocalDateTime(String serialized) { return LocalDateTime.parse(serialized); } }
[ "gfuji@cpan.org" ]
gfuji@cpan.org
9a76a4183dcdd5ce8bc574f438970a5174ba094c
ae64166670999773a2c5239a1ae232518e764551
/src/main/java/de/vv/ef/gen/dltins/AgriculturalCommodityOilSeed1.java
a5beb084d1cac613eca4c38cb0659d4d796e1596
[]
no_license
Niederegger/EsmaFirdsConverter
f16a80ae4f7a4a68c18640d5242b07f7ffe7efb0
a8e0761f907175efc8d27026b90bf65455ed5efa
refs/heads/master
2021-05-07T07:41:27.928907
2017-11-10T16:11:11
2017-11-10T16:11:11
109,146,506
0
1
null
null
null
null
UTF-8
Java
false
false
4,212
java
// // Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 generiert // Siehe <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Änderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren. // Generiert: 2017.11.01 um 01:39:58 PM CET // package de.vv.ef.gen.dltins; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; import de.vv.ef.consumer.L2M; /** * <p>Java-Klasse für AgriculturalCommodityOilSeed1 complex type. * * <p>Das folgende Schemafragment gibt den erwarteten Content an, der in dieser Klasse enthalten ist. * * <pre> * &lt;complexType name="AgriculturalCommodityOilSeed1"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="BasePdct" type="{urn:iso:std:iso:20022:tech:xsd:DRAFT6auth.036.001.01}AssetClassProductType1Code"/> * &lt;element name="SubPdct" type="{urn:iso:std:iso:20022:tech:xsd:DRAFT6auth.036.001.01}AssetClassSubProductType1Code"/> * &lt;element name="AddtlSubPdct" type="{urn:iso:std:iso:20022:tech:xsd:DRAFT6auth.036.001.01}AssetClassDetailedSubProductType1Code"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "AgriculturalCommodityOilSeed1", propOrder = { "basePdct", "subPdct", "addtlSubPdct" }) public class AgriculturalCommodityOilSeed1 { @XmlElement(name = "BasePdct", required = true) @XmlSchemaType(name = "string") protected AssetClassProductType1Code basePdct; @XmlElement(name = "SubPdct", required = true) @XmlSchemaType(name = "string") protected AssetClassSubProductType1Code subPdct; @XmlElement(name = "AddtlSubPdct", required = true) @XmlSchemaType(name = "string") protected AssetClassDetailedSubProductType1Code addtlSubPdct; public L2M getData(String s) { L2M l2m = new L2M(); if(basePdct!=null) l2m.append(s+".BasePdct", basePdct.toString()); if(subPdct!=null) l2m.append(s+".SubPdct", subPdct.toString()); if(addtlSubPdct!=null) l2m.append(s+".AddtlSubPdct", addtlSubPdct.toString()); return l2m; } /** * Ruft den Wert der basePdct-Eigenschaft ab. * * @return * possible object is * {@link AssetClassProductType1Code } * */ public AssetClassProductType1Code getBasePdct() { return basePdct; } /** * Legt den Wert der basePdct-Eigenschaft fest. * * @param value * allowed object is * {@link AssetClassProductType1Code } * */ public void setBasePdct(AssetClassProductType1Code value) { this.basePdct = value; } /** * Ruft den Wert der subPdct-Eigenschaft ab. * * @return * possible object is * {@link AssetClassSubProductType1Code } * */ public AssetClassSubProductType1Code getSubPdct() { return subPdct; } /** * Legt den Wert der subPdct-Eigenschaft fest. * * @param value * allowed object is * {@link AssetClassSubProductType1Code } * */ public void setSubPdct(AssetClassSubProductType1Code value) { this.subPdct = value; } /** * Ruft den Wert der addtlSubPdct-Eigenschaft ab. * * @return * possible object is * {@link AssetClassDetailedSubProductType1Code } * */ public AssetClassDetailedSubProductType1Code getAddtlSubPdct() { return addtlSubPdct; } /** * Legt den Wert der addtlSubPdct-Eigenschaft fest. * * @param value * allowed object is * {@link AssetClassDetailedSubProductType1Code } * */ public void setAddtlSubPdct(AssetClassDetailedSubProductType1Code value) { this.addtlSubPdct = value; } }
[ "alexey.gasevic@vv.de" ]
alexey.gasevic@vv.de
e1ad7f2ad10ba52169885b1322d82ba71af48ef7
25fedddb9454be181a7229be5cc463d60e8ac396
/src/main/java/com/mutyala/uploadingfiles/Application.java
65adcd25f8a100753f434ab9747042518e1d22f2
[]
no_license
shmutyala/springboot-uploading-files
163dee36a8c656a333224ddfeabf220304858b60
6834c682f3da2999f925f1554fda407da29265f3
refs/heads/master
2022-08-15T00:19:26.704934
2020-05-23T16:53:45
2020-05-23T16:53:45
266,379,934
0
0
null
null
null
null
UTF-8
Java
false
false
446
java
package com.mutyala.uploadingfiles; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import java.io.File; import java.io.IOException; @SpringBootApplication public class Application { public static void main(String[] args) throws IOException { new File(UploadingController.uploadingDir).mkdirs(); SpringApplication.run(Application.class, args); } }
[ "shrikantmutyala@gmail.com" ]
shrikantmutyala@gmail.com
5c9d38b9bf246ff59ad7eb0d1b5b84120d6e0142
7d4901defdc5f76af1cfff7ff6b2ae6a5206cbe8
/google-ads-stubs-v7/src/main/java/com/google/ads/googleads/v7/services/stub/AdParameterServiceStubSettings.java
347127666c008275aa582b20341b32d5def82e1c
[ "Apache-2.0" ]
permissive
nwbirnie/google-ads-java
37d0d204bbc055619cf1f86c5cae76e08758835f
1341eb5e2cba3f694f3b4843c7c3534057f94938
refs/heads/main
2021-12-25T07:23:09.910937
2021-12-23T15:31:14
2021-12-23T15:31:14
407,548,306
0
0
Apache-2.0
2021-09-17T13:21:32
2021-09-17T13:21:31
null
UTF-8
Java
false
false
12,563
java
/* * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.ads.googleads.v7.services.stub; import com.google.ads.googleads.v7.resources.AdParameter; import com.google.ads.googleads.v7.services.GetAdParameterRequest; import com.google.ads.googleads.v7.services.MutateAdParametersRequest; import com.google.ads.googleads.v7.services.MutateAdParametersResponse; import com.google.api.core.ApiFunction; import com.google.api.core.BetaApi; import com.google.api.gax.core.GaxProperties; import com.google.api.gax.core.GoogleCredentialsProvider; import com.google.api.gax.core.InstantiatingExecutorProvider; import com.google.api.gax.grpc.GaxGrpcProperties; import com.google.api.gax.grpc.GrpcTransportChannel; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; import com.google.api.gax.retrying.RetrySettings; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.StubSettings; import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; import java.io.IOException; import java.util.List; import javax.annotation.Generated; import org.threeten.bp.Duration; // AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link AdParameterServiceStub}. * * <p>The default instance has everything set to sensible defaults: * * <ul> * <li> The default service address (googleads.googleapis.com) and default port (443) are used. * <li> Credentials are acquired automatically through Application Default Credentials. * <li> Retries are configured for idempotent methods but not for non-idempotent methods. * </ul> * * <p>The builder of this class is recursive, so contained classes are themselves builders. When * build() is called, the tree of builders is called to create the complete settings object. * * <p>For example, to set the total timeout of getAdParameter to 30 seconds: * * <pre>{@code * AdParameterServiceStubSettings.Builder adParameterServiceSettingsBuilder = * AdParameterServiceStubSettings.newBuilder(); * adParameterServiceSettingsBuilder * .getAdParameterSettings() * .setRetrySettings( * adParameterServiceSettingsBuilder * .getAdParameterSettings() * .getRetrySettings() * .toBuilder() * .setTotalTimeout(Duration.ofSeconds(30)) * .build()); * AdParameterServiceStubSettings adParameterServiceSettings = * adParameterServiceSettingsBuilder.build(); * }</pre> */ @Generated("by gapic-generator-java") public class AdParameterServiceStubSettings extends StubSettings<AdParameterServiceStubSettings> { /** The default scopes of the service. */ private static final ImmutableList<String> DEFAULT_SERVICE_SCOPES = ImmutableList.<String>builder().add("https://www.googleapis.com/auth/adwords").build(); private final UnaryCallSettings<GetAdParameterRequest, AdParameter> getAdParameterSettings; private final UnaryCallSettings<MutateAdParametersRequest, MutateAdParametersResponse> mutateAdParametersSettings; /** Returns the object with the settings used for calls to getAdParameter. */ public UnaryCallSettings<GetAdParameterRequest, AdParameter> getAdParameterSettings() { return getAdParameterSettings; } /** Returns the object with the settings used for calls to mutateAdParameters. */ public UnaryCallSettings<MutateAdParametersRequest, MutateAdParametersResponse> mutateAdParametersSettings() { return mutateAdParametersSettings; } @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public AdParameterServiceStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcAdParameterServiceStub.create(this); } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { return InstantiatingExecutorProvider.newBuilder(); } /** Returns the default service endpoint. */ public static String getDefaultEndpoint() { return "googleads.googleapis.com:443"; } /** Returns the default mTLS service endpoint. */ public static String getDefaultMtlsEndpoint() { return "googleads.mtls.googleapis.com:443"; } /** Returns the default service scopes. */ public static List<String> getDefaultServiceScopes() { return DEFAULT_SERVICE_SCOPES; } /** Returns a builder for the default credentials for this service. */ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { return GoogleCredentialsProvider.newBuilder() .setScopesToApply(DEFAULT_SERVICE_SCOPES) .setUseJwtAccessWithScope(true); } /** Returns a builder for the default ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return InstantiatingGrpcChannelProvider.newBuilder() .setMaxInboundMessageSize(Integer.MAX_VALUE); } public static TransportChannelProvider defaultTransportChannelProvider() { return defaultGrpcTransportProviderBuilder().build(); } @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { return ApiClientHeaderProvider.newBuilder() .setGeneratedLibToken( "gapic", GaxProperties.getLibraryVersion(AdParameterServiceStubSettings.class)) .setTransportToken( GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); } /** Returns a new builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); } /** Returns a builder containing all the values of this settings class. */ public Builder toBuilder() { return new Builder(this); } protected AdParameterServiceStubSettings(Builder settingsBuilder) throws IOException { super(settingsBuilder); getAdParameterSettings = settingsBuilder.getAdParameterSettings().build(); mutateAdParametersSettings = settingsBuilder.mutateAdParametersSettings().build(); } /** Builder for AdParameterServiceStubSettings. */ public static class Builder extends StubSettings.Builder<AdParameterServiceStubSettings, Builder> { private final ImmutableList<UnaryCallSettings.Builder<?, ?>> unaryMethodSettingsBuilders; private final UnaryCallSettings.Builder<GetAdParameterRequest, AdParameter> getAdParameterSettings; private final UnaryCallSettings.Builder<MutateAdParametersRequest, MutateAdParametersResponse> mutateAdParametersSettings; private static final ImmutableMap<String, ImmutableSet<StatusCode.Code>> RETRYABLE_CODE_DEFINITIONS; static { ImmutableMap.Builder<String, ImmutableSet<StatusCode.Code>> definitions = ImmutableMap.builder(); definitions.put( "retry_policy_0_codes", ImmutableSet.copyOf( Lists.<StatusCode.Code>newArrayList( StatusCode.Code.UNAVAILABLE, StatusCode.Code.DEADLINE_EXCEEDED))); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } private static final ImmutableMap<String, RetrySettings> RETRY_PARAM_DEFINITIONS; static { ImmutableMap.Builder<String, RetrySettings> definitions = ImmutableMap.builder(); RetrySettings settings = null; settings = RetrySettings.newBuilder() .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.3) .setMaxRetryDelay(Duration.ofMillis(60000L)) .setInitialRpcTimeout(Duration.ofMillis(3600000L)) .setRpcTimeoutMultiplier(1.0) .setMaxRpcTimeout(Duration.ofMillis(3600000L)) .setTotalTimeout(Duration.ofMillis(3600000L)) .build(); definitions.put("retry_policy_0_params", settings); RETRY_PARAM_DEFINITIONS = definitions.build(); } protected Builder() { this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(clientContext); getAdParameterSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); mutateAdParametersSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.<UnaryCallSettings.Builder<?, ?>>of( getAdParameterSettings, mutateAdParametersSettings); initDefaults(this); } protected Builder(AdParameterServiceStubSettings settings) { super(settings); getAdParameterSettings = settings.getAdParameterSettings.toBuilder(); mutateAdParametersSettings = settings.mutateAdParametersSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.<UnaryCallSettings.Builder<?, ?>>of( getAdParameterSettings, mutateAdParametersSettings); } private static Builder createDefault() { Builder builder = new Builder(((ClientContext) null)); builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); builder.setSwitchToMtlsEndpointAllowed(true); return initDefaults(builder); } private static Builder initDefaults(Builder builder) { builder .getAdParameterSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .mutateAdParametersSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); return builder; } /** * Applies the given settings updater function to all of the unary API methods in this service. * * <p>Note: This method does not support applying settings to streaming methods. */ public Builder applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); return this; } public ImmutableList<UnaryCallSettings.Builder<?, ?>> unaryMethodSettingsBuilders() { return unaryMethodSettingsBuilders; } /** Returns the builder for the settings used for calls to getAdParameter. */ public UnaryCallSettings.Builder<GetAdParameterRequest, AdParameter> getAdParameterSettings() { return getAdParameterSettings; } /** Returns the builder for the settings used for calls to mutateAdParameters. */ public UnaryCallSettings.Builder<MutateAdParametersRequest, MutateAdParametersResponse> mutateAdParametersSettings() { return mutateAdParametersSettings; } @Override public AdParameterServiceStubSettings build() throws IOException { return new AdParameterServiceStubSettings(this); } } }
[ "noreply@github.com" ]
nwbirnie.noreply@github.com
05a947b8876db440fea2b73f426961633d1ab93a
f61c7bbec482c0377ecaf6420127db1932eea37b
/Team7Project/src/ca/ualberta/team7project/network/ThreadUpdater.java
69ed3f7a8dd8cc757f1cd310b7fbcfe1055bedbb
[ "Apache-2.0" ]
permissive
CMPUT301W14T07/Team7Project
1e10e296219b62500353d51bd5a63a13c763bb02
168f008135bbdade73715a09fa41853294943b5f
refs/heads/master
2020-03-31T09:50:39.466305
2014-04-08T10:24:15
2014-04-08T10:24:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,244
java
package ca.ualberta.team7project.network; import ca.ualberta.team7project.cache.CacheOperation; import ca.ualberta.team7project.interfaces.ThreadListener; import ca.ualberta.team7project.models.ThreadModel; /** * Updates the comments on the server * <p> * Passes comments on to ElasticSearchOperation */ public class ThreadUpdater { ThreadListener refresh; /** * Construct a TopicUpdater with no refresh callback */ public ThreadUpdater() { super(); this.refresh = null; } /** * Construct a TopicUpdater with an onRefresh() callback * @param refresh an object implementing ThreadListener */ public ThreadUpdater(ThreadListener refresh) { super(); this.refresh = refresh; } /** * Pushes a single comment to the server * <p> * If editing, the old comment will be overwritten automatically * <p> * If a refresh callback was provided, it will be called after * receiving a response from the server * @param comment a comment/topic to be pushed */ public void sendComment(ThreadModel comment) { ElasticSearchOperation search = new ElasticSearchOperation(); CacheOperation cache = new CacheOperation(); search.pushThreadModel(comment, refresh); cache.saveThread(comment); } }
[ "rzzw456@126.com" ]
rzzw456@126.com
2152cf8ba522ad63199ae01e76e7f427bfdaf7dc
68d6585dfd6392e7ee97886a065371728fa70ad3
/src/main/java/com/youyu/cotenant/security/CustomAuthenticationProvider.java
3330b9dd0e8da48e6e983a4fe46074ea08991d45
[]
no_license
xwf001/cotenant
51a4761b5596315423d8c4473714a47ded1776f7
99a6795babd7e943439427e4d98dab1629292d5a
refs/heads/master
2020-07-18T17:57:05.556761
2019-09-10T14:41:27
2019-09-10T14:41:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,425
java
package com.youyu.cotenant.security; import com.youyu.cotenant.entity.CotenantUser; import com.youyu.cotenant.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.AuthenticationProvider; import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Component; import java.util.Collection; import java.util.HashSet; import java.util.Set; /** * 自定义身份验证 */ @Component public class CustomAuthenticationProvider implements AuthenticationProvider { @Autowired private UserService userService; @Autowired private PasswordEncoder encoder; @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { String phone = authentication.getName(); String password = authentication.getCredentials().toString(); CotenantUser user = userService.selectUserByUserName(phone); if (user == null) throw new BadCredentialsException("该用户不存在"); if (encoder.matches(password, user.getPassword())) { //这里设置权限和角色 Collection<GrantedAuthority> authorities = obtionGrantedAuthorities(user); //生成令牌 return new UsernamePasswordAuthenticationToken(phone, password, authorities); } else { throw new BadCredentialsException("密码错误"); } } /** * 取得用户的权限 * * @param user 用户信息对象 * @return */ private Set<GrantedAuthority> obtionGrantedAuthorities(CotenantUser user) { Set<GrantedAuthority> authSet = new HashSet<GrantedAuthority>(); authSet.add(new SimpleGrantedAuthority("1")); return authSet; } @Override public boolean supports(Class<?> authentication) { return authentication.equals(UsernamePasswordAuthenticationToken.class); } }
[ "baopengcheng@peilian.com" ]
baopengcheng@peilian.com
07cabf3531b9b7760b5654b71a0ebc64542f42e7
da313c977d972db150a2151f9ed3abf18d69a22d
/app/src/main/java/com/wangng/pindu/ui/gestoslife/GestosLifeItemView.java
dd6ba9539d2accafdb2e07e931067cdbb9a502ba
[]
no_license
createBean/PinDuReader
cb3fbe5e21f91c22125397c2c3209b5862520710
fbbbf4ca55ed9faf63cb4bc229d7cae0ff4b8bb9
refs/heads/master
2021-01-02T08:15:42.845076
2017-09-25T02:43:07
2017-09-25T02:43:07
98,979,727
0
0
null
null
null
null
UTF-8
Java
false
false
1,365
java
package com.wangng.pindu.ui.gestoslife; import android.content.Context; import android.support.annotation.Nullable; import android.util.AttributeSet; import android.widget.LinearLayout; import android.widget.TextView; import com.wangng.pindu.R; /** * Created by yu on 2017/4/5. */ public class GestosLifeItemView extends LinearLayout { protected TextView titleView; protected TextView timeView; private GestosLifeModel mModel; public GestosLifeItemView(Context context) { super(context); initializeData(); } public GestosLifeItemView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); initializeData(); } public GestosLifeItemView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); initializeData(); } private void initializeData() { setOrientation(VERTICAL); inflate(getContext(), R.layout.gestos_life_item_view, this); initViews(); } private void initViews() { titleView = (TextView) findViewById(R.id.tv_title); timeView = (TextView) findViewById(R.id.tv_time); } public void setModel(GestosLifeModel model) { mModel = model; titleView.setText(mModel.getTitle()); timeView.setText(mModel.getTime()); } }
[ "yubin@bingosoft.net" ]
yubin@bingosoft.net
3b3dd2c2ecf69280b2567992371d47ec739d071f
e241b057c4c5df4b476530a5274a88a552f72d0c
/jframe/src/main/java/com/wujing/jframe/widget/JColorDrawable.java
20f761b9bb28a80ec46156e87dd8ee3d17c58333
[ "Apache-2.0" ]
permissive
haoxiongqin/EasyFrame_master
6e6f614e90d61fc4f1fd224e3627f6ebb2eaead0
a442269bd6e1bba999f829b33664b2f92ee1cd92
refs/heads/master
2021-05-15T13:51:13.504793
2017-10-24T02:29:41
2017-10-24T02:29:41
107,229,619
2
0
null
null
null
null
UTF-8
Java
false
false
1,410
java
package com.wujing.jframe.widget; import android.graphics.Canvas; import android.graphics.ColorFilter; import android.graphics.Paint; import android.graphics.PixelFormat; import android.graphics.RectF; import android.graphics.drawable.Drawable; import android.support.annotation.ColorInt; public class JColorDrawable extends Drawable { private Paint mPaint; private int color; private RectF rectF; public JColorDrawable() { mPaint = new Paint(); // 是否抗锯齿 mPaint.setAntiAlias(true); } public JColorDrawable(int color) { this.color = color; mPaint = new Paint(); mPaint.setAntiAlias(true); } public void setColor(@ColorInt int color) { this.color = color; } @Override public void setBounds(int left, int top, int right, int bottom) { super.setBounds(left, top, right, bottom); rectF = new RectF(left, top, right, bottom); } @Override public void draw(Canvas canvas) { mPaint.setColor(color); canvas.drawRoundRect(rectF, 20, 20, mPaint); } @Override public void setAlpha(int alpha) { mPaint.setAlpha(alpha); } @Override public void setColorFilter(ColorFilter colorFilter) { mPaint.setColorFilter(colorFilter); } @Override public int getOpacity() { return PixelFormat.TRANSLUCENT; } }
[ "527697608@qq.com" ]
527697608@qq.com
aa10ae00ca0c7cc3d0968ad0d81f32a2ad09f8c1
891801400633e6258f03a647777815ee9d21b046
/src/test/java/au/com/brooms/integration/BBPIntegrationTest.java
f5a649b0c4a26c82bf2f3b97a95f341bd3e1de2d
[ "Apache-2.0" ]
permissive
brooms/PiApproximator
b1c9ba4d1cff35cf55e9fab5814e6c2db788ab70
8ba9db157a1e67fd5550f8e8745ff3290c837ff2
refs/heads/master
2021-01-10T12:55:14.554639
2015-11-26T01:38:23
2015-11-26T01:38:23
46,774,384
0
0
null
null
null
null
UTF-8
Java
false
false
2,944
java
package au.com.brooms.integration; import akka.actor.ActorRef; import akka.actor.ActorSystem; import akka.actor.Props; import akka.testkit.JavaTestKit; import au.com.brooms.actors.Controller; import au.com.brooms.actors.messages.ApproximationResult; import au.com.brooms.actors.messages.StartApproximation; import au.com.brooms.approximation.Approximation; import au.com.brooms.approximation.BaileyBorweinPlouffe; import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; /** * Actor system test cases to test controller, worker and result listener using different * approximation methods. * * @author brooms */ public class BBPIntegrationTest extends AbstractIntegrationTest { /** * Akka test system */ protected static ActorSystem system; @BeforeClass public static void setup() { // Initialise an actor system system = ActorSystem.create("BBP"); } @AfterClass public static void teardown() { // Clean up and shutdown JavaTestKit.shutdownActorSystem(system); system = null; } /** * Test the actor system using the Bailey-Borwein-Plouffe approximation */ @Test public void testBaileyBorweinPlouffe() { new JavaTestKit(system) {{ // Approximation method Approximation approximation = new BaileyBorweinPlouffe(); // Create the controller - the entry point to the system ActorRef controller = system.actorOf( Props.create(Controller.class, approximation, numberOfSteps, numberOfWorkers, getRef()), "controller"); // Send a start message to the controller controller.tell(new StartApproximation(), ActorRef.noSender()); // Wait for a result and extract it final ApproximationResult result = new ExpectMsg<ApproximationResult>("ApproximationResult") { @Override protected ApproximationResult match(Object o) { if (o instanceof ApproximationResult) { return ((ApproximationResult) o); } else { throw noMatch(); } } }.get(); // Some basic asserts - we should have a result and the approximation should be pretty close to Pi, // something is clearly wrong if the calculation if executes in under zero milliseconds Assert.assertNotNull(result); Assert.assertTrue(result.getApproximation() > 0); Assert.assertTrue(result.getDuration().toMillis() > 0); // Print out the results System.out.println("--------------------------------------------------------------------------------"); System.out.printf("Pi approximation (%s): %.20f%n", approximation.name(), result.getApproximation()); System.out.printf("Duration (ms): %d%n", result.getDuration().toMillis()); System.out.println("--------------------------------------------------------------------------------"); }}; } }
[ "broomheada@ONE7-3898SN1.au.fjanz.com" ]
broomheada@ONE7-3898SN1.au.fjanz.com
479ce774d6996cd5b9955538e896ac5840d1d1be
a922301f2c77d5fc2db595c561f251b3f0ddf029
/RecuperacionJunio/src/clases/Jugadores.java
50e78cec870bc2bd7924f11ab6bcdf5cedeeb82c
[]
no_license
amanuelbenallid/RecuperacionFINAL
b4a3d657d8c37192779a09bf14b810e8e23b0179
a95f15aad5b2a0540f7380546a0fafcbfae3dcfc
refs/heads/master
2023-08-02T19:27:49.097568
2020-05-03T18:26:42
2020-05-03T18:26:42
260,993,055
0
0
null
2023-07-23T14:47:18
2020-05-03T18:19:31
Java
UTF-8
Java
false
false
1,114
java
package clases; public class Jugadores { private int equipo,id; private String nombre,apellidos,dni,direccion; public int getEquipo() { return equipo; } public void setEquipo(int equipo) { this.equipo = equipo; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getNombre() { return nombre; } public Jugadores( int id, String nombre, String apellidos, String dni, String direccion,int equipo) { super(); this.equipo = equipo; this.id = id; this.nombre = nombre; this.apellidos = apellidos; this.dni = dni; this.direccion = direccion; } public void setNombre(String nombre) { this.nombre = nombre; } public String getApellidos() { return apellidos; } public void setApellidos(String apellidos) { this.apellidos = apellidos; } public String getDni() { return dni; } public void setDni(String dni) { this.dni = dni; } public String getDireccion() { return direccion; } public void setDireccion(String direccion) { this.direccion = direccion; } }
[ "noreply@github.com" ]
amanuelbenallid.noreply@github.com
2594caf5cdbd91edca019a7576ae0f3b57ca5880
3838af469dd9ec5e3264e2eb51fdcfd4ae94f659
/app/src/main/java/com/example/huan/myanimation/utils/Tearing.java
3e5c42ae63431cdec2c2a50297d9bf32f9f5560a
[]
no_license
squirrelhuan/MyAnimation
23083747be0fc59aa2023086a685064bc3345bbb
f1b31dc4590761bee48c431e478ccf5331992d25
refs/heads/master
2021-07-18T19:50:09.243869
2017-10-25T06:20:11
2017-10-25T06:20:11
108,228,308
1
0
null
null
null
null
UTF-8
Java
false
false
8,895
java
package com.example.huan.myanimation.utils; import android.animation.ValueAnimator; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Path; import android.graphics.PointF; import android.util.Log; import android.view.View; import android.view.animation.AccelerateInterpolator; import android.view.animation.DecelerateInterpolator; import com.example.huan.myanimation.view.AnimationViewGroup; import java.util.ArrayList; import java.util.List; import java.util.Random; /** * 撕裂效果 * Created by huan on 2017/10/20. */ public class Tearing extends Animator { private int partCount = 6; public int getPartCount() { return partCount; } public void setPartCount(int partCount) { cell_width = partCount != 0 ? width / partCount : 1; Random random = new Random(); Log.i("cgq", "cell_width=" + cell_width); //初始化数据 pointFs.clear(); for (int i = 0; i < partCount; i++) { if (i == 0) { pointFs.add(new PointF(width / 2, 0)); } else { PointF pointF = pointFs.get(i - 1); int a = height / partCount; Log.i("cgq", "a=" + a); float b = a / 3 + random.nextInt(a * 2 / 3); float c = random.nextInt(100) + width / 2; PointF pointFc = new PointF(c, pointF.y + b); pointFs.add(pointFc); } } float h2 = pointFs.get(partCount - 1).y; if (h2 < height) { for (int j = 0; j < partCount; j++) { PointF pointF = pointFs.get(0); pointF.y = pointF.y * (height / h2); pointFs.add(pointF); pointFs.remove(0); } } Log.i("cgq", "width=" + width + ",cell_width=" + cell_width); this.partCount = partCount; } private float cell_width; public Tearing(int partCount) { this.partCount = partCount; } @Override public void init(int w, int h) { super.init(w, h); setPartCount(partCount); mCanvas.setBitmap(((AnimationViewGroup) targetView).mBitmap); } private ValueAnimator scaleAnimation; private float scale_start = 0;//初始值 private int indexOfAnimation = 0;//当前动画 @Override public void start() { scaleAnimation = valueAnimator.ofFloat(scale_start, 1); scaleAnimation.setDuration(3000); scaleAnimation.setRepeatCount(0); scaleAnimation.setInterpolator(new DecelerateInterpolator()); scaleAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { mFactor = (float) valueAnimator.getAnimatedValue(); setdata(); indexOfAnimation = 1;//切换成第二个动画 ((View) targetView).invalidate(); } }); scaleAnimation.addListener(new android.animation.Animator.AnimatorListener() { @Override public void onAnimationStart(android.animation.Animator animator) { } @Override public void onAnimationEnd(android.animation.Animator animator) { indexOfAnimation = 0;//切换成第1个动画 valueAnimator.start(); } @Override public void onAnimationCancel(android.animation.Animator animator) { } @Override public void onAnimationRepeat(android.animation.Animator animator) { } }); valueAnimator = ValueAnimator.ofFloat(0, 1); valueAnimator.setInterpolator(new AccelerateInterpolator()); // valueAnimator.setInterpolator(new LinearInterpolator()); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { mFactor = (float) valueAnimator.getAnimatedValue(); setdata(); ((View) targetView).invalidate(); } }); valueAnimator.setDuration(2000); valueAnimator.setRepeatCount(0); animatorListener = new android.animation.Animator.AnimatorListener() { @Override public void onAnimationStart(android.animation.Animator animator) { indexOfAnimation = 0; } @Override public void onAnimationEnd(android.animation.Animator animator) { scaleAnimation.start(); } @Override public void onAnimationCancel(android.animation.Animator animator) { } @Override public void onAnimationRepeat(android.animation.Animator animator) { } }; if (animatorListener != null) { valueAnimator.addListener(animatorListener); } valueAnimator.start(); } /** * 用作刷新数据 * * @param value */ @Override public void reData(float value) { } private Canvas mCanvas = new Canvas(); private List<PointF> pointFs = new ArrayList<>(); private int strokeWidth =3; @Override public void reDraw(Canvas canvas) { switch (indexOfAnimation) { case 0://第一个动画 (targetView).dispatchDrawH(mCanvas); Paint paint = new Paint(); Path path = new Path(); int x0 = (int) (width / 2); int y0 = (int) (0); path.moveTo((float) x0, (float) y0); for (int i = 0; i < partCount*mFactor; i++) { path.lineTo(pointFs.get(i).x, pointFs.get(i).y);//左上 } for (int i = 1; i <=partCount*mFactor; i++) { path.lineTo(pointFs.get((int)(partCount*mFactor) - i).x + strokeWidth, pointFs.get((int)(partCount*mFactor) - i).y);//左上 } path.lineTo(x0, y0); //Log.i("cgq", "path=" + path.g); //先将canvas保存 canvas.save(); //设置为在圆形区域内绘制 // canvas.clipPath(path_left); //canvas.translate( (float)-(width * mFactor),0); //绘制Bitmap canvas.drawBitmap(targetView.mBitmap, 0, 0, paint); Paint paint1 =new Paint(); paint1.setColor(Color.WHITE); canvas.drawPath(path, paint1); //canvas.clipPath(width); //恢复Canvas canvas.restore(); break; case 1://第二个动画 reDraw2(canvas); break; } } public void reDraw2(Canvas canvas) { (targetView).dispatchDrawH(mCanvas); Paint paint = new Paint(); Path path = new Path(); Path path_left = new Path(); Path path_right = new Path(); int x0 = (int) (width / 2); int y0 = (int) (0); path.moveTo((float) x0, (float) y0); path_left.moveTo(0,0); path_right.moveTo(width,height); for (int i = 0; i < partCount; i++) { path.lineTo(pointFs.get(i).x, pointFs.get(i).y);//左上 path_left.lineTo(pointFs.get(i).x-(width * mFactor), pointFs.get(i).y); } for (int i = 0; i < partCount; i++) { path.lineTo(pointFs.get(partCount - 1 - i).x + strokeWidth, pointFs.get(partCount - 1 - i).y);//左上 path_right.lineTo(pointFs.get(partCount - 1 - i).x + strokeWidth+(width * mFactor), pointFs.get(partCount - 1 - i).y);//左上 } path.lineTo(x0, y0); path_left.lineTo(0,height); path_left.lineTo(0,0); path_right.lineTo(width,0); path_right.lineTo(width,height); //Log.i("cgq", "path=" + path.g); //先将canvas保存 canvas.save(); //设置为在圆形区域内绘制 canvas.clipPath(path_left); canvas.translate( (float)-(width * mFactor),0); //绘制Bitmap canvas.drawBitmap(targetView.mBitmap, 0, 0, paint); //canvas.drawLine(0, 0, width, height, new Paint()); // Paint paint1 = new Paint(); //paint1.setStrokeWidth(10); //paint1.setColor(Color.CYAN); //canvas.drawPath(path, paint1); //恢复Canvas canvas.restore(); //先将canvas保存 canvas.save(); canvas.clipPath(path_right); canvas.translate( (float)(width * mFactor),0); //绘制Bitmap canvas.drawBitmap(targetView.mBitmap, 0, 0, paint); } }
[ "you@example.com" ]
you@example.com
33d68c84b9068b11a5e110f869ceea8254ad8065
ddb5769f087a51ac369255407679c0e016d0c68c
/chapter4/src/main/java/ch4/AppConfig.java
604a5eb543033d7c8ddfe6f5fbf280023657e3e1
[]
no_license
newfobject/proSpring5
1b5243a15c6b1eabbbb17470341895e63244da7c
81eeb95f002616b260c246857b6f8bf8c557a3da
refs/heads/master
2020-03-12T02:24:17.398445
2018-10-09T20:17:24
2018-10-09T20:17:24
130,401,617
0
0
null
null
null
null
UTF-8
Java
false
false
914
java
package ch4; import ch2.MessageProvider; import ch2.MessageRenderer; import ch2.StandardOutMessageRenderer; import ch3.xml.ConfigurableMessageProvider; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.*; import org.springframework.core.env.Environment; @Configuration @PropertySource(value = "classpath:message.properties") public class AppConfig { @Autowired Environment env; @Bean @Lazy public MessageProvider messageProvider() { return new ConfigurableMessageProvider(env.getProperty("message")); } @Bean(name = "messageRenderer") @Scope(value = "prototype") @DependsOn(value = "messageProvider") public MessageRenderer messageRenderer() { MessageRenderer renderer = new StandardOutMessageRenderer(); renderer.setMessageProvider(messageProvider()); return renderer; } }
[ "alexejchekalov@yandex.ru" ]
alexejchekalov@yandex.ru
3c912d20df7abae5c5fb25946ee6b313b3da333f
ff1778cff8bc9af8586ffa6094482fa61ee30e0d
/ERP/src/java/com/spring/Model/Segment.java
de65c494cd8ba89f3765fe9694ec3a66b2d6c26b
[]
no_license
Chakravarthe/ERP
f906aa41f11b365bcf76f1a59e0d60902665aff7
b60f6a6e77026f73a5f95bedc6e5bdf462a02d81
refs/heads/master
2022-09-06T23:13:59.855195
2020-06-03T07:39:57
2020-06-03T07:39:57
269,020,143
0
0
null
null
null
null
UTF-8
Java
false
false
888
java
package com.spring.Model; import java.util.Date; import com.andromeda.commons.model.BaseModel; public class Segment extends BaseModel { private static long serialVersionUID = 1L; public String segment_name; public String segment_id; public boolean status; public static long getSerialVersionUID() { return serialVersionUID; } public static void setSerialVersionUID(long serialVersionUID) { Segment.serialVersionUID = serialVersionUID; } public String getSegment_name() { return segment_name; } public void setSegment_name(String segment_name) { this.segment_name = segment_name; } public String getSegment_id() { return segment_id; } public void setSegment_id(String segment_id) { this.segment_id = segment_id; } public boolean isStatus() { return status; } public void setStatus(boolean status) { this.status = status; } }
[ "chakravarthi.k111@gmail.com" ]
chakravarthi.k111@gmail.com
fe2998b2d66112d9be2583d36dc5af5a9b8581d4
52e5d515288f9888ca1b57174ba37ce8d324c59f
/JAVA/LabWork/src/bubbleSort/BubbleSort.java
393e2a57776314b99a09894d070487076e10e2aa
[]
no_license
sheikhafsar/1725_OOP
c26afb690f9f2d06840068c496975c2beb23b278
f04955bb7b9e4cf7af8d67cef27880c133f9bfb3
refs/heads/master
2020-03-22T15:44:34.879204
2018-10-31T20:03:52
2018-10-31T20:03:52
140,274,187
0
0
null
null
null
null
UTF-8
Java
false
false
649
java
package bubbleSort; public class BubbleSort { public static Integer[] sort(Integer data[]) { System.out.print("Before Sort::"); printArray(data); for(int i = 0; i < data.length; i++) { for(int j = 0; j < i; j++) { if(data[i] < data[j]) { data[i] += data[j]; data[j] = data[i] - data[j]; data[i] = data[i] - data[j]; } } } System.out.print("After Sort::"); printArray(data); return data; } public static void printArray(Integer data[]) { for(int i = 0; i < data.length; i++) { System.out.print("..." + data[i]); } System.out.println(); } public BubbleSort(String name, String date) { } }
[ "sheikhafsar72@gmail.com" ]
sheikhafsar72@gmail.com
55f8ad052d6390e9824547787bf75ae401e55170
0f4e12895326885e98008a8bb3f715cf73a5c01c
/src/university/faculty/TestDepartment.java
6d8ebdee0d32e402d22da7835161c4811f351073
[]
no_license
oykuzeynep/LYK2016
696ea7b899d2654f0028d04554d4dbb80e329592
3cd7f2bc841a3e42f1f8637735eaec936fc99af0
refs/heads/master
2020-05-29T15:16:05.779396
2016-08-17T09:03:05
2016-08-17T09:03:05
65,748,879
0
0
null
null
null
null
UTF-8
Java
false
false
347
java
package university.faculty; import university.Student; public class TestDepartment { public static void main(String args[]) { Department dept1 = new Department("Computer Engineering", "Engineering"); Student stu2 = new Student("ZEYNEP", "04999", "Fall", 2014); dept1.appendStudent(stu2); System.out.println(dept1); } }
[ "oykuzeynepbayramoglu@gmail.com" ]
oykuzeynepbayramoglu@gmail.com
953f07f52e3253d6be01f55412130322ada355e5
7de9fee1e4838d149dec487dddd6a8bdeda1d68e
/0705/src/main/java/sesoc/global/test/service/NoticeService.java
cce9891a1db2b41df039a4f41aba3fb27098fc08
[]
no_license
yoonsanghyeok/git_test
eb5ccd8dafa47a47a082f645b09b1c4511f019da
d7cc3433f59d571215600653f1fa166ff450e3eb
refs/heads/master
2021-01-01T03:58:59.197672
2017-07-31T02:20:57
2017-07-31T02:20:57
97,097,936
0
0
null
null
null
null
UTF-8
Java
false
false
1,134
java
package sesoc.global.test.service; import java.util.List; import java.util.Map; import org.apache.ibatis.session.RowBounds; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import sesoc.global.test.dao.NoticeRepository; import sesoc.global.test.vo.Notice; @Service public class NoticeService{ @Autowired NoticeRepository repo; public int getNoticeCount(Map<String, String> search) { return repo.getNoticeCount(search); } public List<Notice> selectAll(Map<String, String> search, int startRecord, int countPerPage) { RowBounds rb = new RowBounds(startRecord, countPerPage); return repo.selectAll(search, rb); } public void insertNotice(Notice notice) { repo.insertNotice(notice); } public Notice selectOne(int noticenum) { return repo.selectOne(noticenum); } public void increaseHits(int noticenum) { repo.increaseHits(noticenum); } public void updateNotice(Notice notice) { repo.updateNotice(notice); } public void deleteNotice(int noticenum) { repo.deleteNotice(noticenum); } }
[ "yoonsanghyeok@naver.com" ]
yoonsanghyeok@naver.com
579140b36e9d29161b262193dcc7b3a6ec9ea9de
90ce9a371b3069bee7322c191977cab681299dad
/ZJAOthelloProject/src/othello/Move.java
f3d9405cc0db91ecfd0ae3ed8c4fff384f4b7b29
[]
no_license
zjalleman/ZJAOthelloProject
57355e832ef50948eba34b4468e7dfb2a1e80612
a4b6387d44d1530c640c30ff0cdb3aac7031bf71
refs/heads/master
2020-12-02T05:00:40.421456
2016-08-30T15:23:12
2016-08-30T15:23:12
66,953,032
0
0
null
null
null
null
UTF-8
Java
false
false
396
java
/** * Zachary Alleman * CSCI 373.002 Artificial Intelligence * Othello Assignment * */ package othello; public class Move { String[] moveStr; double value; public Move(String m) { moveStr = m.split(" "); /*for (int i = 0; i < moveStr.length; i++) { System.out.print(moveStr[i]); }*/ } public Move() { } }
[ "zelophore@gmail.com" ]
zelophore@gmail.com
4aaeddc9ed5844a94622415dc04f7e80a97e730e
98464e0283ab4dc510ba1faffe42a230a84f0b17
/src/main/java/service/RoomInformation.java
7606dd74f57b8382b4ef8797d7396d8931677d88
[]
no_license
hellofwy/DouyuBarrageTool
595ab4fa3f34d103c7835caaca3efaf468a5c63d
10bee0394d36b4937d440c9966cb5b01cf76aec6
refs/heads/master
2020-12-26T05:01:54.505246
2016-01-07T13:41:20
2016-01-07T13:41:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,332
java
package service; import controller.GroupIdThread; import domain.ServerConfig; import org.codehaus.jackson.map.ObjectMapper; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import java.io.IOException; import java.net.URLDecoder; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * 获得roomId,groupId信息 * * @author ndrlslz */ public class RoomInformation { private HttpClient httpClient = new HttpClient(); private String html; private String gid; public String getGid() { return gid; } public void setGid(String gid) { this.gid = gid; } public RoomInformation() { html = httpClient.doGet(Config.getDouyu() + "/" + Config.getRoomId()); } public String get(String groupId) { return groupId; } public String getGroupId() throws IOException, InterruptedException { new Thread(new GroupIdThread(this)).start(); while (true) { if (getGid() != null) { return gid; } Thread.sleep(1000); //分配时间给GroupId线程,避免while循环抢占时间 } } public ServerConfig getServerConfig() throws IOException { String REGEX = "server_config\":\"(.*?)\""; Pattern pattern = Pattern.compile(REGEX); Matcher matcher = pattern.matcher(html); if (matcher.find()) { String json = URLDecoder.decode(matcher.group(1), "utf-8"); ObjectMapper mapper = new ObjectMapper(); List<ServerConfig> list = mapper.readValue(json, mapper.getTypeFactory().constructParametricType(ArrayList.class, ServerConfig.class)); return list.get(0); } return null; } public String getRoomIdByNickname() { Document doc = Jsoup.parse(html); Element element = doc.select("#feedback_report_button").first(); String href = element.attr("href"); if (href != null) { return href.split("=")[1]; } return null; } public String getRoomId() { String roomId = Config.getRoomId(); if (!roomId.matches("[0-9]+")) { roomId = getRoomIdByNickname(); } return roomId; } }
[ "ndrlslz@163.com" ]
ndrlslz@163.com
c2ba830bc4d6f535304a7a5992af07cecf04a786
fbafe9dde52e6105848f8d80db206e160b332814
/src/any/AssignChocolates.java
7c9f9b295dac81de67f87adec46b30684fa296eb
[]
no_license
vivekparekh8/CTCI_VIVEK
9fcf80f65b3869195037ccb023c4dadda111d947
86dc6611568f9e3f1ac8cb0638fe5754c95408f8
refs/heads/master
2021-01-10T01:30:45.303635
2016-04-12T05:06:42
2016-04-12T05:06:42
54,134,150
0
0
null
null
null
null
UTF-8
Java
false
false
1,340
java
package any; public class AssignChocolates { public int[] assignChocolates(int[] ages) { int[] assign = new int[ages.length]; for (int i = 0; i < ages.length; i++) { assign[i] = 1; } for (int i = 1; i < ages.length; i++) { if (ages[i] > ages[i-1]) { assign[i] = assign[i-1] + 1; } } for (int i = ages.length-2; i >= 0; i--) { if (ages[i] > ages[i+1]) { assign[i] = assign[i+1] + 1; } } return assign; } /** * @param args */ public static void main(String[] args) { int[] ages = new int[]{2, 6, 1, 3, 2, 1, 9}; AssignChocolates c = new AssignChocolates(); int[] assign = c.assignChocolates(ages); for (int i = 0; i < assign.length; i++) { System.out.print(assign[i] + " "); } } static int func(String s, char a, char b) { if (s.isEmpty()) return -1; char[] strArray = s.toCharArray(); int i = 0; int aIndex = 0; int bIndex = 0; //while () while (aIndex == 0 && bIndex == 0 && i < strArray.length) { if (strArray[i] == a) aIndex = i; if (strArray[i] == b) bIndex = i; i++; } // return aIndex ? (bIndex == 0?aIndex :Math.min(a,b)):(bIndex !=0 ?bIndex :-1); if (aIndex != 0) { if (bIndex == 0) return aIndex; else return Math.min(a, b); } else { if (bIndex != 0) return bIndex; else return -1; } } }
[ "vivekparekh8@gmail.com" ]
vivekparekh8@gmail.com
5f082dd0503c7632e07beaef40a9d05940426c63
5e1908113d37c2d6b109a5c4db64b1bd54e53b4a
/src/ReverseKGroup.java
996515bb1ccc56a63e727e02f3e38851b059f330
[]
no_license
yanshuhang/leetcode
637f57f1518f78f4c9ac2f570ce54a00700689f5
7a85ef99d1183cad5b89b8baa8dea8b1e3a2fcce
refs/heads/main
2023-07-18T19:19:14.720987
2021-09-07T05:13:14
2021-09-07T05:13:14
318,226,918
1
0
null
null
null
null
UTF-8
Java
false
false
118
java
public class ReverseKGroup { public static ListNode solution(ListNode head, int k) { return null; } }
[ "sytem.out@hotmail.com" ]
sytem.out@hotmail.com
92270ae4043bfdc59990c72f7910306ea7fa4ed2
1628113bc1ac818ccfb7191fa7633e44636ac684
/src/main/java/com/rush/ServletInitializer.java
71f602b3b7e5cd2e0b1c11e4dfaa716a0b2ed29d
[]
no_license
m1d0rf33d/rush-spring-react
9673ba173704b8af9e054683d3c8457b88586088
8390523ed0b5b22d1623a21a742833a675491a46
refs/heads/master
2021-06-18T12:48:21.827373
2017-06-02T07:34:50
2017-06-02T07:34:50
71,691,911
0
0
null
null
null
null
UTF-8
Java
false
false
451
java
package com.rush; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.support.SpringBootServletInitializer; /** * Created by aomine on 10/20/16. */ public class ServletInitializer extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(RushPosSyncApplication.class); } }
[ "evillagomesa@yondu.com" ]
evillagomesa@yondu.com
9f98f0f00329f5b00495306e9a3e5db24707276c
e304d6fe5a73b8ef068a2c6f3a039ce6c001fa9b
/src/main/java/com/social/pricing/entity/ManuFacturingCompany.java
d6aa3c990b87f51e98922698116226e596c737a0
[]
no_license
sonu91social/PricingModule
7ce8a5f66ecea7ae0e44f29737e0a624960d7c45
47078699da08869382f74353d5a429146dd4baa8
refs/heads/master
2022-12-07T20:30:02.574061
2020-08-16T12:18:49
2020-08-16T12:18:49
287,908,549
0
0
null
null
null
null
UTF-8
Java
false
false
2,138
java
package com.social.pricing.entity; import java.util.LinkedHashSet; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; @Entity @Table(name = "Manufacturer") @Data @AllArgsConstructor @NoArgsConstructor(force = true) @EqualsAndHashCode(exclude = { "frame","brake","seat","wheel","chain"}) public class ManuFacturingCompany { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; @Column(name = "company_name", unique = true) @NotBlank(message = "CompanyName Cannot be empty") private String companyName; @Fetch(FetchMode.SELECT) @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "manufacturer") @NotNull private Set<FrameCategories> frame = new LinkedHashSet<FrameCategories>(); @Fetch(FetchMode.SELECT) @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "manufacturer") @NotNull private Set<BrakeCategories> brake = new LinkedHashSet<BrakeCategories>(); @Fetch(FetchMode.SELECT) @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "manufacturer") @NotNull private Set<SeatCategories> seat =new LinkedHashSet<SeatCategories>(); @Fetch(FetchMode.SELECT) @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "manufacturer") @NotNull private Set<WheelCategories> wheel = new LinkedHashSet<WheelCategories>(); @Fetch(FetchMode.SELECT) @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "manufacturer") @NotNull private Set<ChainCategories> chain =new LinkedHashSet<ChainCategories>(); }
[ "sonukumar.75421@gmail.com" ]
sonukumar.75421@gmail.com
a13ed921e99f1c720c8617d4b5b1211b2e1cfac6
8566668fd5ac5a78b951e6d951cc07d458813a41
/src/main/java/lib/JSON/JSONWriter.java
3cf6b655b342dc2afe941a288a68b41fd8f377ba
[ "MIT" ]
permissive
jrstanWasTaken/Botnak
dea8ae275840c013da362b8f43330410e9067afe
e68e4764c85954065a56b2d57ce5dbbdc06aaf7c
refs/heads/master
2021-09-11T00:56:03.927181
2018-04-05T06:10:10
2018-04-05T06:10:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,593
java
package lib.JSON; import java.io.IOException; import java.io.Writer; /* Copyright (c) 2006 JSON.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. The Software shall be used for Good, not Evil. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * JSONWriter provides a quick and convenient way of producing JSON text. * The texts produced strictly conform to JSON syntax rules. No whitespace is * added, so the results are ready for transmission or storage. Each instance of * JSONWriter can produce one JSON text. * <p> * A JSONWriter instance provides a <code>value</code> method for appending * values to the * text, and a <code>key</code> * method for adding keys before values in objects. There are <code>array</code> * and <code>endArray</code> methods that make and bound array values, and * <code>object</code> and <code>endObject</code> methods which make and bound * object values. All of these methods return the JSONWriter instance, * permitting a cascade style. For example, <pre> * new JSONWriter(myWriter) * .object() * .key("JSON") * .value("Hello, World!") * .endObject();</pre> which writes <pre> * {"JSON":"Hello, World!"}</pre> * <p> * The first method called must be <code>array</code> or <code>object</code>. * There are no methods for adding commas or colons. JSONWriter adds them for * you. Objects and arrays can be nested up to 20 levels deep. * <p> * This can sometimes be easier than using a JSONObject to build a string. * * @author JSON.org * @version 2011-11-24 */ public class JSONWriter { private static final int maxdepth = 200; /** * The comma flag determines if a comma should be output before the next * value. */ private boolean comma; /** * The current mode. Values: * 'a' (array), * 'd' (done), * 'i' (initial), * 'k' (key), * 'o' (object). */ protected char mode; /** * The object/array stack. */ private final JSONObject stack[]; /** * The stack top index. A value of 0 indicates that the stack is empty. */ private int top; /** * The writer that will receive the output. */ protected Writer writer; /** * Make a fresh JSONWriter. It can be used to build one JSON text. */ public JSONWriter(Writer w) { this.comma = false; this.mode = 'i'; this.stack = new JSONObject[maxdepth]; this.top = 0; this.writer = w; } /** * Append a value. * * @param string A string value. * @return this * @throws JSONException If the value is out of sequence. */ private JSONWriter append(String string) throws JSONException { if (string == null) { throw new JSONException("Null pointer"); } if (this.mode == 'o' || this.mode == 'a') { try { if (this.comma && this.mode == 'a') { this.writer.write(','); } this.writer.write(string); } catch (IOException e) { throw new JSONException(e); } if (this.mode == 'o') { this.mode = 'k'; } this.comma = true; return this; } throw new JSONException("Value out of sequence."); } /** * Begin appending a new array. All values until the balancing * <code>endArray</code> will be appended to this array. The * <code>endArray</code> method must be called to mark the array's end. * * @return this * @throws JSONException If the nesting is too deep, or if the object is * started in the wrong place (for example as a key or after the end of the * outermost array or object). */ public JSONWriter array() throws JSONException { if (this.mode == 'i' || this.mode == 'o' || this.mode == 'a') { this.push(null); this.append("["); this.comma = false; return this; } throw new JSONException("Misplaced array."); } /** * End something. * * @param mode Mode * @param c Closing character * @return this * @throws JSONException If unbalanced. */ private JSONWriter end(char mode, char c) throws JSONException { if (this.mode != mode) { throw new JSONException(mode == 'a' ? "Misplaced endArray." : "Misplaced endObject."); } this.pop(mode); try { this.writer.write(c); } catch (IOException e) { throw new JSONException(e); } this.comma = true; return this; } /** * End an array. This method most be called to balance calls to * <code>array</code>. * * @return this * @throws JSONException If incorrectly nested. */ public JSONWriter endArray() throws JSONException { return this.end('a', ']'); } /** * End an object. This method most be called to balance calls to * <code>object</code>. * * @return this * @throws JSONException If incorrectly nested. */ public JSONWriter endObject() throws JSONException { return this.end('k', '}'); } /** * Append a key. The key will be associated with the next value. In an * object, every value must be preceded by a key. * * @param string A key string. * @return this * @throws JSONException If the key is out of place. For example, keys * do not belong in arrays or if the key is null. */ public JSONWriter key(String string) throws JSONException { if (string == null) { throw new JSONException("Null key."); } if (this.mode == 'k') { try { this.stack[this.top - 1].putOnce(string, Boolean.TRUE); if (this.comma) { this.writer.write(','); } this.writer.write(JSONObject.quote(string)); this.writer.write(':'); this.comma = false; this.mode = 'o'; return this; } catch (IOException e) { throw new JSONException(e); } } throw new JSONException("Misplaced key."); } /** * Begin appending a new object. All keys and values until the balancing * <code>endObject</code> will be appended to this object. The * <code>endObject</code> method must be called to mark the object's end. * * @return this * @throws JSONException If the nesting is too deep, or if the object is * started in the wrong place (for example as a key or after the end of the * outermost array or object). */ public JSONWriter object() throws JSONException { if (this.mode == 'i') { this.mode = 'o'; } if (this.mode == 'o' || this.mode == 'a') { this.append("{"); this.push(new JSONObject()); this.comma = false; return this; } throw new JSONException("Misplaced object."); } /** * Pop an array or object scope. * * @param c The scope to close. * @throws JSONException If nesting is wrong. */ private void pop(char c) throws JSONException { if (this.top <= 0) { throw new JSONException("Nesting error."); } char m = this.stack[this.top - 1] == null ? 'a' : 'k'; if (m != c) { throw new JSONException("Nesting error."); } this.top -= 1; this.mode = this.top == 0 ? 'd' : this.stack[this.top - 1] == null ? 'a' : 'k'; } /** * Push an array or object scope. * * @param jo The scope to open. * @throws JSONException If nesting is too deep. */ private void push(JSONObject jo) throws JSONException { if (this.top >= maxdepth) { throw new JSONException("Nesting too deep."); } this.stack[this.top] = jo; this.mode = jo == null ? 'a' : 'k'; this.top += 1; } /** * Append either the value <code>true</code> or the value * <code>false</code>. * * @param b A boolean. * @return this * @throws JSONException */ public JSONWriter value(boolean b) throws JSONException { return this.append(b ? "true" : "false"); } /** * Append a double value. * * @param d A double. * @return this * @throws JSONException If the number is not finite. */ public JSONWriter value(double d) throws JSONException { return this.value(new Double(d)); } /** * Append a long value. * * @param l A long. * @return this * @throws JSONException */ public JSONWriter value(long l) throws JSONException { return this.append(Long.toString(l)); } /** * Append an object value. * * @param object The object to append. It can be null, or a Boolean, Number, * String, JSONObject, or JSONArray, or an object that implements JSONString. * @return this * @throws JSONException If the value is out of sequence. */ public JSONWriter value(Object object) throws JSONException { return this.append(JSONObject.valueToString(object)); } }
[ "nkerns25@yahoo.com" ]
nkerns25@yahoo.com
3cadc1ea761b5277f8beb43908558754100b60a5
82e5d9862df4cf11905027c595c0bc9e222869ea
/Student.java
1096bc3f47c5d8f4c79b6199b2a1c3b8345374bc
[]
no_license
LeonardoTo1/InClass1
7eb6208dde1bb634a9944f8b4087a1642654cd6a
15c851c03b0fb807e6e0d1084608ba4a47982dfd
refs/heads/master
2020-08-17T05:46:01.974793
2019-10-16T19:43:14
2019-10-16T19:43:14
215,618,527
0
0
null
null
null
null
UTF-8
Java
false
false
617
java
public class Student extends Person implements Comparable<Student>{ private static final int INITIAL_RATING = 5; private String className; private Integer rating; public Student() throws NameException { super(); rating = INITIAL_RATING; } public Student(String firstName, String lastName, Integer rating) throws NameException { super(firstName, lastName); this.rating = rating; } @Override public int compareTo(Student o) { return rating - o.getRating(); } public Integer getRating() { return new Integer(rating); } }
[ "noreply@github.com" ]
LeonardoTo1.noreply@github.com
5f6ac343cff038099d2ebd38ac2cf08bdf1018ff
f2638cfa5bf899ae7bf537acece9d16d74712cc7
/upgrade/src/main/java/datetime/DurationExamples.java
1c85ab405f71bcc10a2eee6a31cb5d4b3619707c
[]
no_license
kaminski-tomasz/ocjp
3789af42601bdd5bc4418eb1ff03f137325fa6fd
13361031602342421140d22ac4c3e38960e9e186
refs/heads/master
2021-09-09T09:11:58.992151
2018-03-14T16:34:35
2018-03-14T16:34:35
29,933,486
0
1
null
null
null
null
UTF-8
Java
false
false
2,930
java
package datetime; import java.time.Duration; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.time.temporal.ChronoUnit; public class DurationExamples { private static void print(Object obj) { System.out.println(obj); } public static void main(String[] args) { print("Constructing durations with static factories"); Duration daily = Duration.ofDays(1); print(daily); Duration hourly = Duration.ofHours(1); print(hourly); Duration everyMinute = Duration.ofMinutes(1); print(everyMinute); Duration everyTenSecond = Duration.ofSeconds(10); print(everyTenSecond); Duration everyMilli = Duration.ofMillis(1); print(everyMilli); Duration everyNano = Duration.ofNanos(1); print(everyNano); Duration duration = Duration.ofSeconds(3 * 3600 + 15 * 60 + (long)30); // PT3H15M30S print(duration); print("\nConstructing durations with ChronoUnit"); daily = Duration.of(1, ChronoUnit.DAYS); print(daily); hourly = Duration.of(1, ChronoUnit.HOURS); print(hourly); everyMinute = Duration.of(1, ChronoUnit.MINUTES); print(everyMinute); everyTenSecond = Duration.of(10, ChronoUnit.SECONDS); print(everyTenSecond); everyMilli = Duration.of(1, ChronoUnit.MILLIS); print(everyMilli); everyNano = Duration.of(1, ChronoUnit.NANOS); print(everyNano); Duration halfDay = Duration.of(1, ChronoUnit.HALF_DAYS); // 12h print(halfDay); print("\nDuration between temporal values"); LocalTime one = LocalTime.of(5, 15); LocalTime two = LocalTime.of(6, 30); LocalDate date = LocalDate.of(2016, 1, 20); print(ChronoUnit.HOURS.between(one, two)); // obcina minuty (zostawia pelne godziny) print(ChronoUnit.HOURS.between(two, one)); print(ChronoUnit.MINUTES.between(one, two)); // java.time.DateTimeException: Unable to obtain LocalTime from TemporalAccessor: // 2016-01-20 of type java.time.LocalDate // print(ChronoUnit.MINUTES.between(one, date)); print("\nAdding duration"); date = LocalDate.of(2016, 1, 20); LocalTime time = LocalTime.of(6, 15); LocalDateTime dateTime = LocalDateTime.of(date, time); Duration duration2 = Duration.ofHours(6); print(dateTime.plus(duration2)); print(time.plus(duration2)); // java.time.temporal.UnsupportedTemporalTypeException: Unsupported unit: Seconds // print(date.plus(duration2)); Duration duration3 = Duration.ofHours(23); print(dateTime.plus(duration3)); print(time.plus(duration3)); // java.time.temporal.UnsupportedTemporalTypeException: Unsupported unit: Seconds // print(date.plus(duration3)); } }
[ "kaminski.tomasz.a@gmail.com" ]
kaminski.tomasz.a@gmail.com
027eceb7e0e0f042a76586c44277ca7e5f2c03d5
bb04913698b56313adabd1117f4d2bae1152fd8e
/app/src/main/java/sugoi/android/amazfun/core/users/add/AddUserPresenter.java
507ff0e4e363b403b1eefc0e91e960084747fb8d
[]
no_license
salmanma6/AmazFun-master
eb457cf7a5fd1665408c9db604f40462e42662fd
8a3b2708f4f36ef045da34c6b831c0f0bcaf23e9
refs/heads/master
2020-03-26T12:28:12.497773
2019-03-26T17:44:24
2019-03-26T17:44:24
144,894,027
1
0
null
null
null
null
UTF-8
Java
false
false
849
java
package sugoi.android.amazfun.core.users.add; import android.content.Context; import com.google.firebase.auth.FirebaseUser; public class AddUserPresenter implements AddUserContract.Presenter, AddUserContract.OnUserDatabaseListener { private AddUserContract.View mView; private AddUserInteractor mAddUserInteractor; public AddUserPresenter(AddUserContract.View view) { this.mView = view; mAddUserInteractor = new AddUserInteractor(this); } @Override public void addUser(Context context, FirebaseUser firebaseUser) { mAddUserInteractor.addUserToDatabase(context, firebaseUser); } @Override public void onSuccess(String message) { mView.onAddUserSuccess(message); } @Override public void onFailure(String message) { mView.onAddUserFailure(message); } }
[ "salmanma6@gmail.com" ]
salmanma6@gmail.com
456597a0f1acb3dd610df92b7dfc5bc14e19a4e2
ccb244e6d80d8e32ceb72924c38c9cf099767486
/web/src/main/java/lv/odylab/evemanage/client/event/QuickCalculatorTabActionCallback.java
a44075537bc6425ca11bb7c3abe3699df46d1c47
[]
no_license
EVE-SECURE/evemanage
52c8ab3f92709b09a3d990dfec759b5b04d0ee0f
dd293fd0babc4a302333f782a64218c3d3f10443
refs/heads/master
2021-01-19T14:07:26.150049
2012-04-14T17:07:29
2012-04-14T17:07:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
943
java
package lv.odylab.evemanage.client.event; import com.google.gwt.event.shared.EventBus; import lv.odylab.evemanage.client.EveManageConstants; import lv.odylab.evemanage.client.event.error.QuickCalculatorTabErrorEvent; import lv.odylab.evemanage.client.tracking.TrackingManager; public abstract class QuickCalculatorTabActionCallback<T> extends ActionCallback<T> { private EventBus eventBus; private TrackingManager trackingManager; private EveManageConstants constants; public QuickCalculatorTabActionCallback(EventBus eventBus, TrackingManager trackingManager, EveManageConstants constants) { this.eventBus = eventBus; this.trackingManager = trackingManager; this.constants = constants; } @Override public void onFailure(Throwable throwable) { eventBus.fireEvent(new QuickCalculatorTabErrorEvent(trackingManager, constants, throwable.getMessage())); } }
[ "vleushin@gmail.com@f1d34e3a-bfac-f34a-777b-39c946d3c925" ]
vleushin@gmail.com@f1d34e3a-bfac-f34a-777b-39c946d3c925
cdc50addd8399166af7fb3547450d2810d4baa1b
8dbea6cfa5142503e57fdca7d82bec9763a1b5f7
/read-file/src/main/java/com/dakai/readfile/domain/UserVo.java
00d9e8f8b753a0e6d60da8099a49b534ab753cf2
[]
no_license
nsyncxy1/configweb
9cbcc6db2e94bcceaf4599eeb6200d336c2050d9
129696679579b83dc0ee61e6a3dd2c8d78689523
refs/heads/main
2023-09-04T11:41:30.108028
2021-11-01T05:45:49
2021-11-01T05:45:49
416,645,294
0
0
null
null
null
null
UTF-8
Java
false
false
147
java
package com.dakai.readfile.domain; import lombok.Data; @Data public class UserVo { String username; String password; String token; }
[ "61077504@qq.com" ]
61077504@qq.com
2b04e131b3a7101cad1bbd09b1a2b8819a2f5e90
f43504b11e935796128f07ab166e7d47a248f204
/Low_level_Problem_set_2/cache/dao/DefaultLevelCache.java
462b50e069becf54aed4996fc42aeea312dca5e7
[]
no_license
vish35/LLD
4e3b4b6a22e334e1ab69871e5ded526613bb73f8
1d8f209213f74395fc1121a5862ce2a467b09f94
refs/heads/main
2023-07-30T09:10:39.696754
2021-09-15T05:46:45
2021-09-15T05:46:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,835
java
package cache.dao; import cache.model.LevelCacheData; import cache.model.ReadResponse; /** * @author priyamvora * @created 03/05/2021 */ public class DefaultLevelCache<Key, Value> { private final LevelCacheData levelCacheData; private final CacheDao<Key, Value> cache; private DefaultLevelCache<Key, Value> next; public DefaultLevelCache(LevelCacheData levelCacheData, CacheDao<Key, Value> cache) { this.levelCacheData = levelCacheData; this.cache = cache; } public void setNext(DefaultLevelCache<Key, Value> next) { this.next = next; } public void debug() { System.out.println(cache); if (next != null) { next.debug(); } } // L1(read time, write time) -> L2 -> L3 public Integer set(Key key, Value value) { Integer currTime = 0; Value currentValue = cache.get(key); currTime += levelCacheData.getReadTime(); if (currentValue == null || !currentValue.equals(value)) { cache.put(key, value); currTime += levelCacheData.getWriteTime(); } if (next != null) { currTime += next.set(key, value); } return currTime; } public ReadResponse<Value> get(Key key) { Integer currTime = 0; Value currentValue = cache.get(key); currTime += levelCacheData.getReadTime(); if (currentValue == null) { ReadResponse<Value> readResponse = next.get(key); currTime += readResponse.getTimeTaken(); currentValue = readResponse.getValue(); if (currentValue != null) { cache.put(key, currentValue); currTime += levelCacheData.getWriteTime(); } } return new ReadResponse<>(currentValue, currTime); } }
[ "gowtkum@amazon.com" ]
gowtkum@amazon.com
8054b20f87c3736782dd944635a40ca0138e68d5
7567b1224e67d65f44dc990de72fc88fcd443f18
/englishlearn/src/main/java/tool/T1.java
9f742b61f913f162019cacda6c1192b0c0fe69f1
[]
no_license
xjesse/learn-english
8a5b3ad603fbe9f522d6866beae0fca7a03e0751
c42bcfb2ca7850e2e878bb4e37806554bb1491a5
refs/heads/master
2021-01-19T03:46:52.105792
2018-01-10T13:10:57
2018-01-10T13:10:57
84,414,315
0
1
null
null
null
null
UTF-8
Java
false
false
20,222
java
package tool; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.net.InetAddress; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Timestamp; import java.util.ArrayList; import java.util.Properties; import org.apache.commons.dbcp2.BasicDataSource; import org.apache.log4j.Logger; import org.apache.log4j.PropertyConfigurator; import mian.Mianwindow; /**关于数据库的工具类 * */ public class T1 { static final String JDBC_DRIVER="com.mysql.jdbc.Driver"; static final String DB_URL="jdbc:mysql://localhost:3306/english?" + "characterEncoding=utf8&useSSL=false&useCursorFetch=true"; static final String USER="root"; static final String PASSWORD="123qwe"; public static void dbpoolInit(){ BasicDataSource ds = new BasicDataSource(); ds.setUrl(DB_URL); ds.setDriverClassName(JDBC_DRIVER); ds.setUsername(USER); ds.setPassword(PASSWORD); } public static ArrayList<String> getinworld () throws ClassNotFoundException{ Connection conn=null; PreparedStatement ptmt=null; ResultSet rs=null; ArrayList<String> word1 =new ArrayList<String>(); //1.装载驱动程序 Class.forName(JDBC_DRIVER); //2.建立链接 try { conn=DriverManager.getConnection(DB_URL, USER, PASSWORD); //3、执行sql语句 ptmt=conn.prepareStatement("select * from dictionary where inword=1"); ptmt.setFetchSize(2); rs=ptmt.executeQuery(); while (rs.next()){ word1.add(rs.getString("english")); } } catch (SQLException e) { e.printStackTrace(); }finally{ //5 清理 try { if(conn!=null) conn.close(); if(ptmt!=null) ptmt.close(); if(rs!=null) rs.close(); } catch (SQLException e) { } } return word1; } public static ArrayList<String> getnowworld () throws ClassNotFoundException{ Connection conn=null; PreparedStatement ptmt=null; ResultSet rs=null; ArrayList<String> word1 =new ArrayList<String>();//�ѻᵥ�� //1.装载驱动程序 Class.forName(JDBC_DRIVER); //2.建立链接 try { conn=DriverManager.getConnection(DB_URL, USER, PASSWORD); //3、执行sql语句 ptmt=conn.prepareStatement("select * from dictionary where nowword=1"); ptmt.setFetchSize(2); rs=ptmt.executeQuery(); //执行结果 while (rs.next()){ // System.out.println(rs.getString("id")+": "+rs.getString("inword")); // word1.add(rs.getString("nowword")); word1.add(rs.getString("english")); } } catch (SQLException e) { e.printStackTrace(); }finally{ //5 清理 try { if(conn!=null) conn.close(); if(ptmt!=null) ptmt.close(); if(rs!=null) rs.close(); } catch (SQLException e) { } } return word1; } public static String searchWords (String english) throws ClassNotFoundException{ Connection conn=null; PreparedStatement ptmt=null; ResultSet rs=null; String word1 =new String(); //1.装载驱动程序 Class.forName(JDBC_DRIVER); //2.建立链接 try { conn=DriverManager.getConnection(DB_URL, USER, PASSWORD); //3、执行sql语句 ptmt=conn.prepareStatement("select * from dictionary where english=?"); ptmt.setString(1, english); ptmt.setFetchSize(2); rs=ptmt.executeQuery(); //执行结果 while (rs.next()){ word1=rs.getString("chinese"); } if(word1.length()==0){ word1="没有查到"; } } catch (SQLException e) { e.printStackTrace(); }finally{ //5 清理 try { if(conn!=null) conn.close(); if(ptmt!=null) ptmt.close(); if(rs!=null) rs.close(); } catch (SQLException e) { } } return word1; } @SuppressWarnings("resource") public void removeinword (String word) throws ClassNotFoundException{ Connection conn=null; PreparedStatement ptmt=null; ResultSet rs=null; //1.装载驱动程序 Class.forName(JDBC_DRIVER); //2.建立链接 try { conn=DriverManager.getConnection(DB_URL, USER, PASSWORD); //3、执行sql语句 ptmt=conn.prepareStatement("select * from inword where inword=? "); ptmt.setString(1, word); rs=ptmt.executeQuery(); int id = -1; while (rs.next()){ id=rs.getInt("id"); } System.out.println(id); ptmt=conn.prepareStatement("delete from inword where id=? "); ptmt.setInt(1, id); ptmt.execute(); ptmt=conn.prepareStatement("update inword set id=id-1 where id>=? ", id); ptmt.setInt(1, id); // ptmt.setFetchSize(2); // rs=ptmt.executeQuery(); ptmt.execute(); conn.commit(); //执行结果 // while (rs.next()){ // System.out.println(rs.getString("UserName")+": "+rs.getString("CourseName")); // } } catch (SQLException e) { e.printStackTrace(); }finally{ //5 清理 try { if(conn!=null) conn.close(); if(ptmt!=null) ptmt.close(); } catch (SQLException e) { } } } public static void insertinword (String word) throws ClassNotFoundException{ Connection conn=null; PreparedStatement ptmt=null; //1.装载驱动程序 Class.forName(JDBC_DRIVER); //2.建立链接 try { conn=DriverManager.getConnection(DB_URL, USER, PASSWORD); //3、执行sql语句 ptmt=conn.prepareStatement("insert into inword (inword,time) values (?,0)"); ptmt.setString(1, word); ptmt.execute(); conn.commit(); //执行结果 } catch (SQLException e) { e.printStackTrace(); }finally{ //5 清理 try { if(conn!=null) conn.close(); if(ptmt!=null) ptmt.close(); } catch (SQLException e) { } } } @SuppressWarnings("resource") public static void removenowword (String word) throws ClassNotFoundException{ Connection conn=null; PreparedStatement ptmt=null; ResultSet rs=null; //1.装载驱动程序 Class.forName(JDBC_DRIVER); //2.建立链接 try { conn=DriverManager.getConnection(DB_URL, USER, PASSWORD); //3、执行sql语句 ptmt=conn.prepareStatement("select * from nowword where nowword=? "); ptmt.setString(1, word); rs=ptmt.executeQuery(); int id = -1; while (rs.next()){ id=rs.getInt("id"); } System.out.println(id); ptmt=conn.prepareStatement("delete from nowword where id=? "); ptmt.setInt(1, id); ptmt.execute(); ptmt=conn.prepareStatement("update nowword set id=id-1 where id>=? ", id); ptmt.setInt(1, id); // ptmt.setFetchSize(2); // rs=ptmt.executeQuery(); ptmt.execute(); conn.commit(); //执行结果 // while (rs.next()){ // System.out.println(rs.getString("UserName")+": "+rs.getString("CourseName")); // } } catch (SQLException e) { e.printStackTrace(); }finally{ //5 清理 try { if(conn!=null) conn.close(); if(ptmt!=null) ptmt.close(); } catch (SQLException e) { } } } public static void insertnowword (String word) throws ClassNotFoundException{ Connection conn=null; PreparedStatement ptmt=null; //1.装载驱动程序 Class.forName(JDBC_DRIVER); //2.建立链接 try { conn=DriverManager.getConnection(DB_URL, USER, PASSWORD); //3、执行sql语句 ptmt=conn.prepareStatement("insert into nowword (nowword,time) values (?,0)"); ptmt.setString(1, word); ptmt.execute(); conn.commit(); //执行结果 } catch (SQLException e) { e.printStackTrace(); }finally{ //5 清理 try { if(conn!=null) conn.close(); if(ptmt!=null) ptmt.close(); } catch (SQLException e) { } } } public static void addinword (String word) throws ClassNotFoundException{ Connection conn=null; PreparedStatement ptmt=null; //1.装载驱动程序 Class.forName(JDBC_DRIVER); //2.建立链接 try { conn=DriverManager.getConnection(DB_URL, USER, PASSWORD); //3、执行sql语句 ptmt=conn.prepareStatement("update dictionary set inword=1 where english=?"); ptmt.setString(1, word); ptmt.execute(); // conn.commit(); //执行结果 } catch (SQLException e) { e.printStackTrace(); }finally{ //5 清理 try { if(conn!=null) conn.close(); if(ptmt!=null) ptmt.close(); } catch (SQLException e) { } } } public static void delinword (ArrayList<String> ImportWord) throws ClassNotFoundException{ for (String ImportWord1 :ImportWord){ T1.delinword(ImportWord1); } } public static void addNowWord (ArrayList<String> ImportWord) throws ClassNotFoundException{ for (String ImportWord1 :ImportWord){ T1.addNowWord(ImportWord1); } } public static void delinword (String word) throws ClassNotFoundException{ Connection conn=null; PreparedStatement ptmt=null; //1.装载驱动程序 Class.forName(JDBC_DRIVER); //2.建立链接 try { conn=DriverManager.getConnection(DB_URL, USER, PASSWORD); //3、执行sql语句 ptmt=conn.prepareStatement("update dictionary set inword=0 where english=?"); ptmt.setString(1, word); ptmt.execute(); // conn.commit(); //执行结果 } catch (SQLException e) { e.printStackTrace(); }finally{ //5 清理 try { if(conn!=null) conn.close(); if(ptmt!=null) ptmt.close(); } catch (SQLException e) { } } } public static void addNowWord (String word) throws ClassNotFoundException{ Connection conn=null; PreparedStatement ptmt=null; //1.装载驱动程序 Class.forName(JDBC_DRIVER); //2.建立链接 try { conn=DriverManager.getConnection(DB_URL, USER, PASSWORD); //3、执行sql语句 ptmt=conn.prepareStatement("update dictionary set nowword=1 where english=?"); ptmt.setString(1, word); ptmt.execute(); // conn.commit(); //执行结果 } catch (SQLException e) { e.printStackTrace(); }finally{ //5 清理 try { if(conn!=null) conn.close(); if(ptmt!=null) ptmt.close(); } catch (SQLException e) { } } } public static void increasetime (String word) throws ClassNotFoundException{ Connection conn=null; PreparedStatement ptmt=null; //1.装载驱动程序 Class.forName(JDBC_DRIVER); //2.建立链接 try { conn=DriverManager.getConnection(DB_URL, USER, PASSWORD); //3、执行sql语句 ptmt=conn.prepareStatement("update dictionary set time=time+1 where english=?"); ptmt.setString(1, word); ptmt.execute(); // conn.commit(); //执行结果 } catch (SQLException e) { e.printStackTrace(); }finally{ //5 清理 try { if(conn!=null) conn.close(); if(ptmt!=null) ptmt.close(); } catch (SQLException e) { } } } public static void delnowword (String word) throws ClassNotFoundException{ Connection conn=null; PreparedStatement ptmt=null; //1.装载驱动程序 Class.forName(JDBC_DRIVER); //2.建立链接 try { conn=DriverManager.getConnection(DB_URL, USER, PASSWORD); //3、执行sql语句 ptmt=conn.prepareStatement("update dictionary set nowword=0 where english=?"); ptmt.setString(1, word); ptmt.execute(); // conn.commit(); //执行结果 } catch (SQLException e) { e.printStackTrace(); }finally{ //5 清理 try { if(conn!=null) conn.close(); if(ptmt!=null) ptmt.close(); } catch (SQLException e) { } } } public static void insertdictionary (String english,String chinese) throws ClassNotFoundException{ Connection conn=null; PreparedStatement ptmt=null; //1.装载驱动程序 Class.forName(JDBC_DRIVER); //2.建立链接 try { conn=DriverManager.getConnection(DB_URL, USER, PASSWORD); //3、执行sql语句 ptmt=conn.prepareStatement("insert into dictionary (english,chinese,time,inword,nowword,lasttime,lianxiang) values (?,?,0,0,0,'2013-06-20 08:52:47','没有')"); ptmt.setString(1, english); ptmt.setString(2, chinese); ptmt.execute(); // conn.commit(); //执行结果 } catch (SQLException e) { e.printStackTrace(); }finally{ //5 清理 try { if(conn!=null) conn.close(); if(ptmt!=null) ptmt.close(); } catch (SQLException e) { } } } public static Timestamp getlasttime (String english) throws ClassNotFoundException{ Connection conn=null; PreparedStatement ptmt=null; ResultSet rs=null; Timestamp Lt=null; //1.装载驱动程序 Class.forName(JDBC_DRIVER); //2.建立链接 try { conn=DriverManager.getConnection(DB_URL, USER, PASSWORD); //3、执行sql语句 ptmt=conn.prepareStatement("select * from dictionary where english=?"); ptmt.setString(1, english); ptmt.execute(); rs=ptmt.executeQuery(); // conn.commit(); //执行结果 while (rs.next()){ System.out.println((rs.getString("lasttime"))); Lt=rs.getTimestamp("lasttime"); } } catch (SQLException e) { e.printStackTrace(); }finally{ //5 清理 try { if(conn!=null) conn.close(); if(ptmt!=null) ptmt.close(); } catch (SQLException e) { } } return Lt; } public static void setlasttime (String english) throws ClassNotFoundException{ Connection conn=null; PreparedStatement ptmt=null; //1.装载驱动程序 Class.forName(JDBC_DRIVER); //2.建立链接 try { conn=DriverManager.getConnection(DB_URL, USER, PASSWORD); //3、执行sql语句 ptmt=conn.prepareStatement("update dictionary set lasttime =? where english=?"); Timestamp date=new Timestamp(System.currentTimeMillis()); String Dates=date.toString(); ptmt.setString(1, Dates); ptmt.setString(2, english); ptmt.execute(); // conn.commit(); //执行结果 } catch (SQLException e) { e.printStackTrace(); }finally{ //5 清理 try { if(conn!=null) conn.close(); if(ptmt!=null) ptmt.close(); } catch (SQLException e) { } } } public static int passtime(Timestamp t1){ int pt =0; long lpt=0; Timestamp date=new Timestamp(System.currentTimeMillis()); lpt=date.getTime()-t1.getTime(); pt=(int) (lpt/86400000); return pt; } /** * *获取最近学过的单词 */ public static ArrayList<String> getnearinworld() throws ClassNotFoundException{ Connection conn=null; PreparedStatement ptmt=null; ResultSet rs=null; ArrayList<String> word =new ArrayList<String>(); // lst=this. //1.装载驱动程序 Class.forName(JDBC_DRIVER); //2.建立链接 try { conn=DriverManager.getConnection(DB_URL, USER, PASSWORD); //3、执行sql语句 Timestamp date=new Timestamp(System.currentTimeMillis()); System.out.println(date.getTime()); long time1=date.getTime(); // System.out.println(time1); long adv= (time1-2*86400000); // System.out.println(adv); Timestamp date1=new Timestamp(adv); // System.out.println(date1); String d2=date1.toString(); System.out.println(d2); ptmt=conn.prepareStatement("select * from dictionary where inword=1&&lasttime>?"); ptmt.setString(1, d2); ptmt.setFetchSize(2); rs=ptmt.executeQuery(); while (rs.next()){ word.add(rs.getString("english")); } } catch (SQLException e) { e.printStackTrace(); }finally{ //5 清理 try { if(conn!=null) conn.close(); if(ptmt!=null) ptmt.close(); if(rs!=null) rs.close(); } catch (SQLException e) { } } return word; } public static ArrayList<String> getduonowworld () throws ClassNotFoundException{ Connection conn=null; PreparedStatement ptmt=null; ResultSet rs=null; ArrayList<String> word =new ArrayList<String>(); // lst=this. //1.装载驱动程序 Class.forName(JDBC_DRIVER); //2.建立链接 try { conn=DriverManager.getConnection(DB_URL, USER, PASSWORD); //3、执行sql语句 ptmt=conn.prepareStatement("select * from dictionary where nowword=1&&time>10"); // ptmt.setString(1, ""); ptmt.setFetchSize(2); rs=ptmt.executeQuery(); while (rs.next()){ word.add(rs.getString("english")); } } catch (SQLException e) { e.printStackTrace(); }finally{ //5 清理 try { if(conn!=null) conn.close(); if(ptmt!=null) ptmt.close(); if(rs!=null) rs.close(); } catch (SQLException e) { } } return word; } public static Logger getMyLog(Class<?> c){ Logger logger = Logger.getLogger(c); PropertyConfigurator.configure(setLogProperty()); return logger; } public static Properties setLogProperty(){ Properties p = new Properties(); String ip = null; try { p.load(Mylog.class.getResourceAsStream("log4j.properties")); InetAddress addr = InetAddress.getLocalHost(); } catch (IOException e) { e.printStackTrace(); } return p; } public static void initmain(){ Mianwindow widm = new Mianwindow(); Logger logger = T1.getMyLog(Mylog.class); logger.debug("主窗口打开成功"); } public static void WriteData(String nfile) { try{ BufferedWriter output = new BufferedWriter(new FileWriter ("C:/Users/Administrator/Desktop/文档/新建文件夹 (2)/test.txt")); output.write(String.valueOf(nfile)+"\r\n"); output.close(); } catch (Exception ex) { System.out.println(ex); } } public static String searchlianxiang (String english) throws ClassNotFoundException{ Connection conn=null; PreparedStatement ptmt=null; ResultSet rs=null; String word1 =new String(); //1.装载驱动程序 Class.forName(JDBC_DRIVER); //2.建立链接 try { conn=DriverManager.getConnection(DB_URL, USER, PASSWORD); //3、执行sql语句 ptmt=conn.prepareStatement("select * from dictionary where english=?"); ptmt.setString(1, english); ptmt.setFetchSize(2); rs=ptmt.executeQuery(); //执行结果 while (rs.next()){ word1=rs.getString("lianxiang"); } if(word1.length()==0){ word1="没有查到"; } } catch (SQLException e) { e.printStackTrace(); }finally{ //5 清理 try { if(conn!=null) conn.close(); if(ptmt!=null) ptmt.close(); if(rs!=null) rs.close(); } catch (SQLException e) { } } return word1; } public static void setlianxiang (String english,String lianxiang) throws ClassNotFoundException{ Connection conn=null; PreparedStatement ptmt=null; //1.装载驱动程序 Class.forName(JDBC_DRIVER); //2.建立链接 try { conn=DriverManager.getConnection(DB_URL, USER, PASSWORD); //3、执行sql语句 ptmt=conn.prepareStatement("update dictionary set lianxiang =? where english=?"); Timestamp date=new Timestamp(System.currentTimeMillis()); ptmt.setString(1, lianxiang); ptmt.setString(2, english); ptmt.execute(); //执行结果 } catch (SQLException e) { e.printStackTrace(); }finally{ //5 清理 try { if(conn!=null) conn.close(); if(ptmt!=null) ptmt.close(); } catch (SQLException e) { } } } public static void main(String[] args) throws ClassNotFoundException{ System.out.println(T1.getinworld()); } }
[ "x-jesse@foxmail.com" ]
x-jesse@foxmail.com
be8ed132ca20b923c83e3c65ba50fdcd069e1081
200bc79029c4d21b8dbe7c8f689a1b0410637814
/src/test/java/org/joda/time/ScheduleTest.java
f54b01b4c195658835c4192ae18915c8978bb775
[]
no_license
donautech/joda-time-schedule
f493383d232eea3fba4f826630622c9ae70d922e
a564367343fe14332e4a8a081554c25f7db5f51a
refs/heads/master
2020-12-26T18:27:49.102941
2020-02-01T11:07:57
2020-02-01T11:07:57
237,596,107
0
0
null
2020-02-01T11:07:58
2020-02-01T10:10:32
Java
UTF-8
Java
false
false
2,442
java
package org.joda.time; import org.junit.Test; import java.util.ArrayList; import static org.junit.Assert.assertEquals; public class ScheduleTest { @Test public void single_intersect() { final Schedule firstSchedule = new Schedule(new ArrayList<Interval>() {{ add(Interval.parse("2020-01-01T13:00:00Z/2020-01-01T14:00:00Z")); add(Interval.parse("2020-01-01T15:00:00Z/2020-01-01T16:00:00Z")); }}); final Schedule secondSchedule = new Schedule(new ArrayList<Interval>() {{ add(Interval.parse("2020-01-01T13:30:00Z/2020-01-01T14:00:00Z")); }}); final Schedule intersectedSchedule = firstSchedule.intersect(secondSchedule); assertEquals(1, intersectedSchedule.size()); } @Test public void double_intersect() { final Schedule firstSchedule = new Schedule(new ArrayList<Interval>() {{ add(Interval.parse("2020-01-01T13:00:00Z/2020-01-01T14:00:00Z")); add(Interval.parse("2020-01-01T15:00:00Z/2020-01-01T16:00:00Z")); }}); final Schedule secondSchedule = new Schedule(new ArrayList<Interval>() {{ add(Interval.parse("2020-01-01T13:30:00Z/2020-01-01T15:30:00Z")); }}); final Schedule intersectedSchedule = firstSchedule.intersect(secondSchedule); assertEquals(2, intersectedSchedule.size()); } @Test public void double_intersect_reverse() { final Schedule secondSchedule = new Schedule(new ArrayList<Interval>() {{ add(Interval.parse("2020-01-01T13:00:00Z/2020-01-01T14:00:00Z")); add(Interval.parse("2020-01-01T15:00:00Z/2020-01-01T16:00:00Z")); }}); final Schedule firstSchedule = new Schedule(new ArrayList<Interval>() {{ add(Interval.parse("2020-01-01T13:30:00Z/2020-01-01T15:30:00Z")); }}); final Schedule intersectedSchedule = firstSchedule.intersect(secondSchedule); assertEquals(2, intersectedSchedule.size()); } @Test public void after_now() { final Schedule schedule = new Schedule(new ArrayList<Interval>() {{ add(new Interval(DateTime.now().minusHours(3), DateTime.now().minusHours(2))); add(new Interval(DateTime.now().plusHours(2), DateTime.now().plusHours(3))); }}); final Schedule afterNowSchedule = schedule.afterNow(); assertEquals(1, afterNowSchedule.size()); } }
[ "dmi3coder@gmail.com" ]
dmi3coder@gmail.com
d9f35adb14768a1db01f8e1fce7a0250dea7f975
c2ef914489cc9b668f57c5e33531153b0d85bac4
/core/src/main/java/org/brunel/model/style/StyleSelector.java
73e37ef8eee3ef49ae5f23043fdb391c7093738c
[]
no_license
neilbartlett/Brunel
af038c302cb8b55a113642c4a9c2a7573bc6b9c2
861c95ee4ce03879d860086bf8ef4948b47efc56
refs/heads/master
2023-06-21T22:53:42.242792
2015-09-11T16:49:20
2015-09-11T16:49:20
42,320,643
0
0
null
2015-09-11T16:45:22
2015-09-11T16:45:22
null
UTF-8
Java
false
false
1,770
java
/* * Copyright (c) 2015 IBM Corporation and others. * * 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.brunel.model.style; /** * StyleSelector matches against a CSS-like style key. It supports the following CSS syntax. * <p/> * * anything * .class class * element element like text, rect, circle, path * e1, e2 element e1 and e2 * e1 e2 element e1 inside and element e1 [descendent] * <p/> * Note that the comma operator is taken care of outside of this class */ public abstract class StyleSelector implements Comparable<StyleSelector> { final int specificity; StyleSelector(int specificity) { this.specificity = specificity; } public int compareTo(StyleSelector o) { return o.specificity - specificity; } public StyleSelector containedIn(StyleSelector[] sel) { StyleSelector[] all = new StyleSelector[sel.length+1]; System.arraycopy(sel, 0, all, 0, sel.length); all[sel.length] = this; return new MultiComponentSelector(all); } public abstract String debug(); public abstract boolean match(StyleTarget target); public abstract StyleSelector replaceClass(String target, String replace); }
[ "gwills@us.ibm.com" ]
gwills@us.ibm.com
485bbc1d35bac3731cfffad4aa817ca661512d95
59e8232e9cb602116439301be4592c26f2de5211
/core/framework/src/main/java/com/tinecommerce/core/catalog/repository/impl/ProductRepositoryImpl.java
462e239fe76ded15bad0d333802080dac8425721
[]
no_license
przemyslawmagiera/tine-commerce
70f2a945a77c72c3d81cc1cfffe3c5d14c41ef68
81f3e88c5ffae1948c7683e1be7039524b50699f
refs/heads/master
2020-03-30T20:10:43.396609
2020-03-11T13:41:26
2020-03-11T13:41:26
151,576,629
0
0
null
null
null
null
UTF-8
Java
false
false
1,991
java
package com.tinecommerce.core.catalog.repository.impl; import com.tinecommerce.core.catalog.model.Product; import com.tinecommerce.core.catalog.repository.ProductRepositoryCustom; import org.apache.log4j.Logger; import org.hibernate.Criteria; import org.hibernate.Session; import org.hibernate.criterion.Restrictions; import org.reflections.Reflections; import org.springframework.stereotype.Repository; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.transaction.Transactional; import java.util.List; import java.util.Set; @Repository @Transactional public class ProductRepositoryImpl implements ProductRepositoryCustom { private static final Logger LOGGER = Logger.getLogger(ProductRepositoryImpl.class); @PersistenceContext private EntityManager entityManager; private Class<? extends Product> getCeilingClass(){ Reflections reflections = new Reflections("com.tinecommerce"); Set<Class<? extends Product>> classes = reflections.getSubTypesOf(Product.class); Class<? extends Product> ceilingClass = Product.class; int minimum = classes.size(); for (Class<? extends Product> aClass : classes) { if(reflections.getSubTypesOf(aClass).size() < minimum) { ceilingClass = aClass; minimum = reflections.getSubTypesOf(aClass).size(); } } return ceilingClass; } @Override public List<? extends Product> findByField(String fieldName, Object value) { Session session = entityManager.unwrap(Session.class); Criteria c = session.createCriteria(getCeilingClass()); c.add(Restrictions.eq(fieldName, value)); return c.list(); } @Override public List<? extends Product> findAllPolimorficEntities() { Session session = entityManager.unwrap(Session.class); Criteria c = session.createCriteria(getCeilingClass()); return c.list(); } }
[ "magiera.przemyslaw@gmail.com" ]
magiera.przemyslaw@gmail.com
adf0568394104292b065fa1689ca82789ce937f8
b0f20eb901d3481c3177bd4d268edee2009bc549
/src/main/java/javabasic/E_ExtendInterfaceAbstract/Garen.java
e47f0d385a4ae39df29603d21bb95d5d1cf667c1
[]
no_license
XuLingyu/StudyJava
34dee1d80f1f1588b22289b6cb12c45a82aa4c1b
88bcb064c30b8c3df77ff820809d2387294c430a
refs/heads/master
2022-12-21T00:07:51.438404
2021-02-23T06:14:35
2021-02-23T06:14:35
165,167,716
0
0
null
2022-12-10T05:56:01
2019-01-11T02:47:47
Java
UTF-8
Java
false
false
1,516
java
package javabasic.E_ExtendInterfaceAbstract; import java.util.Objects; public class Garen extends Hero implements AD { public String garenQWER; public Garen() { } public Garen(String name) { this(name, 0 , 0); //System.out.println("garen is born"); } public Garen( String aa, int hp, int damage) { super(aa, hp , damage); //System.out.println("garen is born"); } public Garen(int hp, String name, String garenQWER) { super(hp, name); this.garenQWER = garenQWER; } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Garen)) return false; if (!super.equals(o)) return false; Garen garen = (Garen) o; return Objects.equals(garenQWER, garen.garenQWER); } @Override public int hashCode() { return Objects.hash(super.hashCode(), garenQWER); } public void garenSword(){ System.out.println("I have a bvig sword"); } public void attack() { physicAttack(); } @Override public void physicAttack() { System.out.println("physic attack done"); } @Override public void physicDefense() { System.out.println("physic defense done"); } @Override public String toString() { return "Garen{" + "name='" + name + '\'' + ", hp=" + hp + ", damage=" + damage + '}'; } }
[ "lingyuxu@gmx.de" ]
lingyuxu@gmx.de
2a2c343060dd2639855029eeeca146f1fbbe97e1
d12903d58056000fa6f6f5f0f37e8bb45dd45fb1
/src/main/com/steadyjack/service/LinkService.java
40ab8feb96fab8f2537eca1c2a03dd02e2a4eebf
[]
no_license
0ranges/blog
80076b3b42c53e8644c22b03da329f2d83f80402
c42cc8099a9c412b65b42a08cece0580e883a450
refs/heads/master
2020-04-16T11:37:05.657980
2019-01-13T19:16:01
2019-01-13T19:16:01
165,544,084
0
0
null
null
null
null
UTF-8
Java
false
false
875
java
package steadyjack.service; import java.util.List; import java.util.Map; import steadyjack.entity.Link; /** * title:LinkService.java * description:友情链接Service接口 * time:2017年1月16日 下午10:35:55 * author:debug-steadyjack */ public interface LinkService { /** * 添加友情链接 * @param link * @return */ public int add(Link link); /** * 修改友情链接 * @param link * @return */ public int update(Link link); /** * 查找友情链接信息 * @param map * @return */ public List<Link> list(Map<String,Object> map); /** * 获取总记录数 * @param map * @return */ public Long getTotal(Map<String,Object> map); /** * 删除友情链接 * @param id * @return */ public Integer delete(Integer id); }
[ "864160262@qq.com" ]
864160262@qq.com
4465fd0af2057c84aff5f8541849e3b7d6d0b30b
0af8b92686a58eb0b64e319b22411432aca7a8f3
/single-large-project/src/main/java/org/gradle/test/performancenull_424/Productionnull_42374.java
6c0a2dec3a2177b621da91a71c4bc098fba5bad2
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
588
java
package org.gradle.test.performancenull_424; public class Productionnull_42374 { private final String property; public Productionnull_42374(String param) { this.property = param; } public String getProperty() { return property; } private String prop0; public String getProp0() { return prop0; } public void setProp0(String value) { prop0 = value; } private String prop1; public String getProp1() { return prop1; } public void setProp1(String value) { prop1 = value; } }
[ "cedric.champeau@gmail.com" ]
cedric.champeau@gmail.com
97544fbc91201c2f81f20618bb6e55849e73d189
69cf5abbe729d18cb2d0e7335774df2983469a16
/src/test/java/com/roles/assignment/domain/UserSimpleIntegrationTest.java
93effdd2d7ecdc84219d09040ceef8edb5a7b2ea
[]
no_license
sergey-rubtsov/roles
11c9dc8ad0c79d83df75a1ed8db7854ee18054b6
01e2f9000fa7db5685ab49dc949ce8d2e0d1c221
refs/heads/master
2021-01-02T08:56:07.315347
2012-12-10T02:07:47
2012-12-10T02:07:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,720
java
package com.roles.assignment.domain; import com.roles.assignment.repository.UserRepository; import com.roles.assignment.service.UserService; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Configurable; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; @Configurable @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = "classpath:/META-INF/spring/applicationContext*.xml") @Transactional public class UserSimpleIntegrationTest { @Test public void testMarkerMethod() { } @Autowired UserService userService; @Autowired UserRepository userRepository; @Test public void testUserRepositoryNotNull() { Assert.assertNotNull(userRepository); } @Test public void testServiceNotNull() { Assert.assertNotNull(userService); } public static User getUser() { User user = new User(); user.setLogin("login"); user.setPassword("password"); user.setEmail("your@emailhere.com"); return user; } public static User getSecondUser() { User user = new User(); user.setLogin("2user"); user.setPassword("password2"); user.setEmail("your2@emailhere.com"); return user; } @Test public void testCountAllUsers() { userService.saveUser(getUser()); userService.saveUser(getSecondUser()); long count = userService.countAllUsers(); Assert.assertTrue("Counter for 'User' incorrectly reported there were no entries", count == 2); } @Test public void testFindByLogin() { userService.saveUser(getUser()); userService.saveUser(getSecondUser()); Assert.assertNull(userService.findByLoginLike("no exist")); Assert.assertEquals("2user", userService.findByLoginLike("2user").getLogin()); } @Test public void testDelete() throws Exception { User user1 = getUser(); User user2 = getSecondUser(); userService.saveUser(user1); userService.saveUser(user2); long count = userService.countAllUsers(); Assert.assertTrue(count == 2); userService.deleteUser(user1); count = userService.countAllUsers(); Assert.assertTrue(count == 1); userService.saveUser(user1); userService.deleteUser(user2.getId()); count = userService.countAllUsers(); Assert.assertTrue(count == 1); } }
[ "RubtsovSL@ipc-wd-01234568.IPC.SYSTEM.LOC" ]
RubtsovSL@ipc-wd-01234568.IPC.SYSTEM.LOC
6d45ada0d5c94ecbc543da259ec4c072c6a4e755
84b2e53786b99e4d6cf576959c1f8fb0bc9b06ab
/app/src/test/java/com/example/materialnewsapp/ExampleUnitTest.java
e7441b2caa31151be4b8581763f0575c7fcddf51
[]
no_license
ozubergz/MaterialNewsApp
8fba8467aa934b356a59678e80085d24895a90d4
3165cb1aa41d6643033f477df7f9be641d664449
refs/heads/master
2023-02-25T02:26:55.285924
2021-01-27T04:46:25
2021-01-27T04:46:25
333,306,214
0
0
null
null
null
null
UTF-8
Java
false
false
388
java
package com.example.materialnewsapp; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "jmin499@gmail.com" ]
jmin499@gmail.com
11e4cf39a0f094e211666b0732805172633b4f78
27457e4786ce43e5f359e76451bd2ccc5c3d83b1
/android/app/build/generated/source/buildConfig/androidTest/debug/com/wisdomheating/test/BuildConfig.java
a50281cf95000cc9f02b1ca2c553a90b57104cc9
[]
no_license
changhaojun/heatingstation
f62b1eebda25a2d43d8c7730c6e30fafe9724449
88e7db99911ebdf34d4c431f04b6297412869a20
refs/heads/master
2020-06-02T18:59:28.658521
2019-07-17T01:29:56
2019-07-17T01:29:56
191,272,969
0
0
null
null
null
null
UTF-8
Java
false
false
451
java
/** * Automatically generated file. DO NOT MODIFY */ package com.wisdomheating.test; public final class BuildConfig { public static final boolean DEBUG = Boolean.parseBoolean("true"); public static final String APPLICATION_ID = "com.wisdomheating.test"; public static final String BUILD_TYPE = "debug"; public static final String FLAVOR = ""; public static final int VERSION_CODE = 1; public static final String VERSION_NAME = "1.0"; }
[ "svector@163.com" ]
svector@163.com
1c4dc02d9d8b5800e3b3c21f9fb69a4a56f45199
2f2ac62beb67c15708604fb29fc4136582a04585
/testsample/src/main/java/CheckersGame.java
687f2ba96bb51e63a64723ad40edd8127d69907d
[]
no_license
Latashaw/ZCWorkArchive
babd78a1037863cba34ddaf401f30d458f3b9a8e
e168df0fa02c77f327a4e1a7fd164662500f6186
refs/heads/master
2021-06-13T10:50:56.360942
2017-04-04T17:52:56
2017-04-04T17:52:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
657
java
/** * Created by latashawatson on 3/8/17. */ public class CheckersGame { private Board gameBoard; private Player player; private Computer computerPlayer; //Players decide what move to make, game makes move public CheckersGame() { gameBoard = new Board(); player = new Player(); computerPlayer = new Computer(); } public void runCheckersGame() { } public void updateGameBoardState() {} public void divideGameBoardToEachPlayerPieces() {} public void countPiecesCatured() {} public void initiateKinging() {} public void checkForGameEnd() {} public void displayWinner() {} }
[ "latashawatson@zipcoders-MacBook-Pro-7.local" ]
latashawatson@zipcoders-MacBook-Pro-7.local
c6b02f1851eb708feb9c87000a505af7ff503291
eac576976210a42aaeb484d45e2316033d1dae9e
/jOOQ/src/main/java/org/jooq/impl/AbstractQuery.java
2d57111fe52dd938bf1a369b1cdba83b49f3a1b4
[ "Apache-2.0" ]
permissive
prashanth02/jOOQ
75fa46912cdeb72ef472b9020635c2a792dcf1af
2a4955abf1752a4e6e2b8127f429d13b8fe68be6
refs/heads/master
2022-10-03T15:32:45.960679
2016-05-30T10:14:52
2016-05-30T10:14:52
60,037,493
0
0
NOASSERTION
2022-09-22T19:34:19
2016-05-30T20:34:12
Java
UTF-8
Java
false
false
16,316
java
/** * Copyright (c) 2009-2016, Data Geekery GmbH (http://www.datageekery.com) * All rights reserved. * * 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. * * Other licenses: * ----------------------------------------------------------------------------- * Commercial licenses for this work are available. These replace the above * ASL 2.0 and offer limited warranties, support, maintenance, and commercial * database integrations. * * For more information, please visit: http://www.jooq.org/licenses * * * * * * * * * * * * * * * * */ package org.jooq.impl; import static java.util.Arrays.asList; import static org.jooq.Constants.FULL_VERSION; import static org.jooq.ExecuteType.DDL; // ... // ... import static org.jooq.conf.ParamType.INDEXED; import static org.jooq.conf.ParamType.INLINED; import static org.jooq.conf.SettingsTools.executePreparedStatements; import static org.jooq.conf.SettingsTools.getParamType; import static org.jooq.impl.DSL.using; import static org.jooq.impl.Tools.blocking; import static org.jooq.impl.Tools.consumeExceptions; import static org.jooq.impl.Tools.DataKey.DATA_COUNT_BIND_VALUES; import static org.jooq.impl.Tools.DataKey.DATA_FORCE_STATIC_STATEMENT; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionStage; import java.util.concurrent.Executor; import org.jooq.AttachableInternal; import org.jooq.Configuration; import org.jooq.ExecuteContext; import org.jooq.ExecuteListener; import org.jooq.Param; import org.jooq.Query; import org.jooq.RenderContext; import org.jooq.Select; import org.jooq.conf.ParamType; import org.jooq.conf.SettingsTools; import org.jooq.conf.StatementType; import org.jooq.exception.ControlFlowSignal; import org.jooq.exception.DetachedException; import org.jooq.tools.JooqLogger; /** * @author Lukas Eder */ abstract class AbstractQuery extends AbstractQueryPart implements Query, AttachableInternal { private static final long serialVersionUID = -8046199737354507547L; private static final JooqLogger log = JooqLogger.getLogger(AbstractQuery.class); private Configuration configuration; private int timeout; private boolean keepStatement; transient PreparedStatement statement; transient Rendered rendered; AbstractQuery(Configuration configuration) { this.configuration = configuration; } // ------------------------------------------------------------------------- // The Attachable and Attachable internal API // ------------------------------------------------------------------------- @Override public final void attach(Configuration c) { configuration = c; } @Override public final void detach() { attach(null); } @Override public final Configuration configuration() { return configuration; } // ------------------------------------------------------------------------- // The QueryPart API // ------------------------------------------------------------------------- final void toSQLSemiColon(RenderContext ctx) { } // ------------------------------------------------------------------------- // The Query API // ------------------------------------------------------------------------- @Override public final List<Object> getBindValues() { return create().extractBindValues(this); } @Override public final Map<String, Param<?>> getParams() { return create().extractParams(this); } @Override public final Param<?> getParam(String name) { return create().extractParam(this, name); } /** * Subclasses may override this for covariant result types * <p> * {@inheritDoc} */ @SuppressWarnings("deprecation") @Override public Query bind(String param, Object value) { try { int index = Integer.valueOf(param); return bind(index, value); } catch (NumberFormatException e) { ParamCollector collector = new ParamCollector(configuration(), true); collector.visit(this); List<Param<?>> params = collector.result.get(param); if (params == null || params.size() == 0) throw new IllegalArgumentException("No such parameter : " + param); for (Param<?> p : params) { p.setConverted(value); closeIfNecessary(p); } return this; } } /** * Subclasses may override this for covariant result types * <p> * {@inheritDoc} */ @SuppressWarnings("deprecation") @Override public Query bind(int index, Object value) { Param<?>[] params = getParams().values().toArray(new Param[0]); if (index < 1 || index > params.length) throw new IllegalArgumentException("Index out of range for Query parameters : " + index); Param<?> param = params[index - 1]; param.setConverted(value); closeIfNecessary(param); return this; } /** * Close the statement if necessary. * <p> * [#1886] If there is an open (cached) statement and its bind values are * inlined due to a {@link StatementType#STATIC_STATEMENT} setting, the * statement should be closed. * * @param param The param that was changed */ private final void closeIfNecessary(Param<?> param) { // This is relevant when there is an open statement, only if (keepStatement() && statement != null) { // When an inlined param is being changed, the previous statement // has to be closed, regardless if variable binding is performed if (param.isInline()) { close(); } // If all params are inlined, the previous statement always has to // be closed else if (getParamType(configuration().settings()) == INLINED) { close(); } } } /** * Subclasses may override this for covariant result types * <p> * {@inheritDoc} */ @Override public Query queryTimeout(int t) { this.timeout = t; return this; } /** * Subclasses may override this for covariant result types * <p> * {@inheritDoc} */ @Override public Query keepStatement(boolean k) { this.keepStatement = k; return this; } protected final boolean keepStatement() { return keepStatement; } @Override public final void close() { if (statement != null) { try { statement.close(); statement = null; } catch (SQLException e) { throw Tools.translate(rendered.sql, e); } } } @Override public final void cancel() { if (statement != null) { try { statement.cancel(); } catch (SQLException e) { throw Tools.translate(rendered.sql, e); } } } @Override public final int execute() { if (isExecutable()) { // Get the attached configuration of this query Configuration c = configuration(); // [#1191] The following triggers a start event on all listeners. // This may be used to provide jOOQ with a JDBC connection, // in case this Query / Configuration was previously // deserialised DefaultExecuteContext ctx = new DefaultExecuteContext(c, this); ExecuteListener listener = new ExecuteListeners(ctx); int result = 0; try { // [#385] If a statement was previously kept open if (keepStatement() && statement != null) { ctx.sql(rendered.sql); ctx.statement(statement); // [#3191] Pre-initialise the ExecuteContext with a previous connection, if available. ctx.connection(c.connectionProvider(), statement.getConnection()); } // [#385] First time statement preparing else { listener.renderStart(ctx); rendered = getSQL0(ctx); ctx.sql(rendered.sql); listener.renderEnd(ctx); rendered.sql = ctx.sql(); // [#3234] Defer initialising of a connection until the prepare step // This optimises unnecessary ConnectionProvider.acquire() calls when // ControlFlowSignals are thrown if (ctx.connection() == null) { throw new DetachedException("Cannot execute query. No Connection configured"); } listener.prepareStart(ctx); prepare(ctx); listener.prepareEnd(ctx); statement = ctx.statement(); } // [#1856] [#4753] Set the query timeout onto the Statement int t = SettingsTools.getQueryTimeout(timeout, ctx.settings()); if (t != 0) { ctx.statement().setQueryTimeout(t); } if ( // [#1145] Bind variables only for true prepared statements // [#2414] Even if parameters are inlined here, child // QueryParts may override this behaviour! executePreparedStatements(c.settings()) && // [#1520] Renderers may enforce static statements, too !Boolean.TRUE.equals(ctx.data(DATA_FORCE_STATIC_STATEMENT))) { listener.bindStart(ctx); if (rendered.bindValues != null) using(c).bindContext(ctx.statement()).visit(rendered.bindValues); listener.bindEnd(ctx); } result = execute(ctx, listener); return result; } // [#3427] ControlFlowSignals must not be passed on to ExecuteListners catch (ControlFlowSignal e) { throw e; } catch (RuntimeException e) { ctx.exception(e); listener.exception(ctx); throw ctx.exception(); } catch (SQLException e) { ctx.sqlException(e); listener.exception(ctx); throw ctx.exception(); } finally { // [#2385] Successful fetchLazy() needs to keep open resources if (!keepResultSet() || ctx.exception() != null) { Tools.safeClose(listener, ctx, keepStatement()); } if (!keepStatement()) { statement = null; rendered = null; } } } else { if (log.isDebugEnabled()) log.debug("Query is not executable", this); return 0; } } @Override public final CompletionStage<Integer> executeAsync() { return executeAsync(Tools.configuration(this).executorProvider().provide()); } @Override public final CompletionStage<Integer> executeAsync(Executor executor) { return ExecutorProviderCompletionStage.of(CompletableFuture.supplyAsync(blocking(this::execute), executor), () -> executor); } /** * Default implementation to indicate whether this query should close the * {@link ResultSet} after execution. Subclasses may override this method. */ protected boolean keepResultSet() { return false; } /** * Default implementation for preparing a statement. Subclasses may override * this method. */ protected void prepare(ExecuteContext ctx) throws SQLException { ctx.statement(ctx.connection().prepareStatement(ctx.sql())); } /** * Default implementation for query execution using a prepared statement. * Subclasses may override this method. */ protected int execute(ExecuteContext ctx, ExecuteListener listener) throws SQLException { int result = 0; PreparedStatement stmt = ctx.statement(); try { listener.executeStart(ctx); // [#1829] Statement.execute() is preferred over Statement.executeUpdate(), as // we might be executing plain SQL and returning results. if (!stmt.execute()) { result = stmt.getUpdateCount(); ctx.rows(result); } listener.executeEnd(ctx); return result; } // [#3011] [#3054] Consume additional exceptions if there are any catch (SQLException e) { consumeExceptions(ctx.configuration(), stmt, e); throw e; } } /** * Default implementation for executable check. Subclasses may override this * method. */ @Override public boolean isExecutable() { return true; } static class Rendered { String sql; QueryPartList<Param<?>> bindValues; Rendered(String sql) { this(sql, null); } Rendered(String sql, QueryPartList<Param<?>> bindValues) { this.sql = sql; this.bindValues = bindValues; } } private final Rendered getSQL0(ExecuteContext ctx) { Rendered result; // [#3542] [#4977] Some dialects do not support bind values in DDL statements if (ctx.type() == DDL) { ctx.data(DATA_FORCE_STATIC_STATEMENT, true); result = new Rendered(getSQL(INLINED)); } else if (executePreparedStatements(configuration().settings())) { try { DefaultRenderContext render = new DefaultRenderContext(configuration); render.data(DATA_COUNT_BIND_VALUES, true); render.visit(this); result = new Rendered(render.render(), render.bindValues()); } catch (DefaultRenderContext.ForceInlineSignal e) { ctx.data(DATA_FORCE_STATIC_STATEMENT, true); result = new Rendered(getSQL(INLINED)); } } else { result = new Rendered(getSQL(INLINED)); } return result; } /** * {@inheritDoc} */ @Override public final String getSQL() { return getSQL(getParamType(Tools.settings(configuration()))); } /** * {@inheritDoc} */ @Override public final String getSQL(ParamType paramType) { switch (paramType) { case INDEXED: return create().render(this); case INLINED: return create().renderInlined(this); case NAMED: return create().renderNamedParams(this); case NAMED_OR_INLINED: return create().renderNamedOrInlinedParams(this); } throw new IllegalArgumentException("ParamType not supported: " + paramType); } /** * {@inheritDoc} */ @Override @Deprecated public final String getSQL(boolean inline) { return getSQL(inline ? INLINED : INDEXED); } }
[ "lukas.eder@gmail.com" ]
lukas.eder@gmail.com
4a597a93c5b2ce2d27e08791c133e70c9a2088bc
9998ba86b11c58f576b2778c7282e7725e39bc97
/app/src/main/java/com/smartcount/smart_count/core/GenderCount.java
f40c26373292148f507f2c97c03de2b5b2e46fd1
[]
no_license
jeremiahokorie/SmartCount
4e80c4ecd200ee23ef6e0525bc7abd35b5abeb4d
410cbdac64f71e798efd4ad33ad64a64649129d5
refs/heads/master
2020-03-20T04:40:48.193393
2018-06-13T09:19:27
2018-06-13T09:19:27
137,191,132
0
0
null
null
null
null
UTF-8
Java
false
false
5,108
java
package com.smartcount.smart_count.core; import android.app.Dialog; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.TextView; import android.widget.Toast; import com.geniusforapp.fancydialog.FancyAlertDialog; import com.smartcount.smart_count.R; import com.smartcount.smart_count.Util.XCore; public class GenderCount extends AppCompatActivity { int male = 0; int female = 0; TextView result,result1,disp; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_gender_count); result = (TextView)findViewById(R.id.result); result1 = (TextView)findViewById(R.id.result1); disp = (TextView)findViewById(R.id.display); // int f = Integer.parseInt(result.getText().toString()); // int m = Integer.parseInt(result1.getText().toString()); // int total = f+m; // disp.setText(total+""); } public void tvlogout (View view){ XCore.dialog(GenderCount.this, "Logout", "Are you sure you want to Sign Out from this page.", new FancyAlertDialog.OnPositiveClicked() { @Override public void OnClick(View view, Dialog dialog) { Intent intent = new Intent(GenderCount.this,LoginActivity.class); startActivity(intent); finish(); } }, "Logout", "").show(); } public void btnsubmit (View view){ } public void imgback (View view){ super.onBackPressed(); } public void imgnext (View view){ XCore.dialog(GenderCount.this, "Next", "Please Select an Option to Continue", new FancyAlertDialog.OnPositiveClicked() { @Override public void OnClick(View view, Dialog dialog) { } }, "Proceed", "").show(); } @Override public void onBackPressed() { // your code. super.onBackPressed(); // XCore.dialog(GenderCount.this, "Logout", // "Are you sure you want to Sign Out from this page.", // new FancyAlertDialog.OnPositiveClicked() { // @Override // public void OnClick(View view, Dialog dialog) { // Intent intent = new Intent(GenderCount.this,LoginActivity.class); // startActivity(intent); // finish(); // } // }, "Logout", "").show(); } public void decreament(View view) { male = male - 1; int f = Integer.parseInt(result.getText().toString()); int m = Integer.parseInt(result1.getText().toString()); int total = f+m; disp.setText(total+""); if (male < 1) { Toast.makeText(getApplicationContext(), "Value cant be less than one", Toast.LENGTH_LONG).show(); }else { displaymale(male); } } private void displaymale(int male) { TextView male1 = (TextView) findViewById(R.id.result); male1.setText(""+male); int f = Integer.parseInt(result.getText().toString()); int m = Integer.parseInt(result1.getText().toString()); int total = f+m; disp.setText(total+""); } private void displayfemale(int female) { TextView male2 = (TextView) findViewById(R.id.result1); male2.setText(""+female); int f = Integer.parseInt(result.getText().toString()); int m = Integer.parseInt(result1.getText().toString()); int total = f+m; disp.setText(total+""); } public void increament(View view) { male = male +1; displaymale(male); int f = Integer.parseInt(result.getText().toString()); int m = Integer.parseInt(result1.getText().toString()); int total = f+m; disp.setText(total+""); } public void submit(View view) { } public void increament1(View view) { female = female +1; displayfemale(female); int f = Integer.parseInt(result.getText().toString()); int m = Integer.parseInt(result1.getText().toString()); int total = f+m; disp.setText(total+""); } public void decreament1(View view) { female = female - 1; int f = Integer.parseInt(result.getText().toString()); int m = Integer.parseInt(result1.getText().toString()); int total = f+m; disp.setText(total+""); if (female < 1) { Toast.makeText(getApplicationContext(), "Value cant be less than one", Toast.LENGTH_LONG).show(); }else { displayfemale(female); } } public void tvreset (View view){ Intent intent = new Intent(getApplicationContext(),CountingMethod.class); startActivity(intent); finish(); } }
[ "jeremiah.imo@etranzact.com" ]
jeremiah.imo@etranzact.com
a207b10be3a16d20504e18a42522a2323fd0b891
f266c383acbc33374c35a7fa95083c8ade292de4
/src/main/java/com/unfair/Util/SmartMatch.java
aa5525923d4ce98f5d46583dedcb1bafb43ac61b
[]
no_license
SummerUnfair/SpringBootTest
c5fdd7f7b3477bf8a5fd90dff3ddbc007dc401c6
e27feba2af198f156d3e91f6be2e80168a0dc656
refs/heads/SpringbootTest
2022-12-15T06:28:48.082525
2020-10-29T02:30:55
2020-10-29T02:30:55
228,985,155
0
0
null
2022-12-06T00:34:00
2019-12-19T05:55:24
Java
UTF-8
Java
false
false
2,944
java
package com.unfair.Util; //import org.apache.log4j.Logger; import net.sf.json.JSONArray; import net.sf.json.JSONObject; /** * 此类主要调用——标准地址匹配接口——-获得城地坐标,百度经纬度,标准地址id,和标准地址 * @author liwei 2019/01/08 * (1)getStandard_id * (2)getStandard_Address * (3)String[] getCityXandY_arr * (4)String getCityXandY_String * (5)getBaiDuShape * * 重要工具类 */ public class SmartMatch { //获取日志器对象 //static Logger log=Logger.getLogger(SmartMatch.class); /** * (1)getStandard_id * 通过非标地址获得标准地址id 1 * @param addr 非标地址 * @return 标准地址id */ public static String getStandard_id(String addr){ String address= addr.replaceAll(" ", ""); String url = "http://10.7.74.41/addrselection/addressIndex/smartMatchAddress.do?addr_full=" + address; String jsonRes = null; try { jsonRes = HttpClientUtil.get(url); } catch (Exception e1) { String msg="SmartMatch的getStandard_id方法调用接口失败,原地址为=(" +addr+")"; //log.info(msg); e1.printStackTrace(); } String standardId =null; if (jsonRes.contains("addr_full")) { JSONObject resJson = JSONObject.fromObject(jsonRes); Object data = resJson.get("data"); JSONArray dataRes = JSONArray.fromObject(data); JSONObject jsObj = new JSONObject(); for(Object obj : dataRes){ jsObj = JSONObject.fromObject(obj); } JSONObject dataJson = JSONObject.fromObject(jsObj); standardId = dataJson.get("id").toString(); }else { String msg="SmartMatch的getStandard_id方法未查询到数据,原地址为=(" +addr+")"; // log.info(msg); } return standardId; } /** * (2)getStandard_Address * 通过非标地址获得标准地址 * @param addr 非标地址 * @return 标准地址 */ public static String getStandard_Address(String addr){ String address= addr.replaceAll(" ", ""); String url = "http://10.7.74.41/addrselection/addressIndex/smartMatchAddress.do?addr_full=" + address; String jsonRes = null; try { jsonRes = HttpClientUtil.get(url); } catch (Exception e1) { String msg="SmartMatch的getStandard_Address方法调用接口失败,原地址为=(" +addr+")"; // log.info(msg); e1.printStackTrace(); } String standardAddress =null; if (jsonRes.contains("addr_full")) { JSONObject resJson = JSONObject.fromObject(jsonRes); Object data = resJson.get("data"); JSONArray dataRes = JSONArray.fromObject(data); JSONObject jsObj = new JSONObject(); for(Object obj : dataRes){ jsObj = JSONObject.fromObject(obj); } JSONObject dataJson = JSONObject.fromObject(jsObj); standardAddress = dataJson.get("addr_full").toString(); }else { String msg="SmartMatch的getStandard_Address方法未查询到数据,原地址为=(" +addr+")"; // log.info(msg); } return standardAddress; } }
[ "928971634@qq.com" ]
928971634@qq.com
4bd5b48b000daceb16906271eaccb8c37799df43
33658b4b77d030bcc7dc1cc391aa299d7ec31252
/src/headless_browser/headless_chrome.java
49cde28098b7c055249f603ae401f5f8c4270a89
[]
no_license
ashwani983/Selenium_Demo
eab6b7398a512b8604983588f52e3e36032f884c
f9fb3d16f593d41092399e814b5658fa3b0d2ec4
refs/heads/main
2023-02-07T02:41:56.750886
2020-12-29T06:58:24
2020-12-29T06:58:24
304,553,583
0
0
null
null
null
null
UTF-8
Java
false
false
838
java
package headless_browser; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; public class headless_chrome { public static void main(String[] args) throws InterruptedException { System.setProperty("webdriver.chrome.driver", "./Driver/chromedriver.exe"); ChromeOptions co=new ChromeOptions(); co.addArguments("headless"); WebDriver driver = new ChromeDriver(co); // Launching the site. driver.get("http://demo.guru99.com/popup.php"); Thread.sleep(5000); System.out.println(driver.getTitle()); driver.findElement(By.xpath("//a[@href='../articles_popup.php']")).click(); System.out.println(driver.getTitle()); driver.quit(); } }
[ "ashwani@Ashwani-PC" ]
ashwani@Ashwani-PC
80b34d2eb625512a5917470a8cdadbb9cf3b268a
27663710a30457842ed9d0a94eb4bb592dacc23c
/app/src/main/java/com/app/peppermint/entity/PhotoExtendEntity.java
865c91842bd031c06210c69b9f8747290d24f90b
[]
no_license
lizubing1992/Peppermint
22d868ea48c80b3af97e93ffd1ad208ba2879225
a3e4f5fb2eeacb529c6a18c3571a73b2a60a77ae
refs/heads/master
2020-03-30T05:56:42.416359
2018-09-29T05:51:52
2018-09-29T05:51:52
150,829,169
4
0
null
null
null
null
UTF-8
Java
false
false
647
java
package com.app.peppermint.entity; public class PhotoExtendEntity { private Integer urlId; private Integer tipId; public Integer getUrlId() { return urlId; } public void setUrlId(Integer urlId) { this.urlId = urlId; } public Integer getTipId() { return tipId; } public void setTipId(Integer tipId) { this.tipId = tipId; } public PhotoExtendEntity(Integer urlId) { this.urlId = urlId; } public PhotoExtendEntity() { } public PhotoExtendEntity(Integer urlId, Integer tipId) { this.urlId = urlId; this.tipId = tipId; } }
[ "lizubing1992@163.com" ]
lizubing1992@163.com
2d482c236c400ce5169daaa35a5a7a291ce82642
432d7c5216e9a131ad02166128cdeb544d74004f
/src/sample/Edit.java
7dc6a8bf8823c81a99bb66145a4f865e16f9fd1a
[]
no_license
Kregopaulgue/interface-finance-manager
37cee2fba8d10d1a1878454fc6b7086e0c2ed7d9
7d89e36a7ae9434de1d2090a56171c7f33925111
refs/heads/master
2021-08-30T06:11:34.756657
2017-12-16T11:14:06
2017-12-16T11:14:06
107,697,715
0
0
null
2017-12-11T14:24:52
2017-10-20T15:56:45
Java
UTF-8
Java
false
false
8,151
java
package sample; import Exceptions.WrongImportanceInputException; import Exceptions.WrongMoneyInputException; import ExpenceEntries.*; import HelperTypes.ExpenceEntryType; import HelperTypes.FoodType; import HelperTypes.TechnicType; import TotalTimeEntries.TotalDayEntries; import TotalTimeEntries.TotalMonthEntries; import TotalTimeEntries.TotalWeekEntries; import XMLLibrary.DateHelper; import javafx.collections.FXCollections; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.*; import javafx.*; import javafx.stage.Stage; import javax.xml.bind.TypeConstraintException; import java.net.URL; import java.time.LocalDate; import java.util.ResourceBundle; /** * Created by Master on 05.12.2017. */ public class Edit implements Initializable{ public static OtherExpenceEntry entryToEdit; public static OtherExpenceEntry entryToAdd; @FXML TextArea descriptionField; @FXML TextField moneySpentTextField, importanceTextField; @FXML ChoiceBox expenceEntryComboBox; @FXML ChoiceBox specificationComboBox; @FXML Button sendButton, cancelButton, getSpecific; @FXML DatePicker datePicker; @Override public void initialize(URL location, ResourceBundle resources) { expenceEntryComboBox.setItems(FXCollections.observableArrayList( ExpenceEntryType.FOOD, ExpenceEntryType.CLOTH, ExpenceEntryType.SERVICE, ExpenceEntryType.BILL, ExpenceEntryType.TECHNIC, ExpenceEntryType.ENTERTAINMENT, ExpenceEntryType.OTHER)); if(!entryToEdit.equals(null)) { moneySpentTextField.setText(String.valueOf(entryToEdit.getMoneySpent())); importanceTextField.setText(String.valueOf(entryToEdit.getImportance())); ExpenceEntryType expenceTypeDescription = entryToEdit.getEntryType(); expenceEntryComboBox.getSelectionModel().select(expenceTypeDescription); descriptionField.setText(entryToEdit.getComment()); datePicker.setValue(entryToEdit.getCalendar()); setSpecification(); } } @FXML public void setSpecification(ActionEvent event) { specificationComboBox.getItems().clear(); ExpenceEntryType expenceTypeDescription = (ExpenceEntryType)expenceEntryComboBox.getSelectionModel().getSelectedItem(); switch(expenceTypeDescription.toString()) { case "FOOD": specificationComboBox.setItems(FXCollections.observableArrayList( FoodType.MAIN_FOOD, FoodType.WATER, FoodType.SWEETS, FoodType.UNIMPORTANT_FOOD, FoodType.OTHER) ); break; case "TECHNIC": specificationComboBox.setItems(FXCollections.observableArrayList( TechnicType.APPLIANCE, TechnicType.AUDIO_SYSTEM, TechnicType.COMPUTER, TechnicType.GAMING_HARDWARE, TechnicType.HARDWARE, TechnicType.OTHER) ); break; default: specificationComboBox.setItems(FXCollections.observableArrayList("Write what u want in description", "Really")); break; } } @FXML public void createEntry(ActionEvent event) { entryToAdd = new OtherExpenceEntry(); OtherExpenceEntry newEntry = new OtherExpenceEntry(); Double allMoneySpent = 0.0; Integer importance = -1; try { allMoneySpent = Double.valueOf(moneySpentTextField.getText()); importance = Integer.valueOf(importanceTextField.getText()); if(allMoneySpent <= 0) { throw new WrongMoneyInputException(); } if(importance < 0 || importance > 10) { throw new WrongImportanceInputException(); } } catch (WrongMoneyInputException | WrongImportanceInputException | NumberFormatException e) { Alert alert = new Alert(Alert.AlertType.WARNING); alert.setTitle("Warning"); if(e instanceof NumberFormatException) { alert.setHeaderText("Wrong data input"); } else { alert.setHeaderText(e.toString()); } alert.showAndWait(); Stage stage = (Stage) sendButton.getScene().getWindow(); stage.close(); } String comment = descriptionField.getText(); LocalDate date = datePicker.getValue(); ExpenceEntryType expenceTypeDescription = (ExpenceEntryType)expenceEntryComboBox.getSelectionModel().getSelectedItem(); String specialTypeDescription = specificationComboBox.getSelectionModel().getSelectedItem().toString(); OtherExpenceEntry returnedEntry = new OtherExpenceEntry(); try { switch(expenceTypeDescription.toString()) { case "FOOD": returnedEntry = new FoodExpenceEntry(allMoneySpent, importance, comment, date, FoodType.valueOf(specialTypeDescription), specialTypeDescription); break; case "TECHNIC": returnedEntry = new TechnicExpenceEntry(allMoneySpent, importance, comment, date, TechnicType.valueOf(specialTypeDescription), specialTypeDescription); break; case "CLOTH": returnedEntry = new ClothExpenceEntry(allMoneySpent, importance, comment, date, specialTypeDescription); break; case "ENTERTAINMENT": returnedEntry = new EntertainmentExpenceEntry(allMoneySpent, importance, comment, date, specialTypeDescription); case "BILL": returnedEntry = new BillExpenceEntry(allMoneySpent, importance, comment, date, specialTypeDescription); case "SERVICE": returnedEntry = new ServiceExpenceEntry(allMoneySpent, importance, comment, date, specialTypeDescription); case "OTHER": returnedEntry = new OtherExpenceEntry(allMoneySpent, importance, comment, date, specialTypeDescription); } } catch(Exception e) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("Error"); alert.setHeaderText("Some field is not fulfilled"); alert.showAndWait(); Stage stage = (Stage) sendButton.getScene().getWindow(); stage.close(); } this.entryToAdd = returnedEntry; Stage stage = (Stage) sendButton.getScene().getWindow(); stage.close(); } public void setSpecification() { specificationComboBox.getItems().clear(); ExpenceEntryType expenceTypeDescription = (ExpenceEntryType)expenceEntryComboBox.getSelectionModel().getSelectedItem(); switch(expenceTypeDescription.toString()) { case "FOOD": specificationComboBox.setItems(FXCollections.observableArrayList( FoodType.MAIN_FOOD, FoodType.WATER, FoodType.SWEETS, FoodType.UNIMPORTANT_FOOD, FoodType.OTHER) ); break; case "TECHNIC": specificationComboBox.setItems(FXCollections.observableArrayList( TechnicType.APPLIANCE, TechnicType.AUDIO_SYSTEM, TechnicType.COMPUTER, TechnicType.GAMING_HARDWARE, TechnicType.HARDWARE, TechnicType.OTHER) ); break; default: specificationComboBox.setItems(FXCollections.observableArrayList("Write what u want in description", "Really")); break; } } }
[ "kregopaulgue@gmail.com" ]
kregopaulgue@gmail.com
3f9b10ce70f08b967a811912da744fdd86e23bea
c3445da9eff3501684f1e22dd8709d01ff414a15
/LIS/sinosoft-parents/lis-business/src/main/java_schema/com/sinosoft/lis/vschema/LITranLogSet.java
3b2532b39c11b86d0ee2bcb2d2d8ce19c3e984b3
[]
no_license
zhanght86/HSBC20171018
954403d25d24854dd426fa9224dfb578567ac212
c1095c58c0bdfa9d79668db9be4a250dd3f418c5
refs/heads/master
2021-05-07T03:30:31.905582
2017-11-08T08:54:46
2017-11-08T08:54:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,280
java
/** * Copyright (c) 2002 sinosoft Co. Ltd. * All right reserved. */ package com.sinosoft.lis.vschema; import com.sinosoft.lis.schema.LITranLogSchema; import com.sinosoft.utility.*; /* * <p>ClassName: LITranLogSet </p> * <p>Description: LITranLogSchemaSet类文件 </p> * <p>Copyright: Copyright (c) 2007</p> * <p>Company: sinosoft </p> * @Database: 泰康未整理PDM */ public class LITranLogSet extends SchemaSet { // @Method public boolean add(LITranLogSchema aSchema) { return super.add(aSchema); } public boolean add(LITranLogSet aSet) { return super.add(aSet); } public boolean remove(LITranLogSchema aSchema) { return super.remove(aSchema); } public LITranLogSchema get(int index) { LITranLogSchema tSchema = (LITranLogSchema)super.getObj(index); return tSchema; } public boolean set(int index, LITranLogSchema aSchema) { return super.set(index,aSchema); } public boolean set(LITranLogSet aSet) { return super.set(aSet); } /** * 数据打包,按 XML 格式打包,顺序参见<A href ={@docRoot}/dataStructure/tb.html#PrpLITranLog描述/A>表字段 * @return: String 返回打包后字符串 **/ public String encode() { StringBuffer strReturn = new StringBuffer(""); int n = this.size(); for (int i = 1; i <= n; i++) { LITranLogSchema aSchema = this.get(i); strReturn.append(aSchema.encode()); if( i != n ) strReturn.append(SysConst.RECORDSPLITER); } return strReturn.toString(); } /** * 数据解包 * @param: str String 打包后字符串 * @return: boolean **/ public boolean decode( String str ) { int nBeginPos = 0; int nEndPos = str.indexOf('^'); this.clear(); while( nEndPos != -1 ) { LITranLogSchema aSchema = new LITranLogSchema(); if(aSchema.decode(str.substring(nBeginPos, nEndPos))) { this.add(aSchema); nBeginPos = nEndPos + 1; nEndPos = str.indexOf('^', nEndPos + 1); } else { // @@错误处理 this.mErrors.copyAllErrors( aSchema.mErrors ); return false; } } LITranLogSchema tSchema = new LITranLogSchema(); if(tSchema.decode(str.substring(nBeginPos))) { this.add(tSchema); return true; } else { // @@错误处理 this.mErrors.copyAllErrors( tSchema.mErrors ); return false; } } }
[ "dingzansh@sinosoft.com.cn" ]
dingzansh@sinosoft.com.cn
0c30d7440b00c73516b1ff1509916195ae496b31
3a11e188d7614bc7fe561f996aac27b2e11f02eb
/app/src/main/java/com/example/stanislavk/profpref/utils/CameraSourcePreview.java
5135a5f4c9ed0c0ec44c2f54f27ec41118171ead
[]
no_license
steam0111/ProfPref
4d34df246c11a0c5aeb2ab24990efaa76f4d5326
7c3b8ccfece32e87fe317417a818579ca33a36b1
refs/heads/master
2021-07-15T04:47:10.004725
2018-04-15T14:25:27
2018-04-15T14:25:27
95,569,024
0
0
null
null
null
null
UTF-8
Java
false
false
5,798
java
/* * Copyright (C) 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.example.stanislavk.profpref.utils; import android.content.Context; import android.content.res.Configuration; import android.util.AttributeSet; import android.util.Log; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.ViewGroup; import com.google.android.gms.common.images.Size; import com.google.android.gms.vision.CameraSource; import java.io.IOException; public class CameraSourcePreview extends ViewGroup { private static final String TAG = "CameraSourcePreview"; private Context mContext; private SurfaceView mSurfaceView; private boolean mStartRequested; private boolean mSurfaceAvailable; private CameraSource mCameraSource; private GraphicOverlay mOverlay; public CameraSourcePreview(Context context, AttributeSet attrs) { super(context, attrs); mContext = context; mStartRequested = false; mSurfaceAvailable = false; mSurfaceView = new SurfaceView(context); mSurfaceView.getHolder().addCallback(new SurfaceCallback()); addView(mSurfaceView); } public void start(CameraSource cameraSource) throws IOException { if (cameraSource == null) { stop(); } mCameraSource = cameraSource; if (mCameraSource != null) { mStartRequested = true; startIfReady(); } } public void start(CameraSource cameraSource, GraphicOverlay overlay ) throws IOException { mOverlay = overlay; start(cameraSource); } public void stop() { if (mCameraSource != null) { mCameraSource.stop(); } } public void release() { if (mCameraSource != null) { mCameraSource.release(); mCameraSource = null; } } private void startIfReady() throws IOException { if (mStartRequested && mSurfaceAvailable) { mCameraSource.start(mSurfaceView.getHolder()); if (mOverlay != null) { Size size = mCameraSource.getPreviewSize(); int min = Math.min(size.getWidth(), size.getHeight()); int max = Math.max(size.getWidth(), size.getHeight()); if (isPortraitMode()) { // Swap width and height sizes when in portrait, since it will be rotated by // 90 degrees mOverlay.setCameraInfo(min, max, mCameraSource.getCameraFacing()); } else { mOverlay.setCameraInfo(max, min, mCameraSource.getCameraFacing()); } mOverlay.clear(); } mStartRequested = false; } } private class SurfaceCallback implements SurfaceHolder.Callback { @Override public void surfaceCreated(SurfaceHolder surface) { mSurfaceAvailable = true; try { startIfReady(); } catch (IOException e) { Log.e(TAG, "Could not start camera source.", e); } } @Override public void surfaceDestroyed(SurfaceHolder surface) { mSurfaceAvailable = false; } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { } } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { int width = 320; int height = 240; if (mCameraSource != null) { Size size = mCameraSource.getPreviewSize(); if (size != null) { width = size.getWidth(); height = size.getHeight(); } } // Swap width and height sizes when in portrait, since it will be rotated 90 degrees if (isPortraitMode()) { int tmp = width; width = height; height = tmp; } final int layoutWidth = right - left; final int layoutHeight = bottom - top; // Computes height and width for potentially doing fit width. int childWidth = layoutWidth; int childHeight = (int)(((float) layoutWidth / (float) width) * height); // If height is too tall using fit width, does fit height instead. if (childHeight > layoutHeight) { childHeight = layoutHeight; childWidth = (int)(((float) layoutHeight / (float) height) * width); } for (int i = 0; i < getChildCount(); ++i) { getChildAt(i).layout(0, 0, childWidth, childHeight); } try { startIfReady(); } catch (IOException e) { Log.e(TAG, "Could not start camera source.", e); } } private boolean isPortraitMode() { int orientation = mContext.getResources().getConfiguration().orientation; if (orientation == Configuration.ORIENTATION_LANDSCAPE) { return false; } if (orientation == Configuration.ORIENTATION_PORTRAIT) { return true; } Log.d(TAG, "isPortraitMode returning false by default"); return false; } }
[ "steam0111@mail.ru" ]
steam0111@mail.ru
6bce11da803531b8ba7738bece4b99261077ef11
d8772960b3b2b07dddc8a77595397cb2618ec7b0
/rhServer/src/main/java/com/rhlinkcon/controller/ReferencialSalarialController.java
7e53dc57d8521d75d9a14a95ea489fedfee7580d
[]
no_license
vctrmarques/interno-rh-sistema
c0f49a17923b5cdfaeb148c6f6da48236055cf29
7a7a5d9c36c50ec967cb40a347ec0ad3744d896e
refs/heads/main
2023-03-17T02:07:10.089496
2021-03-12T19:06:05
2021-03-12T19:06:05
347,168,924
0
1
null
null
null
null
UTF-8
Java
false
false
4,083
java
package com.rhlinkcon.controller; import java.util.List; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.rhlinkcon.payload.generico.PagedResponse; import com.rhlinkcon.payload.referenciaSalarial.ReferenciaSalarialRequest; import com.rhlinkcon.payload.referenciaSalarial.ReferenciaSalarialResponse; import com.rhlinkcon.repository.ReferenciaSalarialRepository; import com.rhlinkcon.security.CurrentUser; import com.rhlinkcon.security.UserPrincipal; import com.rhlinkcon.service.ReferenciaSalarialService; import com.rhlinkcon.util.AppConstants; import com.rhlinkcon.util.Utils; @RestController @RequestMapping("/api") public class ReferencialSalarialController { @Autowired private ReferenciaSalarialRepository nivelSalariaRepository; @Autowired private ReferenciaSalarialService nivelSalarialService; @GetMapping("/listaNiveisSalariais") @PreAuthorize("hasAnyRole('ADMIN')") public List<ReferenciaSalarialResponse> getAllReferenciasSalariais() { return nivelSalarialService.getAllReferenciasSalariais(); } @GetMapping("/niveisSalariais") @PreAuthorize("hasAnyRole('ADMIN')") public PagedResponse<ReferenciaSalarialResponse> getAllReferenciasSalariaisPage(@CurrentUser UserPrincipal currentUser, @RequestParam(value = "page", defaultValue = AppConstants.DEFAULT_PAGE_NUMBER) int page, @RequestParam(value = "size", defaultValue = AppConstants.DEFAULT_PAGE_SIZE) int size, @RequestParam(value = "order", defaultValue = AppConstants.DEFAULT_EMPTY) String order, @RequestParam(value = "descricao", defaultValue = AppConstants.DEFAULT_EMPTY) String descricao) { return nivelSalarialService.getAllReferenciasSalariaisPage(page, size, order, descricao); } @GetMapping("/nivelSalarial/{id}") public ReferenciaSalarialResponse getNivelSalarialById(@PathVariable Long id) { return nivelSalarialService.getReferenciaSalarialById(id); } @PostMapping("/nivelSalarial") @PreAuthorize("hasAnyRole('ADMIN')") public ResponseEntity<?> createNivelSalarial(@Valid @RequestBody ReferenciaSalarialRequest referenciaSalarialRequest) { if (nivelSalariaRepository.existsByCodigo(referenciaSalarialRequest.getCodigo())) { return Utils.badRequest(false, "Este Nível Salarial já existe!"); } nivelSalarialService.createReferenciaSalarial(referenciaSalarialRequest); return Utils.created(true, "Nível Salarial criado com sucesso."); } @PutMapping("/nivelSalarial") @PreAuthorize("hasAnyRole('ADMIN')") public ResponseEntity<?> updateReferenciaSalarial(@Valid @RequestBody ReferenciaSalarialRequest nivelSalarialRequest) { if (nivelSalariaRepository.existsByCodigoAndIdNot(nivelSalarialRequest.getCodigo(), nivelSalarialRequest.getId())) { return Utils.badRequest(false, "Este Nível Salarial já existe!"); } nivelSalarialService.updateReferenciaSalarial(nivelSalarialRequest); return Utils.created(true, "Nível Salarial atualizado com sucesso."); } @DeleteMapping("/nivelSalarial/{id}") @PreAuthorize("hasAnyRole('ADMIN')") public ResponseEntity<?> deleteNivelSalarial(@PathVariable("id") Long id) { try { nivelSalarialService.deleteNivelSalarial(id); return Utils.deleted(true, "Nível Salarial deletado com sucesso."); } catch (Exception e) { return Utils.forbidden(true, "Não é possível excluir um nível salarial que possui outras informações ligadas a ele"); } } }
[ "vctmarques@gmail.com" ]
vctmarques@gmail.com
9f3b999c7615d46a454a55a08a7d731411bd6ef9
95cd21c6bfd537886adefa1dd7e5916ca4dcf559
/net/minecraft/client/particle/ParticleExplosionHuge.java
609e34b3bee6e5819e8fcdea28ceec6d4bfe7ee9
[]
no_license
RavenLeaks/BetterCraft-src
acd3653e9259b46571e102480164d86dc75fb93f
fca1f0f3345b6b75eef038458c990726f16c7ee8
refs/heads/master
2022-10-27T23:36:27.113266
2020-06-09T15:50:17
2020-06-09T15:50:17
271,044,072
4
2
null
null
null
null
UTF-8
Java
false
false
2,531
java
/* */ package net.minecraft.client.particle; /* */ /* */ import net.minecraft.client.renderer.BufferBuilder; /* */ import net.minecraft.entity.Entity; /* */ import net.minecraft.util.EnumParticleTypes; /* */ import net.minecraft.world.World; /* */ /* */ /* */ public class ParticleExplosionHuge /* */ extends Particle /* */ { /* */ private int timeSinceStart; /* 13 */ private final int maximumTime = 8; /* */ /* */ /* */ protected ParticleExplosionHuge(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i1214_8_, double p_i1214_10_, double p_i1214_12_) { /* 17 */ super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D); /* */ } /* */ /* */ /* */ /* */ /* */ public void renderParticle(BufferBuilder worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {} /* */ /* */ /* */ /* */ /* */ public void onUpdate() { /* 29 */ for (int i = 0; i < 6; i++) { /* */ /* 31 */ double d0 = this.posX + (this.rand.nextDouble() - this.rand.nextDouble()) * 4.0D; /* 32 */ double d1 = this.posY + (this.rand.nextDouble() - this.rand.nextDouble()) * 4.0D; /* 33 */ double d2 = this.posZ + (this.rand.nextDouble() - this.rand.nextDouble()) * 4.0D; /* 34 */ this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, d0, d1, d2, (this.timeSinceStart / 8.0F), 0.0D, 0.0D, new int[0]); /* */ } /* */ /* 37 */ this.timeSinceStart++; /* */ /* 39 */ if (this.timeSinceStart == 8) /* */ { /* 41 */ setExpired(); /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ public int getFXLayer() { /* 51 */ return 1; /* */ } /* */ /* */ public static class Factory /* */ implements IParticleFactory /* */ { /* */ public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) { /* 58 */ return new ParticleExplosionHuge(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); /* */ } /* */ } /* */ } /* Location: C:\Users\emlin\Desktop\BetterCraft.jar!\net\minecraft\client\particle\ParticleExplosionHuge.class * Java compiler version: 8 (52.0) * JD-Core Version: 1.1.3 */
[ "emlin2021@gmail.com" ]
emlin2021@gmail.com
94e30d7d84683640831ae8c1a3feed628bfb04e4
691b9eaab1cdbf62989a383c4162f2ef323bd443
/src/org/bird/gui/common/progress/IOnWaitingBarListener.java
a4131020e25f63363d4d84946fec891daee4b19b
[]
no_license
smoers/BirdNew
873a15fd4aa3a99691ab9a0d21c25f15811ea9f3
fa1131ba47fdff7d0fc35d7cc17516c9c028078c
refs/heads/master
2020-04-15T17:12:02.263046
2019-11-04T12:27:03
2019-11-04T12:27:03
164,865,133
0
0
null
null
null
null
UTF-8
Java
false
false
448
java
package org.bird.gui.common.progress; import org.bird.gui.listeners.OnProcessListener; import org.bird.gui.listeners.OnProgressChangeListener; /** * Cette interface permet de rendre un objet * disponible pour l'implémentation de la vue WaitingBar */ public interface IOnWaitingBarListener { public void addOnProgressChangeListener(OnProgressChangeListener listener); public void addOnProcessListener(OnProcessListener listener); }
[ "serge.moers@gmail.com" ]
serge.moers@gmail.com
335aa3074ff229e31ef7005117a2a04705774440
ceb86035b15cf701ef2e1d654bfb2f9eaeb4ef2f
/src/com/ps/springmvc/psbankapp/model/Account.java
3cd123703778e90def1b25dad09e215bfdbb4950
[]
no_license
manmeet0307/BankApp
9fb5ac6a26b14b66bb5e21983e90fdec7115c0ce
6063108d4e956c38bc5fef6a1ff868054eaf8f5f
refs/heads/master
2021-09-09T21:38:34.015573
2018-03-19T20:55:23
2018-03-19T20:55:23
125,660,125
0
1
null
null
null
null
UTF-8
Java
false
false
2,623
java
package com.ps.springmvc.psbankapp.model; import java.util.Date; import javax.validation.constraints.Min; import javax.validation.constraints.NotNull; import javax.validation.constraints.Past; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; import org.springframework.format.annotation.DateTimeFormat; import com.ps.springmvc.psbankapp.validations.PSCode; public class Account { @NotNull(message = " Account Number cannot be zero") private Integer accountNo; @NotNull(message = " Account Holder Name cannot be null") @Size(min=2,max=50,message="Invalid length of account holder name") @Pattern(regexp="[A-Za-z(\\s)]+") private String accountHolderName; @NotNull(message = "Account balance cannot be null") @Min(value=5000,message="Balance should not less than 5000") private Integer balance; @NotNull(message = " Account Type cannot be null") private String accountType; @DateTimeFormat(pattern="MM/dd/yyyy") @NotNull(message = "Date cannot be null") @Past(message="Enter valid date") private Date dateOfBirth; @NotNull(message ="psCode cannot be null") //@PSCode //through model @PSCode(value="PSU",message="Starts with psu") private String psCode; public Account() { this.accountNo = 0; this.accountHolderName = ""; this.balance = 0; this.accountType = ""; this.dateOfBirth = new Date();; this.psCode =""; } public Account(Integer accountNo, String accountHolderName, Integer balance, String accountType, Date dateOfBirth, String pdCode) { super(); this.accountNo = accountNo; this.accountHolderName = accountHolderName; this.balance = balance; this.accountType = accountType; this.dateOfBirth = dateOfBirth; this.psCode = pdCode; } public String getAccountType() { return accountType; } public void setAccountType(String accountType) { this.accountType = accountType; } public Date getDateOfBirth() { return dateOfBirth; } public void setDateOfBirth(Date dateOfBirth) { this.dateOfBirth = dateOfBirth; } public String getPsCode() { return psCode; } public void setPdCode(String psCode) { this.psCode = psCode; } public Integer getAccountNo() { return accountNo; } public void setAccountNo(Integer accountNo) { this.accountNo = accountNo; } public String getAccountHolderName() { return accountHolderName; } public void setAccountHolderName(String accountHolderName) { this.accountHolderName = accountHolderName; } public Integer getBalance() { return balance; } public void setBalance(Integer balance) { this.balance = balance; } }
[ "manmeet0307.kaur@gmail.com" ]
manmeet0307.kaur@gmail.com
9fa43546d9320366e4b54c803601a6335d4b931e
6e1c539a1706ead552660d7a73344e13df553368
/HIPIE_XTEXT/org.xtext.hipie/src-gen/org/xtext/hipie/hIPIE/impl/ECLVarunicodeImpl.java
a469ddfa4c5de9cb9d29bd980c2a195e292bf580
[]
no_license
tiernemi/Eclipse_Plugin_Summer_Project_ICHEC_ECL
f090f1a1d0a07412f255fabf641ce2ce0d752796
0795311f54d83fa78e4a3e5fd80270eecd78237e
refs/heads/master
2020-03-29T19:24:57.402578
2015-07-03T14:13:43
2015-07-03T14:13:43
37,460,783
0
1
null
null
null
null
UTF-8
Java
false
false
769
java
/** */ package org.xtext.hipie.hIPIE.impl; import org.eclipse.emf.ecore.EClass; import org.xtext.hipie.hIPIE.ECLVarunicode; import org.xtext.hipie.hIPIE.HIPIEPackage; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>ECL Varunicode</b></em>'. * <!-- end-user-doc --> * <p> * </p> * * @generated */ public class ECLVarunicodeImpl extends ECLfieldTypeImpl implements ECLVarunicode { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ECLVarunicodeImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return HIPIEPackage.Literals.ECL_VARUNICODE; } } //ECLVarunicodeImpl
[ "tiernemi@tcd.ie" ]
tiernemi@tcd.ie
4146be1945e5c8afb59dd65fdd2a0d887dc35a18
6d4aa7c858fe0bf1737cd3f11de6a0d9de25c20f
/03-java-spring/02-spring-data-i/02-show/src/main/java/com/evghenia/show/Application.java
5b964199ef1f1a8151d0bcb16ac5e188a16ce77a
[]
no_license
Java-May-2021/EvgheniaR-Assigments
5a5b53dda43a47508580906510aac2d4270974ba
187bbc9d75b1ca7ff9224cb59e34911390d2e977
refs/heads/master
2023-05-30T22:07:41.514787
2021-06-25T23:57:11
2021-06-25T23:57:11
364,072,478
0
0
null
null
null
null
UTF-8
Java
false
false
298
java
package com.evghenia.show; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
[ "cantomd@mail.ru" ]
cantomd@mail.ru
2ac98bd9333ba8bd78ee512dcbdfe78d0b33a909
76fad22853ae3c98d64a09e1a013595c0afbc9c1
/zcd-system/zcd-system-api/src/main/java/com/zcd/system/api/UserService.java
f5c57d4336c22fcd65e05452f626aa5ee03ea869
[]
no_license
knowledgeAlan/zcdShop
22e1a9faf77ccdd4c05daa00c7d0a237aa76397c
25f1615e1cd6f4d93eb3e14e60f9f96715c736d4
refs/heads/master
2020-10-01T18:11:08.327572
2019-12-12T11:58:07
2019-12-12T11:58:07
227,594,969
0
0
null
null
null
null
UTF-8
Java
false
false
511
java
package com.zcd.system.api; import com.zcd.system.dto.UserDto; /** * @author zhongzuoming <zhongzuoming, 1299076979@qq.com> * @version v1.0 * @Description * @encoding UTF-8 * @date 2019/12/12 * @time 12:09 * @修改记录 <pre> * 版本 修改人 修改时间 修改内容描述 * -------------------------------------------------- * <p> * -------------------------------------------------- * </pre> */ public interface UserService { void saveUser(UserDto userDto); }
[ "1299076979@qq.com" ]
1299076979@qq.com
278e1a38e7116e65399d708839e9e3e3970bd039
c26304a54824faa7c1b34bb7882ee7a335a8e7fb
/flink-runtime/src/test/java/org/apache/flink/runtime/jobmaster/TestingLogicalSlotBuilder.java
74b8007f97b09c6b1911553890b5b6ba85dfaff9
[ "BSD-3-Clause", "OFL-1.1", "ISC", "MIT", "Apache-2.0" ]
permissive
apache/flink
905e0709de6389fc9212a7c48a82669706c70b4a
fbef3c22757a2352145599487beb84e02aaeb389
refs/heads/master
2023-09-04T08:11:07.253750
2023-09-04T01:33:25
2023-09-04T01:33:25
20,587,599
23,573
14,781
Apache-2.0
2023-09-14T21:49:04
2014-06-07T07:00:10
Java
UTF-8
Java
false
false
3,182
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.flink.runtime.jobmaster; import org.apache.flink.runtime.clusterframework.types.AllocationID; import org.apache.flink.runtime.executiongraph.utils.SimpleAckingTaskManagerGateway; import org.apache.flink.runtime.jobmanager.slots.DummySlotOwner; import org.apache.flink.runtime.jobmanager.slots.TaskManagerGateway; import org.apache.flink.runtime.taskmanager.LocalTaskManagerLocation; import org.apache.flink.runtime.taskmanager.TaskManagerLocation; /** Builder for the {@link TestingLogicalSlot}. */ public class TestingLogicalSlotBuilder { private TaskManagerGateway taskManagerGateway = new SimpleAckingTaskManagerGateway(); private TaskManagerLocation taskManagerLocation = new LocalTaskManagerLocation(); private AllocationID allocationId = new AllocationID(); private SlotRequestId slotRequestId = new SlotRequestId(); private SlotOwner slotOwner = new DummySlotOwner(); private boolean automaticallyCompleteReleaseFuture = true; public TestingLogicalSlotBuilder setTaskManagerGateway(TaskManagerGateway taskManagerGateway) { this.taskManagerGateway = taskManagerGateway; return this; } public TestingLogicalSlotBuilder setTaskManagerLocation( TaskManagerLocation taskManagerLocation) { this.taskManagerLocation = taskManagerLocation; return this; } public TestingLogicalSlotBuilder setAllocationId(AllocationID allocationId) { this.allocationId = allocationId; return this; } public TestingLogicalSlotBuilder setSlotRequestId(SlotRequestId slotRequestId) { this.slotRequestId = slotRequestId; return this; } public TestingLogicalSlotBuilder setAutomaticallyCompleteReleaseFuture( boolean automaticallyCompleteReleaseFuture) { this.automaticallyCompleteReleaseFuture = automaticallyCompleteReleaseFuture; return this; } public TestingLogicalSlotBuilder setSlotOwner(SlotOwner slotOwner) { this.slotOwner = slotOwner; return this; } public TestingLogicalSlot createTestingLogicalSlot() { return new TestingLogicalSlot( taskManagerLocation, taskManagerGateway, allocationId, slotRequestId, automaticallyCompleteReleaseFuture, slotOwner); } }
[ "trohrmann@apache.org" ]
trohrmann@apache.org
6987354883666098845bce12c03a02b662145120
85fa883f53dfd6ae32bdc95d56b439444f3a6c63
/src/test/java/com/shpun/structure/adapter/UserBAdapter.java
982ba15f1b9412ea660d0c86f8d4f2e37a73e462
[ "Apache-2.0" ]
permissive
shpunishment/design-pattern-test
86ed9fb10ad99406731d67d38246acd33afbf0db
8b682fe2be4299d16d37e6294d67cf417228e694
refs/heads/main
2023-02-14T14:56:10.483534
2021-01-07T07:12:09
2021-01-07T07:12:09
327,247,117
0
0
null
null
null
null
UTF-8
Java
false
false
529
java
package com.shpun.structure.adapter; /** * @Description: * @Author: sun * @Date: 2021/1/5 15:30 */ public class UserBAdapter implements UserBService { private UserAService userAService; public UserBAdapter(UserAService userAService) { this.userAService = userAService; } @Override public void setUserBId(String id) { userAService.setUserAId(id); } @Override public void setUserBName(String name) { userAService.setUserAName(name); } }
[ "shpunishment@gmail.com" ]
shpunishment@gmail.com
e1278c633c03a6ba556c60dc3582fed255d66b3b
79c9e436222f7be8ce8019945a3f626a35f8cc37
/10Cent/src/logic/boards/finalBoard/FinalLogicBoard.java
a598facfa08d148caed2813fb5d6c428636b1071
[]
no_license
DanielVitas/10Cent
823ce9fc6311a9d131a6961844388f9d6fee4e32
90feb44fbf2734535d6e8fe491462848e194a851
refs/heads/master
2020-05-14T16:16:48.308029
2019-08-21T20:29:31
2019-08-21T20:29:31
181,868,799
1
0
null
null
null
null
UTF-8
Java
false
false
1,210
java
package logic.boards.finalBoard; import logic.boards.LogicBoard; import logic.boards.Move; import logic.players.Player; import java.util.HashSet; import java.util.Set; import java.util.Stack; import static logic.boards.Board.empty; public class FinalLogicBoard extends LogicBoard { /* LogicBoard that belongs to the FinalBoard. */ private Player player; public FinalLogicBoard() { player = empty; } @Override public Player outcome() { return player; } @Override public void play(Move move) { player = ((FinalMove) move).player; } @Override public Set<Move> legalMoves(Player player, Stack<Move> deconstructedPreviousMove) { return allMoves(player); } @Override public Set<Move> allMoves(Player player) { if (outcome() != empty) return new HashSet<>(); Set<Move> moves = new HashSet<>(); moves.add(new FinalMove(player)); return moves; } @Override public LogicBoard clone() { FinalLogicBoard clonedFinalLogicBoard = new FinalLogicBoard(); clonedFinalLogicBoard.player = player; return clonedFinalLogicBoard; } }
[ "daniel.vitas@gmail.com" ]
daniel.vitas@gmail.com
9b95be19abedc47e4311144bc2688654f541f164
7b46a2d32de7456ee8fd178a87f15a99a68d393f
/src/test/java/it/com/atlassian/bitbucket/jenkins/internal/status/BuildStatusPosterIT.java
6ae0e7dbb13a0983437c1f46dee10a28b0d324ed
[ "Apache-2.0" ]
permissive
jsaribeirolopes/atlassian-bitbucket-server-integration-plugin
0cec802eb4c0c7db408e83f75547b6fca520fd8a
9f533efc2e2755b9650a94fbe12da3136bd64a4a
refs/heads/master
2023-06-25T05:25:46.688371
2021-06-21T06:12:49
2021-06-21T06:12:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
13,060
java
package it.com.atlassian.bitbucket.jenkins.internal.status; import com.atlassian.bitbucket.jenkins.internal.model.BitbucketRepository; import com.atlassian.bitbucket.jenkins.internal.model.BuildState; import com.atlassian.bitbucket.jenkins.internal.status.BitbucketRevisionAction; import com.github.tomakehurst.wiremock.matching.RequestPatternBuilder; import hudson.model.*; import it.com.atlassian.bitbucket.jenkins.internal.fixture.BitbucketJenkinsRule; import it.com.atlassian.bitbucket.jenkins.internal.fixture.BitbucketProxyRule; import it.com.atlassian.bitbucket.jenkins.internal.fixture.GitHelper; import it.com.atlassian.bitbucket.jenkins.internal.fixture.JenkinsProjectHandler; import jenkins.branch.MultiBranchProject; import org.jenkinsci.plugins.workflow.job.WorkflowJob; import org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.RuleChain; import org.junit.rules.TemporaryFolder; import org.junit.rules.TestRule; import org.junit.rules.Timeout; import wiremock.org.apache.http.HttpStatus; import java.io.IOException; import java.net.URL; import java.util.concurrent.TimeUnit; import static com.atlassian.bitbucket.jenkins.internal.model.BuildState.SUCCESSFUL; import static com.github.tomakehurst.wiremock.client.WireMock.*; import static it.com.atlassian.bitbucket.jenkins.internal.fixture.JenkinsProjectHandler.MASTER_BRANCH_PATTERN; import static it.com.atlassian.bitbucket.jenkins.internal.util.BitbucketUtils.*; import static java.lang.String.format; import static org.junit.Assert.assertNotNull; /** * Following tests use a real Bitbucket Server and Jenkins instance for integration testing, however, the build status is posted against * a stub. One of the primary reasons is parallel development. Since we can only start a *released* bitbucket Server version, we would * like to proceed with end to end testing. The secondary benefit is that we have more control over assertions. */ public class BuildStatusPosterIT { private final TemporaryFolder temporaryFolder = new TemporaryFolder(); private final Timeout testTimeout = new Timeout(0, TimeUnit.MINUTES); private final BitbucketJenkinsRule bbJenkinsRule = new BitbucketJenkinsRule(); private final BitbucketProxyRule bitbucketProxyRule = new BitbucketProxyRule(bbJenkinsRule); private final GitHelper gitHelper = new GitHelper(bbJenkinsRule); @Rule public final TestRule chain = RuleChain.outerRule(temporaryFolder) .around(testTimeout) .around(bitbucketProxyRule.getRule()); private String repoSlug; private JenkinsProjectHandler jenkinsProjectHandler; @Before public void setUp() throws Exception { String repoName = REPO_NAME + "-fork"; BitbucketRepository repository = forkRepository(PROJECT_KEY, REPO_SLUG, repoName); repoSlug = repository.getSlug(); String cloneUrl = repository.getCloneUrls() .stream() .filter(repo -> "http".equals(repo.getName())) .findFirst() .orElse(null) .getHref(); gitHelper.initialize(temporaryFolder.newFolder("repositoryCheckout"), cloneUrl); jenkinsProjectHandler = new JenkinsProjectHandler(bbJenkinsRule); } @After public void teardown() { jenkinsProjectHandler.cleanup(); deleteRepository(PROJECT_KEY, repoSlug); gitHelper.cleanup(); } @Test public void testAgainstFreeStyle() throws Exception { FreeStyleProject project = jenkinsProjectHandler.createFreeStyleProject(repoSlug, MASTER_BRANCH_PATTERN); String url = format("/rest/api/1.0/projects/%s/repos/%s/commits/%s/builds", PROJECT_KEY, repoSlug, gitHelper.getLatestCommit()); bitbucketProxyRule.getWireMock().stubFor(post( urlPathMatching(url)) .willReturn(aResponse().withStatus(HttpStatus.SC_NO_CONTENT))); FreeStyleBuild build = project.scheduleBuild2(0).get(); verify(requestBody(postRequestedFor(urlPathMatching(url)), build, bbJenkinsRule.getURL(), SUCCESSFUL, "refs/heads/master")); } @Test public void testAgainstPipelineWithBBCheckOutInScript() throws Exception { String bbSnippet = format("bbs_checkout branches: [[name: '*/master']], credentialsId: '%s', projectName: '%s', repositoryName: '%s', serverId: '%s'", bbJenkinsRule.getBbAdminUsernamePasswordCredentialsId(), PROJECT_KEY, repoSlug, bbJenkinsRule.getBitbucketServerConfiguration().getId()); String script = "node {\n" + " \n" + " stage('checkout') { \n" + bbSnippet + " }" + "}"; WorkflowJob job = jenkinsProjectHandler.createPipelineJob("wfj", script); String url = format("/rest/api/1.0/projects/%s/repos/%s/commits/%s/builds", PROJECT_KEY, repoSlug, gitHelper.getLatestCommit()); bitbucketProxyRule.getWireMock().stubFor(post( urlPathMatching(url)) .willReturn(aResponse().withStatus(HttpStatus.SC_NO_CONTENT))); jenkinsProjectHandler.runPipelineJob(job, build -> { try { verify(requestBody(postRequestedFor(urlPathMatching(url)), build, bbJenkinsRule.getURL(), SUCCESSFUL, "refs/heads/master")); } catch (IOException e) { throw new RuntimeException(e); } }); } @Test public void testAgainstPipelineWithBitbucketSCM() throws Exception { WorkflowJob wfj = jenkinsProjectHandler.createPipelineJobWithBitbucketScm("wfj", repoSlug, MASTER_BRANCH_PATTERN); String latestCommit = checkInJenkinsFile( "pipeline {\n" + " agent any\n" + "\n" + " stages {\n" + " stage('Build') {\n" + " steps {\n" + " echo 'Building..'\n" + " }\n" + " }\n" + " }\n" + "}"); String url = format("/rest/api/1.0/projects/%s/repos/%s/commits/%s/builds", PROJECT_KEY, repoSlug, latestCommit); bitbucketProxyRule.getWireMock().stubFor(post( urlPathMatching(url)) .willReturn(aResponse().withStatus(HttpStatus.SC_NO_CONTENT))); jenkinsProjectHandler.runPipelineJob(wfj, build -> { try { verify(requestBody(postRequestedFor(urlPathMatching(url)), build, bbJenkinsRule.getURL(), SUCCESSFUL, "refs/heads/master")); } catch (IOException e) { throw new RuntimeException(e); } }); } @Test public void testAgainstMultibranchWithBBCheckout() throws Exception { WorkflowMultiBranchProject mbp = jenkinsProjectHandler.createMultibranchJob("mbp", PROJECT_KEY, repoSlug); jenkinsProjectHandler.performBranchScanning(mbp); String latestCommit = checkInJenkinsFile( "pipeline {\n" + " agent any\n" + "\n" + " stages {\n" + " stage('Build') {\n" + " steps {\n" + " echo 'Building..'\n" + " }\n" + " }\n" + " }\n" + "}"); String url = format("/rest/api/1.0/projects/%s/repos/%s/commits/%s/builds", PROJECT_KEY, repoSlug, latestCommit); bitbucketProxyRule.getWireMock().stubFor(post( urlPathMatching(url)) .willReturn(aResponse().withStatus(HttpStatus.SC_NO_CONTENT))); jenkinsProjectHandler.performBranchScanning(mbp); jenkinsProjectHandler.runWorkflowJobForBranch(mbp, "master", build -> { try { verify(requestBody(postRequestedFor(urlPathMatching(url)), build, bbJenkinsRule.getURL(), SUCCESSFUL, "refs/heads/master")); } catch (IOException e) { throw new RuntimeException(e); } }); } @Test public void testCorrectGitCommitIdUsed() throws Exception { String bbSnippet = format("bbs_checkout branches: [[name: '*/master']], credentialsId: '%s', projectName: '%s', repositoryName: '%s', serverId: '%s'", bbJenkinsRule.getBbAdminUsernamePasswordCredentialsId(), PROJECT_KEY, repoSlug, bbJenkinsRule.getBitbucketServerConfiguration().getId()); String script = "node {\n" + " \n" + " stage('checkout') { \n" + bbSnippet + " }" + "}"; WorkflowJob wfj = jenkinsProjectHandler.createPipelineJob("wj", script); String url1 = format("/rest/api/1.0/projects/%s/repos/%s/commits/%s/builds", PROJECT_KEY, repoSlug, gitHelper.getLatestCommit()); bitbucketProxyRule.getWireMock().stubFor(post( urlPathMatching(url1)) .willReturn(aResponse().withStatus(HttpStatus.SC_NO_CONTENT))); jenkinsProjectHandler.runPipelineJob(wfj, build -> { try { verify(requestBody(postRequestedFor(urlPathMatching(url1)), build, bbJenkinsRule.getURL(), SUCCESSFUL, "refs/heads/master")); } catch (IOException e) { throw new RuntimeException(e); } }); String latestCommit = gitHelper.pushEmptyCommit("test message"); String url2 = format("/rest/api/1.0/projects/%s/repos/%s/commits/%s/builds", PROJECT_KEY, repoSlug, latestCommit); bitbucketProxyRule.getWireMock().stubFor(post( urlPathMatching(url2)) .willReturn(aResponse().withStatus(HttpStatus.SC_NO_CONTENT))); jenkinsProjectHandler.runPipelineJob(wfj, build -> { try { verify(requestBody(postRequestedFor(urlPathMatching(url2)), build, bbJenkinsRule.getURL(), SUCCESSFUL, "refs/heads/master")); } catch (IOException e) { throw new RuntimeException(e); } }); } private static RequestPatternBuilder requestBody(RequestPatternBuilder requestPatternBuilder, Run<?, ?> build, URL jenkinsUrl, BuildState buildState, String refName) { Job<?, ?> job = build.getParent(); BitbucketRevisionAction bitbucketRevisionAction = build.getAction(BitbucketRevisionAction.class); assertNotNull(bitbucketRevisionAction); String jenkinsUrlAsString = jenkinsUrl.toExternalForm(); ItemGroup<?> parentProject = job.getParent(); boolean isMultibranch = parentProject instanceof MultiBranchProject; String parentName = isMultibranch ? parentProject.getFullName() : job.getFullName(); String name = isMultibranch ? parentProject.getDisplayName() + " » " + job.getDisplayName() : job.getDisplayName(); return requestPatternBuilder .withRequestBody( equalToJson( format("{" + "\"buildNumber\":\"%s\"," + "\"description\":\"%s\"," + "\"duration\":%d," + "\"key\":\"%s\"," + "\"name\":\"%s\"," + "\"parent\":\"%s\"," + "\"ref\":\"%s\"," + "\"state\":\"%s\"," + "\"url\":\"%s%sdisplay/redirect\"" + "}", build.getId(), buildState.getDescriptiveText(build.getDisplayName(), build.getDurationString()), build.getDuration(), job.getFullName(), name, parentName, refName, buildState, jenkinsUrlAsString, build.getUrl()) ) ); } private String checkInJenkinsFile(String content) throws Exception { return gitHelper.addFileToRepo("master", "Jenkinsfile", content); } }
[ "noreply@github.com" ]
jsaribeirolopes.noreply@github.com
39f465b6142803d9ccb0beb9a5047ed0d1764c1b
3514ff7eb1d3729144cd14f36d47134b8d4e160a
/app/src/main/java/com/example/alexandru/grile/model/Answer.java
320982faca2cf154d28b3d8306276b95ec09295c
[]
no_license
alexandruLaurentiu/grile
416f76a5c02bc2ef510f44803500a53be00bcfd9
aa350a63ef40625c815865fc4d98ca27f336be25
refs/heads/master
2020-04-20T08:08:25.617051
2019-02-01T16:56:37
2019-02-01T16:56:37
168,730,562
0
0
null
null
null
null
UTF-8
Java
false
false
766
java
package com.example.alexandru.grile.model; import android.widget.CheckBox; /** * Created by Alexandru on 10/05/2018. */ public class Answer extends TextModel { private CheckBox checkBox; private boolean correctAnswer; public Answer(String text) { super(text); } public Answer(String text, boolean correctAnswer) { super(text); this.correctAnswer = correctAnswer; } public CheckBox getCheckBox() { return checkBox; } public void setCheckBox(CheckBox checkBox) { this.checkBox = checkBox; } public boolean isCorrectAnswer() { return correctAnswer; } public void setCorrectAnswer(boolean correctAnswer) { this.correctAnswer = correctAnswer; } }
[ "alexandru.hodut94@e-uvt.ro" ]
alexandru.hodut94@e-uvt.ro
adcf2bce980350f05574e45ba938789a80dc2d47
9176b10c2aa5f7c17a0c369b30571d436b41c834
/src/com/wangjulong/cp5/Main.java
1660df64b88cec6b360f78ec3fbb3bba76b8575e
[]
no_license
wangjulong/cp5Analysis
73b973dbcb92b1ffcfa5f76959621816e092739a
db0d74ed04cde8a4da9312d30c2b006d0c386c0f
refs/heads/master
2021-01-13T08:58:12.164688
2016-09-25T07:33:53
2016-09-25T07:33:53
69,150,161
0
0
null
null
null
null
UTF-8
Java
false
false
649
java
package com.wangjulong.cp5; import com.wangjulong.cp5.analysis.NumberAnalysis; import com.wangjulong.cp5.db.DataUpdate; import java.io.IOException; import java.sql.SQLException; public class Main { public static void main(String[] args) throws IOException, SQLException { System.out.println("Hello CP5"); // 更新数据程序 // DataUpdate.update(); // 准备数据 DatabaseAccess databaseAccess = new DatabaseAccess(); int[][] allData = databaseAccess.getAllNumber(); NumberAnalysis numberAnalysis = new NumberAnalysis(allData, 10, 80); numberAnalysis.analysis(); } }
[ "496349619@qq.com" ]
496349619@qq.com