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
715d4ef5c0c9231ce05e74f9c75ed8738bb3bed7
9996e83f9f1c167aac6aeec7390e93a9e77e6875
/src/com/jan/alg/SwapNodes.java
34e18f6b44af3923c1a90dc4d23ae080ceaf735d
[]
no_license
JanLiao/LeetCode_Algorithm
cc0fed19a31e520f13c3cf36b05d39bda973b684
bb5897aba8de774d052fe48a8bb4176339b0b6e3
refs/heads/master
2020-08-14T17:52:43.988913
2019-11-16T08:24:42
2019-11-16T08:24:42
215,210,617
0
0
null
null
null
null
UTF-8
Java
false
false
1,355
java
package com.jan.alg; public class SwapNodes { public ListNode swapPairs(ListNode head) { ListNode pre = new ListNode(0); pre.next = head; ListNode result = pre; ListNode cur = head; if(head == null || head.next == null) return head; if(head.next.next == null){ ListNode cur1 = head.next; cur1.next = head; head.next = null; return cur1; } while(cur != null){ if(cur.next != null){ ListNode tmp = cur.next.next; pre.next = cur.next; cur.next.next = cur; cur.next = tmp; pre = cur; cur = tmp; }else{ break; } } return result.next; } public static void main(String[] args) { int[] arr2 = {1, 3, 5, 8, 9, 22}; ListNode node2 = new ListNode(-3); ListNode nn3 = node2; int k = 0; while(k < arr2.length){ ListNode n = new ListNode(arr2[k++]); node2.next = n; node2 = node2.next; } SwapNodes sn = new SwapNodes(); ListNode list = sn.swapPairs(nn3); while(list != null){ System.out.print(list.val + "\t"); list = list.next; } } }
[ "liaojingan@cvte.com" ]
liaojingan@cvte.com
8a31456d3294dd429ec30a0b9aa91d52993bfb52
57a3985f0d5790a52378bd90cc95a917afcfc6ca
/src/ArmstrongNumber.java
124354f7de2002a307a2adead1bf8dbac580d325
[]
no_license
NSS18/Array-and-Conditional-statements-homework
cc125c4f65afff515e6be5b81b505288c314554f
05a98254a0c6f562a5b69e6ae393d6f56589d2f3
refs/heads/master
2020-12-22T07:14:50.244216
2020-01-28T10:29:24
2020-01-28T10:29:24
236,708,390
0
0
null
null
null
null
UTF-8
Java
false
false
930
java
//6. WAP to input any 3 digit number and check if it is Armstrong number or not import java.util.Scanner; public class ArmstrongNumber { public static void main(String[] args) { int sum=0; int digit; Scanner scanner = new Scanner(System.in); System.out.println("Please enter any three digit number:"); int number = scanner.nextInt(); int temp=number; //to check number is armstrong number or not by finding cube of each digit and adding them while(number>0) { digit = number % 10; number=number/10; int cube = digit * digit * digit; sum =sum + cube; } //to compare the numbers if (sum == temp) System.out.println("Given number "+temp+" is armstrong number."); else System.out.println("Given number "+temp+" is not an armstrong number."); } }
[ "nidhisoftwaretesting@gmail.com" ]
nidhisoftwaretesting@gmail.com
db8a383d10b33f85c3e43f5575854e19996aad1b
89e2d5455ff69c8fc1ea1231d694cad7a3fe12f3
/travel-project/src/main/java/com/hc/rest/service/user/UserService.java
e67f341456eb8e62c4a7b51adae1461590bbaff2
[]
no_license
qq1243551746/ilvxing
27e7b3a288fe4c45138edbfa6e387f4a8cabaf58
0efc2f08ced47d3384985839173216c7af5b8ddc
refs/heads/master
2020-04-15T09:20:30.411874
2019-01-08T03:11:11
2019-01-08T03:11:11
164,397,035
0
0
null
null
null
null
UTF-8
Java
false
false
12,639
java
package com.hc.rest.service.user; import java.util.Date; import java.util.UUID; import java.util.concurrent.TimeUnit; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse; import com.aliyuncs.exceptions.ClientException; import com.hc.rest.entity.user.User; import com.hc.rest.repository.user.UserRespository; import com.hc.rest.utils.EirunyeException; import com.hc.rest.utils.Result; import com.hc.rest.utils.ResultEnum; import com.hc.rest.utils.ResultUtil; import com.hc.rest.utils.ip.GetMacAddress; import com.hc.rest.utils.redis.TravelRedisConfig; import com.hc.rest.utils.tools.md5.Md5PasswordEncoder; import com.hc.rest.utils.tools.util.MD5Utils; import com.hc.rest.utils.tools.util.StringBasicUtils; import com.hc.rest.utils.yzm.AliyunMessageUtil; @Service public class UserService { @Autowired UserRespository userRepository; TravelRedisConfig redis = new TravelRedisConfig(); /** * 用户注册(将该方法返回的数据信息在redis中新增一条) * * @param user * 新增的用户信息 * @param mac * 物理地址 ,以物理地址作为key,将返回的数据设为Value 添加到redis中 * @return * @throws Exception */ @SuppressWarnings("unchecked") public Result<Boolean> userRegister(User user, HttpServletRequest request) throws Exception { RedisTemplate<String, Object> redisTemplate = redis.redisTemplate(); // 获取mac值 String mac = GetMacAddress.getMac(request); // 将用户修改为激活状态,0为未激活状态 1,为激活状态 user.setActivated(1); // 通过随机生成的用户名,进行循环验证,确保用户名的唯一性 String randomUser = StringBasicUtils.getRandomUpper(8); while (true) { User rUser = userRepository.findAllByUserName(randomUser); if (rUser == null) { break; } else { randomUser = StringBasicUtils.getRandomUpper(8); } } //保存用户名 user.setUserName(randomUser); // 将用户密码进行加密 String encrypt = MD5Utils.MD5Encrypt(user.getUserPassword()); // 将用户注册的通过MD5加密之后在通过密钥再次进行unionid加密,双层加密 UUID uuid = UUID.randomUUID(); String codeKey = uuid.toString(); Md5PasswordEncoder encoder = new Md5PasswordEncoder(); String encodersalt = encoder.encodePassword(encrypt, codeKey); user.setUserPassword(encodersalt); // 密言存储到数据库中 user.setUuid(codeKey); // 执行新增操作 Integer result = userRepository.save(user.getActivated(), new Date(), user.getUserCode(), user.getUserName(), user.getUserPassword(), user.getUserType(), user.getUuid()); if (result > 0) { // 将值存储到redis中 redisTemplate.opsForValue().set("register:itrip_user:" + mac, user); redisTemplate.expire("register:itrip_user:" + mac, 1, TimeUnit.DAYS); return ResultUtil.getResult(ResultEnum.SUCCESS, true); } else { return ResultUtil.getResult(ResultEnum.SUCCESS, false); } } /** * 验证手机号或邮箱是否注册过 * * @param userCode * @return * @throws Exception */ @SuppressWarnings("unchecked") public Result<Boolean> verifyUserByCode(String userCode) throws Exception { User user = userRepository.findAllByUserCode(userCode); if (null == user) { return ResultUtil.getResult(ResultEnum.SUCCESS, true); } else { return ResultUtil.getResult(ResultEnum.SUCCESS, false); } } /** * * @param type用户登录类型(1、自动登录 * 2、普通登录 3、就是验证码动态登录) * @param user * 用户登录信息 * @return * @throws ClientException */ @SuppressWarnings("unchecked") public Result<Boolean> login(Integer type, User user, HttpServletRequest request) throws ClientException { RedisTemplate<String, Object> redisTemplate = redis.redisTemplate(); // 获取mac值 String mac = GetMacAddress.getMac(request); if (null != mac) { if (type == 1) { // 自动登录 // 通过Mac值从redis缓存中获取用户信息 User resUser = (User) redisTemplate.opsForValue().get("register:itrip_user:" + mac); if (null == resUser) { return ResultUtil.getResult(ResultEnum.SUCCESS, false); } else { // 通过redis中的用户信息为条件,到数据库中查询 User dbUser = userRepository.findAllByUserCode(resUser.getUserCode()); if (null == dbUser) { return ResultUtil.getResult(ResultEnum.SUCCESS, false); } else { // 匹配数据库中的密码和redis缓存中存储是否相等 if (resUser.getUserPassword().equals(dbUser.getUserPassword())) { // 将数据库中的数据在重新赋值/存储 redisTemplate.opsForValue().set("register:itrip_user:" + mac, dbUser); redisTemplate.expire("register:itrip_user:" + mac, 1, TimeUnit.DAYS); return ResultUtil.getResult(ResultEnum.SUCCESS, true); } else { return ResultUtil.getResult(ResultEnum.SUCCESS, false); } } } } else if (type == 2) { // 普通登录 if (null == user) { // 用户不存在 throw new EirunyeException(ResultEnum.USERNOTEXIST); } else { // 通过用户输入的手机号/邮箱进行查询 User userResult = userRepository.findAllByUserCode(user.getUserCode()); // 判断用户是否存在 if (userResult != null) { // 将用户输入的密码进行md5加密 String encrypt = MD5Utils.MD5Encrypt(user.getUserPassword()); // 将查询出来的用户密码通过uuidd进行解密,在进行匹配 Md5PasswordEncoder encoder = new Md5PasswordEncoder(); boolean result=encoder.isPasswordValid(userResult.getUserPassword(), encrypt, userResult.getUuid()); // 用户的密码与数据库的密码匹配成功 if (result==true) { // 将值存储到redis中 redisTemplate.opsForValue().set("register:itrip_user:" + mac, userResult); redisTemplate.expire("register:itrip_user:" + mac, 1, TimeUnit.DAYS); request.getSession().setAttribute("user", userResult); return ResultUtil.getResult(ResultEnum.SUCCESS, true); } else { throw new EirunyeException(ResultEnum.USERNOTEXIST);// 用户不存在 } } else { throw new EirunyeException(ResultEnum.USERNOTEXIST);// 用户不存在 } } } else if (type == 3) { // 动态验证登录 if (null == user) { throw new EirunyeException(ResultEnum.USERNOTEXIST);// 用户不存在 } else { if (null == user.getUserCode()) { throw new EirunyeException(ResultEnum.USERNOTEXIST);// 用户不存在 } else { User userInfo = userRepository.findAllByUserCode(user.getUserCode()); if (userInfo == null) { throw new EirunyeException(ResultEnum.USERNOTEXIST);// 用户不存在 } else { // 将值存储到redis中 redisTemplate.opsForValue().set("register:itrip_user:" + mac, userInfo); redisTemplate.expire("register:itrip_user:" + mac, 1, TimeUnit.DAYS); return ResultUtil.getResult(ResultEnum.SUCCESS, true); } } } } } else { throw new EirunyeException(ResultEnum.USERNOTEXIST);// 用户不存在 } throw new EirunyeException(ResultEnum.USERNOTEXIST);// 用户不存在 } /** * 发送短信验证码 * * @return * @throws ClientException */ @SuppressWarnings("unchecked") public Result<SendSmsResponse> sendMsg(String phone) throws ClientException { RedisTemplate<String, Object> redisTemplate = redis.redisTemplate(); // 进行验证码的发送 String random = AliyunMessageUtil.createRandomNum(6); //阿里云API接口 SendSmsResponse response = AliyunMessageUtil.sendSms(phone, random); // 代表请求成功 if (response.getCode() != null && response.getCode().equals("OK")) { // 将发送的验证码存到redis中 redisTemplate.opsForValue().set("verCode:" + phone, random); redisTemplate.expire("verCode:" + phone, 1, TimeUnit.MINUTES); return ResultUtil.getResult(ResultEnum.SUCCESS, response); } else { return ResultUtil.error(-1, "验证码发送异常,请稍后进行尝试!"); } } /** * 核实验证码 * * @param phone电话号码 * @param code验证码 * @param type发送类型 * 1、注册 2、登录 * @return */ @SuppressWarnings("unchecked") public Result<Boolean> verifyCode(String phone, String code) { RedisTemplate<String, Object> redisTemplate = redis.redisTemplate(); String reCode = (String) redisTemplate.opsForValue().get("verCode:" + phone); if (null != reCode) { // 将redis缓存中的验证码删除 boolean val = redisTemplate.delete("verCode:" + phone); if (val == true && reCode.equals(code)) { return ResultUtil.getResult(ResultEnum.SUCCESS, true); } else { return ResultUtil.getResult(ResultEnum.SUCCESS, false); } } else { return ResultUtil.getResult(ResultEnum.SUCCESS, false); } } /** * 修改密码 * @param pwd 要修改的密码 * @param phone 用户的手机号 * @param request ip地址 * @return */ @SuppressWarnings("unchecked") public Result<Integer> updatePwdByUserCode(String pwd, String phone, HttpServletRequest request) { RedisTemplate<String, Object> redisTemplate = redis.redisTemplate(); User dbUser = userRepository.findAllByUserCode(phone); if (dbUser == null) { return ResultUtil.getResult(ResultEnum.SUCCESS, 0); } // 将用户密码进行加密 String encrypt = MD5Utils.MD5Encrypt(pwd); // 将用户注册的通过MD5加密之后在通过密钥再次进行unionid加密,双层加密 Md5PasswordEncoder encoder = new Md5PasswordEncoder(); String encodersalt = encoder.encodePassword(encrypt, dbUser.getUuid()); pwd = encodersalt; Integer result = userRepository.updateByUserCode(pwd, phone); if (result > 0) { // 获取mac值 String mac = GetMacAddress.getMac(request); dbUser.setUserPassword(pwd); // 将值存储到redis中 redisTemplate.opsForValue().set("register:itrip_user:" + mac, dbUser); redisTemplate.expire("register:itrip_user:" + mac, 1, TimeUnit.DAYS); return ResultUtil.getResult(ResultEnum.SUCCESS, result); } else { return ResultUtil.getResult(ResultEnum.SUCCESS, result); } } /** * 注销账号 * * @param userName * @param session * @return */ @SuppressWarnings("unchecked") public Result<Boolean> cancellation(String userName, HttpServletRequest request) { RedisTemplate<String, Object> redisTemplate = redis.redisTemplate(); // 获取mac值 String mac = GetMacAddress.getMac(request); // 通过mac值获取用户信息 User user = (User) redisTemplate.opsForValue().get("register:itrip_user:" + mac); if (user != null && user.getUserName().equals(userName)) { // 将redis中的数据进行注销 boolean res = redisTemplate.delete("register:itrip_user:" + mac); if (res == true) { return ResultUtil.getResult(ResultEnum.SUCCESS, true); } else { return ResultUtil.getResult(ResultEnum.SUCCESS, false); } } else { return ResultUtil.getResult(ResultEnum.SUCCESS, false); } } /** * 通过mac地址到redis缓存中获取用户信息 * * @param request * @return */ @SuppressWarnings("unchecked") public Result<User> getUserInfo(HttpServletRequest request) { RedisTemplate<String, Object> redisTemplate = redis.redisTemplate(); // 获取mac值 String mac = GetMacAddress.getMac(request); // 通过mac值获取用户信息 User user = (User) redisTemplate.opsForValue().get("register:itrip_user:" + mac); if (user != null) { // 通过redis中的用户信息为条件,到数据库中查询 User dbUser = userRepository.findAllByUserCode(user.getUserCode()); if (null == dbUser&&!dbUser.getUserPassword().equals(user.getUserPassword())) { return ResultUtil.getResult(ResultEnum.SUCCESS, null); } else { // 匹配数据库中的密码和redis缓存中存储是否相等 if (user.getUserPassword().equals(dbUser.getUserPassword())) { // 将数据库中的数据在重新赋值/存储 redisTemplate.opsForValue().set("register:itrip_user:" + mac, dbUser); redisTemplate.expire("register:itrip_user:" + mac, 1, TimeUnit.DAYS); return ResultUtil.getResult(ResultEnum.SUCCESS, dbUser); } else { return ResultUtil.getResult(ResultEnum.SUCCESS, null); } } } return ResultUtil.getResult(ResultEnum.SUCCESS, null); } }
[ "1243551746@qq.com" ]
1243551746@qq.com
f73b57235e22949737aeb316bd94a657d3d5c72c
77393fb52f86705d9dc7634e00f95bc0cc53ca61
/evolvice-rest/src/main/java/com/evolvice/CarResource.java
ebdbf269f834b2ed8dd040fd8a6caeb74a9cb36f
[]
no_license
eMaM1921990/evolvice
16abcca39831b4af6734e1102ecbabeb5970056b
d5fb4878c44732b20fe20ff0c70f8067878f3db8
refs/heads/master
2020-04-03T02:59:49.480466
2018-10-27T16:36:26
2018-10-27T16:36:26
154,969,394
1
0
null
null
null
null
UTF-8
Java
false
false
1,528
java
package com.evolvice; import com.evolvice.common.model.CarModel; import com.evolvice.service.CarSerivce; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.support.ServletUriComponentsBuilder; import javax.validation.Valid; import java.net.URI; import java.util.List; @RestController @RequestMapping("v1/cars") public class CarResource { @Autowired private CarSerivce carSerivce; @GetMapping public ResponseEntity<List<CarModel>> retrieveAllCars(){ List<CarModel> carModelsList = this.carSerivce.findAllCar(); return ResponseEntity.ok(carModelsList); } @PostMapping public ResponseEntity<CarModel> addNewCar(@Valid @RequestBody CarModel carModel){ carModel = this.carSerivce.createNewCar(carModel); URI location = ServletUriComponentsBuilder .fromCurrentContextPath() .path("/{id}") .buildAndExpand(carModel.getId()).toUri(); return ResponseEntity.created(location).body(carModel); } @PutMapping("{id}") public ResponseEntity<CarModel> updateCar(@Valid @RequestBody CarModel carModel, @PathVariable Long id){ carModel = this.carSerivce.updateCar(carModel, id); return ResponseEntity.ok(carModel); } @DeleteMapping("{id}") public void deleteCar(@PathVariable Long id){ this.carSerivce.deleteCar(id); } }
[ "emam151987@gmail.com" ]
emam151987@gmail.com
6672858321e25421ec9fe7812c757c73b83c60f8
a6a1f5447310b338f9107104611f68c272ca6d4a
/plugins/griffon-spring/tags/RELEASE_0_2/src/main/griffon/spring/factory/support/ArtifactFactoryBean.java
329beab81ed6ff23a92ae53c780ed2e04ac60f3f
[ "Apache-2.0" ]
permissive
codehaus/griffon
0561d286a6b80245b32879d925a5d53f017e17d5
7c3bfbad8b9e5e269375da8af5207e10ee0bc104
refs/heads/master
2023-07-20T00:32:29.902537
2012-03-02T21:12:59
2012-03-02T21:12:59
36,229,267
1
1
null
null
null
null
UTF-8
Java
false
false
1,333
java
/* * Copyright 2009-2010 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package griffon.spring.factory.support; import griffon.core.ArtifactInfo; import org.springframework.beans.factory.FactoryBean; /** * @author Andres Almiray */ public class ArtifactFactoryBean implements FactoryBean { private ArtifactInfo artifact; private boolean singleton = true; public void setArtifact(ArtifactInfo artifact) { this.artifact = artifact; } public void setSingleton(boolean singleton) { this.singleton = singleton; } public Object getObject() throws Exception { return artifact.newInstance(); } public Class getObjectType() { return artifact.getKlass(); } public boolean isSingleton() { return singleton; } }
[ "aalmiray@bb902e69-0157-0410-a63b-ba7c3dd83122" ]
aalmiray@bb902e69-0157-0410-a63b-ba7c3dd83122
739a4a32cd43e921ef55930d345b4d65f7c06fe7
45f04494766af390e62502cfe09da28163008e4a
/node_modules/react-native-track-player/android/src/main/java/com/guichaguri/trackplayer/TrackPlayer.java
ea5f977a06e52472e3a9b633ac811519fd95ef9d
[ "MIT", "Apache-2.0" ]
permissive
SiddigHope/LibAud-Tarwee7
969f8c2e25efcd062878a63650b03aa4d9a21235
83022325c0b0f95008248de3c6c380f77c3fdbaf
refs/heads/main
2023-04-23T09:19:59.532138
2021-05-05T20:06:34
2021-05-05T20:06:34
355,552,233
0
0
MIT
2021-05-05T19:26:34
2021-04-07T13:18:41
Java
UTF-8
Java
false
false
864
java
package com.guichaguri.trackplayer; import com.facebook.react.ReactPackage; import com.facebook.react.bridge.NativeModule; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.uimanager.ViewManager; import com.guichaguri.trackplayer.module.MusicModule; import java.util.Collections; import java.util.List; /** * TrackPlayer * https://github.com/react-native-kit/react-native-track-player * @author Guichaguri */ public class TrackPlayer implements ReactPackage { @Override public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) { return Collections.singletonList(new MusicModule(reactContext)); } @Override public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { return Collections.emptyList(); } }
[ "noory4433@gmail.com" ]
noory4433@gmail.com
29c28fb0c0dac44cc297a3afdd432117c477d8d7
5969d5d442638c487a7f0393b602576e850b130f
/src/Main.java
a28552f21e54cb65d4d43d670a1ee0e9ccc880ab
[]
no_license
ayushdayal/ST_lab_2
91db0c39dbd0aab6b3232a671daaf30a5f86aae2
9707018894296a95a47fd0b8c877d18041946564
refs/heads/master
2023-01-13T20:29:28.113341
2020-11-21T16:34:09
2020-11-21T16:34:09
314,855,639
0
0
null
null
null
null
UTF-8
Java
false
false
615
java
import static java.lang.Integer.min; public class Main { public static float bill(int mint) { float amount = 0; int time; if(mint>0){ amount+= 300; mint-=120; } if(mint>0){ time=min(70,mint); amount+=time; mint-=70; } if(mint>0){ time=min(50,mint); amount+=0.8*time; mint-=50; } if(mint>0) amount+=0.4*mint; return amount; } public static void main(String[] args) { System.out.println(bill(300)); } }
[ "ayushdayal1998@gmail.com" ]
ayushdayal1998@gmail.com
b8959ee2d011e5cdf7af3c93a8ffd1cc2735e287
44210a305f802d9409c178075ef61d2ea3b0d99e
/HATEOAS/src/main/java/com/demo/rest/service/ServiceImpl.java
6a5fe3b7d49a77ea631a06cc2699836d95e59dbb
[]
no_license
DivyaRatan/HATEOAS
9117fa0a3d9c0a6406f5353f51833af7218fcfe1
d0a9e0d65768bfdbd9fe610246b0c29f9fc5f713
refs/heads/master
2020-03-27T04:26:31.187849
2018-08-24T10:51:03
2018-08-24T10:51:03
145,939,618
0
0
null
null
null
null
UTF-8
Java
false
false
815
java
package com.demo.rest.service; import java.util.ArrayList; import java.util.Collection; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.demo.rest.dao.DaoImpl; import com.demo.rest.pojo.Customer; @Component public class ServiceImpl implements Service { @Autowired private DaoImpl dao; //= new DaoImpl(); @Override public void addCustomer(Customer customer) { dao.addCustomer(customer); } @Override public Collection<Customer> viewAllCustomers() { return dao.viewAllCustomers(); } @Override public void updateCustomer(Customer customer) { dao.updateCustomer(customer); } @Override public void deleteCustomer(int customerId) { dao.deleteCustomer(customerId); } }
[ "noreply@github.com" ]
noreply@github.com
0aa79d7c124d9e40fd5a8ccb5e5815e0527a7cbe
c528ea3920e9ce624d05c4e873af21d751f58986
/CIEvents/CIEvents/test/cievents/EmailTest.java
d3e864b27c7a236b4dc6f7e6ba1fdbc71b56ca56
[]
no_license
daoquendo/CIEvents
9f65802768254119d42d51239aecf55ccc5e2028
d863b6a647357cae33c713c9cca70a339383b94b
refs/heads/master
2021-01-10T12:45:28.066117
2015-12-02T06:24:39
2015-12-02T06:24:39
47,240,535
0
0
null
null
null
null
UTF-8
Java
false
false
929
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package cievents; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.*; /** * * @author brian */ public class EmailTest { public EmailTest() { } @BeforeClass public static void setUpClass() { } @AfterClass public static void tearDownClass() { } @Before public void setUp() { } @After public void tearDown() { } @Test public void testSomeMethod() { // TODO review the generated test code and remove the default call to fail. fail("The test case is a prototype."); } }
[ "daoquendo@hotmail.com" ]
daoquendo@hotmail.com
79ea986de508a312ffbf6de87ee441fefd66eccc
ba65bf2cf8e0f44a8a40a1b7d1fda9b4f6ce9f30
/src/test/java/org/hamster/weixinmp/test/controller/WxControllerManualTest.java
ea01c1516f711a1119e897ed79e5c07529a70cc1
[ "Apache-2.0" ]
permissive
xuxingyin/weixin-mp-java
ad525e2fb27b3ad33e0822b6159406ebf09f6dd1
e9034c2b2484e151a0741fc55fa1b982cb293c62
refs/heads/master
2021-01-17T07:29:16.945073
2014-01-06T14:59:41
2014-01-06T14:59:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,089
java
/** * */ package org.hamster.weixinmp.test.controller; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import org.apache.commons.io.IOUtils; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.message.BasicNameValuePair; import org.hamster.weixinmp.test.xml.WxXMLUtilTest; import org.junit.Test; /** * @author grossopaforever@gmail.com * @version Jul 30, 2013 */ public class WxControllerManualTest { public static final String WX_URL = "http://localhost:8080/rest/weixinmp"; @Test //@Ignore public void testPostMsgText() throws ClientProtocolException, IOException { HttpClient httpclient = HttpClientBuilder.create().build(); HttpPost httppost = new HttpPost(WX_URL); // Request parameters and other properties. List<NameValuePair> params = new ArrayList<NameValuePair>(2); params.add(new BasicNameValuePair("signature", "38f004a5f222473f3abd85fd8e4b1de2349119c6")); params.add(new BasicNameValuePair("timestamp", "1375192987")); params.add(new BasicNameValuePair("nonce", "1374785014")); httppost.setEntity(new StringEntity(WxXMLUtilTest.MSG_TEXT_XML)); //Execute and get the response. HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); if (entity != null) { InputStream instream = entity.getContent(); try { String result = IOUtils.toString(instream); System.out.println(result); } finally { instream.close(); } } } public static final void main(String[] args) { try { new WxControllerManualTest().testPostMsgText(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }
[ "grossopaforever@gmail.com" ]
grossopaforever@gmail.com
c69aedad489e5d66cf783ade70e66851ec258b39
95234487e48e7886c925c2760085de281809cd86
/leetcode/src/leetcode/num349.java
6a61d7a4fdd43d57718a863a7b70eec39e2b6cc0
[]
no_license
z18538613285/repotest1
641e6543f5eff48f8189ae8b4d60fb4a1e057e1b
cffbffbd411528876ffff10c8536d0d98f8852e2
refs/heads/master
2023-01-28T13:47:00.284370
2020-11-30T11:58:08
2020-11-30T11:58:08
317,160,951
0
0
null
null
null
null
UTF-8
Java
false
false
481
java
package leetcode; import java.util.*; class Solution349 { public int[] intersection(int[] nums1, int[] nums2) { Set<Integer> result = new HashSet<>(); Set<Integer> set = new HashSet<>(); for (int num : nums2) { set.add(num); } for (int num : nums1) { if (set.contains(num)){ result.add(num); } } return result.stream().mapToInt(Number::intValue).toArray(); } }
[ "2914816030@qq.com" ]
2914816030@qq.com
d611a8c2907c3c5346a89e8d5bd1b8f3617976da
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/15/15_5f29615ab6a6d5f764dd19d65ff58e894efac86a/BiopluxService/15_5f29615ab6a6d5f764dd19d65ff58e894efac86a_BiopluxService_s.java
98dda597392434870e0c11d062c902998a6db883
[]
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
12,198
java
package ceu.marten.services; import java.io.File; import java.util.Timer; import java.util.TimerTask; import plux.android.bioplux.BPException; import plux.android.bioplux.Device; import plux.android.bioplux.Device.Frame; import android.annotation.SuppressLint; import android.app.Notification; import android.app.PendingIntent; import android.app.Service; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.os.Environment; import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.os.Messenger; import android.os.PowerManager; import android.os.PowerManager.WakeLock; import android.os.RemoteException; import android.os.StatFs; import android.support.v4.app.NotificationCompat; import android.util.Log; import ceu.marten.bplux.R; import ceu.marten.model.DeviceConfiguration; import ceu.marten.model.io.DataManager; import ceu.marten.ui.NewRecordingActivity; /** * Creates a connection with a bioplux device and receives frames sent from device * @author Carlos Marten * */ public class BiopluxService extends Service { // Standard debug constant private static final String TAG = BiopluxService.class.getName(); // messages 'what' fields for the communication with client public static final int MSG_REGISTER_AND_START = 1; public static final int MSG_DATA = 2; public static final int MSG_RECORDING_DURATION = 3; public static final int MSG_SAVED = 4; public static final int MSG_CONNECTION_ERROR = 5; // Codes for the activity to display the correct error message public static final int CODE_ERROR_PROCESSING_FRAMES = 6; public static final int CODE_ERROR_SAVING_RECORDING = 7; // Get 80 frames every 50 miliseconds public static final int NUMBER_OF_FRAMES = 80; public static final long TIMER_TIME = 50L; // Used to synchronize timer and main thread private static final Object writingLock = new Object(); private boolean isWriting; // Used to keep activity running while device screen is turned off private PowerManager powerManager; private WakeLock wakeLock; private DeviceConfiguration configuration; private Device connection; private Device.Frame[] frames; private Timer timer = new Timer(); private DataManager dataManager; private String recordingName; private double samplingFrames; private double samplingCounter = 0; private boolean killServiceError = false; /** * Target we publish for clients to send messages to IncomingHandler */ private final Messenger mMessenger = new Messenger(new IncomingHandler()); /** * Messenger with interface for sending messages from the service */ private Messenger client = null; /** * Handler of incoming messages from clients. */ @SuppressLint("HandlerLeak") class IncomingHandler extends Handler { @Override public void handleMessage(Message msg) { switch (msg.what) { case MSG_REGISTER_AND_START: // register client client = msg.replyTo; wakeLock.acquire(); timer.schedule(new TimerTask() { public void run() { processFrames(); } }, 0, TIMER_TIME); break; case MSG_RECORDING_DURATION: dataManager.setDuration(msg.getData().getString("duration")); //TODO HARD CODED break; default: super.handleMessage(msg); } } } /** * Initializes the wake lock and the frames array */ @Override public void onCreate() { super.onCreate(); powerManager = (PowerManager)this.getSystemService(Context.POWER_SERVICE); wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "MyWakeLock"); frames = new Device.Frame[NUMBER_OF_FRAMES]; for (int i = 0; i < frames.length; i++) frames[i] = new Frame(); Log.i(TAG, "Service created"); } /** * Gets information from the activity extracted from the intent and connects * to bioplux device. Returns the communication channel to the service or * null if clients cannot bind to the service */ @Override public IBinder onBind(Intent intent) { Log.i(TAG, "service onbind()"); recordingName = intent.getStringExtra("recordingName").toString(); //TODO HARD CODED configuration = (DeviceConfiguration) intent.getSerializableExtra("configSelected");//TODO HARD CODED samplingFrames = (double)configuration.getReceptionFrequency() / configuration.getSamplingFrequency(); if(connectToBiopluxDevice()){ dataManager = new DataManager(this, recordingName, configuration); showNotification(intent); } return mMessenger.getBinder(); } /** * Gets and process the frames from the bioplux device. Saves all the frames * receives to a text file and send the requested frames to the activity */ private void processFrames() { synchronized (writingLock) { isWriting = true; } getFrames(NUMBER_OF_FRAMES); loop: for (Frame frame : frames) { if(!dataManager.writeFramesToTmpFile(frame)){ sendErrorToActivity(CODE_ERROR_PROCESSING_FRAMES); killServiceError = true; stopSelf(); break loop; } if(samplingCounter++ >= samplingFrames){ sendFrameToActivity(frame.an_in); samplingCounter -= samplingFrames; } } synchronized (writingLock) { isWriting = false; } } /** * Get frames from the bioplux device * @param numberOfFrames */ private void getFrames(int numberOfFrames) { try { connection.GetFrames(numberOfFrames, frames); } catch (BPException e) { Log.e(TAG, "Exception getting frames", e); sendErrorToActivity(e.code); stopSelf(); } } /** * Connects to a bioplux device and begins to acquire frames * Returns true connection has established. False if an exception was caught * @return boolean */ private boolean connectToBiopluxDevice() { // BIOPLUX INITIALIZATION try { connection = Device.Create(configuration.getMacAddress()); connection.BeginAcq(configuration.getReceptionFrequency(), configuration.getActiveChannelsAsInteger(), configuration.getNumberOfBits()); } catch (BPException e) { try { connection.Close(); } catch (BPException e1) { Log.e(TAG, "bioplux close connection exception", e1); sendErrorToActivity(e1.code); killServiceError = true; stopSelf(); return false; } Log.e(TAG, "Bioplux connection exception", e); sendErrorToActivity(e.code); killServiceError = true; stopSelf(); return false; } return true; } /** * Creates the notification and starts service in the foreground * @param parentIntent */ private void showNotification(Intent parentIntent) { // SET THE BASICS NotificationCompat.Builder mBuilder = new NotificationCompat.Builder( this).setSmallIcon(R.drawable.notification) .setContentTitle(getString(R.string.bs_notification_title)) .setContentText(getString(R.string.bs_notification_message)); // CREATE THE INTENT CALLED WHEN NOTIFICATION IS PRESSED Intent newRecordingIntent = new Intent(this, NewRecordingActivity.class); // PENDING INTENT PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, newRecordingIntent, Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT); mBuilder.setContentIntent(pendingIntent); // CREATES THE NOTIFICATION AND START SERVICE AS FOREGROUND Notification serviceNotification = mBuilder.build(); startForeground(R.string.service_id, serviceNotification); } /** * Sends frame to activity via message * @param frame acquired from the bioplux device */ private void sendFrameToActivity(short[] frame) { Bundle b = new Bundle(); b.putShortArray("frame", frame);//TODO HARD CODED Message message = Message.obtain(null, MSG_DATA); message.setData(b); try { client.send(message); } catch (RemoteException e) { Log.e(TAG, "client is dead. Service is being stopped", e); killServiceError = true; stopSelf(); client = null; } } /** * Notifies the client that the recording frames were stored properly */ private void sendSavedNotification() { Message message = Message.obtain(null, MSG_SAVED); try { client.send(message); } catch (RemoteException e) { Log.e(TAG, "client is dead. Service is being stopped", e); killServiceError = true; stopSelf(); client = null; } } /** * Sends the an error code to the client with the corresponding error that * it has encountered * * @param errorCode */ private void sendErrorToActivity(int errorCode) { try { client.send(Message.obtain(null, MSG_CONNECTION_ERROR, errorCode, 0)); } catch (RemoteException e) { Log.e(TAG, "Exception sending error message to activity. Service is stopping", e); } } @Override public int onStartCommand(Intent intent, int flags, int startId) { return START_NOT_STICKY; // do not re-create service if system kills it } /** * Stops the service properly when service is being destroyed */ private void stopService(){ if (timer != null) timer.cancel(); while (isWriting) { try { Thread.sleep(100); } catch (InterruptedException e2) { Log.e(TAG, "Exception thread is sleeping", e2); } } if(!dataManager.closeWriters()) sendErrorToActivity(CODE_ERROR_SAVING_RECORDING); try { connection.EndAcq(); connection.Close(); } catch (BPException e) { Log.e(TAG, "Exception ending ACQ", e); sendErrorToActivity(e.code); } } @Override public boolean onUnbind(Intent intent) { // returns true so that next time the client binds, onRebind() will be called return true; } @Override public void onRebind(Intent intent) { // Override and do nothing. Needed for the notification to be dismissed when the service stops } @Override public void onDestroy() { stopForeground(true); if(!killServiceError){ stopService(); if(!dataManager.saveAndCompressFile(client)) sendErrorToActivity(CODE_ERROR_SAVING_RECORDING); sendSavedNotification(); } wakeLock.release(); super.onDestroy(); Log.i(TAG, "service destroyed"); } /*********************** LOW MEMORY? ********************/ public static boolean externalMemoryAvailable() { return android.os.Environment.getExternalStorageState().equals( android.os.Environment.MEDIA_MOUNTED); } public static String formatSize(long size) { String suffix = null; if (size >= 1024) { suffix = "KB"; size /= 1024; if (size >= 1024) { suffix = "MB"; size /= 1024; } } StringBuilder resultBuffer = new StringBuilder(Long.toString(size)); int commaOffset = resultBuffer.length() - 3; while (commaOffset > 0) { resultBuffer.insert(commaOffset, ','); commaOffset -= 3; } if (suffix != null) resultBuffer.append(suffix); return resultBuffer.toString(); } public static String getAvailableInternalMemorySize() { File path = Environment.getDataDirectory(); StatFs stat = new StatFs(path.getPath()); @SuppressWarnings("deprecation") long blockSize = stat.getBlockSize(); @SuppressWarnings("deprecation") long availableBlocks = stat.getAvailableBlocks(); return formatSize(availableBlocks * blockSize); } public static String getAvailableExternalMemorySize() { if (externalMemoryAvailable()) { File path = Environment.getExternalStorageDirectory(); StatFs stat = new StatFs(path.getPath()); @SuppressWarnings("deprecation") long blockSize = stat.getBlockSize(); @SuppressWarnings("deprecation") long availableBlocks = stat.getAvailableBlocks(); return formatSize(availableBlocks * blockSize); } else { return "ERROR"; } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
83446385223e9592e92bb91f7917abc5139ac785
9427e1ca4cf030120dd590bcc928d43b0f73e8f1
/src/ecologylab/semantics/generated/test/test_poly_fields/Item.java
8333001ce455a97b63e92676ac5c388fd618d25f
[]
no_license
ecologylab/testMetaMetadataCompiler
cc0db99e893dac9c85aa253bf70a54b57843d8a5
6d013590e25c220a58dd68a101f1f2ac08ff2668
refs/heads/master
2021-01-15T21:35:38.345976
2012-07-25T07:02:35
2012-07-25T07:02:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,325
java
package ecologylab.semantics.generated.test.test_poly_fields; import ecologylab.semantics.metadata.Metadata; import ecologylab.semantics.metadata.scalar.MetadataInteger; import ecologylab.semantics.metametadata.MetaMetadataCompositeField; import ecologylab.serialization.annotations.simpl_inherit; import ecologylab.serialization.annotations.simpl_scalar; /** * Item.java * s.im.pl serialization * * Generated by JavaTranslator on 09/16/11. * Copyright 2011 Interface Ecology Lab. */ /** * the base item class. */ @simpl_inherit public class Item extends Metadata { /** * the ID of this item. */ @simpl_scalar private ecologylab.semantics.metadata.scalar.MetadataInteger id; public Item() { } public Item(MetaMetadataCompositeField mmd) { super(mmd); } public MetadataInteger id() { MetadataInteger result = this.id; if (result == null) { result = new MetadataInteger(); this.id = result; } return result; } public Integer getId() { return this.id == null ? 0 : id().getValue(); } public ecologylab.semantics.metadata.scalar.MetadataInteger getIdMetadata() { return id; } public void setId(Integer id) { if (id != 0) this.id().setValue(id); } public void setIdMetadata(ecologylab.semantics.metadata.scalar.MetadataInteger id) { this.id = id; } }
[ "quyin@ecologylab.net" ]
quyin@ecologylab.net
a6e2b479acf6af8faeecd0d2b948302b74b7086c
564fc027cc1dfc701d3a3097ce56ec3f2e918fa6
/src/main/java/com/gft/backend/configs/SpringSessionInitializer.java
ab4d72e7f1d193583f0e3937d119f4ce9ceccb00
[]
no_license
ashurovmf/spring_web_stream
dbd425bee2fd9b324e5f220af48b4e9d3f7047bc
ddddee8cb3e61745fb45d648db093c2036f109cf
refs/heads/master
2020-04-19T14:45:03.831581
2016-09-23T07:37:48
2016-09-23T07:37:48
66,829,504
0
0
null
null
null
null
UTF-8
Java
false
false
259
java
package com.gft.backend.configs; import org.springframework.session.web.context.AbstractHttpSessionApplicationInitializer; /** * Created by miav on 2016-09-13. */ public class SpringSessionInitializer extends AbstractHttpSessionApplicationInitializer { }
[ "miav@gft.com" ]
miav@gft.com
c5d1c090b458f483b0a037018872fe102d94a98b
56fe53e612720292dc30927072e6f76c2eea6567
/onvifcxf/src/org/onvif/ver10/device/wsdl/DeleteUsersResponse.java
9fd2744c4502b7fb1f6a3b624fbc0e7fd66a9866
[]
no_license
guishijin/onvif4java
f0223e63cda3a7fcd44e49340eaae1d7e5354ad0
9b15dba80f193ee4ba952aad377dda89a9952343
refs/heads/master
2020-04-08T03:22:51.810275
2019-10-23T11:16:46
2019-10-23T11:16:46
124,234,334
1
1
null
null
null
null
GB18030
Java
false
false
764
java
package org.onvif.ver10.device.wsdl; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>anonymous complex type的 Java 类。 * * <p>以下模式片段指定包含在此类中的预期内容。 * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "") @XmlRootElement(name = "DeleteUsersResponse") public class DeleteUsersResponse { }
[ "420188751@qq.com" ]
420188751@qq.com
355b365378f70795a9beb6450c1eb3d01c7f78d8
b19b3a02b548220023d7266bc6a85a25518f3319
/back/leetcode/page9/FIndandReplacePattern.java
70fbcffa9d405784dba02d4326a187e6b28fcd16
[]
no_license
yangseungin/algo
40ab28734cf23515bf34fcc1da8f9ba169f54f8f
03c96b21a79425988dc76e842f940e9e642ac1d5
refs/heads/master
2022-05-08T07:54:26.087728
2022-04-01T15:03:45
2022-04-01T15:03:45
177,534,719
1
1
null
2019-04-07T10:50:53
2019-03-25T07:20:12
Java
UTF-8
Java
false
false
960
java
package page9; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class FIndandReplacePattern { public static void main(String[] args) { System.out.println(findAndReplacePattern(new String[]{"abc","deq","mee","aqq","dkd","ccc"}, "abb")); } public static List<String> findAndReplacePattern(String[] words, String pattern) { List<String> ans = new ArrayList<>(); for (String word : words) if (match(word, pattern)) ans.add(word); return ans; } public static boolean match(String word, String pattern) { Map<Character, Character> m1 = new HashMap<>(); Map<Character, Character> m2 = new HashMap<>(); for (int i = 0; i < word.length(); ++i) { char w = word.charAt(i); char p = pattern.charAt(i); if (!m1.containsKey(w)) m1.put(w, p); if (!m2.containsKey(p)) m2.put(p, w); if (m1.get(w) != p || m2.get(p) != w) return false; } return true; } }
[ "rhfpdk92@naver.com" ]
rhfpdk92@naver.com
e602648926a6fac98a3523e3b2baa1e7c5b8b4cb
9023b88ad740bcb8b12fb7e0cfc5180762ffee9a
/Bezbednost/src/main/java/com/example/bezbednost/controller/AuthenticationController.java
8809c1e85743055fefab2bfc63777a67318e9b0f
[]
no_license
NikolaPavlovic1/XML-Bezbednost
c4fdb8fb9033d22c6f0b430eb315788db2224fea
ab0f3bb4dfff8fb515211514c34d78192bf82b80
refs/heads/master
2022-12-12T05:01:05.604500
2019-06-29T20:35:04
2019-06-29T20:35:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,698
java
package com.example.bezbednost.controller; import java.security.Principal; import java.util.HashMap; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.example.bezbednost.model.User; import com.example.bezbednost.security.CustomUserDetailsService; import com.example.bezbednost.security.TokenHelper; import com.example.bezbednost.service.UserService; @RestController @RequestMapping(value = "/auth") public class AuthenticationController { Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired TokenHelper tokenHelper; @Autowired private AuthenticationManager authenticationManager; @Autowired private CustomUserDetailsService userDetailsService; @Autowired private UserService userService; @PostMapping(value = "/login", produces = MediaType.TEXT_PLAIN_VALUE) public ResponseEntity<String> createAuthenticationToken(@RequestParam("email") String email, @RequestParam("password") String password) { // Izvrsavanje security dela Authentication authentication; try { authentication = authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(email, password)); //logger.info("User " + email + " successfully logged in"); } catch (AuthenticationException e) { logger.error("PK, SE_EVENT"); return new ResponseEntity<String>("Wrong email/password.", HttpStatus.FORBIDDEN); } // Ubaci username + password u kontext SecurityContextHolder.getContext().setAuthentication(authentication); // Kreiraj token User user = (User) authentication.getPrincipal(); String jws = tokenHelper.generateToken(user.getEmail()); // Vrati token kao odgovor na uspesno autentifikaciju logger.info("UL-K: {}, SE_EVENT", email); return new ResponseEntity<String>(jws, HttpStatus.OK); } @PreAuthorize("hasRole('USER')") @GetMapping(value = "/current-user") public ResponseEntity<User> getCurrentUser(Principal principal) { if (principal == null) { return new ResponseEntity<User>(HttpStatus.NOT_FOUND); } User user = userService.findOne(principal.getName()); if (user == null) { return new ResponseEntity<User>(HttpStatus.NOT_FOUND); } return new ResponseEntity<User>(user, HttpStatus.OK); } @PostMapping(value = "/change-password") @PreAuthorize("hasRole('USER')") public ResponseEntity<?> changePassword(@RequestBody PasswordChanger passwordChanger) { userDetailsService.changePassword(passwordChanger.oldPassword, passwordChanger.newPassword); Map<String, String> result = new HashMap<>(); result.put("result", "success"); return ResponseEntity.accepted().body(result); } static class PasswordChanger { public String oldPassword; public String newPassword; } }
[ "trifko96@gmail.com" ]
trifko96@gmail.com
8cfa067efedbfe00096abe7e084285a7d80fdb31
80015c815453bc0b8039991ecd48694a0cb4a8ca
/app/src/main/java/com/tomclaw/mandarin/main/ChatLayoutManager.java
622f2b8fc1eb412b26cc8fb89e340214c3e0e482
[]
no_license
tokenbuild/mandarin-android
a47a0fafddc7c14fe42a0bec468a273a0955443b
3a834edc8fa88c15eb68cf05cf515a23d9b0b21d
refs/heads/master
2021-04-15T10:29:35.598031
2018-01-28T21:21:14
2018-01-28T21:21:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
964
java
package com.tomclaw.mandarin.main; import android.content.Context; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; /** * Created by Igor on 07.07.2015. */ public class ChatLayoutManager extends LinearLayoutManager { private DataChangedListener dataChangedListener; public ChatLayoutManager(Context context) { super(context); setReverseLayout(true); } public void setDataChangedListener(DataChangedListener dataChangedListener) { this.dataChangedListener = dataChangedListener; } @Override public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) { super.onLayoutChildren(recycler, state); if (dataChangedListener != null) { dataChangedListener.onDataChanged(); } } public interface DataChangedListener { void onDataChanged(); } }
[ "inbox@tomclaw.com" ]
inbox@tomclaw.com
49533f2b23bd7da6c14326dd7c5b24b0c6bfbbb9
2bef0cbe6ba854c1a73828b4941db23da7094941
/src/thu/jiakai/wordbar/ReviewActivity.java
0689656a94cde055e4ed3ede30075e70514e9b78
[]
no_license
jia-kai/wordbar
9b6062415ccc300d474b31fe8d82e0f35e38f6d5
43408ea8d11db1218c05c819c219e5d742d07e68
refs/heads/master
2020-05-17T23:27:26.923131
2015-03-22T14:35:38
2015-03-22T14:35:38
32,678,883
0
0
null
null
null
null
UTF-8
Java
false
false
1,704
java
package thu.jiakai.wordbar; import java.util.ArrayList; import android.os.Bundle; import android.view.View; import android.widget.TextView; import android.widget.Toast; public class ReviewActivity extends WBActivity { Word curWord; ArrayList<Word> wordList; int wordIndex = -1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_review); ((TextView) findViewById(R.id.wordDefTextView)).setTypeface(fontType); wordList = MemoryModel.getWordsToReview(); Utils.randomShuffle(wordList); wordIndex = -1; moveToNextWord(); } private void onUserResponse(int rst) { if (!curWord.isNone()) MemoryModel.setUserResponse(curWord, rst); moveToNextWord(); } private void moveToNextWord() { if (wordList.isEmpty()) { Toast.makeText(this, "no words to review", Toast.LENGTH_LONG) .show(); finish(); return; } wordIndex += 1; if (wordIndex >= wordList.size()) { wordIndex = 0; Utils.randomShuffle(wordList); } curWord = wordList.get(wordIndex); ((TextView) findViewById(R.id.statusTextView)).setText(String.format( "%d/%d", wordIndex, wordList.size())); ((TextView) findViewById(R.id.wordTitleTextView)) .setText(curWord.spell); ((TextView) findViewById(R.id.wordDefTextView)) .setText("<-- definition -->"); } public void onShowDefClicked(View view) { ((TextView) findViewById(R.id.wordDefTextView)) .setText(curWord.definition); } public void onYesClicked(View view) { if (!curWord.isNone()) { wordList.remove(wordIndex); wordIndex--; } onUserResponse(1); } public void onNoClicked(View view) { onUserResponse(0); } }
[ "jia.kai66@gmail.com" ]
jia.kai66@gmail.com
b62921fc9047b62f7cc61ef58ca0a355cd93e0fc
bbdcd6b5285345f663b6ba2a5c6b1c82dde31730
/server/game/src/main/java/com/wanniu/core/tcp/protocol/Header.java
3554a1be5dda216a5e4dbce0cefbbfb9637427a4
[]
no_license
daxingyou/yxdl
644074e78a9bdacf351959b00dc06322953a08d7
ac571f9ebfb5a76e0c00e8dc3deddb5ea8c00b61
refs/heads/master
2022-12-23T02:25:23.967485
2020-09-27T09:05:34
2020-09-27T09:05:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,878
java
package com.wanniu.core.tcp.protocol; import com.wanniu.core.logfs.Out; import io.netty.buffer.ByteBuf; import java.lang.reflect.Field; import java.lang.reflect.Modifier; public class Header { protected short type; protected int length; private long receiveTime; public void decode(ByteBuf in) { this.type = in.readShort(); this.length = in.readInt(); } public void decodeHeader(ByteBuf in) { decode(in); } public void decode(Header header) { this.type = header.getType(); this.length = header.getLength(); } public void encode(ByteBuf out) { out.writeShort(this.type); out.writeInt(this.length); } public int getLength() { return this.length; } public void setLength(int length) { this.length = length; } public short getType() { return this.type; } public String getTypeHexString() { return "0x" + Integer.toHexString(this.type); } public void setType(short type) { this.type = type; } private static byte calcBytes() { Field[] fs = Header.class.getDeclaredFields(); return (byte) (calcSize(fs) - 2); } public long getReceiveTime() { return this.receiveTime; } public void setReceiveTime(long receiveTime) { this.receiveTime = receiveTime; } public static int calcSize(Field[] fs) { int bits = 0; for (Field f : fs) { int mod = f.getModifiers(); String type = f.getGenericType().toString().intern(); if (!Modifier.isStatic(mod)) { if (type.equals("byte")) { bits += 8; } else if (type.equals("short")) { bits += 16; } else if (type.equals("int")) { bits += 32; } else if (type.equals("long")) { bits += 64; } else if (type.equals("char")) { bits += 16; } else if (type.equals("float")) { bits += 32; } else if (type.equals("double")) { bits += 64; } else { Out.warn(new Object[]{"过滤了非基础数据类型属性:", Modifier.toString(mod), " - ", type, "[", f.getName(), "]"}); } } else if (!"SIZE".equals(f.getName())) { Out.warn(new Object[]{"过滤了静态属性:", Modifier.toString(mod), " - ", type, "[", f.getName(), "]"}); } } bits /= 8; if (bits > 127 || bits < -128) { Out.error(new Object[]{"数值[", Integer.valueOf(bits), "]超过byte边界"}); return 0; } return bits; } public static final byte SIZE = calcBytes(); }
[ "parasol_qian@qq.com" ]
parasol_qian@qq.com
2218eadc86a79d50f158037b1492d29cabd703ea
b36862f740c73a429f52bb6970b923582a5ace43
/src/test/java/demos/hardwareinit/GameLogic.java
f17c663d9966ef3c8468fd4e778d6e2f7fe30d7c
[ "MIT" ]
permissive
CesarChodun/SFE-Engine
e25ba55b845b84c2ef44d23902516a347f7fe2dd
4688382e61fc2621e556a3e8a68acc68d91bd2f5
refs/heads/master
2023-04-26T01:02:14.777910
2020-11-17T20:28:12
2020-11-17T20:28:12
188,080,448
27
2
MIT
2023-04-14T17:59:08
2019-05-22T17:00:58
Java
UTF-8
Java
false
false
1,479
java
package demos.hardwareinit; import com.sfengine.core.Application; import com.sfengine.core.HardwareManager; import com.sfengine.core.engine.Engine; import com.sfengine.core.engine.EngineFactory; import com.sfengine.core.engine.EngineTask; public class GameLogic implements EngineTask { static final String CONFIG_FILE = "demos/hardwareinit"; /** Our engine object. We need it to shut it down when we finish our work. */ private Engine engine = EngineFactory.getEngine(); @Override public void run() throws AssertionError { System.out.print("The engine is running in the "); if (Application.RELEASE) { System.out.print("'RELEASE' mode. "); } else { System.out.print("developer mode. "); } System.out.print("With the debug information turned "); if (Application.DEBUG) { System.out.print("ON.\n"); } else { System.out.print("OFF.\n"); } // Application and hardware initialization. Application.init(CONFIG_FILE); HardwareManager.init(); EngineReport report = new EngineReport(); // Adding engine tasks to the engine. // They will be invoked on the main thread. // In the same order as here. engine.addTask(report, HardwareManager.getDependency()); // A task that will stop the engine. engine.addConfig(() -> {engine.stop();}, report.getDependency()); } }
[ "caesar.chodun@gmail.com" ]
caesar.chodun@gmail.com
202b13ebd1fa72839a487be6378eef01a0f8b59d
70de68c79809e9d3468fd9f8442cdcdef09a28ad
/src/main/java/org/bian/dto/SDCustomerWorkbenchConfigureInputModelServiceDomainServiceConfigurationRecordServiceDomainServiceConfigurationSetup.java
acb19cd28550f41b3e7d3fbdc145e699ad72900d
[ "Apache-2.0" ]
permissive
bianapis/sd-customer-workbench-v2.0
84ff36d35505b61500a731e7a17ec88a5c2366d5
44903d2ca9d7b239cef25ade6728989f67309554
refs/heads/master
2020-07-11T10:16:15.832397
2019-09-04T13:28:40
2019-09-04T13:28:40
204,511,185
0
0
null
null
null
null
UTF-8
Java
false
false
1,206
java
package org.bian.dto; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.Valid; /** * SDCustomerWorkbenchConfigureInputModelServiceDomainServiceConfigurationRecordServiceDomainServiceConfigurationSetup */ public class SDCustomerWorkbenchConfigureInputModelServiceDomainServiceConfigurationRecordServiceDomainServiceConfigurationSetup { private String serviceDomainServiceConfigurationParameter = null; /** * `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::UNCEFACT::Text general-info: The requested and current activation values for the service configuration parameter * @return serviceDomainServiceConfigurationParameter **/ public String getServiceDomainServiceConfigurationParameter() { return serviceDomainServiceConfigurationParameter; } public void setServiceDomainServiceConfigurationParameter(String serviceDomainServiceConfigurationParameter) { this.serviceDomainServiceConfigurationParameter = serviceDomainServiceConfigurationParameter; } }
[ "team1@bian.org" ]
team1@bian.org
c2354f1bbf3f5c603bf7f3cb5ade32f4e31d3465
d212bc3b29401b5418789191e981d7bf218f5fa1
/server/src/test/java/by/mamont/MainTest.java
cc392b65269d9ff78b72e5bab11cd22a9793f28d
[]
no_license
SeregaMamonT/dassite
a1b2edfa1972a28b01d8d04f4d4dfaa8212d39bf
272b2f1dabd29a7c7ce0c8d197138aa3b9545cc8
refs/heads/master
2020-04-05T13:32:51.395609
2017-09-14T15:53:36
2017-09-15T09:40:52
94,875,797
0
0
null
null
null
null
UTF-8
Java
false
false
209
java
package by.mamont; import org.junit.Test; import org.junit.Assert; public class MainTest { @Test public void testGetMessage() { Assert.assertEquals("Augen auf, ich komme!", Main.getMessage()); } }
[ "salexetovich@kyriba.com" ]
salexetovich@kyriba.com
db46f59c6236613b1f11a413d6da019ac814d31d
c790fa604c2bf9a06925c0935c18e86469cf748c
/src/com/poo/WebServlet.java
32b9e08319846134b68b33632d58d5166ac2f89e
[]
no_license
poojamp4/servletproject
db14fa172fc78c6358c7099b721a04320f0d8dc8
851c80b4949a0c648fb08c397dcc8c616cb5cf3b
refs/heads/master
2020-04-22T02:56:23.776412
2019-02-11T04:41:05
2019-02-11T04:41:05
170,068,369
0
0
null
null
null
null
UTF-8
Java
false
false
77
java
package com.poo; public @interface WebServlet { String value(); }
[ "mpoojapatil44@gmail.com" ]
mpoojapatil44@gmail.com
8dc638f49dc56a705c64d7b6646bb3828e62df46
9649297ad585944cf26d49f7261c8be3076012e3
/service-config/src/main/java/org/grimps/service/config/internal/plugins/ConfigurationFileLocationPlugin.java
8114a909d482315aa2c88db85e6cfd240eb40435
[]
no_license
shekhar-jha/grimps-base
39ee73b355aa3e9434f38efb384092b04ceb3a13
de23db2ee67eadb861417a74f2caa0a50799f92d
refs/heads/master
2023-06-24T07:59:55.193153
2023-06-13T17:12:51
2023-06-13T17:12:51
109,073,416
0
0
null
2023-06-13T17:12:52
2017-11-01T01:52:12
Java
UTF-8
Java
false
false
2,175
java
/* * Copyright 2017 Shekhar Jha * * 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.grimps.service.config.internal.plugins; import org.grimps.base.config.Configurable; import org.grimps.base.config.Configuration; import org.grimps.base.utils.Utils; import org.grimps.service.config.plugins.FileLocationPlugin; import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; import java.net.URL; import java.util.ArrayList; import java.util.List; public class ConfigurationFileLocationPlugin implements Configurable, FileLocationPlugin { public static final String CONFIG_FILE_LOCATION_PARAMETER_NAME = "config-location"; private static final XLogger logger = XLoggerFactory.getXLogger(ConfigurationFileLocationPlugin.class); private Configuration configuration; @Override public void configure(Configuration configuration) { logger.entry(configuration); logger.exit(); } @Override public List<URL> getFileLocations() { logger.entry(); List<URL> readFromLocations = new ArrayList<>(); if (configuration != null) { String configurationLocation = configuration.getProperty(CONFIG_FILE_LOCATION_PARAMETER_NAME, String.class); if (!Utils.isEmpty(configurationLocation)) { readFromLocations.addAll(Utils.loadResources(configurationLocation)); } else { logger.debug("No configuration resource location is specified using parameter {}", CONFIG_FILE_LOCATION_PARAMETER_NAME); } } return logger.exit(readFromLocations); } }
[ "sh3khar.jha@gmail.com" ]
sh3khar.jha@gmail.com
0a535867eb9012ca968232e92a03eb1dfe4dcf91
1aa2d27b4762ffa368018aac3bf9ab671b54abed
/cmpe226/src/cmpe226/AdminPage.java
371ee565c4a9d52e01d976a813f1c1000a897ad7
[]
no_license
pruthvivadlamudi/OnlineCourseManagementSystem
892f0960116e2e1a269feec4c9a9ef81a91c248e
6610ec7577c9be118e4fcc9764a2b05f9033be43
refs/heads/master
2020-03-17T05:22:30.960417
2018-05-14T06:49:14
2018-05-14T06:49:14
133,314,061
1
0
null
null
null
null
UTF-8
Java
false
false
2,669
java
package cmpe226; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.Scanner; public class AdminPage { public void start(Connection con) throws Exception { while(true) { System.out.println("Press 1) to add new University \n2) Logout"); Scanner sc = new Scanner(System.in); int choice = sc.nextInt(); switch(choice) { case 1: registerUniversity(con); break; case 2: TestConnection tc = new TestConnection(); tc.loginRegister(con); } } } private int registerUniversity(Connection con) throws Exception { @SuppressWarnings("resource") Scanner sc = new Scanner(System.in); int id=0; PreparedStatement getID = con.prepareStatement("Select max(id) from login"); PreparedStatement insLogin = con.prepareStatement("insert into Login values(?,?,?,'University')"); PreparedStatement insUniv = con.prepareStatement("insert into University values(?,?,(?,?,?,?))"); try { ResultSet rs_getID = getID.executeQuery(); if(!rs_getID.isBeforeFirst()) { id=0; } while(rs_getID.next()) { id=rs_getID.getInt(1) + 1; } System.out.println("Enter Username: "); String uname = sc.nextLine(); System.out.println("Enter password: "); String pswd = sc.nextLine(); System.out.println(); insLogin.setInt(1, id); insLogin.setString(2, uname); insLogin.setString(3, pswd); int rs_insLogin = insLogin.executeUpdate(); if(rs_insLogin<=0) { System.out.println("Login registeration failed!"); } else { System.out.println("You have created your Login information."); } System.out.println("Enter name of Univerity"); String name = sc.nextLine(); System.out.println("Enter Street: "); String street = sc.nextLine(); System.out.println("Enter City: "); String city = sc.nextLine(); System.out.println("Enter State: "); String state = sc.nextLine(); System.out.println("Enter Zipcode: "); int zp = sc.nextInt(); System.out.println(); insUniv.setInt(1, id); insUniv.setString(2, name); insUniv.setString(3, street); insUniv.setString(4, city); insUniv.setString(5, state); insUniv.setInt(6, zp); int rs_insUniv = insUniv.executeUpdate(); if(rs_insUniv<=0) { System.out.println("University registeration failed!"); } else { System.out.println("You have registered successfully!"); } UniversityPage uPage = new UniversityPage(); uPage.start(con, id); } finally { getID.close(); insLogin.close(); insUniv.close(); // sc.close(); } return id; } }
[ "pruthvi.vadlamudi@gmail.com" ]
pruthvi.vadlamudi@gmail.com
4b7557bb20a6dc9509a5b7159f9a25f1bc1cef0c
f01c296c611a61dd0eb4f5b8a87b900719507560
/SimpleBot.java
02d3bf65b154c4b921941ea6e575497fa5e5f84f
[]
no_license
LighterPro/JetBrainsAcademy-SimpleChattyBot
9d4fadbece945735961ceb454d086f32a0791ccd
37c949276e99b6e4e29055baaa939a08fdea2536
refs/heads/main
2023-07-29T09:06:27.378222
2021-09-18T19:04:32
2021-09-18T19:04:32
407,943,884
0
0
null
null
null
null
UTF-8
Java
false
false
2,186
java
package bot; import java.util.Scanner; public class SimpleBot { final static Scanner scanner = new Scanner(System.in); // Do not change this line public static void main(String[] args) { greet("Aid", "2018"); // change it as you need remindName(); guessAge(); count(); test(); end(); } static void greet(String assistantName, String birthYear) { System.out.println("Hello! My name is " + assistantName + "."); System.out.println("I was created in " + birthYear + "."); System.out.println("Please, remind me your name."); } static void remindName() { String name = scanner.nextLine(); System.out.println("What a great name you have, " + name + "!"); } static void guessAge() { System.out.println("Let me guess your age."); System.out.println("Enter remainders of dividing your age by 3, 5 and 7."); int rem3 = scanner.nextInt(); int rem5 = scanner.nextInt(); int rem7 = scanner.nextInt(); int age = (rem3 * 70 + rem5 * 21 + rem7 * 15) % 105; System.out.println("Your age is " + age + "; that's a good time to start programming!"); } static void count() { System.out.println("Now I will prove to you that I can count to any number you want."); int num = scanner.nextInt(); for (int i = 0; i <= num; i++) { System.out.printf("%d!\n", i); } } static void test() { System.out.println("Let's test your programming knowledge."); System.out.println("Why do we use methods?\n" + "1. To repeat a statement multiple times.\n" + "2. To decompose a program into several small subroutines.\n" + "3. To determine the execution time of a program.\n" + "4. To interrupt the execution of a program."); int answer = scanner.nextInt(); while (answer != 2) { System.out.println("Please, try again."); answer = scanner.nextInt(); } } static void end() { System.out.println("Congratulations, have a nice day!"); } }
[ "noreply@github.com" ]
noreply@github.com
90aa9ecaba291612071e57e1e4159f277253fa9d
8378cefea1b50e19f53ead20918a38cdf68d60f9
/src/main/java/com/inted/as/hss/fe/sh/services/PurService.java
14b1ea19fc64d15974e3bd8f2e1bdf976ba83c49
[]
no_license
ssogunle/hss-fe
43136eaddaeb05d0e5499b6a466424d5c6177948
e999a6193898505c057b690b3f898097460c315c
refs/heads/master
2020-04-18T23:48:17.170571
2016-08-30T20:26:46
2016-08-30T20:26:46
167,830,478
1
0
null
null
null
null
UTF-8
Java
false
false
1,758
java
package com.inted.as.hss.fe.sh.services; import java.util.HashMap; import java.util.Map; import org.jdiameter.api.AvpDataException; import org.jdiameter.api.Request; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.inted.as.hss.fe.utils.DiameterUtil; /** * * @author Segun Sogunle Class for Sh Interface - Profile-Update-Request Service * * Reference Doc: 3GPP TS 29.328 * * The service allows an Application Server to do the following: * * -Update repository(transparent) data stored at the HSS for each IMS Public User Identity * -Update the PSI Activation State of a distinct Public Service Identity in the HSS * -Update the Dynamic Service Activation Info stored at the HSS * -Update the Short Message Service Registration Info stored at the HSS * -update the STN-SR stored at the HSS. * */ public class PurService { private static final Logger LOG = LoggerFactory.getLogger(PurService.class); private Request r; public PurService(Request r) { this.r = r; } private Map<String,Object> getAvps(Request req) throws AvpDataException{ Map<String,Object> avps = new HashMap<String,Object>(); //Vendor-specific-application-Id not implemented yet! avps.put("auth_session_state", DiameterUtil.getAuthSessionState(req)); avps.put("origin_host", DiameterUtil.getOriginHost(req)); avps.put("origin_realm", DiameterUtil.getOriginRealm(req)); avps.put("dest_realm", DiameterUtil.getDestinationRealm(req)); avps.put("server_name", DiameterUtil.getServerName(req)); avps.put("data_references", DiameterUtil.getDataReferenceAvps(req)); avps.put("public_identity", DiameterUtil.getPublicIdentity(req)); avps.put("user_data", DiameterUtil.getPublicIdentity(req)); return avps; } }
[ "s.sogunle@gmail.com" ]
s.sogunle@gmail.com
640f0718439c236449283e9925ae23ec624494c3
0af8b92686a58eb0b64e319b22411432aca7a8f3
/large-multiproject/project43/src/test/java/org/gradle/test/performance43_5/Test43_479.java
b81f69134b32156cc79eb9cbde5425ae26586e16
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
292
java
package org.gradle.test.performance43_5; import static org.junit.Assert.*; public class Test43_479 { private final Production43_479 production = new Production43_479("value"); @org.junit.Test public void test() { assertEquals(production.getProperty(), "value"); } }
[ "cedric.champeau@gmail.com" ]
cedric.champeau@gmail.com
da4707d8f08ecf78b6a25c86070d8011c3666472
fe2f9989fb87b5bc7f06c44fbbb789d833b44f7d
/app/src/main/java/com/swachtaapp/ui/home/HomeFragment.java
472562852af291a65d2c8170155c496e6a86b30f
[]
no_license
prameet123/swachtaApp
195b52920b1b1e27b47394084db8aa497d90d4f2
875236fba826cfef5670ac90d9e400b2ee186ac3
refs/heads/master
2022-04-11T22:42:51.510648
2020-03-26T13:50:41
2020-03-26T13:50:41
250,271,359
0
0
null
null
null
null
UTF-8
Java
false
false
5,562
java
package com.swachtaapp.ui.home; import android.app.Activity; import android.app.ProgressDialog; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; import androidx.annotation.Nullable; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.fragment.app.Fragment; import androidx.lifecycle.Observer; import androidx.lifecycle.ViewModelProviders; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.ListAdapter; import androidx.recyclerview.widget.RecyclerView; import com.android.volley.AuthFailureError; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; import com.swachtaapp.MainActivity; import com.swachtaapp.R; import com.swachtaapp.URLs; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; public class HomeFragment extends Fragment { private RecyclerView mList; private List<HomeViewModel> Lists; private RecyclerView.Adapter adapter; public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Lists = new ArrayList<>(); adapter = new HomeAdapter(getActivity(), Lists); final View root = inflater.inflate(R.layout.fragment_home, container, false); mList= (RecyclerView)root.findViewById(R.id.recyclerView); mList.setHasFixedSize(true); mList.setLayoutManager(new LinearLayoutManager(getActivity())); mList.setAdapter(adapter); displayData(); return root; } public void displayData() { //final HomeViewModel[] homeViewModels =new HomeViewModel[]{}; final ProgressDialog progressDialog = new ProgressDialog(getActivity()); progressDialog.setMessage("Loading..."); progressDialog.show(); StringRequest stringRequest = new StringRequest(Request.Method.GET, URLs.URL_GET, new Response.Listener<String>() { @Override public void onResponse(String response) { try { //converting response to json object JSONObject obj = new JSONObject(response); //if no error in response if (obj.getBoolean("status")) { Log.e(URLs.URL_GET, response.toString()); //getting the user from the response progressDialog.dismiss(); //Toast.makeText(getActivity(), obj.getString("message"), Toast.LENGTH_SHORT).show(); JSONArray array = obj.getJSONArray("data"); if (array != null) { for (int j = 0; j <=array.length() - 1; j++) { JSONObject innerElem = array.getJSONObject(j); Log.e("testData", innerElem.getString("binNo")); if (innerElem != null) { HomeViewModel Std = new HomeViewModel(); Std.setBinNumber(innerElem.getString("binNo")); Std.setAddress(innerElem.getString("address")); Std.setStatus(innerElem.getString("status")); Std.setRemark(innerElem.getString("remark")); Std.setDate(innerElem.getString("createdOn")); Lists.add(Std); adapter.notifyDataSetChanged(); } } } } else { Toast.makeText(getActivity(), obj.getString("message"), Toast.LENGTH_SHORT).show(); } } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Toast.makeText(getActivity(), "Network Error ", Toast.LENGTH_SHORT).show(); progressDialog.dismiss(); } }) { @Override protected Map<String, String> getParams() throws AuthFailureError { Map<String, String> params = new HashMap<>(); params.put("bin", ""); return params; } }; RequestQueue requestQueue = Volley.newRequestQueue(getActivity()); requestQueue.add(stringRequest); } }
[ "parmeet@vitaziatech.com" ]
parmeet@vitaziatech.com
a54a94ace0d0bc3ca7762fa6f305b89123ce7b1a
93b7a599ed54b27e5f9723734c1ad52fcb4a7ea9
/app/src/main/java/com/tram/saletech/API/APIRequest.java
a5dc1b2c4397d03e59597fc4a91be7056218b145
[]
no_license
tram421/SaleTech
cdaa5a432ad98730c39cab6492728050f606a7d4
59b62f6a09993674618e4c0f485123bbfa52af7d
refs/heads/master
2023-04-18T20:48:20.555658
2021-05-05T04:52:32
2021-05-05T04:52:32
355,275,478
0
0
null
null
null
null
UTF-8
Java
false
false
1,801
java
package com.tram.saletech.API; import com.google.gson.Gson; import java.util.List; import retrofit2.Call; import retrofit2.http.Field; import retrofit2.http.FormUrlEncoded; import retrofit2.http.GET; import retrofit2.http.POST; public interface APIRequest { @POST("http://maitram.net/api/user.php") Call<List<User>> fetchUser(); @GET("http://maitram.net/api/product.php") Call<List<Product>> fetchProduct(); @FormUrlEncoded @POST("http://maitram.net/api/user.php") Call<List<User>> creatPost( @Field("userid") Integer userid ); @FormUrlEncoded @POST("http://maitram.net/api/user.php") Call<String> creatPost_checkLogin( @Field("user") String name, @Field("password") String password ); @FormUrlEncoded @POST("http://maitram.net/api/cart.php") Call<List<Product>> creatPost_getProductFromCart( @Field("cart") String idProduct ); @FormUrlEncoded @POST("http://maitram.net/api/cart.php") Call<String> inserListCartToUserI( @Field("list") String listIdAndQuantity, @Field("id") Integer id ); @FormUrlEncoded @POST("http://maitram.net/api/voucher.php") Call<List<Voucher>> getVoucherAPII( @Field("userid") Integer userid ); @FormUrlEncoded @POST("http://maitram.net/api/order.php") Call<String> insertToOrderI( @Field("iduser") int userid, @Field("list") String listProduct, @Field("idvoucher") int idvoucher, @Field("bill") int totalBill, @Field(("description")) String description ); @FormUrlEncoded @POST("http://maitram.net/api/order.php") Call<List<Order>> getOrderOfUserI( @Field("iduser1") int userid ); }
[ "maitram0291@gmail.com" ]
maitram0291@gmail.com
5212e2077f2262e16272687245385c8e38a3982b
011fb351682ce2d46cce63de84d8371498d601be
/src/main/java/com/vinay/learning/zipfunctionpart17/unsubscribepart5/YahooFinance.java
ae2d32145c4fe0db5935c69cd1dbd4811e237a3c
[]
no_license
vinayrshanbhag/ReactiveProgramming
0adda53e1a1d76479c579bf898d9248d025b68ae
f2cec7dc86dfdb3b1a3a64bad9c4c64736586d2d
refs/heads/master
2020-03-08T05:12:19.931502
2018-04-12T16:58:50
2018-04-12T16:58:50
127,942,408
0
0
null
null
null
null
UTF-8
Java
false
false
998
java
package com.vinay.learning.zipfunctionpart17.unsubscribepart5; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; public class YahooFinance { public static double getPriceOrig(final String ticker) { try { final URL url = new URL("http://ichart.finance.yahoo.com/table.csv?s=" + ticker); final BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream())); final String data = reader.lines().skip(1).limit(1).findFirst().get(); final String[] dataItems = data.split(","); double price = Double.parseDouble(dataItems[dataItems.length - 1]); return price; } catch(Exception ex) { throw new RuntimeException(ex); } } public static double getPriceMock(final String ticker) { return Math.random() * 2000; } public static double getPrice(final String ticker, boolean useMock) { return useMock ? getPriceMock(ticker) : getPriceOrig(ticker); } }
[ "vinay.shanbhag@live.com" ]
vinay.shanbhag@live.com
4cbbc514f9a8451d160e1b938dd91b9789dcc4ee
3b754b053c6af2f4013cac58ff15fbe98ec42cee
/LlaveCompuesta/src/java/escom/libreria/info/proveedor/jsf/util/PaginationHelper.java
73e38df03b68c02ea8e87402ba88167531c8a10e
[]
no_license
admhouss/libreria-faces
98b748013158ca2683c8af3e76eb768ed7e17531
a73ca66a7a6e6ca700112623658c812b6ce06eb7
refs/heads/master
2021-01-22T13:36:41.210668
2012-05-13T02:29:51
2012-05-13T02:29:51
38,445,008
1
0
null
null
null
null
UTF-8
Java
false
false
1,130
java
package escom.libreria.info.proveedor.jsf.util; import javax.faces.model.DataModel; public abstract class PaginationHelper { private int pageSize; private int page; public PaginationHelper(int pageSize) { this.pageSize = pageSize; } public abstract int getItemsCount(); public abstract DataModel createPageDataModel(); public int getPageFirstItem() { return page*pageSize; } public int getPageLastItem() { int i = getPageFirstItem() + pageSize -1; int count = getItemsCount() - 1; if (i > count) { i = count; } if (i < 0) { i = 0; } return i; } public boolean isHasNextPage() { return (page+1)*pageSize+1 <= getItemsCount(); } public void nextPage() { if (isHasNextPage()) { page++; } } public boolean isHasPreviousPage() { return page > 0; } public void previousPage() { if (isHasPreviousPage()) { page--; } } public int getPageSize() { return pageSize; } }
[ "aaron.jazhiel@hotmail.com" ]
aaron.jazhiel@hotmail.com
3e66c8e57360d975ea9813f7e098074d958aa65e
f3bc97b3c8410844380fb23d43424accc906452b
/spring-boot-security-postgresql-master/src/main/java/com/bezkoder/spring/security/postgresql/models/Paiement.java
17ac9687250bb3aa374d4f9159824d87acd0c5d9
[]
no_license
louay155/projet-back
f6a8646363276f0d053d832bb5580ec7146de1ac
50a8d0de87a643ae45171f2254caa2ec6ba1829f
refs/heads/master
2023-05-13T21:07:23.997646
2021-06-10T17:00:30
2021-06-10T17:00:30
375,768,599
0
0
null
null
null
null
UTF-8
Java
false
false
999
java
package com.bezkoder.spring.security.postgresql.models; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name="paiement") public class Paiement { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private long id; @Column(name="montant") private float montant; @Column(name="Date_pai") private Date date_pai; public Paiement() {} public Paiement(float montant, Date date_pai) { super(); this.montant = montant; this.date_pai = date_pai; } public long getId() { return id; } public void setId(long id) { this.id = id; } public float getMontant() { return montant; } public void setMontant(float montant) { this.montant = montant; } public Date getDate_pai() { return date_pai; } public void setDate_pai(Date date_pai) { this.date_pai = date_pai; } }
[ "The Nutorious BIG@LAPTOP-FQSLPKUF" ]
The Nutorious BIG@LAPTOP-FQSLPKUF
f8bc4ec30cf002fd25d8c98056c17551cf05d5c2
e97d84c134148ce559cfec34d7665b641fd0f061
/pisi/unitedmeows/meowlib/clazz/event.java
0c1638b4bc29d80a2fff11d131823ea273acbe81
[]
no_license
united-meows/MeowLib
6d6cd3f26bb492698db7ee9aaf7c8b1c0574fae5
551b812f8be0c682e4759881605f2529d97a78dc
refs/heads/master
2023-08-16T08:52:04.688193
2021-10-22T20:00:43
2021-10-22T20:00:43
336,835,771
5
1
null
null
null
null
UTF-8
Java
false
false
1,238
java
package pisi.unitedmeows.meowlib.clazz; import pisi.unitedmeows.meowlib.etc.Tuple; import pisi.unitedmeows.meowlib.random.WRandom; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.HashMap; public class event<X extends delegate> { private HashMap<Integer, Tuple<X, Method>> delegates; public event() { delegates = new HashMap<>(); } public int bind(X delegate) { int id = WRandom.BASIC.nextInt(); final Method method = delegate.getClass().getDeclaredMethods()[0]; if (!method.isAccessible()) { method.setAccessible(true); } delegates.put(id, new Tuple<>(delegate, method)); return id; } public void unbindAll() { delegates.clear(); } public void unbind(int id) { delegates.remove(id); } public void run(Object... params) { delegates.values().forEach(x-> { try { x.getSecond().invoke(x.getFirst(), params); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } }); } }
[ "47327665+slowcheet4h@users.noreply.github.com" ]
47327665+slowcheet4h@users.noreply.github.com
308c501ffb512cbd487b6f36b868a645e30cd26f
8d63b5b2a1440fc8a53d986896cb26bde2046a09
/src/main/java/org/tonzoc/controller/SecurityChangController.java
bd4bab52da8b49c10932402c7f4160370f004364
[]
no_license
tsregll/jihei
d7397858300e08632b0df6849b29604eef5d8b42
f7cc0081c680fdcfc5232eaecc6f0e24afe60315
refs/heads/master
2023-05-14T21:08:00.275717
2021-05-30T11:59:29
2021-05-30T11:59:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,532
java
package org.tonzoc.controller; import com.github.pagehelper.Page; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import org.tonzoc.controller.params.PageQueryParams; import org.tonzoc.controller.params.SecurityChangQueryParams; import org.tonzoc.controller.response.PageResponse; import org.tonzoc.exception.PageException; import org.tonzoc.model.SecurityChangModel; import org.tonzoc.model.UserModel; import org.tonzoc.service.IRedisAuthService; import org.tonzoc.service.ISecurityChangService; import org.tonzoc.service.ISecurityService; import org.tonzoc.support.param.SqlQueryParam; import javax.validation.Valid; import java.lang.reflect.InvocationTargetException; import java.text.ParseException; import java.util.List; @RestController @RequestMapping("securityChang") @Transactional public class SecurityChangController extends BaseController{ @Autowired private ISecurityChangService securityChangService; @Autowired private ISecurityService securityService; @Autowired private IRedisAuthService redisAuthService; @GetMapping public PageResponse list(PageQueryParams pageQueryParams, SecurityChangQueryParams securityChangQueryParams,String accounType, String flag) throws PageException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { Page<SecurityChangModel> page = parsePage(pageQueryParams); // 监理 if (accounType != null) { if (accounType.equals("2") && "0".equals(flag)){ // flag = 0 施工单位查到未提交,监理查不到 securityChangQueryParams.setStatus("submitted,unFinish,finish"); }else if (accounType.equals("0") && "1".equals(flag)){ securityChangQueryParams.setStatus("submitted,unFinish,finish"); } } List<SqlQueryParam> sqlQueryParams = parseSqlQueryParams(securityChangQueryParams); List<SecurityChangModel> list = securityChangService.list(sqlQueryParams); return new PageResponse(page.getTotal(), list); } @PostMapping public void add(SecurityChangModel securityChangModel, MultipartFile[] file, Integer fileType) throws Exception { securityChangService.add(securityChangModel, file, fileType, "0"); } @PutMapping(value = "{guid}") public void update(@RequestBody @Valid SecurityChangModel securityChangModel) throws Exception { UserModel userModel = redisAuthService.getCurrentUser(); securityChangService.updateStack(securityChangModel, userModel); this.securityChangService.update(securityChangModel); } @DeleteMapping(value = "{guid}") public void remove(@PathVariable(value = "guid") String guid) throws Exception { UserModel userModel = redisAuthService.getCurrentUser(); this.securityChangService.removeStack(guid, userModel); } // 提交 @PostMapping(value = "submit") public void submit(String securityChangGuid){ securityChangService.submit(securityChangGuid); } // 审批 @PostMapping(value = "approval") public void approval(String securityChangGuid, Integer flag, String approvalScore, String approvalPersonName) throws Exception { securityChangService.approval(securityChangGuid, flag, approvalScore, approvalPersonName); } }
[ "736318704@qq.com" ]
736318704@qq.com
638478d930c00561ce36021f2dfbdd93ed76e627
c7fcf388195350e12d3db1aa879285a923bb5594
/src/main/java/br/com/queridoautomovel/model/domain/Log4j.java
055d77db1e48720c1568f96b561a3f1b89783126
[ "Apache-2.0" ]
permissive
sergiostorinojr/QueridoAutomovel
d9ba2d5fc0197c2cb80cb36cc02f3045830cb0c6
2383a42204d153342569ad7c4aefc15b2f605c3d
refs/heads/master
2021-01-10T04:14:57.003067
2015-12-13T22:56:32
2015-12-13T22:56:32
47,889,570
0
0
null
null
null
null
IBM852
Java
false
false
1,836
java
package br.com.queridoautomovel.model.domain; import java.io.Serializable; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; import javax.xml.bind.annotation.XmlRootElement; /** * * QueridoAutomovel * * @author SÚrgio Junior - sergio.storinojr@gmail.com * 08/12/2015 * */ @Entity @Table(name = "controleLog4j") public class Log4j extends AbstractEntity implements Serializable { @Column(name = "data", length = 25) private String data; @Column(name = "applicacao", length = 2000) private String applicacao; @Column(name = "thread", length = 200) private String thread; @Column(name = "categoria", length = 200) private String categoria; @Column(name = "prioridade", length = 400) private String prioridade; @Column(name = "mensagem", length = 500) private String mensagem; public Log4j() { // TODO Auto-generated constructor stub } public final String getData() { return data; } public final String getApplicacao() { return applicacao; } public final String getThread() { return thread; } public final String getCategoria() { return categoria; } public final String getPrioridade() { return prioridade; } public final String getMensagem() { return mensagem; } public void setData(String data) { this.data = data; } public void setApplicacao(String applicacao) { this.applicacao = applicacao; } public void setThread(String thread) { this.thread = thread; } public void setCategoria(String categoria) { this.categoria = categoria; } public void setPrioridade(String prioridade) { this.prioridade = prioridade; } public void setMensagem(String mensagem) { this.mensagem = mensagem; } }
[ "Junior@Juniior" ]
Junior@Juniior
15219696c5636bed873ee2922ea302feb54e6a4c
fe00e53b98ae9218684c47334a635db2e6ee5d43
/src/main/java/lk/samarasingherSuper/configuration/CustomAuthenticationSuccessHandler.java
743cb459583c2540f24db4e34aa96a7d63a56bce
[]
no_license
Sashisithara1997/samarasingherSuper
5c0a2f92b20c63b0c8c06b137de3ae0a362d3311
0f07da45e4f35e4b6e1e0ae62b7ed9c63a340a66
refs/heads/master
2022-11-18T07:23:55.595126
2020-07-10T02:57:25
2020-07-10T02:57:25
269,113,153
0
0
null
null
null
null
UTF-8
Java
false
false
2,587
java
package lk.samarasingherSuper.configuration; import lk.samarasingherSuper.asset.userManagement.entity.Enum.UserSessionLogStatus; import lk.samarasingherSuper.asset.userManagement.entity.User; import lk.samarasingherSuper.asset.userManagement.entity.UserSessionLog; import lk.samarasingherSuper.asset.userManagement.service.UserService; import lk.samarasingherSuper.asset.userManagement.service.UserSessionLogService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.web.authentication.AuthenticationSuccessHandler; import org.springframework.stereotype.Component; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.time.LocalDateTime; @Component( "customAuthenticationSuccessHandler" ) public class CustomAuthenticationSuccessHandler implements AuthenticationSuccessHandler { @Autowired private UserSessionLogService userSessionLogService; @Autowired private UserService userService; @Override public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { //do some logic here if you want something to be done whenever User authUser = userService.findByUserName(SecurityContextHolder.getContext().getAuthentication().getName()); //if user already have failure attempt clean before a save new session log //the user successfully logs in. UserSessionLog userSessionLog = new UserSessionLog(); userSessionLog.setUser(authUser); userSessionLog.setUserSessionLogStatus(UserSessionLogStatus.LOGGED); userSessionLog.setCreatedAt(LocalDateTime.now()); userSessionLogService.persist(userSessionLog); /* //default session is ok ->>>>> HttpSession session = request.getSession(); session.setAttribute("username", authUser.getUsername()); session.setAttribute("authorities", authentication.getAuthorities()); */ //set our response to OK status response.setStatus(HttpServletResponse.SC_OK); //since we have created our custom success handler, its up to us to where we will redirect the user after // successfully login response.sendRedirect("/mainWindow"); } }
[ "sashisithara97@outlook.com" ]
sashisithara97@outlook.com
b32954bad2637c9bd21811a0eb725dce068e67ac
9bdb2afdc29130c55ba79b84224bcd5809a9ffc8
/src/dataStructures/LinkedListADT.java
fdf4eb367bceb3207a34e6fe2f7b19dbe7c8cd71
[]
no_license
jchukwuezi/MyCollege-ADS-
62ac729dff049803f9fe37536d6f88c3b08a6300
dd87882056615b03f45f3cc0bf3a210253c05e8d
refs/heads/master
2021-01-14T19:06:03.587856
2019-11-18T18:48:12
2019-11-18T18:48:12
242,723,548
0
0
null
null
null
null
UTF-8
Java
false
false
1,185
java
/* * File name: LinkedListADT.java * Author: Joshua Chukwuezi * Student Number: C18709101 * Descripiton of class: Abstract Data Type definition for a Linked List */ package dataStructures; public interface LinkedListADT <T> { // Adds one element to the start or end of this list public void add (T element); // Removes and returns the first element from this list public T remove(T element); // Returns true if this list contains no elements public boolean isEmpty(); // Returns the number of elements in this list public int size(); // Returns a string representation of this list public String toString(); //returns through if it discovers a duplicate element in the list public boolean contains (T element); //Returns first generic object in the list public T getFirst(); //Returns last generic object in the list public T getLast(); //Returns next generic object in the list, where the current object is passed in as a parameter public T getNextGeneric(T element); //Reverses the linked list public void reverse(); }
[ "c18709101@mydit.ie" ]
c18709101@mydit.ie
5ec32a5f8aa0940e13f299b1c0218f20ceb86a07
46d6928ecc36f64575e484011dd923137d3dad6d
/src/main/java/com/autencio/HelloWorld.java
b09e39a28a98009a90758e6fc9be69fa01cf5b91
[]
no_license
gwenharold/programming-problems
f0f08f3e176fbe12be96ae5ed33251a5d5b3500a
1c0b62b9fa5928cdcd0e4f3c4e7bc00081f2a531
refs/heads/master
2021-01-10T11:01:25.766424
2016-04-10T13:26:15
2016-04-10T13:26:15
54,929,059
0
0
null
null
null
null
UTF-8
Java
false
false
322
java
package com.autencio; import org.joda.time.LocalTime; public class HelloWorld { public static void main(String[] args) { LocalTime currentTime = new LocalTime(); System.out.println("The current local time is: " + currentTime); Greeter greeter = new Greeter(); System.out.println(greeter.sayHello()); } }
[ "gwen.autencio@gmail.com" ]
gwen.autencio@gmail.com
93687eb88172dc42d91ae6776d41e1281258e66c
786a0d232a4de410c2845858606ce7eece2b4b30
/ifc/sdg/joana.ifc.sdg.util/src/edu/kit/joana/ifc/sdg/util/GraphStats.java
d59d4d5b4a40bd210477de9c28cb2022bf30bb49
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
AdriLezaack/joana
5baf6c3de302caa20ba007f7421787d7fba4ab09
02ac9ac5ac57fcbdfba6883b35d188583425575a
refs/heads/master
2020-03-13T14:51:08.070748
2018-04-25T15:19:06
2018-04-25T15:19:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,516
java
/** * This file is part of the Joana IFC project. It is developed at the * Programming Paradigms Group of the Karlsruhe Institute of Technology. * * For further details on licensing please read the information at * http://joana.ipd.kit.edu or contact the authors. */ package edu.kit.joana.ifc.sdg.util; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map.Entry; import java.util.Set; import java.util.SortedMap; import java.util.TreeMap; import edu.kit.joana.ifc.sdg.graph.SDG; import edu.kit.joana.ifc.sdg.graph.SDGNode; import edu.kit.joana.util.Pair; class GraphStats implements Iterable<Pair<String, MethodStats>> { private final SortedMap<String, List<MethodStats>> stats = new TreeMap<String, List<MethodStats>>(); private GraphStats() { } private void addMethodStatsFor(String mSig, MethodStats mStats) { List<MethodStats> lsMethodStats; if (!stats.containsKey(mSig)) { lsMethodStats = new LinkedList<MethodStats>(); stats.put(mSig, lsMethodStats); } else { lsMethodStats = stats.get(mSig); } lsMethodStats.add(mStats); } private boolean containsMethodStatsFor(String mSig) { return stats.containsKey(mSig); } private List<MethodStats> getMethodStatsFor(String mSig) { return stats.get(mSig); } private Set<String> getMethodSignatures() { return stats.keySet(); } /* * (non-Javadoc) * * @see java.lang.Iterable#iterator() */ @Override public Iterator<Pair<String, MethodStats>> iterator() { final Iterator<Entry<String, List<MethodStats>>> statsIter = stats.entrySet().iterator(); return new Iterator<Pair<String, MethodStats>>() { Entry<String, List<MethodStats>> curEntry = null; Iterator<MethodStats> curIter = null; @Override public boolean hasNext() { if (curEntry == null) { assert curIter == null; return statsIter.hasNext(); } else { assert curIter != null; return curIter.hasNext() || statsIter.hasNext(); } } @Override public Pair<String, MethodStats> next() { if (curEntry == null) { assert curIter == null; curEntry = statsIter.next(); curIter = curEntry.getValue().iterator(); // inv: all lists occurring as values are non-empty assert curIter.hasNext(); return Pair.pair(curEntry.getKey(), curIter.next()); } else { assert curIter != null; if (curIter.hasNext()) { return Pair.pair(curEntry.getKey(), curIter.next()); } else { curEntry = statsIter.next(); curIter = curEntry.getValue().iterator(); // inv: all lists occurring as values are non-empty assert curIter.hasNext(); return Pair.pair(curEntry.getKey(), curIter.next()); } } } @Override public void remove() { throw new UnsupportedOperationException("This operation is not supported!"); } }; } public static GraphStats computeFrom(SDG sdg) { GraphStats ret = new GraphStats(); for (SDGNode node : sdg.vertexSet()) { if (node.getKind() == SDGNode.Kind.ENTRY && !ret.containsMethodStatsFor(node.getBytecodeMethod())) { ret.addMethodStatsFor(node.getBytecodeMethod(), MethodStats.computeFrom(node, sdg)); } } return ret; } public static GraphStats union(GraphStats gs1, GraphStats gs2) { Set<String> mSigs = new HashSet<String>(); mSigs.addAll(gs1.getMethodSignatures()); mSigs.retainAll(gs2.getMethodSignatures()); if (!mSigs.isEmpty()) { throw new IllegalArgumentException("Cannot join graph stats with common methods!"); } else { GraphStats ret = new GraphStats(); for (Pair<String, MethodStats> e : gs1) { ret.addMethodStatsFor(e.getFirst(), e.getSecond()); } for (Pair<String, MethodStats> e : gs2) { ret.addMethodStatsFor(e.getFirst(), e.getSecond()); } return ret; } } public static GraphStats difference(GraphStats gs1, GraphStats gs2) { GraphStats ret = new GraphStats(); for (Pair<String, MethodStats> e : gs1) { if (gs2.containsMethodStatsFor(e.getFirst())) { List<MethodStats> lsMDiff = MethodStats.subtract(e.getSecond(), gs2.getMethodStatsFor(e.getFirst())); for (MethodStats mDiff : lsMDiff) { if (!mDiff.isZero()) { ret.addMethodStatsFor(e.getFirst(), mDiff); } } } else { ret.addMethodStatsFor(e.getFirst(), e.getSecond()); } } return ret; } public static GraphStats symmetricDifference(GraphStats gs1, GraphStats gs2) { return union(difference(gs1, gs2), difference(gs2, gs1)); } }
[ "martin.mohr@kit.edu" ]
martin.mohr@kit.edu
0a370315116110f8f2305ab76ea9bcc16eff292f
e1a4802dc97c4230915df439e4ce684951960741
/Evnetbus/app/src/test/java/com/example/yunseung_u/evnetbus/ExampleUnitTest.java
0f1e19ebc97f051a2d87b88df5afbfdabcb01ed3
[]
no_license
Aswoo/Used-Library
ffdbc18ac971c9c56708837ed8910a312899e34d
4c4a6d5565c3dbcd9b94aaff4851bad5520e5971
refs/heads/master
2020-03-22T10:57:40.458552
2018-08-30T03:23:55
2018-08-30T03:23:55
139,938,380
0
0
null
null
null
null
UTF-8
Java
false
false
392
java
package com.example.yunseung_u.evnetbus; 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); } }
[ "yhnu191919@gmail.com" ]
yhnu191919@gmail.com
7edaa5655b33416c90e2343fc15781297acc65dc
065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be
/eclipsejdt_cluster/12408/src_1.java
7c2387572a93e17ec81cc6483df214d3d0a03d30
[]
no_license
martinezmatias/GenPat-data-C3
63cfe27efee2946831139747e6c20cf952f1d6f6
b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4
refs/heads/master
2022-04-25T17:59:03.905613
2020-04-15T14:41:34
2020-04-15T14:41:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
59,996
java
/******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.jdt.internal.core; import java.io.*; import java.util.*; import java.util.zip.ZipFile; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; import org.eclipse.jdt.core.*; import org.eclipse.jdt.core.search.SearchEngine; import org.eclipse.jdt.internal.codeassist.CompletionEngine; import org.eclipse.jdt.internal.codeassist.SelectionEngine; import org.eclipse.jdt.internal.compiler.Compiler; import org.eclipse.jdt.internal.core.builder.JavaBuilder; import org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy; import org.eclipse.jdt.internal.core.search.AbstractSearchScope; import org.eclipse.jdt.internal.core.search.indexing.IndexManager; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; import org.xml.sax.SAXException; /** * The <code>JavaModelManager</code> manages instances of <code>IJavaModel</code>. * <code>IElementChangedListener</code>s register with the <code>JavaModelManager</code>, * and receive <code>ElementChangedEvent</code>s for all <code>IJavaModel</code>s. * <p> * The single instance of <code>JavaModelManager</code> is available from * the static method <code>JavaModelManager.getJavaModelManager()</code>. */ public class JavaModelManager implements ISaveParticipant { /** * Unique handle onto the JavaModel */ final JavaModel javaModel = new JavaModel(); /** * Classpath variables pool */ public static HashMap Variables = new HashMap(5); public static HashMap PreviousSessionVariables = new HashMap(5); public static HashSet OptionNames = new HashSet(20); public final static String CP_VARIABLE_PREFERENCES_PREFIX = JavaCore.PLUGIN_ID+".classpathVariable."; //$NON-NLS-1$ public final static String CP_CONTAINER_PREFERENCES_PREFIX = JavaCore.PLUGIN_ID+".classpathContainer."; //$NON-NLS-1$ public final static String CP_ENTRY_IGNORE = "##<cp entry ignore>##"; //$NON-NLS-1$ /** * Classpath containers pool */ public static HashMap Containers = new HashMap(5); public static HashMap PreviousSessionContainers = new HashMap(5); /** * Name of the extension point for contributing classpath variable initializers */ public static final String CPVARIABLE_INITIALIZER_EXTPOINT_ID = "classpathVariableInitializer" ; //$NON-NLS-1$ /** * Name of the extension point for contributing classpath container initializers */ public static final String CPCONTAINER_INITIALIZER_EXTPOINT_ID = "classpathContainerInitializer" ; //$NON-NLS-1$ /** * Name of the extension point for contributing a source code formatter */ public static final String FORMATTER_EXTPOINT_ID = "codeFormatter" ; //$NON-NLS-1$ /** * Special value used for recognizing ongoing initialization and breaking initialization cycles */ public final static IPath VariableInitializationInProgress = new Path("Variable Initialization In Progress"); //$NON-NLS-1$ public final static IClasspathContainer ContainerInitializationInProgress = new IClasspathContainer() { public IClasspathEntry[] getClasspathEntries() { return null; } public String getDescription() { return "Container Initialization In Progress"; } //$NON-NLS-1$ public int getKind() { return 0; } public IPath getPath() { return null; } public String toString() { return getDescription(); } }; private static final String INDEX_MANAGER_DEBUG = JavaCore.PLUGIN_ID + "/debug/indexmanager" ; //$NON-NLS-1$ private static final String COMPILER_DEBUG = JavaCore.PLUGIN_ID + "/debug/compiler" ; //$NON-NLS-1$ private static final String JAVAMODEL_DEBUG = JavaCore.PLUGIN_ID + "/debug/javamodel" ; //$NON-NLS-1$ private static final String CP_RESOLVE_DEBUG = JavaCore.PLUGIN_ID + "/debug/cpresolution" ; //$NON-NLS-1$ private static final String ZIP_ACCESS_DEBUG = JavaCore.PLUGIN_ID + "/debug/zipaccess" ; //$NON-NLS-1$ private static final String DELTA_DEBUG =JavaCore.PLUGIN_ID + "/debug/javadelta" ; //$NON-NLS-1$ private static final String HIERARCHY_DEBUG = JavaCore.PLUGIN_ID + "/debug/hierarchy" ; //$NON-NLS-1$ private static final String POST_ACTION_DEBUG = JavaCore.PLUGIN_ID + "/debug/postaction" ; //$NON-NLS-1$ private static final String BUILDER_DEBUG = JavaCore.PLUGIN_ID + "/debug/builder" ; //$NON-NLS-1$ private static final String COMPLETION_DEBUG = JavaCore.PLUGIN_ID + "/debug/completion" ; //$NON-NLS-1$ private static final String SELECTION_DEBUG = JavaCore.PLUGIN_ID + "/debug/selection" ; //$NON-NLS-1$ private static final String SHARED_WC_DEBUG = JavaCore.PLUGIN_ID + "/debug/sharedworkingcopy" ; //$NON-NLS-1$ private static final String SEARCH_DEBUG = JavaCore.PLUGIN_ID + "/debug/search" ; //$NON-NLS-1$ public final static IWorkingCopy[] NoWorkingCopy = new IWorkingCopy[0]; /** * Returns whether the given full path (for a package) conflicts with the output location * of the given project. */ public static boolean conflictsWithOutputLocation(IPath folderPath, JavaProject project) { try { IPath outputLocation = project.getOutputLocation(); if (outputLocation == null) { // in doubt, there is a conflict return true; } if (outputLocation.isPrefixOf(folderPath)) { // only allow nesting in project's output if there is a corresponding source folder // or if the project's output is not used (in other words, if all source folders have their custom output) IClasspathEntry[] classpath = project.getResolvedClasspath(true); boolean isOutputUsed = false; for (int i = 0, length = classpath.length; i < length; i++) { IClasspathEntry entry = classpath[i]; if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) { if (entry.getPath().equals(outputLocation)) { return false; } if (entry.getOutputLocation() == null) { isOutputUsed = true; } } } return isOutputUsed; } return false; } catch (JavaModelException e) { // in doubt, there is a conflict return true; } } public static IClasspathContainer containerGet(IJavaProject project, IPath containerPath) { Map projectContainers = (Map)Containers.get(project); if (projectContainers == null){ return null; } IClasspathContainer container = (IClasspathContainer)projectContainers.get(containerPath); return container; } public static void containerPut(IJavaProject project, IPath containerPath, IClasspathContainer container){ Map projectContainers = (Map)Containers.get(project); if (projectContainers == null){ projectContainers = new HashMap(1); Containers.put(project, projectContainers); } if (container == null) { projectContainers.remove(containerPath); Map previousContainers = (Map)PreviousSessionContainers.get(project); if (previousContainers != null){ previousContainers.remove(containerPath); } } else { projectContainers.put(containerPath, container); } // do not write out intermediate initialization value if (container == JavaModelManager.ContainerInitializationInProgress) { return; } Preferences preferences = JavaCore.getPlugin().getPluginPreferences(); String containerKey = CP_CONTAINER_PREFERENCES_PREFIX+project.getElementName() +"|"+containerPath;//$NON-NLS-1$ String containerString = CP_ENTRY_IGNORE; try { if (container != null) { containerString = ((JavaProject)project).encodeClasspath(container.getClasspathEntries(), null, false); } } catch(JavaModelException e){ } preferences.setDefault(containerKey, CP_ENTRY_IGNORE); // use this default to get rid of removed ones preferences.setValue(containerKey, containerString); JavaCore.getPlugin().savePluginPreferences(); } /** * Returns the Java element corresponding to the given resource, or * <code>null</code> if unable to associate the given resource * with a Java element. * <p> * The resource must be one of:<ul> * <li>a project - the element returned is the corresponding <code>IJavaProject</code></li> * <li>a <code>.java</code> file - the element returned is the corresponding <code>ICompilationUnit</code></li> * <li>a <code>.class</code> file - the element returned is the corresponding <code>IClassFile</code></li> * <li>a <code>.jar</code> file - the element returned is the corresponding <code>IPackageFragmentRoot</code></li> * <li>a folder - the element returned is the corresponding <code>IPackageFragmentRoot</code> * or <code>IPackageFragment</code></li> * <li>the workspace root resource - the element returned is the <code>IJavaModel</code></li> * </ul> * <p> * Creating a Java element has the side effect of creating and opening all of the * element's parents if they are not yet open. */ public static IJavaElement create(IResource resource, IJavaProject project) { if (resource == null) { return null; } int type = resource.getType(); switch (type) { case IResource.PROJECT : return JavaCore.create((IProject) resource); case IResource.FILE : return create((IFile) resource, project); case IResource.FOLDER : return create((IFolder) resource, project); case IResource.ROOT : return JavaCore.create((IWorkspaceRoot) resource); default : return null; } } /** * Returns the Java element corresponding to the given file, its project being the given * project. * Returns <code>null</code> if unable to associate the given file * with a Java element. * * <p>The file must be one of:<ul> * <li>a <code>.java</code> file - the element returned is the corresponding <code>ICompilationUnit</code></li> * <li>a <code>.class</code> file - the element returned is the corresponding <code>IClassFile</code></li> * <li>a <code>.jar</code> file - the element returned is the corresponding <code>IPackageFragmentRoot</code></li> * </ul> * <p> * Creating a Java element has the side effect of creating and opening all of the * element's parents if they are not yet open. */ public static IJavaElement create(IFile file, IJavaProject project) { if (file == null) { return null; } if (project == null) { project = JavaCore.create(file.getProject()); } if (file.getFileExtension() != null) { String name = file.getName(); if (Util.isValidCompilationUnitName(name)) return createCompilationUnitFrom(file, project); if (Util.isValidClassFileName(name)) return createClassFileFrom(file, project); if (Util.isArchiveFileName(name)) return createJarPackageFragmentRootFrom(file, project); } return null; } /** * Returns the package fragment or package fragment root corresponding to the given folder, * its parent or great parent being the given project. * or <code>null</code> if unable to associate the given folder with a Java element. * <p> * Note that a package fragment root is returned rather than a default package. * <p> * Creating a Java element has the side effect of creating and opening all of the * element's parents if they are not yet open. */ public static IJavaElement create(IFolder folder, IJavaProject project) { if (folder == null) { return null; } if (project == null) { project = JavaCore.create(folder.getProject()); } IJavaElement element = determineIfOnClasspath(folder, project); if (conflictsWithOutputLocation(folder.getFullPath(), (JavaProject)project) || (folder.getName().indexOf('.') >= 0 && !(element instanceof IPackageFragmentRoot))) { return null; // only package fragment roots are allowed with dot names } else { return element; } } /** * Creates and returns a class file element for the given <code>.class</code> file, * its project being the given project. Returns <code>null</code> if unable * to recognize the class file. */ public static IClassFile createClassFileFrom(IFile file, IJavaProject project ) { if (file == null) { return null; } if (project == null) { project = JavaCore.create(file.getProject()); } IPackageFragment pkg = (IPackageFragment) determineIfOnClasspath(file, project); if (pkg == null) { // fix for 1FVS7WE // not on classpath - make the root its folder, and a default package IPackageFragmentRoot root = project.getPackageFragmentRoot(file.getParent()); pkg = root.getPackageFragment(IPackageFragment.DEFAULT_PACKAGE_NAME); } return pkg.getClassFile(file.getName()); } /** * Creates and returns a compilation unit element for the given <code>.java</code> * file, its project being the given project. Returns <code>null</code> if unable * to recognize the compilation unit. */ public static ICompilationUnit createCompilationUnitFrom(IFile file, IJavaProject project) { if (file == null) return null; if (project == null) { project = JavaCore.create(file.getProject()); } IPackageFragment pkg = (IPackageFragment) determineIfOnClasspath(file, project); if (pkg == null) { // not on classpath - make the root its folder, and a default package IPackageFragmentRoot root = project.getPackageFragmentRoot(file.getParent()); pkg = root.getPackageFragment(IPackageFragment.DEFAULT_PACKAGE_NAME); if (VERBOSE){ System.out.println("WARNING : creating unit element outside classpath ("+ Thread.currentThread()+"): " + file.getFullPath()); //$NON-NLS-1$//$NON-NLS-2$ } } return pkg.getCompilationUnit(file.getName()); } /** * Creates and returns a handle for the given JAR file, its project being the given project. * The Java model associated with the JAR's project may be * created as a side effect. * Returns <code>null</code> if unable to create a JAR package fragment root. * (for example, if the JAR file represents a non-Java resource) */ public static IPackageFragmentRoot createJarPackageFragmentRootFrom(IFile file, IJavaProject project) { if (file == null) { return null; } if (project == null) { project = JavaCore.create(file.getProject()); } // Create a jar package fragment root only if on the classpath IPath resourcePath = file.getFullPath(); try { IClasspathEntry[] entries = ((JavaProject)project).getResolvedClasspath(true); for (int i = 0, length = entries.length; i < length; i++) { IClasspathEntry entry = entries[i]; IPath rootPath = entry.getPath(); if (rootPath.equals(resourcePath)) { return project.getPackageFragmentRoot(file); } } } catch (JavaModelException e) { } return null; } /** * Returns the package fragment root represented by the resource, or * the package fragment the given resource is located in, or <code>null</code> * if the given resource is not on the classpath of the given project. */ public static IJavaElement determineIfOnClasspath( IResource resource, IJavaProject project) { IPath resourcePath = resource.getFullPath(); try { IClasspathEntry[] entries = Util.isJavaFileName(resourcePath.lastSegment()) ? project.getRawClasspath() // JAVA file can only live inside SRC folder (on the raw path) : ((JavaProject)project).getResolvedClasspath(true); for (int i = 0; i < entries.length; i++) { IClasspathEntry entry = entries[i]; if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT) continue; IPath rootPath = entry.getPath(); if (rootPath.equals(resourcePath)) { return project.getPackageFragmentRoot(resource); } else if (rootPath.isPrefixOf(resourcePath) && !Util.isExcluded(resource, ((ClasspathEntry)entry).fullExclusionPatternChars())) { // given we have a resource child of the root, it cannot be a JAR pkg root IPackageFragmentRoot root = ((JavaProject) project).getFolderPackageFragmentRoot(rootPath); if (root == null) return null; IPath pkgPath = resourcePath.removeFirstSegments(rootPath.segmentCount()); if (resource.getType() == IResource.FILE) { // if the resource is a file, then remove the last segment which // is the file name in the package pkgPath = pkgPath.removeLastSegments(1); // don't check validity of package name (see http://bugs.eclipse.org/bugs/show_bug.cgi?id=26706) String pkgName = pkgPath.toString().replace('/', '.'); return root.getPackageFragment(pkgName); } else { String pkgName = Util.packageName(pkgPath); if (pkgName == null || JavaConventions.validatePackageName(pkgName).getSeverity() == IStatus.ERROR) { return null; } return root.getPackageFragment(pkgName); } } } } catch (JavaModelException npe) { return null; } return null; } /** * The singleton manager */ private final static JavaModelManager Manager= new JavaModelManager(); /** * Infos cache. */ protected JavaModelCache cache = new JavaModelCache(); /** * Set of elements which are out of sync with their buffers. */ protected Map elementsOutOfSynchWithBuffers = new HashMap(11); /** * Turns delta firing on/off. By default it is on. */ private boolean isFiring= true; /** * Queue of deltas created explicily by the Java Model that * have yet to be fired. */ ArrayList javaModelDeltas= new ArrayList(); /** * Queue of reconcile deltas on working copies that have yet to be fired. * This is a table form IWorkingCopy to IJavaElementDelta */ HashMap reconcileDeltas = new HashMap(); /** * Collection of listeners for Java element deltas */ private IElementChangedListener[] elementChangedListeners = new IElementChangedListener[5]; private int[] elementChangedListenerMasks = new int[5]; private int elementChangedListenerCount = 0; public int currentChangeEventType = ElementChangedEvent.PRE_AUTO_BUILD; public static final int DEFAULT_CHANGE_EVENT = 0; // must not collide with ElementChangedEvent event masks /** * Used to convert <code>IResourceDelta</code>s into <code>IJavaElementDelta</code>s. */ public final DeltaProcessor deltaProcessor = new DeltaProcessor(this); /** * Used to update the JavaModel for <code>IJavaElementDelta</code>s. */ private final ModelUpdater modelUpdater =new ModelUpdater(); /** * Workaround for bug 15168 circular errors not reported * This is a cache of the projects before any project addition/deletion has started. */ public IJavaProject[] javaProjectsCache; /** * Table from IProject to PerProjectInfo. * NOTE: this object itself is used as a lock to synchronize creation/removal of per project infos */ protected Map perProjectInfo = new HashMap(5); /** * A map from ICompilationUnit to IWorkingCopy * of the shared working copies. */ public Map sharedWorkingCopies = new HashMap(); /** * A weak set of the known search scopes. */ protected WeakHashMap searchScopes = new WeakHashMap(); public static class PerProjectInfo { public IProject project; public Object savedState; public boolean triedRead; public IClasspathEntry[] classpath; public IClasspathEntry[] lastResolvedClasspath; public Map resolvedPathToRawEntries; // reverse map from resolved path to raw entries public IPath outputLocation; public Preferences preferences; public PerProjectInfo(IProject project) { this.triedRead = false; this.savedState = null; this.project = project; } } public static boolean VERBOSE = false; public static boolean CP_RESOLVE_VERBOSE = false; public static boolean ZIP_ACCESS_VERBOSE = false; /** * A cache of opened zip files per thread. * (map from Thread to map of IPath to java.io.ZipFile) * NOTE: this object itself is used as a lock to synchronize creation/removal of entries */ private HashMap zipFiles = new HashMap(); /** * Update the classpath variable cache */ public static class PluginPreferencesListener implements Preferences.IPropertyChangeListener { /** * @see org.eclipse.core.runtime.Preferences.IPropertyChangeListener#propertyChange(PropertyChangeEvent) */ public void propertyChange(Preferences.PropertyChangeEvent event) { String propertyName = event.getProperty(); if (propertyName.startsWith(CP_VARIABLE_PREFERENCES_PREFIX)) { String varName = propertyName.substring(CP_VARIABLE_PREFERENCES_PREFIX.length()); String newValue = (String)event.getNewValue(); if (newValue != null && !(newValue = newValue.trim()).equals(CP_ENTRY_IGNORE)) { Variables.put(varName, new Path(newValue)); } else { Variables.remove(varName); } } if (propertyName.startsWith(CP_CONTAINER_PREFERENCES_PREFIX)) { recreatePersistedContainer(propertyName, (String)event.getNewValue(), false); } } } /** * Line separator to use throughout the JavaModel for any source edit operation */ // public static String LINE_SEPARATOR = System.getProperty("line.separator"); //$NON-NLS-1$ /** * Constructs a new JavaModelManager */ private JavaModelManager() { } /** * @deprecated - discard once debug has converted to not using it */ public void addElementChangedListener(IElementChangedListener listener) { this.addElementChangedListener(listener, ElementChangedEvent.POST_CHANGE | ElementChangedEvent.POST_RECONCILE); } /** * addElementChangedListener method comment. * Need to clone defensively the listener information, in case some listener is reacting to some notification iteration by adding/changing/removing * any of the other (for example, if it deregisters itself). */ public void addElementChangedListener(IElementChangedListener listener, int eventMask) { for (int i = 0; i < this.elementChangedListenerCount; i++){ if (this.elementChangedListeners[i].equals(listener)){ // only clone the masks, since we could be in the middle of notifications and one listener decide to change // any event mask of another listeners (yet not notified). int cloneLength = this.elementChangedListenerMasks.length; System.arraycopy(this.elementChangedListenerMasks, 0, this.elementChangedListenerMasks = new int[cloneLength], 0, cloneLength); this.elementChangedListenerMasks[i] = eventMask; // could be different return; } } // may need to grow, no need to clone, since iterators will have cached original arrays and max boundary and we only add to the end. int length; if ((length = this.elementChangedListeners.length) == this.elementChangedListenerCount){ System.arraycopy(this.elementChangedListeners, 0, this.elementChangedListeners = new IElementChangedListener[length*2], 0, length); System.arraycopy(this.elementChangedListenerMasks, 0, this.elementChangedListenerMasks = new int[length*2], 0, length); } this.elementChangedListeners[this.elementChangedListenerCount] = listener; this.elementChangedListenerMasks[this.elementChangedListenerCount] = eventMask; this.elementChangedListenerCount++; } /** * Starts caching ZipFiles. * Ignores if there are already clients. */ public void cacheZipFiles() { synchronized(this.zipFiles) { Thread currentThread = Thread.currentThread(); if (this.zipFiles.get(currentThread) != null) return; this.zipFiles.put(currentThread, new HashMap()); } } public void closeZipFile(ZipFile zipFile) { if (zipFile == null) return; synchronized(this.zipFiles) { if (this.zipFiles.get(Thread.currentThread()) != null) { return; // zip file will be closed by call to flushZipFiles } try { if (JavaModelManager.ZIP_ACCESS_VERBOSE) { System.out.println("(" + Thread.currentThread() + ") [JavaModelManager.closeZipFile(ZipFile)] Closing ZipFile on " +zipFile.getName()); //$NON-NLS-1$ //$NON-NLS-2$ } zipFile.close(); } catch (IOException e) { } } } /** * Configure the plugin with respect to option settings defined in ".options" file */ public void configurePluginDebugOptions(){ if(JavaCore.getPlugin().isDebugging()){ String option = Platform.getDebugOption(BUILDER_DEBUG); if(option != null) JavaBuilder.DEBUG = option.equalsIgnoreCase("true") ; //$NON-NLS-1$ option = Platform.getDebugOption(COMPILER_DEBUG); if(option != null) Compiler.DEBUG = option.equalsIgnoreCase("true") ; //$NON-NLS-1$ option = Platform.getDebugOption(COMPLETION_DEBUG); if(option != null) CompletionEngine.DEBUG = option.equalsIgnoreCase("true") ; //$NON-NLS-1$ option = Platform.getDebugOption(CP_RESOLVE_DEBUG); if(option != null) JavaModelManager.CP_RESOLVE_VERBOSE = option.equalsIgnoreCase("true") ; //$NON-NLS-1$ option = Platform.getDebugOption(DELTA_DEBUG); if(option != null) DeltaProcessor.VERBOSE = option.equalsIgnoreCase("true") ; //$NON-NLS-1$ option = Platform.getDebugOption(HIERARCHY_DEBUG); if(option != null) TypeHierarchy.DEBUG = option.equalsIgnoreCase("true") ; //$NON-NLS-1$ option = Platform.getDebugOption(INDEX_MANAGER_DEBUG); if(option != null) IndexManager.VERBOSE = option.equalsIgnoreCase("true") ; //$NON-NLS-1$ option = Platform.getDebugOption(JAVAMODEL_DEBUG); if(option != null) JavaModelManager.VERBOSE = option.equalsIgnoreCase("true") ; //$NON-NLS-1$ option = Platform.getDebugOption(POST_ACTION_DEBUG); if(option != null) JavaModelOperation.POST_ACTION_VERBOSE = option.equalsIgnoreCase("true") ; //$NON-NLS-1$ option = Platform.getDebugOption(SEARCH_DEBUG); if(option != null) SearchEngine.VERBOSE = option.equalsIgnoreCase("true") ; //$NON-NLS-1$ option = Platform.getDebugOption(SELECTION_DEBUG); if(option != null) SelectionEngine.DEBUG = option.equalsIgnoreCase("true") ; //$NON-NLS-1$ option = Platform.getDebugOption(SHARED_WC_DEBUG); if(option != null) CompilationUnit.SHARED_WC_VERBOSE = option.equalsIgnoreCase("true") ; //$NON-NLS-1$ option = Platform.getDebugOption(ZIP_ACCESS_DEBUG); if(option != null) JavaModelManager.ZIP_ACCESS_VERBOSE = option.equalsIgnoreCase("true") ; //$NON-NLS-1$ } } /** * @see ISaveParticipant */ public void doneSaving(ISaveContext context){ } /** * Fire Java Model delta, flushing them after the fact after post_change notification. * If the firing mode has been turned off, this has no effect. */ public void fire(IJavaElementDelta customDelta, int eventType) { if (!this.isFiring) return; if (DeltaProcessor.VERBOSE && (eventType == DEFAULT_CHANGE_EVENT || eventType == ElementChangedEvent.PRE_AUTO_BUILD)) { System.out.println("-----------------------------------------------------------------------------------------------------------------------");//$NON-NLS-1$ } IJavaElementDelta deltaToNotify; if (customDelta == null){ deltaToNotify = this.mergeDeltas(this.javaModelDeltas); } else { deltaToNotify = customDelta; } // Refresh internal scopes if (deltaToNotify != null) { Iterator scopes = this.searchScopes.keySet().iterator(); while (scopes.hasNext()) { AbstractSearchScope scope = (AbstractSearchScope)scopes.next(); scope.processDelta(deltaToNotify); } } // Notification // Important: if any listener reacts to notification by updating the listeners list or mask, these lists will // be duplicated, so it is necessary to remember original lists in a variable (since field values may change under us) IElementChangedListener[] listeners = this.elementChangedListeners; int[] listenerMask = this.elementChangedListenerMasks; int listenerCount = this.elementChangedListenerCount; switch (eventType) { case DEFAULT_CHANGE_EVENT: firePreAutoBuildDelta(deltaToNotify, listeners, listenerMask, listenerCount); firePostChangeDelta(deltaToNotify, listeners, listenerMask, listenerCount); fireReconcileDelta(listeners, listenerMask, listenerCount); break; case ElementChangedEvent.PRE_AUTO_BUILD: firePreAutoBuildDelta(deltaToNotify, listeners, listenerMask, listenerCount); break; case ElementChangedEvent.POST_CHANGE: firePostChangeDelta(deltaToNotify, listeners, listenerMask, listenerCount); fireReconcileDelta(listeners, listenerMask, listenerCount); break; } } private void firePreAutoBuildDelta( IJavaElementDelta deltaToNotify, IElementChangedListener[] listeners, int[] listenerMask, int listenerCount) { if (DeltaProcessor.VERBOSE){ System.out.println("FIRING PRE_AUTO_BUILD Delta ["+Thread.currentThread()+"]:"); //$NON-NLS-1$//$NON-NLS-2$ System.out.println(deltaToNotify == null ? "<NONE>" : deltaToNotify.toString()); //$NON-NLS-1$ } if (deltaToNotify != null) { notifyListeners(deltaToNotify, ElementChangedEvent.PRE_AUTO_BUILD, listeners, listenerMask, listenerCount); } } private void firePostChangeDelta( IJavaElementDelta deltaToNotify, IElementChangedListener[] listeners, int[] listenerMask, int listenerCount) { // post change deltas if (DeltaProcessor.VERBOSE){ System.out.println("FIRING POST_CHANGE Delta ["+Thread.currentThread()+"]:"); //$NON-NLS-1$//$NON-NLS-2$ System.out.println(deltaToNotify == null ? "<NONE>" : deltaToNotify.toString()); //$NON-NLS-1$ } if (deltaToNotify != null) { // flush now so as to keep listener reactions to post their own deltas for subsequent iteration this.flush(); notifyListeners(deltaToNotify, ElementChangedEvent.POST_CHANGE, listeners, listenerMask, listenerCount); } } private void fireReconcileDelta( IElementChangedListener[] listeners, int[] listenerMask, int listenerCount) { IJavaElementDelta deltaToNotify = mergeDeltas(this.reconcileDeltas.values()); if (DeltaProcessor.VERBOSE){ System.out.println("FIRING POST_RECONCILE Delta ["+Thread.currentThread()+"]:"); //$NON-NLS-1$//$NON-NLS-2$ System.out.println(deltaToNotify == null ? "<NONE>" : deltaToNotify.toString()); //$NON-NLS-1$ } if (deltaToNotify != null) { // flush now so as to keep listener reactions to post their own deltas for subsequent iteration this.reconcileDeltas = new HashMap(); notifyListeners(deltaToNotify, ElementChangedEvent.POST_RECONCILE, listeners, listenerMask, listenerCount); } } public void notifyListeners(IJavaElementDelta deltaToNotify, int eventType, IElementChangedListener[] listeners, int[] listenerMask, int listenerCount) { final ElementChangedEvent extraEvent = new ElementChangedEvent(deltaToNotify, eventType); for (int i= 0; i < listenerCount; i++) { if ((listenerMask[i] & eventType) != 0){ final IElementChangedListener listener = listeners[i]; long start = -1; if (DeltaProcessor.VERBOSE) { System.out.print("Listener #" + (i+1) + "=" + listener.toString());//$NON-NLS-1$//$NON-NLS-2$ start = System.currentTimeMillis(); } // wrap callbacks with Safe runnable for subsequent listeners to be called when some are causing grief Platform.run(new ISafeRunnable() { public void handleException(Throwable exception) { Util.log(exception, "Exception occurred in listener of Java element change notification"); //$NON-NLS-1$ } public void run() throws Exception { listener.elementChanged(extraEvent); } }); if (DeltaProcessor.VERBOSE) { System.out.println(" -> " + (System.currentTimeMillis()-start) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ } } } } /** * Flushes all deltas without firing them. */ protected void flush() { this.javaModelDeltas = new ArrayList(); } /** * Flushes ZipFiles cache if there are no more clients. */ public void flushZipFiles() { synchronized(this.zipFiles) { Thread currentThread = Thread.currentThread(); HashMap map = (HashMap)this.zipFiles.remove(currentThread); if (map == null) return; Iterator iterator = map.values().iterator(); while (iterator.hasNext()) { try { ZipFile zipFile = (ZipFile)iterator.next(); if (JavaModelManager.ZIP_ACCESS_VERBOSE) { System.out.println("(" + currentThread + ") [JavaModelManager.flushZipFiles()] Closing ZipFile on " +zipFile.getName()); //$NON-NLS-1$//$NON-NLS-2$ } zipFile.close(); } catch (IOException e) { } } } } /** * Returns the set of elements which are out of synch with their buffers. */ protected Map getElementsOutOfSynchWithBuffers() { return this.elementsOutOfSynchWithBuffers; } /** * Returns the <code>IJavaElement</code> represented by the * <code>String</code> memento. */ public IJavaElement getHandleFromMemento(String memento) throws JavaModelException { if (memento == null) { return null; } if (memento.equals("")){ // workspace memento //$NON-NLS-1$ return this.javaModel; } int modelEnd= memento.indexOf(JavaElement.JEM_JAVAPROJECT); if (modelEnd == -1) { return null; } boolean returnProject= false; int projectEnd= memento.indexOf(JavaElement.JEM_PACKAGEFRAGMENTROOT, modelEnd); if (projectEnd == -1) { projectEnd= memento.length(); returnProject= true; } String projectName= memento.substring(modelEnd + 1, projectEnd); JavaProject proj= (JavaProject) this.javaModel.getJavaProject(projectName); if (returnProject) { return proj; } int rootEnd= memento.indexOf(JavaElement.JEM_PACKAGEFRAGMENT, projectEnd + 1); if (rootEnd == -1) { return this.javaModel.getHandleFromMementoForRoot(memento, proj, projectEnd, memento.length()); } IPackageFragmentRoot root = this.javaModel.getHandleFromMementoForRoot(memento, proj, projectEnd, rootEnd); if (root == null) return null; int end= memento.indexOf(JavaElement.JEM_COMPILATIONUNIT, rootEnd); if (end == -1) { end= memento.indexOf(JavaElement.JEM_CLASSFILE, rootEnd); if (end == -1) { if (rootEnd + 1 == memento.length()) { return root.getPackageFragment(IPackageFragment.DEFAULT_PACKAGE_NAME); } else { return root.getPackageFragment(memento.substring(rootEnd + 1)); } } //deal with class file and binary members return this.javaModel.getHandleFromMementoForBinaryMembers(memento, root, rootEnd, end); } //deal with compilation units and source members return this.javaModel.getHandleFromMementoForSourceMembers(memento, root, rootEnd, end); } public IndexManager getIndexManager() { return this.deltaProcessor.indexManager; } /** * Returns the info for the element. */ public Object getInfo(IJavaElement element) { return this.cache.getInfo(element); } /** * Returns the handle to the active Java Model. */ public final JavaModel getJavaModel() { return javaModel; } /** * Returns the singleton JavaModelManager */ public final static JavaModelManager getJavaModelManager() { return Manager; } /** * Returns the last built state for the given project, or null if there is none. * Deserializes the state if necessary. * * For use by image builder and evaluation support only */ public Object getLastBuiltState(IProject project, IProgressMonitor monitor) { if (!JavaProject.hasJavaNature(project)) return null; // should never be requested on non-Java projects PerProjectInfo info = getPerProjectInfo(project, true/*create if missing*/); if (!info.triedRead) { info.triedRead = true; try { if (monitor != null) monitor.subTask(Util.bind("build.readStateProgress", project.getName())); //$NON-NLS-1$ info.savedState = readState(project); } catch (CoreException e) { e.printStackTrace(); } } return info.savedState; } /* * Returns the per-project info for the given project. If specified, create the info if the info doesn't exist. */ public PerProjectInfo getPerProjectInfo(IProject project, boolean create) { synchronized(perProjectInfo) { // use the perProjectInfo collection as its own lock PerProjectInfo info= (PerProjectInfo) perProjectInfo.get(project); if (info == null && create) { info= new PerProjectInfo(project); perProjectInfo.put(project, info); } return info; } } /* * Returns the per-project info for the given project. * If the info doesn't exist, check for the project existence and create the info. * @throws JavaModelException if the project doesn't exist. */ public PerProjectInfo getPerProjectInfoCheckExistence(IProject project) throws JavaModelException { JavaModelManager.PerProjectInfo info = getPerProjectInfo(project, false /* don't create info */); if (info == null) { if (!JavaProject.hasJavaNature(project)) { throw ((JavaProject)JavaCore.create(project)).newNotPresentException(); } info = getPerProjectInfo(project, true /* create info */); } return info; } /** * Returns the name of the variables for which an CP variable initializer is registered through an extension point */ public static String[] getRegisteredVariableNames(){ Plugin jdtCorePlugin = JavaCore.getPlugin(); if (jdtCorePlugin == null) return null; ArrayList variableList = new ArrayList(5); IExtensionPoint extension = jdtCorePlugin.getDescriptor().getExtensionPoint(JavaModelManager.CPVARIABLE_INITIALIZER_EXTPOINT_ID); if (extension != null) { IExtension[] extensions = extension.getExtensions(); for(int i = 0; i < extensions.length; i++){ IConfigurationElement [] configElements = extensions[i].getConfigurationElements(); for(int j = 0; j < configElements.length; j++){ String varAttribute = configElements[j].getAttribute("variable"); //$NON-NLS-1$ if (varAttribute != null) variableList.add(varAttribute); } } } String[] variableNames = new String[variableList.size()]; variableList.toArray(variableNames); return variableNames; } /** * Returns the name of the container IDs for which an CP container initializer is registered through an extension point */ public static String[] getRegisteredContainerIDs(){ Plugin jdtCorePlugin = JavaCore.getPlugin(); if (jdtCorePlugin == null) return null; ArrayList containerIDList = new ArrayList(5); IExtensionPoint extension = jdtCorePlugin.getDescriptor().getExtensionPoint(JavaModelManager.CPCONTAINER_INITIALIZER_EXTPOINT_ID); if (extension != null) { IExtension[] extensions = extension.getExtensions(); for(int i = 0; i < extensions.length; i++){ IConfigurationElement [] configElements = extensions[i].getConfigurationElements(); for(int j = 0; j < configElements.length; j++){ String idAttribute = configElements[j].getAttribute("id"); //$NON-NLS-1$ if (idAttribute != null) containerIDList.add(idAttribute); } } } String[] containerIDs = new String[containerIDList.size()]; containerIDList.toArray(containerIDs); return containerIDs; } /** * Returns the File to use for saving and restoring the last built state for the given project. */ private File getSerializationFile(IProject project) { if (!project.exists()) return null; IPluginDescriptor descr= JavaCore.getJavaCore().getDescriptor(); IPath workingLocation= project.getPluginWorkingLocation(descr); return workingLocation.append("state.dat").toFile(); //$NON-NLS-1$ } /** * Returns the open ZipFile at the given location. If the ZipFile * does not yet exist, it is created, opened, and added to the cache * of open ZipFiles. The path must be absolute. * * @exception CoreException If unable to create/open the ZipFile */ public ZipFile getZipFile(IPath path) throws CoreException { synchronized(this.zipFiles) { // TODO: (jerome) use PerThreadObject which does synchronization Thread currentThread = Thread.currentThread(); HashMap map = null; ZipFile zipFile; if ((map = (HashMap)this.zipFiles.get(currentThread)) != null && (zipFile = (ZipFile)map.get(path)) != null) { return zipFile; } String fileSystemPath= null; IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IResource file = root.findMember(path); if (file != null) { // internal resource IPath location; if (file.getType() != IResource.FILE || (location = file.getLocation()) == null) { throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("file.notFound", path.toString()), null)); //$NON-NLS-1$ } fileSystemPath= location.toOSString(); } else { // external resource fileSystemPath= path.toOSString(); } try { if (ZIP_ACCESS_VERBOSE) { System.out.println("(" + currentThread + ") [JavaModelManager.getZipFile(IPath)] Creating ZipFile on " + fileSystemPath ); //$NON-NLS-1$ //$NON-NLS-2$ } zipFile = new ZipFile(fileSystemPath); if (map != null) { map.put(path, zipFile); } return zipFile; } catch (IOException e) { throw new CoreException(new Status(Status.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("status.IOException"), e)); //$NON-NLS-1$ } } } public void loadVariablesAndContainers() throws CoreException { // backward compatibility, consider persistent property QualifiedName qName = new QualifiedName(JavaCore.PLUGIN_ID, "variables"); //$NON-NLS-1$ String xmlString = ResourcesPlugin.getWorkspace().getRoot().getPersistentProperty(qName); try { if (xmlString != null){ StringReader reader = new StringReader(xmlString); Element cpElement; try { DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); cpElement = parser.parse(new InputSource(reader)).getDocumentElement(); } catch(SAXException e) { return; } catch(ParserConfigurationException e){ return; } finally { reader.close(); } if (cpElement == null) return; if (!cpElement.getNodeName().equalsIgnoreCase("variables")) { //$NON-NLS-1$ return; } NodeList list= cpElement.getChildNodes(); int length= list.getLength(); for (int i= 0; i < length; ++i) { Node node= list.item(i); short type= node.getNodeType(); if (type == Node.ELEMENT_NODE) { Element element= (Element) node; if (element.getNodeName().equalsIgnoreCase("variable")) { //$NON-NLS-1$ variablePut( element.getAttribute("name"), //$NON-NLS-1$ new Path(element.getAttribute("path"))); //$NON-NLS-1$ } } } } } catch(IOException e){ } finally { if (xmlString != null){ ResourcesPlugin.getWorkspace().getRoot().setPersistentProperty(qName, null); // flush old one } } // load variables and containers from preferences into cache Preferences preferences = JavaCore.getPlugin().getPluginPreferences(); // only get variable from preferences not set to their default String[] propertyNames = preferences.propertyNames(); int variablePrefixLength = CP_VARIABLE_PREFERENCES_PREFIX.length(); for (int i = 0; i < propertyNames.length; i++){ String propertyName = propertyNames[i]; if (propertyName.startsWith(CP_VARIABLE_PREFERENCES_PREFIX)){ String varName = propertyName.substring(variablePrefixLength); IPath varPath = new Path(preferences.getString(propertyName).trim()); Variables.put(varName, varPath); PreviousSessionVariables.put(varName, varPath); } if (propertyName.startsWith(CP_CONTAINER_PREFERENCES_PREFIX)){ recreatePersistedContainer(propertyName, preferences.getString(propertyName), true/*add to container values*/); } } // override persisted values for variables which have a registered initializer String[] registeredVariables = getRegisteredVariableNames(); for (int i = 0; i < registeredVariables.length; i++) { String varName = registeredVariables[i]; Variables.put(varName, null); // reset variable, but leave its entry in the Map, so it will be part of variable names. } // override persisted values for containers which have a registered initializer String[] registeredContainerIDs = getRegisteredContainerIDs(); for (int i = 0; i < registeredContainerIDs.length; i++) { String containerID = registeredContainerIDs[i]; Iterator projectIterator = Containers.keySet().iterator(); while (projectIterator.hasNext()){ IJavaProject project = (IJavaProject)projectIterator.next(); Map projectContainers = (Map)Containers.get(project); if (projectContainers != null){ Iterator containerIterator = projectContainers.keySet().iterator(); while (containerIterator.hasNext()){ IPath containerPath = (IPath)containerIterator.next(); if (containerPath.segment(0).equals(containerID)) { // registered container projectContainers.put(containerPath, null); // reset container value, but leave entry in Map } } } } } } /** * Merged all awaiting deltas. */ public IJavaElementDelta mergeDeltas(Collection deltas) { if (deltas.size() == 0) return null; if (deltas.size() == 1) return (IJavaElementDelta)deltas.iterator().next(); if (DeltaProcessor.VERBOSE) { System.out.println("MERGING " + deltas.size() + " DELTAS ["+Thread.currentThread()+"]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } Iterator iterator = deltas.iterator(); JavaElementDelta rootDelta = new JavaElementDelta(this.javaModel); boolean insertedTree = false; while (iterator.hasNext()) { JavaElementDelta delta = (JavaElementDelta)iterator.next(); if (DeltaProcessor.VERBOSE) { System.out.println(delta.toString()); } IJavaElement element = delta.getElement(); if (this.javaModel.equals(element)) { IJavaElementDelta[] children = delta.getAffectedChildren(); for (int j = 0; j < children.length; j++) { JavaElementDelta projectDelta = (JavaElementDelta) children[j]; rootDelta.insertDeltaTree(projectDelta.getElement(), projectDelta); insertedTree = true; } IResourceDelta[] resourceDeltas = delta.getResourceDeltas(); if (resourceDeltas != null) { for (int i = 0, length = resourceDeltas.length; i < length; i++) { rootDelta.addResourceDelta(resourceDeltas[i]); insertedTree = true; } } } else { rootDelta.insertDeltaTree(element, delta); insertedTree = true; } } if (insertedTree) { return rootDelta; } else { return null; } } /** * Returns the info for this element without * disturbing the cache ordering. */ // TODO: (jerome) should be synchronized, could answer unitialized info or if cache is in middle of rehash, could even answer distinct element info protected Object peekAtInfo(IJavaElement element) { return this.cache.peekAtInfo(element); } /** * @see ISaveParticipant */ public void prepareToSave(ISaveContext context) throws CoreException { } protected void putInfo(IJavaElement element, Object info) { this.cache.putInfo(element, info); } /** * Reads the build state for the relevant project. */ protected Object readState(IProject project) throws CoreException { File file = getSerializationFile(project); if (file != null && file.exists()) { try { DataInputStream in= new DataInputStream(new BufferedInputStream(new FileInputStream(file))); try { String pluginID= in.readUTF(); if (!pluginID.equals(JavaCore.PLUGIN_ID)) throw new IOException(Util.bind("build.wrongFileFormat")); //$NON-NLS-1$ String kind= in.readUTF(); if (!kind.equals("STATE")) //$NON-NLS-1$ throw new IOException(Util.bind("build.wrongFileFormat")); //$NON-NLS-1$ if (in.readBoolean()) return JavaBuilder.readState(project, in); if (JavaBuilder.DEBUG) System.out.println("Saved state thinks last build failed for " + project.getName()); //$NON-NLS-1$ } finally { in.close(); } } catch (Exception e) { e.printStackTrace(); throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, Platform.PLUGIN_ERROR, "Error reading last build state for project "+ project.getName(), e)); //$NON-NLS-1$ } } return null; } public static void recreatePersistedContainer(String propertyName, String containerString, boolean addToContainerValues) { int containerPrefixLength = CP_CONTAINER_PREFERENCES_PREFIX.length(); int index = propertyName.indexOf('|', containerPrefixLength); if (containerString != null) containerString = containerString.trim(); if (index > 0) { final String projectName = propertyName.substring(containerPrefixLength, index).trim(); JavaProject project = (JavaProject)getJavaModelManager().getJavaModel().getJavaProject(projectName); final IPath containerPath = new Path(propertyName.substring(index+1).trim()); if (containerString == null || containerString.equals(CP_ENTRY_IGNORE)) { containerPut(project, containerPath, null); } else { final IClasspathEntry[] containerEntries = project.decodeClasspath(containerString, false, false); if (containerEntries != null && containerEntries != JavaProject.INVALID_CLASSPATH) { IClasspathContainer container = new IClasspathContainer() { public IClasspathEntry[] getClasspathEntries() { return containerEntries; } public String getDescription() { return "Persisted container ["+containerPath+" for project ["+ projectName+"]"; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ } public int getKind() { return 0; } public IPath getPath() { return containerPath; } public String toString() { return getDescription(); } }; if (addToContainerValues) { containerPut(project, containerPath, container); } Map projectContainers = (Map)PreviousSessionContainers.get(project); if (projectContainers == null){ projectContainers = new HashMap(1); PreviousSessionContainers.put(project, projectContainers); } projectContainers.put(containerPath, container); } } } } /** * Registers the given delta with this manager. */ protected void registerJavaModelDelta(IJavaElementDelta delta) { this.javaModelDeltas.add(delta); } /** * Remembers the given scope in a weak set * (so no need to remove it: it will be removed by the garbage collector) */ public void rememberScope(AbstractSearchScope scope) { // NB: The value has to be null so as to not create a strong reference on the scope this.searchScopes.put(scope, null); } /** * removeElementChangedListener method comment. */ public void removeElementChangedListener(IElementChangedListener listener) { for (int i = 0; i < this.elementChangedListenerCount; i++){ if (this.elementChangedListeners[i].equals(listener)){ // need to clone defensively since we might be in the middle of listener notifications (#fire) int length = this.elementChangedListeners.length; IElementChangedListener[] newListeners = new IElementChangedListener[length]; System.arraycopy(this.elementChangedListeners, 0, newListeners, 0, i); int[] newMasks = new int[length]; System.arraycopy(this.elementChangedListenerMasks, 0, newMasks, 0, i); // copy trailing listeners int trailingLength = this.elementChangedListenerCount - i - 1; if (trailingLength > 0){ System.arraycopy(this.elementChangedListeners, i+1, newListeners, i, trailingLength); System.arraycopy(this.elementChangedListenerMasks, i+1, newMasks, i, trailingLength); } // update manager listener state (#fire need to iterate over original listeners through a local variable to hold onto // the original ones) this.elementChangedListeners = newListeners; this.elementChangedListenerMasks = newMasks; this.elementChangedListenerCount--; return; } } } protected void removeInfo(IJavaElement element) { this.cache.removeInfo(element); } public void removePerProjectInfo(JavaProject javaProject) { synchronized(perProjectInfo) { // use the perProjectInfo collection as its own lock IProject project = javaProject.getProject(); PerProjectInfo info= (PerProjectInfo) perProjectInfo.get(project); if (info != null) { perProjectInfo.remove(project); } } } /** * @see ISaveParticipant */ public void rollback(ISaveContext context){ } private void saveState(PerProjectInfo info, ISaveContext context) throws CoreException { // passed this point, save actions are non trivial if (context.getKind() == ISaveContext.SNAPSHOT) return; // save built state if (info.triedRead) saveBuiltState(info); } /** * Saves the built state for the project. */ private void saveBuiltState(PerProjectInfo info) throws CoreException { if (JavaBuilder.DEBUG) System.out.println(Util.bind("build.saveStateProgress", info.project.getName())); //$NON-NLS-1$ File file = getSerializationFile(info.project); if (file == null) return; long t = System.currentTimeMillis(); try { DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(file))); try { out.writeUTF(JavaCore.PLUGIN_ID); out.writeUTF("STATE"); //$NON-NLS-1$ if (info.savedState == null) { out.writeBoolean(false); } else { out.writeBoolean(true); JavaBuilder.writeState(info.savedState, out); } } finally { out.close(); } } catch (RuntimeException e) { try {file.delete();} catch(SecurityException se) {} throw new CoreException( new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, Platform.PLUGIN_ERROR, Util.bind("build.cannotSaveState", info.project.getName()), e)); //$NON-NLS-1$ } catch (IOException e) { try {file.delete();} catch(SecurityException se) {} throw new CoreException( new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, Platform.PLUGIN_ERROR, Util.bind("build.cannotSaveState", info.project.getName()), e)); //$NON-NLS-1$ } if (JavaBuilder.DEBUG) { t = System.currentTimeMillis() - t; System.out.println(Util.bind("build.saveStateComplete", String.valueOf(t))); //$NON-NLS-1$ } } /** * @see ISaveParticipant */ public void saving(ISaveContext context) throws CoreException { IProject savedProject = context.getProject(); if (savedProject != null) { if (!JavaProject.hasJavaNature(savedProject)) return; // ignore PerProjectInfo info = getPerProjectInfo(savedProject, true /* create info */); saveState(info, context); return; } ArrayList vStats= null; // lazy initialized for (Iterator iter = perProjectInfo.values().iterator(); iter.hasNext();) { try { PerProjectInfo info = (PerProjectInfo) iter.next(); saveState(info, context); } catch (CoreException e) { if (vStats == null) vStats= new ArrayList(); vStats.add(e.getStatus()); } } if (vStats != null) { IStatus[] stats= new IStatus[vStats.size()]; vStats.toArray(stats); throw new CoreException(new MultiStatus(JavaCore.PLUGIN_ID, IStatus.ERROR, stats, Util.bind("build.cannotSaveStates"), null)); //$NON-NLS-1$ } } /** * Record the order in which to build the java projects (batch build). This order is based * on the projects classpath settings. */ protected void setBuildOrder(String[] javaBuildOrder) throws JavaModelException { // optional behaviour // possible value of index 0 is Compute if (!JavaCore.COMPUTE.equals(JavaCore.getOption(JavaCore.CORE_JAVA_BUILD_ORDER))) return; // cannot be customized at project level if (javaBuildOrder == null || javaBuildOrder.length <= 1) return; IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceDescription description = workspace.getDescription(); String[] wksBuildOrder = description.getBuildOrder(); String[] newOrder; if (wksBuildOrder == null){ newOrder = javaBuildOrder; } else { // remove projects which are already mentionned in java builder order int javaCount = javaBuildOrder.length; HashMap newSet = new HashMap(javaCount); // create a set for fast check for (int i = 0; i < javaCount; i++){ newSet.put(javaBuildOrder[i], javaBuildOrder[i]); } int removed = 0; int oldCount = wksBuildOrder.length; for (int i = 0; i < oldCount; i++){ if (newSet.containsKey(wksBuildOrder[i])){ wksBuildOrder[i] = null; removed++; } } // add Java ones first newOrder = new String[oldCount - removed + javaCount]; System.arraycopy(javaBuildOrder, 0, newOrder, 0, javaCount); // java projects are built first // copy previous items in their respective order int index = javaCount; for (int i = 0; i < oldCount; i++){ if (wksBuildOrder[i] != null){ newOrder[index++] = wksBuildOrder[i]; } } } // commit the new build order out description.setBuildOrder(newOrder); try { workspace.setDescription(description); } catch(CoreException e){ throw new JavaModelException(e); } } /** * Sets the last built state for the given project, or null to reset it. */ public void setLastBuiltState(IProject project, Object state) { if (!JavaProject.hasJavaNature(project)) return; // should never be requested on non-Java projects PerProjectInfo info = getPerProjectInfo(project, true /*create if missing*/); info.triedRead = true; // no point trying to re-read once using setter info.savedState = state; if (state == null) { // delete state file to ensure a full build happens if the workspace crashes try { File file = getSerializationFile(project); if (file != null && file.exists()) file.delete(); } catch(SecurityException se) {} } } public void shutdown () { if (this.deltaProcessor.indexManager != null){ // no more indexing this.deltaProcessor.indexManager.shutdown(); } try { IJavaModel model = this.getJavaModel(); if (model != null) { model.close(); } } catch (JavaModelException e) { } } /** * Turns the firing mode to on. That is, deltas that are/have been * registered will be fired. */ public void startDeltas() { this.isFiring= true; } /** * Turns the firing mode to off. That is, deltas that are/have been * registered will not be fired until deltas are started again. */ public void stopDeltas() { this.isFiring= false; } /** * Update Java Model given some delta */ public void updateJavaModel(IJavaElementDelta customDelta) { if (customDelta == null){ for (int i = 0, length = this.javaModelDeltas.size(); i < length; i++){ IJavaElementDelta delta = (IJavaElementDelta)this.javaModelDeltas.get(i); this.modelUpdater.processJavaDelta(delta); } } else { this.modelUpdater.processJavaDelta(customDelta); } } public static IPath variableGet(String variableName){ return (IPath)Variables.get(variableName); } public static String[] variableNames(){ int length = Variables.size(); String[] result = new String[length]; Iterator vars = Variables.keySet().iterator(); int index = 0; while (vars.hasNext()) { result[index++] = (String) vars.next(); } return result; } public static void variablePut(String variableName, IPath variablePath){ // update cache - do not only rely on listener refresh if (variablePath == null) { Variables.remove(variableName); PreviousSessionVariables.remove(variableName); } else { Variables.put(variableName, variablePath); } // do not write out intermediate initialization value if (variablePath == JavaModelManager.VariableInitializationInProgress){ return; } Preferences preferences = JavaCore.getPlugin().getPluginPreferences(); String variableKey = CP_VARIABLE_PREFERENCES_PREFIX+variableName; String variableString = variablePath == null ? CP_ENTRY_IGNORE : variablePath.toString(); preferences.setDefault(variableKey, CP_ENTRY_IGNORE); // use this default to get rid of removed ones preferences.setValue(variableKey, variableString); JavaCore.getPlugin().savePluginPreferences(); } }
[ "375833274@qq.com" ]
375833274@qq.com
5a37ac7d5d75181bc638617c3b8a542334193bdf
56f6f1377b0581ac918892e54121b6413fb29ebb
/app/src/main/java/linhnb/com/soundcloundmusic_mvp/ui/playmusic/playanim/PlayAnimPresenter.java
b742f0b3b90ecb9f93155e830acf3459e8889323
[]
no_license
linhtop97/SoundCloundMusic_MVP
6be0ea5d4d8be2ca343fe3747158bff3c74043f5
b83f5407fc55dbff8d92b44fd5877d5b446f5dc5
refs/heads/develop
2020-03-25T01:35:01.196435
2018-09-05T15:02:36
2018-09-05T15:02:36
143,244,651
0
1
null
2018-08-19T11:27:15
2018-08-02T05:01:50
Java
UTF-8
Java
false
false
407
java
package linhnb.com.soundcloundmusic_mvp.ui.playmusic.playanim; public class PlayAnimPresenter implements PlayAnimContract.Presenter { private PlayAnimContract.View mView; public PlayAnimPresenter(PlayAnimContract.View view) { mView = view; mView.setPresenter(this); } @Override public void subscribe() { } @Override public void unsubscribe() { } }
[ "nguyenbalinh06031997@gmail.com" ]
nguyenbalinh06031997@gmail.com
5e0c65cd0cab0964498bd373d6c44b0415d9230d
7d923545f7554e19a67a998908631d200fffd444
/3.JavaMultithreading/src/com/javarush/task/task22/task2211/Solution.java
2e765eb20e8bc1dd6913e05560ac9a27707fa213
[]
no_license
Tumbrigan/JavaRush
5a4c1de1192be6b197481b4b77b1a059109d0381
c4d02b59b0ebc1d79a8949fbd1a428590c446eed
refs/heads/master
2022-12-11T10:53:37.651694
2020-08-08T11:56:38
2020-08-08T11:56:38
256,436,634
0
0
null
2020-09-18T16:14:20
2020-04-17T07:45:48
Java
UTF-8
Java
false
false
1,397
java
package com.javarush.task.task22.task2211; import java.io.*; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; /* Смена кодировки */ public class Solution { public static void main(String[] args) throws IOException { Charset utf8 = StandardCharsets.UTF_8; Charset windows1251 = Charset.forName("Windows-1251"); FileInputStream fileInputStream = new FileInputStream(args[0]); FileOutputStream fileOutputStream = new FileOutputStream(args[1]); BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream); BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(fileOutputStream); byte[] bytes = new byte[fileInputStream.available()]; bufferedInputStream.read(bytes); String s = new String(bytes, windows1251); byte[] bytes1 = s.getBytes(utf8); bufferedOutputStream.write(bytes1); bufferedInputStream.close(); bufferedOutputStream.close(); // BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(args[0], "Windows-1251"))); // BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(args[1])); // // char[] chars = new char[0]; // bufferedReader.read(chars); // // String s = new String(chars, "Windows-1251"); } }
[ "ihor.kucher.94@gmail.com" ]
ihor.kucher.94@gmail.com
632f9861816500c9e8f5a73d9acf1b3c80c45723
8d9e350f7c1bfdf14601e40f96eefd2676e002ae
/5-Class/祝嘉龙-181180220/LoadClass.java
bd5c93382fb77a002504ca2079b8310c13edb64d
[]
no_license
LDawns/java20-homework
e6c9a45f2589ba5dd68fefe47fca6f2750ca7ab5
67651df88fb2234dc29a221d5360057775ba05e8
refs/heads/master
2023-05-13T20:02:45.878202
2021-06-02T11:38:05
2021-06-02T11:38:05
294,383,544
1
0
null
2020-09-10T10:57:33
2020-09-10T10:57:32
null
UTF-8
Java
false
false
1,099
java
import java.lang.reflect.*; import java.util.regex.*; public class LoadClass{ public static void main(String[] args){ Pattern p = Pattern.compile("\\w+\\."); Base64ClassLoader bcl = new Base64ClassLoader(); try{ Class<?> ec = bcl.loadClass("EncrpytedClass"); Method[] methods = ec.getDeclaredMethods(); Field[] fields = ec.getDeclaredFields(); Constructor[] ctors = ec.getDeclaredConstructors(); System.out.println("Class Name:"); System.out.println(ec.getName()); System.out.println("Field:"); for(Field f : fields){ System.out.println(p.matcher(f.toString()).replaceAll("")); } System.out.println("Methods:"); for(Method m : methods){ System.out.println(p.matcher(m.toString()).replaceAll("")); } System.out.println("Constructors:"); for(Constructor c : ctors){ System.out.println(p.matcher(c.toString()).replaceAll("")); } System.out.println("Instance:"); ctors[0].setAccessible(true); Object obj = ctors[0].newInstance("Naga", 999, 999); System.out.println(obj); }catch(Exception e){ e.printStackTrace(); } } }
[ "55869568+Hoyyyywolf@users.noreply.github.com" ]
55869568+Hoyyyywolf@users.noreply.github.com
7bab84391a90d15659a3bb19c1ac61ab8e2af011
f96229318355cc10c4e82d2ff442064b8e54054a
/com/sun/corba/se/spi/activation/ServerNotActiveHelper.java
98072d40aa6b67ec59e1b85a72279e532c18d57b
[]
no_license
Rusty-Trueno/jdk-code-reading-notes
5e36461db855c9d53d89082c03161b6377e26cf0
93fdd4fb0ed3b4bbbe082df3d8266b6ebdbdf13e
refs/heads/master
2022-12-19T02:55:53.170655
2020-10-05T10:35:17
2020-10-05T10:35:17
288,186,629
2
2
null
null
null
null
UTF-8
Java
false
false
2,796
java
package com.sun.corba.se.spi.activation; /** * com/sun/corba/se/spi/activation/ServerNotActiveHelper.java . * Generated by the IDL-to-Java compiler (portable), version "3.2" * from c:/re/workspace/8-2-build-windows-amd64-cygwin/jdk8u212/12974/corba/src/share/classes/com/sun/corba/se/spi/activation/activation.idl * Monday, April 1, 2019 10:53:58 PM PDT */ abstract public class ServerNotActiveHelper { private static String _id = "IDL:activation/ServerNotActive:1.0"; public static void insert (org.omg.CORBA.Any a, com.sun.corba.se.spi.activation.ServerNotActive that) { org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); a.type (type ()); write (out, that); a.read_value (out.create_input_stream (), type ()); } public static com.sun.corba.se.spi.activation.ServerNotActive extract (org.omg.CORBA.Any a) { return read (a.create_input_stream ()); } private static org.omg.CORBA.TypeCode __typeCode = null; private static boolean __active = false; synchronized public static org.omg.CORBA.TypeCode type () { if (__typeCode == null) { synchronized (org.omg.CORBA.TypeCode.class) { if (__typeCode == null) { if (__active) { return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); } __active = true; org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [1]; org.omg.CORBA.TypeCode _tcOf_members0 = null; _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_long); _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.corba.se.spi.activation.ServerIdHelper.id (), "ServerId", _tcOf_members0); _members0[0] = new org.omg.CORBA.StructMember ( "serverId", _tcOf_members0, null); __typeCode = org.omg.CORBA.ORB.init ().create_exception_tc (com.sun.corba.se.spi.activation.ServerNotActiveHelper.id (), "ServerNotActive", _members0); __active = false; } } } return __typeCode; } public static String id () { return _id; } public static com.sun.corba.se.spi.activation.ServerNotActive read (org.omg.CORBA.portable.InputStream istream) { com.sun.corba.se.spi.activation.ServerNotActive value = new com.sun.corba.se.spi.activation.ServerNotActive (); // read and discard the repository ID istream.read_string (); value.serverId = istream.read_long (); return value; } public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.corba.se.spi.activation.ServerNotActive value) { // write the repository ID ostream.write_string (id ()); ostream.write_long (value.serverId); } }
[ "1076061276@qq.com" ]
1076061276@qq.com
4efe9fe3d3c321c83e10739fccbd9c04906fd57d
4c304a7a7aa8671d7d1b9353acf488fdd5008380
/src/main/java/com/alipay/api/domain/AlipayOpenMiniAliminiabilityprodJsapiQueryModel.java
4c9a7a732b2fc28ad48824656d71aa36af21a569
[ "Apache-2.0" ]
permissive
zhaorongxi/alipay-sdk-java-all
c658983d390e432c3787c76a50f4a8d00591cd5c
6deda10cda38a25dcba3b61498fb9ea839903871
refs/heads/master
2021-02-15T19:39:11.858966
2020-02-16T10:44:38
2020-02-16T10:44:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,474
java
package com.alipay.api.domain; import com.alipay.api.AlipayObject; import com.alipay.api.internal.mapping.ApiField; /** * 交换中心JSAPI查询 * * @author auto create * @since 1.0, 2019-12-26 18:14:30 */ public class AlipayOpenMiniAliminiabilityprodJsapiQueryModel extends AlipayObject { private static final long serialVersionUID = 5252735176296518847L; /** * 来源端,高德:com.amap.app,IOT:com.alipay.iot.xpaas,微博:com.weibo.app,优酷:com.youku.app,网商银行:com.mybank.phone,菜鸟:com.cainiao.app,天猫精灵:com.alibaba.ailabs.genie.webapps,UC:com.uc.app,支付宝:com.alipay.alipaywallet,口碑:com.koubei.mobile.KoubeiClient,财富:com.alipay.antfortune,学习强国:com.xuexi.app,支付宝香港:com.alipay.wallethk */ @ApiField("bundle_id") private String bundleId; /** * 英文名称 */ @ApiField("en_name") private String enName; /** * 交换中心接口版本 */ @ApiField("instance_version") private String instanceVersion; public String getBundleId() { return this.bundleId; } public void setBundleId(String bundleId) { this.bundleId = bundleId; } public String getEnName() { return this.enName; } public void setEnName(String enName) { this.enName = enName; } public String getInstanceVersion() { return this.instanceVersion; } public void setInstanceVersion(String instanceVersion) { this.instanceVersion = instanceVersion; } }
[ "ben.zy@antfin.com" ]
ben.zy@antfin.com
3c5ae201e2a1fdca466556711a930f76fa0d3f76
62aaa67a468107022635b566cbcf1109d3e4e648
/huiyuan/src/client/nc/ui/hkjt/huiyuan/huanka/ace/serviceproxy/AceHy_huankaMaintainProxy.java
d7b53ccdecc67cb1752396fa094d431d4e70192d
[]
no_license
boblee821226/hongkun
f17a90221683f816f382443f5c223347b41afefc
46c02ab124924f2c976044c5f31e632f706e61cf
refs/heads/master
2021-06-25T03:57:28.516510
2021-02-22T05:42:07
2021-02-22T05:42:07
204,677,636
1
1
null
null
null
null
GB18030
Java
false
false
649
java
package nc.ui.hkjt.huiyuan.huanka.ace.serviceproxy; import nc.bs.framework.common.NCLocator; import nc.itf.hkjt.IHy_huankaMaintain; import nc.ui.pubapp.uif2app.query2.model.IQueryService; import nc.ui.querytemplate.querytree.IQueryScheme; /** * 示例单据的操作代理 * * @author author * @version tempProject version */ public class AceHy_huankaMaintainProxy implements IQueryService { @Override public Object[] queryByQueryScheme(IQueryScheme queryScheme) throws Exception { IHy_huankaMaintain query = NCLocator.getInstance().lookup( IHy_huankaMaintain.class); return query.query(queryScheme); } }
[ "441814246@qq.com" ]
441814246@qq.com
892996666b0b9c1398219b4e263b83bb73166117
5830810746c2848e4b25853f33b0742538bcb55a
/src/adapter/Galaxy.java
bdeaf39308c2f0fb233b4dad7203d525d1c75b0c
[]
no_license
ows3090/Design-Pattern-to-Java
980898b14b8d8c98cd9f43d2d8f855472687dad3
dfb9c70e6da4294490d390174c69925c5df1ce29
refs/heads/master
2023-05-02T08:24:51.357774
2021-05-08T13:47:23
2021-05-08T13:47:23
325,469,395
2
0
null
null
null
null
UTF-8
Java
false
false
94
java
package adapter; public interface Galaxy { void showGModel(); void showGVersion(); }
[ "wonseok@owonseog-ui-MacBookPro.local" ]
wonseok@owonseog-ui-MacBookPro.local
eb054d8bcc90caae340b5b91c070aa2271cdabed
4ae76c5e809977f8b897bfd6d06f3869598d346d
/vaadin-periscope-addon/src/main/java/info/magnolia/vaadin/periscope/result/ResultSupplier.java
2eae0cee44a819c6332db7d32c966284c248b761
[]
no_license
CedricReichenbach/vaadin-periscope
5944451f84c9a3067d8627c860b1f0677f99ee4b
58c703dfc64c56781a97025afc8db4f3c788d939
refs/heads/master
2021-01-22T12:26:37.724043
2018-02-19T09:48:49
2018-02-19T09:48:49
92,726,512
0
0
null
2017-08-10T09:24:32
2017-05-29T09:44:45
Java
UTF-8
Java
false
false
1,564
java
/** * This file Copyright (c) 2017 Magnolia International * Ltd. (http://www.magnolia-cms.com). All rights reserved. * * * This file is dual-licensed under both the Magnolia * Network Agreement and the GNU General Public License. * You may elect to use one or the other of these licenses. * * This file is distributed in the hope that it will be * useful, but AS-IS and WITHOUT ANY WARRANTY; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE, TITLE, or NONINFRINGEMENT. * Redistribution, except as permitted by whichever of the GPL * or MNA you select, is prohibited. * * 1. For the GPL license (GPL), you can redistribute and/or * modify this file under the terms of the GNU General * Public License, Version 3, as published by the Free Software * Foundation. You should have received a copy of the GNU * General Public License, Version 3 along with this program; * if not, write to the Free Software Foundation, Inc., 51 * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * 2. For the Magnolia Network Agreement (MNA), this file * and the accompanying materials are made available under the * terms of the MNA which accompanies this distribution, and * is available at http://www.magnolia-cms.com/mna.html * * Any modifications to this file must keep this entire header * intact. * */ package info.magnolia.vaadin.periscope.result; import java.util.List; /** * Supplier of {@link Result}s (duh). */ public interface ResultSupplier extends PeriscopeSupplier<List<Result>> { }
[ "cedric.reichenbach@magnolia-cms.com" ]
cedric.reichenbach@magnolia-cms.com
fe2253bac13a18ec385d03e9a9e58c6cd6cc924e
b213473cceedd14f4622d8069c7b7f3d43417058
/gov/shdrc/reports/dao/jdbc/DRMGRReportDAOJdbc.java
fa01a31b598537fe0c472f63d80d056173650572
[]
no_license
sandhiyasek/test_project
2224466f20a3ce3df97bc376ef11841ba72a94a0
0df06eca02651f02ede4da4b28441a7454cc59d3
refs/heads/master
2021-01-20T02:44:21.725203
2017-04-26T09:41:09
2017-04-26T09:41:09
89,449,965
0
0
null
null
null
null
UTF-8
Java
false
false
24,362
java
package gov.shdrc.reports.dao.jdbc; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.math.BigDecimal; import java.sql.Array; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import gov.shdrc.reports.dao.IDRMGRReportDAO; import gov.shdrc.util.CommonStringList; import gov.shdrc.util.ShdrcReportQueryList; import gov.shdrc.util.Util; import org.json.JSONArray; import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Service; @Service public class DRMGRReportDAOJdbc implements IDRMGRReportDAO{ @Autowired JdbcTemplate jdbcTemplate; public List getIndYearByNameandCategory(int directorateId,String indCategory,String indName){ Connection connection = null; PreparedStatement preparedStatement =null; ResultSet resultSet =null; List resultList=new ArrayList(); try { connection=jdbcTemplate.getDataSource().getConnection(); preparedStatement = connection.prepareStatement("select * from shdrc_dwh.fh_mgr_year(?,?,?)"); Array array=preparedStatement.getConnection().createArrayOf("text", indName.split(",")); preparedStatement.setInt(1, directorateId); preparedStatement.setString(2, indCategory); preparedStatement.setArray(3, array); resultSet = preparedStatement.executeQuery(); while (resultSet.next()) { resultList.add(resultSet.getInt(1)); } } catch (SQLException e) { e.printStackTrace(); } catch(Exception json){ }finally{ try { if (resultSet != null) { resultSet.close(); } if (preparedStatement != null) { preparedStatement.close(); } if (connection != null) { connection.close(); } } catch (SQLException ex) { } } return resultList; } public List<CommonStringList> getFreeHandZoneIndNamesByCategory(int directorateId,String category){ Connection connection = null; PreparedStatement preparedStatement =null; ResultSet resultSet =null; List resultList=new ArrayList(); try { connection=jdbcTemplate.getDataSource().getConnection(); preparedStatement = connection.prepareStatement("select * from shdrc_dwh.fh_mgr_ind_name(?,?)"); preparedStatement.setInt(1, directorateId); preparedStatement.setString(2, category); resultSet = preparedStatement.executeQuery(); while (resultSet.next()) { CommonStringList listCommon=new CommonStringList(); listCommon.setName(resultSet.getString(1)); listCommon.setId(resultSet.getInt(2)); resultList.add(listCommon); } } catch (SQLException e) { e.printStackTrace(); } catch(Exception json){ }finally{ try { if (resultSet != null) { resultSet.close(); } if (preparedStatement != null) { preparedStatement.close(); } if (connection != null) { connection.close(); } } catch (SQLException ex) { } } return resultList; } public List getFreeHandZoneIndCategory(int directorateId){ Connection connection = null; PreparedStatement preparedStatement =null; ResultSet resultSet =null; List resultList=new ArrayList(); try { connection=jdbcTemplate.getDataSource().getConnection(); preparedStatement = connection.prepareStatement("select * from shdrc_dwh.fh_mgr_ind_cat(?)"); preparedStatement.setInt(1, directorateId); resultSet = preparedStatement.executeQuery(); while (resultSet.next()) { resultList.add(resultSet.getString(1)); } } catch (SQLException e) { e.printStackTrace(); } catch(Exception json){ }finally{ try { if (resultSet != null) { resultSet.close(); } if (preparedStatement != null) { preparedStatement.close(); } if (connection != null) { connection.close(); } } catch (SQLException ex) { } } return resultList; } public JSONArray getFreeHandZoneData(int directorateId,String category,String indName,int year){ Connection connection = null; PreparedStatement preparedStatement =null; ResultSet resultSet =null; JSONArray childList=null; JSONArray parentList=new JSONArray(); try { childList=new JSONArray(); childList.put("State_Name"); childList.put("District_Name"); childList.put("HUD_Name"); childList.put("Institution_Name"); childList.put("Institution_Type"); childList.put("Indicator_Name"); childList.put("Indicator_Category"); childList.put("General_Type"); childList.put("General_Name"); childList.put("General_Category"); childList.put("Time_Month_Name"); childList.put("Time_Reg_Year"); childList.put("Ind_Value"); parentList.put(childList); connection=jdbcTemplate.getDataSource().getConnection(); preparedStatement = connection.prepareStatement("select * from shdrc_dwh.fh_mgr_main(?,?,?,?)"); Array array=preparedStatement.getConnection().createArrayOf("text", indName.split(",")); preparedStatement.setInt(1, directorateId); preparedStatement.setString(2, category); preparedStatement.setArray(3, array); preparedStatement.setInt(4, year); resultSet = preparedStatement.executeQuery(); while (resultSet.next()) { childList=new JSONArray(); String State_Name=resultSet.getString(1); String District_Name=resultSet.getString(2); String HUD_Name=resultSet.getString(3); String Institution_Name=resultSet.getString(4); String Institution_Type=resultSet.getString(5); String Indicator_Name=resultSet.getString(6); String Indicator_Category=resultSet.getString(7); String General_Type=resultSet.getString(8); String General_Name=resultSet.getString(9); String General_Category=resultSet.getString(10); String Time_Month_Name=resultSet.getString(11); int Time_Reg_Year=resultSet.getInt(12); int Ind_Value=resultSet.getInt(13); childList.put(State_Name); childList.put(District_Name); childList.put(HUD_Name); childList.put(Institution_Name); childList.put(Institution_Type); childList.put(Indicator_Name); childList.put(Indicator_Category); childList.put(General_Type); childList.put(General_Name); childList.put(General_Category); childList.put(Time_Month_Name); childList.put(Time_Reg_Year); childList.put(Ind_Value); parentList.put(childList); } } catch (SQLException e) { e.printStackTrace(); } catch(Exception json){ }finally{ try { if (resultSet != null) { resultSet.close(); } if (preparedStatement != null) { preparedStatement.close(); } if (connection != null) { connection.close(); } } catch (SQLException ex) { } } return parentList; } @Override public JSONArray getDRMGRIndicatorList(int directorateId, String indicatorCategory, int year, String month, String loggedUser) { Connection connection = null; PreparedStatement preparedStatement =null; ResultSet resultSet =null; JSONArray jsonArray=new JSONArray(); try { connection=jdbcTemplate.getDataSource().getConnection(); preparedStatement = connection.prepareStatement("select * from shdrc_dwh.dash_dept_mgr(?,?,?,?,?,?)"); preparedStatement.setInt(1, directorateId); preparedStatement.setString(2,indicatorCategory); preparedStatement.setString(3,""); preparedStatement.setInt(4, year); preparedStatement.setString(5,month); preparedStatement.setString(6,loggedUser); resultSet = preparedStatement.executeQuery(); while (resultSet.next()) { JSONObject jsonObject=new JSONObject(); jsonObject.put("Indicator", resultSet.getString(1)); jsonObject.put("State", resultSet.getString(2)); jsonObject.put("Department", resultSet.getString(3)); String threSholdColor=getThrosholdColor(resultSet.getString(5).charAt(0)); jsonObject.put("Threshold", threSholdColor); jsonObject.put("ThresholdTooltip", resultSet.getString(6)); jsonObject.put("Value", resultSet.getDouble(4)); jsonArray.put(jsonObject); } } catch (SQLException e) { e.printStackTrace(); } catch(Exception json){ }finally{ try { if (resultSet != null) { resultSet.close(); } if (preparedStatement != null) { preparedStatement.close(); } if (connection != null) { connection.close(); } } catch (SQLException ex) { } } return jsonArray; } @Override public JSONArray getDistrictwiseIndicaotrDetails(int directorateID, String indicatorCategory,String indicatorName, String departmentName, int year, String month, String loggedUser) { Connection connection = null; PreparedStatement preparedStatement =null; ResultSet resultSet =null; JSONArray childList=null; JSONArray parentList=new JSONArray(); try { connection=jdbcTemplate.getDataSource().getConnection(); preparedStatement = connection.prepareStatement("select * from shdrc_dwh.dash_inst_mgr(?,?,?,?,?,?,?)"); preparedStatement.setInt(1, directorateID); preparedStatement.setString(2,indicatorCategory); preparedStatement.setString(3,indicatorName); preparedStatement.setString(4,departmentName); preparedStatement.setInt(5, year); preparedStatement.setString(6,month); preparedStatement.setString(7,loggedUser); resultSet = preparedStatement.executeQuery(); while (resultSet.next()) { /*childList=new JSONArray(); String department=resultSet.getString(3); String institution=resultSet.getString(4); Double val=resultSet.getDouble(5); String color=resultSet.getString(6); String zone=resultSet.getString(7); childList.put(department); childList.put(institution); childList.put(val); childList.put(zone); childList.put(getThrosholdColor(color.charAt(0))); parentList.put(childList);*/ JSONObject jsonObject=new JSONObject(); jsonObject.put("Institution", resultSet.getString(4)); jsonObject.put("Department", resultSet.getString(3)); jsonObject.put("Value", resultSet.getDouble(5)); String threSholdColor=getThrosholdColor(resultSet.getString(6).charAt(0)); jsonObject.put("Threshold", threSholdColor); jsonObject.put("ThresholdTooltip", resultSet.getString(7)); parentList.put(jsonObject); } } catch (SQLException e) { e.printStackTrace(); } catch(Exception json){ }finally{ try { if (resultSet != null) { resultSet.close(); } if (preparedStatement != null) { preparedStatement.close(); } if (connection != null) { connection.close(); } } catch (SQLException ex) { } } return parentList; } @Override public CommonStringList getDashboardIntMaxMonthAndYear(int directorateId,String indFrequency) { Connection connection = null; PreparedStatement preparedStatement =null; ResultSet resultSet =null;CommonStringList commonStringList=null; try { connection=jdbcTemplate.getDataSource().getConnection(); if(directorateId==17){//Required because there is separate query for CMCHIS Directorate preparedStatement = connection.prepareStatement(ShdrcReportQueryList.CMCHIS_DASHBOARD_MAX_MONTH_YEAR); }else{ preparedStatement = connection.prepareStatement(ShdrcReportQueryList.DASHBOARD_MAX_MONTH_YEAR); } preparedStatement.setInt(1, directorateId); preparedStatement.setString(2,indFrequency); preparedStatement.setInt(3, directorateId); preparedStatement.setString(4,indFrequency); resultSet = preparedStatement.executeQuery(); while (resultSet.next()) { commonStringList=new CommonStringList(); commonStringList.setId( resultSet.getInt(1)); commonStringList.setName(resultSet.getString(2)); } } catch (SQLException e) { e.printStackTrace(); } catch(Exception json){ }finally{ try { if (resultSet != null) { resultSet.close(); } if (preparedStatement != null) { preparedStatement.close(); } if (connection != null) { connection.close(); } } catch (SQLException ex) { } } return commonStringList; } private String getThrosholdColor(char c){ if(c=='Y'){ return "#F36A6A";//"#ff4d4d";//red } else if(c=='N'){ return "#66A65C";//"#2e9e66";//"#00994d";//green }else{ return ""; } } public JSONArray getFreeHandZoneData(int year){ Connection connection = null; PreparedStatement preparedStatement =null; ResultSet resultSet =null; JSONArray childList=null; JSONArray parentList=new JSONArray(); try { childList=new JSONArray(); childList.put("State_Name"); childList.put("District_Name"); childList.put("HUD_Name"); childList.put("Institution_Name"); childList.put("Institution_Type"); childList.put("Indicator_Name"); childList.put("Indicator_Category"); childList.put("General_Type"); childList.put("General_Name"); childList.put("General_Category"); childList.put("Time_Month_Name"); childList.put("Time_Reg_Year"); childList.put("Ind_Value"); parentList.put(childList); connection=jdbcTemplate.getDataSource().getConnection(); preparedStatement = connection.prepareStatement(ShdrcReportQueryList.ESI_FREEHANDZONE_FULL_INFO); preparedStatement.setInt(1, year); resultSet = preparedStatement.executeQuery(); while (resultSet.next()) { childList=new JSONArray(); String State_Name=resultSet.getString(1); String District_Name=resultSet.getString(2); String HUD_Name=resultSet.getString(3); String Institution_Name=resultSet.getString(4); String Institution_Type=resultSet.getString(5); String Indicator_Name=resultSet.getString(6); String Indicator_Category=resultSet.getString(7); String General_Type=resultSet.getString(8); String General_Name=resultSet.getString(9); String General_Category=resultSet.getString(10); String Time_Month_Name=resultSet.getString(11); int Time_Reg_Year=resultSet.getInt(12); int Ind_Value=resultSet.getInt(13); childList.put(State_Name); childList.put(District_Name); childList.put(HUD_Name); childList.put(Institution_Name); childList.put(Institution_Type); childList.put(Indicator_Name); childList.put(Indicator_Category); childList.put(General_Type); childList.put(General_Name); childList.put(General_Category); childList.put(Time_Month_Name); childList.put(Time_Reg_Year); childList.put(Ind_Value); parentList.put(childList); } } catch (SQLException e) { e.printStackTrace(); } catch(Exception json){ }finally{ try { if (resultSet != null) { resultSet.close(); } if (preparedStatement != null) { preparedStatement.close(); } if (connection != null) { connection.close(); } } catch (SQLException ex) { } } return parentList; } //Reports Zone public JSONArray getReportZoneData(Integer directorateId,String reportName,Integer fromYear,String fromMonth,Integer toYear,String toMonth, String userName){ Connection connection = null; PreparedStatement preparedStatement =null; ResultSet resultSet =null; String query=null; JSONArray childList=null; JSONArray parentList=new JSONArray(); try { childList = getReportTemplateHeader(reportName); parentList.put(childList); connection=jdbcTemplate.getDataSource().getConnection(); query = getQueryByReportName(reportName); preparedStatement=connection.prepareStatement(query); preparedStatement.setInt(1, directorateId); preparedStatement.setString(2, reportName); preparedStatement.setInt(3, fromYear); preparedStatement.setString(4, fromMonth); preparedStatement.setInt(5, toYear); preparedStatement.setString(6, toMonth); preparedStatement.setString(7, userName); resultSet=preparedStatement.executeQuery(); parentList=getDataByReportName(resultSet,reportName,parentList); } catch (SQLException e) { e.printStackTrace(); } catch(Exception json){ }finally{ try { if (resultSet != null) { resultSet.close(); } if (preparedStatement != null) { preparedStatement.close(); } if (connection != null) { connection.close(); } } catch (SQLException ex) { } } return parentList; } private JSONArray getReportTemplateHeader(String reportName){ JSONArray childList=null; try{ childList=new JSONArray(); if("Degrees Awarded in the Convocation".equalsIgnoreCase(reportName)){ childList.put("Course Category"); childList.put("Course Name"); childList.put("Branch Name"); childList.put("Indicator"); childList.put("Value"); } else if(("PHD Awarded".equalsIgnoreCase(reportName))){ childList.put("Indicator"); childList.put("Branch"); childList.put("General Code"); childList.put("Value"); } else if(("Students Admission details (Institution wise)".equalsIgnoreCase(reportName))){ childList.put("Institution Name"); childList.put("Indicator"); childList.put("Course Speciality"); childList.put("Course Name"); childList.put("Value"); } }catch(Exception json){ } return childList; } private String getQueryByReportName(String reportName){ String query = null; if("PHD Awarded".equalsIgnoreCase(reportName)){ query=ShdrcReportQueryList.DRMGR_REPORTZONE_PHD_AWARDED; } else if("Degrees Awarded in the Convocation".equalsIgnoreCase(reportName)){ query=ShdrcReportQueryList.DRMGR_REPORTZONE_DEGREES_AWARDED_IN_CONVOCATION; } else if("Students Admission details (Institution wise)".equalsIgnoreCase(reportName)){ query=ShdrcReportQueryList.DRMGR_REPORTZONE_STUDENTS_ADMITTED; } return query; } private JSONArray getDataByReportName(ResultSet resultSet,String reportName,JSONArray parentList){ JSONArray childList=null; try{ if("Degrees Awarded in the Convocation".equalsIgnoreCase(reportName)){ while(resultSet.next()) { childList=new JSONArray(); String indicator=resultSet.getString(1); String course=resultSet.getString(2); String coursecategory=resultSet.getString(3); String generalType=resultSet.getString(4); BigDecimal val=truncateDecimal(resultSet.getDouble(5),2); childList.put(coursecategory); childList.put(course); childList.put(generalType); childList.put(indicator); childList.put(val); parentList.put(childList); } } else if(("PHD Awarded".equalsIgnoreCase(reportName))){ while(resultSet.next()) { childList=new JSONArray(); String indicator=resultSet.getString(1); String generalType=resultSet.getString(2); String branchCode=resultSet.getString(3); BigDecimal val=truncateDecimal(resultSet.getDouble(4),2); childList.put(indicator); childList.put(generalType); childList.put(branchCode); childList.put(val); parentList.put(childList); } } else if(("Students Admission details (Institution wise)".equalsIgnoreCase(reportName))){ while(resultSet.next()) { childList=new JSONArray(); String institutionName=resultSet.getString(1); String indicator=resultSet.getString(2); String courseSpeciality=resultSet.getString(3); String generalType=resultSet.getString(4); BigDecimal val=truncateDecimal(resultSet.getDouble(5),2); childList.put(institutionName); childList.put(indicator); childList.put(courseSpeciality); childList.put(generalType); childList.put(val); parentList.put(childList); } } }catch(Exception json){ } return parentList; } private static BigDecimal truncateDecimal(double x,int numberofDecimals) { if ( x > 0) { return new BigDecimal(String.valueOf(x)).setScale(numberofDecimals, BigDecimal.ROUND_FLOOR); } else { return new BigDecimal(String.valueOf(x)).setScale(numberofDecimals, BigDecimal.ROUND_CEILING); } } //Analysis Zone public JSONArray getAnalysisZoneData(Integer directorateId,String analysisReportName,Integer year,String month,String userName){ String sr=null; Connection connection = null; PreparedStatement preparedStatement =null; ResultSet resultSet =null; JSONArray analysisZoneData=new JSONArray(); try { if("Trend of Phd Awarded".equalsIgnoreCase(analysisReportName)){ sr = ShdrcReportQueryList.DRMGR_ANALYSISZONE_PHD_AWARDED; } else if("Students Admitted in Top 10 Institutions-Year wise".equalsIgnoreCase(analysisReportName)){ sr = ShdrcReportQueryList.DRMGR_ANALYSISZONE_STUDENTS_ADMITTED; } else if("Number of Degrees Awarded - Across Medical Colleges".equalsIgnoreCase(analysisReportName)){ sr = ShdrcReportQueryList.DRMGR_ANALYSISZONE_DEGREES_AWARDED; } else if("Comparison of various institutions -Year wise".equalsIgnoreCase(analysisReportName)){ sr = ShdrcReportQueryList.DRMGR_ANALYSISZONE_INSTITUTIONS_COMPARISON; } connection=jdbcTemplate.getDataSource().getConnection(); preparedStatement=connection.prepareStatement(sr); preparedStatement.setInt(1, directorateId); preparedStatement.setString(2, analysisReportName); preparedStatement.setInt(3, year); preparedStatement.setString(4, month); preparedStatement.setString(5, userName); resultSet=preparedStatement.executeQuery(); while(resultSet.next()){ String label=null; int value; JSONObject jsonObject=new JSONObject(); if("Comparison of various institutions -Year wise".equalsIgnoreCase(analysisReportName)){ label= resultSet.getString(1); value=resultSet.getInt(2); } else{ label=resultSet.getString(2); value=resultSet.getInt(3); } jsonObject.put("label",label); jsonObject.put("value",value); analysisZoneData.put(jsonObject); } } catch (SQLException e) { e.printStackTrace(); } catch(Exception json){ }finally{ try { if (resultSet != null) { resultSet.close(); } if (preparedStatement != null) { preparedStatement.close(); } if (connection != null) { connection.close(); } } catch (SQLException ex) { } } return analysisZoneData; } }
[ "sandhiya.sekar@accenture.com" ]
sandhiya.sekar@accenture.com
d1d84cb3447b8095b865183455e70972a2d9b74f
c3d69b2026bd161ce4d2ab58ca2b73a66a02979e
/Method.java
cb37e690c2aa2559f317ef1734a9a4a20c768381
[]
no_license
vicksheart/oops-concept
f0a45ebd438b2495088b47bfecf16e5037897dde
77dadf18cbc5ca346b1feb713ff02e2ad0e12abd
refs/heads/master
2021-01-23T20:56:23.416692
2017-05-08T20:01:37
2017-05-08T20:01:37
90,666,478
0
0
null
null
null
null
UTF-8
Java
false
false
406
java
import java.io.*; import java.util.*; class Method { public static void main(String arr[]) { int age; Scanner in = new Scanner(System.in); System.out.println("Enter your age"); age=in.nextInt(); String result = agecalculator(age); System.out.println(result); } public static String agecalculator(int age) { if(age>18) { return "adult"; } else { return "minor"; } } }
[ "manstiwa556@gmail.com" ]
manstiwa556@gmail.com
1b280725362b0247727d3528380d6c2984b9a9ac
768af1c4cd80bef225c128696fe18c9d85291d0d
/src/Button.java
fe2a607d5addd6edc81326fd7012a218c94b680b
[ "MIT" ]
permissive
JamieOrchard/Tic-Tac-Toe-Game
7df41bf9ea6a772a495d3ee4c296f36fe673678e
f3c00892be34cf9808b19f74a153cb75438a4a27
refs/heads/master
2020-03-27T20:34:39.724258
2018-09-15T20:40:58
2018-09-15T20:40:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
11,442
java
package tiko.game; import java.awt.event.ActionEvent; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.KeyListener; import java.awt.event.KeyEvent; import java.awt.Graphics2D; import java.awt.Color; import java.awt.Rectangle; import java.awt.PointerInfo; import java.awt.Point; import java.awt.MouseInfo; import java.util.Scanner; import java.io.*; public class Button implements MouseListener, KeyListener { static public Main game; BaseButton reset_btn = new BaseButton( 0, 256, 96, 32, 10, 206, 96, 32); BaseButton forfeit_btn = new BaseButton( 96, 256, 96, 32, 10, 206, 96, 32); BaseButton easy_btn = new BaseButton( 192, 256, 96, 32, 116, 206, 96, 32); BaseButton normal_btn = new BaseButton( 288, 256, 96, 32, 116, 248, 96, 32); BaseButton hard_btn = new BaseButton( 0, 288, 96, 32, 116, 292, 96, 32); BaseButton online_btn = new BaseButton( 96, 288, 96, 32, 10, 290, 96, 32); BaseButton host_btn = new BaseButton( 192, 288, 96, 32, 116, 206, 96, 32); BaseButton connect_btn = new BaseButton( 288, 288, 96, 32, 116, 248, 96, 32); BaseButton disconnect_btn = new BaseButton( 0, 320, 96, 32, 0, 0, 0, 0); BaseButton start_btn = new BaseButton( 96, 320, 96, 32, 116, 292, 96, 32); BaseButton bot_btn = new BaseButton( 192, 320, 96, 32, 10, 248, 96, 32); BaseButton network_inputbox_ip = new BaseButton( 0, 352, 96, 32, 222, 206, 154, 32); BaseButton network_inputbox_port = new BaseButton( 0, 352, 96, 32, 222, 248, 154, 32); public Button(Main game){ this.game = game; } public void mouseClicked(MouseEvent e){} public void mouseEntered(MouseEvent e){} public void mouseExited(MouseEvent e){} public void keyPressed(KeyEvent e){} public void keyTyped(KeyEvent e){} public String ip_string = new String(); public String port_string = new String(); public boolean network_active = false; public Network online = new Network(this); public void keyReleased(KeyEvent e) { System.out.println(e.getKeyCode()); //System.out.println(e.getKeyCode()); if(network_inputbox_port.active){ if(e.getKeyCode() == 8){ if(port_string.length() > 0){port_string = port_string.substring(0, port_string.length() -1);} } else if(e.getKeyCode() >= 48 && e.getKeyCode() <= 57 || e.getKeyCode() >= 97 && e.getKeyCode() <= 105){ port_string += e.getKeyChar(); } System.out.println(port_string); } if(network_inputbox_ip.active){ if(e.getKeyCode() == 8){ if(ip_string.length() > 0){ip_string = ip_string.substring(0, ip_string.length() -1);} } else{ip_string += e.getKeyChar();} System.out.println(ip_string); } } public void mousePressed(MouseEvent e) { int mx = e.getX(); int my = e.getY(); if(reset_btn.Collision(mx,my)){reset_btn.state = BtnState.Push;} if(online_btn.Collision(mx,my)){online_btn.state = BtnState.Push;} if(online_btn.active){ if(host_btn.Collision(mx,my)){online_btn.state = BtnState.Push;} if(connect_btn.Collision(mx,my)){online_btn.state = BtnState.Push;} if(start_btn.Collision(mx,my)){online_btn.state = BtnState.Push;} } if(bot_btn.Collision(mx,my)){bot_btn.state = BtnState.Push;} if(bot_btn.active){ if(easy_btn.Collision(mx,my)){easy_btn.state = BtnState.Push;} if(normal_btn.Collision(mx,my)){normal_btn.state = BtnState.Push;} if(hard_btn.Collision(mx,my)){hard_btn.state = BtnState.Push;} } } public void mouseReleased(MouseEvent e) { int mx = e.getX(); int my = e.getY(); Rectangle rect = new Rectangle(game.game_board.grid_dst); rect.width /= 3; rect.height /= 3; if(game.game_board.winner == ID.Empty){ for(int y = 0; y < 3; y++){ for(int x = 0; x < 3; x++){ if(mCollision(mx, my, rect.x + (rect.width * x), rect.y + (rect.height * y) ,rect.width, rect.height)){ game.game_board.placeTile(y * 3 + x); } } } } if(reset_btn.Collision(mx,my)){ reset_btn.state = BtnState.None; game.game_board.reset(); } if(bot_btn.Collision(mx,my)){ bot_btn.active = !bot_btn.active; online_btn.active = false; bot_btn.state = BtnState.None; } if(bot_btn.active){ if(easy_btn.Collision(mx,my)){ easy_btn.active = !easy_btn.active; easy_btn.state = BtnState.None; normal_btn.active = false; hard_btn.active = false; game.game_board.reset(); } if(normal_btn.Collision(mx,my)){ easy_btn.active = false; normal_btn.active = !normal_btn.active; normal_btn.state = BtnState.None; hard_btn.active = false; game.game_board.reset(); } if(hard_btn.Collision(mx,my)){ easy_btn.active = false; normal_btn.active = false; hard_btn.active = !hard_btn.active; hard_btn.state = BtnState.None; game.game_board.reset(); } }else{ easy_btn.active = false; easy_btn.state = BtnState.None; normal_btn.active = false; normal_btn.state = BtnState.None; hard_btn.active = false; hard_btn.state = BtnState.None; } if(online_btn.Collision(mx,my)){ online_btn.active = !online_btn.active; bot_btn.active = false; online_btn.state = BtnState.None; } if(online_btn.active) { if(host_btn.Collision(mx,my)){ connect_btn.active = false; host_btn.active = !host_btn.active; network_inputbox_port.active = false; network_inputbox_ip.active = false; } if(connect_btn.Collision(mx,my)){ host_btn.active = false; connect_btn.active = !connect_btn.active; network_inputbox_ip.active = false; network_inputbox_port.active = false; } if(start_btn.Collision(mx,my)){ if(!network_active){ if(host_btn.active){ System.out.println("Server Start"); network_active = true; online.start(); } else if(connect_btn.active){ System.out.println("Server Start"); network_active = true; online.start(); } } else{ //Code to shutdown server } } if(host_btn.active){ if(network_inputbox_port.Collision(mx,my)){ network_inputbox_port.active = !network_inputbox_port.active; } } if(connect_btn.active){ if(network_inputbox_port.Collision(mx,my)){ network_inputbox_port.active = !network_inputbox_port.active; network_inputbox_ip.active = false; } if(network_inputbox_ip.Collision(mx,my)){ network_inputbox_ip.active = !network_inputbox_ip.active; network_inputbox_port.active = false; } } } } public void update() { PointerInfo pi = MouseInfo.getPointerInfo(); Point p = pi.getLocation(); int mx = ((int) p.getX() - ((int) game.getLocationOnScreen().getX())); int my = ((int) p.getY() - ((int) game.getLocationOnScreen().getY())); //RESET BUTTON if(reset_btn.Collision(mx,my)){ if(reset_btn.state == BtnState.None){reset_btn.state = BtnState.Hover;} }else{reset_btn.state = BtnState.None;} //BOT BUTTON if(bot_btn.Collision(mx,my)){ if(bot_btn.state == BtnState.None){bot_btn.state = BtnState.Hover;} }else{bot_btn.state = BtnState.None;} if(bot_btn.active){ //EASY BUTTON if(easy_btn.Collision(mx,my)){ if(easy_btn.state == BtnState.None){easy_btn.state = BtnState.Hover;} }else{easy_btn.state = BtnState.None;} if(easy_btn.active){ game.game_board.bot.active = true; game.game_board.bot.difficulty = 2; } //NORMAL BUTTON if(normal_btn.Collision(mx,my)){ if(normal_btn.state == BtnState.None){normal_btn.state = BtnState.Hover;} }else{normal_btn.state = BtnState.None;} if(normal_btn.active){ game.game_board.bot.active = true; game.game_board.bot.difficulty = 8; } //HARD BUTTON if(hard_btn.Collision(mx,my)){ if(hard_btn.state == BtnState.None){hard_btn.state = BtnState.Hover;} }else{hard_btn.state = BtnState.None;} if(hard_btn.active){ game.game_board.bot.active = true; game.game_board.bot.difficulty = 20; } } //ONLINE BUTTON if(online_btn.Collision(mx,my)){ if(online_btn.state == BtnState.None){online_btn.state = BtnState.Hover;} }else{online_btn.state = BtnState.None;} if(online_btn.active){ //HOST BUTTON if(host_btn.Collision(mx,my)){ if(host_btn.state == BtnState.None){host_btn.state = BtnState.Hover;} }else{host_btn.state = BtnState.None;} //CONNECT BUTTON if(connect_btn.Collision(mx,my)){ if(connect_btn.state == BtnState.None){connect_btn.state = BtnState.Hover;} }else{connect_btn.state = BtnState.None;} //START BUTTON if(start_btn.Collision(mx,my)){ if(start_btn.state == BtnState.None){start_btn.state = BtnState.Hover;} }else{start_btn.state = BtnState.None;} if(network_active){start_btn.active = true;} } } public void draw(Graphics2D _g2d) { reset_btn.active = true; reset_btn.draw(_g2d); bot_btn.draw(_g2d); if(bot_btn.active){ easy_btn.draw(_g2d); normal_btn.draw(_g2d); hard_btn.draw(_g2d); } online_btn.draw(_g2d); if(online_btn.active){ host_btn.draw(_g2d); connect_btn.draw(_g2d); start_btn.draw(_g2d); if(host_btn.active || connect_btn.active){ _g2d.setColor(Color.WHITE); if(host_btn.active){ if(port_string.length() == 0){_g2d.drawString("Port", 225, 263);} _g2d.drawString(port_string, 225, 263); } if(connect_btn.active){ if(ip_string.length() == 0){_g2d.drawString("IP", 225, 226);} if(port_string.length() == 0){_g2d.drawString("Port", 225, 263);} _g2d.drawString(ip_string, 225, 226); _g2d.drawString(port_string, 225, 263); network_inputbox_ip.draw(_g2d); } network_inputbox_port.draw(_g2d); _g2d.setColor(Color.BLACK); } } } static Boolean mCollision(int mx, int my, int pos_x, int pos_y, int pos_w, int pos_h) { if((mx > pos_x) && (mx < pos_x + pos_w)){ if((my > pos_y) && (my < pos_y + pos_h)){ return true; } } return false; } } enum BtnState{None, Hover, Push}; class BaseButton { public Rectangle src_pos; public Rectangle dst_pos; public BtnState state = BtnState.None; public boolean active = false; boolean hover; BaseButton() { } BaseButton(int _sx, int _sy, int _sw, int _sh, int _dx, int _dy, int _dw, int _dh) { src_pos = new Rectangle(_sx, _sy, _sw, _sh); dst_pos = new Rectangle(_dx, _dy, _dw, _dh); } void setSrcXY(int x, int y) { src_pos.x = x; src_pos.y = y; } boolean Collision(int mx, int my) { if((mx > dst_pos.x) && (mx < dst_pos.x + dst_pos.width)){ if((my > dst_pos.y) && (my < dst_pos.y + dst_pos.height)){ return true; } } return false; } void draw(Graphics2D _g2d) { Rectangle temp = new Rectangle(dst_pos); if(state == BtnState.Hover){ temp.x -= 2; temp.y -= 2; temp.width += 4; temp.height += 4; } if(state == BtnState.Push) { temp.x += 2; temp.y += 2; temp.width -= 4; temp.height -= 4; } Button.game.game_board.sheet.setSrcPos(src_pos); Button.game.game_board.sheet.setDstPos(temp); Button.game.game_board.sheet.draw(_g2d); if(!active) { temp = new Rectangle(288,320,96,32); Button.game.game_board.sheet.setSrcPos(temp); Button.game.game_board.sheet.setDstPos(dst_pos); Button.game.game_board.sheet.draw(_g2d); } } }
[ "jamiebillings@sky.com" ]
jamiebillings@sky.com
cb3518ffb67c74e44f27fd5051598647b740ea65
33115edd3e4148c48fe5a6cb8f68b69ecb1f0c42
/05-Multiplayer Server/Jetris/src/LaunchMultiplayerServer.java
cfa978bed6ffd8a9b65d9aaabbc36824ef8fe758
[ "MIT" ]
permissive
Christian1984/FUN-mit-FOPT
e2db18bbbd37cdf11b77c72c386ff0f7d593b5a4
c15dbcb7fa3bc29228f83eefe2b4422f8ae1003a
refs/heads/master
2020-02-26T13:28:34.521916
2016-08-10T12:28:40
2016-08-10T12:28:40
65,380,564
1
0
null
null
null
null
UTF-8
Java
false
false
451
java
import java.rmi.RemoteException; /** * Created by chris on 07.04.16. */ public class LaunchMultiplayerServer { public static void main(String args[]) { try { //create rmi registry //TODO //create game service and bind //TODO //status System.out.println("Server started!"); } catch (RemoteException e) { e.printStackTrace(); } } }
[ "chris.hoffmann84@gmail.com" ]
chris.hoffmann84@gmail.com
2501d27e5f334b161cc36f87061f214e43c5eb6a
2391192bfb99949068fa14ada1dcc0462134cd31
/app/src/main/java/de/gematik/poc/vaccination/pki/package-info.java
709577dfeb122fe1a47c3da175808b6394dcb496
[ "Apache-2.0" ]
permissive
gematik/poc-vaccination-certification-verifier
b30b063e84506a37b84bb43bd1228e7b50629ebd
85027ae22f94ba79ef6f0aad187e2161f76c9cef
refs/heads/master
2023-04-03T13:00:20.025709
2021-04-01T07:58:28
2021-04-01T07:58:28
353,597,022
1
0
null
null
null
null
UTF-8
Java
false
false
1,013
java
/* * Copyright (c) 2021 gematik GmbH * * 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. */ /** * This package provides functionality dealing with a public key infrastructure. */ @DefaultAnnotation(NonNull.class) // help spotbugs @ReturnValuesAreNonnullByDefault // help spotbugs package de.gematik.poc.vaccination.pki; import edu.umd.cs.findbugs.annotations.DefaultAnnotation; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.ReturnValuesAreNonnullByDefault;
[ "software-development@gematik.de" ]
software-development@gematik.de
f000587f98f54f83021e2df185387e56b811d9d3
f1e96e7cb24ee25c6d7c3532c42bb0ae2642d735
/6/Publisher.java
076af9b32c5df71c9700f2271ec2ab4cf59db072
[]
no_license
imadityac/Distributed-computing
653ea23f8d8afdf9dc305671db0179ec6eae2dd3
44cd7c9a244013c279e64284f1c1cf3876def9f0
refs/heads/master
2022-04-24T20:13:28.418134
2020-04-21T17:14:35
2020-04-21T17:14:35
257,662,214
0
0
null
null
null
null
UTF-8
Java
false
false
1,172
java
package publishersubscriber; import java.util.Scanner; import javax.jms.*; import org.apache.activemq.ActiveMQConnection; import org.apache.activemq.ActiveMQConnectionFactory; public class Publisher { private static String url=ActiveMQConnection.DEFAULT_BROKER_URL; public static void main(String[] args) throws JMSException{ ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(url); Connection connection = connectionFactory.createConnection(); connection.start(); /*JMS messages are sent and recieved using a session*/ Session session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE); Topic topic = session.createTopic("testt"); MessageProducer producer = session.createProducer(topic); //creating small text message TextMessage message = session.createTextMessage(); System.out.println("Enter message to be sent:"); Scanner input= new Scanner(System.in); String text=input.next(); message.setText(text); //creating small text message producer.send(message); System.out.println("Sent message:"+message.getText()); connection.close(); } }
[ "imadityac@gmail.com" ]
imadityac@gmail.com
b437e995338e23d3aee80ccaa7101dd15594704a
9cb2f0e4e78cfa51a9d827ecebb7760d23dcca38
/src/main/java/cput/immutablepro/Model/Employee.java
39e7daa6a47a247ffd050bf549231d0a390d3aa3
[]
no_license
khanyaMvumbi/ImmutablePro
d32be5906b1ca0e8c80d3798d13a2426e445d26b
5a9ba96a5b6eef6c2a80fe87edae9fffcef9ce1b
refs/heads/master
2021-03-12T20:27:14.700495
2014-03-08T21:09:27
2014-03-08T21:09:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,008
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package cput.immutablepro.Model; import java.util.List; /** * * @author Khanya */ public class Employee { private String empID; private String empName; private String empSurname; private String jobType; private List<FeedAnimal> feedAnimal; private List<TransportAnimal> transportAnimal; private List<AdoptAnimal> purchase; private List<ServiceHabitat> serviceHabitat; private List<ServiceAnimal> serviceAnimal; private Employee(EmployeeBuilder build) { this.empID = build.empID; this.empName = build.empName; this.empSurname = build.empSurname; this.jobType = build.jobType; this.transportAnimal = build.transportAnimal; this.feedAnimal = build.feedAnimal; this.serviceAnimal = build.serviceAnimal; this.serviceHabitat = build.serviceHabitat; this.purchase = build.purchase; } public static class EmployeeBuilder{ private String empID; private String empName; private String empSurname; private String jobType; private List<FeedAnimal> feedAnimal; private List<TransportAnimal> transportAnimal; private List<ServiceHabitat> serviceHabitat; private List<ServiceAnimal> serviceAnimal; private List<AdoptAnimal> purchase; public EmployeeBuilder(String empID) { this.empID = empID; } public EmployeeBuilder EmpID(String empID) { this.empID = empID; return this; } public EmployeeBuilder EmpName(String empName) { this.empName = empName; return this; } public EmployeeBuilder EmpSurname(String empSurname) { this.empSurname = empSurname; return this; } public EmployeeBuilder JobType(String jobType) { this.jobType = jobType; return this; } public EmployeeBuilder FeedAnimal(List<FeedAnimal> feedAnimal) { this.feedAnimal = feedAnimal; return this; } public EmployeeBuilder transportAnimal(List<TransportAnimal> transportAnimal) { this.transportAnimal = transportAnimal; return this; } public EmployeeBuilder ServiceHabitat(List<ServiceHabitat> serviceHabitat) { this.serviceHabitat = serviceHabitat; return this; } public EmployeeBuilder ServiceAnimal(List<ServiceAnimal> serviceAnimal) { this.serviceAnimal = serviceAnimal; return this; } public EmployeeBuilder Purchase(List<AdoptAnimal> purchase) { this.purchase = purchase; return this; } public EmployeeBuilder empBuild(Employee emp) { empName = emp.getEmpName(); empID = emp.getEmpID(); empSurname = emp.getEmpSurname(); jobType = emp.getJobType(); purchase = emp.getPurchase(); serviceAnimal = emp.getServiceAnimal(); transportAnimal = emp.getTransportAnimal(); serviceHabitat = emp.getServiceHabitat(); feedAnimal = emp.getFeedAnimal(); return this; } public Employee build() { return new Employee(this); } } public String getEmpID() { return empID; } public String getEmpName() { return empName; } public String getEmpSurname() { return empSurname; } public List<AdoptAnimal> getPurchase() { return purchase; } public List<ServiceHabitat> getServiceHabitat() { return serviceHabitat; } public List<ServiceAnimal> getServiceAnimal() { return serviceAnimal; } public String getJobType() { return jobType; } public List<FeedAnimal> getFeedAnimal() { return feedAnimal; } public List<cput.immutablepro.Model.TransportAnimal> getTransportAnimal() { return transportAnimal; } @Override public int hashCode() { return empID.hashCode(); } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Employee other = (Employee) obj; if ((this.empID == null) ? (other.empID != null) : !this.empID.equals(other.empID)) { return false; } return true; } }
[ "Khanya@155.238.100.35" ]
Khanya@155.238.100.35
ea86aacbb25177134183c90b4ba0c2700553e45a
091a4c6d5d12c176ef2b08e20691e3dc07deed8d
/src/main/java/ua/epam/spring/hometask/dao/DomainObjectDAO.java
3c12c8c71d3185591477dacec83b2516046f06d0
[]
no_license
ilnurnigma/spring-core-hometask1
6185b7773902d6a159f624e9353e90bf39eb5def
de1ba0e878a09eca129cd2412651ddc943848abc
refs/heads/master
2021-01-19T13:59:49.352032
2017-09-03T22:40:02
2017-09-03T22:40:02
100,872,453
0
0
null
null
null
null
UTF-8
Java
false
false
2,119
java
package ua.epam.spring.hometask.dao; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; import ua.epam.spring.hometask.domain.DomainObject; import ua.epam.spring.hometask.domain.User; import javax.annotation.Nonnull; import java.sql.DatabaseMetaData; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Collection; import java.util.HashSet; public abstract class DomainObjectDAO<T extends DomainObject> { protected Collection<T> domainObjects = new HashSet<>(); protected JdbcTemplate jdbcTemplate; protected String tableName; public DomainObject save(T object) { jdbcTemplate.update("insert into " + tableName + " (id, msg) values (?, ?)", object.getId(), "some message"); domainObjects.add(object); return object; } public boolean remove(T object) { jdbcTemplate.update("delete from " + tableName + " where id=?", object.getId()); return domainObjects.remove(object); } /** * Getting object by id from storage * * @param id id of the object * @return Found object or <code>null</code> */ public T getById(@Nonnull Long id) { jdbcTemplate.queryForObject("select id, msg from " + tableName + " where id=?", new RowMapper<T>() { @Override public T mapRow(ResultSet resultSet, int rowNumber) throws SQLException { DomainObject domainObject = new DomainObject(); domainObject.setId(resultSet.getLong("id")); return (T) domainObject; } }, id); return null; } /** * Getting all objects from storage * * @return collection of objects */ @Nonnull public Collection<T> getAll() { Collection<T> objects = new HashSet<>(); objects.addAll(domainObjects); return objects; } public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; } public void setTableName(String tableName) { this.tableName = tableName; } }
[ "ilnur.nigma@gmail.com" ]
ilnur.nigma@gmail.com
f2f1a318d3f25721f661155c14fbe7a01eb0a13a
b66d67ef361a87a67eea42144eefd5362f5b5347
/src/main/java/com/bushpath/rutils/query/EqualExpression.java
753b5305d19949fe7d8a09a9250c039f01a8e541
[ "MIT" ]
permissive
hamersaw/rutils
99c7bc89e62dcc57cb329f420961de090bf4bece
b85ad0a4f9559568c1a06c019efa14c23731a566
refs/heads/master
2020-03-20T06:26:15.108283
2019-02-21T02:32:12
2019-02-21T02:32:12
137,248,855
0
0
null
null
null
null
UTF-8
Java
false
false
939
java
package com.bushpath.rutils.query; import java.io.Serializable; import java.lang.Comparable; public class EqualExpression<T extends Comparable<T>> extends Expression<T> implements Serializable { private T value; public EqualExpression(T value) { super(); this.value = value; } @Override public boolean evaluate(T value) { return value.compareTo(this.value) == 0; } @Override public boolean evaluateBin(T lowerBound, T upperBound) { return lowerBound.compareTo(this.value) <= 0 && upperBound.compareTo(this.value) > 0; } @Override public String toString(int depth) { StringBuilder stringBuilder = new StringBuilder("\n"); for (int i=0; i<depth; i++) { stringBuilder.append("\t"); } stringBuilder.append("EqualExpression (" + this.value + ")"); return stringBuilder.toString(); } }
[ "hamersaw@bushpath.com" ]
hamersaw@bushpath.com
cc12d762abec46d36813337e65a1c15444a6822a
6daed1f92432ec9a359cffd6ce8022acfddbaa11
/InterviewQuestions/src/my/interview/questions/SieveOfEratosthenes.java
bb16070a9d56e41fa084dc78af04d7d5169d313e
[]
no_license
mayankjoshi/ProjectBrainiac
d6e8c956fecfe4bc300324c1881361a0b814c56b
8daa92681da58e87c2bc42ee2cabfdbe8913e3aa
refs/heads/master
2021-01-02T22:50:16.274933
2020-04-30T04:27:07
2020-04-30T04:27:07
6,058,804
0
0
null
null
null
null
UTF-8
Java
false
false
517
java
package my.interview.questions; public class SieveOfEratosthenes { public static void main(String[] args) { int n = 1000000; boolean[] isPrime = new boolean[n + 1]; for (int i = 0; i < isPrime.length; i++) { isPrime[i] = true; } for (int i = 2; i * i <= n; i++) { if (isPrime[i]) { for (int j = i; i * j <= n; j++) { isPrime[i * j] = false; } } } for (int i = 2; i < isPrime.length; i++) { if (isPrime[i]) { System.out.println(i); } } } }
[ "mayank@192.168.0.4" ]
mayank@192.168.0.4
bce8ba26865648b93e5b50b7764f37fc6122fe69
61b8075d28f2936f6468bb74200381ccdae9bc2b
/src-scenario/scenario/examples/sclaim_tatami2/simpleScenarioA/package-info.java
556b26809fe3981e6d913be922ae9e828e13e4d7
[]
no_license
yonutix/ttm-raspbian
6ed2428db31d7b119b1f9fa5a1c2cc8525d73f9f
111513bb37883515b0616fad22dd365d2429a9ff
refs/heads/master
2021-01-20T19:13:14.147295
2016-06-28T06:18:05
2016-06-28T06:18:05
59,979,305
0
0
null
null
null
null
UTF-8
Java
false
false
470
java
/** * */ /** * 2 containers (non-main), each with on agent. Agent A initially sends a message to agent B, agent B replies back. On * receiving the reply, agent A performs some operations on the knowledge base. * <p> * Features tested: * <ul> * <li>message-activated reactive behaviors * <li>send and receive * <li>knowledge base * <li>the print primitive * </ul> * * @author Andrei Olaru * */ package scenario.examples.sclaim_tatami2.simpleScenarioA;
[ "yonutix@yahoo.com" ]
yonutix@yahoo.com
0810950132cbdc08d4f1f81c0efe6dacfbe9374a
7fc4834429fc2e1fe5d1387ee7cccf81270d23d0
/HvtApp/app/build/generated/ap_generated_sources/debug/out/application/haveri/tourism/di/module/AppModule_ProvidePreferenceNameFactory.java
543f62b71a129a8ec407eab0f7b8532216ee7b20
[]
no_license
satishru/satishru-Haveri-App-Latest-2020
bef50ff1ffa5740e7f537d63a620c242fb3fe980
278d01c28ef2354bfe1e7db4b145a1dbc7641f80
refs/heads/master
2022-11-13T15:58:01.861327
2020-07-01T05:43:05
2020-07-01T05:43:05
275,434,792
0
0
null
null
null
null
UTF-8
Java
false
false
963
java
// Generated by Dagger (https://google.github.io/dagger). package application.haveri.tourism.di.module; import dagger.internal.Factory; import dagger.internal.Preconditions; public final class AppModule_ProvidePreferenceNameFactory implements Factory<String> { private final AppModule module; public AppModule_ProvidePreferenceNameFactory(AppModule module) { this.module = module; } @Override public String get() { return provideInstance(module); } public static String provideInstance(AppModule module) { return proxyProvidePreferenceName(module); } public static AppModule_ProvidePreferenceNameFactory create(AppModule module) { return new AppModule_ProvidePreferenceNameFactory(module); } public static String proxyProvidePreferenceName(AppModule instance) { return Preconditions.checkNotNull( instance.providePreferenceName(), "Cannot return null from a non-@Nullable @Provides method"); } }
[ "ujjammanavar.satish@gmail.com" ]
ujjammanavar.satish@gmail.com
31dd904b0be9f39e6c0e074c70cf45b39950f8fe
bcbda1f37ee3033cfa1b17284b1b291fae4be927
/src/presentacion/action/Tipo_UsuarioAction.java
5c98d9d041a5253916cdd60e6e2925f5c77cd294
[]
no_license
jvasquez2/MyPet
4bd1bb30a55b774d96e7bac2affdcaa77a9ef382
26ea88f12eba269ef008a6095085d586217b5432
refs/heads/master
2020-08-05T03:41:44.200361
2014-08-10T14:24:05
2014-08-10T14:24:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
136
java
package presentacion.action; import com.opensymphony.xwork2.ActionSupport; public class Tipo_UsuarioAction extends ActionSupport { }
[ "jvaldivieso89@gmail.com" ]
jvaldivieso89@gmail.com
a4b1e2deca860aafce0c3731e36f2d2ca833e5b8
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/2/2_3baa03c12db033df5cb00220362f20dc2d403a8b/UserRatingsHandler/2_3baa03c12db033df5cb00220362f20dc2d403a8b_UserRatingsHandler_s.java
e211142fa1d11ba98032be91fd59874d3aa44761
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
2,869
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package org.m4us.handlers; import java.sql.Timestamp; import java.util.ArrayList; import java.util.List; import org.group.utils.qo.UserProfileUpdate; import org.m4us.controller.FlowContext; import org.m4us.movielens.utils.dto.*; import org.m4us.workers.UserRatingsWorker; /** * * @author arka */ public class UserRatingsHandler implements IHandler{ @Override public void handleRequest(FlowContext flowCtx) { List<DataTransferObject>updateList=new ArrayList<DataTransferObject>(); List<DataTransferObject>insertList=new ArrayList<DataTransferObject>(); UserInfoTableObject userInfo = (UserInfoTableObject)flowCtx.get("userInfo"); List<DataTransferObject> similarMoviesList = (List<DataTransferObject>)flowCtx.get("similarMoviesList"); for(DataTransferObject object : similarMoviesList){ { MoviesRatingsComposite movieObj = (MoviesRatingsComposite)object; MoviesTableObject mtObject = movieObj.getMovieObj(); RatingsTableObject rtObject = movieObj.getRatingsObj(); float newRating=Float.parseFloat((String)flowCtx.get("movieId")+mtObject.getMovieId()); if(newRating>0) { if(rtObject.getRating()==0) { RatingsTableObject newRatingObject=new RatingsTableObject(); newRatingObject.setMovieId(mtObject.getMovieId()); newRatingObject.setRating(newRating); newRatingObject.setUserId(userInfo.getUserId()); newRatingObject.setRatingDate(new Timestamp(System.currentTimeMillis())); insertList.add(newRatingObject); } else if(rtObject.getRating() != newRating) { RatingsTableObject newRatingObject=new RatingsTableObject(); newRatingObject.setMovieId(mtObject.getMovieId()); newRatingObject.setRating(newRating); newRatingObject.setUserId(userInfo.getUserId()); newRatingObject.setRatingDate(new Timestamp(System.currentTimeMillis())); updateList.add(newRatingObject); } } } UserRatingsWorker userRatingsWorker=new UserRatingsWorker(); userRatingsWorker.insertUserRatings(insertList); userRatingsWorker.updateUserRatings(updateList); UserProfileUpdate upu=new UserProfileUpdate(); upu.updateProfile(insertList); flowCtx.remove("similarMoviesList"); } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
275f9443c7f12bcd8e76d56746d64953ae5bb077
f187b8eb37ece3348f565ec38fa7386caa946e36
/src/day9/Test2.java
5172fe1744efff348b23551c734edaceda9d0cd7
[]
no_license
ChikaraGaston/JAVASE-CORE
c3e97bd53db230a2a601c9a3cb475a6c40b25409
98cf3d89d0bcc81abe8256b7795877d9b7939958
refs/heads/master
2020-12-29T07:16:09.766817
2020-03-10T03:45:07
2020-03-10T03:45:07
238,508,106
1
0
null
null
null
null
UTF-8
Java
false
false
6,348
java
package day9; public class Test2 { public static void main(String[] args) { //定义账户对象 Acount a=new Acount(); Acount a1=new Acount(); //多线程对象 User u_wechat=new User(a,2000); User u_alipay=new User(a1,2000); Thread wechat=new Thread(u_alipay,"微信"); Thread alipay=new Thread(u_alipay,"支付宝"); wechat.start(); alipay.start(); } } class Acount{ public static int money=3000; /** * 提款方法,判读账户的钱够不够 * 线程共享资源,一个线程执行这个方法没有完毕,另一个线程又开始执行该方法 * 解决方法 * 一个线程整体执行完毕,另一个线程再执行 * 通过synchronized()同步锁来完成,锁的是整个对象,而不是方法,不同的对象,就是不同的锁 * 可以直接在方法上加上关键字synchronized * @param m */ public synchronized void drawing(int m){ String name=Thread.currentThread().getName(); if (money<m){ System.out.println(name+"操作,账户余额不足:"+money); }else { System.out.println(name+"操作,账户原有金额:"+money); System.out.println(name+"操作,取款金额:"+m); System.out.println(name+"操作,取款操作:原金额"+money+"-"+"取款金额"+m); money=money-m; System.out.println(name+"操作,取款后余额:"+money); } } public synchronized void drawing1(int m){ String name=Thread.currentThread().getName(); if (money<m){ System.out.println(name+"操作,账户余额不足:"+money); }else { System.out.println(name+"操作,账户原有金额:"+money); System.out.println(name+"操作,取款金额:"+m); System.out.println(name+"操作,取款操作:原金额"+money+"-"+"取款金额"+m); money=money-m; System.out.println(name+"操作,取款后余额:"+money); } } /** * 静态的方法加关键字,对所有的对象都是同一个锁 * @param m */ public static synchronized void drawing2(int m){ String name=Thread.currentThread().getName(); if (money<m){ System.out.println(name+"操作,账户余额不足:"+money); }else { System.out.println(name+"操作,账户原有金额:"+money); System.out.println(name+"操作,取款金额:"+m); System.out.println(name+"操作,取款操作:原金额"+money+"-"+"取款金额"+m); money=money-m; System.out.println(name+"操作,取款后余额:"+money); } } public void drawing3(int m){ //用this锁代码块代表当前的对象,如果在其他方法中也有synchronized的代码块使用飞都是同一个同步锁 synchronized(this){ String name=Thread.currentThread().getName(); if (money<m){ System.out.println(name+"操作,账户余额不足:"+money); }else { System.out.println(name+"操作,账户原有金额:"+money); System.out.println(name+"操作,取款金额:"+m); System.out.println(name+"操作,取款操作:原金额"+money+"-"+"取款金额"+m); money=money-m; System.out.println(name+"操作,取款后余额:"+money); } } } public void drawing4(int m){ //用this锁代码块代表当前的对象,如果在其他方法中也有synchronized的代码块使用飞都是同一个同步锁 synchronized(this){ String name=Thread.currentThread().getName(); if (money<m){ System.out.println(name+"操作,账户余额不足:"+money); }else { System.out.println(name+"操作,账户原有金额:"+money); System.out.println(name+"操作,取款金额:"+m); System.out.println(name+"操作,取款操作:原金额"+money+"-"+"取款金额"+m); money=money-m; System.out.println(name+"操作,取款后余额:"+money); } } } public void drawing5(int money,Acount acount){ //用this锁代码块代表当前的对象,如果在其他方法中也有synchronized的代码块使用飞都是同一个同步锁 synchronized(acount){ String name=Thread.currentThread().getName(); //需求:如果是微信操作,先不执行,等支付宝操作完,微信再继续操作 if (name.equals("微信")){ try { acount.wait();//当前的线程进入等待状态 } catch (InterruptedException e) { e.printStackTrace(); } } if (this.money<money){ System.out.println(name+"操作,账户余额不足:"+this.money); }else { System.out.println(name+"操作,账户原有金额:"+this.money); System.out.println(name+"操作,取款金额:"+money); System.out.println(name+"操作,取款操作:原金额"+this.money+"-"+"取款金额"+money); this.money=this.money-money; System.out.println(name+"操作,取款后余额:"+this.money); } if (name.equals("支付宝")){ try{ acount.notify();//唤醒当前优先级最高的线程,进入就绪状态 } catch (Exception e){ e.printStackTrace(); } } } } } class User implements Runnable{ Acount acount; int money; public User(Acount acount,int money){ this.acount=acount; this.money=money; } @Override public void run() { // if (Thread.currentThread().getName().equals("微信")){ // acount.drawing3(money); // }else { // acount.drawing4(money); // } // acount.drawing3(money); acount.drawing5(money,acount); } }
[ "452539786@qq.com" ]
452539786@qq.com
7c011a895632d3f53af8bffb7df65346cbe76f63
057ae1b3138f72e52a02a57423b9b03ec23dfa1e
/src/main/java/at/medunigraz/pathology/bibbox/datatools/jooq/prostate_google/tables/records/CasedataprostateRecord.java
5e65cff88078075d55ba4678a2f9d408ff7e8f5d
[]
no_license
reihsr/analysistools
0b2642f5cb6d04ac7013b1baa0219b7a64cc49fd
c9c319d57502b692c3754dd88b3460e864b1b675
refs/heads/master
2022-10-01T13:47:04.241574
2020-10-30T15:34:20
2020-10-30T15:34:20
202,162,532
0
0
null
2022-09-22T19:15:05
2019-08-13T14:31:39
Java
UTF-8
Java
false
true
26,504
java
/* * This file is generated by jOOQ. */ package at.medunigraz.pathology.bibbox.datatools.jooq.prostate_google.tables.records; import at.medunigraz.pathology.bibbox.datatools.jooq.prostate_google.tables.Casedataprostate; import java.sql.Date; import javax.annotation.Generated; import org.jooq.impl.TableRecordImpl; /** * This class is generated by jOOQ. */ @Generated( value = { "http://www.jooq.org", "jOOQ version:3.11.11" }, comments = "This class is generated by jOOQ" ) @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class CasedataprostateRecord extends TableRecordImpl<CasedataprostateRecord> { private static final long serialVersionUID = 537003125; /** * Setter for <code>prostate_google.casedataprostate.vhistonumberid_fk</code>. */ public void setVhistonumberidFk(Long value) { set(0, value); } /** * Getter for <code>prostate_google.casedataprostate.vhistonumberid_fk</code>. */ public Long getVhistonumberidFk() { return (Long) get(0); } /** * Setter for <code>prostate_google.casedataprostate.projectid_fk</code>. */ public void setProjectidFk(Integer value) { set(1, value); } /** * Getter for <code>prostate_google.casedataprostate.projectid_fk</code>. */ public Integer getProjectidFk() { return (Integer) get(1); } /** * Setter for <code>prostate_google.casedataprostate.caseid</code>. */ public void setCaseid(String value) { set(2, value); } /** * Getter for <code>prostate_google.casedataprostate.caseid</code>. */ public String getCaseid() { return (String) get(2); } /** * Setter for <code>prostate_google.casedataprostate.vhistonumberid</code>. */ public void setVhistonumberid(Long value) { set(3, value); } /** * Getter for <code>prostate_google.casedataprostate.vhistonumberid</code>. */ public Long getVhistonumberid() { return (Long) get(3); } /** * Setter for <code>prostate_google.casedataprostate.vpatientid_fk</code>. */ public void setVpatientidFk(Long value) { set(4, value); } /** * Getter for <code>prostate_google.casedataprostate.vpatientid_fk</code>. */ public Long getVpatientidFk() { return (Long) get(4); } /** * Setter for <code>prostate_google.casedataprostate.age</code>. */ public void setAge(Short value) { set(5, value); } /** * Getter for <code>prostate_google.casedataprostate.age</code>. */ public Short getAge() { return (Short) get(5); } /** * Setter for <code>prostate_google.casedataprostate.examinationtype</code>. */ public void setExaminationtype(String value) { set(6, value); } /** * Getter for <code>prostate_google.casedataprostate.examinationtype</code>. */ public String getExaminationtype() { return (String) get(6); } /** * Setter for <code>prostate_google.casedataprostate.examinationdate</code>. */ public void setExaminationdate(String value) { set(7, value); } /** * Getter for <code>prostate_google.casedataprostate.examinationdate</code>. */ public String getExaminationdate() { return (String) get(7); } /** * Setter for <code>prostate_google.casedataprostate.diagnosis</code>. */ public void setDiagnosis(String value) { set(8, value); } /** * Getter for <code>prostate_google.casedataprostate.diagnosis</code>. */ public String getDiagnosis() { return (String) get(8); } /** * Setter for <code>prostate_google.casedataprostate.organ</code>. */ public void setOrgan(String value) { set(9, value); } /** * Getter for <code>prostate_google.casedataprostate.organ</code>. */ public String getOrgan() { return (String) get(9); } /** * Setter for <code>prostate_google.casedataprostate.organzusatz</code>. */ public void setOrganzusatz(String value) { set(10, value); } /** * Getter for <code>prostate_google.casedataprostate.organzusatz</code>. */ public String getOrganzusatz() { return (String) get(10); } /** * Setter for <code>prostate_google.casedataprostate.t</code>. */ public void setT(String value) { set(11, value); } /** * Getter for <code>prostate_google.casedataprostate.t</code>. */ public String getT() { return (String) get(11); } /** * Setter for <code>prostate_google.casedataprostate.n</code>. */ public void setN(String value) { set(12, value); } /** * Getter for <code>prostate_google.casedataprostate.n</code>. */ public String getN() { return (String) get(12); } /** * Setter for <code>prostate_google.casedataprostate.m</code>. */ public void setM(String value) { set(13, value); } /** * Getter for <code>prostate_google.casedataprostate.m</code>. */ public String getM() { return (String) get(13); } /** * Setter for <code>prostate_google.casedataprostate.g</code>. */ public void setG(String value) { set(14, value); } /** * Getter for <code>prostate_google.casedataprostate.g</code>. */ public String getG() { return (String) get(14); } /** * Setter for <code>prostate_google.casedataprostate.r</code>. */ public void setR(String value) { set(15, value); } /** * Getter for <code>prostate_google.casedataprostate.r</code>. */ public String getR() { return (String) get(15); } /** * Setter for <code>prostate_google.casedataprostate.l</code>. */ public void setL(String value) { set(16, value); } /** * Getter for <code>prostate_google.casedataprostate.l</code>. */ public String getL() { return (String) get(16); } /** * Setter for <code>prostate_google.casedataprostate.v</code>. */ public void setV(String value) { set(17, value); } /** * Getter for <code>prostate_google.casedataprostate.v</code>. */ public String getV() { return (String) get(17); } /** * Setter for <code>prostate_google.casedataprostate.caselfdnr</code>. */ public void setCaselfdnr(String value) { set(18, value); } /** * Getter for <code>prostate_google.casedataprostate.caselfdnr</code>. */ public String getCaselfdnr() { return (String) get(18); } /** * Setter for <code>prostate_google.casedataprostate.dukes</code>. */ public void setDukes(String value) { set(19, value); } /** * Getter for <code>prostate_google.casedataprostate.dukes</code>. */ public String getDukes() { return (String) get(19); } /** * Setter for <code>prostate_google.casedataprostate.stageing</code>. */ public void setStageing(String value) { set(20, value); } /** * Getter for <code>prostate_google.casedataprostate.stageing</code>. */ public String getStageing() { return (String) get(20); } /** * Setter for <code>prostate_google.casedataprostate.stageingreferenzid_fk</code>. */ public void setStageingreferenzidFk(Integer value) { set(21, value); } /** * Getter for <code>prostate_google.casedataprostate.stageingreferenzid_fk</code>. */ public Integer getStageingreferenzidFk() { return (Integer) get(21); } /** * Setter for <code>prostate_google.casedataprostate.estimatednumberofslides</code>. */ public void setEstimatednumberofslides(Integer value) { set(22, value); } /** * Getter for <code>prostate_google.casedataprostate.estimatednumberofslides</code>. */ public Integer getEstimatednumberofslides() { return (Integer) get(22); } /** * Setter for <code>prostate_google.casedataprostate.patientid</code>. */ public void setPatientid(String value) { set(23, value); } /** * Getter for <code>prostate_google.casedataprostate.patientid</code>. */ public String getPatientid() { return (String) get(23); } /** * Setter for <code>prostate_google.casedataprostate.vpatientid</code>. */ public void setVpatientid(Long value) { set(24, value); } /** * Getter for <code>prostate_google.casedataprostate.vpatientid</code>. */ public Long getVpatientid() { return (Long) get(24); } /** * Setter for <code>prostate_google.casedataprostate.dateofbirth</code>. */ public void setDateofbirth(String value) { set(25, value); } /** * Getter for <code>prostate_google.casedataprostate.dateofbirth</code>. */ public String getDateofbirth() { return (String) get(25); } /** * Setter for <code>prostate_google.casedataprostate.dateofdeath</code>. */ public void setDateofdeath(String value) { set(26, value); } /** * Getter for <code>prostate_google.casedataprostate.dateofdeath</code>. */ public String getDateofdeath() { return (String) get(26); } /** * Setter for <code>prostate_google.casedataprostate.icdn</code>. */ public void setIcdn(String value) { set(27, value); } /** * Getter for <code>prostate_google.casedataprostate.icdn</code>. */ public String getIcdn() { return (String) get(27); } /** * Setter for <code>prostate_google.casedataprostate.icde</code>. */ public void setIcde(String value) { set(28, value); } /** * Getter for <code>prostate_google.casedataprostate.icde</code>. */ public String getIcde() { return (String) get(28); } /** * Setter for <code>prostate_google.casedataprostate.gender</code>. */ public void setGender(String value) { set(29, value); } /** * Getter for <code>prostate_google.casedataprostate.gender</code>. */ public String getGender() { return (String) get(29); } /** * Setter for <code>prostate_google.casedataprostate.survivalindays</code>. */ public void setSurvivalindays(Integer value) { set(30, value); } /** * Getter for <code>prostate_google.casedataprostate.survivalindays</code>. */ public Integer getSurvivalindays() { return (Integer) get(30); } /** * Setter for <code>prostate_google.casedataprostate.survivalstatus</code>. */ public void setSurvivalstatus(String value) { set(31, value); } /** * Getter for <code>prostate_google.casedataprostate.survivalstatus</code>. */ public String getSurvivalstatus() { return (String) get(31); } /** * Setter for <code>prostate_google.casedataprostate.cutofday</code>. */ public void setCutofday(String value) { set(32, value); } /** * Getter for <code>prostate_google.casedataprostate.cutofday</code>. */ public String getCutofday() { return (String) get(32); } /** * Setter for <code>prostate_google.casedataprostate.dateoffirstdiagnosis</code>. */ public void setDateoffirstdiagnosis(String value) { set(33, value); } /** * Getter for <code>prostate_google.casedataprostate.dateoffirstdiagnosis</code>. */ public String getDateoffirstdiagnosis() { return (String) get(33); } /** * Setter for <code>prostate_google.casedataprostate.ageatcutof</code>. */ public void setAgeatcutof(Short value) { set(34, value); } /** * Getter for <code>prostate_google.casedataprostate.ageatcutof</code>. */ public Short getAgeatcutof() { return (Short) get(34); } /** * Setter for <code>prostate_google.casedataprostate.id</code>. */ public void setId(Integer value) { set(35, value); } /** * Getter for <code>prostate_google.casedataprostate.id</code>. */ public Integer getId() { return (Integer) get(35); } /** * Setter for <code>prostate_google.casedataprostate.eingangsdatum</code>. */ public void setEingangsdatum(Date value) { set(36, value); } /** * Getter for <code>prostate_google.casedataprostate.eingangsdatum</code>. */ public Date getEingangsdatum() { return (Date) get(36); } /** * Setter for <code>prostate_google.casedataprostate.alterpat</code>. */ public void setAlterpat(Integer value) { set(37, value); } /** * Getter for <code>prostate_google.casedataprostate.alterpat</code>. */ public Integer getAlterpat() { return (Integer) get(37); } /** * Setter for <code>prostate_google.casedataprostate.einsender</code>. */ public void setEinsender(String value) { set(38, value); } /** * Getter for <code>prostate_google.casedataprostate.einsender</code>. */ public String getEinsender() { return (String) get(38); } /** * Setter for <code>prostate_google.casedataprostate.gewinnungsart</code>. */ public void setGewinnungsart(String value) { set(39, value); } /** * Getter for <code>prostate_google.casedataprostate.gewinnungsart</code>. */ public String getGewinnungsart() { return (String) get(39); } /** * Setter for <code>prostate_google.casedataprostate.material</code>. */ public void setMaterial(String value) { set(40, value); } /** * Getter for <code>prostate_google.casedataprostate.material</code>. */ public String getMaterial() { return (String) get(40); } /** * Setter for <code>prostate_google.casedataprostate.materialzusatz</code>. */ public void setMaterialzusatz(String value) { set(41, value); } /** * Getter for <code>prostate_google.casedataprostate.materialzusatz</code>. */ public String getMaterialzusatz() { return (String) get(41); } /** * Setter for <code>prostate_google.casedataprostate.makroskopischebeschreibung</code>. */ public void setMakroskopischebeschreibung(String value) { set(42, value); } /** * Getter for <code>prostate_google.casedataprostate.makroskopischebeschreibung</code>. */ public String getMakroskopischebeschreibung() { return (String) get(42); } /** * Setter for <code>prostate_google.casedataprostate.histologischebeschreibung</code>. */ public void setHistologischebeschreibung(String value) { set(43, value); } /** * Getter for <code>prostate_google.casedataprostate.histologischebeschreibung</code>. */ public String getHistologischebeschreibung() { return (String) get(43); } /** * Setter for <code>prostate_google.casedataprostate.mikroskopischebeschreibung</code>. */ public void setMikroskopischebeschreibung(String value) { set(44, value); } /** * Getter for <code>prostate_google.casedataprostate.mikroskopischebeschreibung</code>. */ public String getMikroskopischebeschreibung() { return (String) get(44); } /** * Setter for <code>prostate_google.casedataprostate.mpbeschreibung</code>. */ public void setMpbeschreibung(String value) { set(45, value); } /** * Getter for <code>prostate_google.casedataprostate.mpbeschreibung</code>. */ public String getMpbeschreibung() { return (String) get(45); } /** * Setter for <code>prostate_google.casedataprostate.schnellschnittdiagnose</code>. */ public void setSchnellschnittdiagnose(String value) { set(46, value); } /** * Getter for <code>prostate_google.casedataprostate.schnellschnittdiagnose</code>. */ public String getSchnellschnittdiagnose() { return (String) get(46); } /** * Setter for <code>prostate_google.casedataprostate.mpdiagnose</code>. */ public void setMpdiagnose(String value) { set(47, value); } /** * Getter for <code>prostate_google.casedataprostate.mpdiagnose</code>. */ public String getMpdiagnose() { return (String) get(47); } /** * Setter for <code>prostate_google.casedataprostate.diagnose</code>. */ public void setDiagnose(String value) { set(48, value); } /** * Getter for <code>prostate_google.casedataprostate.diagnose</code>. */ public String getDiagnose() { return (String) get(48); } /** * Setter for <code>prostate_google.casedataprostate.dgcode1</code>. */ public void setDgcode1(String value) { set(49, value); } /** * Getter for <code>prostate_google.casedataprostate.dgcode1</code>. */ public String getDgcode1() { return (String) get(49); } /** * Setter for <code>prostate_google.casedataprostate.dgcode2</code>. */ public void setDgcode2(String value) { set(50, value); } /** * Getter for <code>prostate_google.casedataprostate.dgcode2</code>. */ public String getDgcode2() { return (String) get(50); } /** * Setter for <code>prostate_google.casedataprostate.kommentar</code>. */ public void setKommentar(String value) { set(51, value); } /** * Getter for <code>prostate_google.casedataprostate.kommentar</code>. */ public String getKommentar() { return (String) get(51); } /** * Setter for <code>prostate_google.casedataprostate.befunder1</code>. */ public void setBefunder1(String value) { set(52, value); } /** * Getter for <code>prostate_google.casedataprostate.befunder1</code>. */ public String getBefunder1() { return (String) get(52); } /** * Setter for <code>prostate_google.casedataprostate.befunder2</code>. */ public void setBefunder2(String value) { set(53, value); } /** * Getter for <code>prostate_google.casedataprostate.befunder2</code>. */ public String getBefunder2() { return (String) get(53); } /** * Setter for <code>prostate_google.casedataprostate.vidit1</code>. */ public void setVidit1(String value) { set(54, value); } /** * Getter for <code>prostate_google.casedataprostate.vidit1</code>. */ public String getVidit1() { return (String) get(54); } /** * Setter for <code>prostate_google.casedataprostate.vidit2</code>. */ public void setVidit2(String value) { set(55, value); } /** * Getter for <code>prostate_google.casedataprostate.vidit2</code>. */ public String getVidit2() { return (String) get(55); } /** * Setter for <code>prostate_google.casedataprostate.befundstatus</code>. */ public void setBefundstatus(String value) { set(56, value); } /** * Getter for <code>prostate_google.casedataprostate.befundstatus</code>. */ public String getBefundstatus() { return (String) get(56); } /** * Setter for <code>prostate_google.casedataprostate.abschlussdatum</code>. */ public void setAbschlussdatum(String value) { set(57, value); } /** * Getter for <code>prostate_google.casedataprostate.abschlussdatum</code>. */ public String getAbschlussdatum() { return (String) get(57); } /** * Setter for <code>prostate_google.casedataprostate.vpatid</code>. */ public void setVpatid(String value) { set(58, value); } /** * Getter for <code>prostate_google.casedataprostate.vpatid</code>. */ public String getVpatid() { return (String) get(58); } /** * Setter for <code>prostate_google.casedataprostate.vhistid</code>. */ public void setVhistid(String value) { set(59, value); } /** * Getter for <code>prostate_google.casedataprostate.vhistid</code>. */ public String getVhistid() { return (String) get(59); } /** * Setter for <code>prostate_google.casedataprostate.befundlfdnr</code>. */ public void setBefundlfdnr(String value) { set(60, value); } /** * Getter for <code>prostate_google.casedataprostate.befundlfdnr</code>. */ public String getBefundlfdnr() { return (String) get(60); } /** * Setter for <code>prostate_google.casedataprostate.anzbl1</code>. */ public void setAnzbl1(String value) { set(61, value); } /** * Getter for <code>prostate_google.casedataprostate.anzbl1</code>. */ public String getAnzbl1() { return (String) get(61); } /** * Setter for <code>prostate_google.casedataprostate.anzot</code>. */ public void setAnzot(String value) { set(62, value); } /** * Getter for <code>prostate_google.casedataprostate.anzot</code>. */ public String getAnzot() { return (String) get(62); } /** * Setter for <code>prostate_google.casedataprostate.file</code>. */ public void setFile(String value) { set(63, value); } /** * Getter for <code>prostate_google.casedataprostate.file</code>. */ public String getFile() { return (String) get(63); } /** * Setter for <code>prostate_google.casedataprostate.vpatid1_ext</code>. */ public void setVpatid1Ext(Long value) { set(64, value); } /** * Getter for <code>prostate_google.casedataprostate.vpatid1_ext</code>. */ public Long getVpatid1Ext() { return (Long) get(64); } /** * Setter for <code>prostate_google.casedataprostate.vhistid1_ext</code>. */ public void setVhistid1Ext(Long value) { set(65, value); } /** * Getter for <code>prostate_google.casedataprostate.vhistid1_ext</code>. */ public Long getVhistid1Ext() { return (Long) get(65); } // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- /** * Create a detached CasedataprostateRecord */ public CasedataprostateRecord() { super(Casedataprostate.CASEDATAPROSTATE); } /** * Create a detached, initialised CasedataprostateRecord */ public CasedataprostateRecord(Long vhistonumberidFk, Integer projectidFk, String caseid, Long vhistonumberid, Long vpatientidFk, Short age, String examinationtype, String examinationdate, String diagnosis, String organ, String organzusatz, String t, String n, String m, String g, String r, String l, String v, String caselfdnr, String dukes, String stageing, Integer stageingreferenzidFk, Integer estimatednumberofslides, String patientid, Long vpatientid, String dateofbirth, String dateofdeath, String icdn, String icde, String gender, Integer survivalindays, String survivalstatus, String cutofday, String dateoffirstdiagnosis, Short ageatcutof, Integer id, Date eingangsdatum, Integer alterpat, String einsender, String gewinnungsart, String material, String materialzusatz, String makroskopischebeschreibung, String histologischebeschreibung, String mikroskopischebeschreibung, String mpbeschreibung, String schnellschnittdiagnose, String mpdiagnose, String diagnose, String dgcode1, String dgcode2, String kommentar, String befunder1, String befunder2, String vidit1, String vidit2, String befundstatus, String abschlussdatum, String vpatid, String vhistid, String befundlfdnr, String anzbl1, String anzot, String file, Long vpatid1Ext, Long vhistid1Ext) { super(Casedataprostate.CASEDATAPROSTATE); set(0, vhistonumberidFk); set(1, projectidFk); set(2, caseid); set(3, vhistonumberid); set(4, vpatientidFk); set(5, age); set(6, examinationtype); set(7, examinationdate); set(8, diagnosis); set(9, organ); set(10, organzusatz); set(11, t); set(12, n); set(13, m); set(14, g); set(15, r); set(16, l); set(17, v); set(18, caselfdnr); set(19, dukes); set(20, stageing); set(21, stageingreferenzidFk); set(22, estimatednumberofslides); set(23, patientid); set(24, vpatientid); set(25, dateofbirth); set(26, dateofdeath); set(27, icdn); set(28, icde); set(29, gender); set(30, survivalindays); set(31, survivalstatus); set(32, cutofday); set(33, dateoffirstdiagnosis); set(34, ageatcutof); set(35, id); set(36, eingangsdatum); set(37, alterpat); set(38, einsender); set(39, gewinnungsart); set(40, material); set(41, materialzusatz); set(42, makroskopischebeschreibung); set(43, histologischebeschreibung); set(44, mikroskopischebeschreibung); set(45, mpbeschreibung); set(46, schnellschnittdiagnose); set(47, mpdiagnose); set(48, diagnose); set(49, dgcode1); set(50, dgcode2); set(51, kommentar); set(52, befunder1); set(53, befunder2); set(54, vidit1); set(55, vidit2); set(56, befundstatus); set(57, abschlussdatum); set(58, vpatid); set(59, vhistid); set(60, befundlfdnr); set(61, anzbl1); set(62, anzot); set(63, file); set(64, vpatid1Ext); set(65, vhistid1Ext); } }
[ "robert.reihs@medunigraz.at" ]
robert.reihs@medunigraz.at
44ba56af93b71c06b718f2dc526a4830d2bdef3c
e64fc6840ce2dec56ede54a6608b982515b7ef25
/src/main/java/com/webberis/vet/service/impl/BreedServiceImpl.java
4e088718a4e31354b87aea956125c9557d6d1ce1
[]
no_license
alvgarvilla/wevet
e58759f0b0216506d7e31195e1e42a5b56567085
02102723ccd7be9cce7f5d6d37bebcc3a8a4ddf0
refs/heads/master
2020-12-24T15:32:01.437365
2015-08-14T08:24:52
2015-08-14T08:24:52
40,703,968
0
0
null
null
null
null
UTF-8
Java
false
false
2,036
java
package com.webberis.vet.service.impl; import java.util.List; import org.apache.log4j.Logger; import org.hibernate.HibernateException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.webberis.vet.beans.Breed; import com.webberis.vet.dao.GenericDAO; import com.webberis.vet.service.GenericService; @Service("breedService") @Transactional() public class BreedServiceImpl implements GenericService<Breed>{ private static final Logger logger = Logger.getLogger(BreedServiceImpl.class); @Autowired GenericDAO<Breed> breedDao; public int save(Breed element) { logger.info("Saving a Breed element"); try { Breed breed = breedDao.save(element); return breed.getId(); } catch (HibernateException e) { logger.error("There was an error while saving an Breed element", e); throw e; } } public void update(Breed element) { logger.info("Updating a Breed element"); try { breedDao.update(element); } catch (HibernateException e) { logger.error("There was an error while updating a Breed element", e); throw e; } } public void delete(Breed element) { logger.info("Deleting a Breed element"); try { breedDao.delete(element); } catch (HibernateException e) { logger.error("There was an error while deleting a Breed element", e); throw e; } } public List<Breed> getAll() { logger.info("Getting all Breed elements"); try { return breedDao.getAll(Breed.class); } catch (HibernateException e) { logger.error("There was an error while getting all Breed elements", e); throw e; } } public Breed get(int id) { logger.info("Getting Breed element"); try { return breedDao.get(Breed.class, id); } catch (HibernateException e) { logger.error("There was an error while getting a Breed element", e); throw e; } } }
[ "Alvaro@Alvaro-PC" ]
Alvaro@Alvaro-PC
30f4f8b5fcd3a2e0e3df5e3e4b6513f4d42f42d8
f9e465251fe219399e2505889b73cc38e29dcf31
/src/main/java/com/ias/admin/system/shiro/AdminRealm.java
018cd3990268bc5fca6dc6a6c0f6af3ab1c9d6ba
[]
no_license
duddddu/ias
afc3c11ba6fd0e7a37873d74a78b75ba8a2447f0
c9219ff722cff79883cff20045f588a60a5db0e9
refs/heads/master
2020-03-09T17:34:36.357782
2018-04-10T12:02:43
2018-04-10T12:03:33
128,911,816
0
0
null
null
null
null
UTF-8
Java
false
false
3,039
java
package com.ias.admin.system.shiro; import com.ias.admin.common.config.ApplicaConte; import com.ias.admin.common.util.ShiroUtils; import com.ias.admin.system.mapper.AdminMapper; import com.ias.admin.system.pojo.AdminPO; import com.ias.admin.system.service.MenuService; import org.apache.shiro.authc.*; import org.apache.shiro.authz.AuthorizationInfo; import org.apache.shiro.authz.SimpleAuthorizationInfo; import org.apache.shiro.realm.AuthorizingRealm; import org.apache.shiro.subject.PrincipalCollection; import org.springframework.beans.factory.annotation.Autowired; import java.util.HashMap; import java.util.Map; public class AdminRealm extends AuthorizingRealm { @Autowired AdminMapper adminMapper; @Autowired MenuService menuService; /** * 提供用户信息返回权限信息 */ @Override protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) { /*Integer adminId = ShiroUtils.getAdminId(); Set<String> perms = menuService.listPerms(adminId); SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); info.setStringPermissions(perms); return info;*/ System.out.println("暂无权限控制"); return null; } /* * 提供账户信息返回认证信息 * */ @Override protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException { String username = (String) token.getPrincipal();//主体,就是当前登录的数据实体 Map<String, Object> map = new HashMap<>(); map.put("username", username); String password = new String((char[]) token.getCredentials()); //凭证,用户的密码,具体加密方式用户自己实现,什么都不做就是原文 //Roles:用户拥有的角色标识(角色名称,admin,account,customer_service), // 字符串格式列表:用户拥有多个角色的可能 //Permissions:用户拥有的权限标识(每个权限唯一标识,比如主键或者权限唯一标识编码), // 字符串格式列表:用户拥有多个权限的可能 //查询用户信息 adminMapper = ApplicaConte.getBean(AdminMapper.class); AdminPO adminPO = null; try{ adminPO = adminMapper.list(map).get(0); }catch(IndexOutOfBoundsException e){ System.out.println("查询了管理员账号"); } // 账号不存在 if (adminPO == null) { throw new UnknownAccountException("账号不存在"); } //密码错误 if (!password.equals(adminPO.getPassword())) { throw new UnknownAccountException("密码错误"); } //第一个参数是user对象,第二个是指从数据库中获取的password,第三个参数是当前realm的名称。 SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(adminPO, password, getName()); return info; } }
[ "345912664@qq.com" ]
345912664@qq.com
8a411713bd4cf1a57814994d9d79d52a2f67b0a9
5791c4ee993e94b5e2b67c0d2fd339dff900bd92
/dubbo-demo-service/src/main/java/org/apache/james/mime4j/field/address/AddressList.java
710e369cd787e1db178f8c01498d76cde5ef92f0
[ "MIT" ]
permissive
yjvfhpy/dubbo-rest-example
778d32d08fedbbdb3a775fe9e7b123ebcf17d5dd
c20b9c226226482ccf56c9639286c6b163981f22
refs/heads/master
2020-04-27T06:15:18.475881
2018-08-29T02:41:32
2018-08-29T02:41:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,122
java
/**************************************************************** * Licensed to the Apache Software Foundation (ASF) under one * * or more contributor license agreements. See the NOTICE file * * distributed with this work for additional information * * regarding copyright ownership. The ASF licenses this file * * to you under the Apache License, Version 2.0 (the * * "License"); you may not use this file except in compliance * * with the License. You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, * * software distributed under the License is distributed on an * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * * KIND, either express or implied. See the License for the * * specific language governing permissions and limitations * * under the License. * ****************************************************************/ package org.apache.james.mime4j.field.address; import org.apache.james.mime4j.field.address.parser.AddressListParser; import org.apache.james.mime4j.field.address.parser.ParseException; import java.io.Serializable; import java.io.StringReader; import java.util.AbstractList; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * An immutable, random-access list of Address objects. */ public class AddressList extends AbstractList<Address> implements Serializable { private static final long serialVersionUID = 1L; private final List<? extends Address> addresses; /** * @param addresses * A List that contains only Address objects. * @param dontCopy * true iff it is not possible for the addresses list to be * modified by someone else. */ public AddressList(List<? extends Address> addresses, boolean dontCopy) { if (addresses != null) this.addresses = dontCopy ? addresses : new ArrayList<Address>( addresses); else this.addresses = Collections.emptyList(); } /** * The number of elements in this list. */ @Override public int size() { return addresses.size(); } /** * Gets an address. */ @Override public Address get(int index) { return addresses.get(index); } /** * Returns a flat list of all mailboxes represented in this address list. * Use this if you don't care about grouping. */ public MailboxList flatten() { // in the common case, all addresses are mailboxes boolean groupDetected = false; for (Address addr : addresses) { if (!(addr instanceof Mailbox)) { groupDetected = true; break; } } if (!groupDetected) { @SuppressWarnings("unchecked") final List<Mailbox> mailboxes = (List<Mailbox>) addresses; return new MailboxList(mailboxes, true); } List<Mailbox> results = new ArrayList<Mailbox>(); for (Address addr : addresses) { addr.addMailboxesTo(results); } // copy-on-construct this time, because subclasses // could have held onto a reference to the results return new MailboxList(results, false); } /** * Dumps a representation of this address list to stdout, for debugging * purposes. */ public void print() { for (Address addr : addresses) { System.out.println(addr.toString()); } } /** * Parse the address list string, such as the value of a From, To, Cc, Bcc, * Sender, or Reply-To header. * * The string MUST be unfolded already. */ public static AddressList parse(String rawAddressList) throws ParseException { AddressListParser parser = new AddressListParser(new StringReader( rawAddressList)); return Builder.getInstance().buildAddressList(parser.parseAddressList()); } /** * Test console. */ public static void main(String[] args) throws Exception { java.io.BufferedReader reader = new java.io.BufferedReader( new java.io.InputStreamReader(System.in)); while (true) { try { System.out.print("> "); String line = reader.readLine(); if (line.length() == 0 || line.toLowerCase().equals("exit") || line.toLowerCase().equals("quit")) { System.out.println("Goodbye."); return; } AddressList list = parse(line); list.print(); } catch (Exception e) { e.printStackTrace(); Thread.sleep(300); } } } }
[ "suzy@wjs.com" ]
suzy@wjs.com
2e8821e869dac60a40beb3dbf846dc3a69654870
cd15433d1d0d428155b27a3e4568fc6b14235be0
/SimpleSocket/src/4. EcoDatagrama/Example.java
1beaf1e1a979cbe37e0f7aea91cde415a27f5c41
[]
no_license
tonabarrera/aplicaciones-redes
eb593ffa06d031ac44c3a4e7c81a750b00b8a4e9
252f53a857f3eeabf79521331daff649221acd28
refs/heads/master
2021-08-31T11:04:13.924071
2017-12-21T04:32:44
2017-12-21T04:32:44
100,416,163
5
0
null
null
null
null
UTF-8
Java
false
false
759
java
package datagram; /** * @author tona created on 24/08/2017 for SimpleSocket. */ public class Example { /* * Clase DatagramPacket * * Constructores: * Para recibir * DatagramPacket(byte[] b, int t) * Para enviar * DatagramPacket(byte []b, int t, InetAddress dst, int pto) * DatagramPacket(byte[] b, int t, SocketAddress dst) * * clase DatagramSocket * * Constructores: * crea y asoca al primer puerto que encuentre * DatagramSocket() * setBroadcast(boolean) // enable a la opcion de broadcast * getInetAddress y getPort() soolo funciona si use el metodo connect(InetAddress, int) * getSoTimeout() & setSoTimeout(int) temporizador para cerrar el socket despues de un tiempo * */ }
[ "carlostonatihu@gmail.com" ]
carlostonatihu@gmail.com
aa559352c971eb8bfa4fbf98047b4ed921bb9c03
519f3178f58af3e8ecc4599a7123ddfc230c57f7
/src/main/java/pl/themolka/arcade/condition/NotCondition.java
6142ead59ee886ed6fed0a116b736c3128d7d73d
[ "Apache-2.0" ]
permissive
ShootGame/Arcade2
8a6985e4e902a78abf8d4fc0222932fa105dda2a
aaf6d6cc229c95a1b12a2a20f48331a9ced9df52
refs/heads/master
2021-07-12T12:51:06.150210
2019-12-21T20:00:07
2019-12-21T20:00:07
77,339,352
7
0
Apache-2.0
2021-04-26T16:52:35
2016-12-25T19:15:43
Java
UTF-8
Java
false
false
1,056
java
/* * Copyright 2018 Aleksander Jagiełło * * 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 pl.themolka.arcade.condition; public class NotCondition<K, V extends InvertableResult<V>> extends SingleCondition<K, V> { public NotCondition(Condition<K, V> condition) { super(condition); } @Override public V query(K k, Condition<K, V> condition) { return condition.query(k).invert(); } @Override public String toString() { return "NOT(" + this.getCondition().toString() + ")"; } }
[ "themolkapl@gmail.com" ]
themolkapl@gmail.com
3b88ae6c17f5aec928ada4b974e7d89c33cd3db6
00ea561f8a5e1b248d2b2af7553e196b88515cd4
/app/src/main/java/com/hzjytech/operation/adapters/home/viewholders/MachiesCountViewHolder.java
a110c16098670ffc8f4a95f0c0808378ad27f565
[]
no_license
ailinghengshui/YW
d7188fd640eeba021b94356f8dfd5e0e2c1579cf
db1eedc2c947cf0d4a18a6efe1fed9e81f2d8c02
refs/heads/master
2021-09-06T03:27:46.533300
2018-02-02T02:15:18
2018-02-02T02:15:18
119,919,280
0
0
null
null
null
null
UTF-8
Java
false
false
6,770
java
package com.hzjytech.operation.adapters.home.viewholders; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.util.TypedValue; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import com.hzjytech.operation.R; import com.hzjytech.operation.constants.Constants; import com.hzjytech.operation.entity.Machies; import com.hzjytech.operation.inter.MachineStateClickListener; import com.hzjytech.operation.utils.DensityUtil; import com.hzjytech.operation.widgets.BadgeView; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; /** * Created by hehongcan on 2017/4/24. */ public class MachiesCountViewHolder extends RecyclerView.ViewHolder { private MachineStateClickListener machineStateChangeLister; @BindView(R.id.item_machines_error) LinearLayout itemMachinesError; @BindView(R.id.item_machines_shortage) LinearLayout itemMachinesShortage; @BindView(R.id.item_machines_offline) LinearLayout itemMachinesOffline; @BindView(R.id.item_machines_lock) LinearLayout itemMachinesLock; @BindView(R.id.item_machines_unoperation) LinearLayout itemMachinesUnoperation; @BindView(R.id.iv_error) ImageView ivError; @BindView(R.id.iv_shortage) ImageView ivShortage; @BindView(R.id.iv_offline) ImageView ivOffline; @BindView(R.id.iv_lock) ImageView ivLock; @BindView(R.id.iv_unoperation) ImageView ivUnoperation; private BadgeView mErrorBadgeView; private BadgeView mLockBadgeView; private BadgeView mOfflineBadgeView; private BadgeView mShortageBadgeView; private BadgeView mUnoperationBadageView; public MachiesCountViewHolder(View machiesCountView, MachineStateClickListener machineStateChangeLister) { super(machiesCountView); ButterKnife.bind(this, machiesCountView); this.machineStateChangeLister = machineStateChangeLister; } public void setViewData(Context mContext, Object item, int position, int viewType) { int x = DensityUtil.dp2px(mContext, -7); int y = DensityUtil.dp2px(mContext, 8); if(mErrorBadgeView==null){ mErrorBadgeView = new BadgeView(mContext, ivError); mErrorBadgeView.setBadgePosition(BadgeView.POSITION_TOP_RIGHT); mErrorBadgeView.setBadgeBackgroundColor(mContext.getResources().getColor(R.color.light_red)); mErrorBadgeView.setTextSize(TypedValue.COMPLEX_UNIT_SP,13); //22SP mErrorBadgeView.setTranslationX(x); mErrorBadgeView.setTranslationY(y); } if(mLockBadgeView==null){ mLockBadgeView = new BadgeView(mContext, ivLock); mLockBadgeView.setBadgePosition(BadgeView.POSITION_TOP_RIGHT); mLockBadgeView.setBadgeBackgroundColor(mContext.getResources().getColor(R.color.heavy_green)); mLockBadgeView.setTextSize(TypedValue.COMPLEX_UNIT_SP,13); mLockBadgeView.setTranslationX(x); mLockBadgeView.setTranslationY(y); } if(mOfflineBadgeView==null){ mOfflineBadgeView = new BadgeView(mContext, ivOffline); mOfflineBadgeView.setBadgePosition(BadgeView.POSITION_TOP_RIGHT); mOfflineBadgeView.setBadgeBackgroundColor(mContext.getResources().getColor(R.color.light_green)); mOfflineBadgeView.setTextSize(TypedValue.COMPLEX_UNIT_SP,13); mOfflineBadgeView.setTranslationX(x); mOfflineBadgeView.setTranslationY(y); } if(mShortageBadgeView==null){ mShortageBadgeView = new BadgeView(mContext, ivShortage); mShortageBadgeView.setBadgePosition(BadgeView.POSITION_TOP_RIGHT); mShortageBadgeView.setBadgeBackgroundColor(mContext.getResources().getColor(R.color.light_orange)); mShortageBadgeView.setTextSize(TypedValue.COMPLEX_UNIT_SP,13); mShortageBadgeView.setTranslationX(x); mShortageBadgeView.setTranslationY(y); } if(mUnoperationBadageView==null){ mUnoperationBadageView = new BadgeView(mContext, ivUnoperation); mUnoperationBadageView.setBadgePosition(BadgeView.POSITION_TOP_RIGHT); mUnoperationBadageView.setBadgeBackgroundColor(mContext.getResources().getColor(R.color.badage_blue)); mUnoperationBadageView.setTextSize(TypedValue.COMPLEX_UNIT_SP,13); mUnoperationBadageView.setTranslationX(x); mUnoperationBadageView.setTranslationY(y); } Machies machies = (Machies) item; int sick = machies.getSick(); if (sick > 0) { mErrorBadgeView.setText(sick + ""); mErrorBadgeView.show(); } else { mErrorBadgeView.hide(); } int locked = machies.getLocked(); if (locked > 0) { mLockBadgeView.setText(locked + ""); mLockBadgeView.show(); } else { mLockBadgeView.hide(); } int offline = machies.getOffline(); if (offline > 0) { mOfflineBadgeView.setText(offline + ""); mOfflineBadgeView.show(); } else { mOfflineBadgeView.hide(); } int lack = machies.getLack(); if (lack > 0) { mShortageBadgeView.setText(lack + ""); mShortageBadgeView.show(); } else { mShortageBadgeView.hide(); } int offOperation = machies.getOffOperation(); if (offOperation > 0) { mUnoperationBadageView.setText(offOperation + ""); mUnoperationBadageView.show(); } else { mUnoperationBadageView.hide(); } } @OnClick({R.id.item_machines_error, R.id.item_machines_shortage, R.id.item_machines_offline, R.id.item_machines_lock, R.id.item_machines_unoperation}) public void onClick(View view) { if(machineStateChangeLister==null){ return; } switch (view.getId()) { case R.id.item_machines_error: machineStateChangeLister.state(Constants.state_error); break; case R.id.item_machines_shortage: machineStateChangeLister.state(Constants.state_lack); break; case R.id.item_machines_offline: machineStateChangeLister.state(Constants.state_offline); break; case R.id.item_machines_lock: machineStateChangeLister.state(Constants.state_lock); break; case R.id.item_machines_unoperation: machineStateChangeLister.state(Constants.state_unoperation); break; } } }
[ "hdwhhc@sina.cn" ]
hdwhhc@sina.cn
11ff1eaa947d834d7121dd3d022344221cf1a04d
f0cdf98c1332634fdac66764779f3e722349cd02
/library/core/src/test/java/com/upax/exoplayer2/WakeLockManagerTest.java
63ea6c97ea3149eb4ce286f8a8a5cd89608ab5e9
[ "Apache-2.0" ]
permissive
UlaiS/exoplayer2
acc8a565b4f2c379fe129c561786371b5078105c
73ea2e4283b753d081da603dbcd6b8079aeb0935
refs/heads/main
2022-07-29T19:57:50.987503
2021-11-23T23:52:06
2021-11-23T23:52:06
431,241,943
0
0
null
null
null
null
UTF-8
Java
false
false
2,083
java
/* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.upax.exoplayer2; import static com.google.common.truth.Truth.assertThat; import android.content.Context; import android.os.PowerManager.WakeLock; import androidx.test.core.app.ApplicationProvider; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.shadows.ShadowPowerManager; /** Unit tests for {@link WakeLockManager} */ @RunWith(AndroidJUnit4.class) public class WakeLockManagerTest { private Context context; @Before public void setUp() { context = ApplicationProvider.getApplicationContext(); } @Test public void stayAwakeFalse_wakeLockIsNeverHeld() { WakeLockManager wakeLockManager = new WakeLockManager(context); wakeLockManager.setEnabled(true); wakeLockManager.setStayAwake(false); WakeLock wakeLock = ShadowPowerManager.getLatestWakeLock(); assertThat(wakeLock.isHeld()).isFalse(); wakeLockManager.setEnabled(false); assertThat(wakeLock.isHeld()).isFalse(); } @Test public void stayAwakeTrue_wakeLockIsOnlyHeldWhenEnabled() { WakeLockManager wakeLockManager = new WakeLockManager(context); wakeLockManager.setEnabled(true); wakeLockManager.setStayAwake(true); WakeLock wakeLock = ShadowPowerManager.getLatestWakeLock(); assertThat(wakeLock.isHeld()).isTrue(); wakeLockManager.setEnabled(false); assertThat(wakeLock.isHeld()).isFalse(); } }
[ "ulainava@gmail.com" ]
ulainava@gmail.com
6f88e69285828c0b8fc2d184c31ca8bd5dff0542
a94619fdc8770da90d0d307da64f19e95bcbbfc7
/java/alt.java
37ac9ddc57ae04f1bcf30c2f578ba305eda4f108
[]
no_license
BeCandid/CFR
b95cf21629ced30fac290a61ff51d443057a5919
ab5019fb6196b6c8f8e2a3fe18f557b89831d690
refs/heads/master
2021-01-12T05:52:09.792333
2016-12-24T10:04:51
2016-12-24T10:04:51
77,222,002
3
0
null
null
null
null
UTF-8
Java
false
false
726
java
/* * Decompiled with CFR 0_110. * * Could not load the following classes: * java.lang.Object * java.lang.String */ public abstract class alt { private final String a; private final String b; public alt(String string2, String string3) { this.a = string2; this.b = string3; } public String a() { return this.a; } public String b() { return this.b; } public static class a extends alt { public a(String string2, String string3) { super(string2, string3); } } public static class b extends alt { public b(String string2, String string3) { super(string2, string3); } } }
[ "admin@timo.de.vc" ]
admin@timo.de.vc
622c419cf09448cb48adb8dc715f6b326ad5cf70
2c02b2c6417f52a7f6f447ba5a34f326d074b118
/spring-boot-demo-14-1/src/main/java/com/roncoo/example141/util/listerner/CustomListener.java
27212e2277f402ad14e5628e592f2ee942f33cbb
[]
no_license
SeerGlaucus/spring-boot-demo
ca313b3596a01ba2dcfdaff11756b9e6aac50ab3
2605a30c5b6abca3a2d8e35847b9ccab603c0fb7
refs/heads/master
2021-07-10T05:19:39.525992
2017-10-12T08:07:20
2017-10-12T08:07:20
106,662,887
0
0
null
null
null
null
UTF-8
Java
false
false
543
java
package com.roncoo.example141.util.listerner; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; import javax.servlet.annotation.WebListener; /** * 自定义listener * * @author wujing */ @WebListener public class CustomListener implements ServletContextListener { @Override public void contextInitialized(ServletContextEvent sce) { System.out.println("contextInitialized"); } @Override public void contextDestroyed(ServletContextEvent sce) { System.out.println("contextDestroyed"); } }
[ "ygss2020@gmail.com" ]
ygss2020@gmail.com
e91e2ca892f0601d2ab183d0ae532c87a3e428be
7d8da7d5889e93c555669f2e8bee4e68a16ff9de
/src/main/java/com/kmv/geological/domain/dto/page/SimplePageResponseDTO.java
4a75cf91201cf454c12dc1ca477529f23545b977
[]
no_license
rahnemon2011/job-sample
33df48a31b479cd03c6a4437bebf4f08b33f6d1a
dfe5a19cffd6ff379a5f7728c984d7a74a13a41a
refs/heads/master
2021-09-09T04:35:02.743984
2018-03-13T22:24:13
2018-03-13T22:24:13
125,007,653
0
0
null
null
null
null
UTF-8
Java
false
false
747
java
package com.kmv.geological.domain.dto.page; import com.kmv.geological.domain.dto.BaseResponseDTO; import java.util.List; /** * @author h.mohammadi */ public class SimplePageResponseDTO<T extends Object> extends BaseResponseDTO { private List<T> content; private long count; public List<T> getContent() { return content; } public SimplePageResponseDTO() { } public SimplePageResponseDTO(List<T> content, long count) { this.content = content; this.count = count; } public void setContent(List<T> content) { this.content = content; } public long getCount() { return count; } public void setCount(long count) { this.count = count; } }
[ "rahnemon2011@gmail.com" ]
rahnemon2011@gmail.com
5b8d4c8499f972c16d9bf5e581d17508de6252f1
44ddfc7e639f0cb4fb191f9cc0ab16f6b2334abd
/app/src/test/java/com/example/matt/podcastapplication/ExampleUnitTest.java
603e16e443012eeafc6f891eadeaec64304df01a
[]
no_license
mattv23v/PodcastApplication
911c34a09e9feb97d508fcf3d43598830539047f
70821ccdd2ed56a302b637ad5448c33e9e82a12f
refs/heads/master
2020-04-14T07:13:18.020738
2019-08-23T18:29:26
2019-08-23T18:29:26
162,765,297
0
0
null
null
null
null
UTF-8
Java
false
false
396
java
package com.example.matt.podcastapplication; 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); } }
[ "mvgundy@gmail.com" ]
mvgundy@gmail.com
84010cdc6e102547e12f3fd0f88a3eff7fec3aee
d64f835aa8686b86ceed8a6888d27fd341fa7cdf
/src/main/java/com/douwe/banque/projection/AccountOperation.java
8eefa977794ec37c2d3f53a029351511fe4753d8
[]
no_license
Guidona/banque-gui
4797af55ab39114c38a079bfe83fe8df010b7c7b
b560509f1d64ceb285f69aaf1ecbf7b599fbd7d8
refs/heads/master
2021-01-25T07:49:23.619115
2017-06-23T17:59:57
2017-06-23T17:59:57
93,675,246
0
0
null
null
null
null
UTF-8
Java
false
false
1,999
java
package com.douwe.banque.projection; import com.douwe.banque.data.Account; import com.douwe.banque.data.Operation; import com.douwe.banque.data.OperationType; import com.douwe.banque.data.User; import java.util.Date; /** * * @author Vincent Douwe <douwevincent@yahoo.fr> */ public class AccountOperation { private Operation operation; private String accountNumber; private String username; public AccountOperation(String username, String accountNumber, Operation operation){ this.username = username; this.accountNumber = accountNumber; this.operation = operation; } public Integer getId() { return operation.getId(); } public void setId(Integer id) { operation.setId(id); } public OperationType getType() { return operation.getType(); } public void setType(OperationType type) { operation.setType(type); } public Date getDateOperation() { return operation.getDateOperation(); } public void setDateOperation(Date dateOperation) { operation.setDateOperation(dateOperation); } public String getDescription() { return operation.getDescription(); } public void setDescription(String description) { operation.setDescription(description); } public Account getAccount() { return operation.getAccount(); } public void setAccount(Account account) { operation.setAccount(account); } public User getUser() { return operation.getUser(); } public void setUser(User user) { operation.setUser(user); } public String getAccountNumber() { return accountNumber; } public void setAccountNumber(String accountNumber) { this.accountNumber = accountNumber; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } }
[ "mguidona@gmail.com" ]
mguidona@gmail.com
9c9dc020e8e3da18785724e07d852f85d4c4c126
beff573d1a74d7647d7911d02873190e3f3c512b
/src/main/java/eu/smartdatalake/simsearch/service/SimSearchController.java
77783c13af7165bd7884e7a839d188b7360b3dd9
[ "Apache-2.0" ]
permissive
smartdatalake/simsearch
7979eb1de359dda966c87c6e3ebdaa6a96511d72
30aa8af879d75bdff086085ca8992aad23b2f0d1
refs/heads/master
2023-04-27T22:57:57.159644
2023-04-20T13:17:11
2023-04-20T13:17:11
239,735,731
5
2
Apache-2.0
2022-11-16T01:19:37
2020-02-11T10:32:54
Java
UTF-8
Java
false
false
28,082
java
package eu.smartdatalake.simsearch.service; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.json.simple.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.CrossOrigin; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import eu.smartdatalake.simsearch.Coordinator; import eu.smartdatalake.simsearch.InstanceSettings; import eu.smartdatalake.simsearch.engine.Response; import eu.smartdatalake.simsearch.engine.SearchResponse; import eu.smartdatalake.simsearch.manager.AttributeInfo; import eu.smartdatalake.simsearch.request.MountRequest; import eu.smartdatalake.simsearch.request.CatalogRequest; import eu.smartdatalake.simsearch.request.RemoveRequest; import eu.smartdatalake.simsearch.request.SearchRequest; import java.lang.Exception; import java.security.SecureRandom; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.StringTokenizer; import javax.xml.bind.DatatypeConverter; /** * Controller that handles all HTTP requests to the RESTful web service. */ @RestController @RequestMapping("/simsearch/api") public class SimSearchController { int API_key_length = 128; // Standard length (in bits) for all generated API keys Map<String, Coordinator> dictCoordinators; // Dictionary of all coordinator instances (each with its own API key) deployed at the SimSearch back-end. Map<String, Set<String>> extraApiKeys; // For a "master" API key, keep a set of any associated API keys available for search and catalog operations List<String> adminApiKeys; // List of admin-defined API keys /** * Provides the list of API keys defined by the administrator upon launching of the service. * @param propKeys A string containing comma-separated values representing admin-defined API keys. * @return A list of API keys as defined by the administrator when the service is launched. */ private List<String> getApiKeys(String propKeys) { List<String> validApiKeys = new ArrayList<String>(); String keysString = System.getProperty(propKeys); if (keysString != null ) { StringTokenizer strTok = new StringTokenizer(keysString, " "); while (strTok.hasMoreTokens()) { validApiKeys.add(strTok.nextToken()); } } return validApiKeys; } /** * Checks whether the given API key is defined by the administrator, i.e., using a JSON when the service is launched. * @param api_key The API key to check. * @return A Boolean value: True, if the key is defined by the administrator; otherwise, False. */ private boolean isAdminApiKey(String api_key) { return adminApiKeys.contains(api_key) ? true : false; } /** * Checks whether the given API key is valid, i.e., listed among those generated for the various data sources. * @param api_key The API key to check. * @return A Boolean value: True, if the key is valid; otherwise, False. */ private boolean isValidApiKey(String api_key) { return dictCoordinators.containsKey(api_key) ? true : false; } /** * Checks whether the given API key is associated with a master API key and thus allows certain requests (search, catalog) against the respective datasets. * @param api_key The API key to check. * @return The master API key to employ for evaluating any requests. */ private String getMasterApiKey(String api_key) { for (String masterApiKey: extraApiKeys.keySet()) { if (extraApiKeys.get(masterApiKey).contains(api_key)) return masterApiKey; // The master API key to use for requests to the data sources } return api_key; // There is no associated master API key } /** * Associates the given extra API key to an existing master API key that enables certain requests (catalog, search). * @param masterApiKey The master API key that enables SimSearch requests. * @param extraApiKey The extra API key to associate with the master API key. * @return A boolean value: True, if the extra API key has been associated with the master API key; otherwise, False. */ private boolean assignExtraApiKey(String masterApiKey, String extraApiKey) { // Check if extra API key is already in use, even for another master API key for (String key: extraApiKeys.keySet()) { if (extraApiKeys.get(key).contains(extraApiKey)) return false; } // If the master API key has no associated extra key, initialize its set if (!extraApiKeys.containsKey(masterApiKey)) extraApiKeys.put(masterApiKey, new HashSet<String>()); // Associate the extra API key to the master API key return extraApiKeys.get(masterApiKey).add(extraApiKey); } /** * Revokes and deactivates the given extra API key from an existing master API key; specifying requests with the extra API key will be no longer enabled. * @param masterApiKey The master API key that controls SimSearch requests. * @param extraApiKey The extra API key to revoke from the master API key. * @return A boolean value: True, if the extra API key has been revoked; otherwise, False. */ private boolean revokeExtraApiKey(String masterApiKey, String extraApiKey) { if (extraApiKeys.containsKey(masterApiKey)) return extraApiKeys.get(masterApiKey).remove(extraApiKey); return false; } /** * Generates a new API key that is associated with the newly specified data source(s). * @return A string with the new API key. */ public String generateAPIkey() { SecureRandom random = new SecureRandom(); byte bytes[] = new byte[API_key_length/8]; random.nextBytes(bytes); return DatatypeConverter.printHexBinary(bytes).toLowerCase(); } /** * Constructor. It also instantiates the lists of API keys. */ @Autowired public SimSearchController() { // Instantiate a dictionary of all instantiated coordinators (one per generated API key) dictCoordinators = new HashMap<String, Coordinator>(); // Instantiate any administrative API keys specified in the optional input JSON // This specifies the admin-defined API keys adminApiKeys = getApiKeys("admin_api_keys"); // Instantiate dictionary to keep any extra API keys extraApiKeys = new HashMap<String, Set<String>>(); } /** * Provides general information about the running SimSearch service accessible through this API key. * @param apiKey The client API key controlling the corresponding data sources. * @return The main settings of the running instance. */ @CrossOrigin @ApiOperation(value = "Provides general information about the running SimSearch service accessible through this API key") @RequestMapping(value = "/_settings", method = { RequestMethod.POST, RequestMethod.GET }, consumes = "application/json", produces = "application/json") public ResponseEntity<JSONObject> settings(@ApiParam("The client API key allowing access to the data") @RequestHeader("api_key") String apiKey) { // Identify the master API key, if applicable apiKey = getMasterApiKey(apiKey); // value may change to its master API key if (!isValidApiKey(apiKey)) { JSONObject res = new JSONObject(); res.put("Notification", "Operation not allowed for this user. Please check your client API key."); return new ResponseEntity<>(res, HttpStatus.FORBIDDEN); } else { // Identify the coordinator that handles existing data sources for this API key Coordinator myCoordinator = dictCoordinators.get(apiKey); InstanceSettings settings = myCoordinator.getSettings(); JSONObject res = new JSONObject(); res.put(settings.settings.index.getProvidedName(), settings); return new ResponseEntity<>(res, HttpStatus.OK); } } /** * Associates an API key with a master API key, thus enabling certain requests (catalog, search). * @param apiKey The client API key controlling the corresponding data sources. * @param extraKey The extra API key to associate. * @return A notification to the user. */ @CrossOrigin @ApiOperation(value = "Associate an extra API key with the given client API key; certain requests (catalog, search) controlled by the client API key will be also allowed with this extra key") @RequestMapping(value = "/assignKey", method = { RequestMethod.POST }, consumes = "application/json", produces = "application/json") public ResponseEntity<Response> assignKey(@ApiParam("The client API key allowing access to the data") @RequestHeader("api_key") String apiKey, @ApiParam("The extra API key to associate with this client API key") @RequestBody String extraKey) { Response assignResponse = new Response(); if (!isValidApiKey(apiKey)) { assignResponse.setNotification("Operation not allowed for this user. Please check your client API key."); return new ResponseEntity<>(assignResponse, HttpStatus.FORBIDDEN); } if (assignExtraApiKey(apiKey, extraKey)) { // Identify the coordinator that handles existing data sources for the master API key Coordinator myCoordinator = dictCoordinators.get(apiKey); assignResponse.setNotification("Data sources controlled by API key " + apiKey + " can now be also queried using this API key: " + extraKey); assignResponse.setApiKey(extraKey); myCoordinator.log("Data sources controlled by API key " + apiKey + " can now be also queried using this API key: " + extraKey); return new ResponseEntity<>(assignResponse, HttpStatus.OK); } else { assignResponse.setNotification("Operation failed. Extra API key is already associated with a client API key. Please check your API keys."); return new ResponseEntity<>(assignResponse, HttpStatus.BAD_REQUEST); } } /** * Removes an API key that has been associated with a master API key, which controls similarity search requests. * @param apiKey The client API key controlling the corresponding data sources. * @param extraKey The extra API key to revoke. * @return A notification to the user. */ @CrossOrigin @ApiOperation(value = "Revokes the specified extra API key associated with the client API key; the revoked API key can no loger be used in similarity search requests") @RequestMapping(value = "/revokeKey", method = { RequestMethod.POST }, consumes = "application/json", produces = "application/json") public ResponseEntity<Response> revokeKey(@ApiParam("The client API key allowing access to the data") @RequestHeader("api_key") String apiKey, @ApiParam("The extra API key to deactivate") @RequestBody String extraKey) { Response revokeResponse = new Response(); if (!isValidApiKey(apiKey)) { revokeResponse.setNotification("Operation not allowed for this user. Please check your client API key."); return new ResponseEntity<>(revokeResponse, HttpStatus.FORBIDDEN); } if (revokeExtraApiKey(apiKey, extraKey)) { // Identify the coordinator that handles existing data sources for the master API key Coordinator myCoordinator = dictCoordinators.get(apiKey); revokeResponse.setNotification("Data sources controlled by API key " + apiKey + " are no longer available for queries using this API key: " + extraKey); revokeResponse.setApiKey(extraKey); myCoordinator.log("Data sources controlled by API key " + apiKey + " are no longer available for queries using this API key: " + extraKey); return new ResponseEntity<>(revokeResponse, HttpStatus.OK); } else { revokeResponse.setNotification("Operation failed. There is no such extra API key associated with the given client API key. Please check your API keys."); return new ResponseEntity<>(revokeResponse, HttpStatus.BAD_REQUEST); } } /** * Lists any API keys associated with a master API key that controls similarity search requests. * @param apiKey The client API key controlling the corresponding data sources. * @return A JSON listing the catalog of queryable attributes and the similarity operation supported by each one. */ @CrossOrigin @ApiOperation(value = "List any extra API keys associated with the given client API key that enables similarity search requests") @RequestMapping(value = "/listKeys", method = { RequestMethod.POST }, consumes = "application/json", produces = "application/json") public ResponseEntity<Response> listKeys(@ApiParam("The client API key") @RequestHeader("api_key") String apiKey) { Response listResponse = new Response(); if (!isValidApiKey(apiKey)) { listResponse.setNotification("Operation not allowed for this user. Please check your API key."); return new ResponseEntity<>(listResponse, HttpStatus.FORBIDDEN); } // Report any associated keys if (extraApiKeys.containsKey(apiKey)) { String[] extraKeys = extraApiKeys.get(apiKey).toArray(new String[0]); if (extraKeys.length > 0) { listResponse.setNotification("API key " + apiKey + " has the following associated extra keys: " + Arrays.toString(extraKeys)); return new ResponseEntity<>(listResponse, HttpStatus.OK); } } // No associated keys found listResponse.setNotification("API key " + apiKey + " has no associated extra keys."); return new ResponseEntity<>(listResponse, HttpStatus.BAD_REQUEST); } /** * Mounts the specified data sources and associates them to a new API key, including building in-memory indices or instantiating connections to remote sources. * @param params Parameters specified in JSON (instantiating a MountRequest object) that specify the data sources that will be enabled and their queryable attributes. * @return A notification whether the data sources were successfully mounted or not. If successful, this request also returns an API key to be used in all subsequent requests involving these data sources. */ @CrossOrigin @ApiOperation(value = "Mount the specified data sources and associate them to a new API key, including building in-memory indices or instantiating connections to remote sources") @RequestMapping(value = "/index", method = { RequestMethod.POST }, consumes = "application/json", produces = "application/json") public ResponseEntity<Response> index(@ApiParam("Parameters in this request") @RequestBody MountRequest params) { Response mountResponse; // Create a new instance of the coordinator at the SimSearch back-end Coordinator myCoordinator = new Coordinator(); // A new API key where the specified data source(s) will be assigned to String apiKey; // System.out.println("Preparing indices. This process may take a few minutes. Please wait..."); // MOUNTING DATA SOURCE(S) try { // Invoke mounting step mountResponse = myCoordinator.mount(params); // Generate a new API key ... apiKey = generateAPIkey(); // ... that must be used in all subsequent requests against these data sources dictCoordinators.put(apiKey, myCoordinator); // In case of no errors, notify accordingly if (mountResponse.getNotification() != null) mountResponse.appendNotification("Mounting stage terminated abnormally. Some data sources may not have been mounted."); else mountResponse.appendNotification("Mounting of data sources completed successfully."); mountResponse.appendNotification("***IMPORTANT*** In all subsequent requests regarding this data, you must specify this API key: " + apiKey); mountResponse.setApiKey(apiKey); myCoordinator.log("Newly created data sources have been associated with this API key: " + apiKey); } catch (Exception e) { e.printStackTrace(); mountResponse = new Response(); mountResponse.setNotification("Mounting stage terminated abnormally. Make sure that the submitted JSON configuration provides suitable specifications."); // System.out.println("Mounting stage terminated abnormally."); return new ResponseEntity<>(mountResponse, HttpStatus.BAD_REQUEST); } // System.out.println("Mounting of data sources completed!"); return new ResponseEntity<>(mountResponse, HttpStatus.OK); } /** * Appends the specified data sources to those already mounted for this API key, including building in-memory indices or instantiating connections to remote sources. * @param apiKey The client API key associated with the corresponding data sources. * @param params Parameters specified in JSON (instantiating a MountRequest object) that specify the data sources that will be enabled and their queryable attributes. * @return A notification whether the data sources were successfully mounted or not. */ @CrossOrigin @ApiOperation(value = "Append the specified data sources to those already mounted under the given API key, including building in-memory indices or instantiating connections to remote sources") @RequestMapping(value = "/append", method = { RequestMethod.POST }, consumes = "application/json", produces = "application/json") public ResponseEntity<Response> append(@ApiParam("The client API key allowing access to the data") @RequestHeader("api_key") String apiKey, @ApiParam("Parameters in this request") @RequestBody MountRequest params) { Response appendResponse; if (!isValidApiKey(apiKey) && !isAdminApiKey(apiKey)) { appendResponse = new Response(); appendResponse.setNotification("Operation not allowed for this user. Please check your API key."); return new ResponseEntity<>(appendResponse, HttpStatus.FORBIDDEN); } // Identify the coordinator that handles existing data sources for the specified API key Coordinator myCoordinator = dictCoordinators.get(apiKey); // If no coordinator exists yet for admin-defined API key, create one... if ((isAdminApiKey(apiKey)) && (myCoordinator == null)) { myCoordinator = new Coordinator(); // ... and keep it for use in all subsequent requests against these data sources dictCoordinators.put(apiKey, myCoordinator); } // System.out.println("Preparing indices. This process may take a few minutes. Please wait..."); // MOUNTING DATA SOURCE(S) try { // Invoke mounting step appendResponse = myCoordinator.mount(params); // In case of no errors, notify accordingly if (appendResponse.getNotification() != null) appendResponse.appendNotification("Mounting stage terminated abnormally. Some data sources may not have been appended."); appendResponse.appendNotification("Appended data sources are now available for queries and are associated with this API key: " + apiKey); appendResponse.setApiKey(apiKey); myCoordinator.log("Appended data sources are now available for queries and are associated with this API key: " + apiKey); } catch (Exception e) { e.printStackTrace(); appendResponse = new Response(); appendResponse.setNotification("Mounting stage terminated abnormally. Make sure that the submitted JSON configuration provides suitable specifications."); // System.out.println("Mounting stage terminated abnormally."); return new ResponseEntity<>(appendResponse, HttpStatus.BAD_REQUEST); } // System.out.println("Mounting of data sources completed!"); return new ResponseEntity<>(appendResponse, HttpStatus.OK); } /** * Unmounts all data sources associated with the given API key, and destroys the corresponding instance of SimSearch. * @param apiKey The client API key associated with a running instance of SimSearch service. * @return A notification about the status of the SimSearch instance. */ @CrossOrigin @ApiOperation(value = "Unmount all data sources associated with the given API key; the corresponding instance of SimSearch will be destroyed and can no longer respond to requests") @RequestMapping(value = "/unmount", method = { RequestMethod.POST }, consumes = "application/json", produces = "application/json") public ResponseEntity<Response> unmount(@ApiParam("The client API key allowing access to the data") @RequestHeader("api_key") String apiKey) { Response unmountResponse = new Response(); if (!isValidApiKey(apiKey)) { unmountResponse.setNotification("Operation not allowed for this user. Please check your API key."); return new ResponseEntity<>(unmountResponse, HttpStatus.FORBIDDEN); } // Dismiss the coordinator corresponding to the specified API key Coordinator myCoordinator = dictCoordinators.get(apiKey); if (myCoordinator != null) { myCoordinator.log("********************** Unmounting data sources ... **********************"); myCoordinator.log("SimSearch instance controlled by API key " + apiKey + " is no longer mounted and cannot support any requests."); myCoordinator = null; dictCoordinators.remove(apiKey); extraApiKeys.remove(apiKey); unmountResponse.setNotification("SimSearch instance controlled by API key " + apiKey + " is no longer mounted and cannot support any requests. Any associated API keys have been deleted."); return new ResponseEntity<>(unmountResponse, HttpStatus.OK); } else { unmountResponse.setNotification("Cannot find any instance of SimSearch associated with API key " + apiKey + ". Please check your API key."); return new ResponseEntity<>(unmountResponse, HttpStatus.BAD_REQUEST); } } /** * Lists the queryable attributes that may be included in similarity search requests. * @param apiKey The client API key associated with the corresponding data sources. * @param params Parameters specified in JSON (instantiating a CatalogRequest object); if empty {}, then all sources will be listed. * @return A JSON listing the catalog of queryable attributes and the similarity operation supported by each one. */ @CrossOrigin @ApiOperation(value = "List the queryable attributes associated with the given client API key; these may be included in similarity search requests") @RequestMapping(value = "/catalog", method = { RequestMethod.POST }, consumes = "application/json", produces = "application/json") public ResponseEntity<AttributeInfo[]> catalog(@ApiParam("The client API key") @RequestHeader("api_key") String apiKey, @ApiParam("Parameters in this request") @RequestBody CatalogRequest params) { // Identify the master API key, if applicable apiKey = getMasterApiKey(apiKey); // value may change to its master API key if (!isValidApiKey(apiKey)) { AttributeInfo[] response = new AttributeInfo[1]; response[0] = new AttributeInfo("No catalog available","Operation not allowed for this user. Please check your API key."); return new ResponseEntity<>(response, HttpStatus.FORBIDDEN); } // Identify the coordinator that handles data sources for the specified API key Coordinator myCoordinator = dictCoordinators.get(apiKey); // CATALOG OF DATA SOURCES try { // Invoke listing of available data sources return new ResponseEntity<>(myCoordinator.listDataSources(params), HttpStatus.OK); } catch (Exception e) { e.printStackTrace(); // System.out.println("Listing of data sources terminated abnormally."); AttributeInfo[] response = new AttributeInfo[1]; response[0] = new AttributeInfo("No catalog available","Listing of data sources terminated abnormally"); return new ResponseEntity<>(response, HttpStatus.NOT_FOUND); } } /** * Removes attribute(s) from those available for similarity search queries. * Any removed attribute(s) can become available again with an index request to the RESTful service. * @param apiKey The client API key associated with the corresponding data sources. * @param params Parameters specified in JSON (instantiating a RemoveRequest object) that declare the attribute(s) to become unavailable for queries. * @return A notification on whether the requested attribute removal succeeded or not. */ @CrossOrigin @ApiOperation(value = "Remove attribute(s) associated with the given client API key; these become no longer queryable in similarity search queries") @RequestMapping(value = "/delete", method = { RequestMethod.POST }, consumes = "application/json", produces = "application/json") public ResponseEntity<Response> delete(@ApiParam("The client API key allowing access to the data") @RequestHeader("api_key") String apiKey, @ApiParam("Parameters in this request") @RequestBody RemoveRequest params) { Response delResponse; if (!isValidApiKey(apiKey)) { delResponse = new Response(); delResponse.setNotification("Operation not allowed for this user. Please check your API key."); return new ResponseEntity<>(delResponse, HttpStatus.FORBIDDEN); } // Identify the coordinator that handles data sources for the specified API key Coordinator myCoordinator = dictCoordinators.get(apiKey); // REMOVAL OF ATTRIBUTE DATA try { // Invoke removal functionality delResponse = myCoordinator.delete(params); delResponse.appendNotification("Any maintained indices have been purged."); myCoordinator.log("Removed the specified data source(s) associated with this API key: " + apiKey); } catch (NullPointerException e) { e.printStackTrace(); delResponse = new Response(); delResponse.setNotification("No dataset with at least one of the specified attributes is available for search. Make sure that the JSON file provides suitable specifications."); return new ResponseEntity<>(delResponse, HttpStatus.BAD_REQUEST); } catch (Exception e) { e.printStackTrace(); delResponse = new Response(); delResponse.setNotification("Attribute data removal terminated abnormally. Make sure that the submitted JSON configuration provides suitable specifications."); return new ResponseEntity<>(delResponse, HttpStatus.BAD_REQUEST); } return new ResponseEntity<>(delResponse, HttpStatus.OK); } /** * Allows submission of multi-attribute similarity search requests to the RESTful service. * @param apiKey The client API key associated with the corresponding data sources. * @param params Parameters specified in JSON (instantiating a SearchRequest object) that define the attributes, query values, and weights to be applied in the search request. * @return A JSON with the ranked results qualifying to the criteria specified in the similarity search query. */ @CrossOrigin @ApiOperation(value = "Submit multi-attribute similarity search requests with user-specified query values and parameters") @RequestMapping(value = "/search", method = { RequestMethod.POST }, consumes = "application/json", produces = "application/json") public ResponseEntity<SearchResponse[]> search(@ApiParam("The client API key") @RequestHeader("api_key") String apiKey, @ApiParam("Parameters in this request") @RequestBody SearchRequest params) { // Identify the master API key, if applicable apiKey = getMasterApiKey(apiKey); // value may change to its master API key if (!isValidApiKey(apiKey)) { SearchResponse[] response = new SearchResponse[1]; SearchResponse res0 = new SearchResponse(); res0.setNotification("Operation not allowed for this user. Please check your API key."); response[0] = res0; return new ResponseEntity<>(response, HttpStatus.FORBIDDEN); } // Identify the coordinator that handles data sources for the specified API key Coordinator myCoordinator = dictCoordinators.get(apiKey); // SEARCH try { // Invoke search with the parameters specified in the query configuration return new ResponseEntity<>(myCoordinator.search(params), HttpStatus.OK); } catch (Exception e) { e.printStackTrace(); SearchResponse[] response = new SearchResponse[1]; SearchResponse res0 = new SearchResponse(); res0.setNotification("Query evaluation terminated abnormally. Make sure that the submitted JSON configuration provides suitable query specifications."); response[0] = res0; return new ResponseEntity<>(response, HttpStatus.BAD_REQUEST); } } }
[ "kpatro@athenarc.gr" ]
kpatro@athenarc.gr
5f007496497f45321196dc2da83a67629dfd696a
c8f2735e093a210784e3ad4430006a8d35cfa642
/PuertoRico/src/org/hirschhorn/puertorico/gamestate/TradingHouse.java
d268e704280031b11260096f6eba6f1a8c7aca7f
[ "MIT" ]
permissive
ghirschhorn987/puertorico
9c32571a1b05a43fbebf24ab8bb3c4bc153d66a4
637cd4382d6c5ada69b843ec7ece86345513674c
refs/heads/master
2016-09-06T01:48:09.108292
2015-08-27T07:31:50
2015-08-27T07:31:50
41,462,425
2
0
null
null
null
null
UTF-8
Java
false
false
881
java
package org.hirschhorn.puertorico.gamestate; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import org.hirschhorn.puertorico.constants.Good; public class TradingHouse { List<Good> goods; public TradingHouse(TradingHouse tradingHouse) { goods = new ArrayList<>(tradingHouse.goods); } public TradingHouse() { goods = new ArrayList<>(); } public int getGoodCount(Good chosenGood){ int count = 0; for (Good good : goods) { if (good.equals(chosenGood)) { count++; } } return count; } public Set<Good> getUniqueGoods(){ return new HashSet<Good>(goods); } public List<Good> getAllGoods(){ return new ArrayList<>(goods); } public void addGood(Good good) { goods.add(good); } public void clearGoods() { goods.clear(); } }
[ "ghirschhorn987@gmail.com" ]
ghirschhorn987@gmail.com
abecba78fb8c86c5309ae937116eb27a86da02f7
710d0c681c78b23b02c8064c750aee4fab735e94
/SEMINAR9/src/ro/ase/cts/chain/Cont.java
abf9fdca08563eba98d2b1fb88d55fb85930d810
[]
no_license
DeaconescuLucian/CTS
1b37c47dabcaaa98d22601f0e86f74f6753bb0e4
7acb48c083ed2aaaee3df0f3711ef805ad42ab8d
refs/heads/master
2023-05-08T18:10:51.049644
2021-06-03T06:22:10
2021-06-03T06:22:10
342,137,189
0
0
null
null
null
null
UTF-8
Java
false
false
475
java
package ro.ase.cts.chain; public abstract class Cont { private float sold; private String client; private Cont succesor; public Cont(float sold, String client, Cont succesor) { super(); this.sold = sold; this.client = client; this.succesor = succesor; } public float getSold() { return sold; } public String getClient() { return client; } public Cont getSuccesor() { return succesor; } public abstract void plateste(float suma); }
[ "deaconesculucian18@stud.ase.ro" ]
deaconesculucian18@stud.ase.ro
6da1bfe52c5d580bef70ef297f75d1284d09d24b
f2b6d20a53b6c5fb451914188e32ce932bdff831
/src/com/linkedin/android/entities/viewholders/MultiTileViewHolder.java
88664ab349cf07eab02414b12e47fb65b3e20a33
[]
no_license
reverseengineeringer/com.linkedin.android
08068c28267335a27a8571d53a706604b151faee
4e7235e12a1984915075f82b102420392223b44d
refs/heads/master
2021-04-09T11:30:00.434542
2016-07-21T03:54:43
2016-07-21T03:54:43
63,835,028
3
0
null
null
null
null
UTF-8
Java
false
false
1,119
java
package com.linkedin.android.entities.viewholders; import android.view.View; import android.widget.Button; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import butterknife.InjectView; import com.linkedin.android.infra.ViewHolderCreator; import com.linkedin.android.infra.app.BaseViewHolder; public class MultiTileViewHolder extends BaseViewHolder { public static final ViewHolderCreator<MultiTileViewHolder> CREATOR = new ViewHolderCreator() { public final int getLayoutId() { return 2130968667; } }; @InjectView(2131755396) public TextView header; @InjectView(2131755540) public RelativeLayout tileLeft; @InjectView(2131755541) public RelativeLayout tileRight; @InjectView(2131755424) public LinearLayout tileRow; @InjectView(2131755425) public Button viewAllButton; public MultiTileViewHolder(View paramView) { super(paramView); } } /* Location: * Qualified Name: com.linkedin.android.entities.viewholders.MultiTileViewHolder * Java Class Version: 6 (50.0) * JD-Core Version: 0.7.1 */
[ "reverseengineeringer@hackeradmin.com" ]
reverseengineeringer@hackeradmin.com
725b3a9de0aa4d629d2f278bb808bd44bb0821b3
447520f40e82a060368a0802a391697bc00be96f
/apks/playstore_apps/com_spotify_music/source/com/spotify/mobile/android/spotlets/findfriends/model/ResultModel.java
16f79cc0adbc2fa8a6af9526be1d45e987539cca
[ "Apache-2.0" ]
permissive
iantal/AndroidPermissions
7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465
d623b732734243590b5f004d167e542e2e2ae249
refs/heads/master
2023-07-19T01:29:26.689186
2019-09-30T19:01:42
2019-09-30T19:01:42
107,239,248
0
0
Apache-2.0
2023-07-16T07:41:38
2017-10-17T08:22:57
null
UTF-8
Java
false
false
5,224
java
package com.spotify.mobile.android.spotlets.findfriends.model; import android.os.Parcel; import android.os.Parcelable; import android.os.Parcelable.Creator; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import com.spotify.mobile.android.cosmos.JacksonModel; import mmo; @JsonIgnoreProperties(ignoreUnknown=true) public class ResultModel implements Parcelable, JacksonModel { public static final Parcelable.Creator<ResultModel> CREATOR = new Parcelable.Creator() {}; @JsonProperty("image") private final String mImage; @JsonProperty("isFollowing") private boolean mIsFollowing; @JsonProperty("subtitleUri") private final String mSubtitleUri; @JsonProperty("title") private final String mTitle; @JsonProperty("uri") private final String mUri; public ResultModel(Parcel paramParcel) { this.mUri = paramParcel.readString(); this.mTitle = paramParcel.readString(); this.mImage = paramParcel.readString(); this.mSubtitleUri = paramParcel.readString(); this.mIsFollowing = mmo.a(paramParcel); } public ResultModel(@JsonProperty("uri") String paramString1, @JsonProperty("title") String paramString2, @JsonProperty("image") String paramString3, @JsonProperty("subtitleUri") String paramString4, @JsonProperty("following") boolean paramBoolean) { this.mUri = paramString1; this.mTitle = paramString2; paramString1 = paramString3; if (paramString3 == null) { paramString1 = ""; } this.mImage = paramString1; this.mSubtitleUri = paramString4; this.mIsFollowing = paramBoolean; } public int describeContents() { return 0; } public boolean equals(Object paramObject) { if (this == paramObject) { return true; } if (paramObject != null) { if (getClass() != paramObject.getClass()) { return false; } paramObject = (ResultModel)paramObject; if (this.mIsFollowing != paramObject.mIsFollowing) { return false; } if (!this.mImage.equals(paramObject.mImage)) { return false; } if (!this.mTitle.equals(paramObject.mTitle)) { return false; } return this.mUri.equals(paramObject.mUri); } return false; } public String getImage() { return this.mImage; } public String getTitle() { return this.mTitle; } public String getUri() { if (this.mSubtitleUri == null) { return this.mUri; } return this.mSubtitleUri; } public int hashCode() { throw new Runtime("d2j fail translate: java.lang.RuntimeException: can not merge I and Z\n\tat com.googlecode.dex2jar.ir.TypeClass.merge(TypeClass.java:100)\n\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeRef.updateTypeClass(TypeTransformer.java:174)\n\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.provideAs(TypeTransformer.java:780)\n\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.e1expr(TypeTransformer.java:496)\n\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.exExpr(TypeTransformer.java:713)\n\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.exExpr(TypeTransformer.java:703)\n\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.e2expr(TypeTransformer.java:632)\n\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.exExpr(TypeTransformer.java:716)\n\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.exExpr(TypeTransformer.java:703)\n\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.s1stmt(TypeTransformer.java:810)\n\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.sxStmt(TypeTransformer.java:840)\n\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.analyze(TypeTransformer.java:206)\n\tat com.googlecode.dex2jar.ir.ts.TypeTransformer.transform(TypeTransformer.java:44)\n\tat com.googlecode.d2j.dex.Dex2jar$2.optimize(Dex2jar.java:162)\n\tat com.googlecode.d2j.dex.Dex2Asm.convertCode(Dex2Asm.java:414)\n\tat com.googlecode.d2j.dex.ExDex2Asm.convertCode(ExDex2Asm.java:42)\n\tat com.googlecode.d2j.dex.Dex2jar$2.convertCode(Dex2jar.java:128)\n\tat com.googlecode.d2j.dex.Dex2Asm.convertMethod(Dex2Asm.java:509)\n\tat com.googlecode.d2j.dex.Dex2Asm.convertClass(Dex2Asm.java:406)\n\tat com.googlecode.d2j.dex.Dex2Asm.convertDex(Dex2Asm.java:422)\n\tat com.googlecode.d2j.dex.Dex2jar.doTranslate(Dex2jar.java:172)\n\tat com.googlecode.d2j.dex.Dex2jar.to(Dex2jar.java:272)\n\tat com.googlecode.dex2jar.tools.Dex2jarCmd.doCommandLine(Dex2jarCmd.java:108)\n\tat com.googlecode.dex2jar.tools.BaseCmd.doMain(BaseCmd.java:288)\n\tat com.googlecode.dex2jar.tools.Dex2jarCmd.main(Dex2jarCmd.java:32)\n"); } public boolean isFollowing() { return this.mIsFollowing; } public String toString() { return this.mTitle; } public void toggleFollowing() { this.mIsFollowing ^= true; } public void writeToParcel(Parcel paramParcel, int paramInt) { paramParcel.writeString(this.mUri); paramParcel.writeString(this.mTitle); paramParcel.writeString(this.mImage); paramParcel.writeString(this.mSubtitleUri); mmo.a(paramParcel, this.mIsFollowing); } }
[ "antal.micky@yahoo.com" ]
antal.micky@yahoo.com
11edfa0530b7ef904de3726fe9a64e2d689d69e8
f4039e43d8cc2260d4354c22c5008ef0734f0a80
/jd-pojo/src/main/java/com/jd/pojo/log/PayLog.java
0876f776debfe262e5adbeee4170dad2af735b46
[]
no_license
JamzYang/jd-parent
ef6698d551e991bc19158f3827f476efb3585696
88fd7b395b37f05d4712c5b688c7cfc267d39fa7
refs/heads/master
2020-03-19T06:40:31.394694
2018-06-10T15:13:22
2018-06-10T15:13:22
136,044,815
0
0
null
null
null
null
UTF-8
Java
false
false
5,657
java
package com.jd.pojo.log; import java.io.Serializable; import java.util.Date; public class PayLog implements Serializable { /** * 支付订单号 */ private String outTradeNo; /** * 创建日期 */ private Date createTime; /** * 支付完成时间 */ private Date payTime; /** * 支付金额(分) */ private Long totalFee; /** * 用户ID */ private String userId; /** * 交易号码 */ private String transactionId; /** * 交易状态 */ private String tradeState; /** * 订单编号列表 */ private String orderList; /** * 支付类型 */ private String payType; private static final long serialVersionUID = 1L; public String getOutTradeNo() { return outTradeNo; } public void setOutTradeNo(String outTradeNo) { this.outTradeNo = outTradeNo == null ? null : outTradeNo.trim(); } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Date getPayTime() { return payTime; } public void setPayTime(Date payTime) { this.payTime = payTime; } public Long getTotalFee() { return totalFee; } public void setTotalFee(Long totalFee) { this.totalFee = totalFee; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId == null ? null : userId.trim(); } public String getTransactionId() { return transactionId; } public void setTransactionId(String transactionId) { this.transactionId = transactionId == null ? null : transactionId.trim(); } public String getTradeState() { return tradeState; } public void setTradeState(String tradeState) { this.tradeState = tradeState == null ? null : tradeState.trim(); } public String getOrderList() { return orderList; } public void setOrderList(String orderList) { this.orderList = orderList == null ? null : orderList.trim(); } public String getPayType() { return payType; } public void setPayType(String payType) { this.payType = payType == null ? null : payType.trim(); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append(" ["); sb.append("Hash = ").append(hashCode()); sb.append(", outTradeNo=").append(outTradeNo); sb.append(", createTime=").append(createTime); sb.append(", payTime=").append(payTime); sb.append(", totalFee=").append(totalFee); sb.append(", userId=").append(userId); sb.append(", transactionId=").append(transactionId); sb.append(", tradeState=").append(tradeState); sb.append(", orderList=").append(orderList); sb.append(", payType=").append(payType); sb.append(", serialVersionUID=").append(serialVersionUID); sb.append("]"); return sb.toString(); } @Override public boolean equals(Object that) { if (this == that) { return true; } if (that == null) { return false; } if (getClass() != that.getClass()) { return false; } PayLog other = (PayLog) that; return (this.getOutTradeNo() == null ? other.getOutTradeNo() == null : this.getOutTradeNo().equals(other.getOutTradeNo())) && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) && (this.getPayTime() == null ? other.getPayTime() == null : this.getPayTime().equals(other.getPayTime())) && (this.getTotalFee() == null ? other.getTotalFee() == null : this.getTotalFee().equals(other.getTotalFee())) && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId())) && (this.getTransactionId() == null ? other.getTransactionId() == null : this.getTransactionId().equals(other.getTransactionId())) && (this.getTradeState() == null ? other.getTradeState() == null : this.getTradeState().equals(other.getTradeState())) && (this.getOrderList() == null ? other.getOrderList() == null : this.getOrderList().equals(other.getOrderList())) && (this.getPayType() == null ? other.getPayType() == null : this.getPayType().equals(other.getPayType())); } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((getOutTradeNo() == null) ? 0 : getOutTradeNo().hashCode()); result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); result = prime * result + ((getPayTime() == null) ? 0 : getPayTime().hashCode()); result = prime * result + ((getTotalFee() == null) ? 0 : getTotalFee().hashCode()); result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode()); result = prime * result + ((getTransactionId() == null) ? 0 : getTransactionId().hashCode()); result = prime * result + ((getTradeState() == null) ? 0 : getTradeState().hashCode()); result = prime * result + ((getOrderList() == null) ? 0 : getOrderList().hashCode()); result = prime * result + ((getPayType() == null) ? 0 : getPayType().hashCode()); return result; } }
[ "yangshenmail@126.com" ]
yangshenmail@126.com
10ee8d685f733165ed6efdc994df6f499dee4f5b
e3712168b5154d456edf3512a1424b9aea290f24
/frontend/Tagline/sources/com/microsoft/appcenter/utils/ShutdownHelper.java
b37d9900ea443f028715130ff3c3dbc90377ea02
[]
no_license
uandisson/Projeto-TagLine-HACK_GOV_PE
bf3c5c106191292b3692068d41bc5e6f38f07d52
5e130ff990faf5c8c5dab060398c34e53e0fd896
refs/heads/master
2023-03-12T17:36:36.792458
2021-02-11T18:17:51
2021-02-11T18:17:51
338,082,674
0
1
null
null
null
null
UTF-8
Java
false
false
333
java
package com.microsoft.appcenter.utils; import android.os.Process; import android.support.annotation.VisibleForTesting; public class ShutdownHelper { @VisibleForTesting ShutdownHelper() { } public static void shutdown(int status) { Process.killProcess(Process.myPid()); System.exit(status); } }
[ "uandisson@gmail.com" ]
uandisson@gmail.com
7ec448284df192c4c7e989508822379a050e200e
10561621ece0468f1e956e7d32040500636f8191
/src/main/java/com/endava/homework/models/Visit.java
e6bbaba832400d2a4acbd394836a339d886f3681
[]
no_license
alinaaaromannn/RestAsusredHomework1
659408658c7168088de5b16acc2f98962a35a663
c9230c2dca6b4a135276e5d84ce680483d76c9a7
refs/heads/master
2022-11-29T03:09:45.340484
2020-08-09T17:12:25
2020-08-09T17:12:25
286,277,795
0
0
null
null
null
null
UTF-8
Java
false
false
325
java
package com.endava.homework.models; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; @Builder @Data @NoArgsConstructor @AllArgsConstructor public class Visit { private String date; private String description; private int id; private Pet pet; }
[ "alina.roman@endava.com" ]
alina.roman@endava.com
c9e12e935e86e8749b1bdd5bbe5248a0b8412bed
8815357c8bf08dfab3a9eed3de8e7dc84ca43b31
/app/src/main/java/com/app/patientapp/FCM/MyFirebaseMessagingService.java
f088ad0104c2d63501cc3255eacdb1a9b7b925fd
[]
no_license
nandak9/Patient-App-Using-AI
01bcfc744025ffe4a17992c60223b92e727510f9
4a40870723422255f5cb690bddb8dd12bcc02d2b
refs/heads/master
2020-04-26T17:55:35.219247
2019-06-10T12:15:42
2019-06-10T12:15:42
173,728,721
0
0
null
null
null
null
UTF-8
Java
false
false
2,569
java
package com.app.patientapp.FCM; import com.app.patientapp.Notifications.NotificationIntentHelper; import com.app.patientapp.Util.Log; import com.google.firebase.messaging.FirebaseMessagingService; import com.google.firebase.messaging.RemoteMessage; /** * Created by abhisheksingh on 1/30/18. */ public class MyFirebaseMessagingService extends FirebaseMessagingService { private static final String TAG = "MyFirebaseMsgService"; /** * Called when message is received. * * @param remoteMessage Object representing the message received from Firebase Cloud Messaging. */ @Override public void onMessageReceived(RemoteMessage remoteMessage) { // Check if message contains a data payload. if (remoteMessage.getData().size() > 0) { Log.d(TAG, "Message data payload: " + remoteMessage.getData().toString()); NotificationIntentHelper.sendNotification(getApplicationContext(), remoteMessage); } if(remoteMessage.getNotification() != null) { NotificationIntentHelper.sendNotification(getApplicationContext(), remoteMessage); } } /** * Create and show a simple notification containing the received FCM message. * * @param messageBody FCM message body received. */ /* private void sendNotification(String messageBody,String title) { Intent intent = new Intent(this, HomeActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 */ /* Request code *//* , intent, PendingIntent.FLAG_ONE_SHOT); String channelId = getString(R.string.default_notification_channel_id); Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, channelId) .setSmallIcon(R.mipmap.ic_launcher) .setBadgeIconType(BADGE_ICON_SMALL) .setContentTitle(title) .setContentText(messageBody) .setAutoCancel(true) .setSound(defaultSoundUri) .setContentIntent(pendingIntent); NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(0 */ /* ID of notification *//* , notificationBuilder.build()); } */ }
[ "nandakishore.kumar@wibmodc.com" ]
nandakishore.kumar@wibmodc.com
bbb1df53fd01c7338b7676917cd898a13c349365
9739360e173b4219658401f38a491f579d73d27c
/src/com/service/IUserService.java
95a7fc55d71828ba511644d290eede51ec49c62a
[]
no_license
Yangdarong/1507052436
cdeeeabe029dc19a7270407853c39d2cf808f150
fca1b7b5739a2bf8ac2befbfdba2819dc1e8687a
refs/heads/master
2020-03-21T13:29:48.273192
2018-06-28T06:24:49
2018-06-28T06:24:49
138,609,061
0
0
null
null
null
null
UTF-8
Java
false
false
362
java
package com.service; import java.util.List; import com.beans.User; /** * 用户的业务层接口 * @author 杨鑫荣 * */ public interface IUserService { /** * 用户登录 * @param userName 用户名 * @param userPasswd 密码 * @return 查询到的用户 */ List<User> userLogin(String userName, String userPasswd); }
[ "yxr800@icloud.com" ]
yxr800@icloud.com
54d7ad5fa873e5e07bdb6efe98203967e3c63422
e6c17206cdf91f27ff75da257893ea0822c552af
/algorithm/src/newYear/FibSolution.java
e9093d50ceaae5a8a284496718152916afb91f5e
[ "Apache-2.0" ]
permissive
chenxiaoyanemile/algorithm
8faf4f7d5e861d1a7d8e24029ab8adbb3282327d
043cec569c410404e86df3dccb48031b54db64e2
refs/heads/master
2021-06-10T13:29:38.761753
2021-05-18T02:19:29
2021-05-18T02:19:29
179,201,911
0
0
null
null
null
null
GB18030
Java
false
false
535
java
package newYear; /** * 509. 斐波那契数列 * 通常用 F(n) 表示,形成的序列成为 斐波那契数列。 * 该数列由0 和 1 开始,后面的每一项数字都是前两项数字的和。 * F(0) = 0; * F(1) = 1; * F(n) = F(n-1) + F(n-2), n>1; * 给出 n ,请计算 F(n) * @author dell * */ public class FibSolution { public int fib(int n) { if(n < 2) { return n; } int p = 0; int q = 0; int r = 1; for(int i = 2; i <= n; ++i) { p = q; q = r; r = p+q; } return r; } }
[ "chenxiaoyanemile@gmail.com" ]
chenxiaoyanemile@gmail.com
8319499af235bc7724692358276a6b3bf181bdcd
8b9190a8c5855d5753eb8ba7003e1db875f5d28f
/sources/org/reactnative/barcodedetector/RNBarcodeDetector.java
94f3f72edc881121c1a1240cfe236bc83763709f
[]
no_license
stevehav/iowa-caucus-app
6aeb7de7487bd800f69cb0b51cc901f79bd4666b
e3c7eb39de0be6bbfa8b6b063aaa85dcbcee9044
refs/heads/master
2020-12-29T10:25:28.354117
2020-02-05T23:15:52
2020-02-05T23:15:52
238,565,283
21
3
null
null
null
null
UTF-8
Java
false
false
2,102
java
package org.reactnative.barcodedetector; import android.content.Context; import android.util.SparseArray; import com.google.android.gms.vision.barcode.Barcode; import com.google.android.gms.vision.barcode.BarcodeDetector; import org.reactnative.camera.utils.ImageDimensions; import org.reactnative.frame.RNFrame; public class RNBarcodeDetector { public static int ALL_FORMATS = 0; public static int ALTERNATE_MODE = 1; public static int INVERTED_MODE = 2; public static int NORMAL_MODE; private BarcodeDetector mBarcodeDetector = null; private int mBarcodeType = 0; private BarcodeDetector.Builder mBuilder; private ImageDimensions mPreviousDimensions; public RNBarcodeDetector(Context context) { this.mBuilder = new BarcodeDetector.Builder(context).setBarcodeFormats(this.mBarcodeType); } public boolean isOperational() { if (this.mBarcodeDetector == null) { createBarcodeDetector(); } return this.mBarcodeDetector.isOperational(); } public SparseArray<Barcode> detect(RNFrame rNFrame) { if (!rNFrame.getDimensions().equals(this.mPreviousDimensions)) { releaseBarcodeDetector(); } if (this.mBarcodeDetector == null) { createBarcodeDetector(); this.mPreviousDimensions = rNFrame.getDimensions(); } return this.mBarcodeDetector.detect(rNFrame.getFrame()); } public void setBarcodeType(int i) { if (i != this.mBarcodeType) { release(); this.mBuilder.setBarcodeFormats(i); this.mBarcodeType = i; } } public void release() { releaseBarcodeDetector(); this.mPreviousDimensions = null; } private void releaseBarcodeDetector() { BarcodeDetector barcodeDetector = this.mBarcodeDetector; if (barcodeDetector != null) { barcodeDetector.release(); this.mBarcodeDetector = null; } } private void createBarcodeDetector() { this.mBarcodeDetector = this.mBuilder.build(); } }
[ "steve@havelka.co" ]
steve@havelka.co
f6947cbffe5a4ea0e7055dc3c956f9b641fbafa9
2e1caf774338a58e7e9ed2f2c371a7d0efa61302
/polymorphism/src/overriding/Age.java
2f04de0806c51b8296f48327cb51d47ad2f6ca2f
[]
no_license
Anupamagiridharan/My-Training
554ec68d4463d0c0150d74eaa1824a0357b67918
587fc90dbe5f7fd044c55ffedae9224babad1b1c
refs/heads/master
2023-04-27T09:26:01.294326
2021-05-15T07:04:36
2021-05-15T07:04:36
367,561,497
0
0
null
null
null
null
UTF-8
Java
false
false
136
java
package overriding; public class Age extends Name{ void Print() { System.out.println("22"); } }
[ "noreply@github.com" ]
noreply@github.com
f17abcaf9dc97daf01e732cd0c977360149e5d12
ba44e8867d176d74a6ca0a681a4f454ca0b53cad
/resources/testscript/Workflow/Customization/Cust_API_GenUtil_getFormElementById_1Helper.java
d6ddbde578614ea34d8d0a82693d0068ad64ea6d
[]
no_license
eric2323223/FATPUS
1879e2fa105c7e7683afd269965d8b59a7e40894
989d2cf49127d88fdf787da5ca6650e2abd5a00e
refs/heads/master
2016-09-15T19:10:35.317021
2012-06-29T02:32:36
2012-06-29T02:32:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,389
java
// DO NOT EDIT: This file is automatically generated. // // Only the associated template file should be edited directly. // Helper class files are automatically regenerated from the template // files at various times, including record actions and test object // insertion actions. Any changes made directly to a helper class // file will be lost when automatically updated. package resources.testscript.Workflow.Customization; import com.rational.test.ft.object.interfaces.*; import com.rational.test.ft.object.interfaces.SAP.*; import com.rational.test.ft.object.interfaces.WPF.*; import com.rational.test.ft.object.interfaces.siebel.*; import com.rational.test.ft.object.interfaces.flex.*; import com.rational.test.ft.object.interfaces.dojo.*; import com.rational.test.ft.script.*; import com.rational.test.ft.vp.IFtVerificationPoint; /** * Script Name : <b>Cust_API_GenUtil_getFormElementById_1</b><br> * Generated : <b>2012/03/26 5:19:28 PM</b><br> * Description : Helper class for script<br> * Original Host : Windows XP x86 5.1 build 2600 Service Pack 2 <br> * * @since March 26, 2012 * @author test */ public abstract class Cust_API_GenUtil_getFormElementById_1Helper extends RationalTestScript { protected Cust_API_GenUtil_getFormElementById_1Helper() { setScriptName("testscript.Workflow.Customization.Cust_API_GenUtil_getFormElementById_1"); } }
[ "eric2323223@gmail.com" ]
eric2323223@gmail.com
cb0547005f08def4e9fe2d998e7935c495855a31
969cf02071e75497117d2a48bcef6a3034819e89
/commonLib/src/main/java/net/youmi/android/libs/common/download/ext/DownloadStatus.java
3f2a9b7fdcad22af37182d9f485719c6d9ba9c2d
[]
no_license
zhengyuqin/ProxyServerAndroid
18842ad3b5bc351a605a2cdbb376cab4d729ac70
0e812e8037241e274589ee20aac5c36997afb6fb
refs/heads/master
2020-04-06T15:00:00.455805
2016-10-21T10:08:01
2016-10-21T10:08:01
53,205,091
2
4
null
null
null
null
UTF-8
Java
false
false
403
java
package net.youmi.android.libs.common.download.ext; /** * app的下载状态 * Created by yxf on 14-9-22. */ public enum DownloadStatus { PENDING, DOWNLOADING, PAUSED, FAILED, FINISHED, DISABLE; public static DownloadStatus value2Name(int value) { for (DownloadStatus status : DownloadStatus.values()) { if (status.ordinal() == value) { return status; } } return null; } }
[ "zhengyuqin@youmi.net" ]
zhengyuqin@youmi.net
5dd3d1a5b87b572086a0afceaea3dbb145d0c18e
d322cc537c1495c2716f7a94aa5632c6a65d8acf
/project01/src/main/java/bitcamp/java87/project01/domain/Style.java
f7f3113f9896c7c3ee1eb6fbf2c1eabc1410fd07
[]
no_license
jwlee87/java87
fd0d616cb830be5f909e9adf388bfc8ca353de0d
56aa50810c7f61446f56c806fb5eb7efebe4a6cd
refs/heads/master
2020-12-24T12:20:03.182674
2016-12-21T15:01:40
2016-12-21T15:01:40
73,056,956
0
0
null
null
null
null
UTF-8
Java
false
false
6,052
java
package bitcamp.java87.project01.domain; public class Style { private int styleNo; private int userNo; private String fileName; private String styleTitle; private String styleInfo1; private String styleInfo2; private String styleInfo3; private String styleInfo4; private String styleInfo5; private String priceInfo1; private String priceInfo2; private String priceInfo3; private String priceInfo4; private String priceInfo5; private String infomation1; private String infomation2; private String infomation3; private String infomation4; private String infomation5; private String styleTagPosition1; private String styleTagPosition2; private String styleTagPosition3; private String styleTagPosition4; private String styleTagPosition5; private String hashTagString; private String styleDesc; public Style(){ } public int getProdNo() { return styleNo; } public void setProdNo(int styleNo) { this.styleNo = styleNo; } public int getUserNo() { return userNo; } public void setUserNo(int userNo) { this.userNo = userNo; } public String getFileName() { return fileName; } public void setFileName(String fileName) { this.fileName = fileName; } public String getStyleTitle() { return styleTitle; } public void setStyleTitle(String styleTitle) { this.styleTitle = styleTitle; } public String getStyleInfo1() { return styleInfo1; } public void setStyleInfo1(String styleInfo1) { this.styleInfo1 = styleInfo1; } public String getStyleInfo2() { return styleInfo2; } public void setStyleInfo2(String styleInfo2) { this.styleInfo2 = styleInfo2; } public String getStyleInfo3() { return styleInfo3; } public void setStyleInfo3(String styleInfo3) { this.styleInfo3 = styleInfo3; } public String getStyleInfo4() { return styleInfo4; } public void setStyleInfo4(String styleInfo4) { this.styleInfo4 = styleInfo4; } public String getStyleInfo5() { return styleInfo5; } public void setStyleInfo5(String styleInfo5) { this.styleInfo5 = styleInfo5; } public String getPriceInfo1() { return priceInfo1; } public void setPriceInfo1(String priceInfo1) { this.priceInfo1 = priceInfo1; } public String getPriceInfo2() { return priceInfo2; } public void setPriceInfo2(String priceInfo2) { this.priceInfo2 = priceInfo2; } public String getPriceInfo3() { return priceInfo3; } public void setPriceInfo3(String priceInfo3) { this.priceInfo3 = priceInfo3; } public String getPriceInfo4() { return priceInfo4; } public void setPriceInfo4(String priceInfo4) { this.priceInfo4 = priceInfo4; } public String getPriceInfo5() { return priceInfo5; } public void setPriceInfo5(String priceInfo5) { this.priceInfo5 = priceInfo5; } public String getInfomation1() { return infomation1; } public void setInfomation1(String infomation1) { this.infomation1 = infomation1; } public String getInfomation2() { return infomation2; } public void setInfomation2(String infomation2) { this.infomation2 = infomation2; } public String getInfomation3() { return infomation3; } public void setInfomation3(String infomation3) { this.infomation3 = infomation3; } public String getInfomation4() { return infomation4; } public void setInfomation4(String infomation4) { this.infomation4 = infomation4; } public String getInfomation5() { return infomation5; } public void setInfomation5(String infomation5) { this.infomation5 = infomation5; } public String getStyleTagPosition1() { return styleTagPosition1; } public void setStyleTagPosition1(String styleTagPosition1) { this.styleTagPosition1 = styleTagPosition1; } public String getStyleTagPosition2() { return styleTagPosition2; } public void setStyleTagPosition2(String styleTagPosition2) { this.styleTagPosition2 = styleTagPosition2; } public String getStyleTagPosition3() { return styleTagPosition3; } public void setStyleTagPosition3(String styleTagPosition3) { this.styleTagPosition3 = styleTagPosition3; } public String getStyleTagPosition4() { return styleTagPosition4; } public void setStyleTagPosition4(String styleTagPosition4) { this.styleTagPosition4 = styleTagPosition4; } public String getStyleTagPosition5() { return styleTagPosition5; } public void setStyleTagPosition5(String styleTagPosition5) { this.styleTagPosition5 = styleTagPosition5; } public String getHashTagString() { return hashTagString; } public void setHashTagString(String hashTagString) { this.hashTagString = hashTagString; } public String getStyleDesc() { return styleDesc; } public void setStyleDesc(String styleDesc) { this.styleDesc = styleDesc; } @Override public String toString() { return "Product [styleNo=" + styleNo + ", userNo=" + userNo + ", fileName=" + fileName + ", styleTitle=" + styleTitle + ", styleInfo1=" + styleInfo1 + ", styleInfo2=" + styleInfo2 + ", styleInfo3=" + styleInfo3 + ", styleInfo4=" + styleInfo4 + ", styleInfo5=" + styleInfo5 + ", priceInfo1=" + priceInfo1 + ", priceInfo2=" + priceInfo2 + ", priceInfo3=" + priceInfo3 + ", priceInfo4=" + priceInfo4 + ", priceInfo5=" + priceInfo5 + ", infomation1=" + infomation1 + ", infomation2=" + infomation2 + ", infomation3=" + infomation3 + ", infomation4=" + infomation4 + ", infomation5=" + infomation5 + ", styleTagPosition1=" + styleTagPosition1 + ", styleTagPosition2=" + styleTagPosition2 + ", styleTagPosition3=" + styleTagPosition3 + ", styleTagPosition4=" + styleTagPosition4 + ", styleTagPosition5=" + styleTagPosition5 + ", hashTagString=" + hashTagString + ", styleDesc=" + styleDesc + "]"; } }
[ "jwee0330@gmail.com" ]
jwee0330@gmail.com
4c8480f2d443e97760da50bf6b97f0ed11078b65
9a1c22254f675ce25ddff1ebe980a8de067e58b9
/src/Productos/Producido.java
b6f3ebbe461b241770d48cba8b196b0499be1d88
[]
no_license
mlugom/Quiz2POO
691ad6d6d83b554750dc40437d209170f7676a86
4f458bf815a6b08eaba06e99e8cd17774c60f9c3
refs/heads/master
2020-04-25T10:50:21.845768
2019-02-26T14:49:03
2019-02-26T14:49:03
172,723,708
0
0
null
null
null
null
UTF-8
Java
false
false
714
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Productos; import Eslabon.Farmer; import java.util.*; /** * * @author ELKIN RAMIREZ */ public class Producido extends Producto{ private int numLote; private ArrayList<Cultivado> matPrima; private ArrayList<Farmer> granjas; public Producido(String nombre, int numLote, ArrayList<Cultivado> matPrima, ArrayList<Farmer> granjas) { super(nombre); this.numLote = numLote; this.matPrima = matPrima; this.granjas = granjas; } }
[ "ELKIN RAMIREZ@10.208.41.68" ]
ELKIN RAMIREZ@10.208.41.68
0a65f608762376d0938208254b5dadd2db5dc3c2
96765d41016462aa3f2a92151df8f43cb175b2e3
/Project1RanaR/src/main/java/com/revature/servlets/ReturnImageFromDbServlet.java
d2f18cb0182a8e41410d006170d741bcd400ddd2
[]
no_license
1807July30Java/RanaR
21573ad2df61131ae5ca256c86e031b40b1c091f
bbf3d41221d275daba251af8fa781fa4dedbbb5e
refs/heads/master
2020-03-24T19:22:00.232524
2018-09-02T22:33:03
2018-09-02T22:33:03
142,922,091
0
0
null
null
null
null
UTF-8
Java
false
false
1,442
java
package com.revature.servlets; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.revature.dao.ReimbursementDAO; import com.revature.dao.ReimbursementDAOImpl; /** * Servlet implementation class ReturnImageFromDbServlet */ public class ReturnImageFromDbServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public ReturnImageFromDbServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Integer ticketId = Integer.parseInt(request.getParameter("ticketId")); ReimbursementDAO reim = new ReimbursementDAOImpl(); byte[] objFromDb = reim.retrieveImage(ticketId); response.setContentType("image/jpg"); response.getOutputStream().write(objFromDb); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }
[ "rishabh.r@hotmail.com" ]
rishabh.r@hotmail.com
f671d4f1551cd621550361ad5637455a8b3db7b0
db0e6e5053e8bc41bf0c774dcd3fec7853966286
/StreamApi/StreamAPI/src/streams/ImprimindoObjetos.java
c32a8287c51ae7df45b605c2ad21fd82176ed261
[ "MIT" ]
permissive
v4gh3tt1/WS_JavaCursos
12a79aea2b4497da4d446f3bbc2b8a7ed428e90f
9079b1a132e8cd11cb2a3e7b7178e761f639768b
refs/heads/master
2023-02-18T23:47:54.463619
2021-01-19T17:18:18
2021-01-19T17:18:18
323,122,599
0
0
MIT
2021-01-19T17:18:19
2020-12-20T17:05:25
CSS
IBM852
Java
false
false
1,032
java
package streams; import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.stream.Stream; public class ImprimindoObjetos { public static void main(String[] args) { // percorrer lista e imprimir dados List<String> aprovados = Arrays.asList("Lu", "Gui", "Luca", "Ana"); //forma mais simples de percorrer os elementos com lašo for for (int i = 0; i < aprovados.size(); i++) { System.out.println(aprovados.get(i)); } System.out.println("\n*-*-*-*-*-*-*-*-*"); // usando o foreach for(String nome: aprovados) { System.out.println(nome); } System.out.println("\n*-*-*-*-*-*-*-*-*"); // usando o Iterator, quando nao sabe a quantidade certa, usar while Iterator<String> it = aprovados.iterator(); while (it.hasNext()){ System.out.println(it.next()); } // usando strem ->lašo interno System.out.println("\n*-*-*-*-*-*-*-*-*"); Stream<String> st = aprovados.stream(); st.forEach(System.out::println); // lašo interno } }
[ "63205923+v4gh3tt1@users.noreply.github.com" ]
63205923+v4gh3tt1@users.noreply.github.com
0e299b3b23794aa2d3e65bf0517568545dde60d2
c8a64e1ff28a6fd87950c333d974b87111f64b45
/lab3/src/bsu/mmf/algorithms/lab3/ChainHashTable.java
50fb960cfc7bbfc963715b249b9241c80e8b0664
[]
no_license
annametelskaya/algorithms
3a008031221c799c1fdc49fde1f12b97850d85ff
391833bde9b8362f4461aac7a73e177da653fdd8
refs/heads/master
2020-03-29T12:04:21.308795
2018-12-21T19:37:18
2018-12-21T19:37:18
149,883,618
1
0
null
null
null
null
UTF-8
Java
false
false
1,343
java
package bsu.mmf.algorithms.lab3; public class ChainHashTable { private Chain[] array; private double A; public ChainHashTable(double a) { array = new Chain[Variables.ARRAY_SIZE]; for (int i = 0; i < array.length; i++) { array[i] = new Chain(); } A = a; } public int hashFunction(int value) { return (int) (value % Variables.CONST * A % 1 * Variables.ARRAY_SIZE); } public void insert(int[] arr) { for (int i = 0; i < arr.length; i++) { int index = hashFunction(arr[i]); array[index].insert(arr[i]); } } public LinkedList find(int key) { int index = hashFunction(key); return array[index].find(key); } public void delete(int key) { int index = hashFunction(key); array[index].delete(key); } public int findMaxChain() { int len = 0; for (int i = 0; i < array.length; i++) { if (array[i] != null) { if (len < array[i].getLen()) { len = array[i].getLen(); } } } return len; } public void display() { for (int j = 0; j < array.length; j++) { System.out.print("№" + j + ": "); array[j].display(); } } }
[ "annam.2620@gmail.com" ]
annam.2620@gmail.com
905d82dcc5919526a4cdf41a2980d368935e8485
b7ba2e23c9c3c5a5b7f7b8aed07d230f2184b512
/app/src/main/java/com/unicorn/easygo/activity/ScanShoppingCartActivity.java
14c83be8a28e4c04cf29efd0dee86188b39f1a61
[ "Apache-2.0" ]
permissive
haocdp/EasyGo
b477dbe99ce3c4bc2960d896ea32927f71ecf380
4e53f1621ba1b365a1cd7daf31b6801b95c0106a
refs/heads/dev
2021-01-23T12:32:48.646197
2017-07-05T01:08:32
2017-07-05T01:08:32
93,167,313
1
0
null
2017-06-18T06:12:37
2017-06-02T13:18:42
Java
UTF-8
Java
false
false
1,539
java
package com.unicorn.easygo.activity; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.TextView; import com.unicorn.easygo.EGOApplication; import com.unicorn.easygo.R; import com.unicorn.easygo.utils.FontUtil; public class ScanShoppingCartActivity extends AppCompatActivity { private TextView title; private TextView shoppingCartNo; private TextView textView; private TextView textView2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.scan_shopping_cart_result); title = (TextView) findViewById(R.id.title_text); shoppingCartNo = (TextView) findViewById(R.id.shoppingCartNo); textView = (TextView) findViewById(R.id.textView); textView2 = (TextView) findViewById(R.id.textView2); Intent intent = getIntent(); String scNo = intent.getStringExtra("shoppingCartNo").split("-")[1]; shoppingCartNo.setText(scNo); EGOApplication.getInstance().setHasBundCart(true); EGOApplication.getInstance().setShoppingCartNo(scNo); title.setText(getString(R.string.haveAScan)); setFonts(); } private void setFonts() { FontUtil.setFont(title, this.getAssets(), 0); FontUtil.setFont(shoppingCartNo, this.getAssets(), 0); FontUtil.setFont(textView, this.getAssets(), 0); FontUtil.setFont(textView2, this.getAssets(), 0); } }
[ "haoc_dp@163.com" ]
haoc_dp@163.com