blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
6320f614a9ad86114c00806b6c59380857a476bf
b662562b6111848c68eb666d030e35336b05916b
/Ccnee/src/common/handler/SummernoteImgDeleteHandler.java
0e3b493a1a7a1599cea1cb5f9f5b21a29cbf0e50
[]
no_license
taewonMin/EscapeRoom
e267d24c92009404056cf21204cf4b2d137dd972
db28401d12c2e57fe00375b7707a0e8ce59f181d
refs/heads/master
2023-03-07T22:14:01.749390
2021-02-09T09:50:50
2021-02-09T09:50:50
336,993,339
1
0
null
null
null
null
UTF-8
Java
false
false
1,188
java
package common.handler; import java.io.File; import java.io.PrintWriter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.fasterxml.jackson.databind.ObjectMapper; import common.command.DeleteImgCommand; import common.util.GetUploadPath; public class SummernoteImgDeleteHandler implements CommandHandler { @Override public boolean isRedirect(HttpServletRequest req) { return false; } @Override public String process(HttpServletRequest request, HttpServletResponse response) throws Exception { ObjectMapper mapper = new ObjectMapper(); DeleteImgCommand delReq = mapper.readValue(request.getReader(), DeleteImgCommand.class); String savePath = GetUploadPath.getUploadPath("summernote.img"); String fileName = delReq.getFileName(); File target = new File(savePath + File.separator + fileName); response.setContentType("text/plain;charset=utf-8"); PrintWriter out = response.getWriter(); if (!target.exists()) { out.print(fileName + " 이미지를 삭제할 수 없습니다."); } else { target.delete(); out.print(fileName + " 이미지를 삭제했습니다."); } return null; } }
[ "mtw9411@naver.com" ]
mtw9411@naver.com
12db7deca2ad1a5a729967c8636fae2b73bbccdb
80403ec5838e300c53fcb96aeb84d409bdce1c0c
/server/api/src/org/labkey/api/util/HelpTopic.java
e777ae9208852aec12b43cd130eca220f8abcf12
[]
no_license
scchess/LabKey
7e073656ea494026b0020ad7f9d9179f03d87b41
ce5f7a903c78c0d480002f738bccdbef97d6aeb9
refs/heads/master
2021-09-17T10:49:48.147439
2018-03-22T13:01:41
2018-03-22T13:01:41
126,447,224
0
1
null
null
null
null
UTF-8
Java
false
false
4,138
java
/* * Copyright (c) 2007-2016 LabKey Corporation * * 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.labkey.api.util; import org.jetbrains.annotations.NotNull; import org.junit.Assert; import org.junit.Test; import org.labkey.api.Constants; import org.labkey.api.annotations.JavaRuntimeVersion; import org.labkey.api.view.NavTree; import java.util.Formatter; import java.util.Map; /** * User: Tamra Myers * Date: Feb 15, 2007 * Time: 1:10:09 PM */ public class HelpTopic { private static String TARGET_NAME = "labkeyHelp"; // LabKey help should always appear in the same tab/window private static String HELP_VERSION = Formats.f1.format(Constants.getPreviousReleaseVersion()); @JavaRuntimeVersion // Update this link whenever we require a new major Java version so we always point at the current docs private static final String JDK_JAVADOC_BASE_URL = "http://docs.oracle.com/javase/8/docs/api/"; private String _topic; public static final HelpTopic DEFAULT_HELP_TOPIC = new HelpTopic("default"); public HelpTopic(@NotNull String topic) { _topic = topic; } @Override public String toString() { return getHelpTopicHref(); } public String getHelpTopicHref() { return "http://www.labkey.org/wiki/home/documentation/" + HELP_VERSION + "/page.view?name=" + _topic; } // Create a simple link (just an <a> tag with plain mixed case text, no graphics) that links to the help topic, displays // the provided text, uses the standard target, etc. Use in cases where LabKey standard link style doesn't fit in. public String getSimpleLinkHtml(String displayText) { StringBuilder html = new StringBuilder(); html.append("<a href=\""); html.append(PageFlowUtil.filter(getHelpTopicHref())); html.append("\" target=\""); html.append(TARGET_NAME); html.append("\">"); html.append(PageFlowUtil.filter(displayText)); html.append("</a>"); return html.toString(); } private static final Map<String, String> TARGET_MAP = PageFlowUtil.map("target", TARGET_NAME); // TODO: Use this in places where it makes sense (search results page, etc.) // Create a standard LabKey style link (all caps + arrow right) to the help topic, displaying the provided text, using the standard target, etc. public String getLinkHtml(String displayText) { return PageFlowUtil.textLink(displayText, getHelpTopicHref(), null, null, TARGET_MAP); } // Get create a NavTree for a menu item that to the help topic, displays the provided text, uses the standard target, etc. public NavTree getNavTree(String displayText) { NavTree tree = new NavTree(displayText, getHelpTopicHref()); tree.setTarget(HelpTopic.TARGET_NAME); return tree; } /** * @return a link to the Oracle JDK JavaDocs for whatever the current LabKey-supported JDK is */ public static String getJDKJavaDocLink(Class c) { return JDK_JAVADOC_BASE_URL + c.getName().replace(".", "/").replace("$", ".") + ".html"; } public static class TestCase extends Assert { @Test public void testJavaDocLinkGeneration() { assertEquals(JDK_JAVADOC_BASE_URL + "java/util/Formatter.html", getJDKJavaDocLink(Formatter.class)); assertEquals(JDK_JAVADOC_BASE_URL + "java/util/Map.Entry.html", getJDKJavaDocLink(Map.Entry.class)); } } }
[ "klum@labkey.com" ]
klum@labkey.com
c0d91b41b12d61f7a98b3b14176e384ec50427cc
b481fe91efcfe5c1e55265a1e09999f5a55ee62b
/backend/src/main/java/com/zka/lyceena/services/StudentsServiceImpl.java
e0b2a121420895386c56659913b8f230404d50dd
[]
no_license
ziedayadi/lyceena
742e845178d64908d5ce04500adbe46a0c9ec2c4
62e3a8c8d2b08ee1307014803d8f740fa92e5547
refs/heads/master
2023-03-18T19:18:13.621270
2021-03-03T15:10:32
2021-03-03T15:10:32
318,531,558
0
0
null
null
null
null
UTF-8
Java
false
false
2,695
java
package com.zka.lyceena.services; import com.zka.lyceena.constants.CacheNames; import com.zka.lyceena.dao.ClassesJpaRepository; import com.zka.lyceena.dao.ParentsJpaRepository; import com.zka.lyceena.dao.StudentsJpaRepository; import com.zka.lyceena.dto.StudentDto; import com.zka.lyceena.entities.actors.Parent; import com.zka.lyceena.entities.actors.Student; import com.zka.lyceena.entities.classes.Class; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; import java.util.List; @Service public class StudentsServiceImpl implements StudentsService { @Autowired private StudentsJpaRepository studentsJpaRepository; @Autowired private ParentsJpaRepository parentsJpaRepository; @Autowired private ClassesJpaRepository classesJpaRepository; @Autowired private UserDetailsProvider userDetailsProvider; @Cacheable(CacheNames.STUDENTS) @Override public List<Student> findAll() { return this.studentsJpaRepository.findAll(Sort.by(Sort.Direction.ASC, "firstName", "lastName")); } @CacheEvict(value=CacheNames.STUDENTS, allEntries=true) @Override public void save(StudentDto dto) { Student entity = this.studentsJpaRepository.findById(dto.getId()).orElse(new Student()); entity.setSex(dto.getSex()); entity.setStatus(dto.getStatus()); entity.setEmailAdress(dto.getEmailAdress()); entity.setFirstName(dto.getFirstName()); entity.setLastName(dto.getLastName()); entity.setBirthDate(dto.getBirthDate()); entity.setUserName(dto.getUserName()); Parent parent = this.parentsJpaRepository.findById(dto.getParentId()).get(); Class aClass = this.classesJpaRepository.findById(dto.getClassId()).get(); entity.setParent(parent); entity.setAClass(aClass); this.studentsJpaRepository.save(entity); } @Override @CacheEvict(value=CacheNames.STUDENTS, allEntries=true) public void deleteById(String id) { this.studentsJpaRepository.deleteById(id); } @Override public List<Student> findByParentId(String parentId) { return this.studentsJpaRepository.findByParentId(parentId); } @Override public Student findOne(String id) { return this.studentsJpaRepository.findById(id).orElseThrow(); } @Override public Student findOneByUsername(String username) { return this.studentsJpaRepository.findByUserName(username).orElseThrow(); } }
[ "zied.ayedi22@gmail.com" ]
zied.ayedi22@gmail.com
e90287a33157b62aece70ee7f0d863c41ca8ba12
cb2ebeea362221fb76eec61774714bc1efbe7213
/assignments/loops/abcloop.java
f35ac08b9b1e55358655a5df1afd0b9b3b13f065
[]
no_license
Devonthurman/thurman-apcs
5a73334047c7a7712c257ff89b08ca907ec1c724
8301236c478e3356f4ed2225bcf108ed0486998e
refs/heads/master
2021-05-08T23:18:31.013175
2018-05-24T14:26:57
2018-05-24T14:26:57
119,703,261
0
0
null
null
null
null
UTF-8
Java
false
false
210
java
class abcloop{ public static void main (String[] args){ char a=' '; int n=32; while (n <= 126){ System.out.println(a); a++; n++; } } }
[ "Thurm.Devo2019@ssusd.org" ]
Thurm.Devo2019@ssusd.org
c672e8f2a73cfc382cfda0544be4e843640714f4
d15b02a100340747709eda1b3f157752498e7192
/src/main/java/com/lingkj/common/utils/payment/wxpay/WeChatPayService.java
ea5e3cce3a44b6bae9e8ce9d51741f392559a857
[ "Apache-2.0" ]
permissive
Apl0m3/CLKJ-MINJIAOBAO-JAVA
a3420de0c7bbfe03660bcf34d1442ab4e41f9f0f
7f2171155a3c7cd0d4e7291cb95e9592d792a9e2
refs/heads/master
2022-06-28T22:50:21.487550
2019-12-12T01:40:18
2019-12-12T01:40:18
227,493,368
0
1
Apache-2.0
2022-06-21T02:25:52
2019-12-12T01:21:28
JavaScript
UTF-8
Java
false
false
13,717
java
package com.lingkj.common.utils.payment.wxpay; import com.lingkj.common.exception.RRException; import com.lingkj.project.transaction.entity.TransactionRecord; import org.apache.commons.lang.StringUtils; import org.springframework.stereotype.Service; import java.io.DataOutputStream; import java.io.IOException; import java.io.OutputStream; import java.math.BigDecimal; import java.net.HttpURLConnection; import java.net.URL; import java.util.Map; import java.util.SortedMap; import java.util.TreeMap; @Service("wePay") public class WeChatPayService { /** * 微信支付统一下单 **/ public Map<String, Object> unifiedOrder(TransactionRecord order, Map<String, Object> map) throws RRException { Map<String, Object> resultMap; try { WxPaySendData paySendData = new WxPaySendData(); //构建微信支付请求参数集合 paySendData.setAppId(WeChatConfig.APP_ID); paySendData.setBody("购买商品"); paySendData.setMchId(WeChatConfig.MCH_ID); paySendData.setNonceStr(WeChatUtils.getRandomStr(32)); paySendData.setNotifyUrl(WeChatConfig.NOTIFY_URL); paySendData.setDeviceInfo("WEB"); paySendData.setOutTradeNo(order.getTransactionId()); BigDecimal order_price = order.getAmount().multiply(new BigDecimal(100)); paySendData.setTotalFee(order_price.intValue()); paySendData.setTradeType(WeChatConfig.TRADE_TYPE_JSAPI); paySendData.setSpBillCreateIp((String) map.get("remoteIp")); paySendData.setOpenId((String) map.get("openId")); //将参数拼成map,生产签名 SortedMap<String, Object> params = buildParamMap(paySendData); paySendData.setSign(WeChatUtils.getSign(params)); //将请求参数对象转换成xml String reqXml = WeChatUtils.sendDataToXml(paySendData); //发送请求 HttpURLConnection urlConnection = getHttpURLConnection(reqXml); resultMap = WeChatUtils.parseXml(urlConnection.getInputStream()); } catch (Exception e) { throw new RRException("微信支付统一下单异常", e); } return resultMap; } private HttpURLConnection getHttpURLConnection(String reqXml) throws IOException { byte[] xmlData = reqXml.getBytes("UTF-8"); URL url = new URL(WeChatConfig.UNIFIED_ORDER_URL); HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setRequestMethod("POST"); urlConnection.setDoOutput(true); urlConnection.setDoInput(true); urlConnection.setUseCaches(false); urlConnection.setRequestProperty("Accept-Charset", "UTF-8"); urlConnection.setRequestProperty("contentType", "UTF-8"); urlConnection.setRequestProperty("Content_Type", "text/xml"); urlConnection.setRequestProperty("Content-length", String.valueOf(xmlData.length)); DataOutputStream outputStream = new DataOutputStream(urlConnection.getOutputStream()); outputStream.write(xmlData); outputStream.flush(); outputStream.close(); return urlConnection; } /** * 支付 * * @param order * @param map * @return * @throws RRException */ /* public Map<String, Object> paySyaoOrder(SynergismAttendOrder order, Map<String, Object> map) throws RRException { Map<String, Object> resultMap; try { WxPaySendData paySendData = new WxPaySendData(); //构建微信支付请求参数集合 paySendData.setAppId(WeChatConfig.APP_ID); paySendData.setBody("购买互助计划"); paySendData.setMchId(WeChatConfig.MCH_ID); paySendData.setNonceStr(WeChatUtils.getRandomStr(32)); paySendData.setNotifyUrl(WeChatConfig.NOTIFY_URL); paySendData.setDeviceInfo("WEB"); paySendData.setOutTradeNo(order.getSyaoOrderNum()); //System.out.println(BigDecimal.valueOf(100).multiply(BigDecimal.valueOf(order.getSyaoOrderPrice()))); BigDecimal order_price = BigDecimal.valueOf(order.getSyaoOrderPrice()).multiply(new BigDecimal(100)); paySendData.setTotalFee(order_price.intValue()); paySendData.setTradeType(WeChatConfig.TRADE_TYPE_JSAPI); paySendData.setSpBillCreateIp((String) map.get("remoteIp")); paySendData.setOpenId((String) map.get("openId")); //将参数拼成map,生产签名 SortedMap<String, Object> params = buildParamMap(paySendData); paySendData.setSign(WeChatUtils.getSign(params)); //将请求参数对象转换成xml String reqXml = WeChatUtils.sendDataToXml(paySendData); //发送请求 byte[] xmlData = reqXml.getBytes("UTF-8"); URL url = new URL(WeChatConfig.UNIFIED_ORDER_URL); HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setDoOutput(true); urlConnection.setDoInput(true); urlConnection.setUseCaches(false); // urlConnection.setRequestMethod("POST"); urlConnection.setRequestProperty("Accept-Charset", "UTF-8"); urlConnection.setRequestProperty("contentType", "UTF-8"); urlConnection.setRequestProperty("Content_Type", "text/xml"); urlConnection.setRequestProperty("Content-length", String.valueOf(xmlData.length)); DataOutputStream outputStream = new DataOutputStream(urlConnection.getOutputStream()); outputStream.write(xmlData); outputStream.flush(); outputStream.close(); resultMap = WeChatUtils.parseXml(urlConnection.getInputStream()); resultMap.put("package", params.toString()); } catch (Exception e) { e.printStackTrace(); throw new RRException("微信支付统一下单异常:" + e.getMessage(), e); } return resultMap; }*/ /** * 构建统一下单参数map 用于生成签名 * * @param data * @return SortedMap<String, Object> */ private static SortedMap<String, Object> buildParamMap(WxPaySendData data) { SortedMap<String, Object> paramters = new TreeMap<String, Object>(); if (null != data) { if (StringUtils.isNotEmpty(data.getAppId())) { paramters.put("appid", data.getAppId()); } if (StringUtils.isNotEmpty(data.getAttach())) { paramters.put("attach", data.getAttach()); } if (StringUtils.isNotEmpty(data.getBody())) { paramters.put("body", data.getBody()); } if (StringUtils.isNotEmpty(data.getDetail())) { paramters.put("detail", data.getDetail()); } if (StringUtils.isNotEmpty(data.getDeviceInfo())) { paramters.put("device_info", data.getDeviceInfo()); } if (StringUtils.isNotEmpty(data.getFeeType())) { paramters.put("fee_type", data.getFeeType()); } if (StringUtils.isNotEmpty(data.getGoodsTag())) { paramters.put("goods_tag", data.getGoodsTag()); } if (StringUtils.isNotEmpty(data.getLimitPay())) { paramters.put("limit_pay", data.getLimitPay()); } if (StringUtils.isNotEmpty(data.getMchId())) { paramters.put("mch_id", data.getMchId()); } if (StringUtils.isNotEmpty(data.getNonceStr())) { paramters.put("nonce_str", data.getNonceStr()); } if (StringUtils.isNotEmpty(data.getNotifyUrl())) { paramters.put("notify_url", data.getNotifyUrl()); } if (StringUtils.isNotEmpty(data.getOpenId())) { paramters.put("openid", data.getOpenId()); } if (StringUtils.isNotEmpty(data.getOutTradeNo())) { paramters.put("out_trade_no", data.getOutTradeNo()); } if (StringUtils.isNotEmpty(data.getSign())) { paramters.put("sign", data.getSign()); } if (StringUtils.isNotEmpty(data.getSpBillCreateIp())) { paramters.put("spbill_create_ip", data.getSpBillCreateIp()); } if (StringUtils.isNotEmpty(data.getTimeStart())) { paramters.put("time_start", data.getTimeStart()); } if (StringUtils.isNotEmpty(data.getTimeExpire())) { paramters.put("time_expire", data.getTimeExpire()); } if (StringUtils.isNotEmpty(data.getProductId())) { paramters.put("product_id", data.getProductId()); } if (data.getTotalFee().compareTo(0) > 0) { paramters.put("total_fee", data.getTotalFee()); } if (StringUtils.isNotEmpty(data.getTradeType())) { paramters.put("trade_type", data.getTradeType()); } //申请退款参数 if (StringUtils.isNotEmpty(data.getTransactionId())) { paramters.put("transaction_id", data.getTransactionId()); } if (StringUtils.isNotEmpty(data.getOutRefundNo())) { paramters.put("out_refund_no", data.getOutRefundNo()); } if (StringUtils.isNotEmpty(data.getOpUserId())) { paramters.put("op_user_id", data.getOpUserId()); } if (StringUtils.isNotEmpty(data.getRefundFeeType())) { paramters.put("refund_fee_type", data.getRefundFeeType()); } if (null != data.getRefundFee() && data.getRefundFee() > 0) { paramters.put("refund_fee", data.getRefundFee()); } } return paramters; } public static void main(String[] args) { Map<String, Object> resultMap; // 28 32 4 101 2018-04-02 13:30:07 0 S17069945790362101 2 try {//获取请求Ip地址=14.116.137.167---用户标识openId=oxvFav4oW-pCjaWz5VgCfKdnjeY4 WxPaySendData paySendData = new WxPaySendData(); //构建微信支付请求参数集合 paySendData.setAppId(WeChatConfig.APP_ID); paySendData.setAttach("微信订单支付:测试"); paySendData.setBody("商品描述"); paySendData.setMchId(WeChatConfig.MCH_ID); paySendData.setNonceStr(WeChatUtils.getRandomStr(32)); paySendData.setNotifyUrl(WeChatConfig.NOTIFY_URL); paySendData.setDeviceInfo("WEB"); paySendData.setOutTradeNo("S17069945790362101"); paySendData.setTotalFee(1); paySendData.setTradeType(WeChatConfig.TRADE_TYPE_JSAPI); paySendData.setSpBillCreateIp("14.116.137.167"); paySendData.setOpenId("oxvFav4oW-pCjaWz5VgCfKdnjeY4"); //将参数拼成map,生产签名 SortedMap<String, Object> params = buildParamMap(paySendData); paySendData.setSign(WeChatUtils.getSign(params)); //将请求参数对象转换成xml String reqXml = WeChatUtils.sendDataToXml(paySendData); //发送请求 byte[] xmlData = reqXml.getBytes("UTF-8"); URL url = new URL(WeChatConfig.UNIFIED_ORDER_URL); HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setDoOutput(true); urlConnection.setDoInput(true); urlConnection.setUseCaches(false); // urlConnection.setRequestMethod("POST"); urlConnection.setRequestProperty("Accept-Charset", "UTF-8"); urlConnection.setRequestProperty("contentType", "UTF-8"); urlConnection.setRequestProperty("Content_Type", "text/xml"); urlConnection.setRequestProperty("Content-length", String.valueOf(xmlData.length)); /* DataOutputStream outputStream = new DataOutputStream(urlConnection.getOutputStream()); // xmlData = new String(xmlData.getBytes("UTF-8"), "ISO-8859-1"); System.out.println(xmlData); outputStream.write(xmlData); outputStream.flush(); outputStream.close();*/ OutputStream outputStream = urlConnection.getOutputStream(); outputStream.write(reqXml.getBytes("UTF-8")); if (outputStream != null) { try { outputStream.close(); } catch (IOException e) { e.printStackTrace(); } } //返回打开连接读取的输入流,输入流转化为StringBuffer类型,这一套流程要记住,常用 /* BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); String line = null; StringBuffer stringBuffer = new StringBuffer(); while ((line = bufferedReader.readLine()) != null) { //转化为UTF-8的编码格式 line = new String(line.getBytes("UTF-8")); stringBuffer.append(line); } System.out.println("Get请求返回的数据"); System.out.println(stringBuffer.toString());*/ resultMap = WeChatUtils.parseXml(urlConnection.getInputStream()); } catch (Exception e) { // throw new RRException("微信支付统一下单异常", e); } } }
[ "811203731@qq.com" ]
811203731@qq.com
9797910a372a08555505826dcfc9e084c492d75a
35ecd3b30d2e9a34b77805ec1174568b588e4619
/src/app/test/NioFileSupport.java
5577395e518143f5132b74c6e54c15d0fc273d19
[ "BSD-2-Clause" ]
permissive
Indivikar/WacherTreeView
bfdfc3a37bd26c82ab9ed68abbd103eae89f5150
4daa2c0ea8001a24bbc2686ab3a23f0d95c93e2f
refs/heads/master
2021-07-02T11:04:34.342099
2019-03-26T15:07:24
2019-03-26T15:07:24
144,189,318
0
0
null
null
null
null
UTF-8
Java
false
false
2,774
java
package app.test; import java.nio.file.*; import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE; import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY; public class NioFileSupport { /** change this as appropriate for your file system structure. */ public static final String DIRECTORY_TO_WATCH = "D:\\Test"; public static void main(String[] args) throws Exception { // get the directory we want to watch, using the Paths singleton class Path toWatch = Paths.get(DIRECTORY_TO_WATCH); if(toWatch == null) { throw new UnsupportedOperationException("Directory not found"); } // make a new watch service that we can register interest in // directories and files with. WatchService myWatcher = toWatch.getFileSystem().newWatchService(); // start the file watcher thread below MyWatchQueueReader fileWatcher = new MyWatchQueueReader(myWatcher); Thread th = new Thread(fileWatcher, "FileWatcher"); th.start(); // register a file toWatch.register(myWatcher, ENTRY_CREATE, ENTRY_MODIFY); th.join(); } /** * This Runnable is used to constantly attempt to take from the watch * queue, and will receive all events that are registered with the * fileWatcher it is associated. In this sample for simplicity we * just output the kind of event and name of the file affected to * standard out. */ private static class MyWatchQueueReader implements Runnable { /** the watchService that is passed in from above */ private WatchService myWatcher; public MyWatchQueueReader(WatchService myWatcher) { this.myWatcher = myWatcher; } /** * In order to implement a file watcher, we loop forever * ensuring requesting to take the next item from the file * watchers queue. */ @Override public void run() { try { // get the first event before looping WatchKey key = myWatcher.take(); while(key != null) { // we have a polled event, now we traverse it and // receive all the states from it for (WatchEvent event : key.pollEvents()) { System.out.printf("Received %s event for file: %s\n", event.kind(), event.context() ); } key.reset(); key = myWatcher.take(); } } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("Stopping thread"); } } }
[ "d.hirt@indivikar.ch" ]
d.hirt@indivikar.ch
7a4905fe6f968ad9d9565fa3f820284c47896645
30864c8be1f1319eabb702d299916972e2021886
/app/src/test/java/com/animesh/roy/exportjson/ExampleUnitTest.java
bbdf80ed99d5df1ae88c188d577c14429a2a1917
[]
no_license
markali3003/ParseJSONRecyclerView
0678644b69c6daa5e4fcbc1023d1685f537a68c3
b02bea5e4fbccd52032a9e0ccebba4e3a5f8b0ba
refs/heads/master
2022-03-26T02:00:45.327369
2020-01-02T13:13:09
2020-01-02T13:13:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
387
java
package com.animesh.roy.exportjson; 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); } }
[ "royanimesh2211@gmail.com" ]
royanimesh2211@gmail.com
ae73a04d7a1bf9e83ce84e190833774ea67ecad6
8e56eb69c9a1a14fb3be1e57eafca959eb059394
/private/src/com/zwq/demo/sort/QuickSort.java
b3639aaecc742e9635ed21a0e3ce22ae9bf2aec2
[]
no_license
jkzhou24/my-workspace
cc0072385553810a7d2b099b2304b3821f10b914
5f581f2affdad065b69544bae8669ac5221cbc3b
refs/heads/master
2022-08-20T23:51:12.011115
2019-08-06T01:15:52
2019-08-06T01:16:06
99,407,003
0
0
null
null
null
null
UTF-8
Java
false
false
2,621
java
package com.zwq.demo.sort; import java.util.Arrays; /* * @description: * @author: zwq * @date: 2019/6/24 20:26 */ public class QuickSort { //arr 需要排序的数组 //low 开始时最左边的索引=0 //high 开始时最右边的索引=arr.length-1 public static void quickSort(int[] arr, int low, int high) { int i, j, temp; if (low > high) { return; } i = low;//左边哨兵的索引 j = high;//右边哨兵的索引 //temp就是基准位 temp = arr[low];//以最左边为 基准位 while (i < j) { //先看右边,依次往左递减 //先从右往左找一个小于 基准位的数 //当右边的哨兵位置所在的数>基准位的数 时 //继续从右往左找(同时 j 索引-1) //找到后会跳出 while循环 System.out.println("AAA: " + Arrays.toString(arr)); while (temp <= arr[j] && i < j) { j--; } System.out.println("BBB: " + Arrays.toString(arr)); //再看左边,依次往右递增 //步骤和上面类似 while (temp >= arr[i] && i < j) { i++; } System.out.println("CCC: " + Arrays.toString(arr)); //如果满足条件则交换 if (i < j) { //z、y 都是临时参数,用于存放 左右哨兵 所在位置的数据 int z = arr[i]; int y = arr[j]; // 左右哨兵 交换数据(互相持有对方的数据) arr[i] = y; arr[j] = z; } System.out.println("DDD: " + Arrays.toString(arr)); } //这时 跳出了 “while (i<j) {}” 循环 //说明 i=j 左右在同一位置 //最后将基准为与i和j相等位置的数字交换 arr[low] = arr[i];//或 arr[low] = arr[j]; arr[i] = temp;//或 arr[j] = temp; //i=j //这时 左半数组<(i或j所在索引的数)<右半数组 //也就是说(i或j所在索引的数)已经确定排序位置, 所以就不用再排序了, // 只要用相同的方法 分别处理 左右数组就可以了 //递归调用左半数组 quickSort(arr, low, j - 1); //递归调用右半数组 quickSort(arr, j + 1, high); } public static void main(String[] args) { int[] arr = {6, 1, 2, 7, 9, 3, 4, 5, 10, 8}; //int[] arr = {3, 1, 2, 5 , 4}; quickSort(arr, 0, arr.length - 1); System.out.println(Arrays.toString(arr)); } }
[ "zhouwenqing@richinfo.cn" ]
zhouwenqing@richinfo.cn
4996f125cd1f88e50359d53348dc153f3d17fb4d
045af083d767c4def538f8a7af1b8490eaef2dce
/src/main/java/org/jhipster/blogdemojhipster/repository/BankRepository.java
abc291f90a3fd7c885809ee8a608f037d0dcdeaf
[]
no_license
dame620/baamtuAppointement
d76670245cbc15d8e2f8e5c5a77af3ce8fd0f04a
c30658575744e7a0d6e6a02411499fd552c908fd
refs/heads/master
2023-07-04T03:22:38.108748
2021-08-12T11:18:23
2021-08-12T11:18:23
395,292,772
0
0
null
null
null
null
UTF-8
Java
false
false
370
java
package org.jhipster.blogdemojhipster.repository; import org.jhipster.blogdemojhipster.domain.Bank; import org.springframework.data.jpa.repository.*; import org.springframework.stereotype.Repository; /** * Spring Data SQL repository for the Bank entity. */ @SuppressWarnings("unused") @Repository public interface BankRepository extends JpaRepository<Bank, Long> {}
[ "damendiaye620@gmail.com" ]
damendiaye620@gmail.com
51a2062131fe9c8c01bcc3e3a1d23010b0b0177e
ca6fe39543bcc3fcc480cf52b2fd712cb1558e2f
/src/main/java/com/java/test/service/IBookService.java
6d06334e8855f12d30bc648c021625ac276bc2bc
[]
no_license
shangjianwei/java2demo
d44086035ba0f3790f1ea41018cb65d29737a06c
dfe7db7d4862a146e8fa014761201e4a11d7353e
refs/heads/master
2020-03-26T03:18:50.942826
2018-08-12T08:15:27
2018-08-12T08:15:27
144,449,484
0
0
null
null
null
null
UTF-8
Java
false
false
251
java
package com.java.test.service; import com.java.test.model.Book; import com.baomidou.mybatisplus.service.IService; /** * <p> * 服务类 * </p> * * @author test * @since 2018-08-12 */ public interface IBookService extends IService<Book> { }
[ "shangjianwei159@163.com" ]
shangjianwei159@163.com
dae8ba27263f4260656982092684a5c89a77bc2d
9a4305f7856cda224e34c7ee7873f24bd6576854
/Java Projects/Card Game Sim/src/Main.java
d161cfdddd133ee8ee5c2045eac2461d033e5909
[]
no_license
zachklaus/past-projects
cf5f678f377cc5551a63f1da2888c26dd4448efd
3570c93725e24dead23d51cb3992d6ce7487e1d2
refs/heads/main
2023-07-11T17:28:36.589485
2021-08-18T04:36:37
2021-08-18T04:36:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,635
java
import java.util.ArrayList; import java.util.Collections; import java.util.concurrent.TimeUnit; public class Main { private static ArrayList<Card> deck = null; private static ArrayList<Card> playerOneDeck = null; private static ArrayList<Card> playerTwoDeck = null; public static void main(String[] args) { System.out.println("This is a simulation of a game of \"War\" card game between two players."); //waitClear(); deck = new ArrayList<Card>(); buildDeck(); System.out.println("Shuffling deck..."); //waitClear(); Collections.shuffle(deck); System.out.println("Dealing cards to players..."); //waitClear(); dealCards(); } public static void buildDeck() { for (int i = 2; i < 15; i++) { Card card = new Card(i, 1); deck.add(card); } for (int i = 2; i < 15; i++) { Card card = new Card(i, 2); deck.add(card); } for (int i = 2; i < 15; i++) { Card card = new Card(i, 3); deck.add(card); } for (int i = 2; i < 15; i++) { Card card = new Card(i, 4); deck.add(card); } } public static void clearConsole() { for (int i = 0; i < 70; i++) { System.out.println(""); } } public static void waitClear() { try { TimeUnit.SECONDS.sleep(8); } catch (Exception e) { System.err.println("Sleep error!"); System.exit(-1); } clearConsole(); } public static void dealCards() { for (int i = 0; i < 26; i++) { System.out.println("i = " + i); playerOneDeck.add(deck.get(i)); } for (int i = 27; i < 52; i++) { System.out.println("i = " + i); playerTwoDeck.add(deck.get(i)); } } }
[ "zachklausner@gmail.com" ]
zachklausner@gmail.com
5fffe77c510be2ccca6ffa0dfbf87768aa62994c
5d642a5aadfbcf5d876c3d22d6e9d16835ac91f6
/ice006OneTwoThreeStepsDP/src/ice006OneTwoThreeStepsDP/Test.java
cffdf5972a7e616a3d5cf68c9ba982c5d0c573c9
[]
no_license
theeverlastingconcubine/ooOooOoo
704f9ac4d156057fd22877d9d1b1b13333366cf5
40330fd5a2453286de7001bd79de558890317893
refs/heads/master
2021-01-11T09:16:36.834406
2017-06-19T16:37:37
2017-06-19T16:37:37
77,223,365
0
1
null
2017-01-09T21:23:59
2016-12-23T12:13:25
Java
UTF-8
Java
false
false
801
java
package ice006OneTwoThreeStepsDP; public class Test { public static void main(String[] args){ System.out.println(countWays(37)); System.out.println(Integer.MIN_VALUE); } // public static int countWays(int n){ // // if (n<0) return 0; // else if (n==0) return 1; // else return countWays(n-1)+countWays(n-2)+countWays(n-3); // // } public static int countWays(int n){ int[] memo = new int[n+1]; for(int i = 0; i<memo.length; i++) memo[i] = -1; return countWays(n,memo); } private static int countWays(int n, int[] memo){ if(n<0) return 0; else if(n==0) return 1; else { if(memo[n]>-1) return memo[n]; else memo[n] = countWays(n-1,memo) + countWays(n-2, memo) + countWays(n-3, memo); } return memo[n]; } }
[ "woodennoise@yandex.ru" ]
woodennoise@yandex.ru
e11a9ebed344429b1890dbcb064002384805590e
99a9f565faeb18d82ff0f275313d16b90a8dfe14
/src/main/java/com/org/https/api/exception/FileStorageException.java
a70ec270dbaf88bbcde49c652d86978a9ffb424d
[]
no_license
gdmedage/spring-https-with-ssl
be207a960f6493e973b8f45164820777171ba866
31ac69bbcd8649d1f441afde947c8bc99dbecba9
refs/heads/master
2022-06-09T16:42:22.576787
2020-05-01T21:04:18
2020-05-01T21:04:18
260,553,062
0
0
null
2020-05-03T08:31:28
2020-05-01T20:33:36
Java
UTF-8
Java
false
false
790
java
package com.org.https.api.exception; /** * The Class FileStorageException. */ public class FileStorageException extends MyException { /** The Constant serialVersionUID. */ private static final long serialVersionUID = 1L; /** * Instantiates a new file storage exception. * * @param message the message */ public FileStorageException(String message) { super(message); } /** * Instantiates a new file storage exception. * * @param message the message * @param cause the cause */ public FileStorageException(String message, Throwable cause) { super(message, cause); } /** * Instantiates a new file storage exception. * * @param cause the cause */ public FileStorageException(Throwable cause) { super(cause); } }
[ "gdmedage@gmail.com" ]
gdmedage@gmail.com
db32b4ab67019899d0ed90754bea03d0238e2d31
89e22c243beae7cf103bbab03ed7316344cd2b57
/src/com/example/maptrees/GPSTracker.java
feb088fcc25df9177917716caa31fe993a6a1c00
[]
no_license
siddddhant/MapTrees
f107ca800e2c2f4ef8feed0d83325934eb870336
4750f21ccb5069a6d7f9ae55ac5e64a1092d5d17
refs/heads/master
2016-09-05T22:33:44.875667
2014-03-28T17:45:17
2014-03-28T17:45:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,494
java
package com.example.maptrees; import java.io.IOException; import java.util.List; import java.util.Locale; import android.app.AlertDialog; import android.app.Service; import android.content.Context; import android.content.Intent; import android.location.Address; import android.location.Geocoder; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.os.IBinder; import android.util.Log; public class GPSTracker extends Service implements LocationListener { private final Context mContext; //flag for GPS Status boolean isGPSEnabled = false; //flag for network status boolean isNetworkEnabled = false; boolean canGetLocation = false; Location location; double latitude; double longitude; //The minimum distance to change updates in metters private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10; //10 metters //The minimum time beetwen updates in milliseconds private static final long MIN_TIME_BW_UPDATES = 1000 * 60 * 1; // 1 minute //Declaring a Location Manager protected LocationManager locationManager; public GPSTracker(Context context) { this.mContext = context; getLocation(); } public Location getLocation() { try { locationManager = (LocationManager) mContext.getSystemService(LOCATION_SERVICE); //getting GPS status isGPSEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); //getting network status isNetworkEnabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER); if (!isGPSEnabled && !isNetworkEnabled) { // no network provider is enabled } else { this.canGetLocation = true; //First get location from Network Provider if (isNetworkEnabled) { locationManager.requestLocationUpdates( LocationManager.NETWORK_PROVIDER, MIN_TIME_BW_UPDATES, MIN_DISTANCE_CHANGE_FOR_UPDATES, this); Log.d("Network", "Network"); if (locationManager != null) { location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); updateGPSCoordinates(); } } //if GPS Enabled get lat/long using GPS Services if (isGPSEnabled) { if (location == null) { locationManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, MIN_TIME_BW_UPDATES, MIN_DISTANCE_CHANGE_FOR_UPDATES, this); Log.d("GPS Enabled", "GPS Enabled"); if (locationManager != null) { location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); updateGPSCoordinates(); } } } } } catch (Exception e) { //e.printStackTrace(); Log.e("Error : Location", "Impossible to connect to LocationManager", e); } return location; } public void updateGPSCoordinates() { if (location != null) { latitude = location.getLatitude(); longitude = location.getLongitude(); } } /** * Stop using GPS listener * Calling this function will stop using GPS in your app */ public void stopUsingGPS() { if (locationManager != null) { locationManager.removeUpdates(GPSTracker.this); } } /** * Function to get latitude */ public double getLatitude() { if (location != null) { latitude = location.getLatitude(); } return latitude; } /** * Function to get longitude */ public double getLongitude() { if (location != null) { longitude = location.getLongitude(); } return longitude; } /** * Function to check GPS/wifi enabled */ public boolean canGetLocation() { return this.canGetLocation; } /** * Function to show settings alert dialog */ /** * Get list of address by latitude and longitude * @return null or List<Address> */ public List<Address> getGeocoderAddress(Context context) { if (location != null) { Geocoder geocoder = new Geocoder(context, Locale.ENGLISH); try { List<Address> addresses = geocoder.getFromLocation(latitude, longitude, 1); return addresses; } catch (IOException e) { //e.printStackTrace(); Log.e("Error : Geocoder", "Impossible to connect to Geocoder", e); } } return null; } /** * Try to get AddressLine * @return null or addressLine */ /** * Try to get Locality * @return null or locality */ /** * Try to get Postal Code * @return null or postalCode */ /** * Try to get CountryName * @return null or postalCode */ @Override public void onLocationChanged(Location location) { } @Override public void onProviderDisabled(String provider) { } @Override public void onProviderEnabled(String provider) { } @Override public void onStatusChanged(String provider, int status, Bundle extras) { // TODO Auto-generated method stub } @Override public IBinder onBind(Intent intent) { // TODO Auto-generated method stub return null; } }
[ "siddddhant@gmail.com" ]
siddddhant@gmail.com
25969103ef247ca191c167547c590ae203cd5272
08afd4b18fa902d9a383b248e14efcb062ed7b26
/src/main/java/com/qf/report/vo/SearchVo.java
ea89578728fa390d5b5ce4ede26d23af3bf1cf5a
[]
no_license
zhengnaixiang/back_newsWebSite
6d333c0de3b83ff5176b44afc13e6f883c34a2c7
ea698b9ff77f5cdaeb83be67bb1703a755585587
refs/heads/master
2020-05-09T13:12:51.973742
2019-04-23T11:50:49
2019-04-23T11:50:49
181,142,132
1
0
null
null
null
null
UTF-8
Java
false
false
597
java
package com.qf.report.vo; public class SearchVo { int currentPage; String search; public int getCurrentPage() { return currentPage; } public void setCurrentPage(int currentPage) { this.currentPage = currentPage; } public String getSearch() { return search; } public void setSearch(String search) { this.search = search; } @Override public String toString() { return "SearchVo{" + "currentPage=" + currentPage + ", search='" + search + '\'' + '}'; } }
[ "1021596238@qq.com" ]
1021596238@qq.com
5abe2aa03617a707d1df8db3d7bcc7004ef54a25
eb64a90ecbe47a8e95c68d0193a22f8d2cee1fd2
/mysimplexml/src/main/java/dcll/jbou/mysimplexml/App.java
cb9e9b37687882b0b3f1100d8c655f9b3021ab09
[]
no_license
Jeremy-BOURDIOL/MySimpleXml
724bf852f63e1a79d5a40c8db54d23cabaf6d45a
85cc5435e039e7e0964fc405c2f0d4a26e1ddb45
refs/heads/master
2016-09-05T23:51:16.928761
2013-02-22T11:53:19
2013-02-22T11:53:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
184
java
package dcll.jbou.mysimplexml; /** * Hello world! * */ public class App { public static void main( String[] args ) { System.out.println( "Hello World!" ); } }
[ "jeremy.bourdiol@univ-tlse3.fr" ]
jeremy.bourdiol@univ-tlse3.fr
04908d4e80ea787885d57d8b2cc0069a3542d155
02cbc33bb33663ac450460e5522c50b60d51515e
/src/main/java/iot/restful/JsonSerializable.java
3d6ba23dc54b2761bc4d187f86aec98b3ffdeea9
[]
no_license
kwlee0220/sensorthings
e8e9a9c9f7982a926f2d677095459daf7ee63c26
6b4841184929cc7d59a1f1822b35f25ad6a7d248
refs/heads/master
2021-01-17T22:21:12.590043
2019-07-29T14:03:17
2019-07-29T14:03:17
84,194,772
0
0
null
null
null
null
UTF-8
Java
false
false
180
java
package iot.restful; import java.util.Map; /** * * @author Kang-Woo Lee (ETRI) */ public interface JsonSerializable { public Map<String, Object> serialize(); }
[ "kwlee@etri.re.kr" ]
kwlee@etri.re.kr
24b25208a27a7dbe487ba61fa534eaf41557c69c
3fbfeccd2746b2def5f4e63c1d5f423458c4a3ba
/PM2/src/aufgabenblatt1/a3/TestArrayListe.java
b55e99707f7f492c9175348cba7b8b57858505a7
[]
no_license
adem40/PM2
9fe58cdda10ce3b11647a4b95c4a27a6f5a9aaa3
a644de0c3769a3b2b6e3fcf83debf8e58a639df3
refs/heads/master
2021-01-11T19:34:55.756673
2016-12-14T14:11:47
2016-12-14T14:11:47
69,030,249
0
0
null
null
null
null
UTF-8
Java
false
false
2,194
java
package aufgabenblatt1.a3; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import org.junit.Test; public class TestArrayListe { @Test public void testHinzufuegen(){ ArrayListe<Integer> arrayList = new ArrayListe<Integer>(); arrayList.hinzufuegen(10); Integer test = 10; assertEquals(test,arrayList.get(0)); } @Test public void testEntfernen(){ ArrayListe<Integer> arrayList = new ArrayListe<Integer>(); arrayList.hinzufuegen(3); arrayList.hinzufuegen(4); arrayList.hinzufuegen(5); arrayList.entfernen(4); Integer test[] = {3,5}; for(int i =0; i< arrayList.getAnzahlElemente();i++){ assertEquals(test[i],arrayList.get(i)); } } @Test public void testEntferneElementAnIndex(){ ArrayListe<Integer> arrayList = new ArrayListe<Integer>(); arrayList.hinzufuegen(4); arrayList.hinzufuegen(6); arrayList.hinzufuegen(4); arrayList.hinzufuegen(7); arrayList.entferneElementAnIndex(2); Integer test[] = {4,6,7}; for(int i =0; i< arrayList.getAnzahlElemente();i++){ assertEquals(test[i],arrayList.get(i)); } } @Test public void testGetAnzahlElemente(){ ArrayListe<Integer> arrayList = new ArrayListe<Integer>(); arrayList.hinzufuegen(1); arrayList.hinzufuegen(2); arrayList.hinzufuegen(3); arrayList.hinzufuegen(4); int test = 4; assertEquals(test,arrayList.getAnzahlElemente()); } @Test public void testGetKleinstesElement(){ ArrayListe<Integer> arrayList = new ArrayListe<Integer>(); arrayList.hinzufuegen(16); arrayList.hinzufuegen(10); arrayList.hinzufuegen(5); arrayList.hinzufuegen(8); Integer test = 5; assertEquals(test,arrayList.getKleinstesElement()); } @Test public void testStaticTest(){ ArrayListe<Integer> arrayList1 = new ArrayListe<Integer>(); ArrayListe<String> arrayList2 = new ArrayListe<String>(); arrayList1.hinzufuegen(100); arrayList1.hinzufuegen(18); arrayList2.hinzufuegen("Text"); arrayList2.hinzufuegen("weiterer Text"); assertFalse(ErsteElementNummer.ersteElementNummer(arrayList2)); assertTrue(ErsteElementNummer.ersteElementNummer(arrayList1)); } }
[ "adem.da40@gmail.com" ]
adem.da40@gmail.com
7b9b573247c43a10dd44d877b2cfa331593e56a6
2b3ce20333b5a28f0c5abc938ac2fafd9e709de6
/src/main/java/YNRPC/VariantReal64.java
6d545e157c89a763d777f51e4c239605438f5d28
[]
no_license
flyme6/ynWeb
3a25918c5210abb268d302c7a574da536d961240
8af4ccb3814416d4a232fcbfd54e1fa5d92b86b9
refs/heads/master
2020-04-30T07:08:30.794032
2019-03-20T07:18:52
2019-03-20T07:18:52
176,675,271
1
3
null
null
null
null
UTF-8
Java
false
false
2,529
java
// ********************************************************************** // // Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved. // // This copy of Ice is licensed to you under the terms described in the // ICE_LICENSE file included in this distribution. // // ********************************************************************** // // Ice version 3.6.4 // // <auto-generated> // // Generated from file `RpcCommon.ice' // // Warning: do not edit this file. // // </auto-generated> // package YNRPC; public class VariantReal64 extends Variant { public VariantReal64() { super(); } public VariantReal64(VarType vt, double value) { super(vt); this.value = value; } private static class __F implements Ice.ObjectFactory { public Ice.Object create(String type) { assert(type.equals(ice_staticId())); return new VariantReal64(); } public void destroy() { } } private static Ice.ObjectFactory _factory = new __F(); public static Ice.ObjectFactory ice_factory() { return _factory; } public static final String[] __ids = { "::Ice::Object", "::YNRPC::Variant", "::YNRPC::VariantReal64" }; public boolean ice_isA(String s) { return java.util.Arrays.binarySearch(__ids, s) >= 0; } public boolean ice_isA(String s, Ice.Current __current) { return java.util.Arrays.binarySearch(__ids, s) >= 0; } public String[] ice_ids() { return __ids; } public String[] ice_ids(Ice.Current __current) { return __ids; } public String ice_id() { return __ids[2]; } public String ice_id(Ice.Current __current) { return __ids[2]; } public static String ice_staticId() { return __ids[2]; } protected void __writeImpl(IceInternal.BasicStream __os) { __os.startWriteSlice(ice_staticId(), -1, false); __os.writeDouble(value); __os.endWriteSlice(); super.__writeImpl(__os); } protected void __readImpl(IceInternal.BasicStream __is) { __is.startReadSlice(); value = __is.readDouble(); __is.endReadSlice(); super.__readImpl(__is); } public double value; public VariantReal64 clone() { return (VariantReal64)super.clone(); } public static final long serialVersionUID = 1002531941L; }
[ "z1078966873@163.com" ]
z1078966873@163.com
2878d1ccd1449dc2cdd364a18d93024a1772dd19
a4b5316c3e7c8499ced7f96332eccb5309d9fe26
/java-12/src/main/java/com/challenge/entity/User.java
029a90d032c2f65ac813a7b049a6cb28d8a86e73
[]
no_license
alfredosantos/codenation
7dcb4aa1beb40b145f81a97ad6c60eb5ec8312ef
3befa651dee2d781a432efd856ab0557d6be3335
refs/heads/master
2022-05-31T15:13:07.519394
2019-09-13T17:16:55
2019-09-13T17:16:55
200,568,547
0
0
null
2022-05-20T21:08:27
2019-08-05T02:29:44
Java
UTF-8
Java
false
false
2,537
java
package com.challenge.entity; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; import java.time.LocalDateTime; import java.util.Arrays; import java.util.Collection; import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EntityListeners; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.validation.constraints.Email; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; @Entity @AllArgsConstructor @NoArgsConstructor @Data @EntityListeners(AuditingEntityListener.class) @EqualsAndHashCode(of = "id") @Table(name = "users") public class User implements UserDetails { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column @NotNull @Size(max = 100) private String fullName; @Column @Email @Size(max = 100) @NotNull private String email; @Column @NotNull @Size(max = 50) private String nickname; @Column @NotNull @Size(max = 255) private String password; @Column @CreatedDate @JsonFormat(pattern = "yyyy-MM-dd HH:mm") private LocalDateTime createdAt; @JsonIgnore @OneToMany(mappedBy = "id.user") private List<Candidate> candidates; @JsonIgnore @OneToMany(mappedBy = "id.user") private List<Submission> submissions; @Override public Collection<? extends GrantedAuthority> getAuthorities() { return Arrays.asList(new SimpleGrantedAuthority("ADMIN")); } @Override public String getPassword() { return this.password; } @Override public String getUsername() { return this.email; } @Override public boolean isAccountNonExpired() { return true; } @Override public boolean isAccountNonLocked() { return true; } @Override public boolean isCredentialsNonExpired() { return true; } @Override public boolean isEnabled() { return true; } }
[ "alfredgsantos@gmail.com" ]
alfredgsantos@gmail.com
5b4c3a7e4fe4a658eade582217a6d97116df803b
7d50d2d40f13b51d356c20c942ca3b0ef1da3a2c
/src/main/java/com/jadbit/jhipstertest/config/CloudDatabaseConfiguration.java
0c528a094df9b3e9906e2dee673785ad3517e564
[]
no_license
armandotaglieri/jhipstertest
ba9a73b3a2f1d11fa7e2d919ef7964f136be1c68
401a377c2596f216e193ef6bc844892918807570
refs/heads/master
2021-04-12T09:50:26.148245
2018-03-25T21:33:16
2018-03-25T21:33:16
126,742,165
0
0
null
null
null
null
UTF-8
Java
false
false
698
java
package com.jadbit.jhipstertest.config; import io.github.jhipster.config.JHipsterConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.cloud.config.java.AbstractCloudConfig; import org.springframework.context.annotation.*; import javax.sql.DataSource; @Configuration @Profile(JHipsterConstants.SPRING_PROFILE_CLOUD) public class CloudDatabaseConfiguration extends AbstractCloudConfig { private final Logger log = LoggerFactory.getLogger(CloudDatabaseConfiguration.class); @Bean public DataSource dataSource() { log.info("Configuring JDBC datasource from a cloud provider"); return connectionFactory().dataSource(); } }
[ "jhipster-bot@users.noreply.github.com" ]
jhipster-bot@users.noreply.github.com
731094c544c5eb7ee3c1d42c91c03712434bc898
1927b43e27ecbe9d0e8f99120e2b71e599baee4a
/src/redrun/model/gameobject/map/Start.java
acf7e42e488e9ec993d608af13bad421eb2cc74f
[ "MIT" ]
permissive
l50/redrun
d869b1a4d060c851be75179d3c567de0fe343ce5
a6ef54f99e512c0d59edee010058cb42e9998073
refs/heads/master
2020-03-29T09:36:55.688658
2015-01-13T02:36:33
2015-01-13T02:36:33
28,900,525
1
0
null
null
null
null
UTF-8
Java
false
false
5,061
java
package redrun.model.gameobject.map; import redrun.model.constants.Direction; import redrun.model.constants.Scale; import redrun.model.constants.TrapType; import redrun.model.gameobject.MapObject; import redrun.model.gameobject.world.InvisibleWall; import redrun.model.gameobject.world.Plane; import redrun.model.gameobject.world.RectangularPrism; /** * This class represents a start point that denotes the beginning of the level. * * @author Troy Squillaci * @version 1.0 * @since 2014-11-22 * @see MapObject */ public class Start extends MapObject { /** * Creates a new oriented start point at the specified location. * * @param x the x position of the start point * @param y the y position of the start point * @param z the z position of the start point * @param groundTexture an optional texture to apply to the ground * @param wallTexture an optional texture to apply to the walls * @param orientation the cardinal direction of the start point * @param trap an optional trap to place on the start point */ public Start(float x, float y, float z, String groundTexture, String wallTexture, Direction orientation, TrapType type) { super(x, y, z, groundTexture, wallTexture, orientation, type); int size = Scale.MAP_SCALE.scale(); switch (orientation) { case NORTH: { components.add(new Plane(x, y, z, groundTexture, Direction.NORTH, size)); components.add(new RectangularPrism(x, y + 1.5f, z + (size / 2), wallTexture, size, 3.0f, 1.0f)); components.add(new RectangularPrism(x + (size / 2), y + 1.5f, z, wallTexture, 1.0f, 3.0f, size - 2)); components.add(new RectangularPrism(x, y + 1.5f, z + -(size / 2), wallTexture, size, 3.0f, 1.0f)); break; } case EAST: { components.add(new Plane(x, y, z, groundTexture, Direction.EAST, size)); components.add(new RectangularPrism(x + -(size / 2), y + 1.5f, z, wallTexture, 1.0f, 3.0f, size)); components.add(new RectangularPrism(x, y + 1.5f, z + (size / 2), wallTexture, size - 2, 3.0f, 1.0f)); components.add(new RectangularPrism(x + (size / 2), y + 1.5f, z, wallTexture, 1.0f, 3.0f, size)); break; } case SOUTH: { components.add(new Plane(x, y, z, groundTexture, Direction.SOUTH, size)); components.add(new RectangularPrism(x, y + 1.5f, z + -(size / 2), wallTexture, size, 3.0f, 1.0f)); components.add(new RectangularPrism(x + -(size / 2), y + 1.5f, z, wallTexture, 1.0f, 3.0f, size - 2)); components.add(new RectangularPrism(x, y + 1.5f, z + (size / 2), wallTexture, size, 3.0f, 1.0f)); break; } case WEST: { components.add(new Plane(x, y, z, groundTexture, Direction.WEST, size)); components.add(new RectangularPrism(x + (size / 2), y + 1.5f, z, wallTexture, 1.0f, 3.0f, size)); components.add(new RectangularPrism(x, y + 1.5f, z + -(size / 2), wallTexture, size - 2, 3.0f, 1.0f)); components.add(new RectangularPrism(x + -(size / 2), y + 1.5f, z, wallTexture, 1.0f, 3.0f, size)); break; } default: { try { throw new IllegalArgumentException(); } catch (IllegalArgumentException ex) { ex.printStackTrace(); } } } switch (orientation) { case NORTH: { components.add(new InvisibleWall(x, y + 10f, z + (size / 2), null, size, 10.0f, 0.0f)); components.add(new InvisibleWall(x + (size / 2), y + 10f, z, null, 0.0f, 10.0f, size - 2)); components.add(new InvisibleWall(x, y + 10f, z + -(size / 2), null, size, 10.0f, 0.0f)); break; } case EAST: { components.add(new InvisibleWall(x + -(size / 2), y + 10f, z, null, 0.0f, 10.0f, size)); components.add(new InvisibleWall(x, y + 10f, z + (size / 2), null, size - 2, 10.0f, 0.0f)); components.add(new InvisibleWall(x + (size / 2), y + 10f, z, null, 0.0f, 10.0f, size)); break; } case SOUTH: { components.add(new InvisibleWall(x, y + 10f, z + -(size / 2), null, size, 10.0f, 0.0f)); components.add(new InvisibleWall(x + -(size / 2), y + 10f, z, null, 0.0f, 10.0f, size - 2)); components.add(new InvisibleWall(x, y + 10f, z + (size / 2), null, size, 10.0f, 0.0f)); break; } case WEST: { components.add(new InvisibleWall(x + (size / 2), y + 10f, z, null, 0.0f, 10.0f, size)); components.add(new InvisibleWall(x, y + 10f, z + -(size / 2), null, size - 2, 10.0f, 0.0f)); components.add(new InvisibleWall(x + -(size / 2), y + 10f, z, null, 0.0f, 10.0f, size)); break; } default: { try { throw new IllegalArgumentException(); } catch (IllegalArgumentException ex) { ex.printStackTrace(); } } } } @Override public int compareTo(MapObject o) { return 0; } }
[ "jayson.e.grace@gmail.com" ]
jayson.e.grace@gmail.com
99c15d8d9a84707b7b442d8fc49da58b17f0a8ab
a4ff580ce0f7da6479ca174551c5762a356dc234
/src/main/java/RemoveElement/wangyuhuich/RemoveElement.java
f2adcc7c223a19ad126f94316e3eecc17b8e2c2c
[]
no_license
hans1980775481/leetcode
1d9f82f9bf333789f734652b730f824693678c56
ddcec681e0be6625e539fa51e2bdccb3c943f08d
refs/heads/master
2023-01-01T21:32:52.037633
2019-07-21T05:43:36
2019-07-21T05:43:36
198,017,545
0
0
null
null
null
null
UTF-8
Java
false
false
986
java
package RemoveElement.wangyuhuich; /** * 思路:快速排序 * * 结果:执行用时 : 1 ms, 在Remove Element的Java提交中击败了99.59% 的用户 * 内存消耗 : 34.5 MB, 在Remove Element的Java提交中击败了95.75% 的用户 */ public class RemoveElement { public int removeElement(int[] nums, int val) { int valCount = 0; for (int i = 0; i < nums.length; i++) { if (nums[i] == val) { valCount++; } } int i = 0; int j = nums.length - 1; while (i < j) { while (nums[i] != val && i < j) { i++; } while (nums[j] == val && i < j) { j--; } nums[j] = nums[i] + (nums[i] = nums[j]) - nums[j]; } return nums.length - valCount; } public static void main(String[] args) { int[] arr = {3, 2, 2, 3}; new RemoveElement().removeElement(arr, 3); } }
[ "wtchange@163.com" ]
wtchange@163.com
e80becea0cdfe464f8821da073522b6a41caad78
4326300db0816e928fde7236af8eb3967ae95f13
/src/main/java/de/embl/cba/tables/results/ResultsChildAndParentMerger.java
eaaf2fd18a429c0a0e6ac6c4cd04527ce31034f3
[ "BSD-2-Clause" ]
permissive
embl-cba/imagej-utils
c8d6a3dafc087d329ea2bd4386cbf3c399ea86fe
61c1d0342e015db3628bcfc40d254638a487c178
refs/heads/master
2022-11-07T06:30:09.656289
2022-09-23T13:43:20
2022-09-23T13:43:20
157,394,467
0
0
BSD-2-Clause
2022-09-23T13:39:15
2018-11-13T14:37:27
Java
UTF-8
Java
false
false
5,507
java
/*- * #%L * Various Java code for ImageJ * %% * Copyright (C) 2018 - 2022 EMBL * %% * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * #L% */ package de.embl.cba.tables.results; import ij.measure.ResultsTable; import java.util.*; import java.util.stream.IntStream; public class ResultsChildAndParentMerger { private final ResultsTable childTable; private final ResultsTable parentTable; private final String childName; private final String childTableParentLabelColumn; private final HashMap< Integer, Map< String, List< Double > > > parentToFeatureToMeasurements; private final HashMap< Integer, Integer > parentToRowIndex; public enum AggregationMode { Mean, Sum, Max, Min } public ResultsChildAndParentMerger( ResultsTable childTable, ResultsTable parentTable, String childName, String parentLabelColumn ) { this.childTable = childTable; this.childName = childName; this.childTableParentLabelColumn = parentLabelColumn; this.parentTable = parentTable; parentToRowIndex = initParentToRowIndex(); parentToFeatureToMeasurements = initFeatureMap(); populateFeatureMap( parentToFeatureToMeasurements ); } public ResultsTable appendToParentTable( AggregationMode mode ) { parentToFeatureToMeasurements.keySet().stream().forEach( parent -> { parentToFeatureToMeasurements.get( parent ).keySet().stream().forEach( measurement -> { DoubleSummaryStatistics statistics = parentToFeatureToMeasurements.get( parent ).get( measurement ).stream().mapToDouble( x -> x ).summaryStatistics(); Integer row = parentToRowIndex.get( parent ); if ( measurement.equals( "Label" ) ) { final String column = childName + "_" + "Count"; parentTable.setValue( column, row, statistics.getCount() ); } else { final String column = "" + childName + "_" + mode + "_" + measurement; switch ( mode ) { case Mean: parentTable.setValue( column, row, statistics.getAverage() ); case Sum: parentTable.setValue( column, row, statistics.getSum() ); case Max: parentTable.setValue( column, row, statistics.getMax() ); case Min: parentTable.setValue( column, row, statistics.getMin() ); } } } ); } ); return parentTable; } private HashMap< Integer, Map< String, List< Double > > > initFeatureMap() { HashMap< Integer, Map< String, List< Double > > > parentToFeatureToMeasurements = new HashMap<>(); IntStream.range( 0, parentTable.size() ).forEach( row -> { final HashMap< String, List< Double > > featureToMeasurements = new HashMap<>(); parentToFeatureToMeasurements.put( getParentLabel( row ), featureToMeasurements ); Arrays.stream( childTable.getHeadings() ).forEach( column -> featureToMeasurements.put( column, new ArrayList<>() ) ); } ); return parentToFeatureToMeasurements; } private void populateFeatureMap( HashMap< Integer, Map< String, List< Double > > > parentToFeatureToMeasurements ) { Arrays.stream( childTable.getHeadings() ).forEach( column -> { IntStream.range( 0, childTable.size() ).forEach( rowIndex -> { final int parentIndex = ( int ) childTable.getValue( childTableParentLabelColumn, rowIndex ); if ( parentIndex != 0 ) { if ( column.equals( "Label" ) ) { parentToFeatureToMeasurements.get( parentIndex ).get( column ).add( 1.0D ); } else { final double measurement = childTable.getValue( column, rowIndex ); parentToFeatureToMeasurements.get( parentIndex ).get( column ).add( measurement ); } } else { // child object that does not reside within any parent object } } ); } ); } private HashMap< Integer, Integer > initParentToRowIndex() { HashMap< Integer, Integer > parentLabelToRowIndex = new HashMap<>(); IntStream.range( 0, parentTable.size() ).forEach( row -> { parentLabelToRowIndex.put( getParentLabel( row ), row ); }); return parentLabelToRowIndex; } private int getParentLabel( int row ) { try { // when opened from csv file return ( int ) parentTable.getValue( "Label", row ); } catch ( Exception e ) { // when obtained from MorpholibJ return Integer.parseInt( parentTable.getLabel( row ) ); } } }
[ "christian.tischer@embl.de" ]
christian.tischer@embl.de
f9d88634f70e6750228cbc79674110a9f0e3299d
7111765f847cc3f630556670a5d901f8bf2599f8
/src/medicine/gui/ProductManager.java
e8e5bbc1248e1ba1f842d5593d97a37e327b2e94
[]
no_license
MartinStevo/Medicament
c64f0b5bcd4dd99b106231b99aba48df591d95e0
4986d2ef19f2ba558f6f47364b7ea3aabb717191
refs/heads/master
2022-11-01T03:04:40.045907
2020-06-16T14:14:51
2020-06-16T14:14:51
272,718,438
0
0
null
null
null
null
WINDOWS-1252
Java
false
false
6,021
java
package medicine.gui; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import javax.swing.GroupLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTextField; import medicine.Constants; import medicine.DataManager; import medicine.Medicament; import medicine.Constants.MEDICAMENT_TYPE; import medicine.Constants.VOLUME; public class ProductManager extends CommonDialog implements ActionListener { // serialization needs: private static final long serialVersionUID = 2436658205288199612L; private JLabel lblPriceValue; private JLabel lbl10PercentPriceValue; private JTextField tfPackages; private double price; // price for single package private double totalPrice; // price for all packages public ProductManager(final JFrame parent, final DataManager data) { super(parent, data); setTitle("Product manager"); } @Override protected JPanel createDesign() { // DESIGN: final JPanel panel = new JPanel(); final GroupLayout layout = new GroupLayout(panel); panel.setLayout(layout); layout.setAutoCreateContainerGaps(true); layout.setAutoCreateGaps(true); // Accept button: final JButton btnRegister = new JButton("Accept request"); btnRegister.addActionListener(this); btnRegister.setActionCommand(Constants.PRODUCT_ACTION_ACCEPT); // get selected Medicament: final Medicament medicament = dataManager.getSelectedMedicament(); final VOLUME volume = dataManager.getVolume(); // labels: final JLabel lblName = new JLabel(medicament.getName()); final JLabel lblFree = new JLabel(medicament.getType().toString()); final JLabel lblVolume = new JLabel(volume.toString()); final JLabel lblPrice = new JLabel("Price: "); lblPriceValue = new JLabel(); final JLabel lbl10PercentPrice = new JLabel("10% price to pay: "); lbl10PercentPriceValue = new JLabel(); final JLabel lblPieces = new JLabel("Packages: "); tfPackages = new JTextField("1"); tfPackages.setHorizontalAlignment(JTextField.RIGHT); tfPackages.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { final int key = e.getKeyCode(); switch (key) { case KeyEvent.VK_0: case KeyEvent.VK_1: case KeyEvent.VK_2: case KeyEvent.VK_3: case KeyEvent.VK_4: case KeyEvent.VK_5: case KeyEvent.VK_6: case KeyEvent.VK_7: case KeyEvent.VK_8: case KeyEvent.VK_9: case KeyEvent.VK_BACK_SPACE: case KeyEvent.VK_DELETE: case KeyEvent.VK_ENTER: handlePrice(); break; default: // ignore rest break; } } }); // initialization: calculatePrice(medicament, volume); // horizontal layout: layout.setHorizontalGroup(layout.createParallelGroup().addGroup(layout.createSequentialGroup().addComponent(lblName).addGap(20).addComponent(lblFree).addGap(20).addComponent(lblVolume).addGap(20)).addGroup(layout.createSequentialGroup().addComponent(lblPieces).addComponent(tfPackages, GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE)).addGroup(layout.createSequentialGroup().addComponent(lblPrice).addComponent(lblPriceValue)).addGroup( layout.createSequentialGroup().addComponent(lbl10PercentPrice).addComponent(lbl10PercentPriceValue)).addComponent(btnRegister)); // vertical layout: layout.setVerticalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup().addComponent(lblName).addComponent(lblFree).addComponent(lblVolume)).addGap(20).addGroup(layout.createParallelGroup().addComponent(lblPieces).addComponent(tfPackages, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)).addGap(50).addGroup(layout.createParallelGroup().addComponent(lblPrice).addComponent(lblPriceValue)).addGroup( layout.createParallelGroup().addComponent(lbl10PercentPrice).addComponent(lbl10PercentPriceValue)).addComponent(lbl10PercentPrice).addComponent(btnRegister)); return panel; } private void calculatePrice(final Medicament medicament, final VOLUME volume) { final double basicPrice = volume.getPrice(); if (!medicament.getType().isFree()) price = basicPrice; else price = basicPrice * 1.2d; // multiply penalty totalPrice = price; updatePriceLabel(); } private void updatePriceLabel() { lblPriceValue.setText(String.format("%.2f€", totalPrice)); lbl10PercentPriceValue.setText(String.format("%.2f€", totalPrice * 0.1d)); } private void handlePrice() { final String text = tfPackages.getText(); int packages = 0; try { // parse number of packages: packages = Integer.parseInt(text); } catch (final NumberFormatException e) { showErrorMessage(); tfPackages.setText("1"); return; } if (packages <= 0) { showErrorMessage(); tfPackages.setText("1"); return; } // recalculate total: totalPrice = packages * price; updatePriceLabel(); } private void showErrorMessage() { // display ERROR: JOptionPane.showMessageDialog(this, "Invalid package count!", "Error", JOptionPane.ERROR_MESSAGE); tfPackages.requestFocus(); } @Override public void actionPerformed(final ActionEvent event) { final String command = event.getActionCommand(); if (command.equals(Constants.PRODUCT_ACTION_ACCEPT)) { handlePrice(); dataManager.setFinalPrice(totalPrice); final MEDICAMENT_TYPE type = dataManager.getSelectedMedicament().getType(); // check type: if (type.equals(MEDICAMENT_TYPE.TYPE_V)) new MedicineRepresentative((JFrame) getParent(), dataManager).setVisible(true); else { final String message = String.format("Order in total price %.2f€ successfully completed.", totalPrice); JOptionPane.showMessageDialog(this, message, "Request complete", JOptionPane.INFORMATION_MESSAGE); } dispose(); } else System.err.println("Unsupported action command: " + command); } }
[ "martinstevo1995@gmail.com" ]
martinstevo1995@gmail.com
d7098009652f1fbdebcf12fa754a30df7cd1a830
40738c44b88c76f7a06a59e3b8978351e2fc96cd
/src/main/java/com/et/lesson02/entity/Emp.java
05745de67e8a29e0dab79937d9da0b1f2bcc0feb
[]
no_license
RoseWJJ/SpringBoot
3cad556503c495753ae239fedceae3f264549afa
e225b0e28a8392be74457437e8c1abc2a98becfc
refs/heads/master
2021-09-02T09:29:42.393771
2018-01-01T12:41:54
2018-01-01T12:41:54
115,918,333
0
0
null
null
null
null
UTF-8
Java
false
false
753
java
package com.et.lesson02.entity; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; public class Emp { private int id; private String name;//此处写属性名, 以防数据库列名和属性名不一致 private int deptid;//此处写数据库中的列名一致 时 可以不用谢 public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getDeptid() { return deptid; } public void setDeptid(int deptid) { this.deptid = deptid; } }
[ "admiin@admiin-PC" ]
admiin@admiin-PC
2a8d7ec9bead77530832e75f2aa8c32a03d0d605
e15e4f3bb97c8c4fdcb0405af764d5c9054fa5c8
/src/main/java/qiyi/timerService.java
9a18ae0a121c77f778478681e5d392ede5a70132
[]
no_license
JiaChunjie/test03
b7f8044f34198670db8f51da95c3fe9881bb4420
ba0aef9383641e3cf76228f31ca95fdd3b6e6013
refs/heads/master
2023-03-19T23:40:02.771697
2021-03-04T04:21:15
2021-03-04T04:21:15
344,344,844
0
0
null
null
null
null
UTF-8
Java
false
false
3,408
java
package qiyi; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import qiyi.util; public class timerService extends JFrame { private static final long serialVersionUID = 1L; private static final String INITIAL_LABEL_TEXT = "00:00:00 000"; // 计数线程 private CountingThread thread = new CountingThread(); // 记录程序开始时间 private long programStart = System.currentTimeMillis(); // 程序一开始就是暂停的 private long pauseStart = programStart; // 程序暂停的总时间 private long pauseCount = 0; private JLabel label = new JLabel(INITIAL_LABEL_TEXT); private JButton startPauseButton = new JButton("开始"); private JButton resetButton = new JButton("清零"); private ActionListener startPauseButtonListener = new ActionListener() { public void actionPerformed(ActionEvent e) { if (thread.stopped) { pauseCount += (System.currentTimeMillis() - pauseStart); thread.stopped = false; startPauseButton.setText("暂停"); } else { pauseStart = System.currentTimeMillis(); thread.stopped = true; startPauseButton.setText("继续"); } } }; private ActionListener resetButtonListener = new ActionListener() { public void actionPerformed(ActionEvent e) { pauseStart = programStart; pauseCount = 0; thread.stopped = true; label.setText(INITIAL_LABEL_TEXT); startPauseButton.setText("开始"); } }; public timerService(String title) throws HeadlessException { super(title); setDefaultCloseOperation(EXIT_ON_CLOSE); setLocation(300, 300); setResizable(false); util utilI = new util(); utilI.setupBorder(); utilI.setupLabel(); utilI.setupButtonsPanel(); startPauseButton.addActionListener(startPauseButtonListener); resetButton.addActionListener(resetButtonListener); thread.start(); // 计数线程一直就运行着 } private class CountingThread extends Thread { public boolean stopped = true; private CountingThread() { setDaemon(true); } @Override public void run() { while (true) { if (!stopped) { long elapsed = System.currentTimeMillis() - programStart - pauseCount; label.setText(format(elapsed)); } try { sleep(1); // 1毫秒更新一次显示 } catch (InterruptedException e) { e.printStackTrace(); System.exit(1); } } } // 将毫秒数格式化 private String format(long elapsed) { int hour, minute, second, milli; milli = (int) (elapsed % 1000); elapsed = elapsed / 1000; second = (int) (elapsed % 60); elapsed = elapsed / 60; minute = (int) (elapsed % 60); elapsed = elapsed / 60; hour = (int) (elapsed % 60); return String.format("%02d:%02d:%02d %03d", hour, minute, second, milli); } } }
[ "jiachunjie@qiyi.com" ]
jiachunjie@qiyi.com
052944068a6eec9f4b28b6b287a758f229eb86ff
e5e14c668aba7eee496d0fc299352679a10ffe9a
/lyMusicPlay/src/com/ly/musicplay/activity/SplashActivity.java
72d7a555400df3ade7203309dadc4b6a74ce0a30
[]
no_license
peiniwan/lyMusicPlay
0affb4e14767d7c8c0e2aa3f29a0016946005170
649a5e18e8e2517f2289fd33c4559314e2433a33
refs/heads/master
2021-01-10T05:32:57.094908
2016-01-21T07:19:48
2016-01-21T07:19:48
43,635,089
3
0
null
null
null
null
UTF-8
Java
false
false
1,267
java
package com.ly.musicplay.activity; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.view.animation.AlphaAnimation; import android.widget.RelativeLayout; import com.ly.musicplay.R; /** * 闪屏页 * * @author Administrator * */ public class SplashActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_aplash); RelativeLayout rlRoot = (RelativeLayout) findViewById(R.id.rl_roots); Handler handler = new Handler(); // 重写进程里面的run方法,当启动进程是就会主动条用run方法 Runnable runnable = new Runnable() { @Override public void run() { Intent intent = new Intent(); intent.setClass(SplashActivity.this, MainActivity.class); SplashActivity.this.startActivity(intent); // 实现跳转之后结束MainActivity控件,否则返回键会返回这个界面 SplashActivity.this.finish(); } }; handler.postDelayed(runnable, 1500);// 调用进程延迟2秒 // 渐变的动画效果 AlphaAnimation anim = new AlphaAnimation(0.3f, 1f); anim.setDuration(1000); rlRoot.startAnimation(anim); } }
[ "410093000@qq.com" ]
410093000@qq.com
e1a9bcd8cba4fc73b1f5b9bcf5349909e5a045f2
b3ad31d34d493191f24efec4deedc9f679214f8f
/src/com/carousell/cache/CacheProvider.java
4475b65a7c6860ddc4f901e2be59e3932fcd6f43
[]
no_license
bruteforce/Carousell
4f1493e25a34637dfd756ac37a1ae9e9c965f196
72cd6682f17ea6593e734c9b69a662f102a2f76c
refs/heads/main
2023-08-15T03:46:42.664665
2021-09-27T16:24:44
2021-09-27T16:24:44
410,913,683
0
0
null
null
null
null
UTF-8
Java
false
false
157
java
package com.carousell.cache; public interface CacheProvider<K, V> { V get(K key); void put(K key, V value); void remove(K key); void clear(); }
[ "noreply@github.com" ]
noreply@github.com
5d12409b2850643b238e2d2f1ca059e797f254e4
47bee068ddb9dacfff94d08341f604ebe97f9fef
/src/main/java/com/smlsnnshn/Lessons/day07_controlFlowStatements2/NestedIfStatmenets.java
96e885357e30e3615a869178cd5d431ff54e1edb
[]
no_license
ismailsinansahin/JavaLessons
55686229d946390a52383f5d80e1053f411286e7
768cb63e22462e7c2eef709102df5d19d9c98568
refs/heads/master
2023-07-18T23:10:31.302133
2021-09-14T20:56:35
2021-09-14T20:56:35
360,487,169
2
0
null
null
null
null
UTF-8
Java
false
false
453
java
package com.smlsnnshn.Lessons.day07_controlFlowStatements2; public class NestedIfStatmenets { public static void main(String[] args) { boolean isRushHour=false; int carType=2; double price=0.0; if(carType==1) { if(isRushHour) { price=30.0; }else { price=5.0; } }else if(carType==2) { if(isRushHour) { price=55.30; }else { price=15.99; } } System.out.println("Toll Cost: " + price); } }
[ "ismailsinansahin@gmail.com" ]
ismailsinansahin@gmail.com
bfda43251969d947283e08ccceb4e6bfd919cac0
8fc2b4c1085df217f63fb50f13e983a9c0e64596
/qms/src/main/java/com/myspringbt/demo/config/FileUploadConfig.java
4077fcd3bd04fe16e161a0021b31d92b246ecd15
[]
no_license
guojianping1234/qms
b7e9b6bfe4828e0b81c59d9c75916253f106488c
794392c0a0a023a9853612fc788eedafe344ef0c
refs/heads/master
2022-07-07T22:15:30.434146
2020-07-20T14:37:11
2020-07-20T14:37:11
250,975,101
1
0
null
2022-06-21T03:05:24
2020-03-29T07:14:24
Java
UTF-8
Java
false
false
598
java
package com.myspringbt.demo.config; import org.springframework.boot.web.servlet.MultipartConfigFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import javax.servlet.MultipartConfigElement; @Configuration public class FileUploadConfig { @Bean public MultipartConfigElement multipartConfigElement() { MultipartConfigFactory factory = new MultipartConfigFactory(); factory.setMaxFileSize("100MB"); factory.setMaxRequestSize("100MB"); return factory.createMultipartConfig(); } }
[ "1017742675@qq.com" ]
1017742675@qq.com
da995f43d52975d9668808643be4a54029a22fcf
06da8b4567e0861266b8a9635c26e79a97583c73
/Week_07/one-million/src/test/java/com/example/demo/OneMillionApplicationTests.java
03bd83cfc659b8880f86d19acfe06fd6245f11fe
[]
no_license
jimrueaster/JAVA-01
5884690176572927920808392ca9884da7e6ea0e
549df005aa9bfc981283e942fe012f87e4dcb600
refs/heads/main
2023-04-19T13:55:48.073232
2021-05-10T14:12:40
2021-05-10T14:12:40
326,554,428
0
0
null
2021-01-04T03:02:12
2021-01-04T03:02:12
null
UTF-8
Java
false
false
212
java
package com.example.demo; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class OneMillionApplicationTests { @Test void contextLoads() { } }
[ "295140325@qq.com" ]
295140325@qq.com
21eaeecf77cf8a83b0d365a7e772513d2d337b0f
9339cb45bdbd9f1c5b7769bf29e58a39893a811d
/view-admin/src/main/java/com/zx5435/pcmoto/admin/model/plus/NewsMapper.java
33bef554facebfa7c51a125aebe81bfa9de7fa18
[ "MIT" ]
permissive
wolanx/springcloud-demo
0022a3fa3bd6698e31844af104d6be4209f38de9
af729dde67910e51491df5ddfc749fe93b06e82c
refs/heads/master
2022-02-02T09:37:36.968732
2019-08-02T13:27:21
2019-08-02T13:27:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
212
java
package com.zx5435.pcmoto.admin.model.plus; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.zx5435.pcmoto.admin.model.base.NewsDO; public interface NewsMapper extends BaseMapper<NewsDO> { }
[ "825407762@qq.com" ]
825407762@qq.com
01b287a416081a407d589807158db9c858659d88
f6acaf3d94a3c3fdb74ccccb51c1e478f7bdcd55
/src/test/java/com/saucedemo/pages/LandingPage.java
bce31b53e2832398f4a2ad8e689465492c329650
[]
no_license
sauceaaron/CucumberExample
bae7b3b6ccd14d5a800d8b3a372020204f0ee273
d62b86b623cf69faa2d7c14d1eb6fd1e758d66d8
refs/heads/master
2021-07-14T18:06:57.822542
2019-10-18T14:31:23
2019-10-18T14:31:23
216,043,088
0
1
null
2020-10-13T16:49:24
2019-10-18T14:31:16
Java
UTF-8
Java
false
false
176
java
package com.saucedemo.pages; import org.openqa.selenium.By; public class LandingPage { public By logo = By.cssSelector(".login_logo"); public String title = "Swag Labs"; }
[ "aaron.evans@saucelabs.com" ]
aaron.evans@saucelabs.com
563f8f6cf572fd82799580a34c36f406ef92371c
d0617ea436942047a7ca1f82f7bdae59ec87e468
/Code/JAVA/Server/Data/DateClient.java
24977e48e7212143991177b798bbdedb8cbba15c
[]
no_license
saph2/BasicCode
1bbb02cb6782f522d7b69be3f17c7fc85faec60c
a12d05dd0c8a020a1816cc3e035d95f2929940cb
refs/heads/master
2021-01-09T06:12:29.393139
2018-09-11T19:44:18
2018-09-11T19:44:18
80,932,626
0
0
null
null
null
null
UTF-8
Java
false
false
1,094
java
package getReady; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.Socket; /** * Trivial client for the date server. */ public class DateClient { /** * Runs the client as an application. First it displays a dialog * box asking for the IP address or hostname of a host running * the date server, then connects to it and displays the date that * it serves. */ public static void main(String[] args) throws IOException { System.out.print("Enter IP Address of a machine that is\n" + "running the date service on port 9090:"); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); //buffer to read input from user String serverAddress = br.readLine();//read next line input from user Socket s = new Socket(serverAddress, 9090); BufferedReader input = new BufferedReader(new InputStreamReader(s.getInputStream())); String answer = input.readLine(); System.exit(0); } }
[ "noreply@github.com" ]
noreply@github.com
f9e9ef7a411f67ada4d91a19a05f48b7b1fbf0a6
1b8127c4e2347df3052670213aac53d83e432ac6
/src/main/java/kr/or/connect/diexam1/Car.java
a97be73686db0bb0e7a30ade8c527c180e4b4858
[]
no_license
wkdtndgns/Spring_Di_tdd
d2a3412d43ee0b587ac3dcf07295624ad7727bee
05b6507322e2e1050e482b88b4cdd1343694c6df
refs/heads/master
2020-03-22T19:51:38.507801
2018-07-18T07:24:21
2018-07-18T07:24:21
140,555,755
0
0
null
null
null
null
UTF-8
Java
false
false
590
java
package kr.or.connect.diexam1; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class Car { @Autowired private Engine v8; public Car() { System.out.println("Car 생성자 "); } public void setEngine(Engine e ) { this.v8 =e; } public void run() { System.out.println("엔진을 이용하여 달립니다."); v8.exec(); } public static void main(String[] args) { Engine e = new Engine(); Car c = new Car(); c.setEngine(e); c.run(); } }
[ "wkdtndgns@naver.com" ]
wkdtndgns@naver.com
c32c7a2eabcdf8a5812cc40778705e101a9640c3
481f3c6b713379912988084cf10810e7d9a74fd0
/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabAppMenuPropertiesDelegate.java
d4a5a5a4d626de592e9cbf59ada0c2ddd2719775
[ "MPL-2.0-no-copyleft-exception", "LicenseRef-scancode-unknown-license-reference", "AGPL-3.0-only", "LGPL-2.1-only", "GPL-2.0-only", "MPL-2.0", "BSD-3-Clause" ]
permissive
huhisoft/huhi-android
bab71148730ff68b770f56b93b731302528045ec
1c00f05a2ab19f0d6acf42331931de61555a93e8
refs/heads/master
2023-01-13T11:26:25.618267
2019-11-11T04:09:38
2019-11-11T04:09:38
219,455,870
0
4
BSD-3-Clause
2022-12-10T08:31:33
2019-11-04T08:48:00
null
UTF-8
Java
false
false
10,581
java
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.chrome.browser.customtabs; import android.content.Context; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.graphics.drawable.DrawableCompat; import android.support.v7.content.res.AppCompatResources; import android.text.TextUtils; import android.view.Menu; import android.view.MenuItem; import android.view.View; import org.chromium.base.ContextUtils; import org.chromium.base.VisibleForTesting; import org.chromium.chrome.R; import org.chromium.chrome.browser.ActivityTabProvider; import org.chromium.chrome.browser.DefaultBrowserInfo; import org.chromium.chrome.browser.appmenu.AppMenuPropertiesDelegateImpl; import org.chromium.chrome.browser.browserservices.BrowserServicesIntentDataProvider.CustomTabsUiType; import org.chromium.chrome.browser.download.DownloadUtils; import org.chromium.chrome.browser.firstrun.FirstRunStatus; import org.chromium.chrome.browser.multiwindow.MultiWindowModeStateDispatcher; import org.chromium.chrome.browser.share.ShareHelper; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.toolbar.ToolbarManager; import org.chromium.chrome.browser.util.UrlConstants; import java.util.HashMap; import java.util.List; import java.util.Map; /** * App menu properties delegate for {@link CustomTabActivity}. */ public class CustomTabAppMenuPropertiesDelegate extends AppMenuPropertiesDelegateImpl { private final static String CUSTOM_MENU_ITEM_ID_KEY = "CustomMenuItemId"; private final @CustomTabsUiType int mUiType; private final boolean mShowShare; private final boolean mShowStar; private final boolean mShowDownload; private final boolean mIsOpenedByChrome; private final boolean mIsIncognito; private final List<String> mMenuEntries; private final Map<MenuItem, Integer> mItemToIndexMap = new HashMap<MenuItem, Integer>(); private boolean mIsCustomEntryAdded; /** * Creates an {@link CustomTabAppMenuPropertiesDelegate} instance. */ public CustomTabAppMenuPropertiesDelegate(Context context, ActivityTabProvider activityTabProvider, MultiWindowModeStateDispatcher multiWindowModeStateDispatcher, TabModelSelector tabModelSelector, ToolbarManager toolbarManager, View decorView, @CustomTabsUiType final int uiType, List<String> menuEntries, boolean isOpenedByChrome, boolean showShare, boolean showStar, boolean showDownload, boolean isIncognito) { super(context, activityTabProvider, multiWindowModeStateDispatcher, tabModelSelector, toolbarManager, decorView, null); mUiType = uiType; mMenuEntries = menuEntries; mIsOpenedByChrome = isOpenedByChrome; mShowShare = showShare; mShowStar = showStar; mShowDownload = showDownload; mIsIncognito = isIncognito; } @Override public int getAppMenuLayoutId() { return R.menu.custom_tabs_menu; } @Override public void prepareMenu(Menu menu) { Tab currentTab = mActivityTabProvider.get(); if (currentTab != null) { MenuItem forwardMenuItem = menu.findItem(R.id.forward_menu_id); forwardMenuItem.setEnabled(currentTab.canGoForward()); mReloadMenuItem = menu.findItem(R.id.reload_menu_id); Drawable icon = AppCompatResources.getDrawable(mContext, R.drawable.btn_reload_stop); DrawableCompat.setTintList(icon, AppCompatResources.getColorStateList(mContext, R.color.standard_mode_tint)); mReloadMenuItem.setIcon(icon); loadingStateChanged(currentTab.isLoading()); MenuItem shareItem = menu.findItem(R.id.share_row_menu_id); shareItem.setVisible(mShowShare); shareItem.setEnabled(mShowShare); boolean openInChromeItemVisible = true; boolean bookmarkItemVisible = mShowStar; boolean downloadItemVisible = mShowDownload; boolean addToHomeScreenVisible = true; boolean requestDesktopSiteVisible = true; if (mUiType == CustomTabsUiType.MEDIA_VIEWER) { // Most of the menu items don't make sense when viewing media. menu.findItem(R.id.icon_row_menu_id).setVisible(false); menu.findItem(R.id.find_in_page_id).setVisible(false); bookmarkItemVisible = false; // Set to skip initialization. downloadItemVisible = false; // Set to skip initialization. openInChromeItemVisible = false; requestDesktopSiteVisible = false; addToHomeScreenVisible = false; } else if (mUiType == CustomTabsUiType.PAYMENT_REQUEST) { // Only the icon row and 'find in page' are shown for opening payment request UI // from Chrome. openInChromeItemVisible = false; requestDesktopSiteVisible = false; addToHomeScreenVisible = false; downloadItemVisible = false; bookmarkItemVisible = false; } else if (mUiType == CustomTabsUiType.READER_MODE) { // Only 'find in page' and the reader mode preference are shown for Reader Mode UI. menu.findItem(R.id.icon_row_menu_id).setVisible(false); bookmarkItemVisible = false; // Set to skip initialization. downloadItemVisible = false; // Set to skip initialization. openInChromeItemVisible = false; requestDesktopSiteVisible = false; addToHomeScreenVisible = false; menu.findItem(R.id.reader_mode_prefs_id).setVisible(true); } else if (mUiType == CustomTabsUiType.MINIMAL_UI_WEBAPP) { requestDesktopSiteVisible = false; addToHomeScreenVisible = false; downloadItemVisible = false; bookmarkItemVisible = false; } else if (mUiType == CustomTabsUiType.OFFLINE_PAGE) { openInChromeItemVisible = false; bookmarkItemVisible = true; downloadItemVisible = false; addToHomeScreenVisible = false; requestDesktopSiteVisible = true; } if (!FirstRunStatus.getFirstRunFlowComplete()) { openInChromeItemVisible = false; bookmarkItemVisible = false; downloadItemVisible = false; addToHomeScreenVisible = false; } if (mIsIncognito) { addToHomeScreenVisible = false; } String url = currentTab.getUrl(); boolean isChromeScheme = url.startsWith(UrlConstants.CHROME_URL_PREFIX) || url.startsWith(UrlConstants.CHROME_NATIVE_URL_PREFIX); if (isChromeScheme || TextUtils.isEmpty(url)) { addToHomeScreenVisible = false; } MenuItem downloadItem = menu.findItem(R.id.offline_page_id); if (downloadItemVisible) { downloadItem.setEnabled(DownloadUtils.isAllowedToDownloadPage(currentTab)); } else { downloadItem.setVisible(false); } MenuItem bookmarkItem = menu.findItem(R.id.bookmark_this_page_id); if (bookmarkItemVisible) { updateBookmarkMenuItem(bookmarkItem, currentTab); } else { bookmarkItem.setVisible(false); } prepareTranslateMenuItem(menu, currentTab); MenuItem openInChromeItem = menu.findItem(R.id.open_in_browser_id); if (openInChromeItemVisible) { String title = mIsIncognito ? ContextUtils.getApplicationContext() .getString(R.string.menu_open_in_incognito_chrome) : DefaultBrowserInfo.getTitleOpenInDefaultBrowser(mIsOpenedByChrome); openInChromeItem.setTitle(title); } else { openInChromeItem.setVisible(false); } // Add custom menu items. Make sure they are only added once. if (!mIsCustomEntryAdded) { mIsCustomEntryAdded = true; for (int i = 0; i < mMenuEntries.size(); i++) { MenuItem item = menu.add(0, 0, 1, mMenuEntries.get(i)); mItemToIndexMap.put(item, i); } } updateRequestDesktopSiteMenuItem(menu, currentTab, requestDesktopSiteVisible); prepareAddToHomescreenMenuItem(menu, currentTab, addToHomeScreenVisible); } } /** * @return The index that the given menu item should appear in the result of * {@link CustomTabIntentDataProvider#getMenuTitles()}. Returns -1 if item not found. */ public static int getIndexOfMenuItemFromBundle(Bundle menuItemData) { if (menuItemData != null && menuItemData.containsKey(CUSTOM_MENU_ITEM_ID_KEY)) { return menuItemData.getInt(CUSTOM_MENU_ITEM_ID_KEY); } return -1; } @Override public @Nullable Bundle getBundleForMenuItem(MenuItem item) { if (!mItemToIndexMap.containsKey(item)) { return null; } Bundle itemBundle = new Bundle(); itemBundle.putInt(CUSTOM_MENU_ITEM_ID_KEY, mItemToIndexMap.get(item).intValue()); return itemBundle; } @Override public int getFooterResourceId() { // Avoid showing the branded menu footer for media and offline pages. if (mUiType == CustomTabsUiType.MEDIA_VIEWER || mUiType == CustomTabsUiType.OFFLINE_PAGE) { return 0; } return R.layout.powered_by_chrome_footer; } /** * Get the {@link MenuItem} object associated with the given title. If multiple menu items have * the same title, a random one will be returned. This method is for testing purpose _only_. */ @VisibleForTesting MenuItem getMenuItemForTitle(String title) { for (MenuItem item : mItemToIndexMap.keySet()) { if (item.getTitle().equals(title)) return item; } return null; } }
[ "huhibrowser@gmail.com" ]
huhibrowser@gmail.com
00dd848d1985bf5679da9e4c5e80bf9282ab9789
3f7a5d7c700199625ed2ab3250b939342abee9f1
/src/gcom/gui/atendimentopublico/hidrometro/EfetuarSubstituicaoHidrometroAction.java
ce865d681adfe50e34882cb3df5ea27471d2cc23
[]
no_license
prodigasistemas/gsan-caema
490cecbd2a784693de422d3a2033967d8063204d
87a472e07e608c557e471d555563d71c76a56ec5
refs/heads/master
2021-01-01T06:05:09.920120
2014-10-08T20:10:40
2014-10-08T20:10:40
24,958,220
1
0
null
null
null
null
ISO-8859-1
Java
false
false
18,967
java
/* * Copyright (C) 2007-2007 the GSAN - Sistema Integrado de Gestão de Serviços de Saneamento * * This file is part of GSAN, an integrated service management system for Sanitation * * GSAN is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License. * * GSAN is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ /* * GSAN - Sistema Integrado de Gestão de Serviços de Saneamento * Copyright (C) <2007> * Adriano Britto Siqueira * Alexandre Santos Cabral * Ana Carolina Alves Breda * Ana Maria Andrade Cavalcante * Aryed Lins de Araújo * Bruno Leonardo Rodrigues Barros * Carlos Elmano Rodrigues Ferreira * Cláudio de Andrade Lira * Denys Guimarães Guenes Tavares * Eduardo Breckenfeld da Rosa Borges * Fabíola Gomes de Araújo * Flávio Leonardo Cavalcanti Cordeiro * Francisco do Nascimento Júnior * Homero Sampaio Cavalcanti * Ivan Sérgio da Silva Júnior * José Edmar de Siqueira * José Thiago Tenório Lopes * Kássia Regina Silvestre de Albuquerque * Leonardo Luiz Vieira da Silva * Márcio Roberto Batista da Silva * Maria de Fátima Sampaio Leite * Micaela Maria Coelho de Araújo * Nelson Mendonça de Carvalho * Newton Morais e Silva * Pedro Alexandre Santos da Silva Filho * Rafael Corrêa Lima e Silva * Rafael Francisco Pinto * Rafael Koury Monteiro * Rafael Palermo de Araújo * Raphael Veras Rossiter * Roberto Sobreira Barbalho * Rodrigo Avellar Silveira * Rosana Carvalho Barbosa * Sávio Luiz de Andrade Cavalcante * Tai Mu Shih * Thiago Augusto Souza do Nascimento * Tiago Moreno Rodrigues * Vivianne Barbosa Sousa * * Este programa é software livre; você pode redistribuí-lo e/ou * modificá-lo sob os termos de Licença Pública Geral GNU, conforme * publicada pela Free Software Foundation; versão 2 da * Licença. * Este programa é distribuído na expectativa de ser útil, mas SEM * QUALQUER GARANTIA; sem mesmo a garantia implícita de * COMERCIALIZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM * PARTICULAR. Consulte a Licença Pública Geral GNU para obter mais * detalhes. * Você deve ter recebido uma cópia da Licença Pública Geral GNU * junto com este programa; se não, escreva para Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * 02111-1307, USA. */ package gcom.gui.atendimentopublico.hidrometro; import gcom.atendimentopublico.bean.IntegracaoComercialHelper; import gcom.atendimentopublico.ordemservico.OrdemServico; import gcom.atendimentopublico.ordemservico.ServicoNaoCobrancaMotivo; import gcom.atendimentopublico.ordemservico.ServicoTipo; import gcom.cadastro.imovel.FiltroImovel; import gcom.cadastro.imovel.Imovel; import gcom.fachada.Fachada; import gcom.gui.ActionServletException; import gcom.gui.GcomAction; import gcom.micromedicao.hidrometro.FiltroHidrometro; import gcom.micromedicao.hidrometro.Hidrometro; import gcom.micromedicao.hidrometro.HidrometroInstalacaoHistorico; import gcom.micromedicao.hidrometro.HidrometroSituacao; import gcom.seguranca.acesso.usuario.Usuario; import gcom.util.ConstantesSistema; import gcom.util.Util; import gcom.util.filtro.ParametroSimples; import java.math.BigDecimal; import java.util.Collection; import java.util.Date; import java.util.Iterator; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; /** * Efetua a substituição do hidrômetro de acordo com os parâmetros informados * * @author Ana Maria * @date 19/07/2006 */ public class EfetuarSubstituicaoHidrometroAction extends GcomAction { /** * Este caso de uso permite efetuar substituição de hidrômetro * * [UC0364] Efetuar Substituição de Hidrômetro * * @param actionMapping * @param actionForm * @param httpServletRequest * @param httpServletResponse * @return */ public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) { ActionForward retorno = actionMapping.findForward("telaSucesso"); EfetuarSubstituicaoHidrometroActionForm efetuarSubstituicaoHidrometroActionForm = (EfetuarSubstituicaoHidrometroActionForm) actionForm; Fachada fachada = Fachada.getInstancia(); HttpSession sessao = httpServletRequest.getSession(false); //Usuario logado no sistema Usuario usuario = (Usuario) sessao.getAttribute("usuarioLogado"); String matriculaImovel = efetuarSubstituicaoHidrometroActionForm.getMatriculaImovel(); String numeroHidrometro = efetuarSubstituicaoHidrometroActionForm.getNumeroHidrometro(); String numeroTombamento = efetuarSubstituicaoHidrometroActionForm.getNumeroTombamento(); String tipoMedicaoAtual = efetuarSubstituicaoHidrometroActionForm.getTipoMedicaoAtual(); String situacaoHidrometroSubstituido = efetuarSubstituicaoHidrometroActionForm.getSituacaoHidrometro(); String localArmazenagemHidrometro = null; String hidrometroExtraviado = (String) sessao.getAttribute("hidrometroExtravido"); sessao.removeAttribute("hidrometroExtravido"); // caso o hidrometro esteja extraviado, nao pega o local de armazenagem if(hidrometroExtraviado == null || !hidrometroExtraviado.equals("sim")){ localArmazenagemHidrometro = efetuarSubstituicaoHidrometroActionForm.getLocalArmazenagemHidrometro(); } String numeroLeituraRetiradaHidrometro = efetuarSubstituicaoHidrometroActionForm.getNumeroLeitura(); String idServicoMotivoNaoCobranca = efetuarSubstituicaoHidrometroActionForm.getMotivoNaoCobranca(); String valorPercentual = efetuarSubstituicaoHidrometroActionForm.getPercentualCobranca(); HidrometroInstalacaoHistorico hidrometroInstalacaoHistorico = new HidrometroInstalacaoHistorico(); //RM8268 String icTrocaProt = efetuarSubstituicaoHidrometroActionForm.getIndicadorTrocaProtecao(); String icTrocaReg = efetuarSubstituicaoHidrometroActionForm.getIndicadorTrocaRegistro(); if(icTrocaProt != null){ if(icTrocaProt.equalsIgnoreCase(ConstantesSistema.SIM.toString())){ hidrometroInstalacaoHistorico.setIndicadorTrocaProtecao(ConstantesSistema.SIM); }else{ hidrometroInstalacaoHistorico.setIndicadorTrocaProtecao(ConstantesSistema.NAO); } } if(icTrocaReg != null){ if(icTrocaReg.equalsIgnoreCase(ConstantesSistema.SIM.toString())){ hidrometroInstalacaoHistorico.setIndicadorTrocaRegistro(ConstantesSistema.SIM); }else{ hidrometroInstalacaoHistorico.setIndicadorTrocaRegistro(ConstantesSistema.NAO); } } //fim_RM8268 /* * author Jonathan Marcos * date 16/01/2014 * RM7833 * indicador medicao Telemedido */ String indicadorMedicaoTelemedido = efetuarSubstituicaoHidrometroActionForm.getIndicadorMedicaoTelemedido(); if(indicadorMedicaoTelemedido.equalsIgnoreCase(ConstantesSistema.SIM.toString())){ hidrometroInstalacaoHistorico.setIndicadorMedicaoTelemedido(ConstantesSistema.SIM); }else{ hidrometroInstalacaoHistorico.setIndicadorMedicaoTelemedido(ConstantesSistema.NAO); } //Constroi o filtro para pesquisa da Ordem de Serviço OrdemServico ordemServico = (OrdemServico) sessao.getAttribute("ordemServico"); if(ordemServico.getImovel() != null){ matriculaImovel = ordemServico.getImovel().getId().toString(); }else{ matriculaImovel = ordemServico.getRegistroAtendimento().getImovel().getId().toString(); } if (numeroHidrometro != null && !numeroHidrometro.equals("")) { //Constroi o filtro para pesquisa do Hidrômetro FiltroHidrometro filtroHidrometro = new FiltroHidrometro(); filtroHidrometro.adicionarParametro(new ParametroSimples( FiltroHidrometro.NUMERO_HIDROMETRO, numeroHidrometro)); //Realiza a pesquisa do Hidrômetro Collection colecaoHidrometro = null; colecaoHidrometro = fachada.pesquisar(filtroHidrometro,Hidrometro.class.getName()); //verifica se o número do hidrômetro não está cadastrado if (colecaoHidrometro == null || colecaoHidrometro.isEmpty()) { throw new ActionServletException("atencao.numero_hidrometro_inexistente", null, efetuarSubstituicaoHidrometroActionForm.getNumeroHidrometro()); } Iterator iteratorHidrometro = colecaoHidrometro.iterator(); Hidrometro hidrometro = (Hidrometro) iteratorHidrometro.next(); FiltroImovel filtroImovel = new FiltroImovel(); filtroImovel.adicionarCaminhoParaCarregamentoEntidade("localidade.hidrometroLocalArmazenagem"); filtroImovel.adicionarParametro(new ParametroSimples(FiltroImovel.ID, matriculaImovel)); Collection colecaoImoveis = fachada.pesquisar(filtroImovel, Imovel.class.getName()); Imovel imovelComLocalidade = (Imovel) Util.retonarObjetoDeColecao(colecaoImoveis); if (imovelComLocalidade != null && imovelComLocalidade.getLocalidade().getHidrometroLocalArmazenagem() != null && hidrometro.getHidrometroLocalArmazenagem() != null && !hidrometro.getHidrometroLocalArmazenagem().getId().equals(imovelComLocalidade.getLocalidade().getHidrometroLocalArmazenagem().getId())) { throw new ActionServletException("atencao.hidrometro_local_armazenagem_imovel_diferente_hidrometro_local_armazenagem_hidrometro"); } hidrometroInstalacaoHistorico.setHidrometro(hidrometro); } else if(numeroTombamento != null && !numeroTombamento.equals("")){ FiltroHidrometro filtroHidrometro = new FiltroHidrometro(); filtroHidrometro.adicionarParametro(new ParametroSimples( FiltroHidrometro.TOMBAMENTO,numeroTombamento)); filtroHidrometro.adicionarCaminhoParaCarregamentoEntidade(FiltroHidrometro.HIDROMETRO_SITUACAO); Collection colecaoHidrometro = fachada.pesquisar(filtroHidrometro,Hidrometro.class.getName()); //[FS0015] - Verificar Situação do Tombamento //Caso o tombamento informado não esteja cadastrado if (colecaoHidrometro == null || colecaoHidrometro.isEmpty()) { efetuarSubstituicaoHidrometroActionForm.setNumeroTombamento(""); throw new ActionServletException("atencao.tombamento_inexistente"); }else{ Hidrometro hidro = (Hidrometro) Util.retonarObjetoDeColecao(colecaoHidrometro); FiltroImovel filtroImovel = new FiltroImovel(); filtroImovel.adicionarCaminhoParaCarregamentoEntidade("localidade.hidrometroLocalArmazenagem"); filtroImovel.adicionarParametro(new ParametroSimples(FiltroImovel.ID, matriculaImovel)); Collection colecaoImoveis = fachada.pesquisar(filtroImovel, Imovel.class.getName()); Imovel imovelComLocalidade = (Imovel) Util.retonarObjetoDeColecao(colecaoImoveis); //Caso o hidrômetro informado esteja com a situação diferente de DISPONÍVEL if(hidro.getHidrometroSituacao().getId().intValue() != HidrometroSituacao.DISPONIVEL.intValue()){ throw new ActionServletException("atencao.hidrometro_situacao_nao_pode_instalar",null,hidro.getHidrometroSituacao().getDescricao()); } //Caso tenha local de armazenagem na localidade do imóvel e o hidrômetro informado //não esteja armazenado no local de instalação da localidade do imóvel onde o mesmo está sendo instalado if (imovelComLocalidade != null && imovelComLocalidade.getLocalidade().getHidrometroLocalArmazenagem() != null && !hidro.getHidrometroLocalArmazenagem().getId().equals(imovelComLocalidade.getLocalidade().getHidrometroLocalArmazenagem().getId())) { throw new ActionServletException("atencao.hidrometro_local_armazenagem_imovel_diferente_hidrometro_local_armazenagem_hidrometro"); } hidrometroInstalacaoHistorico.setHidrometro(hidro); } } //Hidrometro NOVO //Atualiza a entidade com os valores do formulário efetuarSubstituicaoHidrometroActionForm.setFormValues(hidrometroInstalacaoHistorico); //Hidrometro antigo HidrometroInstalacaoHistorico hidrometroSubstituicaoHistorico = (HidrometroInstalacaoHistorico)sessao.getAttribute("hidrometroSubstituicaoHistorico"); if(ordemServico!= null && ordemServico.getServicoTipo().getConstanteFuncionalidadeTipoServico() != null && ordemServico.getServicoTipo().getConstanteFuncionalidadeTipoServico().intValue() != ServicoTipo.TIPO_INSTALACAO_CAIXA_PROTECAO){ Date dataRetirada = Util.converteStringParaDate(efetuarSubstituicaoHidrometroActionForm.getDataRetirada()); hidrometroSubstituicaoHistorico.setDataRetirada(dataRetirada); if (numeroLeituraRetiradaHidrometro != null && !numeroLeituraRetiradaHidrometro.equalsIgnoreCase("")){ hidrometroSubstituicaoHistorico.setNumeroLeituraRetirada(new Integer(numeroLeituraRetiradaHidrometro)); } } hidrometroSubstituicaoHistorico.setUltimaAlteracao(new Date()); BigDecimal valorAtual = new BigDecimal(0); if(ordemServico != null && efetuarSubstituicaoHidrometroActionForm.getIdTipoDebito() != null){ ServicoNaoCobrancaMotivo servicoNaoCobrancaMotivo = null; ordemServico.setIndicadorComercialAtualizado(ConstantesSistema.SIM); if (efetuarSubstituicaoHidrometroActionForm.getValorDebito() != null && !efetuarSubstituicaoHidrometroActionForm.getValorDebito().equals("") ) { String valorDebito = efetuarSubstituicaoHidrometroActionForm .getValorDebito().toString().replace(".", ""); valorDebito = valorDebito.replace(",", "."); valorAtual = new BigDecimal(valorDebito); ordemServico.setValorAtual(valorAtual); } if(idServicoMotivoNaoCobranca != null && !idServicoMotivoNaoCobranca.equals(ConstantesSistema.NUMERO_NAO_INFORMADO)){ servicoNaoCobrancaMotivo = new ServicoNaoCobrancaMotivo(); servicoNaoCobrancaMotivo.setId(new Integer(idServicoMotivoNaoCobranca)); } ordemServico.setServicoNaoCobrancaMotivo(servicoNaoCobrancaMotivo); if(valorPercentual != null){ ordemServico.setPercentualCobranca(new BigDecimal(efetuarSubstituicaoHidrometroActionForm.getPercentualCobranca())); } ordemServico.setUltimaAlteracao(new Date()); } String qtdParcelas = efetuarSubstituicaoHidrometroActionForm.getQuantidadeParcelas(); IntegracaoComercialHelper integracaoComercialHelper = new IntegracaoComercialHelper(); integracaoComercialHelper.setHidrometroInstalacaoHistorico(hidrometroInstalacaoHistorico); integracaoComercialHelper.setHidrometroSubstituicaoHistorico(hidrometroSubstituicaoHistorico); integracaoComercialHelper.setSituacaoHidrometroSubstituido(situacaoHidrometroSubstituido); if(localArmazenagemHidrometro != null){ integracaoComercialHelper.setLocalArmazenagemHidrometro(new Integer(localArmazenagemHidrometro)); } integracaoComercialHelper.setMatriculaImovel(matriculaImovel); integracaoComercialHelper.setOrdemServico(ordemServico); integracaoComercialHelper.setQtdParcelas(qtdParcelas); integracaoComercialHelper.setUsuarioLogado(usuario); if(efetuarSubstituicaoHidrometroActionForm.getVeioEncerrarOS().equalsIgnoreCase("FALSE") || (sessao.getAttribute("movimentarOS") != null && sessao.getAttribute("movimentarOS").equals("TRUE"))){ integracaoComercialHelper.setVeioEncerrarOS(Boolean.FALSE); fachada.efetuarSubstituicaoHidrometro(integracaoComercialHelper); }else{ // fachada.validacaoSubstituicaoHidrometro(matriculaImovel,hidrometroInstalacaoHistorico.getHidrometro().getNumero(),hidrometroInstalacaoHistorico.getHidrometro().getHidrometroSituacao().getId().toString()); if(ordemServico!= null && ordemServico.getServicoTipo().getConstanteFuncionalidadeTipoServico() != null && ordemServico.getServicoTipo().getConstanteFuncionalidadeTipoServico().intValue() != ServicoTipo.TIPO_INSTALACAO_CAIXA_PROTECAO){ fachada.validacaoSubstituicaoHidrometro(matriculaImovel,hidrometroInstalacaoHistorico.getHidrometro().getNumero(), situacaoHidrometroSubstituido,hidrometroInstalacaoHistorico.getHidrometro().getNumero()); } integracaoComercialHelper.setVeioEncerrarOS(Boolean.TRUE); sessao.setAttribute("integracaoComercialHelper", integracaoComercialHelper); if(sessao.getAttribute("semMenu") == null){ retorno = actionMapping.findForward("encerrarOrdemServicoAction"); /* * Autor: Jonathan Marcos * Data: 25/11/2013 * RM8974 * UC0364 * [Observacoes] Caso o tipo de ordem de servico * encerrada seja SUBSTITUICAO DE HIDROMETRO */ if(ordemServico.getServicoTipo().getId().compareTo( ServicoTipo.TIPO_EFETUAR_SUBSTITUICAO_HIDROMETRO)==0){ sessao.setAttribute("ordemServico", ordemServico); sessao.setAttribute("tipoSubstituicao", true); sessao.setAttribute("tipoMedicaoAtual", tipoMedicaoAtual); sessao.setAttribute("matriculaImovel", matriculaImovel); } }else{ retorno = actionMapping.findForward("encerrarOrdemServicoPopupAction"); } sessao.removeAttribute("caminhoRetornoIntegracaoComercial"); } //Inserir na base de dados a instalação de hidrômetro e a atualização da substituição do hidrômetro /* fachada.efetuarSubstituicaoHidrometro(hidrometroInstalacaoHistorico,matriculaImovel, hidrometroSubstituicaoHistorico, situacaoHidrometroSubstituido, new Integer(localArmazenagemHidrometro), ordemServico, efetuarSubstituicaoHidrometroActionForm.getVeioEncerrarOS().toString()); */ if(retorno.getName().equalsIgnoreCase("telaSucesso")){ // Monta a página de sucesso montarPaginaSucesso(httpServletRequest, "Substituição de Hidrômetro para "+ tipoMedicaoAtual + " no imóvel "+matriculaImovel+ " efetuada com sucesso.", "Efetuar outra Substituição de Hidrômetro", "exibirEfetuarSubstituicaoHidrometroAction.do"); } sessao.removeAttribute("EfetuarSubstituicaoHidrometroActionForm"); sessao.removeAttribute("hidrometroSubstituicaoHistorico"); return retorno; } }
[ "felipesantos2089@gmail.com" ]
felipesantos2089@gmail.com
e04283b8acb1e81a29c36f0606061ff8d82150a4
82134c1600913f27465b38ac714626f7d46a7a1d
/app/src/main/java/com/example/android/xenoblade/LocationFragment.java
85ede41dd8cbad77f1b9f74c0a689476b08b9082
[]
no_license
JoshMayberry/Xenoblade
19d3a3c7a0f8299246454ed03b8c811610d47ae3
4a62b3a2e742979f114688ef31e13a586ab94540
refs/heads/master
2020-04-29T08:35:08.759217
2019-03-26T21:48:13
2019-03-26T21:48:13
175,990,964
0
0
null
null
null
null
UTF-8
Java
false
false
2,499
java
package com.example.android.xenoblade; import android.content.Context; import java.util.ArrayList; import java.util.List; public class LocationFragment extends GenericFragment<Location> { public LocationFragment() { super(); position = 1; } @Override List<Location> getOffline(Context context) { List<Location> locationList = new ArrayList<>(); locationList.add(new Location() .setTitle(context.getString(R.string.location_offline_1_title)) .setSubText(context.getString(R.string.location_offline_1_subText))); locationList.add(new Location() .setTitle(context.getString(R.string.location_offline_2_title)) .setSubText(context.getString(R.string.location_offline_2_subText))); locationList.add(new Location() .setTitle(context.getString(R.string.location_offline_3_title)) .setSubText(context.getString(R.string.location_offline_3_subText))); locationList.add(new Location() .setTitle(context.getString(R.string.location_offline_4_title)) .setSubText(context.getString(R.string.location_offline_4_subText))); locationList.add(new Location() .setTitle(context.getString(R.string.location_offline_5_title)) .setSubText(context.getString(R.string.location_offline_5_subText))); locationList.add(new Location() .setTitle(context.getString(R.string.location_offline_6_title)) .setSubText(context.getString(R.string.location_offline_6_subText))); locationList.add(new Location() .setTitle(context.getString(R.string.location_offline_7_title)) .setSubText(context.getString(R.string.location_offline_7_subText))); locationList.add(new Location() .setTitle(context.getString(R.string.location_offline_8_title)) .setSubText(context.getString(R.string.location_offline_8_subText))); locationList.add(new Location() .setTitle(context.getString(R.string.location_offline_9_title)) .setSubText(context.getString(R.string.location_offline_9_subText))); locationList.add(new Location() .setTitle(context.getString(R.string.location_offline_10_title)) .setSubText(context.getString(R.string.location_offline_10_subText))); return locationList; } }
[ "joshua.mayberry1991@gmail.com" ]
joshua.mayberry1991@gmail.com
60bfd68dd260b0d30c54ffc87f93e58fba631a43
c577f5380b4799b4db54722749cc33f9346eacc1
/BugSwarm/twilio-twilio-java-243842923/buggy_files/src/main/java/com/twilio/rest/video/v1/room/RoomRecordingReader.java
4d4e69cce05d2a46b9edc37d4b2c7b4c487f7809
[]
no_license
tdurieux/BugSwarm-dissection
55db683fd95f071ff818f9ca5c7e79013744b27b
ee6b57cfef2119523a083e82d902a6024e0d995a
refs/heads/master
2020-04-30T17:11:52.050337
2019-05-09T13:42:03
2019-05-09T13:42:03
176,972,414
1
0
null
null
null
null
UTF-8
Java
false
false
4,130
java
/** * This code was generated by * \ / _ _ _| _ _ * | (_)\/(_)(_|\/| |(/_ v1.0.0 * / / */ package com.twilio.rest.video.v1.room; import com.twilio.base.Page; import com.twilio.base.Reader; import com.twilio.base.ResourceSet; import com.twilio.exception.ApiConnectionException; import com.twilio.exception.ApiException; import com.twilio.exception.RestException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; public class RoomRecordingReader extends Reader<RoomRecording> { private final String pathRoomSid; /** * Construct a new RoomRecordingReader. * * @param pathRoomSid The room_sid */ public RoomRecordingReader(final String pathRoomSid) { this.pathRoomSid = pathRoomSid; } /** * Make the request to the Twilio API to perform the read. * * @param client TwilioRestClient with which to make the request * @return RoomRecording ResourceSet */ @Override public ResourceSet<RoomRecording> read(final TwilioRestClient client) { return new ResourceSet<>(this, client, firstPage(client)); } /** * Make the request to the Twilio API to perform the read. * * @param client TwilioRestClient with which to make the request * @return RoomRecording ResourceSet */ @Override @SuppressWarnings("checkstyle:linelength") public Page<RoomRecording> firstPage(final TwilioRestClient client) { Request request = new Request( HttpMethod.GET, Domains.VIDEO.toString(), "/v1/Rooms/" + this.pathRoomSid + "/Recordings", client.getRegion() ); addQueryParams(request); return pageForRequest(client, request); } /** * Retrieve the next page from the Twilio API. * * @param page current page * @param client TwilioRestClient with which to make the request * @return Next Page */ @Override public Page<RoomRecording> nextPage(final Page<RoomRecording> page, final TwilioRestClient client) { Request request = new Request( HttpMethod.GET, page.getNextPageUrl( Domains.VIDEO.toString(), client.getRegion() ) ); return pageForRequest(client, request); } /** * Generate a Page of RoomRecording Resources for a given request. * * @param client TwilioRestClient with which to make the request * @param request Request to generate a page for * @return Page for the Request */ private Page<RoomRecording> pageForRequest(final TwilioRestClient client, final Request request) { Response response = client.request(request); if (response == null) { throw new ApiConnectionException("RoomRecording read failed: Unable to connect to server"); } else if (!TwilioRestClient.SUCCESS.apply(response.getStatusCode())) { RestException restException = RestException.fromJson(response.getStream(), client.getObjectMapper()); if (restException == null) { throw new ApiException("Server Error, no content"); } throw new ApiException( restException.getMessage(), restException.getCode(), restException.getMoreInfo(), restException.getStatus(), null ); } return Page.fromJson( "recordings", response.getContent(), RoomRecording.class, client.getObjectMapper() ); } /** * Add the requested query string arguments to the Request. * * @param request Request to add query string arguments to */ private void addQueryParams(final Request request) { if (getPageSize() != null) { request.addQueryParam("PageSize", Integer.toString(getPageSize())); } } }
[ "durieuxthomas@hotmail.com" ]
durieuxthomas@hotmail.com
3cae1e3a7b2375e9ba9a2f5f46510fec2dff3b53
0e47cb9b2dfc70a3e94a6ac6d055a89195c964d8
/src/by/epamlab/actions/ExitAction.java
6b1582e0930324f438b0246d0aa6f66931782add
[]
no_license
ViktorFP/Struts
420cd7b2b0989627194805c6e75dd9707005bff3
c44a73c739e045210d289f183ac63e66133156e6
refs/heads/master
2021-01-01T04:55:43.073574
2016-05-29T13:02:13
2016-05-29T13:02:13
59,456,557
0
0
null
null
null
null
UTF-8
Java
false
false
553
java
package by.epamlab.actions; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; public class ExitAction extends Action { @Override public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { return mapping.findForward("success"); } }
[ "VikPr_85@mail.ru" ]
VikPr_85@mail.ru
60178c91c97b1ef7466613c85f167ed962426b12
471a6511c91a87111aac30d9e1d0cf44812af6a2
/src/main/java/org/codelibs/fess/es/exbhv/JobLogBhv.java
e468ad1f1f5308d4ed60c86a40545fb3c7832a32
[ "Apache-2.0" ]
permissive
beavis28/fess
1160e8a66de4805ee235d1ce64f409f8247bf737
8dbc3e9b77c93fe270ff15210dfe3000cc3c9d8c
refs/heads/master
2020-12-11T07:39:26.254838
2015-10-11T06:51:14
2015-10-11T06:51:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
160
java
package org.codelibs.fess.es.exbhv; import org.codelibs.fess.es.bsbhv.BsJobLogBhv; /** * @author FreeGen */ public class JobLogBhv extends BsJobLogBhv { }
[ "shinsuke@yahoo.co.jp" ]
shinsuke@yahoo.co.jp
2cd7ebca227476fa17b72223b21c91dcecaa1325
32b50e9ea80cded37b2e9cf9f474aa7c55116b0d
/src/main/java/com/example/controller/MenuController.java
df07bcc3fb00db2c23b68f54a9c28620728eb0f5
[]
no_license
Vinsm-L/Code
6a215c165ab40cde9d6d9d1ae2c31e61aba1dad6
04c857b8c8b2f11c5dd053129484f5eb10ca3c46
refs/heads/master
2020-03-20T01:02:04.311021
2018-06-11T14:34:23
2018-06-11T14:34:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
868
java
package com.example.controller; import com.example.pojo.Goods; import com.example.service.IMenuService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import java.util.List; @Controller @RequestMapping(value = "/api/*/menu") public class MenuController { @Autowired private IMenuService menuService; @ResponseBody @RequestMapping(path = "", method = RequestMethod.GET) public String getMenu() { List<Goods> list = menuService.getGoodsList(); String ret = ""; for (Goods goods : list) { ret += goods.toString() + "\n"; } return ret; } }
[ "1203177935@qq.com" ]
1203177935@qq.com
2f4c9ccff7ce37ff1f6a073cfafcf3f0722f32cf
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/21/21_a88cf8a4381f9bc2c6aff4c312f372dc9de3361a/Atum/21_a88cf8a4381f9bc2c6aff4c312f372dc9de3361a_Atum_s.java
08538b1a005131a8bdad9ee74367b786da2cd27f
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
43,461
java
package rebelkeithy.mods.atum; import java.util.ArrayList; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.EntityList; import net.minecraft.item.EnumArmorMaterial; import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.Item; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemSeeds; import net.minecraft.item.ItemSlab; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.world.biome.BiomeGenBase; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.EnumHelper; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; import rebelkeithy.mods.atum.artifacts.HorusFlight; import rebelkeithy.mods.atum.artifacts.ItemAkersToil; import rebelkeithy.mods.atum.artifacts.ItemAtensFury; import rebelkeithy.mods.atum.artifacts.ItemGebsBlessing; import rebelkeithy.mods.atum.artifacts.ItemNeithsAudacity; import rebelkeithy.mods.atum.artifacts.ItemNutsAgility; import rebelkeithy.mods.atum.artifacts.ItemOsirisWill; import rebelkeithy.mods.atum.artifacts.ItemPtahsDecadence; import rebelkeithy.mods.atum.artifacts.ItemRasGlory; import rebelkeithy.mods.atum.artifacts.ItemSekhmetsWrath; import rebelkeithy.mods.atum.artifacts.ItemSoteksRage; import rebelkeithy.mods.atum.blocks.AtumStone; import rebelkeithy.mods.atum.blocks.BlockArrowTrap; import rebelkeithy.mods.atum.blocks.BlockAtumGlass; import rebelkeithy.mods.atum.blocks.BlockAtumLeaves; import rebelkeithy.mods.atum.blocks.BlockAtumLog; import rebelkeithy.mods.atum.blocks.BlockAtumPortal; import rebelkeithy.mods.atum.blocks.BlockAtumSand; import rebelkeithy.mods.atum.blocks.BlockAtumSapling; import rebelkeithy.mods.atum.blocks.BlockAtumSlab; import rebelkeithy.mods.atum.blocks.BlockAtumStairs; import rebelkeithy.mods.atum.blocks.BlockAtumStone; import rebelkeithy.mods.atum.blocks.BlockAtumWall; import rebelkeithy.mods.atum.blocks.BlockDate; import rebelkeithy.mods.atum.blocks.BlockFertileSoil; import rebelkeithy.mods.atum.blocks.BlockFertileSoilTilled; import rebelkeithy.mods.atum.blocks.BlockFlax; import rebelkeithy.mods.atum.blocks.BlockPapyrus; import rebelkeithy.mods.atum.blocks.BlockSandLayered; import rebelkeithy.mods.atum.blocks.BlockShrub; import rebelkeithy.mods.atum.blocks.ItemBlockAtumWall; import rebelkeithy.mods.atum.blocks.ItemPapyrusPlant; import rebelkeithy.mods.atum.blocks.ItemSandLayered; import rebelkeithy.mods.atum.blocks.TileEntityArrowTrap; import rebelkeithy.mods.atum.blocks.ores.BlockAtumOre; import rebelkeithy.mods.atum.blocks.ores.BlockAtumRedstone; import rebelkeithy.mods.atum.cursedchest.BlockChestSpawner; import rebelkeithy.mods.atum.cursedchest.PharaohChest; import rebelkeithy.mods.atum.cursedchest.TileEntityChestSpawner; import rebelkeithy.mods.atum.cursedchest.TileEntityPharaohChest; import rebelkeithy.mods.atum.entities.EntityBanditArcher; import rebelkeithy.mods.atum.entities.EntityBanditWarlord; import rebelkeithy.mods.atum.entities.EntityBanditWarrior; import rebelkeithy.mods.atum.entities.EntityDesertWolf; import rebelkeithy.mods.atum.entities.EntityDustySkeleton; import rebelkeithy.mods.atum.entities.EntityGhost; import rebelkeithy.mods.atum.entities.EntityMummy; import rebelkeithy.mods.atum.entities.EntityPharaoh; import rebelkeithy.mods.atum.entities.EntityStoneSoldier; import rebelkeithy.mods.atum.furnace.BlockLimeStoneFurnace; import rebelkeithy.mods.atum.furnace.TileEntityLimestoneFurnace; import rebelkeithy.mods.atum.items.ItemAtumBow; import rebelkeithy.mods.atum.items.ItemLoot; import rebelkeithy.mods.atum.items.ItemScepter; import rebelkeithy.mods.atum.items.ItemScimitar; import rebelkeithy.mods.atum.items.ItemStoneSoldierSword; import rebelkeithy.mods.atum.items.ItemTexturedArmor; import rebelkeithy.mods.atum.tools.LimestoneAxe; import rebelkeithy.mods.atum.tools.LimestoneHoe; import rebelkeithy.mods.atum.tools.LimestonePickaxe; import rebelkeithy.mods.atum.tools.LimestoneShovel; import rebelkeithy.mods.atum.tools.LimestoneSword; import rebelkeithy.mods.atum.world.AtumWorldProvider; import rebelkeithy.mods.atum.world.biome.BiomeGenAtumDesert; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.PostInit; import cpw.mods.fml.common.Mod.PreInit; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; // Start of post-modjam branch @Mod(modid="Atum", name="Atum", version="0.0.0.1") @NetworkMod(channels = {"Atum"}, clientSideRequired = true, serverSideRequired = false) public class Atum { @Instance(value="Atum") public static Atum instance; @SidedProxy(clientSide = "rebelkeithy.mods.atum.ClientProxy", serverSide = "rebelkeithy.mods.atum.CommonProxy") public static CommonProxy proxy; public static AtumTab tabs = new AtumTab("Atum"); public static BlockAtumPortal portal; public static Block cursedChest; public static Block atumSand; public static Block atumStone; public static Block atumCobble; public static Block atumLargeBrick; public static Block atumSmallBrick; public static Block atumCarvedBrick; public static BlockAtumSlab atumSlabs; public static BlockAtumSlab atumDoubleSlab; public static Block atumSmoothStairs; public static Block atumCobbleStairs; public static Block atumLargeStoneStairs; public static Block atumSmallStoneStairs; public static Block atumSandLayered; public static Block atumCrackedLargeBrick; public static Block atumWall; public static Block atumCrystalGlass; public static Block atumFramedGlass; public static Block atumPalmSapling; public static Block atumDateBlock; public static Block atumShrub; public static Block atumWeed; public static Block atumPapyrus; public static Block atumFlax; public static BlockFertileSoil atumFertileSoil; public static Block atumFertileSoilTilled; public static Block atumLog; public static Block atumLeaves; public static Block atumPlanks; public static Block atumTrapArrow; public static Block atumPharaohChest; public static Block atumRedstoneOre; public static Block atumCoalOre; public static Block atumIronOre; public static Block atumGoldOre; public static Block atumLapisOre; public static Block atumDiamondOre; public static Item itemScarab; public static Item itemScimitar; public static Item itemScepter; public static Item itemStoneSoldierSword; public static Item itemBow; public static Item itemLoot; public static Item ptahsPick; public static Item soteksRage; public static Item osirisWill; public static Item akersToil; public static Item gebsBlessing; public static Item atensFury; public static Item rasGlory; public static Item sekhmetsWrath; public static Item nutsAgility; public static Item horusFlight; public static Item limestoneShovel; public static Item limestonePickaxe; public static Item limestoneAxe; public static Item limestoneSword; public static Item limestoneHoe; public static Item mummyHelmet; public static Item mummyChest; public static Item mummyLegs; public static Item mummyBoots; public static Item wandererHelmet; public static Item wandererChest; public static Item wandererLegs; public static Item wandererBoots; public static Item desertHelmet; public static Item desertChest; public static Item desertLegs; public static Item desertBoots; public static Item itemPapyrusPlant; public static Item itemEctoplasm; public static Item itemStoneChunk; public static Item itemClothScrap; public static Item itemScroll; public static Item itemPelt; public static Item itemDate; public static Item itemLinen; public static Item itemFlax; public static Item itemFlaxSeeds; public static int dimensionID = 17; public static BiomeGenBase atumDesert; public static Block furnaceIdle; public static Block furnaceBurning; public static Item neithsAudacity; @PreInit public void preInit(FMLPreInitializationEvent event) { ConfigAtum.initConfig(); portal = new BlockAtumPortal(ConfigAtum.portalBlockID); cursedChest = new BlockChestSpawner(ConfigAtum.cursedChestID).setUnlocalizedName("AtumCursedChest").setHardness(4.0F).setCreativeTab(tabs); atumPharaohChest = new PharaohChest(ConfigAtum.pharaohChestID).setUnlocalizedName("AtumPharaohChest").setHardness(4.0F).setCreativeTab(tabs); atumSand = new BlockAtumSand(ConfigAtum.sandID).setUnlocalizedName("Atum:AtumSand").setStepSound(Block.soundSandFootstep).setHardness(0.5F).setCreativeTab(tabs); atumStone = new AtumStone(ConfigAtum.stoneID).setUnlocalizedName("Atum:AtumStone").setHardness(1.5F).setCreativeTab(tabs); atumCobble = new Block(ConfigAtum.cobbleID, Material.rock).setUnlocalizedName("Atum:AtumCobble").setHardness(2.0F).setCreativeTab(tabs); atumCrackedLargeBrick = new Block(ConfigAtum.crackedLargeBrickID, Material.rock).setUnlocalizedName("Atum:AtumCrackedLargeBrick").setHardness(2.0F).setCreativeTab(tabs); atumLargeBrick = new BlockAtumStone(ConfigAtum.largeBrickID, Material.rock).setUnlocalizedName("Atum:AtumBrickLarge").setHardness(2.0F).setCreativeTab(tabs); atumSmallBrick = new BlockAtumStone(ConfigAtum.smallBrickID, Material.rock).setUnlocalizedName("Atum:AtumBrickSmall").setHardness(2.0F).setCreativeTab(tabs); atumCarvedBrick = new BlockAtumStone(ConfigAtum.carvedBrickID, Material.rock).setUnlocalizedName("Atum:AtumBrickCarved").setHardness(2.0F).setCreativeTab(tabs); atumSlabs = (BlockAtumSlab) new BlockAtumSlab(ConfigAtum.slabID, false, Material.rock).setUnlocalizedName("Atum:AtumSlab").setHardness(2.0F).setCreativeTab(tabs); atumDoubleSlab = (BlockAtumSlab) new BlockAtumSlab(ConfigAtum.doubleSlabID, true, Material.rock).setUnlocalizedName("Atum:AtumDoubleSlab").setHardness(2.0F); atumSmoothStairs = (new BlockAtumStairs(ConfigAtum.smoothStairsID, atumStone, 0)).setUnlocalizedName("Atum:SmoothStair").setCreativeTab(tabs); atumCobbleStairs = (new BlockAtumStairs(ConfigAtum.cobbleStairsID, atumCobble, 0)).setUnlocalizedName("Atum:CobbleStair").setCreativeTab(tabs); atumLargeStoneStairs = (new BlockAtumStairs(ConfigAtum.largeStoneStairsID, atumLargeBrick, 0)).setUnlocalizedName("Atum:LargeStoneStair").setCreativeTab(tabs); atumSmallStoneStairs = (new BlockAtumStairs(ConfigAtum.smallStoneStairsID, atumSmallBrick, 0)).setUnlocalizedName("Atum:SmallStoneStair").setCreativeTab(tabs); atumShrub = (new BlockShrub(ConfigAtum.shrubID)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("Atum:Shrub"); atumWeed = (new BlockShrub(ConfigAtum.weedID)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("Atum:Weed"); atumPapyrus = (new BlockPapyrus(ConfigAtum.papyrusBlockID)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("Atum:AtumPapyrus"); atumWall = (new BlockAtumWall(ConfigAtum.wallID, atumStone)).setUnlocalizedName("Atum:AtumStoneWall").setHardness(0.3F).setCreativeTab(tabs); atumCrystalGlass = (new BlockAtumGlass(ConfigAtum.crystalGlassID, "Atum:AtumCrystalGlass", Material.glass, false)).setStepSound(Block.soundGlassFootstep).setUnlocalizedName("Atum:AtumCrystalGlass").setHardness(0.3F).setCreativeTab(tabs); atumFramedGlass = (new BlockAtumGlass(ConfigAtum.framedGlassID, "Atum:AtumFramedGlass", Material.glass, false)).setStepSound(Block.soundGlassFootstep).setUnlocalizedName("Atum:AtumFramedGlass").setCreativeTab(tabs); atumPalmSapling = (new BlockAtumSapling(ConfigAtum.palmSaplingID)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("Atum:AtumPalmSapling").setCreativeTab(tabs); atumDateBlock = (new BlockDate(ConfigAtum.blockDateID, Material.plants)).setHardness(0.0F).setUnlocalizedName("Atum:AtumDate").setCreativeTab(tabs); atumFlax = (new BlockFlax(ConfigAtum.flaxBlockID)).setUnlocalizedName("Atum:FlaxBlock").setCreativeTab(tabs); atumSandLayered = (new BlockSandLayered(ConfigAtum.sandLayeredID)).setHardness(0.1F).setStepSound(Block.soundSnowFootstep).setUnlocalizedName("SandLayered").setLightOpacity(0).setCreativeTab(tabs); atumFertileSoil = (BlockFertileSoil) new BlockFertileSoil(ConfigAtum.fertileSoilID).setUnlocalizedName("Atum:FertileSoil").setHardness(0.5F).setStepSound(Block.soundGrassFootstep).setCreativeTab(tabs); atumFertileSoilTilled = new BlockFertileSoilTilled(ConfigAtum.fertileSoilTillID).setUnlocalizedName("Atum:FertileSoilTilled").setHardness(0.5F).setStepSound(Block.soundGrassFootstep).setCreativeTab(tabs); atumLog = new BlockAtumLog(ConfigAtum.logID).setUnlocalizedName("AtumLogs").setHardness(2F).setStepSound(Block.soundWoodFootstep).setCreativeTab(tabs); atumLeaves = new BlockAtumLeaves(ConfigAtum.leavesID).setUnlocalizedName("AtumLeaves").setHardness(0.2F).setLightOpacity(1).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("AtumLeaves").setCreativeTab(tabs); atumPlanks = (new Block(ConfigAtum.plankID, Material.wood)).setUnlocalizedName("AtumPlanks").setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("Atum:Planks").setCreativeTab(tabs); atumTrapArrow = new BlockArrowTrap(ConfigAtum.trapArrowID).setUnlocalizedName("FireTrap").setHardness(0.2F).setCreativeTab(tabs); furnaceIdle = (new BlockLimeStoneFurnace(ConfigAtum.furnaceIdleID, false)).setHardness(3.5F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("limestonefurnaceidle").setCreativeTab(tabs); furnaceBurning = (new BlockLimeStoneFurnace(ConfigAtum.furnaceBurningID, true)).setHardness(3.5F).setStepSound(Block.soundStoneFootstep).setLightValue(0.875F).setUnlocalizedName("limestonefurnaceactive"); atumRedstoneOre = new BlockAtumRedstone(ConfigAtum.redstoneOreID).setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("Atum:AtumRedstone").setCreativeTab(tabs); atumGoldOre = (new BlockAtumOre(ConfigAtum.goldOreID)).setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("Atum:AtumGold").setCreativeTab(tabs); atumIronOre = (new BlockAtumOre(ConfigAtum.ironOreID)).setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("Atum:AtumIron").setCreativeTab(tabs); atumCoalOre = (new BlockAtumOre(ConfigAtum.coalOreID)).setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("Atum:AtumCoal").setCreativeTab(tabs); atumLapisOre = (new BlockAtumOre(ConfigAtum.lapisOreID)).setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("Atum:AtumLapis").setCreativeTab(tabs); atumDiamondOre = (new BlockAtumOre(ConfigAtum.diamondOreID)).setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("Atum:AtumDiamond").setCreativeTab(tabs); ForgeHooks.canToolHarvestBlock(atumSand, 0, new ItemStack(Item.shovelIron)); MinecraftForge.setBlockHarvestLevel(atumSand, "shovel", 0); LanguageRegistry.addName(atumStone, "Limestone"); LanguageRegistry.addName(atumSand, "Limestone sand"); LanguageRegistry.addName(atumCobble, "Cracked Limestone"); //EntityRegistry.registerModEntity(EntityMummy.class, "AtumMummy", ConfigAtum.mummyID, this, 16, 20, true); ArrayList<BiomeGenBase> biomeList = new ArrayList<BiomeGenBase>(); for(int i = 0; i < BiomeGenBase.biomeList.length; i++) { if(BiomeGenBase.biomeList[i] != null && BiomeGenBase.biomeList[i].biomeID != ConfigAtum.biomeAtumDesertID) { biomeList.add(BiomeGenBase.biomeList[i]); } } int entityID; entityID = EntityRegistry.findGlobalUniqueEntityId(); EntityRegistry.registerGlobalEntityID(EntityMummy.class, "AtumMummy", entityID); EntityList.addMapping(EntityMummy.class, "AtumMummy", entityID, 0x515838, 0x868F6B); entityID = EntityRegistry.findGlobalUniqueEntityId(); EntityRegistry.registerGlobalEntityID(EntityBanditWarrior.class, "AtumBanditWarrior", entityID); EntityList.addMapping(EntityBanditWarrior.class, "AtumBanditWarrior", entityID, 0xC2C2C2, 0x040F85); entityID = EntityRegistry.findGlobalUniqueEntityId(); EntityRegistry.registerGlobalEntityID(EntityBanditArcher.class, "AtumBanditArcher", entityID); EntityList.addMapping(EntityBanditArcher.class, "AtumBanditArcher", entityID, 0xC2C2C2, 0x7E0C0C); entityID = EntityRegistry.findGlobalUniqueEntityId(); EntityRegistry.registerGlobalEntityID(EntityPharaoh.class, "AtumPharaoh", entityID); EntityList.addMapping(EntityPharaoh.class, "AtumPharaoh", entityID, 0xD4BC37, 0x3A4BE0); entityID = EntityRegistry.findGlobalUniqueEntityId(); EntityRegistry.registerGlobalEntityID(EntityDustySkeleton.class, "AtumDustySkeleton", entityID); EntityList.addMapping(EntityDustySkeleton.class, "AtumDustySkeleton", entityID, 0xB59C7D, 0x6F5C43); entityID = EntityRegistry.findGlobalUniqueEntityId(); EntityRegistry.registerGlobalEntityID(EntityGhost.class, "AtumDesertGhost", entityID); EntityList.addMapping(EntityGhost.class, "AtumDesertGhost", entityID, 0xE7DBC8, 0xAD9467); entityID = EntityRegistry.findGlobalUniqueEntityId(); EntityRegistry.registerGlobalEntityID(EntityStoneSoldier.class, "AtumStoneSoldier", entityID); EntityList.addMapping(EntityStoneSoldier.class, "AtumStoneSoldier", entityID, 0x918354, 0x695D37); entityID = EntityRegistry.findGlobalUniqueEntityId(); EntityRegistry.registerGlobalEntityID(EntityDesertWolf.class, "AtumDesertWolf", entityID); EntityList.addMapping(EntityDesertWolf.class, "AtumDesertWolf", entityID, 0x918354, 0x695D37); entityID = EntityRegistry.findGlobalUniqueEntityId(); EntityRegistry.registerGlobalEntityID(EntityBanditWarlord.class, "AtumBanditWarlord", entityID); EntityList.addMapping(EntityBanditWarlord.class, "AtumBanditWarlord", entityID, 0x918354, 0x695D37); LanguageRegistry.instance().addStringLocalization("entity.AtumMummy.name", "Mummy"); LanguageRegistry.instance().addStringLocalization("entity.AtumBanditWarrior.name", "Brigand"); LanguageRegistry.instance().addStringLocalization("entity.AtumBanditArcher.name", "Nomad"); LanguageRegistry.instance().addStringLocalization("entity.AtumPharaoh.name", "Pharaoh"); LanguageRegistry.instance().addStringLocalization("entity.AtumDustySkeleton.name", "Forsaken"); LanguageRegistry.instance().addStringLocalization("entity.AtumDesertGhost.name", "Wraith"); LanguageRegistry.instance().addStringLocalization("entity.AtumStoneSoldier.name", "Tombguard"); LanguageRegistry.instance().addStringLocalization("entity.AtumDesertWolf.name", "Desert Wolf"); LanguageRegistry.instance().addStringLocalization("entity.AtumBanditWarlord.name", "Warlord"); //EntityList.addMapping(EntityBandit.class, "AtumBanditArcher", ConfigAtum.banditArcherID, 0xC2C2C2, 0x070C0C); GameRegistry.registerBlock(atumSand, "AtumSand"); GameRegistry.registerBlock(atumStone, "AtumStone"); GameRegistry.registerBlock(atumCobble, "AtumCobble"); GameRegistry.registerBlock(atumLargeBrick, "AtumBrickLarge"); GameRegistry.registerBlock(atumSmallBrick, "AtumBrickSmall"); GameRegistry.registerBlock(atumCarvedBrick, "AtumBrickCarved"); GameRegistry.registerBlock(atumCrackedLargeBrick, "AtumCrackedLargeBrick"); GameRegistry.registerBlock(atumSlabs, "AtumSlabs"); GameRegistry.registerBlock(atumSmoothStairs, "AtumSmoothStairs"); GameRegistry.registerBlock(atumCobbleStairs, "AtumCobbleStairs"); GameRegistry.registerBlock(atumLargeStoneStairs, "AtumLargeStoneStairs"); GameRegistry.registerBlock(atumSmallStoneStairs, "AtumSmallStoneStairs"); GameRegistry.registerBlock(atumShrub, "AtumShrub"); GameRegistry.registerBlock(atumLog, "AtumLog"); GameRegistry.registerBlock(atumLeaves, "AtumLeaves"); GameRegistry.registerBlock(atumPlanks, "AtumPlanks"); GameRegistry.registerBlock(atumWeed, "AtumWeed"); GameRegistry.registerBlock(atumTrapArrow, "AtumArmorTrap"); GameRegistry.registerBlock(cursedChest, "BlockCursedChest"); GameRegistry.registerBlock(atumPharaohChest, "BlockPharaohChest"); GameRegistry.registerBlock(atumSandLayered, ItemSandLayered.class, "BlockSandLayered"); GameRegistry.registerBlock(furnaceIdle, "limestonefurnaceidle"); GameRegistry.registerBlock(furnaceBurning, "limestonefurnaceburning"); GameRegistry.registerBlock(atumRedstoneOre, "atumRedstoneOre"); GameRegistry.registerBlock(atumCoalOre, "atumCoalOre"); GameRegistry.registerBlock(atumIronOre, "atumIronOre"); GameRegistry.registerBlock(atumGoldOre, "atumGoldOre"); GameRegistry.registerBlock(atumLapisOre, "atumLapisOre"); GameRegistry.registerBlock(atumDiamondOre, "atumDiamondOre"); GameRegistry.registerBlock(atumPapyrus, "atumPapyrusBlock"); GameRegistry.registerBlock(atumWall, ItemBlockAtumWall.class, "AtumWalls"); GameRegistry.registerBlock(atumCrystalGlass, "AtumCrystalGlass"); GameRegistry.registerBlock(atumFramedGlass, "AtumFramedGlass"); GameRegistry.registerBlock(atumPalmSapling, "AtumPalmSapling"); GameRegistry.registerBlock(atumDateBlock, "AtumDateBlock"); GameRegistry.registerBlock(atumFlax, "Flax"); GameRegistry.registerBlock(atumFertileSoil, "FertileSoil"); GameRegistry.registerBlock(atumFertileSoilTilled, "FertileSoilTilled"); GameRegistry.registerTileEntity(TileEntityChestSpawner.class, "CursedChest"); GameRegistry.registerTileEntity(TileEntityPharaohChest.class, "PharaohChest"); GameRegistry.registerTileEntity(TileEntityArrowTrap.class, "ArrowTrap"); GameRegistry.registerTileEntity(TileEntityLimestoneFurnace.class, "LimestoneFurnace"); Item.itemsList[ConfigAtum.slabID] = (new ItemSlab(atumSlabs.blockID - 256, atumSlabs, atumDoubleSlab, false)).setUnlocalizedName("woodSlab").setCreativeTab(tabs); Item.itemsList[atumDoubleSlab.blockID] = (new ItemSlab(atumDoubleSlab.blockID - 256, atumSlabs, atumDoubleSlab, true)).setUnlocalizedName("woodSlab"); itemScarab = new ItemPortalSpawner(ConfigAtum.portalSpawnerID).setUnlocalizedName("Atum:Scarab").setCreativeTab(tabs); atumDesert = (new BiomeGenAtumDesert(ConfigAtum.biomeAtumDesertID)).setColor(16421912).setBiomeName("AtumDesert").setDisableRain().setTemperatureRainfall(2.0F, 0.0F).setMinMaxHeight(0.1F, 0.2F); itemLoot = new ItemLoot(ConfigAtum.lootID).setCreativeTab(tabs); itemDate = (new ItemFood(ConfigAtum.itemDateID, 5, 1.5F, false)).setUnlocalizedName("Atum:Date").setCreativeTab(tabs); itemScimitar = (new ItemScimitar(ConfigAtum.scimitarID, EnumToolMaterial.IRON)).setUnlocalizedName("Atum:Scimitar").setCreativeTab(tabs); itemBow = (new ItemAtumBow(ConfigAtum.bowID)).setUnlocalizedName("Atum:Bow").setCreativeTab(tabs); itemStoneSoldierSword = new ItemStoneSoldierSword(ConfigAtum.stoneSwordID, EnumToolMaterial.IRON).setUnlocalizedName("Atum:StoneSoldierSword").setCreativeTab(tabs); itemScepter = new ItemScepter(ConfigAtum.scepterID, EnumToolMaterial.GOLD).setUnlocalizedName("Atum:Scepter").setCreativeTab(tabs); ptahsPick = new ItemPtahsDecadence(ConfigAtum.ptahsPickID, EnumToolMaterial.EMERALD).setUnlocalizedName("Atum:PtahsDecadence").setCreativeTab(tabs); soteksRage = new ItemSoteksRage(ConfigAtum.soteksRageID, EnumToolMaterial.EMERALD).setUnlocalizedName("Atum:SoteksRage").setCreativeTab(tabs); osirisWill = new ItemOsirisWill(ConfigAtum.osirisWillID, EnumToolMaterial.EMERALD).setUnlocalizedName("Atum:OsirisWill").setCreativeTab(tabs); akersToil = new ItemAkersToil(ConfigAtum.akersToilID, EnumToolMaterial.EMERALD).setUnlocalizedName("Atum:AkersToil").setCreativeTab(tabs); gebsBlessing = new ItemGebsBlessing(ConfigAtum.gebsBlessingID, EnumToolMaterial.EMERALD).setUnlocalizedName("Atum:GebsBlessing").setCreativeTab(tabs); atensFury = new ItemAtensFury(ConfigAtum.atensFuryID).setUnlocalizedName("Atum:AtensFury").setCreativeTab(tabs); rasGlory = new ItemRasGlory(ConfigAtum.rasGloryID, EnumArmorMaterial.DIAMOND, 0, 0).setTextureFile("EgyptianArmor_1").setUnlocalizedName("Atum:RasGlory").setCreativeTab(tabs); sekhmetsWrath = new ItemSekhmetsWrath(ConfigAtum.sekhmetsWrathID, EnumArmorMaterial.DIAMOND, 1, 1).setTextureFile("EgyptianArmor_1").setUnlocalizedName("Atum:SekhmetsWrath").setCreativeTab(tabs); nutsAgility = new ItemNutsAgility(ConfigAtum.nutsAgilityID, EnumArmorMaterial.DIAMOND, 2, 2).setTextureFile("EgyptianArmor_2").setUnlocalizedName("Atum:NutsAgility").setCreativeTab(tabs); horusFlight = new HorusFlight(ConfigAtum.horusFlightID, EnumArmorMaterial.DIAMOND, 3, 3).setTextureFile("EgyptianArmor_1").setUnlocalizedName("Atum:HorusFlight").setCreativeTab(tabs); limestoneShovel = new LimestoneShovel(ConfigAtum.limestoneShovelID, EnumToolMaterial.STONE).setUnlocalizedName("Atum:LimestoneShovel").setCreativeTab(tabs); limestonePickaxe = new LimestonePickaxe(ConfigAtum.limestonePickaxeID, EnumToolMaterial.STONE).setUnlocalizedName("Atum:LimestonePickaxe").setCreativeTab(tabs); limestoneAxe = new LimestoneAxe(ConfigAtum.limestoneAxeID, EnumToolMaterial.STONE).setUnlocalizedName("Atum:LimestoneAxe").setCreativeTab(tabs); limestoneSword = new LimestoneSword(ConfigAtum.limestoneSwordID, EnumToolMaterial.STONE).setUnlocalizedName("Atum:LimestoneSword").setCreativeTab(tabs); limestoneHoe = new LimestoneHoe(ConfigAtum.limestoneHoeID, EnumToolMaterial.STONE).setUnlocalizedName("Atum:LimestoneHoe").setCreativeTab(tabs); EnumArmorMaterial mummyEnum = EnumHelper.addArmorMaterial("Mummy", 5, new int[] {1, 3, 2, 1}, 15); mummyHelmet = (ItemTexturedArmor)(new ItemTexturedArmor(ConfigAtum.mummyHelmetID, mummyEnum, 0, 0)).setTextureFile("MummyArmor_1").setUnlocalizedName("Atum:MummyHelmet").setCreativeTab(tabs); mummyChest = (ItemTexturedArmor)(new ItemTexturedArmor(ConfigAtum.mummyChestID, mummyEnum, 0, 1)).setTextureFile("MummyArmor_1").setUnlocalizedName("Atum:MummyChest").setCreativeTab(tabs); mummyLegs = (ItemTexturedArmor)(new ItemTexturedArmor(ConfigAtum.mummyLegsID, mummyEnum, 0, 2)).setTextureFile("MummyArmor_2").setUnlocalizedName("Atum:MummyLegs").setCreativeTab(tabs); mummyBoots = (ItemTexturedArmor)(new ItemTexturedArmor(ConfigAtum.mummyBootsID, mummyEnum, 0, 3)).setTextureFile("MummyArmor_1").setUnlocalizedName("Atum:MummyBoots").setCreativeTab(tabs); EnumArmorMaterial wandererEnum = EnumHelper.addArmorMaterial("Wanderer", 10, new int[] {2, 3, 3, 2}, 15); wandererHelmet = (ItemTexturedArmor)(new ItemTexturedArmor(ConfigAtum.wandererHelmetID, wandererEnum, 0, 0)).setTextureFile("WandererArmor_1").setUnlocalizedName("Atum:WandererHelmet").setCreativeTab(tabs); wandererChest = (ItemTexturedArmor)(new ItemTexturedArmor(ConfigAtum.wandererChestID, wandererEnum, 0, 1)).setTextureFile("WandererArmor_1").setUnlocalizedName("Atum:WandererChest").setCreativeTab(tabs); wandererLegs = (ItemTexturedArmor)(new ItemTexturedArmor(ConfigAtum.wandererLegsID, wandererEnum, 0, 2)).setTextureFile("WandererArmor_2").setUnlocalizedName("Atum:WandererLegs").setCreativeTab(tabs); wandererBoots = (ItemTexturedArmor)(new ItemTexturedArmor(ConfigAtum.wandererBootsID, wandererEnum, 0, 3)).setTextureFile("WandererArmor_1").setUnlocalizedName("Atum:WandererBoots").setCreativeTab(tabs); EnumArmorMaterial desertEnum = EnumHelper.addArmorMaterial("Desert", 20, new int[] {3, 6, 5, 3}, 15); desertHelmet = (ItemTexturedArmor)(new ItemTexturedArmor(ConfigAtum.desertHelmetID, desertEnum, 0, 0)).setTextureFile("DesertArmor_1").setUnlocalizedName("Atum:DesertHelmet").setCreativeTab(tabs); desertChest = (ItemTexturedArmor)(new ItemTexturedArmor(ConfigAtum.desertChestID, desertEnum, 0, 1)).setTextureFile("DesertArmor_1").setUnlocalizedName("Atum:DesertChest").setCreativeTab(tabs); desertLegs = (ItemTexturedArmor)(new ItemTexturedArmor(ConfigAtum.desertLegsID, desertEnum, 0, 2)).setTextureFile("DesertArmor_2").setUnlocalizedName("Atum:DesertLegs").setCreativeTab(tabs); desertBoots = (ItemTexturedArmor)(new ItemTexturedArmor(ConfigAtum.desertBootsID, desertEnum, 0, 3)).setTextureFile("DesertArmor_1").setUnlocalizedName("Atum:DesertBoots").setCreativeTab(tabs); itemPapyrusPlant = new ItemPapyrusPlant(ConfigAtum.itemPapyrusPlantID, atumPapyrus).setUnlocalizedName("Atum:PapyrusPlantItem").setCreativeTab(tabs); itemEctoplasm = new Item(ConfigAtum.ectoplasmID).setUnlocalizedName("Atum:Ectoplasm").setCreativeTab(tabs); itemStoneChunk = new Item(ConfigAtum.stoneChunkID).setUnlocalizedName("Atum:StoneChunk").setCreativeTab(tabs); itemClothScrap = new Item(ConfigAtum.clothScrapID).setUnlocalizedName("Atum:ClothScrap").setCreativeTab(tabs); itemScroll = new Item(ConfigAtum.scrollID).setUnlocalizedName("Atum:Scroll").setCreativeTab(tabs); itemPelt = new Item(ConfigAtum.peltID).setUnlocalizedName("Atum:WolfPelt").setCreativeTab(tabs); itemLinen = new Item(ConfigAtum.linenID).setUnlocalizedName("Atum:Linen").setCreativeTab(tabs); itemFlax = new Item(ConfigAtum.itemFlaxID).setUnlocalizedName("Atum:FlaxItem").setCreativeTab(tabs); itemFlaxSeeds = new ItemSeeds(ConfigAtum.itemFlaxSeedsID, atumFlax.blockID, Block.tilledField.blockID).setUnlocalizedName("Atum:FlaxSeeds").setCreativeTab(tabs); neithsAudacity = new ItemNeithsAudacity(ConfigAtum.neithsAudacityID).setUnlocalizedName("Atum:NeithsAudacity").setCreativeTab(tabs); MinecraftForge.setToolClass(akersToil, "shovel", 4); MinecraftForge.setToolClass(limestoneShovel, "shovel", 1); MinecraftForge.setToolClass(limestoneAxe, "axe", 1); MinecraftForge.setBlockHarvestLevel(atumCoalOre, "pickaxe", 0); MinecraftForge.setBlockHarvestLevel(atumIronOre, "pickaxe", 1); MinecraftForge.setBlockHarvestLevel(atumGoldOre, "pickaxe", 2); MinecraftForge.setBlockHarvestLevel(atumLapisOre, "pickaxe", 2); MinecraftForge.setBlockHarvestLevel(atumDiamondOre, "pickaxe", 2); MinecraftForge.setBlockHarvestLevel(atumRedstoneOre, "pickaxe", 2); proxy.registerModelRenderers(); proxy.registerTickHandlers(); proxy.preloadImages(); proxy.registerParticles(); MinecraftForge.EVENT_BUS.register(new BonemealEventListener()); MinecraftForge.EVENT_BUS.register(new FallDamageListener()); MinecraftForge.EVENT_BUS.register(new UseHoeEventListener()); NetworkRegistry.instance().registerGuiHandler(this, new AtumGuiHandler()); } @Init public void init(FMLInitializationEvent event) { DimensionManager.registerProviderType(Atum.dimensionID, AtumWorldProvider.class, true); DimensionManager.registerDimension(Atum.dimensionID , Atum.dimensionID); addNames(); addRecipes(); addShapelessRecipes(); addOreDictionaryEntries(); addSmeltingRecipes(); } @PostInit public void postInit(FMLPostInitializationEvent event) { } public void addRecipes() { // Brick recipes GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(atumLargeBrick, 4), "XX", "XX", 'X', atumStone)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(atumSmallBrick, 4), "XX", "XX", 'X', atumCobble)); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(atumCarvedBrick, 1), atumStone)); // Stair recipes GameRegistry.addRecipe(new ItemStack(atumSmoothStairs, 6), "X ", "XX ", "XXX", 'X', atumStone); GameRegistry.addRecipe(new ItemStack(atumCobbleStairs, 6), "X ", "XX ", "XXX", 'X', atumCobble); GameRegistry.addRecipe(new ItemStack(atumLargeStoneStairs, 6), "X ", "XX ", "XXX", 'X', atumLargeBrick); GameRegistry.addRecipe(new ItemStack(atumSmallStoneStairs, 6), "X ", "XX ", "XXX", 'X', atumSmallBrick); // Slab recipes GameRegistry.addRecipe(new ItemStack(atumSlabs, 6, 0), "XXX", 'X', atumStone); GameRegistry.addRecipe(new ItemStack(atumSlabs, 6, 1), "XXX", 'X', atumCobble); GameRegistry.addRecipe(new ItemStack(atumSlabs, 6, 2), "XXX", 'X', atumLargeBrick); GameRegistry.addRecipe(new ItemStack(atumSlabs, 6, 3), "XXX", 'X', atumSmallBrick); // Wall recipes GameRegistry.addRecipe(new ItemStack(atumWall, 6, 0), "XXX", "XXX", 'X', atumStone); GameRegistry.addRecipe(new ItemStack(atumWall, 6, 1), "XXX", "XXX", 'X', atumCobble); GameRegistry.addRecipe(new ItemStack(atumWall, 6, 2), "XXX", "XXX", 'X', atumLargeBrick); GameRegistry.addRecipe(new ItemStack(atumWall, 6, 3), "XXX", "XXX", 'X', atumSmallBrick); // Crystal glass to framed glass GameRegistry.addRecipe(new ItemStack(atumFramedGlass), " X ", "XSX", " X ", 'X', Item.stick, 'S', atumCrystalGlass); // Cracked large bricks recipe GameRegistry.addRecipe(new ItemStack(atumCrackedLargeBrick, 4), "XX", "XX", 'X', itemStoneChunk); // Xp bottle recipe GameRegistry.addRecipe(new ItemStack(Item.expBottle), " X ", "XBX", " X ", 'X', itemEctoplasm, 'B', Item.potion); // Limestone tool recipes GameRegistry.addRecipe(new ItemStack(limestoneSword), "L", "L", "S", 'L', atumStone, 'S', Item.stick); GameRegistry.addRecipe(new ItemStack(limestoneShovel), "L", "S", "S", 'L', atumStone, 'S', Item.stick); GameRegistry.addRecipe(new ItemStack(limestonePickaxe), "LLL", " S ", " S ", 'L', atumStone, 'S', Item.stick); GameRegistry.addRecipe(new ItemStack(limestoneAxe), "LL", "LS", " S", 'L', atumStone, 'S', Item.stick); GameRegistry.addRecipe(new ItemStack(limestoneHoe), "LL", " S", " S", 'L', atumStone, 'S', Item.stick); // Mummy armor recipes GameRegistry.addRecipe(new ItemStack(mummyHelmet), "XXX", "X X", 'X', itemClothScrap); GameRegistry.addRecipe(new ItemStack(mummyChest), "X X", "XXX", "XXX", 'X', itemClothScrap); GameRegistry.addRecipe(new ItemStack(mummyLegs), "XXX", "X X", "X X", 'X', itemClothScrap); GameRegistry.addRecipe(new ItemStack(mummyBoots), "X X", "X X", 'X', itemClothScrap); // Wanderer's armor recipes GameRegistry.addRecipe(new ItemStack(wandererHelmet), "XXX", "X X", 'X', itemLinen); GameRegistry.addRecipe(new ItemStack(wandererChest), "X X", "XXX", "XXX", 'X', itemLinen); GameRegistry.addRecipe(new ItemStack(wandererLegs), "XXX", "X X", "X X", 'X', itemLinen); GameRegistry.addRecipe(new ItemStack(wandererBoots), "X X", "X X", 'X', itemLinen); // Linen from flax GameRegistry.addRecipe(new ItemStack(itemLinen), "XXX", 'X', this.itemFlax); // Scroll from papyrus GameRegistry.addRecipe(new ItemStack(itemScroll), "XXX", "SXS", "XXX", 'X', Atum.itemPapyrusPlant, 'S', Item.stick); // Scarab recipe GameRegistry.addRecipe(new ItemStack(itemScarab), " G ", "GDG", " G ", 'G', Item.ingotGold, 'D', Item.diamond); // Furnace recipe GameRegistry.addRecipe(new ItemStack(furnaceIdle), "XXX", "X X", "XXX", 'X', atumCobble); } public void addSmeltingRecipes() { // Ore smelting recipes FurnaceRecipes.smelting().addSmelting(atumIronOre.blockID, 0, new ItemStack(Item.ingotIron), 0.7F); FurnaceRecipes.smelting().addSmelting(atumCoalOre.blockID, new ItemStack(Item.coal), 0.1F); FurnaceRecipes.smelting().addSmelting(atumRedstoneOre.blockID, new ItemStack(Item.redstone), 0.7F); FurnaceRecipes.smelting().addSmelting(atumLapisOre.blockID, new ItemStack(Item.dyePowder, 1, 4), 0.2F); FurnaceRecipes.smelting().addSmelting(atumGoldOre.blockID, new ItemStack(Item.ingotGold), 1.0F); FurnaceRecipes.smelting().addSmelting(atumDiamondOre.blockID, new ItemStack(Item.diamond), 1.0F); // Palm log to charcoal FurnaceRecipes.smelting().addSmelting(atumLog.blockID, new ItemStack(Item.coal, 1, 1), 0.15F); // Atum cobble to Atum stone FurnaceRecipes.smelting().addSmelting(atumCobble.blockID, new ItemStack(atumStone), 0.1F); // Atum sand to crystal glass FurnaceRecipes.smelting().addSmelting(atumSand.blockID, new ItemStack(atumCrystalGlass), 0.1F); } public void addOreDictionaryEntries() { // Palm log to "logWood" OreDictionary.registerOre("logWood", atumLog); // Palm planks to "plankWood" OreDictionary.registerOre("plankWood", atumPlanks); } public void addShapelessRecipes() { // Palm planks from Palm logs GameRegistry.addShapelessRecipe(new ItemStack(atumPlanks, 4), atumLog); // Desert armor from iron armor GameRegistry.addShapelessRecipe(new ItemStack(desertHelmet), wandererHelmet, Item.helmetIron); GameRegistry.addShapelessRecipe(new ItemStack(desertChest), wandererChest, Item.plateIron); GameRegistry.addShapelessRecipe(new ItemStack(desertLegs), wandererLegs, Item.legsIron); GameRegistry.addShapelessRecipe(new ItemStack(desertBoots), wandererBoots, Item.bootsIron); // Atum (Strange) sand to normal vanilla sand GameRegistry.addShapelessRecipe(new ItemStack(Block.sand), atumSand); // Linen cloth to string GameRegistry.addShapelessRecipe(new ItemStack(Item.silk, 3), itemFlax); } public void addNames() { LanguageRegistry.addName(atumSand, "Strange Sand"); LanguageRegistry.addName(atumStone, "Limestone"); LanguageRegistry.addName(atumCobble, "Cracked Limestone"); LanguageRegistry.addName(atumLargeBrick, "Large Limestone Bricks"); LanguageRegistry.addName(atumSmallBrick, "Small Limestone Bricks"); LanguageRegistry.addName(atumCarvedBrick, "Carved Limestone"); LanguageRegistry.addName(atumCrackedLargeBrick, "Cracked Large Limestone Bricks"); LanguageRegistry.addName(atumSmoothStairs, "Limestone Stairs"); LanguageRegistry.addName(atumCobbleStairs, "Cracked Limestone Stairs"); LanguageRegistry.addName(atumLargeStoneStairs, "Large Limestone Brick Stairs"); LanguageRegistry.addName(atumSmallStoneStairs, "Small Limestone Brick Stairs"); LanguageRegistry.addName(atumShrub, "Desert Shrub"); LanguageRegistry.addName(atumLog, "Palm Log"); LanguageRegistry.addName(atumPlanks, "Palm Planks"); LanguageRegistry.addName(atumLeaves, "Palm Leaves"); LanguageRegistry.addName(atumWeed, "Desert Shrub"); LanguageRegistry.addName(atumTrapArrow, "Fire Trap"); LanguageRegistry.addName(cursedChest, "Cursed Chest"); LanguageRegistry.addName(atumPharaohChest, "Pharaoh's Chest"); LanguageRegistry.addName(atumSandLayered, "Strange Sand"); LanguageRegistry.addName(furnaceIdle, "Limestone Furnace"); LanguageRegistry.addName(atumRedstoneOre, "Redstone Ore"); LanguageRegistry.addName(atumCoalOre, "Coal Ore"); LanguageRegistry.addName(atumIronOre, "Iron Ore"); LanguageRegistry.addName(atumGoldOre, "Gold Ore"); LanguageRegistry.addName(atumLapisOre, "Lapis Ore"); LanguageRegistry.addName(atumDiamondOre, "Diamond Ore"); LanguageRegistry.addName(new ItemStack(atumSlabs, 6, 0), "Limestone Slabs"); LanguageRegistry.addName(new ItemStack(atumSlabs, 6, 1), "Cracked Limestone Slabs"); LanguageRegistry.addName(new ItemStack(atumSlabs, 6, 2), "Large Limestone Brick Slabs"); LanguageRegistry.addName(new ItemStack(atumSlabs, 6, 3), "Small Limestone Brick Slabs"); LanguageRegistry.addName(atumPapyrus, "Papyrus"); LanguageRegistry.addName(new ItemStack(atumWall, 6, 0), "Limestone Wall"); LanguageRegistry.addName(new ItemStack(atumWall, 6, 1), "Cracked Limestone Wall"); LanguageRegistry.addName(new ItemStack(atumWall, 6, 2), "Large Limestone Brick Wall"); LanguageRegistry.addName(new ItemStack(atumWall, 6, 3), "Small Limestone Brick Wall"); LanguageRegistry.addName(atumCrystalGlass, "Crystal Glass"); LanguageRegistry.addName(atumFramedGlass, "Framed Crystal Glass"); LanguageRegistry.addName(atumPalmSapling, "Palm Sapling"); LanguageRegistry.addName(atumDateBlock, "Date Block"); LanguageRegistry.addName(atumFertileSoil, "Fertile Soil"); LanguageRegistry.addName(atumFertileSoilTilled, "Fertile Soil Tilled"); LanguageRegistry.addName(itemScarab, "Golden Scarab"); LanguageRegistry.addName(itemScimitar, "Scimitar"); LanguageRegistry.addName(itemBow, "Shortbow"); LanguageRegistry.addName(itemStoneSoldierSword, "Ancient Stone Sword"); LanguageRegistry.addName(itemEctoplasm, "Ectoplasm"); LanguageRegistry.addName(itemStoneChunk, "Limestone Chunk"); LanguageRegistry.addName(itemClothScrap, "Cloth Scrap"); LanguageRegistry.addName(itemScepter, "Royal Scepter"); LanguageRegistry.addName(itemPapyrusPlant, "Papyrus"); LanguageRegistry.addName(ptahsPick, "Ptah's Decadence"); LanguageRegistry.addName(soteksRage, "Sotek's Rage"); LanguageRegistry.addName(osirisWill, "Osiris's Will"); LanguageRegistry.addName(akersToil, "Aker's Toil"); LanguageRegistry.addName(gebsBlessing, "Geb's Blessing"); LanguageRegistry.addName(atensFury, "Aten's Fury"); LanguageRegistry.addName(rasGlory, "Ra's Glory"); LanguageRegistry.addName(sekhmetsWrath, "Sekhmet's Wrath"); LanguageRegistry.addName(nutsAgility, "Nut's Agility"); LanguageRegistry.addName(horusFlight, "Horus's Flight"); LanguageRegistry.addName(limestoneShovel, "Limestone Shovel"); LanguageRegistry.addName(limestonePickaxe, "Limestone Pickaxe"); LanguageRegistry.addName(limestoneAxe, "Limestone Axe"); LanguageRegistry.addName(limestoneSword, "Limestone Sword"); LanguageRegistry.addName(limestoneHoe, "Limestone Hoe"); LanguageRegistry.addName(mummyHelmet, "Head Wrap"); LanguageRegistry.addName(mummyChest, "Chest Wrap"); LanguageRegistry.addName(mummyLegs, "Leg Wrap"); LanguageRegistry.addName(mummyBoots, "Feet Wrap"); LanguageRegistry.addName(wandererHelmet, "Wanderer Head"); LanguageRegistry.addName(wandererChest, "Wanderer Chest"); LanguageRegistry.addName(wandererLegs, "Wanderer Legs"); LanguageRegistry.addName(wandererBoots, "Wanderer Sandels"); LanguageRegistry.addName(desertHelmet, "Desert Head"); LanguageRegistry.addName(desertChest, "Desert Chest"); LanguageRegistry.addName(desertLegs, "Desert Legs"); LanguageRegistry.addName(desertBoots, "Desert Sandels"); LanguageRegistry.addName(neithsAudacity, "Neith's Audacity"); LanguageRegistry.addName(itemScroll, "Scroll"); LanguageRegistry.addName(itemPelt, "Wolf Pelt"); LanguageRegistry.addName(itemLinen, "Linen"); LanguageRegistry.addName(itemFlax, "Flax"); LanguageRegistry.addName(itemFlaxSeeds, "Flax Seeds"); LanguageRegistry.instance().addStringLocalization("itemGroup.Atum", "Atum"); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
00fc190f7e414254ad30e51b5d10aa84d16b08fc
3fdfda983cbf71e4909273ad4c793b60a4d20b58
/20-web-flux/src/main/java/ru/otus/web/flux/domain/Comment.java
8379468cd5e0087e65d18b27a14a8caf5c76b478
[]
no_license
DenK7/2021-02-otus-spring-kubrin
be1316455e8871a26640b4b261e77cb02ae450db
e6b79ed6dbd9b99f9ad09d386f55453e39738100
refs/heads/main
2023-07-09T14:04:16.320880
2021-08-04T17:54:42
2021-08-04T17:54:42
342,537,588
0
0
null
2021-07-29T18:07:01
2021-02-26T10:13:58
Java
UTF-8
Java
false
false
441
java
package ru.otus.web.flux.domain; import lombok.Builder; import lombok.Data; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.data.mongodb.core.mapping.Field; @Data @Document(value = "comment") @Builder public class Comment { @Id private String id; @Field(name = "comment_txt") private String commentTxt; private String bookId; }
[ "kdv2kz@yandex.ru" ]
kdv2kz@yandex.ru
fb196bc34aeee7b9cb913f89dfec04215156240e
e0ffaa78078bba94b5ad7897ce4baf9636d5e50d
/plugins/edu.kit.ipd.sdq.modsim.hla.edit/src/edu/kit/ipd/sdq/modsim/hla/ieee1516/omt/provider/SimpleDataType1ItemProvider.java
e62558b2194da8c381454a385da274c370242728
[]
no_license
kit-sdq/RTI_Plugin
828fbf76771c1fb898d12833ec65b40bbb213b3f
bc57398be3d36e54d8a2c8aaac44c16506e6310c
refs/heads/master
2021-05-05T07:46:18.402561
2019-01-30T13:26:01
2019-01-30T13:26:01
118,887,589
0
0
null
null
null
null
UTF-8
Java
false
false
3,985
java
/** */ package edu.kit.ipd.sdq.modsim.hla.ieee1516.omt.provider; import edu.kit.ipd.sdq.modsim.hla.ieee1516.omt.OmtPackage; import edu.kit.ipd.sdq.modsim.hla.ieee1516.omt.SimpleDataType1; import java.util.Collection; import java.util.List; import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.ecore.util.FeatureMap; import org.eclipse.emf.ecore.util.FeatureMapUtil; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; /** * This is the item provider adapter for a {@link edu.kit.ipd.sdq.modsim.hla.ieee1516.omt.SimpleDataType1} object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public class SimpleDataType1ItemProvider extends SimpleDataTypeItemProvider { /** * This constructs an instance from a factory and a notifier. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public SimpleDataType1ItemProvider(AdapterFactory adapterFactory) { super(adapterFactory); } /** * This returns the property descriptors for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { if (itemPropertyDescriptors == null) { super.getPropertyDescriptors(object); } return itemPropertyDescriptors; } /** * This returns SimpleDataType1.gif. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object getImage(Object object) { return overlayImage(object, getResourceLocator().getImage("full/obj16/SimpleDataType1")); } /** * This returns the label text for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String getText(Object object) { String label = ((SimpleDataType1)object).getIdtag(); return label == null || label.length() == 0 ? getString("_UI_SimpleDataType1_type") : getString("_UI_SimpleDataType1_type") + " " + label; } /** * This handles model notifications by calling {@link #updateChildren} to update any cached * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void notifyChanged(Notification notification) { updateChildren(notification); super.notifyChanged(notification); } /** * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children * that can be created under this object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); } /** * This returns the label text for {@link org.eclipse.emf.edit.command.CreateChildCommand}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String getCreateChildText(Object owner, Object feature, Object child, Collection<?> selection) { Object childFeature = feature; Object childObject = child; if (childFeature instanceof EStructuralFeature && FeatureMapUtil.isFeatureMap((EStructuralFeature)childFeature)) { FeatureMap.Entry entry = (FeatureMap.Entry)childObject; childFeature = entry.getEStructuralFeature(); childObject = entry.getValue(); } boolean qualify = childFeature == OmtPackage.eINSTANCE.getSimpleDataType_Units() || childFeature == OmtPackage.eINSTANCE.getSimpleDataType_Resolution() || childFeature == OmtPackage.eINSTANCE.getSimpleDataType_Accuracy(); if (qualify) { return getString ("_UI_CreateChild_text2", new Object[] { getTypeText(childObject), getFeatureText(childFeature), getTypeText(owner) }); } return super.getCreateChildText(owner, feature, child, selection); } }
[ "gruen.jojo.develop@gmail.com" ]
gruen.jojo.develop@gmail.com
9177c13f7e1a498c7c390f518d7461d4f86dc98e
efad55decaacfd1e50316d298a2a491ebc709e9e
/KDtrees.Week5/src/com/company/KdTree.java
b4b4df72f2eb454ad925bb3140492af266d6529a
[]
no_license
SophiaYarmolenko/Algorithms-Part-1-Princeton-University
540845cdd636a52daf04d536c0278277f49b8353
570ac11265fae5c747de1428925b086da02079f1
refs/heads/master
2021-06-13T20:52:06.254248
2020-08-21T16:49:39
2020-08-21T16:49:39
254,442,794
0
0
null
null
null
null
UTF-8
Java
false
false
11,033
java
//package com.company; import edu.princeton.cs.algs4.RectHV; import edu.princeton.cs.algs4.Point2D; import edu.princeton.cs.algs4.StdDraw; import java.util.Iterator; import java.util.LinkedList; public class KdTree { private Node root; private static final boolean RED = true; private static final boolean BLUE = false; private Node nearestPoint = root; // private double color = 255; private double minimalDistance; // construct an empty set of points public KdTree() {}; private class Node { Point2D point; boolean color; int counter = 0;//number of children + 1 Node left; Node right; public Node(Point2D point, boolean color) { checkNull(point); this.point = point; this.color = color; } } // is the set empty? public boolean isEmpty() { return size() == 0; } // number of points in the set public int size() { return size(root); } private int size(Node x) { if( x == null) return 0; return x.counter; } // add the point to the set (if it is not already in the set) public void insert(Point2D point) { checkNull(point); root = put(root, point, RED); } private Node put(Node node, Point2D point, boolean color) { if(node == null) { node = new Node(point, color); node.counter = 1 + size(node.left) +size(node.right); return node; } double previousCoordinate;//the old coordinate to compare with double currentlyCoordinate;//the new coordinate double anotherPreviousCoordinate; double anotherCurrentlyCoordinate; if(color == RED) { previousCoordinate = node.point.x(); currentlyCoordinate = point.x(); anotherCurrentlyCoordinate = point.y(); anotherPreviousCoordinate = node.point.y(); } else { previousCoordinate = node.point.y(); currentlyCoordinate = point.y(); anotherCurrentlyCoordinate = point.x(); anotherPreviousCoordinate = node.point.x(); } if ( currentlyCoordinate == previousCoordinate && anotherCurrentlyCoordinate == anotherPreviousCoordinate) node.point = point; else if( currentlyCoordinate < previousCoordinate ) node.left = put(node.left, point, !color); else if ( currentlyCoordinate >= previousCoordinate ) node.right = put(node.right, point, !color); node.counter = 1 + size(node.left) +size(node.right); return node; } // does the set contain point p? public boolean contains(Point2D p) { checkNull(p); Node node = root; double ownCoordinate ; double possibleCoordinate; double anotherOwnCoordinate; double anotherPossibleCoordinate; while ( node != null) { if(node.color == RED) { ownCoordinate = p.x(); possibleCoordinate = node.point.x(); anotherOwnCoordinate = p.y(); anotherPossibleCoordinate = node.point.y(); } else { ownCoordinate = p.y(); possibleCoordinate = node.point.y(); anotherOwnCoordinate = p.x(); anotherPossibleCoordinate = node.point.x(); } if( ownCoordinate == possibleCoordinate && anotherOwnCoordinate == anotherPossibleCoordinate) return true; else if( ownCoordinate < possibleCoordinate ) node = node.left; else if ( ownCoordinate >= possibleCoordinate) node = node.right; } return false; } // draw all points to standard draw public void draw() { Iterator<Node> iterator = iterator(); while (iterator.hasNext()) { Node pointNode = iterator.next(); if(pointNode.color == RED) drowLine(new Point2D(pointNode.point.x()-1, pointNode.point.y()), new Point2D(pointNode.point.x()+1, pointNode.point.y()), RED); else drowLine(new Point2D(pointNode.point.x(), pointNode.point.y() - 1), new Point2D(pointNode.point.x(), pointNode.point.y() + 1), BLUE); StdDraw.setPenColor(0 , 0, 0); StdDraw.setPenRadius(0.02); pointNode.point.draw(); } } private void drowLine (Point2D pointLeft, Point2D pointRight, boolean color) { if(color == RED) StdDraw.setPenColor(255 , 0, 0); else StdDraw.setPenColor(0 , 0, 255); StdDraw.setPenRadius(0.005); StdDraw.line(pointLeft.x(), pointLeft.y(), pointRight.x(), pointRight.y()); } private Iterator <Node> iterator() { LinkedList<Node> q = new LinkedList<Node>(); inorder(root, q); return q.iterator(); } private void inorder(Node x, LinkedList<Node> q) { if(x == null) return; inorder(x.left, q); q.add(x); inorder(x.right, q); } // all points that are inside the rectangle (or on the boundary) public Iterable<Point2D> range(RectHV rect) { checkNull(rect); LinkedList <Point2D> pointsInRect = new LinkedList<Point2D>(); InRectSearch(rect, pointsInRect, root); return pointsInRect; } private void InRectSearch(RectHV rect, LinkedList<Point2D> pointsInRect, Node node) { double ownCoordinate; double rectCoordinateMin; double rectCoordinateMax; if(node != null) { if (rect.contains(node.point)) pointsInRect.add(node.point); if(node.color == RED) { ownCoordinate = node.point.x(); rectCoordinateMin = rect.xmin(); rectCoordinateMax = rect.xmax(); } else { ownCoordinate = node.point.y(); rectCoordinateMin = rect.ymin(); rectCoordinateMax = rect.ymax(); } if( ownCoordinate > rectCoordinateMax ) { InRectSearch(rect, pointsInRect, node.left); } else if ( ownCoordinate < rectCoordinateMin) { InRectSearch(rect, pointsInRect, node.right); } else { InRectSearch(rect, pointsInRect, node.right); InRectSearch(rect, pointsInRect, node.left); } } } // a nearest neighbor in the set to point p; null if the set is empty public Point2D nearest(Point2D p) { checkNull(p); if(isEmpty()) return null; minimalDistance = p.distanceTo(root.point); return nearest(root, p); } private Point2D nearest(Node node, Point2D p) { if( node == null) return nearestPoint.point; double distanceToEdge; double distanceToPoint = p.distanceTo(node.point); double currentCoordinate; double nearestCoordinate; if(distanceToPoint <= minimalDistance) { minimalDistance = distanceToPoint; nearestPoint = node; // System.out.println("new minimal = " + nearestPoint.point.toString()); //StdDraw.setPenColor(0 , (int) color, 0); //nearestPoint.point.draw(); //color -= 40; } if(node.color == RED) { distanceToEdge = Math.sqrt(p.distanceSquaredTo(node.point) - Math.pow(node.point.y()-p.y(), 2)); currentCoordinate = node.point.x(); nearestCoordinate = nearestPoint.point.x(); } else { distanceToEdge = Math.sqrt(p.distanceSquaredTo(node.point) - Math.pow(node.point.x()-p.x(), 2)); currentCoordinate = node.point.y(); nearestCoordinate = nearestPoint.point.y(); } if(distanceToEdge > minimalDistance) if(nearestCoordinate < currentCoordinate) nearest(node.left, p); else nearest(node.right, p); else { nearest(node.right, p); nearest(node.left, p); //System.out.println("Nearest = " + nearestPoint.point.toString()); } return nearestPoint.point; } private void checkNull(Object element) { if ( element == null ) throw new IllegalArgumentException("Argument is null"); } // unit testing of the methods (optional) public static void main(String[] args) { KdTree tree = new KdTree(); tree.insert(new Point2D(0.8125, 0.0625)); tree.insert(new Point2D(0.40625, 0.21875)); tree.insert(new Point2D(0.625 , 0.15625)); tree.insert(new Point2D(0.34375, 0.1875)); tree.insert(new Point2D(0.21875, 0.0)); tree.insert(new Point2D(0.25, 0.5625)); tree.insert(new Point2D(0.1875, 0.28125)); tree.insert(new Point2D(0.53125, 0.6875)); tree.insert(new Point2D(0.84375, 0.59375)); tree.insert(new Point2D(0.4375, 0.09375)); tree.insert(new Point2D(0.5, 0.96875)); tree.insert(new Point2D(0.96875, 0.625)); tree.insert(new Point2D(0.375, 0.34375)); tree.insert(new Point2D(0.6875, 0.375)); tree.insert(new Point2D(0.3125, 0.8125)); tree.insert(new Point2D(0.0, 0.65625)); tree.insert(new Point2D(0.71875, 0.53125)); tree.insert(new Point2D(0.09375, 0.46875)); tree.insert(new Point2D(0.46875, 0.75)); tree.insert(new Point2D(0.75, 0.4375)); tree.draw(); RectHV rect = new RectHV(0.0, 0.0, 0.5, 0.5); System.out.println("size of the tree = " + tree.size()); System.out.println("contains (0.0, 0.2)? = " + tree.contains(new Point2D(0.0, 0.2))); for(Point2D point : tree.range(rect)) System.out.println(point.toString()); StdDraw.setPenColor(0 , 0, 225); tree.nearest(new Point2D(1.0, 0.40625)).draw(); //System.out.println("nearest point = " + tree.nearest(new Point2D(1.0, 0.40625))); StdDraw.setPenColor(100 , 0, 100); new Point2D(1.0, 0.40625).draw(); } }
[ "noreply@github.com" ]
noreply@github.com
8c049d7c025ece14006dc5bfd9d21b571285f2c9
4688d19282b2b3b46fc7911d5d67eac0e87bbe24
/aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/Predicate.java
5f059931f20dc5485873e614563483fa63bec8d0
[ "Apache-2.0" ]
permissive
emilva/aws-sdk-java
c123009b816963a8dc86469405b7e687602579ba
8fdbdbacdb289fdc0ede057015722b8f7a0d89dc
refs/heads/master
2021-05-13T17:39:35.101322
2018-12-12T13:11:42
2018-12-12T13:11:42
116,821,450
1
0
Apache-2.0
2018-09-19T04:17:41
2018-01-09T13:45:39
Java
UTF-8
Java
false
false
7,073
java
/* * Copyright 2012-2018 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.glue.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** * <p> * Defines the predicate of the trigger, which determines when it fires. * </p> * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/glue-2017-03-31/Predicate" target="_top">AWS API * Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class Predicate implements Serializable, Cloneable, StructuredPojo { /** * <p> * Currently "OR" is not supported. * </p> */ private String logical; /** * <p> * A list of the conditions that determine when the trigger will fire. * </p> */ private java.util.List<Condition> conditions; /** * <p> * Currently "OR" is not supported. * </p> * * @param logical * Currently "OR" is not supported. * @see Logical */ public void setLogical(String logical) { this.logical = logical; } /** * <p> * Currently "OR" is not supported. * </p> * * @return Currently "OR" is not supported. * @see Logical */ public String getLogical() { return this.logical; } /** * <p> * Currently "OR" is not supported. * </p> * * @param logical * Currently "OR" is not supported. * @return Returns a reference to this object so that method calls can be chained together. * @see Logical */ public Predicate withLogical(String logical) { setLogical(logical); return this; } /** * <p> * Currently "OR" is not supported. * </p> * * @param logical * Currently "OR" is not supported. * @return Returns a reference to this object so that method calls can be chained together. * @see Logical */ public Predicate withLogical(Logical logical) { this.logical = logical.toString(); return this; } /** * <p> * A list of the conditions that determine when the trigger will fire. * </p> * * @return A list of the conditions that determine when the trigger will fire. */ public java.util.List<Condition> getConditions() { return conditions; } /** * <p> * A list of the conditions that determine when the trigger will fire. * </p> * * @param conditions * A list of the conditions that determine when the trigger will fire. */ public void setConditions(java.util.Collection<Condition> conditions) { if (conditions == null) { this.conditions = null; return; } this.conditions = new java.util.ArrayList<Condition>(conditions); } /** * <p> * A list of the conditions that determine when the trigger will fire. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setConditions(java.util.Collection)} or {@link #withConditions(java.util.Collection)} if you want to * override the existing values. * </p> * * @param conditions * A list of the conditions that determine when the trigger will fire. * @return Returns a reference to this object so that method calls can be chained together. */ public Predicate withConditions(Condition... conditions) { if (this.conditions == null) { setConditions(new java.util.ArrayList<Condition>(conditions.length)); } for (Condition ele : conditions) { this.conditions.add(ele); } return this; } /** * <p> * A list of the conditions that determine when the trigger will fire. * </p> * * @param conditions * A list of the conditions that determine when the trigger will fire. * @return Returns a reference to this object so that method calls can be chained together. */ public Predicate withConditions(java.util.Collection<Condition> conditions) { setConditions(conditions); return this; } /** * Returns a string representation of this object; useful for testing and debugging. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getLogical() != null) sb.append("Logical: ").append(getLogical()).append(","); if (getConditions() != null) sb.append("Conditions: ").append(getConditions()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Predicate == false) return false; Predicate other = (Predicate) obj; if (other.getLogical() == null ^ this.getLogical() == null) return false; if (other.getLogical() != null && other.getLogical().equals(this.getLogical()) == false) return false; if (other.getConditions() == null ^ this.getConditions() == null) return false; if (other.getConditions() != null && other.getConditions().equals(this.getConditions()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getLogical() == null) ? 0 : getLogical().hashCode()); hashCode = prime * hashCode + ((getConditions() == null) ? 0 : getConditions().hashCode()); return hashCode; } @Override public Predicate clone() { try { return (Predicate) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.glue.model.transform.PredicateMarshaller.getInstance().marshall(this, protocolMarshaller); } }
[ "" ]
9a9b39ff7956dfe2a55a04e29486dadfc228ce6f
8084c0237a4ec5ec655db086403b03df76463182
/app/src/main/java/ds/danstrong/classtracker/MainActivity.java
aae16acae536dcbd4f59b1b9965e6c579688dc7f
[ "MIT" ]
permissive
dstrongj/Android_Class_Tracker
d59f5b023a24f436eb482816119e49b4a66c29f7
e5b9fb79efcf6f38e9c1f9ee6ae8a45b1a2eb501
refs/heads/master
2020-04-21T22:57:01.491668
2019-02-09T22:11:55
2019-02-09T22:11:55
169,929,816
0
0
null
null
null
null
UTF-8
Java
false
false
1,655
java
package ds.danstrong.classtracker; import android.content.Intent; import android.database.Cursor; import android.net.Uri; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.view.View; import android.widget.Toast; public class MainActivity extends AppCompatActivity { private static final int TERM_VIEWER_ACTIVITY_CODE = 11111; private static final int TERM_LIST_ACTIVITY_CODE = 22222; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); } public void openCurrentTerm(View view) { Cursor c = getContentResolver().query(DataProvider.TERMS_URI, null, DBOpenHelper.TERM_ACTIVE + " =1", null, null); while (c.moveToNext()) { Intent intent = new Intent(this, TermViewerActivity.class); long id = c.getLong(c.getColumnIndex(DBOpenHelper.TERMS_TABLE_ID)); Uri uri = Uri.parse(DataProvider.TERMS_URI + "/" + id); intent.putExtra(DataProvider.TERM_CONTENT_TYPE, uri); startActivityForResult(intent, TERM_VIEWER_ACTIVITY_CODE); return; } Toast.makeText(this, getString(R.string.no_active_term_set), Toast.LENGTH_SHORT).show(); } public void openTermList(View view) { Intent intent = new Intent(this, TermListActivity.class); startActivityForResult(intent, TERM_LIST_ACTIVITY_CODE); } }
[ "daniel.strong4@gmail.com" ]
daniel.strong4@gmail.com
175498a5ae58abe6afc8df812d23af37c43c4a91
3e38fec5ff90cce295ead28f891ffcfeaa8c41a3
/src/main/java/com/secusociale/portail/service/soap/employeurExistant/package-info.java
0c6b187094860bcac41c657157d06481a801aa03
[]
no_license
CSSIPRES/PortailCssIpresV2
e54167e9f37b1de6a4c0708fbdb72472ae98fd18
3691154cda5fa4c92ba11d3b0837d6a00ae0d01b
refs/heads/master
2022-12-28T08:09:56.639551
2020-11-13T08:56:52
2020-11-13T08:56:52
254,369,166
0
0
null
2022-12-16T05:13:35
2020-04-09T12:46:41
Java
UTF-8
Java
false
false
163
java
@javax.xml.bind.annotation.XmlSchema(namespace = "http://oracle.com/CM_GET_EMPLOYEUR_DETAILS.xsd") package com.secusociale.portail.service.soap.employeurExistant;
[ "kebe1702@gmail.com" ]
kebe1702@gmail.com
8af946e06167f86ebaf119448e0df8a7111b8172
612cf50dbe21d3fd26f3e22c473a2095d5a544f7
/SpringBootJSP-SpringSecurity/src/main/java/com/xuandien369/reponsitory/FMDetailsReponsitory.java
df3d1026c914f6fcca6dfd69e0de62b885f31539
[]
no_license
xuandien369/music_project
0419397fb25196e7f2818a2d47ed3995d9b941bf
39021e90b46f25d436e2bb3c4200a09667a7f26f
refs/heads/main
2023-01-31T08:20:43.065002
2020-12-13T13:08:11
2020-12-13T13:08:11
321,066,058
0
0
null
null
null
null
UTF-8
Java
false
false
574
java
package com.xuandien369.reponsitory; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import com.xuandien369.entity.FavoriteMusic; import com.xuandien369.entity.FavoriteMusicDetails; public interface FMDetailsReponsitory extends JpaRepository<FavoriteMusicDetails, Integer>{ @Query("SELECT e FROM FavoriteMusicDetails e WHERE e.FMId = :FMId") List<FavoriteMusicDetails> findByFMId(@Param("FMId") FavoriteMusic FMId); }
[ "xuandien369@gmail.com" ]
xuandien369@gmail.com
c92565c53132f64926a4d1aa4c26f9f3f4336e59
d130b41b39a94a46d1a8b4b874bbc40a4094d45f
/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Helper/OperationHelper.java
e5d9939f79808d5916230f0c34e640f1b619dbbf
[]
no_license
HavenNunnelley/ftc2021
38e06c6bb51354f34a38697ead5beaf8727d524d
6666bf022bd29a0190ee4bc2e276a10c361a9f32
refs/heads/master
2023-01-03T14:54:21.866071
2020-10-29T23:30:36
2020-10-29T23:30:36
303,528,921
0
0
null
null
null
null
UTF-8
Java
false
false
884
java
package org.firstinspires.ftc.teamcode.Helper; import com.qualcomm.robotcore.hardware.HardwareMap; import org.firstinspires.ftc.robotcore.external.Telemetry; public class OperationHelper { protected Telemetry telemetry; // this is protected because it can be used by derived classes, // in this case LanderHelper is a derived class from NoOperationHelper // Telemetry refers to displaying information on the driver phone // Telemetry is defined through FtcRobotController protected HardwareMap hardwareMap; // hardwareMap is defined through FtcRobot Controller // hardwareMap is created through Config on Robot Control Phone OperationHelper(Telemetry t, HardwareMap h) { telemetry = t; hardwareMap = h; } public void init() {} public int loop(double runTime, int state){ return state; } }
[ "slane2727@gmail.com" ]
slane2727@gmail.com
8953ec320c209646713ed69ea3af24701706050c
180e78725121de49801e34de358c32cf7148b0a2
/dataset/protocol1/repairnator/learning/6468/Properties.java
2dea9db6009e83bda5874b816475cdf6c6e63d2a
[]
no_license
ASSERT-KTH/synthetic-checkstyle-error-dataset
40e8d1e0a7ebe7f7711def96a390891a6922f7bd
40c057e1669584bfc6fecf789b5b2854660222f3
refs/heads/master
2023-03-18T12:50:55.410343
2019-01-25T09:54:39
2019-01-25T09:54:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,228
java
package fr.inria.spirals.repairnator.process.inspectors.properties; import fr.inria.spirals.repairnator.process.inspectors.properties.builds.Builds; import fr.inria.spirals.repairnator.process.inspectors.properties.commits.Commits; import fr.inria.spirals.repairnator.process.inspectors.properties.patchDiff.PatchDiff; import fr.inria.spirals.repairnator.process.inspectors.properties.projectMetrics.ProjectMetrics; import fr.inria.spirals.repairnator.process.inspectors.properties.repository.Repository; import fr.inria.spirals.repairnator.process.inspectors.properties.reproductionBuggyBuild.ReproductionBuggyBuild; import fr.inria.spirals.repairnator.process.inspectors.properties.tests.Tests; public class Properties { private String version; // this property is specific for bears.json private String type; private Repository repository; private Builds builds; private Commits commits; private Tests tests; private PatchDiff patchDiff; private ProjectMetrics projectMetrics; private ReproductionBuggyBuild reproductionBuggyBuild; public Properties() { this.repository = new Repository(); this.builds = new Builds(); this.commits = new Commits(); this.tests = new Tests(); this.patchDiff = new PatchDiff(); this.projectMetrics = new ProjectMetrics(); this.reproductionBuggyBuild = new ReproductionBuggyBuild(); } public String getVersion() { return version; } public void setVersion(String version) { this.version = version; } public String getType() { return type; } public void setType(String type) { this.type = type; } public Repository getRepository() { return repository; } public Builds getBuilds() { return builds; } public Commits getCommits() { return commits; } public Tests getTests() { return tests; } public PatchDiff getPatchDiff() { return patchDiff; } public ProjectMetrics getProjectMetrics() { return projectMetrics; } public ReproductionBuggyBuild getReproductionBuggyBuild() { return reproductionBuggyBuild; } }
[ "bloriot97@gmail.com" ]
bloriot97@gmail.com
e162a0915d1c24c9e847de763a0c4378db4e7801
cc5cd063cb069896fb7443a023fb3fe8fca0b29d
/ReadPropertiesFile.java
cadb6dc6aa8c55057b98b92fbdc69913f908e40f
[]
no_license
Kevinstronger/File-IO
701da870fb90a5888fb38c508bf33ba2d233b732
e9040fbeef41cd2e308f112e534200bcc152e946
refs/heads/master
2021-01-10T20:29:05.001646
2014-06-05T03:10:28
2014-06-05T03:10:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,134
java
package com.ifeng.Action; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; /** * 读取配置文件的例子 * @author zhangyj * */ public class test { public static void main(String[] args) { //System.out.println(System.getProperty("user.dir")); loadFile(); } private static void loadFile() { String filePath = System.getProperty("user.dir")+"/conf/shield.properties"; BufferedReader bufr = null; String line = null; try { bufr = new BufferedReader(new FileReader(filePath)); while((line=bufr.readLine())!= null){ parceLine(line); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }finally{ try{ if(bufr != null){ bufr.close(); } }catch(IOException e){ e.printStackTrace(); } } } private static void parceLine(String line) { String str = line; String tmp = str.trim(); if(tmp.startsWith("#") || tmp.isEmpty()) { return; } String[] value = tmp.split("=", 2); System.out.println(value[0]+"="+value[1]); } }
[ "zhang1830@gmail.com" ]
zhang1830@gmail.com
6c81faf57612d94d1a3979450d354db61ae0424f
f4cd4319723d6d24321adc2786bd9acac6c5695c
/app/src/main/java/com/tencent/qcloud/xiaozhibo/mainui/TCMainActivity.java
3afdc0350b91df9012b6e1e6855dffc43170d4b9
[]
no_license
liuxiaofeng8888/XiaoZhiBo1
9c60fe6453d88341c37369fdd3db1cbce574f6ff
8142599f319b4eec122bd1c14f8f13450ce7febe
refs/heads/master
2020-05-25T22:40:50.190984
2019-05-22T10:43:58
2019-05-22T10:43:58
188,018,309
0
1
null
null
null
null
UTF-8
Java
false
false
7,576
java
package com.tencent.qcloud.xiaozhibo.mainui; import android.Manifest; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.PackageManager; import android.os.Build; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentTabHost; import android.support.v4.content.LocalBroadcastManager; import android.text.TextUtils; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.widget.ImageView; import android.widget.TabHost; import com.tencent.liteav.demo.lvb.liveroom.IMLVBLiveRoomListener; import com.tencent.liteav.demo.lvb.liveroom.MLVBLiveRoom; import com.tencent.liteav.demo.lvb.liveroom.roomutil.commondef.AnchorInfo; import com.tencent.liteav.demo.lvb.liveroom.roomutil.commondef.AudienceInfo; import com.tencent.liteav.demo.lvb.liveroom.roomutil.commondef.MLVBCommonDef; import com.tencent.qcloud.xiaozhibo.R; import com.tencent.qcloud.xiaozhibo.common.utils.TCConstants; import com.tencent.qcloud.xiaozhibo.common.utils.TCUtils; import com.tencent.qcloud.xiaozhibo.login.TCUserMgr; import com.tencent.qcloud.xiaozhibo.mainui.list.TCLiveListFragment; import com.tencent.qcloud.xiaozhibo.push.TCPublishSettingActivity; import com.tencent.qcloud.xiaozhibo.userinfo.TCUserInfoFragment; /** * 主界面,包括直播列表,用户信息页 * UI使用FragmentTabHost+Fragment * 直播列表:TCLiveListFragment * 个人信息页:TCUserInfoFragment */ public class TCMainActivity extends FragmentActivity { private static final String TAG = TCMainActivity.class.getSimpleName(); //被踢下线广播监听 private LocalBroadcastManager mLocalBroadcatManager; private BroadcastReceiver mExitBroadcastReceiver; private FragmentTabHost mTabHost; private LayoutInflater mLayoutInflater; private final Class mFragmentArray[] = {TCLiveListFragment.class, TCLiveListFragment.class, TCUserInfoFragment.class}; private int mImageViewArray[] = {R.drawable.tab_video, R.drawable.play_click, R.drawable.tab_user}; private String mTextviewArray[] = {"video", "publish", "user"}; private long mLastClickPubTS = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mTabHost = (FragmentTabHost) findViewById(android.R.id.tabhost); mLayoutInflater = LayoutInflater.from(this); mTabHost.setup(this, getSupportFragmentManager(), R.id.contentPanel); int fragmentCount = mFragmentArray.length; for (int i = 0; i < fragmentCount; i++) { TabHost.TabSpec tabSpec = mTabHost.newTabSpec(mTextviewArray[i]).setIndicator(getTabItemView(i)); mTabHost.addTab(tabSpec, mFragmentArray[i], null); mTabHost.getTabWidget().setDividerDrawable(null); } mTabHost.getTabWidget().getChildTabViewAt(1).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (System.currentTimeMillis() - mLastClickPubTS > 1000) { mLastClickPubTS = System.currentTimeMillis(); startActivity(new Intent(TCMainActivity.this, TCPublishSettingActivity.class)); } } }); mLocalBroadcatManager = LocalBroadcastManager.getInstance(this); mExitBroadcastReceiver = new ExitBroadcastRecevier(); mLocalBroadcatManager.registerReceiver(mExitBroadcastReceiver, new IntentFilter(TCConstants.EXIT_APP)); Log.w("TCLog","mainactivity oncreate"); if (Build.VERSION.SDK_INT >= 23) { int REQUEST_CODE_CONTACT = 101; String[] permissions = {Manifest.permission.WRITE_EXTERNAL_STORAGE}; //验证是否许可权限 for (String str : permissions) { if (this.checkSelfPermission(str) != PackageManager.PERMISSION_GRANTED) { //申请权限 this.requestPermissions(permissions, REQUEST_CODE_CONTACT); return; } } } } @Override protected void onResume() { super.onResume(); // 监听相同账号是被重复登录 MLVBLiveRoom.sharedInstance(this).setListener(new IMLVBLiveRoomListener() { @Override public void onError(int errCode, String errMsg, Bundle extraInfo) { if (errCode == MLVBCommonDef.LiveRoomErrorCode.ERROR_IM_FORCE_OFFLINE) { onReceiveExitMsg(); } } @Override public void onWarning(int warningCode, String warningMsg, Bundle extraInfo) { } @Override public void onDebugLog(String log) { } @Override public void onRoomDestroy(String roomID) { } @Override public void onAnchorEnter(AnchorInfo anchorInfo) { } @Override public void onAnchorExit(AnchorInfo anchorInfo) { } @Override public void onAudienceEnter(AudienceInfo audienceInfo) { } @Override public void onAudienceExit(AudienceInfo audienceInfo) { } @Override public void onRequestJoinAnchor(AnchorInfo anchorInfo, String reason) { } @Override public void onKickoutJoinAnchor() { } @Override public void onRequestRoomPK(AnchorInfo anchorInfo) { } @Override public void onQuitRoomPK(AnchorInfo anchorInfo) { } @Override public void onRecvRoomTextMsg(String roomID, String userID, String userName, String userAvatar, String message) { } @Override public void onRecvRoomCustomMsg(String roomID, String userID, String userName, String userAvatar, String cmd, String message) { } }); } @Override protected void onStart() { super.onStart(); if (TextUtils.isEmpty(TCUserMgr.getInstance().getUserToken())) { if (TCUtils.isNetworkAvailable(this) && TCUserMgr.getInstance().hasUser()) { TCUserMgr.getInstance().autoLogin(null); } } } @Override protected void onDestroy() { super.onDestroy(); mLocalBroadcatManager.unregisterReceiver(mExitBroadcastReceiver); } public class ExitBroadcastRecevier extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(TCConstants.EXIT_APP)) { onReceiveExitMsg(); } } } public void onReceiveExitMsg() { TCUtils.showKickOut(this); } /** * 动态获取tabicon * @param index tab index * @return */ private View getTabItemView(int index) { View view; if (index % 2 == 0) { view = mLayoutInflater.inflate(R.layout.tab_button1, null); } else { view = mLayoutInflater.inflate(R.layout.tab_button, null); } ImageView icon = (ImageView) view.findViewById(R.id.tab_icon); icon.setImageResource(mImageViewArray[index]); return view; } }
[ "liuxiaofeng@zhuangdianwenhua.com" ]
liuxiaofeng@zhuangdianwenhua.com
0678fa2b990e7d270ce85ae4cfdfb7a05549780e
61a8385ac48292e30e34c6fdcdffbe0f0ff28850
/app/src/main/java/com/example/neartab/NearToDTO.java
11fcde5ca606de65b4e2fdff70cf5e9a512c68f6
[]
no_license
MheeJ/TWIPEE_NearTab
4c62785f9378cdc9cca4f9b1302d80e4eebe6434
62af186fb9e25bdf1fa6eaa12aa0e82d502bdf29
refs/heads/master
2022-04-25T09:25:45.094885
2020-04-24T03:21:47
2020-04-24T03:21:47
258,392,977
0
0
null
null
null
null
UTF-8
Java
false
false
1,039
java
package com.example.neartab; import android.graphics.Bitmap; public class NearToDTO { private Bitmap resld_tourist; private String nearposition; private String nearposition_detail; private String distance; public Bitmap getResld_tourist() { return resld_tourist; } public void setResld_tourist(Bitmap resld_tourist) { this.resld_tourist = resld_tourist; } public String getNearposition() { return nearposition; } public void setNearposition(String nearposition) { this.nearposition = nearposition; } public String getNearposition_detail() { return nearposition_detail; } public void setNearposition_detail(String nearposition_detail) { this.nearposition_detail = nearposition_detail; } public String getDistance() { return distance; } public void setDistance(String distance) { float dist = Float.parseFloat(distance); dist = dist / 1000; this.distance = Float.toString(dist) + "km"; } }
[ "unimini27@naver.com" ]
unimini27@naver.com
9ea0aab90651f4e97a717c849b86c8ba35cc8444
00588f10bb3b249499c921b03d3b51a26e585526
/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/material/WxOpenMaterialVideoInfoResult.java
8f4f95fa1a1e76ef6bb735b753f63f06c714d636
[ "Apache-2.0" ]
permissive
liuhuan543539666/WeiXinDev
2923fe73e759c6d2801513b7c8a3d2705672da98
50b8155385feba9ebac71d20a2d34852c0c07c91
refs/heads/master
2020-04-10T15:50:09.502732
2020-03-21T13:28:21
2020-03-21T13:28:21
161,124,794
0
1
null
null
null
null
UTF-8
Java
false
false
1,230
java
package me.chanjar.weixin.open.bean.material; import me.chanjar.weixin.open.util.json.WxOpenGsonBuilder; import java.io.Serializable; public class WxOpenMaterialVideoInfoResult implements Serializable { /** * */ private static final long serialVersionUID = 1269131745333792202L; private String title; private String description; private String downUrl; public static WxOpenMaterialVideoInfoResult fromJson(String json) { return WxOpenGsonBuilder.create().fromJson(json, WxOpenMaterialVideoInfoResult.class); } public String getTitle() { return this.title; } public void setTitle(String title) { this.title = title; } public String getDescription() { return this.description; } public void setDescription(String description) { this.description = description; } public String getDownUrl() { return this.downUrl; } public void setDownUrl(String downUrl) { this.downUrl = downUrl; } @Override public String toString() { return "WxOpenMaterialVideoInfoResult [title=" + this.title + ", description=" + this.description + ", downUrl=" + this.downUrl + "]"; } }
[ "543539666@qq.com" ]
543539666@qq.com
8f098e04be1ff386ece31d9d7a31a5a66eb15ef1
b8ecef4625db7324a76117317aca757259337fcf
/Come342/src/Model/Grade.java
208e78a507ae2c8d653435c9c7b87ac040d7b239
[]
no_license
testcome342/come342ProjectGroup24
1456cace61b96cec13d1317f2e80c1c21a854fd3
9fa62c79f33728402fc8418cad4e6fea60091f51
refs/heads/master
2020-03-12T23:10:29.257232
2018-05-02T08:44:00
2018-05-02T08:44:00
130,860,765
0
0
null
null
null
null
UTF-8
Java
false
false
40
java
package Model; public class Grade { }
[ "ilkaysever92@gmail.com" ]
ilkaysever92@gmail.com
4cb7545f3b618f092ca340c7005348947739aa7a
07f661550199c25a74319bdb0e2452844af5612a
/智品惠/src/main/java/com/zph/commerce/crash/CrashLogUtil.java
0aeade3b8ab32ff0fd5569514c5d51e76a1a1ede
[]
no_license
yekai0115/ZhiPinHui
3e141314f7d6538f0be4ffcddcee38908d8bb482
ff5cce36d68d3b727b40597b895e85dc8c63b803
refs/heads/master
2021-09-01T05:43:51.773806
2017-12-25T05:57:03
2017-12-25T05:57:03
107,392,266
0
0
null
null
null
null
UTF-8
Java
false
false
2,144
java
package com.zph.commerce.crash; import java.io.BufferedWriter; import java.io.Closeable; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; public class CrashLogUtil { private static final SimpleDateFormat timeFormat = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss", Locale.getDefault()); /** * 将日志写入文件。 * * @param tag * @param message * @param tr */ public static synchronized void writeLog(File logFile, String tag, String message, Throwable tr) { if (!logFile.exists()) { logFile.mkdirs(); } String time = timeFormat.format(Calendar.getInstance().getTime()); synchronized (logFile) { FileWriter fileWriter = null; BufferedWriter bufdWriter = null; PrintWriter printWriter = null; try { String fileName = "crash-" + time + ".txt"; File file=new File(logFile.getAbsolutePath()+ File.separator+fileName); if(!file.exists()){ file.createNewFile(); } fileWriter = new FileWriter(file, true); bufdWriter = new BufferedWriter(fileWriter); printWriter = new PrintWriter(fileWriter); bufdWriter.append(time).append(" ").append("E").append('/').append(tag).append(" ") .append(message).append('\n'); bufdWriter.flush(); tr.printStackTrace(printWriter); printWriter.flush(); fileWriter.flush(); } catch (IOException e) { closeQuietly(fileWriter); closeQuietly(bufdWriter); closeQuietly(printWriter); } } } public static void closeQuietly(Closeable closeable) { if (closeable != null) { try { closeable.close(); } catch (IOException ioe) { // ignore } } } }
[ "244489565@qq.com" ]
244489565@qq.com
682779aafbf9d200e61b664010beb01a05640d8c
6ad53f3975e736658716ffa3c567097fbac83bc7
/src/main/java/com/demo/atguigu/TestForkJoinPool.java
4a73f1d2578463acbef4b794aa195bb96520c3d2
[ "MIT" ]
permissive
ZhangJin1988/juc
c07c38e2a4beb3d3df1c3af246ea52d327ae1197
b2998a239ec77922d2daaad580cd0be49b4b8014
refs/heads/master
2021-01-21T21:00:48.525437
2018-05-02T10:09:03
2018-05-02T10:09:03
92,299,227
4
0
null
null
null
null
UTF-8
Java
false
false
2,260
java
package com.demo.atguigu; import java.time.Duration; import java.time.Instant; import java.util.concurrent.ForkJoinPool; import java.util.concurrent.ForkJoinTask; import java.util.concurrent.RecursiveTask; import java.util.stream.LongStream; import org.junit.Test; public class TestForkJoinPool { public static void main(String[] args) { Instant start = Instant.now(); ForkJoinPool pool = new ForkJoinPool(); ForkJoinTask<Long> task = new ForkJoinSumCalculate(0L, 50000000000L); Long sum = pool.invoke(task); System.out.println(sum); Instant end = Instant.now(); System.out.println("耗费时间为:" + Duration.between(start, end).toMillis());//166-1996-10590 } @Test public void test1(){ Instant start = Instant.now(); long sum = 0L; for (long i = 0L; i <= 50000000000L; i++) { sum += i; } System.out.println(sum); Instant end = Instant.now(); System.out.println("耗费时间为:" + Duration.between(start, end).toMillis());//35-3142-15704 } //java8 新特性 @Test public void test2(){ Instant start = Instant.now(); Long sum = LongStream.rangeClosed(0L, 50000000000L) .parallel() .reduce(0L, Long::sum); System.out.println(sum); Instant end = Instant.now(); System.out.println("耗费时间为:" + Duration.between(start, end).toMillis());//1536-8118 } } class ForkJoinSumCalculate extends RecursiveTask<Long>{ /** * */ private static final long serialVersionUID = -259195479995561737L; private long start; private long end; private static final long THURSHOLD = 10000L; //临界值 public ForkJoinSumCalculate(long start, long end) { this.start = start; this.end = end; } @Override protected Long compute() { long length = end - start; if(length <= THURSHOLD){ long sum = 0L; for (long i = start; i <= end; i++) { sum += i; } return sum; }else{ long middle = (start + end) / 2; ForkJoinSumCalculate left = new ForkJoinSumCalculate(start, middle); left.fork(); //进行拆分,同时压入线程队列 ForkJoinSumCalculate right = new ForkJoinSumCalculate(middle+1, end); right.fork(); // return left.join() + right.join(); } } }
[ "315552364@qq.com" ]
315552364@qq.com
778793607e3d8f007048a3607d5a2b4a01192b01
3d67cec5a314849d9ed5a3b203a6c8b61b229919
/prog8_leaderElection/src/Message.java
abeb52b9d4cad210da7535535328c74e9e5288a3
[]
no_license
anusha-vij-6062/CS249-DistributedSystems
94a7ea5ed05c19b9f464bd6672f01fc1e9d38d7d
3cae90018923249b70e4fdfa3ff9085c501628b5
refs/heads/master
2021-10-10T13:04:15.610313
2019-01-11T07:51:27
2019-01-11T07:51:27
104,839,916
0
0
null
null
null
null
UTF-8
Java
false
false
1,261
java
/** * Leader Election in Asyn Ring O(n^2) Algorithm * CS 249 Team #2 Rashmeet Khanuja, Anusha Vijay, Steven Yen */ public class Message { private MessageType messageType; private Integer idNumber; //identifier private Integer phase; //the k value private Integer distance; //the hop/distance /** * Constructor for message * @param t type of the message IDENTIFIER/TERMINATE * @param idNum identifier of sender proc when used with IDENTIFIER message, * identifier of the leader proc when used with TERMINATE message */ public Message(MessageType t, Integer idNum, Integer k, Integer d){ messageType = t; idNumber = idNum; phase = k; distance = d; } public Message(MessageType t, Integer idNum){ messageType = t; idNumber = idNum; } public Message(MessageType t){ messageType = t; } public MessageType getMessageType(){ return messageType; } public Integer getIdNumber(){ return idNumber; } public Integer getPhase() { return phase; } public Integer getDistance() { return distance; } }
[ "anusha.vijay@sjsu.edu" ]
anusha.vijay@sjsu.edu
e37224f7df8593b837c05a7a281536aa185ca0f6
dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9
/data_defect4j/preprossed_method_corpus/Lang/65/org/apache/commons/lang/builder/ToStringBuilder_append_280.java
efe21c5f5f555d51f9aea599690c12c7bf67f333
[]
no_license
hvdthong/NetML
dca6cf4d34c5799b400d718e0a6cd2e0b167297d
9bb103da21327912e5a29cbf9be9ff4d058731a5
refs/heads/master
2021-06-30T15:03:52.618255
2020-10-07T01:58:48
2020-10-07T01:58:48
150,383,588
1
1
null
2018-09-26T07:08:45
2018-09-26T07:08:44
null
UTF-8
Java
false
false
2,457
java
org apach common lang builder assist implement link object string tostr method enabl good consist code string tostr code built object aim simplifi process allow field name handl type consist handl null consist output arrai multi dimension arrai enabl detail level control object collect handl hierarchi write code pre person string ag smoker string string tostr string builder tostringbuild append append ag ag append smoker smoker string tostr pre produc string tostr format code person 7f54 stephen ag smoker code add superclass code string tostr code link append super appendsup append code string tostr code object deleg object link append string appendtostr altern method reflect determin field test field method code reflect string reflectiontostr code code access object accessibleobject set access setaccess code chang visibl field fail secur manag permiss set correctli slower test explicitli typic invoc method pre string string tostr string builder tostringbuild reflect string reflectiontostr pre builder debug 3rd parti object pre system println object string builder tostringbuild reflect string reflectiontostr object anobject pre exact format code string tostr code determin link string style tostringstyl pass constructor author stephen colebourn author gari gregori author pete gieser version string builder tostringbuild append code string tostr code code code param add code string tostr code string builder tostringbuild append style append buffer
[ "hvdthong@gmail.com" ]
hvdthong@gmail.com
bba0f531299cbb6b954136d732676333aada7df3
c60765ac982d7acd115df58423772566a43503b1
/api/src/main/java/org/apache/sling/validation/api/exceptions/NonExistingTypeException.java
07fee662a99ab30e3f3d88d60ecae291b633b56c
[ "Apache-2.0" ]
permissive
teamwar/org.apache.sling.validation
ea8d2cac4fa7bc6923a59d3bd5271b4a16b888fa
9b08124668d6896e67408d0b257bebe43ee4d423
refs/heads/master
2021-01-21T08:44:15.026318
2014-09-23T08:14:39
2014-09-23T08:14:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
340
java
package org.apache.sling.validation.api.exceptions; import org.apache.sling.validation.api.Type; /** * {@link RuntimeException} indicating the usage of a non-defined {@link Type}. */ public class NonExistingTypeException extends RuntimeException { public NonExistingTypeException(String message) { super(message); } }
[ "radu@apache.org" ]
radu@apache.org
b8535af303ebccc1350c0bea21a1f617c946e612
05dc7a60290d6e44aa042c935ba816e2fb46280c
/part10-Part10_11.WageOrder/src/main/java/Human.java
117d29fa4d8aaea7c80ff93186eedf6b8221cce9
[]
no_license
jpalojarvi/mooc-java-programming-ii
826d88f33c27ac612d4703612585f923c0da7fe7
d2c38830b2e7d915ad1bb7ea87b81d8a01b7d119
refs/heads/main
2023-05-26T18:17:45.855375
2021-06-13T11:09:09
2021-06-13T11:09:09
359,821,879
0
0
null
2021-04-22T10:56:08
2021-04-20T13:15:50
Java
UTF-8
Java
false
false
503
java
public class Human implements Comparable<Human>{ private int wage; private String name; public Human(String name, int wage) { this.name = name; this.wage = wage; } public String getName() { return name; } public int getWage() { return wage; } @Override public String toString() { return name + " " + wage; } @Override public int compareTo(Human o) { return o.getWage() - this.getWage(); } }
[ "johannes.palojarvi@gmail.com" ]
johannes.palojarvi@gmail.com
8aced54e570eb9543dd15dec40cfee988f5520ef
0b59266f7848814fd077b44774e99448f54394c2
/src/test/java/com/steven/SpringbootSwaggerApplicationTests.java
8870abba500c5b04e38d122b4d26cd4b0717c14f
[]
no_license
StevenGeek/swagger
76ccd8535c75c01da4cc910a83b265db447f4f5e
008d4b722c3c61cc7e2bae6ce6532c70eefaf5e6
refs/heads/master
2021-01-22T23:53:35.910710
2017-03-21T08:50:25
2017-03-21T08:50:25
85,677,350
0
0
null
null
null
null
UTF-8
Java
false
false
338
java
package com.steven; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class SpringbootSwaggerApplicationTests { @Test public void contextLoads() { } }
[ "stevengeek@163.com" ]
stevengeek@163.com
b3b81538b806f39973d4ad5d14f3eb693403ee4a
c292732e52fc0122fd5d19af895b91fe94c1c0b5
/homework2/src/main/java/ru/yakimov/runner/QuizJustDisplay.java
a88d16fe4195bfb2632656542ac95fa59ce09755
[]
no_license
bukazoid/2020-11-otus-spring-yakimov
24d9c62ce1a647ba8c66faece8a689eab9d48ac3
8f6c8977c29abf2b533e7888f663f34a791728c6
refs/heads/main
2023-08-14T23:08:22.963405
2021-09-27T08:46:01
2021-09-27T08:46:01
315,846,796
0
1
null
2021-09-27T08:46:02
2020-11-25T06:17:42
JavaScript
UTF-8
Java
false
false
1,135
java
package ru.yakimov.runner; import java.util.List; import lombok.AllArgsConstructor; import ru.yakimov.domain.QuizQuestion; import ru.yakimov.services.QuestionProcessor; import ru.yakimov.services.QuizReader; import ru.yakimov.services.UserIO; import ru.yakimov.services.WelcomeMessageService; @AllArgsConstructor public class QuizJustDisplay implements Quiz { final private QuizReader quizReader; final private UserIO userIO; final private QuestionProcessor processor; final private WelcomeMessageService welcome; @Override public void proceedQuiz() { welcome.sayHello(); // say hello userIO.printLine("Hello, student! let's see our questions"); userIO.printLine(); List<QuizQuestion> questions = quizReader.readQuestions(); userIO.printLine("we have %s questions", questions.size()); for (QuizQuestion question : questions) { if (question.isFreeAnswer()) { processor.displayFreeAnswerQuestion(question); } else { processor.displayQuestionWithOptionsAndReturnCorrectOne(question); } userIO.printLine(); } userIO.printLine("done"); } }
[ "pavelpyakimov@gmail.com" ]
pavelpyakimov@gmail.com
d4fe69016385178f4bf6683c0d1a3ca04732b80e
9c61379e86a7d027f7586df8e23b9808e14f3efd
/test2-server/test2-server-web/src/main/java/com/tww/rocketmq/config/ExecutorConfig.java
9abf977f236beb7cd905d0e0ec09064a502cb2db
[]
no_license
aa1678066774/springcloud
8206bfbf2f71bb4306551a3db5f59202524c2f7e
307deb90a7fe22f6b5c63726572f1c80201e781a
refs/heads/master
2022-07-01T20:32:50.448322
2020-08-06T07:41:28
2020-08-06T07:41:28
184,204,359
3
0
null
2022-06-29T18:17:46
2019-04-30T06:26:16
JavaScript
UTF-8
Java
false
false
1,444
java
package com.tww.rocketmq.config; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import java.util.concurrent.Executor; import java.util.concurrent.ThreadPoolExecutor; @Configuration @EnableAsync public class ExecutorConfig { private static final Logger logger = LoggerFactory.getLogger(ExecutorConfig.class); @Bean public Executor asyncServiceExecutor() { logger.info("start asyncServiceExecutor"); ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); //配置核心线程数 executor.setCorePoolSize(10); //配置最大线程数 executor.setMaxPoolSize(10); //配置队列大小 executor.setQueueCapacity(99999); //配置线程池中的线程的名称前缀 executor.setThreadNamePrefix("async-service-"); // rejection-policy:当pool已经达到max size的时候,如何处理新任务 // CALLER_RUNS:不在新线程中执行任务,而是有调用者所在的线程来执行 executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); //执行初始化 executor.initialize(); return executor; } }
[ "weiweitang@shangshibang.com" ]
weiweitang@shangshibang.com
d54256b4a2f1b7bf6faf94fd59185916472f8465
14273c29a81a43d908e0b2c82ef43c1a9941e923
/app/src/main/java/com/asum/xlistview/listview/decoration/SpaceItemDecoration.java
287d6826a179aaf6b83087c7abacd54c7a0348fe
[]
no_license
asum0007/XListView
45a179e72f1fb1f3415d82d5cb3b52c6a3e456d2
baaba5300f304000cb592bc65e05495e9a688be7
refs/heads/master
2021-01-01T05:22:29.961039
2017-06-08T10:52:38
2017-06-08T10:52:38
56,592,578
0
0
null
null
null
null
UTF-8
Java
false
false
7,139
java
package com.asum.xlistview.listview.decoration; import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.support.v4.content.ContextCompat; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.View; import com.asum.xlistview.listview.item.XBaseRecyclerFooterView; import com.asum.xlistview.listview.item.XBaseRecyclerHeaderView; import com.asum.xlistview.listview.item.XBaseRecyclerViewItem; /** * @Author XJW * @CreateTime 2016/10/13 */ public class SpaceItemDecoration extends RecyclerView.ItemDecoration { public enum Type { COLOR, RESOURCE_ID; } private Paint paint; private Drawable divider; private int dividerHeight = 2; private int orientation;//列表的方向:LinearLayoutManager.VERTICAL或LinearLayoutManager.HORIZONTAL private boolean hideLastOne; private boolean haveHeader, haveFooter; private static final int[] ATTRS = new int[]{android.R.attr.listDivider}; /** * 2px高度的透明分割线 * * @param context * @param orientation 列表方向 */ public SpaceItemDecoration(Context context, int orientation) { if (orientation != LinearLayoutManager.VERTICAL && orientation != LinearLayoutManager.HORIZONTAL) { this.orientation = LinearLayoutManager.VERTICAL; } else { this.orientation = orientation; } } /** * 2px高度使用资源ID的分隔线 * * @param context * @param orientation 列表方向 * @param drawableId 分割线图片 */ public SpaceItemDecoration(Context context, int orientation, int drawableId) { this(context, orientation); divider = ContextCompat.getDrawable(context, drawableId); dividerHeight = divider.getIntrinsicHeight(); } /** * 自定义高度和颜色(资源ID)的分隔线 * * @param context * @param orientation 列表方向 * @param dividerHeight 分割线高度 * @param resId 资源 */ public SpaceItemDecoration(Context context, int orientation, int dividerHeight, int resId, Type type) { this(context, orientation); this.dividerHeight = dividerHeight; if (type.equals(Type.COLOR)) { paint = new Paint(Paint.ANTI_ALIAS_FLAG); paint.setStyle(Paint.Style.FILL); paint.setColor(resId); } else { divider = ContextCompat.getDrawable(context, resId); } } /** * 最后一条是否添加间距 * * @param showBottom */ public void setBottomEnable(boolean showBottom) { this.hideLastOne = showBottom; } public void setHaveHeader(boolean haveHeader) { this.haveHeader = haveHeader; } public void setHaveFooter(boolean haveFooter) { this.haveFooter = haveFooter; } //获取分割线尺寸 public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { super.getItemOffsets(outRect, view, parent, state); final int allCount = state.getItemCount(); if (view instanceof XBaseRecyclerHeaderView && haveHeader) { outRect.set(0, 0, 0, 0); } else if (view instanceof XBaseRecyclerFooterView && haveFooter) { outRect.set(0, 0, 0, 0); } else { int itemId = ((XBaseRecyclerViewItem) view).getRecyclerId(); if (haveHeader && itemId == allCount - 2 - (haveFooter ? 1 : 0) && !hideLastOne) { outRect.set(0, 0, 0, 0); } else if (!haveHeader && itemId == allCount - 1 && !hideLastOne) { outRect.set(0, 0, 0, 0); } else { outRect.set(0, 0, 0, dividerHeight); } } } //绘制分割线 public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) { super.onDraw(c, parent, state); final int childSize = parent.getChildCount(); final boolean lastViewIsOther, firstViewIsOther; if (childSize > 0) { final View lastView = parent.getChildAt(childSize - 1); final View firstView = parent.getChildAt(0); if (lastView instanceof XBaseRecyclerViewItem) { lastViewIsOther = false; } else { lastViewIsOther = true; } if (firstView instanceof XBaseRecyclerViewItem) { firstViewIsOther = false; } else { firstViewIsOther = true; } } else { lastViewIsOther = false; firstViewIsOther = false; } if (orientation == LinearLayoutManager.VERTICAL) { drawHorizontal(c, parent, childSize, lastViewIsOther, firstViewIsOther); } else { drawVertical(c, parent, childSize, lastViewIsOther); } } //绘制横向 item 分割线 private void drawHorizontal(Canvas canvas, RecyclerView parent, int childSize, boolean lastViewIsOther, boolean firstViewIsOther) { final int left = parent.getPaddingLeft(); final int right = parent.getMeasuredWidth() - parent.getPaddingRight(); for (int i = 0; i < childSize; i++) { final View child = parent.getChildAt(i); final RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) child.getLayoutParams(); final int top = child.getBottom() + layoutParams.bottomMargin; final int bottom; if ((firstViewIsOther && i == 0) || (lastViewIsOther && !hideLastOne && i == childSize - 2 - (firstViewIsOther ? 1 : 0))) { bottom = top; } else { bottom = top + dividerHeight; } if (divider != null) { // divider.setBounds(left, top, right, bottom); // divider.draw(canvas); } if (paint != null) { canvas.drawRect(left, top, right, bottom, paint); } } } //绘制纵向 item 分割线 private void drawVertical(Canvas canvas, RecyclerView parent, int childSize, boolean lastViewIsOther) { final int top = parent.getPaddingTop(); final int bottom = parent.getMeasuredHeight() - parent.getPaddingBottom(); for (int i = 0; i < childSize; i++) { final View child = parent.getChildAt(i); final RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) child.getLayoutParams(); final int left = child.getRight() + layoutParams.rightMargin; final int right = left + dividerHeight; if (divider != null) { divider.setBounds(left, top, right, bottom); divider.draw(canvas); } if (paint != null) { canvas.drawRect(left, top, right, bottom, paint); } } } }
[ "xiejunwen@quickplain.com" ]
xiejunwen@quickplain.com
2ebe6ea663bcbe0353b1de4d49b85e3db239ae71
e60fd4d1f0d72f9411f46a49df575d851f7ee087
/Runable1.java
ea1cd7b6ab2a6b2728d23e93445f846089d8e059
[]
no_license
leigelaing/JAVA
955818402b005d5b31b8c6b26e0877dd07a98934
db0de486f7d3be63717b143bbd8ea807918798bd
refs/heads/master
2023-05-11T11:24:01.441101
2021-05-31T23:33:22
2021-05-31T23:33:22
296,523,588
0
0
null
null
null
null
UTF-8
Java
false
false
940
java
package com.haha; /* 实现Runable接口创建多线程的好处: 1.避免了单继承的局限性 一个类只能继承一个类,类继承了Thread就不能继承其他类 实现了Runable接口,还可以继承其他的类,实现其他的接口。 2.增强了程序的扩展性,降低了程序的耦合性 实现Runable接口的方式,把设置线程任务和开启线程进行了分离 实现类中我们重写了Ruenable方法,用来设置线程任务 创建Thread类对象,调用Start方法:用来开启新的线程。 */ //1.创建一个Runable接口的实现类 public class Runable1 implements Runnable { // 2.在实现类中重写Runable接口的run方法,设置线程任务 public void run(){ for (int i = 0; i < 20; i++) { System.out.println(Thread.currentThread().getName() +"->"+i); } } }
[ "noreply@github.com" ]
noreply@github.com
edc58e1fe9eb6297022e284c077065de939068d1
eaa6bc2b39b0ee943efcbf6cd9f188575cbaca87
/src/main/java/com/bnsf/drools/poc/events/LocomotiveInventoryMissingInCacheEvent.java
a7445cc4c5c787da8268397151748da3a66f62de
[]
no_license
kanigicharla8/poc_gradle
79213d19fdb2d93c3779710b25d68790fb76e157
76fd20a8d4f27eae2c27696a5419a933c2b15069
refs/heads/master
2021-01-10T09:35:55.970743
2015-10-11T00:12:18
2015-10-11T00:12:18
44,033,117
0
0
null
null
null
null
UTF-8
Java
false
false
220
java
/** * */ package com.bnsf.drools.poc.events; /** * Represents LocomotiveInventory missing in the cache * * @author rakesh * */ public class LocomotiveInventoryMissingInCacheEvent extends AbstractBNSFEvent{ }
[ "kanigicharla.s@LP-3C970E26FDBC.HCLT.CORP.HCL.IN" ]
kanigicharla.s@LP-3C970E26FDBC.HCLT.CORP.HCL.IN
a036c4f0099b06dc134fc3bf3d0a6c5f37af08b1
27155dc0554a947ef912bf93d15e84a0d504f977
/src/main/src/com/founder/xy/api/AbstractArticleParser.java
da1ff6d8939e1299f60dec4376a72d07849b9bd5
[]
no_license
nolan124/xy6.0-xzw
75dee8c32e005c4bebffb05a0e1a22b8389cc430
86b702fa4517a153857fe8bfd3df8f907417b856
refs/heads/master
2023-03-17T11:41:18.327201
2019-03-13T05:01:17
2019-03-13T05:01:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,150
java
package com.founder.xy.api; import com.founder.e5.doc.Document; import com.founder.xy.commons.FilePathUtil; import org.jsoup.Jsoup; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import java.io.File; import java.io.IOException; import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.UUID; public abstract class AbstractArticleParser { public static final SimpleDateFormat format = new SimpleDateFormat("yyyyMM/dd"); protected final static String SmallTitlePic = "smalltitlepic"; protected final static String MiddleTitlePic = "middletitlepic"; protected final static String BigTitlePic = "bigtitlepic"; protected final static String VideoPic = "videopic"; public static byte[] JPG = {0x4a, 0x46, 0x49, 0x46}; public static byte[] GIF = {0x47, 0x49, 0x46}; public static byte[] PNG = {(byte)0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a}; private String storeBasePath;//翔宇图片存储 private String articleTime;//翔宇稿件顺序起点日期 enum AttType{ AttArticle, //文章 AttVideo, //视频 AttPic //组图 } class FileNamePair{ public String abstractPath; public String recordPath; public String storePath; FileNamePair(String abstractPath, String recordPath, String storePath){ this.abstractPath = abstractPath; this.recordPath = recordPath; this.storePath = storePath; } public String toString() { StringBuffer buf = new StringBuffer(); buf.append("{abstractPath: " + abstractPath + ", "); buf.append("recordPath: " + recordPath + ", "); buf.append("storePath: " + storePath + "}"); return buf.toString(); } } protected FileNamePair generateFilePath(String type){ return generateFilePath(type, false); } protected FileNamePair generateFilePath(String type, boolean isAttr){ String recordPath = "xy"; recordPath = FilePathUtil.normalPath(recordPath, format.format(new Date())); String uuid = UUID.randomUUID().toString(); recordPath = FilePathUtil.normalPath(recordPath, uuid + "." + type); String absPath = FilePathUtil.normalPath(storeBasePath, recordPath); FileNamePair fileNamePair = new FileNamePair(absPath, "图片存储;" + recordPath,"/" + recordPath); if(!isAttr){ return fileNamePair; } fileNamePair.recordPath = "../../xy/image.do?path=" + fileNamePair.recordPath; return fileNamePair; } protected String replaceAttPath(String content, AttType attType, String filePath, String recordPath){ org.jsoup.nodes.Document html = Jsoup.parse(content); Elements list = html.select("img"); if (list.isEmpty()) return content; for (Element img : list) { if(img.attr("src").contains("image.do?path=")) continue; img.replaceWith(Jsoup.parse("<img src=\"" + recordPath + "\">").select("img").get(0)); break; } return html.body().html(); } public String getImageType(byte[] data){ if(data != null && data.length > PNG.length){ boolean result = true; for(int t=0; t<PNG.length; ++t){ if(data[t]!=PNG[t]){ result = false; break; } } if(result){ return "png"; } } if(data != null && data.length > 10){ int offset = 6; boolean result = true; for(int t=0; t<JPG.length; ++t){ if(data[t+offset]!=JPG[t]){ result = false; break; } } if(result){ return "jpg"; } } if(data != null && data.length > 3){ boolean result = true; for(int t=0; t<GIF.length; ++t){ if(data[t]!=GIF[t]){ result = false; break; } } if(result){ return "gif"; } } return "jpg"; } protected String getImageType(String fileName){ int index = fileName.lastIndexOf("."); if(index > 0){ return fileName.substring(index + 1,index + 4); }else{ return "jpg"; } } /** * 计算稿件排序字段值 */ // public double getNewOrder(long articleID, String artPubTime) { public double getNewOrder(Document article) { Timestamp pubTime = article.getTimestamp("a_pubTime"); // Timestamp pubTime = Timestamp.valueOf(artPubTime); if (pubTime == null) return 0; Calendar ca = Calendar.getInstance(); ca.setTime(pubTime); double order = createDisplayOrder(ca, 0, 0, article.getDocID()); // double order = createDisplayOrder(ca, 0, 0, articleID); return order; } public double createDisplayOrder(Calendar cd, int daycnt, int ord, long id) { if (cd == null) cd = Calendar.getInstance(); int nHour = cd.get(Calendar.HOUR_OF_DAY); int nMinute = cd.get(Calendar.MINUTE); cd.set(Calendar.HOUR_OF_DAY, 0); cd.set(Calendar.MINUTE, 0); cd.set(Calendar.SECOND, 0); cd.set(Calendar.MILLISECOND, 0); Calendar dd = Calendar.getInstance(); if(articleTime.trim().equals("")||articleTime==null){ dd.set(2015, 4, 13, 0, 0, 0); //新起点~ //dd.set(2000, 9, 12, 0, 0, 0); //dd.set(2000, 2, 12, 0, 0, 0); }else{ String[] atime = articleTime.trim().split("-"); dd.set(Integer.parseInt(atime[0]), Integer.parseInt(atime[1]), Integer.parseInt(atime[2]), 0, 0, 0); } dd.set(Calendar.HOUR_OF_DAY, 0); dd.set(Calendar.MINUTE, 0); dd.set(Calendar.SECOND, 0); dd.set(Calendar.MILLISECOND, 0); long tt = cd.getTimeInMillis() - dd.getTimeInMillis(); double ret = 0; /* 87654321.12345678: [------][0][00][0.0][000000] 万位以上是天数,千位的是优先级,百位和十位是小时数,个位和小数点后第一位是分钟,小数点后第二位开始连续6位是ID long days = (tt / 1000 * 60 * 60 * 24); //毫秒数转成天数 days += daycnt; //天数再加上置顶天数 ret = days * 10000 + priority * 1000 + hour * 10 + minutes * 0.1 + ID后六位放在小数点后第二位开始 */ ret = (long) ( (double) (tt) / 8640.0) + daycnt * 10000 + (double)ord * 1000 + (double)nHour*10.0 + (double)nMinute*0.1 + (double)(id % 1000000)*0.0000001; return ret * -1; } /** * 生成抽图文件信息 */ public void extractingImg(String attrPath){ int index = attrPath.indexOf(";"); if(index > -1){ String path = attrPath.substring(index + 1); path = path.replace("/", "~"); File infoDir = new File(FilePathUtil.normalPath(storeBasePath,"extracting")); if(!infoDir.exists()){ infoDir.mkdirs(); } File infoFile = new File(infoDir, path); if(!infoFile.exists()){ try { infoFile.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } } } public String getStoreBasePath() { return storeBasePath; } public void setStoreBasePath(String storeBasePath) { this.storeBasePath = storeBasePath; } public String getArticleTime() { return articleTime; } public void setArticleTime(String articleTime) { this.articleTime = articleTime; } }
[ "2491042435@qq.com" ]
2491042435@qq.com
fbb0c93076207c03e3218ea189b469ba3e4173a5
6f0f6f2beed4cd362ca65fe242dfb80daedfc1dc
/DesignPattern/src/practise/lios/models/Light.java
f7d5658ec61b9f42ee075aaf101b0f89fd4d2367
[ "MIT" ]
permissive
AiguangLi/JavaBasicStudy
fe678711b236dd71923101783f0e021ef76894e7
639490e70b5cd909d14550ec4a9f1aa1b7ee4998
refs/heads/master
2022-12-04T00:56:07.721120
2020-08-16T14:33:34
2020-08-16T14:33:34
257,915,888
0
0
null
null
null
null
UTF-8
Java
false
false
405
java
package practise.lios.models; /** * @author liaiguang */ public class Light { public void on() { System.out.println("Light is on!"); } public void off() { System.out.println("Light is off!"); } public void brighten() { System.out.println("Light is more bright!"); } public void dim() { System.out.println("Light is less bright!"); } }
[ "aiguang.li@qq.com" ]
aiguang.li@qq.com
1f1f690bd96d2f6f03d97fc8da9d6729f8238c91
0363f930e53dafbffb39580598e6c0d5ad8bac8b
/rpc-common/src/main/java/com/lzp/util/RegisterUtil.java
943ab99eeb51ebd81d51e212670e71fa55a24aae
[]
no_license
Eteon/zprpc
694e93a6d48d678e874158ca7744bc8a9c00ad90
e55f2763a7d22b5dd80ee00ba5f0a51a3927c4a0
refs/heads/master
2022-12-26T00:35:19.741268
2020-10-07T15:36:03
2020-10-07T15:36:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,100
java
package com.lzp.util; import com.alibaba.nacos.api.exception.NacosException; import com.alibaba.nacos.api.naming.NamingService; import com.alibaba.nacos.api.naming.pojo.Instance; import com.lzp.annotation.Service; import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Description:扫描指定包下所有类,获得所有被指定注解修饰的类,返回实例(如果项目用到了Spring,就到 * Spring容器中找,找不到才自己初始化一个),并注册到注册中心中 * 只会扫描依赖了这个项目的工程的classpath下的包,其classpath下面的jar包里的包是不会扫描的 * * @author: Lu ZePing * @date: 2020/9/30 11:14 */ public class RegisterUtil { /** * 扫描指定包下所有类,获得所有被com.lzp.com.lzp.annotation.@Service修饰的类,返回实例(如果项目用到了Spring,就到 * Spring容器中找,找不到才自己初始化一个),并注册到注册中心中 * * ______________________________________________ * | namespace | * | ———————————————————————————————————————— | * | | ____________ group____________________ | | * | || |------------service--------------| | | | * | || | |cluser | | cluster| | | | | * | || | |_______| |________| | | | | * | || |_________________________________| | | | * | ||_____________________________________| | | * | |_______________________________________ | | * ——————————————————————————————————————————————— * group和serviceid决定一个服务,一个service包含多个cluster,每个cluster * 里包含多个instance * @param basePack 要扫描的包 * @param namingService 注册中心 * @param ip 要注册进注册中心的实例(instance)ip * @param port 要注册进注册中心的实例(instance)port */ public static Map<String, Object> searchAndRegiInstance(String basePack, NamingService namingService,String ip,int port) throws ClassNotFoundException, InstantiationException, IllegalAccessException, NacosException { Map<String, Object> idServiceMap = new HashMap(); String classpath = RegisterUtil.class.getResource("/").getPath(); basePack = basePack.replace(".", File.separator); String searchPath = classpath + basePack; List<String> classPaths = new ArrayList<String>(); doPath(new File(searchPath), classPaths); for (String s : classPaths) { s = s.replace(classpath.replace("/", "\\").replaceFirst("\\\\", ""), "").replace("\\", ".").replace(".class", ""); Class cls = Class.forName(s); if (cls.isAnnotationPresent(Service.class)) { Service service = (Service) cls.getAnnotation(Service.class); Map<String, Object> nameInstanceMap = SpringUtil.getBeansOfType(cls); if (nameInstanceMap.size() != 0) { idServiceMap.put(service.id(), nameInstanceMap.entrySet().iterator().next().getValue()); } else { idServiceMap.put(service.id(), cls.newInstance()); } namingService.registerInstance(service.id(), ip, port); } } return idServiceMap; } /** * 该方法会得到所有的类,将类的绝对路径写入到容器中 * @param file */ private static void doPath(File file, List<String> classPaths) { if (file.isDirectory()) { File[] files = file.listFiles(); for (File f1 : files) { doPath(f1,classPaths); } } else { if (file.getName().endsWith(".class")) { classPaths.add(file.getPath()); } } } }
[ "382513254@qq.com" ]
382513254@qq.com
9710ac83e6db0323f198ecc860660fa45f8c58c0
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/27/27_fda298f051aa44244f7b48545b76b2af916ebcc4/SubstitutionOperation/27_fda298f051aa44244f7b48545b76b2af916ebcc4_SubstitutionOperation_s.java
0b62ba13c8b15e0cabc16d5d563c63a1918c950d
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
5,316
java
package net.sourceforge.vrapper.vim.commands; import java.util.regex.PatternSyntaxException; import net.sourceforge.vrapper.platform.SearchAndReplaceService; import net.sourceforge.vrapper.platform.TextContent; import net.sourceforge.vrapper.utils.ContentType; import net.sourceforge.vrapper.utils.LineInformation; import net.sourceforge.vrapper.utils.SubstitutionDefinition; import net.sourceforge.vrapper.utils.TextRange; import net.sourceforge.vrapper.vim.EditorAdaptor; import net.sourceforge.vrapper.vim.modes.ConfirmSubstitutionMode; /** * Perform a substitution on a range of lines. Can be current line, * all lines, or any range in between. * For example, :s/foo/blah/g or :%s/foo/blah/g or :2,5s/foo/blah/g */ public class SubstitutionOperation extends SimpleTextOperation { private String substitution; public SubstitutionOperation(String substitution) { this.substitution = substitution; } @Override public void execute(EditorAdaptor editorAdaptor, TextRange region, ContentType contentType) { TextContent model = editorAdaptor.getModelContent(); int startLine; int endLine; if(region == null) { //special case, recalculate 'current line' every time //(this is to ensure '.' always works on current line) int offset = editorAdaptor.getPosition().getModelOffset(); startLine = model.getLineInformationOfOffset(offset).getNumber(); endLine = startLine; } else { startLine = model.getLineInformationOfOffset( region.getLeftBound().getModelOffset() ).getNumber(); endLine = model.getLineInformationOfOffset( region.getRightBound().getModelOffset() ).getNumber(); if(model.getTextLength() == region.getRightBound().getModelOffset()) { //the endLine calculation is off-by-one for the last line in the file //force it to actually use the last line endLine = model.getNumberOfLines(); } } SubstitutionDefinition subDef; try { subDef = new SubstitutionDefinition(substitution, editorAdaptor.getRegisterManager().getRegister("/").getContent().getText()); } catch(PatternSyntaxException e) { editorAdaptor.getUserInterfaceService().setErrorMessage(e.getDescription()); return; } if(subDef.flags.indexOf('c') > -1) { //move into "confirm" mode editorAdaptor.changeModeSafely(ConfirmSubstitutionMode.NAME, new ConfirmSubstitutionMode.SubstitutionConfirm(subDef, startLine, endLine)); return; } int numReplaces = 0; int lineReplaceCount = 0; if(startLine == endLine) { LineInformation currentLine = model.getLineInformation(startLine); //begin and end compound change so a single 'u' undoes all replaces editorAdaptor.getHistory().beginCompoundChange(); numReplaces = performReplace(currentLine, subDef.find, subDef.replace, subDef.flags, editorAdaptor); editorAdaptor.getHistory().endCompoundChange(); } else { LineInformation line; int lineChanges = 0; int totalLines = model.getNumberOfLines(); int lineDiff; //perform search individually on each line in the range //(so :%s without 'g' flag runs once on each line) editorAdaptor.getHistory().beginCompoundChange(); for(int i=startLine; i < endLine; i++) { line = model.getLineInformation(i); lineChanges = performReplace(line, subDef.find, subDef.replace, subDef.flags, editorAdaptor); if(lineChanges > 0) { lineReplaceCount++; } numReplaces += lineChanges; lineDiff = model.getNumberOfLines() - totalLines; if(lineDiff > 0) { //lines were introduced as a result of this replacement //skip over those introduced lines and move on to the next intended line i += lineDiff; endLine += lineDiff; totalLines += lineDiff; } } editorAdaptor.getHistory().endCompoundChange(); } if(numReplaces == 0) { editorAdaptor.getUserInterfaceService().setErrorMessage("'"+subDef.find+"' not found"); } else if(lineReplaceCount > 0) { editorAdaptor.getUserInterfaceService().setInfoMessage( numReplaces + " substitutions on " + lineReplaceCount + " lines" ); } //enable '&', 'g&', and ':s' features editorAdaptor.getRegisterManager().setLastSubstitution(this); } private int performReplace(LineInformation line, String find, String replace, String flags, EditorAdaptor editorAdaptor) { //Eclipse regex doesn't handle '^' and '$' like Vim does. //Time for some special cases! if(find.equals("^")) { //insert the text at the beginning of the line editorAdaptor.getModelContent().replace(line.getBeginOffset(), 0, replace); return 1; } else if(find.equals("$")) { //insert the text at the end of the line editorAdaptor.getModelContent().replace(line.getEndOffset(), 0, replace); return 1; } else { //let Eclipse handle the regex SearchAndReplaceService searchAndReplace = editorAdaptor.getSearchAndReplaceService(); return searchAndReplace.replace(line, find, replace, flags); } } public TextOperation repetition() { return this; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
eef87bd8cf326e84148b00312a2d47d7a803cf3e
c4df65aad78427d821b520d80486997732a5349b
/src/test/java/com/dalingjia/spring/cyclicDependency/Appconfig.java
b123a9b25f17f5dce0fe0dc1fd06f7422a1d3218
[]
no_license
tanhuaqiang/mycode
810572fd77f42157f3bf5f4fc810543aa324d7b6
4f563787a26c2ca0f64869531370afe1111ed329
refs/heads/master
2023-08-15T11:36:48.380828
2022-07-07T11:58:44
2022-07-07T11:58:44
242,457,185
1
0
null
2023-07-23T06:31:57
2020-02-23T04:39:16
Java
UTF-8
Java
false
false
275
java
package com.dalingjia.spring.cyclicDependency; import org.springframework.beans.factory.annotation.Configurable; import org.springframework.context.annotation.ComponentScan; @Configurable @ComponentScan("com.dalingjia.spring.cyclicDependency") public class Appconfig { }
[ "tanhuaqiang@meituan.com" ]
tanhuaqiang@meituan.com
9df5113474aa72401e69be7c9266ad959ac4bcd6
0f2171e6c688c32ca762ec1a77368f1f16089e2b
/app/src/main/java/com/example/zeeshan/sqloperations/MainActivity.java
411be6bed2ec48812aa8418ef492b06f2b66617f
[]
no_license
mzeeshansikander/AndroidSqlLite_Crud
8304803be6d8e2076fee6fcc159256d2d8a06b43
58567c636314d31bb0663858a3b999f2585e6d79
refs/heads/master
2020-03-19T10:31:43.746049
2018-06-06T19:56:42
2018-06-06T19:56:42
136,379,561
0
0
null
null
null
null
UTF-8
Java
false
false
3,418
java
package com.example.zeeshan.sqloperations; import android.content.ContentValues; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteAbortException; import android.database.sqlite.SQLiteDatabase; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.ListView; import android.widget.Toast; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity { SQLiteDatabase db; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); db = openOrCreateDatabase("Graduates",MODE_PRIVATE,null); } public void addStudent(View view){ EditText roll_no = findViewById(R.id.et_rollNo); EditText name = findViewById(R.id.et_name); String sRoll_no = roll_no.getText().toString(); String sName = name.getText().toString(); String query = "CREATE TABLE IF NOT EXISTS STUDENTS(roll_number TEXT,name TEXT)"; db.execSQL(query); ContentValues content = new ContentValues(); content.put("roll_number",sRoll_no); content.put("name",sName); db.insert("STUDENTS",null,content); } public void searchStudent(View view){ EditText roll_no = findViewById(R.id.et_rollNo); String sRoll_no = roll_no.getText().toString(); EditText studentName = findViewById(R.id.et_name); String query = "Select * from STUDENTS WHERE roll_number = \'"+sRoll_no+"\';"; Log.e("TAG",query); Cursor cr = db.rawQuery(query,null); cr.moveToFirst(); do { String id = cr.getString(cr.getColumnIndex("roll_number")); String name = cr.getString(cr.getColumnIndex("name")); roll_no.setText(id); studentName.setText(name); } while (cr.moveToNext()); cr.close(); } public void clearStudent(View view){ ListView students_lv = findViewById(R.id.lv_students); EditText roll_no = findViewById(R.id.et_rollNo); EditText studentName = findViewById(R.id.et_name); roll_no.setText(""); studentName.setText(""); students_lv.setAdapter(null); } public void viewStudents(View view){ List<String> studentsList = new ArrayList<>(); ListView students_lv = findViewById(R.id.lv_students); String query = "SELECT * FROM STUDENTS"; Cursor cr = db.rawQuery(query,null); cr.moveToFirst(); do{ String name = cr.getString(cr.getColumnIndex("name")); studentsList.add(name); }while(cr.moveToNext()); ArrayAdapter adapter = new ArrayAdapter(MainActivity.this,android.R.layout.simple_list_item_1,studentsList); students_lv.setAdapter(adapter); } public void deleteStudent(View view){ EditText roll_no = findViewById(R.id.et_rollNo); String sRoll_no = roll_no.getText().toString(); String query = "DELETE FROM STUDENTS WHERE roll_number = \'"+sRoll_no+"\';"; Log.e("TAG",query); db.execSQL(query); } }
[ "zeeshan.sikander@live.com" ]
zeeshan.sikander@live.com
5fd5698ce2e16a1a92d9f1d8418add64cdfaa713
58f893aa303ed1a58d58b388c7ede4a62f244d39
/server/WebProject/src/main/java/com/afd/member/space/ClickList.java
2d058dc037a34696d88648c92860c3f9d7fc788b
[]
no_license
sioi35/backup
6e0a9da319cd2affd201b41beecb35a17e384a3d
dda370b54ad09310e71b6a862b7cac09c0fc9563
refs/heads/main
2023-07-18T14:25:40.726500
2021-09-07T10:27:36
2021-09-07T10:27:36
376,705,033
0
0
null
null
null
null
UTF-8
Java
false
false
693
java
package com.afd.member.space; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet("/main/member/space/clicklist.do") public class ClickList extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { RequestDispatcher dispatcher = req.getRequestDispatcher("/WEB-INF/views/main/member/space/clicklist.jsp"); dispatcher.forward(req, resp); } }
[ "sioi35@naver.com" ]
sioi35@naver.com
6229477ec62fb3fa9528b17e448ada6e4674107b
28448db59afd6883c07a9cd786c881f41efffd67
/app/src/main/java/com/kbrs/app/GsmRemoteControl/AddEditChannelActivity.java
f8f2915f032f57d5817b9d1847aa2d0fc9961dce
[]
no_license
Dev-theSergio/GSM_0.1.10
d506e3161874e2d841149184da82b15a3d3e5605
facb3127dd49ac2386f01b6227ec0136b7ca9b82
refs/heads/master
2020-05-29T21:45:58.753060
2019-05-30T10:17:17
2019-05-30T10:17:17
189,380,451
0
0
null
null
null
null
UTF-8
Java
false
false
13,475
java
package com.kbrs.app.GsmRemoteControl; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Typeface; import android.support.design.widget.TextInputEditText; import android.support.design.widget.TextInputLayout; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.InputType; import android.util.Log; import android.view.HapticFeedbackConstants; import android.view.View; import android.widget.Button; import android.widget.Toast; import java.util.Objects; public class AddEditChannelActivity extends AppCompatActivity { public static final String EXTRA_ID = "saved_add_id"; public static final String EXTRA_NUMBER = "saved_add_number"; public static final String EXTRA_TITLE = "saved_add_text"; public static final String EXTRA_CHECKED = "saved_add_switch"; private TextInputLayout editChannelNumber; private TextInputLayout editChannelDescription; TextInputEditText addEditChannelDescription; Button buttonAddChannelSave; private String switchChecked; String number; String description; String extraDescription; String extraNumber; private String phoneNumber; SharedPreferences phone; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_channel); editChannelDescription = findViewById(R.id.editAddChannelDescription); editChannelNumber = findViewById(R.id.editAddChannelNumber); buttonAddChannelSave = findViewById(R.id.buttonAddChannelSave); addEditChannelDescription = findViewById(R.id.addEditChannelDescription); Typeface customFont = Typeface.createFromAsset(getAssets(), "font/Circe-Regular.ttf"); editChannelNumber.setTypeface(customFont); editChannelDescription.setTypeface(customFont); //addEditChannelDescription.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES); //!!!!!!!!!!!!!!!!!! phone = this.getSharedPreferences(SettingsActivity.SAVED_TEXT_GSM, MODE_PRIVATE); phoneNumber = phone.getString(SettingsActivity.SAVED_TEXT_GSM, "Номер не задан"); final Intent intent = getIntent(); if (intent.hasExtra(EXTRA_ID)) { setTitle("Редактирование канала"); extraDescription = intent.getStringExtra(EXTRA_TITLE); extraNumber = intent.getStringExtra(EXTRA_NUMBER); switchChecked = intent.getStringExtra(EXTRA_CHECKED); if(extraDescription.equals("...")){ Objects.requireNonNull(editChannelNumber.getEditText()).setText(intent.getStringExtra(EXTRA_NUMBER)); Objects.requireNonNull(editChannelDescription.getEditText()).setText(""); }else { Objects.requireNonNull(editChannelNumber.getEditText()).setText(intent.getStringExtra(EXTRA_NUMBER)); Objects.requireNonNull(editChannelDescription.getEditText()).setText(intent.getStringExtra(EXTRA_TITLE)); } editChannelNumber.setEnabled(false); } else { setTitle("Добавление канала"); } buttonAddChannelSave.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); if ((phoneNumber.equals("Номер не задан") & !(editChannelDescription.getEditText().getText().toString().equals("...") | editChannelDescription.getEditText().getText().toString().equals("") | editChannelDescription.getEditText().getText().toString().equals(intent.getStringExtra(EXTRA_TITLE)))) | (phoneNumber.equals("Номер не задан") & !editChannelNumber.getEditText().getText().toString().equals(intent.getStringExtra(EXTRA_NUMBER)))) { Toast.makeText(AddEditChannelActivity.this, "Номер GSM устройства не задан,\nперейдите в \"Настройки\"", Toast.LENGTH_SHORT).show(); } else { saveAddEditChannel(); Log.d("add","success"); } } }); } private void saveAddEditChannel() { number = Objects.requireNonNull(editChannelNumber.getEditText()).getText().toString().trim(); description = Objects.requireNonNull(editChannelDescription.getEditText()).getText().toString().trim(); Intent data = new Intent(); if (number.isEmpty() & editChannelNumber.isEnabled()) { // если поле ввода номера канала включено и пустое editChannelNumber.setError("Поле не может быть пустым."); } else { if (number.equals(".")) { // если . в поле ввода editChannelNumber.setError("Введите число."); } else { if (number.equals("1") | number.equals("2") | number.equals("3")) { // если выбраны мастер каналы if (description.isEmpty()) { // если описание мастер канала пустое if (!editChannelNumber.isEnabled()) { // если поле ввода номера slave канала неактивно (== режим редактирования) if (!extraDescription.equals("...")) { // и если установленное значение идентификатора не равно значению по умолчанию data.putExtra(EXTRA_TITLE, "..."); // установить описание по умочанию data.putExtra(EXTRA_NUMBER, number); // передать данные номера канала data.putExtra(EXTRA_CHECKED, switchChecked); // передать данные состояния int id = getIntent().getIntExtra(EXTRA_ID, -1); if (id != -1) { data.putExtra(EXTRA_ID, id); } setResult(RESULT_FIRST_USER, data); finish(); } else { setResult(RESULT_CANCELED); finish(); } } else { data.putExtra(EXTRA_TITLE, "..."); // установить описание по умочанию data.putExtra(EXTRA_NUMBER, number); // передать данные номера канала data.putExtra(EXTRA_CHECKED, switchChecked); // передать данные состояния int id = getIntent().getIntExtra(EXTRA_ID, -1); if (id != -1) { data.putExtra(EXTRA_ID, id); } setResult(RESULT_OK, data); finish(); } } else if (editChannelDescription.getEditText().getText(). toString().trim().equals(getIntent().getStringExtra(EXTRA_TITLE))) { // если поле описания мастер канала не изменно setResult(RESULT_CANCELED); // ничего не делать - отмена обновления finish(); } else { editChannelNumber.setError(null); // сброс ошибки data.putExtra(EXTRA_NUMBER, getIntent().getStringExtra(EXTRA_NUMBER)); // номер мастер канала неизменен data.putExtra(EXTRA_TITLE, description); // обновляем описание data.putExtra(EXTRA_CHECKED, switchChecked); int id = getIntent().getIntExtra(EXTRA_ID, -1); if (id != -1) { data.putExtra(EXTRA_ID, id); } setResult(RESULT_OK, data); finish(); } } else if (Integer.valueOf(number) < 4 | Integer.valueOf(number) > 19) { // если значение slave каналов не в диапазоне editChannelNumber.setError("Введите число от 4 до 19."); // ошибка ввода } else if (editChannelNumber.getEditText().getText(). // если номер slave канала не изменился toString().trim().equals(getIntent().getStringExtra(EXTRA_NUMBER)) & editChannelDescription.getEditText().getText(). // и описание slave канала не изменилось toString().trim().equals(getIntent().getStringExtra(EXTRA_TITLE))) { setResult(RESULT_CANCELED); // ничего не делать - отмена обновления finish(); } else { if (description.isEmpty()) { // если описание slave канала пустое editChannelNumber.setError(null); // сбросить ошибку if (!editChannelNumber.isEnabled()) { // если поле ввода номера slave канала неактивно (== режим редактирования) if (!extraDescription.equals("...")) { // и если установленное значение идентификатора не равно значению по умолчанию data.putExtra(EXTRA_TITLE, "..."); // установить описание по умочанию data.putExtra(EXTRA_NUMBER, number); // передать данные номера канала data.putExtra(EXTRA_CHECKED, switchChecked); // передать данные состояния int id = getIntent().getIntExtra(EXTRA_ID, -1); if (id != -1) { data.putExtra(EXTRA_ID, id); } setResult(RESULT_FIRST_USER, data); finish(); } else { setResult(RESULT_CANCELED); finish(); } } else { data.putExtra(EXTRA_TITLE, "..."); // установить описание по умочанию data.putExtra(EXTRA_NUMBER, number); // передать данные номера канала data.putExtra(EXTRA_CHECKED, switchChecked); // передать данные состояния int id = getIntent().getIntExtra(EXTRA_ID, -1); if (id != -1) { data.putExtra(EXTRA_ID, id); } setResult(RESULT_OK, data); finish(); } } else { editChannelNumber.setError(null); data.putExtra(EXTRA_TITLE, description); data.putExtra(EXTRA_NUMBER, number); data.putExtra(EXTRA_CHECKED, switchChecked); int id = getIntent().getIntExtra(EXTRA_ID, -1); if (id != -1) { data.putExtra(EXTRA_ID, id); } setResult(RESULT_OK, data); finish(); } } } } } }
[ "thesergio@mail.ru" ]
thesergio@mail.ru
9eb13801341692cec9b76d367074d750d70f159f
4aee845a6888cf0cb2f50b866be84f6a4289c1a9
/src/deux_douze/Maladie.java
2824c5eb9f54be9e79ba1ddcaad9714ef1598453
[]
no_license
Ronan-1337/TP_09-07-2020
ceecfa2bec4ddf9ddc34979c8e5976bf5a2fe5ff
ab40f0a337145b7d4dd98f561638dbb3f7a97a9c
refs/heads/master
2022-11-13T04:12:22.104407
2020-07-09T15:26:42
2020-07-09T15:26:42
278,118,115
0
0
null
2020-07-09T15:26:43
2020-07-08T14:54:33
Java
ISO-8859-1
Java
false
false
128
java
package deux_douze; enum Maladie { // on suppose que toutes les maladies sont énumérées ici GRIPPE, PESTE, CHOLERA; }
[ "67144266+Ronan-1337@users.noreply.github.com" ]
67144266+Ronan-1337@users.noreply.github.com
051cfa3d7b4926019501820eed19202fa2cbc07a
a8773bc498e6d5040e5fdb971e816920a89a412c
/Empty_triangle_StarPattern.java
19d8d278188e4572edefc6b6244c3f722350af17
[]
no_license
Debipdas/Java_Lab_placement
439248ed38737588d949cad83f370c25bb7c6058
65acaaf8545784dd4d4a493f51a01197b87dbe6c
refs/heads/main
2023-05-30T05:58:18.802621
2021-06-16T18:17:05
2021-06-16T18:17:05
377,584,920
0
0
null
null
null
null
UTF-8
Java
false
false
712
java
package com.java.lab; public class Empty_triangle_StarPattern { public static void main(String[] args) { int rows =6; for (int i=1; i<=rows; i++) { // Print space in decreasing order for (int j=rows; j>i; j--) { System.out.print(" "); } // Print star in increasing order for (int k=1; k<=(i * 2) -1; k++) { if( k == 1 || k == (i * 2) -1 || i == rows) System.out.print("*"); else System.out.print(" "); } System.out.println(); } } }
[ "noreply@github.com" ]
noreply@github.com
7f9a29545c3926e6dc320cce55ffc0908b75850a
f14244e8574bf8c741fec70a9ed84f1dc60d1a68
/src/me/Samkist/Objects/Widget.java
2be8cf3d556015c45feb7e406f697c4e40afdf3e
[]
no_license
Samkist/FinalSearchSort
a1ee020e9e46b99bda8f961870d5c475ea41aa4f
e62a786a62d8335e83a96c6a17c9b15f533c36b6
refs/heads/master
2021-02-19T11:07:47.219380
2020-03-11T13:28:02
2020-03-11T13:28:02
245,307,294
0
0
null
null
null
null
UTF-8
Java
false
false
890
java
package me.Samkist.Objects; /** * Created by Samkist * https://github.com/Samkist */ public class Widget implements Comparable<Widget> { private String code; private int sold; public Widget(String code, int sold) { try { if (code.length() != 3) throw new Exception(); Integer.parseInt(code); } catch(Exception e) { throw new IllegalArgumentException("Invalid Code"); } this.code = code; this.sold = sold; } public String getCode() { return code; } public int getSold() { return sold; } public void setSold(int sold) { this.sold = sold; } @Override public int compareTo(Widget widget) { return sold - widget.getSold(); } @Override public String toString() { return getCode() + " - " + getSold(); } }
[ "samshark23451@gmail.com" ]
samshark23451@gmail.com
1d6514a008e6a890762ab7086bfaf821d3774e50
cc9672cb2341829ec0b692711d62d75b4156523c
/src/main/java/com/abouerp/library/applet/repository/BookDetailRepository.java
8715c3f61febc30842a79dbfe0ca5f2fdd24bf13
[]
no_license
Abouerp/applet-library
8a934b68a35f0cbf0978fabfecbcf042eb8c4081
2f67de13706e5cc6ce50d260dc6c1887050420e8
refs/heads/master
2023-03-21T10:44:24.815996
2021-03-16T07:38:22
2021-03-16T07:38:22
338,746,803
0
0
null
null
null
null
UTF-8
Java
false
false
664
java
package com.abouerp.library.applet.repository; import com.abouerp.library.applet.domain.book.BookDetail; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.querydsl.QuerydslPredicateExecutor; import org.springframework.stereotype.Repository; import java.util.List; /** * @author Abouerp */ @Repository public interface BookDetailRepository extends JpaRepository<BookDetail, Integer>, QuerydslPredicateExecutor<BookDetail> { @Query(value = "select * from BookDetail where book_id = ?1",nativeQuery = true) List<BookDetail> findByBookId(Integer id); }
[ "1057240821@qq.com" ]
1057240821@qq.com
9aa1bd3fc60593795aa0979701145f21e59a39b9
8dc84558f0058d90dfc4955e905dab1b22d12c08
/content/public/android/java/src/org/chromium/content/browser/input/SuggestionsPopupWindow.java
7b1fc0c67c86a4632e61d00e5056202bcdc08328
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
permissive
meniossin/src
42a95cc6c4a9c71d43d62bc4311224ca1fd61e03
44f73f7e76119e5ab415d4593ac66485e65d700a
refs/heads/master
2022-12-16T20:17:03.747113
2020-09-03T10:43:12
2020-09-03T10:43:12
263,710,168
1
0
BSD-3-Clause
2020-05-13T18:20:09
2020-05-13T18:20:08
null
UTF-8
Java
false
false
18,386
java
// Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.content.browser.input; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.graphics.Rect; import android.graphics.drawable.ColorDrawable; import android.os.Build; import android.text.SpannableString; import android.util.DisplayMetrics; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.BaseAdapter; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.PopupWindow; import android.widget.PopupWindow.OnDismissListener; import android.widget.TextView; import org.chromium.base.ApiCompatibilityUtils; import org.chromium.base.VisibleForTesting; import org.chromium.content.R; import org.chromium.ui.UiUtils; import org.chromium.ui.base.WindowAndroid; /** * Popup window that displays a menu for viewing and applying text replacement suggestions. */ public abstract class SuggestionsPopupWindow implements OnItemClickListener, OnDismissListener, View.OnClickListener { private static final String ACTION_USER_DICTIONARY_INSERT = "com.android.settings.USER_DICTIONARY_INSERT"; private static final String USER_DICTIONARY_EXTRA_WORD = "word"; // From Android Settings app's @integer/maximum_user_dictionary_word_length. private static final int ADD_TO_DICTIONARY_MAX_LENGTH_ON_JELLY_BEAN = 48; private final Context mContext; protected final TextSuggestionHost mTextSuggestionHost; private final View mParentView; private WindowAndroid mWindowAndroid; private Activity mActivity; private DisplayMetrics mDisplayMetrics; private PopupWindow mPopupWindow; private LinearLayout mContentView; private String mHighlightedText; private int mNumberOfSuggestionsToUse; private TextView mAddToDictionaryButton; private TextView mDeleteButton; private ListView mSuggestionListView; private LinearLayout mListFooter; private View mDivider; private int mPopupVerticalMargin; private boolean mDismissedByItemTap; /** * @param context Android context to use. * @param textSuggestionHost TextSuggestionHost instance (used to communicate with Blink). * @param windowAndroid The current WindowAndroid instance. * @param parentView The view used to attach the PopupWindow. */ public SuggestionsPopupWindow(Context context, TextSuggestionHost textSuggestionHost, WindowAndroid windowAndroid, View parentView) { mContext = context; mTextSuggestionHost = textSuggestionHost; mWindowAndroid = windowAndroid; mParentView = parentView; createPopupWindow(); initContentView(); mPopupWindow.setContentView(mContentView); } /** * Method to be implemented by subclasses that returns how mnay suggestions are available (some * of them may not be displayed if there's not enough room in the window). */ protected abstract int getSuggestionsCount(); /** * Method to be implemented by subclasses to return an object representing the suggestion at * the specified position. */ protected abstract Object getSuggestionItem(int position); /** * Method to be implemented by subclasses to return a SpannableString representing text, * possibly with formatting added, to display for the suggestion at the specified position. */ protected abstract SpannableString getSuggestionText(int position); /** * Method to be implemented by subclasses to apply the suggestion at the specified position. */ protected abstract void applySuggestion(int position); /** * Hides or shows the "Add to dictionary" button in the suggestion menu footer. */ protected void setAddToDictionaryEnabled(boolean isEnabled) { mAddToDictionaryButton.setVisibility(isEnabled ? View.VISIBLE : View.GONE); } private void createPopupWindow() { mPopupWindow = new PopupWindow(); mPopupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT); mPopupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { // Set the background on the PopupWindow instead of on mContentView (where we set it for // pre-Lollipop) since the popup will not properly dismiss on pre-Marshmallow unless it // has a background set. mPopupWindow.setBackgroundDrawable(ApiCompatibilityUtils.getDrawable( mContext.getResources(), R.drawable.floating_popup_background_light)); // On Lollipop and later, we use elevation to create a drop shadow effect. // On pre-Lollipop, we instead use a background image on mContentView (in // initContentView). mPopupWindow.setElevation(mContext.getResources().getDimensionPixelSize( R.dimen.text_suggestion_popup_elevation)); } else { // The PopupWindow does not properly dismiss pre-Marshmallow unless it has a background // set. mPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); } mPopupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED); mPopupWindow.setFocusable(true); mPopupWindow.setClippingEnabled(false); mPopupWindow.setOnDismissListener(this); } private void initContentView() { final LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mContentView = (LinearLayout) inflater.inflate(R.layout.text_edit_suggestion_container, null); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { // Set this on the content view instead of on the PopupWindow so we can retrieve the // padding later. mContentView.setBackground(ApiCompatibilityUtils.getDrawable( mContext.getResources(), R.drawable.dropdown_popup_background)); } // mPopupVerticalMargin is the minimum amount of space we want to have between the popup // and the top or bottom of the window. mPopupVerticalMargin = mContext.getResources().getDimensionPixelSize( R.dimen.text_suggestion_popup_vertical_margin); mSuggestionListView = (ListView) mContentView.findViewById(R.id.suggestionContainer); // android:divider="@null" in the XML file crashes on Android N and O // when running as a WebView (b/38346876). mSuggestionListView.setDivider(null); mListFooter = (LinearLayout) inflater.inflate(R.layout.text_edit_suggestion_list_footer, null); mSuggestionListView.addFooterView(mListFooter, null, false); mSuggestionListView.setAdapter(new SuggestionAdapter()); mSuggestionListView.setOnItemClickListener(this); mDivider = mContentView.findViewById(R.id.divider); mAddToDictionaryButton = (TextView) mContentView.findViewById(R.id.addToDictionaryButton); mAddToDictionaryButton.setOnClickListener(this); mDeleteButton = (TextView) mContentView.findViewById(R.id.deleteButton); mDeleteButton.setOnClickListener(this); } /** * Dismisses the text suggestion menu (called by TextSuggestionHost when certain events occur, * for example device rotation). */ public void dismiss() { mPopupWindow.dismiss(); } /** * Used by TextSuggestionHost to determine if the text suggestion menu is currently visible. */ public boolean isShowing() { return mPopupWindow.isShowing(); } /** * Used by TextSuggestionHost to update {@link WindowAndroid} to the current one. */ public void updateWindowAndroid(WindowAndroid windowAndroid) { mWindowAndroid = windowAndroid; } private void addToDictionary() { final Intent intent = new Intent(ACTION_USER_DICTIONARY_INSERT); String wordToAdd = mHighlightedText; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { // There was a bug in Jelly Bean, fixed in the initial version of KitKat, that can cause // a crash if the word we try to add is too long. The "add to dictionary" intent uses an // EditText widget to show the word about to be added (and allow the user to edit it). // It has a maximum length of 48 characters. If a word is longer than this, it will be // truncated, but the intent will try to select the full length of the word, causing a // crash. // KitKit and later still truncate the word, but avoid the crash. if (wordToAdd.length() > ADD_TO_DICTIONARY_MAX_LENGTH_ON_JELLY_BEAN) { wordToAdd = wordToAdd.substring(0, ADD_TO_DICTIONARY_MAX_LENGTH_ON_JELLY_BEAN); } } intent.putExtra(USER_DICTIONARY_EXTRA_WORD, wordToAdd); intent.setFlags(intent.getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK); mContext.startActivity(intent); } private class SuggestionAdapter extends BaseAdapter { private LayoutInflater mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); @Override public int getCount() { return mNumberOfSuggestionsToUse; } @Override public Object getItem(int position) { return getSuggestionItem(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { TextView textView = (TextView) convertView; if (textView == null) { textView = (TextView) mInflater.inflate( R.layout.text_edit_suggestion_item, parent, false); } textView.setText(getSuggestionText(position)); return textView; } } private void measureContent() { // Make the menu wide enough to fit its widest item. int width = UiUtils.computeMaxWidthOfListAdapterItems(mSuggestionListView.getAdapter()); width += mContentView.getPaddingLeft() + mContentView.getPaddingRight(); final int verticalMeasure = View.MeasureSpec.makeMeasureSpec( mDisplayMetrics.heightPixels, View.MeasureSpec.AT_MOST); mContentView.measure( View.MeasureSpec.makeMeasureSpec(width, View.MeasureSpec.EXACTLY), verticalMeasure); mPopupWindow.setWidth(width); } private void updateDividerVisibility() { // If we don't have any spell check suggestions, "Add to dictionary" will be the first menu // item, and we shouldn't show a divider above it. if (mNumberOfSuggestionsToUse == 0) { mDivider.setVisibility(View.GONE); } else { mDivider.setVisibility(View.VISIBLE); } } /** * Called by TextSuggestionHost to tell this class what text is currently highlighted (so it can * be added to the dictionary if requested). */ protected void show(double caretXPx, double caretYPx, String highlightedText) { mNumberOfSuggestionsToUse = getSuggestionsCount(); mHighlightedText = highlightedText; mActivity = mWindowAndroid.getActivity().get(); // Note: the Activity can be null here if we're in a WebView that was created without // using an Activity. So all code in this class should handle this case. if (mActivity != null) { mDisplayMetrics = mActivity.getResources().getDisplayMetrics(); } else { // Getting the DisplayMetrics from the passed-in context doesn't handle multi-window // mode as well, but it's good enough for the "improperly-created WebView" case mDisplayMetrics = mContext.getResources().getDisplayMetrics(); } // In single-window mode, we need to get the status bar height to make sure we don't try to // draw on top of it (we can't draw on top in older versions of Android). // In multi-window mode, as of Android N, the behavior is as follows: // // Portrait mode, top window: the window height does not include the height of the status // bar, but drawing at Y position 0 starts at the top of the status bar. // // Portrait mode, bottom window: the window height does not include the height of the status // bar, and the status bar isn't touching the window, so we can't draw on it regardless. // // Landscape mode: the window height includes the whole height of the keyboard // (Google-internal b/63405914), so we are unable to handle this case properly. // // For our purposes, we don't worry about if we're drawing over the status bar in // multi-window mode, but we need to make sure we don't do it in single-window mode (in case // we're on an old version of Android). int statusBarHeight = 0; if (mActivity != null && !ApiCompatibilityUtils.isInMultiWindowMode(mActivity)) { Rect rect = new Rect(); mActivity.getWindow().getDecorView().getWindowVisibleDisplayFrame(rect); statusBarHeight = rect.top; } // We determine the maximum number of suggestions we can show by taking the available // height in the window, subtracting the height of the list footer (divider, add to // dictionary button, delete button), and dividing by the height of a suggestion item. mListFooter.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)); final int verticalSpaceAvailableForSuggestions = mDisplayMetrics.heightPixels - statusBarHeight - mListFooter.getMeasuredHeight() - 2 * mPopupVerticalMargin - mContentView.getPaddingTop() - mContentView.getPaddingBottom(); final int itemHeight = mContext.getResources().getDimensionPixelSize( R.dimen.text_edit_suggestion_item_layout_height); final int maxItemsToShow = verticalSpaceAvailableForSuggestions > 0 ? verticalSpaceAvailableForSuggestions / itemHeight : 0; mNumberOfSuggestionsToUse = Math.min(mNumberOfSuggestionsToUse, maxItemsToShow); // If we're not showing any suggestions, hide the divider before "Add to dictionary" and // "Delete". updateDividerVisibility(); measureContent(); final int width = mContentView.getMeasuredWidth(); final int height = mContentView.getMeasuredHeight(); // Horizontally center the menu on the caret location, and vertically position the menu // under the caret. int positionX = (int) Math.round(caretXPx - width / 2.0f); int positionY = (int) Math.round(caretYPx); // We get the insertion point coords relative to the viewport. // We need to render the popup relative to the window. final int[] positionInWindow = new int[2]; mParentView.getLocationInWindow(positionInWindow); positionX += positionInWindow[0]; positionY += positionInWindow[1]; // Subtract off the container's top padding to get the proper alignment with the caret. // Note: there is no explicit padding set. On Android L and later, we use elevation to draw // a drop shadow and there is no top padding. On pre-L, we instead use a background image, // which results in some implicit padding getting added that we need to account for. positionY -= mContentView.getPaddingTop(); // Horizontal clipping: if part of the menu (except the shadow) would fall off the left // or right edge of the screen, shift the menu to keep it on-screen. final int menuAtRightEdgeOfWindowPositionX = mDisplayMetrics.widthPixels - width + mContentView.getPaddingRight(); positionX = Math.min(menuAtRightEdgeOfWindowPositionX, positionX); positionX = Math.max(-mContentView.getPaddingLeft(), positionX); // Vertical clipping: if part of the menu or its bottom margin would fall off the bottom of // the screen, shift it up to keep it on-screen. positionY = Math.min(positionY, mDisplayMetrics.heightPixels - height - mContentView.getPaddingTop() - mPopupVerticalMargin); mPopupWindow.showAtLocation(mParentView, Gravity.NO_GRAVITY, positionX, positionY); } @Override public void onClick(View v) { if (v == mAddToDictionaryButton) { addToDictionary(); mTextSuggestionHost.onNewWordAddedToDictionary(mHighlightedText); mDismissedByItemTap = true; mPopupWindow.dismiss(); } else if (v == mDeleteButton) { mTextSuggestionHost.deleteActiveSuggestionRange(); mDismissedByItemTap = true; mPopupWindow.dismiss(); } } @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // Ignore taps somewhere in the list footer (divider, "Add to dictionary", "Delete") that // don't get handled by a button. if (position >= mNumberOfSuggestionsToUse) { return; } applySuggestion(position); mDismissedByItemTap = true; mPopupWindow.dismiss(); } @Override public void onDismiss() { mTextSuggestionHost.onSuggestionMenuClosed(mDismissedByItemTap); mDismissedByItemTap = false; } /** * @return The popup's content view. */ @VisibleForTesting public View getContentViewForTesting() { return mContentView; } }
[ "arnaud@geometry.ee" ]
arnaud@geometry.ee
83466cb858435cf5f6992ff3464bdf26e41b45e4
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/2/2_43e22a9028f83322db4727a4feaa7e0d5d07c1d0/ClientLeaseSetManagerJob/2_43e22a9028f83322db4727a4feaa7e0d5d07c1d0_ClientLeaseSetManagerJob_t.java
064fcf1f9460290c485ef81dcc7f4e8dcc54d178
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
9,857
java
package net.i2p.router.tunnelmanager; import java.util.Date; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import java.util.TreeMap; import net.i2p.data.Lease; import net.i2p.data.LeaseSet; import net.i2p.data.RouterInfo; import net.i2p.data.TunnelId; import net.i2p.router.JobImpl; import net.i2p.router.RouterContext; import net.i2p.router.TunnelInfo; import net.i2p.util.Log; /** * Manage the process of requesting a lease set as necessary for a client based * on the contents of the tunnel pool. Request a new lease set when: * - # safe inbound tunnels meets or exceeds the client's minimum and * - no current leaseSet exists * or * - one of the tunnels in the current leaseSet has expired * or * - it has been N minutes since the current leaseSet was created * (where N is based off the clientSettings.getInboundDuration) * */ class ClientLeaseSetManagerJob extends JobImpl { private Log _log; private ClientTunnelPool _pool; private LeaseSet _currentLeaseSet; private long _lastCreated; private boolean _forceRequestLease; /** * Recheck the set every 15 seconds * todo: this should probably be updated dynamically based on expiration dates / etc. * */ private final static long RECHECK_DELAY = 15*1000; /** * How long to wait for the client to approve or reject a leaseSet */ private final static long REQUEST_LEASE_TIMEOUT = 30*1000; public ClientLeaseSetManagerJob(RouterContext context, ClientTunnelPool pool) { super(context); _log = context.logManager().getLog(ClientLeaseSetManagerJob.class); _pool = pool; _currentLeaseSet = null; _lastCreated = -1; } public void forceRequestLease() { _currentLeaseSet = null; _forceRequestLease = true; } public String getName() { return "Manage Client Lease Set"; } public void runJob() { if ((!_forceRequestLease) && (_pool.isStopped()) ) { if ( (_pool.getInactiveInboundTunnelIds().size() <= 0) && (_pool.getInboundTunnelIds().size() <= 0) ) { if (_log.shouldLog(Log.INFO)) _log.info("No more tunnels and the client has stopped, so no need to manage the leaseSet any more for " + _pool.getDestination().calculateHash()); return; } else { if (_log.shouldLog(Log.INFO)) _log.info("Client " + _pool.getDestination().calculateHash() + " is stopped, but they still have some tunnels, so don't stop maintaining the leaseSet"); requeue(RECHECK_DELAY); return; } } int available = _pool.getSafePoolSize(); if (available >= _pool.getClientSettings().getNumInboundTunnels()) { if (_forceRequestLease) { if (_log.shouldLog(Log.INFO)) _log.info("Forced to request a new lease (reconnected client perhaps?)"); _forceRequestLease = false; requestNewLeaseSet(); } else if (_currentLeaseSet == null) { if (_log.shouldLog(Log.INFO)) _log.info("No leaseSet is known - request a new one"); requestNewLeaseSet(); } else if (tunnelsChanged()) { if (_log.shouldLog(Log.INFO)) _log.info("Tunnels changed from the old leaseSet - request a new one: [pool = " + _pool.getInboundTunnelIds() + " old leaseSet: " + _currentLeaseSet); requestNewLeaseSet(); } else if (getContext().clock().now() > _lastCreated + _pool.getClientSettings().getInboundDuration()) { if (_log.shouldLog(Log.INFO)) _log.info("We've exceeded the client's requested duration (limit = " + new Date(_lastCreated + _pool.getClientSettings().getInboundDuration()) + " / " + _pool.getClientSettings().getInboundDuration() + ") - request a new leaseSet"); requestNewLeaseSet(); } else { _log.debug("The current LeaseSet is fine, noop"); } } else { _log.warn("Insufficient safe inbound tunnels exist for the client (" + available + " available, " + _pool.getClientSettings().getNumInboundTunnels() + " required) - no leaseSet requested"); } requeue(RECHECK_DELAY); } /** * Determine if the tunnels in the current leaseSet are the same as the * currently available free tunnels * * @return true if the tunnels are /not/ the same, else false if they are the same */ private boolean tunnelsChanged() { long furthestInFuture = 0; Set currentIds = new HashSet(_currentLeaseSet.getLeaseCount()); for (int i = 0; i < _currentLeaseSet.getLeaseCount(); i++) { Lease lease = (Lease)_currentLeaseSet.getLease(i); currentIds.add(lease.getTunnelId()); if (lease.getEndDate().getTime() > furthestInFuture) furthestInFuture = lease.getEndDate().getTime(); } Set avail = _pool.getInboundTunnelIds(); avail.removeAll(currentIds); // check to see if newer ones exist in the available pool for (Iterator iter = avail.iterator(); iter.hasNext(); ) { TunnelId id = (TunnelId)iter.next(); TunnelInfo info = _pool.getInboundTunnel(id); // we need to check this in case the tunnel was deleted since 6 lines up if ( (id != null) && (info != null) && (info.getSettings() != null) ) { // if something available but not in the currently published lease will be // around longer than any of the published leases, we want that tunnel to // be added to our published lease if (info.getSettings().getExpiration() > furthestInFuture) { if (_log.shouldLog(Log.DEBUG)) _log.debug("Tunnel " + id.getTunnelId() + " expires " + (info.getSettings().getExpiration()-furthestInFuture) + "ms after any of the existing ones do"); return true; } } } if (_log.shouldLog(Log.DEBUG)) _log.debug("None of the available tunnels expire after the existing lease set's tunnels"); return false; } /** * Request a new leaseSet based off the currently available safe tunnels */ private void requestNewLeaseSet() { LeaseSet proposed = buildNewLeaseSet(); getContext().clientManager().requestLeaseSet(_pool.getDestination(), proposed, REQUEST_LEASE_TIMEOUT, new LeaseSetCreatedJob(), null); } /** * Create a new proposed leaseSet with all inbound tunnels */ private LeaseSet buildNewLeaseSet() { LeaseSet ls = new LeaseSet(); TreeMap tunnels = new TreeMap(); long now = getContext().clock().now(); for (Iterator iter = _pool.getInboundTunnelIds().iterator(); iter.hasNext(); ) { TunnelId id = (TunnelId)iter.next(); TunnelInfo info = _pool.getInboundTunnel(id); if (!info.getIsReady()) continue; long exp = info.getSettings().getExpiration(); if (now + RECHECK_DELAY + REQUEST_LEASE_TIMEOUT > exp) continue; RouterInfo ri = getContext().netDb().lookupRouterInfoLocally(info.getThisHop()); if (ri == null) continue; Lease lease = new Lease(); lease.setEndDate(new Date(exp)); lease.setRouterIdentity(ri.getIdentity()); lease.setTunnelId(id); tunnels.put(new Long(0-exp), lease); } // now pick the N tunnels with the longest time remaining (n = # tunnels the client requested) // place tunnels.size() - N into the inactive pool int selected = 0; int wanted = _pool.getClientSettings().getNumInboundTunnels(); for (Iterator iter = tunnels.values().iterator(); iter.hasNext(); ) { Lease lease = (Lease)iter.next(); if (selected < wanted) { ls.addLease(lease); selected++; } else { _pool.moveToInactive(lease.getTunnelId()); } } ls.setDestination(_pool.getDestination()); return ls; } private class LeaseSetCreatedJob extends JobImpl { public LeaseSetCreatedJob() { super(ClientLeaseSetManagerJob.this.getContext()); } public String getName() { return "LeaseSet created"; } public void runJob() { RouterContext ctx = ClientLeaseSetManagerJob.this.getContext(); LeaseSet ls = ctx.netDb().lookupLeaseSetLocally(_pool.getDestination().calculateHash()); if (ls != null) { _log.info("New leaseSet completely created"); _lastCreated = ctx.clock().now(); _currentLeaseSet = ls; } else { _log.error("New lease set created, but not found locally? wtf?!"); } } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
0bdbc91eb2939f8c63c6fa1ce219a2108f6843cc
5ac60b140812a326e5112bee9daf8111bbe1d431
/app/src/main/java/ua/com/expertsolution/chesva/model/json/ChangeBoxRfidListRequest.java
910a794bc31e7d72a938f2b6b8171b5229f49ab7
[]
no_license
chrisgate/ChesvaExample
e38760e120ec090d4dda6340d42a773dd2dd18ab
ad4deef08fda29328f817fa5bb11801cd98eacc1
refs/heads/master
2023-02-19T05:49:16.353171
2021-01-20T09:16:00
2021-01-20T09:16:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
592
java
package ua.com.expertsolution.chesva.model.json; import com.google.gson.annotations.SerializedName; import java.util.List; import ua.com.expertsolution.chesva.model.dto.Box; import ua.com.expertsolution.chesva.model.dto.Operation; public class ChangeBoxRfidListRequest { @SerializedName("Items") private List<Operation> items; public ChangeBoxRfidListRequest(List<Operation> items) { this.items = items; } public List<Operation> getItems() { return items; } public void setItems(List<Operation> items) { this.items = items; } }
[ "ardix.dev@gmail.com" ]
ardix.dev@gmail.com
63c994652b398583386f7fef6e7096ec8df7cf3e
8ecf9ef60ef1bffc29b934b013a1142f8508e1d6
/src/com/taozhu/modules/web/excel/service/IHeadDefineHandler.java
6a7287482e0e5508fe7f86346dd646c622e37717
[]
no_license
apollo2099/AppServer
eacb5739e8f64a4f955f5d3e6e724680f0b86d3d
9df1d685c7ace4af1019c9388522df8401717544
refs/heads/master
2021-01-09T20:40:28.114611
2016-06-15T07:27:03
2016-06-15T07:27:03
61,184,299
0
0
null
null
null
null
UTF-8
Java
false
false
325
java
package com.taozhu.modules.web.excel.service; import java.util.List; import java.util.Map; import com.taozhu.modules.web.excel.pojo.ColDefine; import com.taozhu.modules.web.excel.pojo.FileDefine; public interface IHeadDefineHandler { public List<ColDefine> execute(FileDefine fd,Object obj,Map<String, String> param); }
[ "huixiong@juanpi.com" ]
huixiong@juanpi.com
3322af37b13dc2b178801a6bc632189d5185bfff
7a13dfe0fed58bed3899ff916efa29f64a6357b3
/hango-api-plane-server/src/main/java/org/hango/cloud/core/plugin/FragmentHolder.java
3d9c3df17df7061eb6d84f7d890b128ee09dcdd3
[ "Apache-2.0" ]
permissive
lgh990/api-plane
3eda18819b75b0a9743c762a96a10b5acaecf73e
053342ee19193084ca47cc402a7c13f01d1532d5
refs/heads/main
2023-06-29T07:52:53.400864
2021-08-04T05:52:51
2021-08-04T05:52:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,351
java
package org.hango.cloud.core.plugin; public class FragmentHolder { private FragmentWrapper virtualServiceFragment; // ratelimit插件的configmap private FragmentWrapper sharedConfigFragment; private FragmentWrapper gatewayPluginsFragment; // ratelimit插件的smartLimiter private FragmentWrapper smartLimiterFragment; public FragmentWrapper getVirtualServiceFragment() { return virtualServiceFragment; } public void setVirtualServiceFragment(FragmentWrapper virtualServiceFragment) { this.virtualServiceFragment = virtualServiceFragment; } public FragmentWrapper getSharedConfigFragment() { return sharedConfigFragment; } public void setSharedConfigFragment(FragmentWrapper sharedConfigFragment) { this.sharedConfigFragment = sharedConfigFragment; } public FragmentWrapper getGatewayPluginsFragment() { return gatewayPluginsFragment; } public void setGatewayPluginsFragment(FragmentWrapper gatewayPluginsFragment) { this.gatewayPluginsFragment = gatewayPluginsFragment; } public FragmentWrapper getSmartLimiterFragment() { return smartLimiterFragment; } public void setSmartLimiterFragment(FragmentWrapper smartLimiterFragment) { this.smartLimiterFragment = smartLimiterFragment; } }
[ "hanjiahao@corp.netease.com" ]
hanjiahao@corp.netease.com
d1c4bb564aa2809d4bcf0e16eddd76c22904a809
33d8dc7e5991efeb8863c451317981e87d999832
/api/src/main/java/io/seg/kofo/bitcoinwo/response/BlockMsgResponse.java
c3fdd897395c4d3e852e8f9fb2ce8ac3b88af501
[]
no_license
AELFSTAKING/btc.watchonly
420662d87585a9505a00594b10f868b6d0be4ecf
2ab709ccb8c4c713ac15bab1e256bc9b875078e7
refs/heads/master
2022-08-10T02:50:40.438644
2020-03-13T09:00:37
2020-03-13T09:00:37
244,081,626
1
0
null
2022-06-21T02:53:55
2020-03-01T03:43:22
Java
UTF-8
Java
false
false
340
java
package io.seg.kofo.bitcoinwo.response; import lombok.*; @Data @Builder @AllArgsConstructor @NoArgsConstructor @ToString public class BlockMsgResponse { /** * 高度 */ private Long height; /** * 区块hash */ private String blockHash; /** * 区块内容 */ private String msg; }
[ "gin_so@qq.com" ]
gin_so@qq.com
9870b76560e91e03bb3bfbdac38bc014546a1116
d8d25065d94204e4dbb2d2da8d77b19dba0d3424
/app/src/main/java/com/newtowndata/sudoku/Main.java
f496152f3d060ba09a6f458cb5e6a4dc10119db4
[ "Apache-2.0" ]
permissive
NewTownData/sudoku_solver
c31c601131786eb82d930cfc4e3ba3990a3640a2
7e431944be7c6c89cbdd6a24ba013916f1ee1fd6
refs/heads/main
2023-05-29T12:08:18.309665
2021-06-06T06:59:27
2021-06-06T06:59:27
374,282,773
0
0
null
null
null
null
UTF-8
Java
false
false
1,022
java
/** * Copyright 2021 Voyta Krizek, https://github.com/NewTownData * * 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.newtowndata.sudoku; /** * * @author Voyta Krizek, https://github.com/NewTownData */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new MainWin().setVisible(true); } }); } }
[ "vkdot@users.noreply.github.com" ]
vkdot@users.noreply.github.com
99f8d53b4ab955c37738a5c0f40ac58339d6a3db
4a9cdc6ed2158b1d9e294fa8e742d67a7da674fe
/src/persistence/rest/RestExchangeRateLoader.java
aaf1fda1d97fdbef66eb006d0c34a85bd7cf5871
[]
no_license
Miguelnj/MoneyCalculatorWithUI
9c61a8d9f9f83396c1e3b385ac7687f4df377741
0ae4f69a04e37b4f6b94183336a3c37d58672fcf
refs/heads/master
2021-05-12T15:14:25.666224
2018-01-10T15:47:43
2018-01-10T15:47:43
116,977,395
0
0
null
null
null
null
UTF-8
Java
false
false
1,005
java
package persistence.rest; import Model.Currency; import Model.ExchangeRate; import persistence.ExchangeRateLoader; import java.io.InputStream; import java.net.URL; import java.io.IOException; public class RestExchangeRateLoader implements ExchangeRateLoader{ @Override public ExchangeRate load(Currency from, Currency to){ try { return new ExchangeRate(from, to, read(from.getCode(), to.getCode())); } catch (IOException ignored) { return null; } } private double read(String from, String to) throws IOException { String line = read(new URL("http://api.fixer.io/latest?base="+from+"&symbols="+to)) ; return Double.parseDouble(line.substring(line.indexOf(to)+5, line.indexOf("}"))); } private String read(URL url) throws IOException { InputStream is = url.openStream(); byte[] buffer = new byte[1024]; int length = is.read(buffer); return new String(buffer, 0, length); } }
[ "miguel.navjor@gmail.com" ]
miguel.navjor@gmail.com
3d50487eea6d1da2dda189346c479a63764e73af
21ede326b6cfcf5347ca6772d392d3acca80cfa0
/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java
47cfcae693ca38a510d967bc32c49da67f525069
[ "BSD-3-Clause" ]
permissive
csagan5/kiwi
6eaab0ab4db60468358291956506ad6f889401f8
eb2015c28925be91b4a3130b3c2bee2f5edc91de
refs/heads/master
2020-04-04T17:06:54.003121
2018-10-24T08:20:01
2018-10-24T08:20:01
156,107,399
2
0
null
null
null
null
UTF-8
Java
false
false
18,834
java
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.chrome.browser.init; import android.app.Activity; import android.content.Context; import android.os.AsyncTask; import android.os.Build; import android.os.Handler; import android.os.Looper; import android.os.Process; import android.os.StrictMode; import com.squareup.leakcanary.LeakCanary; import org.chromium.base.ActivityState; import org.chromium.base.ApplicationStatus; import org.chromium.base.ApplicationStatus.ActivityStateListener; import org.chromium.base.CommandLine; import org.chromium.base.ContentUriUtils; import org.chromium.base.ContextUtils; import org.chromium.base.Log; import org.chromium.base.PathUtils; import org.chromium.base.SysUtils; import org.chromium.base.ThreadUtils; import org.chromium.base.TraceEvent; import org.chromium.base.annotations.RemovableInRelease; import org.chromium.base.library_loader.LibraryLoader; import org.chromium.base.library_loader.LibraryProcessType; import org.chromium.base.library_loader.ProcessInitException; import org.chromium.base.memory.MemoryPressureUma; import org.chromium.chrome.browser.AppHooks; import org.chromium.chrome.browser.ChromeApplication; import org.chromium.chrome.browser.ChromeStrictMode; import org.chromium.chrome.browser.ChromeSwitches; import org.chromium.chrome.browser.ClassRegister; import org.chromium.chrome.browser.FileProviderHelper; import org.chromium.chrome.browser.crash.LogcatExtractionRunnable; import org.chromium.chrome.browser.download.DownloadManagerService; import org.chromium.chrome.browser.services.GoogleServicesManager; import org.chromium.chrome.browser.tabmodel.document.DocumentTabModelImpl; import org.chromium.chrome.browser.webapps.ActivityAssigner; import org.chromium.chrome.browser.webapps.ChromeWebApkHost; import org.chromium.components.crash.browser.CrashDumpManager; import org.chromium.content_public.browser.BrowserStartupController; import org.chromium.content_public.browser.DeviceUtils; import org.chromium.content_public.browser.SpeechRecognition; import org.chromium.net.NetworkChangeNotifier; import org.chromium.policy.CombinedPolicyProvider; import org.chromium.ui.resources.ResourceExtractor; import java.io.File; import java.util.Locale; /** * Application level delegate that handles start up tasks. * {@link AsyncInitializationActivity} classes should override the {@link BrowserParts} * interface for any additional initialization tasks for the initialization to work as intended. */ public class ChromeBrowserInitializer { private static final String TAG = "BrowserInitializer"; private static ChromeBrowserInitializer sChromeBrowserInitializer; private static BrowserStartupController sBrowserStartupController; private final Handler mHandler; private final ChromeApplication mApplication; private final Locale mInitialLocale = Locale.getDefault(); private boolean mPreInflationStartupComplete; private boolean mPostInflationStartupComplete; private boolean mNativeInitializationComplete; // Public to allow use in ChromeBackupAgent public static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "chrome"; /** * A callback to be executed when there is a new version available in Play Store. */ public interface OnNewVersionAvailableCallback extends Runnable { /** * Set the update url to get the new version available. * @param updateUrl The url to be used. */ void setUpdateUrl(String updateUrl); } /** * This class is an application specific object that orchestrates the app initialization. * @param context The context to get the application context from. * @return The singleton instance of {@link ChromeBrowserInitializer}. */ public static ChromeBrowserInitializer getInstance(Context context) { if (sChromeBrowserInitializer == null) { sChromeBrowserInitializer = new ChromeBrowserInitializer(context); } return sChromeBrowserInitializer; } private ChromeBrowserInitializer(Context context) { mApplication = (ChromeApplication) context.getApplicationContext(); mHandler = new Handler(Looper.getMainLooper()); initLeakCanary(); } @RemovableInRelease private void initLeakCanary() { // Watch that Activity objects are not retained after their onDestroy() has been called. // This is a no-op in release builds. LeakCanary.install(mApplication); } /** * @return whether native initialization is complete. */ public boolean hasNativeInitializationCompleted() { return mNativeInitializationComplete; } /** * Initializes the Chrome browser process synchronously. * * @throws ProcessInitException if there is a problem with the native library. */ public void handleSynchronousStartup() throws ProcessInitException { handleSynchronousStartupInternal(false); } /** * Initializes the Chrome browser process synchronously with GPU process warmup. */ public void handleSynchronousStartupWithGpuWarmUp() throws ProcessInitException { handleSynchronousStartupInternal(true); } private void handleSynchronousStartupInternal(final boolean startGpuProcess) throws ProcessInitException { ThreadUtils.checkUiThread(); BrowserParts parts = new EmptyBrowserParts() { @Override public boolean shouldStartGpuProcess() { return startGpuProcess; } }; handlePreNativeStartup(parts); handlePostNativeStartup(false, parts); } /** * Execute startup tasks that can be done without native libraries. See {@link BrowserParts} for * a list of calls to be implemented. * @param parts The delegate for the {@link ChromeBrowserInitializer} to communicate * initialization tasks. */ public void handlePreNativeStartup(final BrowserParts parts) { ThreadUtils.checkUiThread(); ProcessInitializationHandler.getInstance().initializePreNative(); preInflationStartup(); parts.preInflationStartup(); if (parts.isActivityFinishing()) return; preInflationStartupDone(); parts.setContentViewAndLoadLibrary(() -> this.onInflationComplete(parts)); } /** * This is called after the layout inflation has been completed (in the callback sent to {@link * BrowserParts#setContentViewAndLoadLibrary}). This continues the post-inflation pre-native * startup tasks. Namely {@link BrowserParts#postInflationStartup()}. * @param parts The {@link BrowserParts} that has finished layout inflation */ private void onInflationComplete(final BrowserParts parts) { if (parts.isActivityFinishing()) return; postInflationStartup(); parts.postInflationStartup(); } /** * This is needed for device class manager which depends on commandline args that are * initialized in preInflationStartup() */ private void preInflationStartupDone() { // Domain reliability uses significant enough memory that we should disable it on low memory // devices for now. // TODO(zbowling): remove this after domain reliability is refactored. (crbug.com/495342) if (SysUtils.isLowEndDevice()) { CommandLine.getInstance().appendSwitch(ChromeSwitches.DISABLE_DOMAIN_RELIABILITY); } } /** * Pre-load shared prefs to avoid being blocked on the disk access async task in the future. * Running in an AsyncTask as pre-loading itself may cause I/O. */ private void warmUpSharedPrefs() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... params) { ContextUtils.getAppSharedPreferences(); DocumentTabModelImpl.warmUpSharedPrefs(mApplication); ActivityAssigner.warmUpSharedPrefs(mApplication); DownloadManagerService.warmUpSharedPrefs(mApplication); return null; } }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else { ContextUtils.getAppSharedPreferences(); DocumentTabModelImpl.warmUpSharedPrefs(mApplication); ActivityAssigner.warmUpSharedPrefs(mApplication); DownloadManagerService.warmUpSharedPrefs(mApplication); } } private void preInflationStartup() { ThreadUtils.assertOnUiThread(); if (mPreInflationStartupComplete) return; PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX); // Ensure critical files are available, so they aren't blocked on the file-system // behind long-running accesses in next phase. // Don't do any large file access here! ChromeStrictMode.configureStrictMode(); ChromeWebApkHost.init(); warmUpSharedPrefs(); DeviceUtils.addDeviceSpecificUserAgentSwitch(mApplication); ApplicationStatus.registerStateListenerForAllActivities( createActivityStateListener()); mPreInflationStartupComplete = true; } private void postInflationStartup() { ThreadUtils.assertOnUiThread(); if (mPostInflationStartupComplete) return; // Check to see if we need to extract any new resources from the APK. This could // be on first run when we need to extract all the .pak files we need, or after // the user has switched locale, in which case we want new locale resources. ResourceExtractor.get().startExtractingResources(); mPostInflationStartupComplete = true; } /** * Execute startup tasks that require native libraries to be loaded. See {@link BrowserParts} * for a list of calls to be implemented. * @param isAsync Whether this call should synchronously wait for the browser process to be * fully initialized before returning to the caller. * @param delegate The delegate for the {@link ChromeBrowserInitializer} to communicate * initialization tasks. */ public void handlePostNativeStartup(final boolean isAsync, final BrowserParts delegate) throws ProcessInitException { assert ThreadUtils.runningOnUiThread() : "Tried to start the browser on the wrong thread"; if (!mPostInflationStartupComplete) { throw new IllegalStateException( "ChromeBrowserInitializer.handlePostNativeStartup called before " + "ChromeBrowserInitializer.postInflationStartup has been run."); } final ChainedTasks tasks = new ChainedTasks(); tasks.add(new Runnable() { @Override public void run() { ProcessInitializationHandler.getInstance().initializePostNative(); } }); tasks.add(new Runnable() { @Override public void run() { initNetworkChangeNotifier(mApplication.getApplicationContext()); } }); tasks.add(new Runnable() { @Override public void run() { // This is not broken down as a separate task, since this: // 1. Should happen as early as possible // 2. Only submits asynchronous work // 3. Is thus very cheap (profiled at 0.18ms on a Nexus 5 with Lollipop) // It should also be in a separate task (and after) initNetworkChangeNotifier, as // this posts a task to the UI thread that would interfere with preconneciton // otherwise. By preconnecting afterwards, we make sure that this task has run. delegate.maybePreconnect(); onStartNativeInitialization(); } }); tasks.add(new Runnable() { @Override public void run() { if (delegate.isActivityDestroyed()) return; delegate.initializeCompositor(); } }); tasks.add(new Runnable() { @Override public void run() { if (delegate.isActivityDestroyed()) return; delegate.initializeState(); } }); tasks.add(new Runnable() { @Override public void run() { onFinishNativeInitialization(); } }); tasks.add(new Runnable() { @Override public void run() { if (delegate.isActivityDestroyed()) return; delegate.finishNativeInitialization(); } }); if (isAsync) { // We want to start this queue once the C++ startup tasks have run; allow the // C++ startup to run asynchonously, and set it up to start the Java queue once // it has finished. startChromeBrowserProcessesAsync(delegate.shouldStartGpuProcess(), delegate.startServiceManagerOnly(), new BrowserStartupController.StartupCallback() { @Override public void onFailure() { delegate.onStartupFailure(); } @Override public void onSuccess() { tasks.start(false); } }); } else { startChromeBrowserProcessesSync(); tasks.start(true); } } private void startChromeBrowserProcessesAsync(boolean startGpuProcess, boolean startServiceManagerOnly, BrowserStartupController.StartupCallback callback) throws ProcessInitException { try { TraceEvent.begin("ChromeBrowserInitializer.startChromeBrowserProcessesAsync"); getBrowserStartupController().startBrowserProcessesAsync( startGpuProcess, startServiceManagerOnly, callback); } finally { TraceEvent.end("ChromeBrowserInitializer.startChromeBrowserProcessesAsync"); } } private void startChromeBrowserProcessesSync() throws ProcessInitException { try { TraceEvent.begin("ChromeBrowserInitializer.startChromeBrowserProcessesSync"); ThreadUtils.assertOnUiThread(); StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads(); LibraryLoader.getInstance().ensureInitialized(LibraryProcessType.PROCESS_BROWSER); StrictMode.setThreadPolicy(oldPolicy); LibraryLoader.getInstance().asyncPrefetchLibrariesToMemory(); getBrowserStartupController().startBrowserProcessesSync(false); GoogleServicesManager.get(mApplication); } finally { TraceEvent.end("ChromeBrowserInitializer.startChromeBrowserProcessesSync"); } } private BrowserStartupController getBrowserStartupController() { if (sBrowserStartupController == null) { sBrowserStartupController = BrowserStartupController.get(LibraryProcessType.PROCESS_BROWSER); } return sBrowserStartupController; } public static void initNetworkChangeNotifier(Context context) { ThreadUtils.assertOnUiThread(); TraceEvent.begin("NetworkChangeNotifier.init"); // Enable auto-detection of network connectivity state changes. NetworkChangeNotifier.init(); NetworkChangeNotifier.setAutoDetectConnectivityState(true); TraceEvent.end("NetworkChangeNotifier.init"); } private void onStartNativeInitialization() { ThreadUtils.assertOnUiThread(); if (mNativeInitializationComplete) return; // The policies are used by browser startup, so we need to register the policy providers // before starting the browser process. AppHooks.get().registerPolicyProviders(CombinedPolicyProvider.get()); SpeechRecognition.initialize(mApplication); ClassRegister.get().registerContentClassFactory(); } private void onFinishNativeInitialization() { if (mNativeInitializationComplete) return; mNativeInitializationComplete = true; ContentUriUtils.setFileProviderUtil(new FileProviderHelper()); // When a minidump is detected, extract and append a logcat to it, then upload it to the // crash server. Note that the logcat extraction might fail. This is ok; in that case, the // minidump will be found and uploaded upon the next browser launch. CrashDumpManager.registerUploadCallback(new CrashDumpManager.UploadMinidumpCallback() { @Override public void tryToUploadMinidump(File minidump) { AsyncTask.THREAD_POOL_EXECUTOR.execute(new LogcatExtractionRunnable(minidump)); } }); MemoryPressureUma.initializeForBrowser(); } private ActivityStateListener createActivityStateListener() { return new ActivityStateListener() { @Override public void onActivityStateChange(Activity activity, int newState) { if (newState == ActivityState.CREATED || newState == ActivityState.DESTROYED) { // Android destroys Activities at some point after a locale change, but doesn't // kill the process. This can lead to a bug where Chrome is halfway RTL, where // stale natively-loaded resources are not reloaded (http://crbug.com/552618). if (!mInitialLocale.equals(Locale.getDefault())) { Log.e(TAG, "Killing process because of locale change."); Process.killProcess(Process.myPid()); } } } }; } /** * For unit testing of clients. * @param initializer The (dummy or mocked) initializer to use. */ public static void setForTesting(ChromeBrowserInitializer initializer) { sChromeBrowserInitializer = initializer; } /** * Set {@link BrowserStartupController) to use for unit testing. * @param controller The (dummy or mocked) {@link BrowserStartupController) instance. */ public static void setBrowserStartupControllerForTesting(BrowserStartupController controller) { sBrowserStartupController = controller; } }
[ "team@geometry.ee" ]
team@geometry.ee
9823b8a58783fdb777ada6e9efd9b2fe51280663
01f5d27ed6bc3094712a5c38952663c6446ea0a1
/Scheduling/src/LagrangianSolver/LagrangianUnweightedLocalSearch.java
fbaaf02c3cbb6c199ee88b8a43abc12411c628b3
[]
no_license
mattzav/Lagrangian_Scheduling
2397c84b5438c4bb1f9566b7b961a20c5f859ca9
10ba71c7e7ddeae321264da67fdc019f59e156fe
refs/heads/master
2023-01-22T00:58:10.651431
2020-12-07T16:13:03
2020-12-07T16:13:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
16,027
java
package LagrangianSolver; import java.io.File; import java.io.IOException; import java.util.Random; import ilog.concert.*; import ilog.cplex.*; import ilog.cplex.IloCplex.UnknownObjectException; import jxl.Workbook; import jxl.write.Label; import jxl.write.Number; import jxl.write.WritableSheet; import jxl.write.WritableWorkbook; import jxl.write.WriteException; //controllare se migliora la corrispondenza tra w e x public class LagrangianUnweightedLocalSearch { private static final String EXCEL_FILE_LOCATION = "C:\\Users\\Matte\\Dropbox\\Scheduling\\Job diversi\\Articolo\\Risultati Numerici\\Unweighted\\lambda = "; static WritableWorkbook workBook = null; static WritableSheet excelSheet; public static double[] d;// public static double alpha, beta, v; public static double[][] gamma, delta, epsilon; public static int p[]; // public static double w[][]; public static double Pa, Pb; public static double x_val[][]; public static double subgradientLength; public static double subgrad_alpha = 0., subgrad_beta = 0; public static double[][] subgrad_gamma, subgrad_delta, subgrad_epsilon; public static int n, nA, nB; public static int countIter, lastIter, exchange; public static long start, timeToBest; public static double timeLimit; public static int seed = 953; public static Random r; public static double bestUB = Double.MAX_VALUE, bestLB = -Double.MAX_VALUE, currUB, currLB, maxBound; public static int[] currentSolution; public static double sumA, sumB; public static double[] timeSol; public static void main(String[] args) { r = new Random(); // create CPLEX environment IloCplex cplex; try { cplex = new IloCplex(); cplex.setOut(null); for (int pow = 0; pow <= 1; pow++) { for (nA = 100; nA <= 100; nA += 50) { for (nB = nA + 50; nB <= nA + 50; nB += 10) { n = nA + nB; // create Excel file // createExcelFile(pow, nA, nB); int excelRow = 1; // create binary x variables IloNumVar[][] x = new IloNumVar[n][]; for (int i = 0; i < n; i++) x[i] = cplex.numVarArray(n, 0, Double.MAX_VALUE); for (int scenario = 0; scenario < 1; scenario++) { initParam(Math.pow(10, pow)); // init parameters start = System.currentTimeMillis(); computeMaxBound(); // compute an upper bound on the value of V while (Math.abs(bestUB) > Math.pow(10, -6) && (System.currentTimeMillis() - start) / 1000 < timeLimit) { countIter++; createRelaxationModel(cplex, x, n); // create the relaxation model if (cplex.solve()) { // printMultipliers(); computeOptimalWandV(cplex, x); // compute the optimal value of W and V w.r.t. x updateBounds(cplex); // update current/best lower/upper bound improveSolution(); computeSubGrad(); // compute the value of subgradient updateMultipliers(); // update multipliers // printParam(); } cplex.clearModel(); } long timeToExit = System.currentTimeMillis() - start; // add to file Excel the results // addValueToExcelFile(excelRow, Math.pow(10, pow), timeToExit); excelRow++; System.out.println("n = " + n + ", nA = " + nA + ", nB = " + nB + ", lambda_i = " + Math.pow(10, pow) + ", N.iter = " + lastIter + " , Obj = " + bestUB + " ," + (double) timeToBest / 1000 + ", " + (double) timeToExit / 1000 + ", " + (seed - 1)); } // close excel file closeExcelFile(); } } seed = 953; } } catch (IloException e) { System.err.println("MAIN ERROR"); } } private static void improveSolution() { // System.out.println("BEFORE SEARCHING \n"); // // System.out.println("--------"); // System.out.println("X SOLUTION"); // for (int i = 0; i < n; i++) // for (int j = 0; j < n; j++) // if (x_val[i][j] >= 1 - Math.pow(10, -5)) // System.out.print("x_{" + i + "," + j + "} = " + x_val[i][j]); // // System.out.println("--------"); // System.out.println("VECTOR SOLUTION"); // for (int i = 0; i < n; i++) // System.out.println("job " + currentSolution[i] + " in pos " + i); // System.out.println("--------"); // System.out.println("UB = " + currUB); // System.out.println("-------"); for (int i = 0; i < n - 1; i++) { double newSumA = sumA; double newSumB = sumB; if (currentSolution[i] < nA) newSumA += p[currentSolution[i + 1]]; else newSumB += p[currentSolution[i + 1]]; if (currentSolution[i + 1] < nA) newSumA -= p[currentSolution[i]]; else newSumB -= p[currentSolution[i]]; if (Math.abs(newSumA / nA - newSumB / nB) < currUB) { exchange++; currUB = Math.abs(newSumA / nA - newSumB / nB); lastIter = countIter; int toExchange = currentSolution[i]; currentSolution[i] = currentSolution[i + 1]; currentSolution[i + 1] = toExchange; // x_val[currentSolution[i]][i] = 0; // x_val[currentSolution[i]][i + 1] = 1; // // x_val[currentSolution[i + 1]][i] = 1; // x_val[currentSolution[i + 1]][i + 1] = 0; sumA = newSumA; sumB = newSumB; if (currUB < bestUB) { timeToBest = System.currentTimeMillis() - start; bestUB = currUB; if (bestUB == 0) break; } } } // System.out.println("AFTER SEARCHING \n"); // // System.out.println("--------"); // // System.out.println("VECTOR AFTER SEARCH"); // for (int i = 0; i < n; i++) // System.out.println("job " + currentSolution[i] + " in pos " + i); // // System.out.println("UB =" + bestUB); // System.out.println("--------"); // if(bestUB!=before) // System.out.println("before = "+before+ " after = "+bestUB); } private static void closeExcelFile() { if (workBook != null) { try { workBook.write(); workBook.close(); } catch (IOException e) { e.printStackTrace(); } catch (WriteException e) { e.printStackTrace(); } } } private static void addValueToExcelFile(int excelRow, double lambda, long timeToExit) { try { Number number = new Number(0, excelRow, nA); excelSheet.addCell(number); number = new Number(1, excelRow, nB); excelSheet.addCell(number); number = new Number(2, excelRow, lambda); excelSheet.addCell(number); number = new Number(3, excelRow, lastIter); excelSheet.addCell(number); number = new Number(4, excelRow, bestUB); excelSheet.addCell(number); String optimum = "YES"; if (Math.abs(bestUB) > Math.pow(10, -6)) optimum = "-"; Label label = new Label(5, excelRow, optimum); excelSheet.addCell(label); number = new Number(6, excelRow, (double) timeToBest / 1000); excelSheet.addCell(number); number = new Number(7, excelRow, (double) timeToExit / 1000); excelSheet.addCell(number); number = new Number(8, excelRow, seed - 1); excelSheet.addCell(number); number = new Number(9, excelRow, (double) exchange / countIter); excelSheet.addCell(number); for (int i = 15; i < 15 + n; i++) excelSheet.addCell(new Number(i, excelRow, p[i - 15])); // // for (int i = 0; i < 100; i++) // excelSheet.addCell(new Number(i, 61 + excelRow, timeSol[i])); } catch (Exception e) { throw new RuntimeException("Error adding excel value"); } } private static void createExcelFile(int pow, int nA, int nB) { try { String path = EXCEL_FILE_LOCATION + String.valueOf((int) Math.pow(10, pow)) + "\\" + nA + "_" + nB + ".xls"; System.out.println("\n \n"); System.out.println("-----------------------------------"); System.out.println("PATH = " + path); System.out.println(); workBook = Workbook.createWorkbook(new File(path)); // create an Excel sheet excelSheet = workBook.createSheet("Lagrangian Results", 0); // add header into the Excel sheet Label label = new Label(0, 0, "nA"); excelSheet.addCell(label); label = new Label(1, 0, "nB"); excelSheet.addCell(label); label = new Label(2, 0, "Lambda_0"); excelSheet.addCell(label); label = new Label(3, 0, "N. Iter"); excelSheet.addCell(label); label = new Label(4, 0, "Best UB"); excelSheet.addCell(label); label = new Label(5, 0, "Optimum"); excelSheet.addCell(label); label = new Label(6, 0, "Time To Best"); excelSheet.addCell(label); label = new Label(7, 0, "Time To Exit"); excelSheet.addCell(label); label = new Label(8, 0, "Seed"); excelSheet.addCell(label); label = new Label(9, 0, "AVG exchange"); excelSheet.addCell(label); } catch (Exception e) { throw new RuntimeException("error creating excel file"); } } private static void createRelaxationModel(IloCplex cplex, IloNumVar[][] x, int n) throws IloException { IloLinearNumExpr fo = cplex.linearNumExpr(); double coefficients[][] = new double[n][n]; // for (int i = 0; i < n; i++) // for (int j = 0; j < n; j++) // coefficients[i][j] = 0.; for (int t = 0; t < n; t++) for (int j = 0; j < n; j++) { coefficients[j][t] += ((gamma[j][t] - epsilon[j][t]) * d[t]); for (int l = 0; l < n; l++) for (int k = 0; k < t; k++) { coefficients[l][k] += ((gamma[j][t] - delta[j][t]) * p[l]); } } for (int t = 0; t < n; t++) { cplex.addEq(cplex.sum(x[t]), 1); IloLinearNumExpr t_th_constraint = cplex.linearNumExpr(); for (int j = 0; j < n; j++) { fo.addTerm(coefficients[t][j], x[t][j]); t_th_constraint.addTerm(1, x[j][t]); } cplex.addEq(1, t_th_constraint); } cplex.addMinimize(fo); } private static void computeMaxBound() { double current = 0; double sA = 0, sB = 0; int countA = 0; int countB = 0; for (int i = 0; i < n; i++) { if (countB == nB) { current += p[countA]; sA += current; countA++; } else if (countA == nA) { current += p[nA + countB]; sB += current; countB++; } else if (i % 2 == 0) { current += p[countA]; sA += current; countA++; } else { current += p[nA + countB]; sB += current; countB++; } } maxBound = Math.max(sA / nA - sB / nB, sB / nB - sA / nA); } // private static void printMultipliers() { // for (int i = 0; i < n; i++) // for (int j = 0; j < n; j++) { // System.out.println("gamma_{" + i + "," + j + "} = " + gamma[i][j]); // System.out.println("delta{" + i + "," + j + "} = " + delta[i][j]); // System.out.println("eps{" + i + "," + j + "} = " + epsilon[i][j]); // } // } // private static void printParam() { // System.out.println("alpha = " + alpha); // System.out.println("beta = " + beta); // System.out.println("v = " + v); // for (int i = 0; i < n; i++) { // for (int j = 0; j < n; j++) { // if (x_val[i][j] == 1.) // System.out.println("x_{" + i + "," + j + "} = " + x_val[i][j]); // System.out.println("w_{" + i + "," + j + "} = " + w[i][j]); // // System.out.println("subgamma_{" + i + "," + j + "} = " + subgrad_gamma[i][j]); // System.out.println("subdelta{" + i + "," + j + "} = " + subgrad_delta[i][j]); // System.out.println("subeps{" + i + "," + j + "} = " + subgrad_epsilon[i][j]); // // System.out.println("gamma_{" + i + "," + j + "} = " + gamma[i][j] + " "); // System.out.print("delta{" + i + "," + j + "} = " + delta[i][j] + " "); // System.out.println("eps{" + i + "," + j + "} = " + epsilon[i][j] + " "); // } // System.out.println(); // } // System.out.println("grad norm " + computeGradientLength()); // System.out.println("LB" + bestLb); // System.out.println("UB" + bestUb); // } private static void updateBounds(IloCplex cplex) throws IloException { double lb = cplex.getObjValue(); for (int t = 0; t < n; t++) { for (int j = 0; j < nA; j++) { lb += (w[j][t] * (alpha / nA - beta / nA - gamma[j][t] + delta[j][t] + epsilon[j][t])); lb -= (d[t] * gamma[j][t]); } for (int j = nA; j < n; j++) { lb += (w[j][t] * (beta / nB - alpha / nB - gamma[j][t] + delta[j][t] + epsilon[j][t])); lb -= (d[t] * gamma[j][t]); } } lb += ((Pa / nA) * (alpha - beta)); lb -= ((Pb / nB) * (alpha - beta)); lb += (v * (1 - alpha - beta)); currLB = lb; if (lb > bestLB) { bestLB = lb; } sumA = 0; sumB = 0; double current = 0; for (int t = 0; t < n; t++) for (int j = 0; j < n; j++) if (x_val[j][t] >= 1 - Math.pow(10, -6)) { current += p[j]; currentSolution[t] = j; if (j < nA) sumA += current; else sumB += current; break; } double ub = Math.max(sumA / nA - sumB / nB, sumB / nB - sumA / nA); currUB = ub; if (ub < bestUB) { lastIter = countIter; bestUB = ub; timeToBest = System.currentTimeMillis() - start; } } private static void updateMultipliers() { double factor = (-currLB) / subgradientLength; alpha = Math.max(0, alpha + subgrad_alpha * factor); beta = Math.max(0, beta + subgrad_beta * factor); for (int j = 0; j < n; j++) for (int t = 0; t < n; t++) { gamma[j][t] = Math.max(0, gamma[j][t] + subgrad_gamma[j][t] * factor); delta[j][t] = Math.max(0, delta[j][t] + subgrad_delta[j][t] * factor); epsilon[j][t] = Math.max(0, epsilon[j][t] + subgrad_epsilon[j][t] * factor); } } private static void computeSubGrad() { subgrad_alpha = 0; subgrad_beta = 0; subgradientLength = 0; double toAdd = 0; for (int t = 0; t < n; t++) { for (int j = 0; j < n; j++) { if (j < nA) { subgrad_alpha += w[j][t] / nA; subgrad_beta -= w[j][t] / nA; } else { subgrad_alpha -= w[j][t] / nB; subgrad_beta += w[j][t] / nB; } subgrad_gamma[j][t] = d[t] * x_val[j][t]; subgrad_gamma[j][t] -= (w[j][t] + d[t]); subgrad_delta[j][t] = w[j][t]; subgrad_epsilon[j][t] = w[j][t] - d[t] * x_val[j][t]; subgrad_gamma[j][t] += toAdd; subgrad_delta[j][t] -= toAdd; subgradientLength += Math.pow(subgrad_gamma[j][t], 2); subgradientLength += Math.pow(subgrad_delta[j][t], 2); subgradientLength += Math.pow(subgrad_epsilon[j][t], 2); } for (int l = 0; l < n; l++) if (x_val[l][t] == 1.) toAdd += p[l]; } subgrad_alpha += Pa / nA; subgrad_alpha -= Pb / nB; subgrad_alpha -= v; subgrad_beta -= Pa / nA; subgrad_beta += Pb / nB; subgrad_beta -= v; subgradientLength += Math.pow(subgrad_alpha, 2); subgradientLength += Math.pow(subgrad_beta, 2); } private static void computeOptimalWandV(IloCplex cplex, IloNumVar[][] x) throws UnknownObjectException, IloException { for (int i = 0; i < n; i++) x_val[i] = cplex.getValues(x[i]); if (1 - alpha - beta >= 0) v = 0; else v = maxBound; for (int t = 0; t < n; t++) { for (int j = 0; j < nA; j++) if (alpha / nA - beta / nA - gamma[j][t] + delta[j][t] + epsilon[j][t] >= 0) w[j][t] = 0.; else w[j][t] = d[t]; for (int j = nA; j < n; j++) if (beta / nB - alpha / nB - gamma[j][t] + delta[j][t] + epsilon[j][t] >= 0) w[j][t] = 0.; else w[j][t] = d[t]; } } private static void initParam(Double init) { subgrad_alpha = 0.; subgrad_beta = 0; timeLimit = 1800; subgradientLength = 0; exchange = 0; countIter = 0; lastIter = 0; bestUB = Double.MAX_VALUE; bestLB = -Double.MAX_VALUE; currUB = 0.; currLB = 0.; maxBound = 0.; sumA = 0.; sumB = 0.; currentSolution = new int[n]; p = new int[n]; d = new double[n]; gamma = new double[n][n]; delta = new double[n][n]; epsilon = new double[n][n]; w = new double[n][n]; x_val = new double[n][n]; subgrad_gamma = new double[n][n]; subgrad_delta = new double[n][n]; subgrad_epsilon = new double[n][n]; r.setSeed(seed); seed++; for (int i = 0; i < n; i++) { p[i] = r.nextInt(25) + 1; r.nextInt(); } Pa = 0; Pb = 0; for (int i = 0; i < nA; i++) Pa += p[i]; for (int i = nA; i < n; i++) Pb += p[i]; alpha = init; beta = init; for (int i = 0; i < n; i++) { d[i] = i * (Pa + Pb); for (int j = 0; j < n; j++) { gamma[i][j] = init; delta[i][j] = init; epsilon[i][j] = init; } } } }
[ "matteozav@hotmail.com" ]
matteozav@hotmail.com
5e3f8da61023033f9ad8d16450aab252465c4403
5b19ab89fd6bec8dac0330c7779ad300a2998efe
/src/test/java/com/pkstudio/hive/jbehave/Steps.java
74ca33a46faa7a3e1a5810c005ddd60a83c96297
[]
no_license
sidzej666/HiveServerTests
b81064d6aff4327e3d1e917dc101e08005b389ca
ff4050afe5a87719c1c54842fedc35bc1ffe3a5a
refs/heads/master
2020-04-09T20:08:05.587123
2015-02-05T18:56:17
2015-02-05T18:56:17
30,215,364
0
0
null
null
null
null
UTF-8
Java
false
false
430
java
package com.pkstudio.hive.jbehave; 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; import org.springframework.stereotype.Component; @Target(value=ElementType.TYPE) @Retention(value=RetentionPolicy.RUNTIME) @Documented @Component public @interface Steps { }
[ "pawel.kutesko@gmail.com" ]
pawel.kutesko@gmail.com
b0eda5d3d8a00460e46f5fa71d0b47ec3eb969c6
7d2b11021dbb30674c91f8fe824555aa0cc9e9fe
/src/test/java/com/acabra/gtechdevalgs/google/NumberOfIslands2UnionFindTest.java
048f59cf9020a40218c06f3352f5d913e7af592b
[ "MIT" ]
permissive
acabra85/googleTechDevAlgs
f159670294b1724b5b90e909f59e1902b8800396
3e22940ffc44cea3ea7a6cef034a9a293b3f480a
refs/heads/master
2023-03-12T09:31:52.578842
2023-03-05T14:13:56
2023-03-05T14:13:56
167,084,157
1
0
MIT
2020-10-13T12:10:56
2019-01-22T23:35:14
Java
UTF-8
Java
false
false
3,889
java
package com.acabra.gtechdevalgs.google; import org.hamcrest.core.Is; import org.hamcrest.MatcherAssert; import org.junit.Before; import org.junit.Test; import java.util.Arrays; import java.util.Collections; import java.util.List; public class NumberOfIslands2UnionFindTest { private NumberOfIslands2UnionFind underTest; @Before public void setup() { underTest = new NumberOfIslands2UnionFind(); } @Test public void numIslands2_unionFind_1() { List<Integer> expected = Arrays.asList(1, 2, 3, 4, 5, 3, 2, 1, 1); int[][] positions = {{0, 0}, {0, 2}, {2, 0}, {2, 2}, {1, 1} ,{0, 1}, {1, 0}, {2, 1}, {1, 2}}; List<Integer> actual = underTest.numIslands2(3, 3, positions); MatcherAssert.assertThat(actual.size(), Is.is(expected.size())); for (int i = 0; i < actual.size(); ++i) { MatcherAssert.assertThat(actual.get(i), Is.is(expected.get(i))); } } @Test public void numIslands2_unionFind_2() { List<Integer> expected = Arrays.asList(1, 2, 3, 4, 5, 3, 2, 1, 1); int[][] positions = {{0, 0}, {0, 2}, {2, 0}, {2, 2}, {1, 1} ,{0, 1}, {1, 0}, {2, 1}, {1, 2}}; List<Integer> actual = underTest.numIslands2(3, 3, positions); MatcherAssert.assertThat(actual.size(), Is.is(expected.size())); for (int i = 0; i < actual.size(); ++i) { MatcherAssert.assertThat(actual.get(i), Is.is(expected.get(i))); } } @Test public void numIslands2_unionFind_3() { List<Integer> expected = Collections.singletonList(1); int[][] positions = {{7, 0}}; List<Integer> actual = underTest.numIslands2(8, 2, positions); MatcherAssert.assertThat(actual.size(), Is.is(expected.size())); for (int i = 0; i < actual.size(); ++i) { MatcherAssert.assertThat(actual.get(i), Is.is(expected.get(i))); } } @Test public void numIslands2_unionFind_4() { NumberOfIslands2Utils.TestInputObject testInputObject = NumberOfIslands2Utils.getNumberOfIslands2TestData4(); int rows = testInputObject.getRows(); int cols = testInputObject.getCols(); int[][] positions = testInputObject.getPositions(); List<Integer> actual = underTest.numIslands2(rows, cols, positions); MatcherAssert.assertThat(actual.size(), Is.is(testInputObject.getExpected().size())); for (int i = 0; i < actual.size(); ++i) { MatcherAssert.assertThat(actual.get(i), Is.is(testInputObject.getExpected().get(i))); } } @Test public void numIslands2_unionFind_5() { NumberOfIslands2Utils.TestInputObject testInputObject = NumberOfIslands2Utils.getNumberOfIslands2TestData5(); int rows = testInputObject.getRows(); int cols = testInputObject.getCols(); int[][] positions = testInputObject.getPositions(); List<Integer> actual = underTest.numIslands2(rows, cols, positions); MatcherAssert.assertThat(actual.size(), Is.is(testInputObject.getExpected().size())); for (int i = 0; i < actual.size(); ++i) { MatcherAssert.assertThat(actual.get(i), Is.is(testInputObject.getExpected().get(i))); } } @Test public void numIslands2_unionFind_6() { NumberOfIslands2Utils.TestInputObject testInputObject = NumberOfIslands2Utils.getNumberOfIslands2TestData6(); int rows = testInputObject.getRows(); int cols = testInputObject.getCols(); int[][] positions = testInputObject.getPositions(); List<Integer> actual = underTest.numIslands2(rows, cols, positions); MatcherAssert.assertThat(actual.size(), Is.is(testInputObject.getExpected().size())); for (int i = 0; i < actual.size(); ++i) { MatcherAssert.assertThat(actual.get(i), Is.is(testInputObject.getExpected().get(i))); } } }
[ "cabra.agustin@gmail.com" ]
cabra.agustin@gmail.com
fbc31fe50e53c5dee6551ae852273958c9a26213
126f247e14fb880012f396ee8172ab40fdf829c5
/src/com/servlet/StudentAddServlet.java
f2d2b7dd47f345217a46643f82195709a7f3c861
[]
no_license
Lidalin1233/test
832f60e77166ca0d3a4c26af083a118643c0365a
90e5b93341aa68a4614408ae574f85157c6fc2be
refs/heads/master
2020-05-22T21:56:48.902653
2019-05-14T07:37:16
2019-05-14T07:37:16
186,538,298
0
0
null
null
null
null
UTF-8
Java
false
false
1,467
java
package com.servlet; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.entry.Student; import com.service.StudentService; /** * Servlet implementation class LoginServlet */ @WebServlet("/StudentAddServlet") public class StudentAddServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ StudentService cls=new StudentService(); protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String code = request.getParameter("code"); String name = request.getParameter("name"); String tel = request.getParameter("tel"); String addr = request.getParameter("addr"); String forclass=request.getParameter("studentname"); Student s=new Student(); s.setCode(code); s.setForclass(forclass); s.setTel(tel); s.setAddr(addr); s.setName(name); cls.add(s); request.setAttribute("pageNow", new Integer(1)); request.getRequestDispatcher("studentqueryservlet").forward(request, response); } }
[ "Administrator@WJX-20170614AYY" ]
Administrator@WJX-20170614AYY
147b6da14c615067e17f5365a513741a27808c07
af27db1fc912f895cdcf6775c8e69bceafdb83ea
/app/src/main/java/com/example/android_mycart/adapter/ProductAdapter.java
13b8ef98043166eb4877fd581aabeece1006489f
[]
no_license
ankit0896/android-mycart
c3c8aaea8574b386634b382f548381a24e7a6739
3a4fabda73297a4e6a8cbbf972315fc568288de3
refs/heads/master
2022-12-20T07:32:35.796386
2020-09-18T10:03:20
2020-09-18T10:03:20
296,575,400
0
0
null
2020-09-18T10:03:21
2020-09-18T09:26:17
Java
UTF-8
Java
false
false
4,374
java
package com.example.android_mycart.adapter; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.example.android_mycart.R; import com.example.android_mycart.database.SqliteHelper; import com.example.android_mycart.model.Product; import java.util.ArrayList; import java.util.List; import de.hdodenhof.circleimageview.CircleImageView; public class ProductAdapter extends RecyclerView.Adapter<ProductAdapter.ProductViewHolder> { Context context; List<Product> productList = new ArrayList<>(); SqliteHelper sqliteHelper; public ProductAdapter(Context context, List<Product> productList) { this.context = context; this.productList = productList; sqliteHelper = new SqliteHelper(context); } @NonNull @Override public ProductViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.custom_product_layout, parent, false); return new ProductViewHolder(view); } @Override public void onBindViewHolder(@NonNull final ProductViewHolder holder, final int position) { final Product product = productList.get(position); holder.name.setText(product.getName()); holder.price.setText("Rs "+product.getPrice()+"/-"); holder.pic.setImageResource(product.getImage()); holder.plus.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int quantity= new Integer((String) holder.quantity.getText()); setIncreament(holder,quantity); } }); holder.minus.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int quanity= new Integer((String) holder.quantity.getText()); if(quanity==0){ Toast.makeText(context, "Quantity Cannot be Neagative !!", Toast.LENGTH_SHORT).show(); }else{ setDecrement(holder,quanity); } } }); holder.button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int quanity= new Integer((String) holder.quantity.getText()); if(quanity==0){ Toast.makeText(context, "Add Some Quantity !!", Toast.LENGTH_SHORT).show(); }else{ Product product1 = new Product(); product1.setId(product.getId()); product1.setName(product.getName()); product1.setPrice(product.getPrice()); product1.setQuantity(Integer.valueOf((String) holder.quantity.getText())); sqliteHelper.insertProduct(product1,context); holder.quantity.setText(""+0); } } }); } private void setDecrement(ProductViewHolder holder, int quanity) { quanity--; holder.quantity.setText(""+quanity); } private void setIncreament(ProductViewHolder holder, int quantity) { quantity++; holder.quantity.setText(""+quantity); } @Override public int getItemCount() { return productList.size(); } public class ProductViewHolder extends RecyclerView.ViewHolder { ImageView plus,minus; TextView name,price,quantity; CircleImageView pic; Button button; public ProductViewHolder(@NonNull View itemView) { super(itemView); plus = itemView.findViewById(R.id.iv_add); minus = itemView.findViewById(R.id.iv_remove); name = itemView.findViewById(R.id.tv_product_name); price = itemView.findViewById(R.id.tv_product_price); pic = itemView.findViewById(R.id.iv_product); button = itemView.findViewById(R.id.btn_Add_to_cart); quantity = itemView.findViewById(R.id.tv_quantity_product); } } }
[ "officialap0896@gmail.com" ]
officialap0896@gmail.com
be4ccfdce439318866ebc07755a759834f5dbf7c
b7b98978f30e5d89ad5f8b6bd3f3caf9a48b9be6
/src/GpTriplets.java
12cc46eb4c141906f1f2abfc0562e4ef0c3caecf
[]
no_license
abhinavdas1/LeetCode
78dfce12f7e694477263452849291f9fc8cf57ce
b9c3c8bdfab954a25a14949a89fd333d80ba2b60
refs/heads/master
2021-01-22T03:40:47.056640
2017-12-01T00:32:23
2017-12-01T00:32:23
92,394,996
0
0
null
null
null
null
UTF-8
Java
false
false
649
java
/** * Created by abhinavdas on 11/20/16. */ class GpTriplets { public static int answer( int[] l) { int count = 0; int[] step1 = new int[l.length]; for (int i = 1; i < l.length - 1; ++i) { for (int j = 0; j < i; ++j) { if (l[i] % l[j] == 0) ++step1[i]; } } for (int i = 2; i < l.length; i++) { for (int j = 1; j < i; ++j) { if (l[i] % l[j] == 0) count += step1[j]; } } return count; } }
[ "iabhinavdas@gmail.com" ]
iabhinavdas@gmail.com
6da93e46891e528459fea77b5e2742f4e01d6a33
fd88489cb2e9c345135e31d4f8a59579a5ffad9c
/src/main/java/com/bailihui/shop/pojo/TbUser.java
069d3778e164b92f532fdd9208a6283f33012ab8
[]
no_license
Cnlomou/bailihui-shop
cf579f0024e77bbc8b4e6e518cfad5d3c33e9bae
30a027010dcf447817f116ac563189508596a91f
refs/heads/master
2022-12-29T20:30:32.060907
2020-10-22T02:38:44
2020-10-22T02:38:44
306,201,060
0
0
null
null
null
null
UTF-8
Java
false
false
557
java
package com.bailihui.shop.pojo; import java.util.Date; import javax.persistence.*; import lombok.Data; /** * @author Cnlomou * @create 2020/5/25 20:22 */ @Data @Table(name = "tb_user") public class TbUser { @Id @Column(name = "id") private Integer id; /** * 用户标识 */ @Column(name = "userId") private String userid; /** * 收货地址 */ @Column(name = "address") private String address; /** * 创建时间 */ @Column(name = "createTime") private Date createtime; }
[ "1246269795@qq.com" ]
1246269795@qq.com
7396eff312904a16fd9e97548eee2c905eb7a1cb
cba56340735b3347c3fae1b46b747668e5d027f8
/src/tss/tpm/TPMS_ASYM_PARMS.java
d2b6b7c4c4c964150df4bbad2bf97a82abff78f8
[ "MIT" ]
permissive
kvnmlr/tpm2.0-playground
7cadd974ff27c231cfc6165056bca5b97e9db1fa
9b423b5ef8fc8e697b9276ff6bfcb118be45573f
refs/heads/master
2021-07-04T22:05:18.745386
2017-09-25T20:32:21
2017-09-25T20:32:21
104,788,255
2
0
null
null
null
null
UTF-8
Java
false
false
6,285
java
package tss.tpm; import tss.*; // -----------This is an auto-generated file: do not edit //>>> /** * This structure contains the common public area parameters for an asymmetric key. The first two parameters of the parameter definition structures of an asymmetric key shall have the same two first components. */ public class TPMS_ASYM_PARMS extends TpmStructure implements TPMU_PUBLIC_PARMS { /** * This structure contains the common public area parameters for an asymmetric key. The first two parameters of the parameter definition structures of an asymmetric key shall have the same two first components. * * @param _symmetric the companion symmetric algorithm for a restricted decryption key and shall be set to a supported symmetric algorithm This field is optional for keys that are not decryption keys and shall be set to TPM_ALG_NULL if not used. * @param _scheme for a key with the sign attribute SET, a valid signing scheme for the key type for a key with the decrypt attribute SET, a valid key exchange protocol for a key with sign and decrypt attributes, shall be TPM_ALG_NULL (One of TPMS_KEY_SCHEME_ECDH, TPMS_KEY_SCHEME_ECMQV, TPMS_SIG_SCHEME_RSASSA, TPMS_SIG_SCHEME_RSAPSS, TPMS_SIG_SCHEME_ECDSA, TPMS_SIG_SCHEME_ECDAA, TPMS_SIG_SCHEME_SM2, TPMS_SIG_SCHEME_ECSCHNORR, TPMS_ENC_SCHEME_RSAES, TPMS_ENC_SCHEME_OAEP, TPMS_SCHEME_HASH, TPMS_NULL_ASYM_SCHEME) */ public TPMS_ASYM_PARMS(TPMT_SYM_DEF_OBJECT _symmetric,TPMU_ASYM_SCHEME _scheme) { symmetric = _symmetric; scheme = _scheme; } /** * This structure contains the common public area parameters for an asymmetric key. The first two parameters of the parameter definition structures of an asymmetric key shall have the same two first components. */ public TPMS_ASYM_PARMS() {}; /** * the companion symmetric algorithm for a restricted decryption key and shall be set to a supported symmetric algorithm This field is optional for keys that are not decryption keys and shall be set to TPM_ALG_NULL if not used. */ public TPMT_SYM_DEF_OBJECT symmetric; /** * scheme selector */ // private TPM_ALG_ID schemeScheme; /** * for a key with the sign attribute SET, a valid signing scheme for the key type for a key with the decrypt attribute SET, a valid key exchange protocol for a key with sign and decrypt attributes, shall be TPM_ALG_NULL */ public TPMU_ASYM_SCHEME scheme; public int GetUnionSelector_scheme() { if(scheme instanceof TPMS_KEY_SCHEME_ECDH){return 0x0019; } if(scheme instanceof TPMS_KEY_SCHEME_ECMQV){return 0x001D; } if(scheme instanceof TPMS_SIG_SCHEME_RSASSA){return 0x0014; } if(scheme instanceof TPMS_SIG_SCHEME_RSAPSS){return 0x0016; } if(scheme instanceof TPMS_SIG_SCHEME_ECDSA){return 0x0018; } if(scheme instanceof TPMS_SIG_SCHEME_ECDAA){return 0x001A; } if(scheme instanceof TPMS_SIG_SCHEME_SM2){return 0x001B; } if(scheme instanceof TPMS_SIG_SCHEME_ECSCHNORR){return 0x001C; } if(scheme instanceof TPMS_ENC_SCHEME_RSAES){return 0x0015; } if(scheme instanceof TPMS_ENC_SCHEME_OAEP){return 0x0017; } if(scheme instanceof TPMS_SCHEME_HASH){return 0x7FFF; } if(scheme instanceof TPMS_NULL_ASYM_SCHEME){return 0x0010; } throw new RuntimeException("Unrecognized type"); } @Override public void toTpm(OutByteBuf buf) { symmetric.toTpm(buf); buf.writeInt(GetUnionSelector_scheme(), 2); ((TpmMarshaller)scheme).toTpm(buf); return; } @Override public void initFromTpm(InByteBuf buf) { symmetric = TPMT_SYM_DEF_OBJECT.fromTpm(buf); int _schemeScheme = buf.readInt(2); scheme=null; if(_schemeScheme==TPM_ALG_ID.ECDH.toInt()) {scheme = new TPMS_KEY_SCHEME_ECDH();} else if(_schemeScheme==TPM_ALG_ID.ECMQV.toInt()) {scheme = new TPMS_KEY_SCHEME_ECMQV();} else if(_schemeScheme==TPM_ALG_ID.RSASSA.toInt()) {scheme = new TPMS_SIG_SCHEME_RSASSA();} else if(_schemeScheme==TPM_ALG_ID.RSAPSS.toInt()) {scheme = new TPMS_SIG_SCHEME_RSAPSS();} else if(_schemeScheme==TPM_ALG_ID.ECDSA.toInt()) {scheme = new TPMS_SIG_SCHEME_ECDSA();} else if(_schemeScheme==TPM_ALG_ID.ECDAA.toInt()) {scheme = new TPMS_SIG_SCHEME_ECDAA();} // code generator workaround BUGBUG >> (probChild)else if(_schemeScheme==TPM_ALG_ID.SM2.toInt()) {scheme = new TPMS_SIG_SCHEME_SM2();} // code generator workaround BUGBUG >> (probChild)else if(_schemeScheme==TPM_ALG_ID.ECSCHNORR.toInt()) {scheme = new TPMS_SIG_SCHEME_ECSCHNORR();} else if(_schemeScheme==TPM_ALG_ID.RSAES.toInt()) {scheme = new TPMS_ENC_SCHEME_RSAES();} else if(_schemeScheme==TPM_ALG_ID.OAEP.toInt()) {scheme = new TPMS_ENC_SCHEME_OAEP();} else if(_schemeScheme==TPM_ALG_ID.ANY.toInt()) {scheme = new TPMS_SCHEME_HASH();} else if(_schemeScheme==TPM_ALG_ID.NULL.toInt()) {scheme = new TPMS_NULL_ASYM_SCHEME();} if(scheme==null)throw new RuntimeException("Unexpected type selector"); scheme.initFromTpm(buf); } @Override public byte[] toTpm() { OutByteBuf buf = new OutByteBuf(); toTpm(buf); return buf.getBuf(); } public static TPMS_ASYM_PARMS fromTpm (byte[] x) { TPMS_ASYM_PARMS ret = new TPMS_ASYM_PARMS(); InByteBuf buf = new InByteBuf(x); ret.initFromTpm(buf); if (buf.bytesRemaining()!=0) throw new AssertionError("bytes remaining in buffer after object was de-serialized"); return ret; } public static TPMS_ASYM_PARMS fromTpm (InByteBuf buf) { TPMS_ASYM_PARMS ret = new TPMS_ASYM_PARMS(); ret.initFromTpm(buf); return ret; } @Override public String toString() { TpmStructurePrinter _p = new TpmStructurePrinter("TPMS_ASYM_PARMS"); toStringInternal(_p, 1); _p.endStruct(); return _p.toString(); } @Override public void toStringInternal(TpmStructurePrinter _p, int d) { _p.add(d, "TPMT_SYM_DEF_OBJECT", "symmetric", symmetric); _p.add(d, "TPMU_ASYM_SCHEME", "scheme", scheme); }; }; //<<<
[ "kevin.mueller1@live.de" ]
kevin.mueller1@live.de
15a69ef9e27d634932158ad3102c6e29dd748c64
895184a634b269e1688d51e323cc9eb8860d0392
/app/src/main/java/com/qianfeng/yyz/zhonghuasuan/classify_second/presenter/ClassifySecondPresenter.java
2c04ba73c0d39096dd8838aad27e580f90c4e5d4
[]
no_license
yzzAndroid/ZhongHuaSuan
414af1d51c66d5783b38bab26e161accd1cc7de7
861e74012e20e5131354486bf08ff00b9d6c61d2
refs/heads/master
2020-02-26T15:55:29.156701
2016-10-25T09:06:26
2016-10-25T09:06:26
70,892,820
0
0
null
null
null
null
UTF-8
Java
false
false
2,108
java
package com.qianfeng.yyz.zhonghuasuan.classify_second.presenter; import com.qianfeng.yyz.zhonghuasuan.bean.EightGoodsBean; import com.qianfeng.yyz.zhonghuasuan.classify_second.model.ClassifySeconndModel; import com.qianfeng.yyz.zhonghuasuan.classify_second.model.IClassifySecondModel; import com.qianfeng.yyz.zhonghuasuan.classify_second.view.IClassifySecondView; import com.qianfeng.yyz.zhonghuasuan.datacallback.IDataFronNetCallback; import java.util.Map; /** * Created by Administrator on 2016/10/20 0020. */ public class ClassifySecondPresenter implements IClassifySecondPresenter, IDataFronNetCallback<EightGoodsBean> { private static ClassifySecondPresenter presenter; private IClassifySecondModel model; private IClassifySecondView classifyView; public ClassifySecondPresenter() { model = new ClassifySeconndModel(); } public static IClassifySecondPresenter getInstance(){ if (presenter==null){ presenter = new ClassifySecondPresenter(); } return presenter; } @Override public void enterClassifySecondView(IClassifySecondView classifyView, Map<String,String> map) { this.classifyView = classifyView; classifyView.refresh(); model.getClasifySecondBean(this,map); } @Override public void enterClassifySecondSearching(IClassifySecondView classifyView, Map<String, String> map) { this.classifyView = classifyView; classifyView.refresh(); model.getClasifySecondSearchingBean(this,map); } @Override public void refresh(Map<String, String> map,boolean isSeaching) { if (isSeaching){ model.getClasifySecondSearchingBean(this,map); }else { model.getClasifySecondBean(this,map); } classifyView.refresh(); } @Override public void success(EightGoodsBean bean) { classifyView.initView(bean); classifyView.completeRefresh(); } @Override public void failed(String msg) { classifyView.completeRefresh(); classifyView.showError(msg); } }
[ "1316234380@qq.com" ]
1316234380@qq.com