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
81dce61b68c7ee1a1654737cfe4d17c0c0349da0
2b88432b01e34cfc6dd4ea254ba81a2aea916bac
/src/test/java/com/imd/services/AnimalSrvcTest.java
ec2c83aa6c84b3c25c9cbca5d54154ebceb69727
[ "Apache-2.0" ]
permissive
imdairies/imd-farm-solutions
028f00d55e571c3a428dc290c16a1c4a966e2cf6
b14d1b4e820f48e72acd09c1ff77d4803aaee6dd
refs/heads/master
2022-12-07T22:11:01.331576
2020-09-07T17:35:05
2020-09-07T17:35:05
153,991,918
0
0
Apache-2.0
2022-11-16T09:26:36
2018-10-21T09:27:20
Java
UTF-8
Java
false
false
2,209
java
package com.imd.services; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import com.imd.services.bean.AnimalBean; import com.imd.util.IMDLogger; import com.imd.util.Util; class AnimalSrvcTest { @BeforeAll static void setUpBeforeClass() throws Exception { } @AfterAll static void tearDownAfterClass() throws Exception { } @BeforeEach void setUp() throws Exception { } @AfterEach void tearDown() throws Exception { } @Test void testFarmInseminationScreenRecordSorting() { try { AnimalSrvc srvc = new AnimalSrvc(); int originalLoggingMode = IMDLogger.loggingMode; IMDLogger.loggingMode = Util.WARNING; String responseJson = srvc.getAdultFemaleCows(new AnimalBean()).getEntity().toString(); String[] animalJsons = responseJson.split("\n}"); if (animalJsons.length > 0) { double hours = 9999999; for (int i=0; i<animalJsons.length; i++) { String animalRecord = animalJsons[i]; int start = animalRecord.indexOf("hoursSinceInsemination\":"); if (start >= 0) { start = animalRecord.indexOf("hoursSinceInsemination\":") + "hoursSinceInsemination\":\"".length(); int end = animalRecord.indexOf("\"",start); assertTrue(hours >= Double.parseDouble(animalRecord.substring(start,end)),"Animals are not correctly sorted in descending order of their insemination date. Previous record's hoursSinceInsemination was: " + hours + " and the current record's hoursSinceInsemination is: " + Double.parseDouble(animalRecord.substring(start,end)) + " so we encountered an older record which was placed below a recent record - this should have been other way around"); hours = Double.parseDouble(animalRecord.substring(start,end)); // IMDLogger.log( "Record " + (i+1) + ") hours are: " + hours,Util.WARNING); } } } IMDLogger.loggingMode = originalLoggingMode; } catch (Exception ex) { ex.printStackTrace(); fail("Exception occurred while running unit test: AnimalSrvc.testGetAdultFemaleCows " + ex.getMessage()); } } }
11310985c2633b4225a323bb0122dccca5a5f7f0
3f098726f771a9506216255300f47d17e448dde3
/Source_Scripte/src/vl09/logging/LoggingHandler.java
71ae965a29b234c64b43de654ec538993554dc41
[]
no_license
CoffieRalf/LearnPM
200e2f88e380736ca992a0280b8d7313d45f02a1
1556719c595a9ecedbca502a0dd6eb9bb9ac24cf
refs/heads/master
2020-04-02T12:57:55.335881
2016-07-02T16:46:49
2016-07-02T16:46:49
61,121,251
0
0
null
null
null
null
UTF-8
Java
false
false
1,055
java
package vl09.logging; import java.util.logging.ConsoleHandler; import java.util.logging.Level; import java.util.logging.Logger; /** * @author Carsten Gips * @since 27.02.2016 * */ public class LoggingHandler { private static Logger log = Logger.getLogger(LoggingHandler.class.getName()); public static void main(String[] argv) { log.setUseParentHandlers(false); // ??? :-) // log.setLevel(Level.FINE); // log.setLevel(Level.ALL); ConsoleHandler handlerA = new ConsoleHandler(); handlerA.setLevel(Level.ALL); handlerA.setFormatter(new MyFormatter("A")); log.addHandler(handlerA); ConsoleHandler handlerB = new ConsoleHandler(); handlerB.setLevel(Level.FINER); handlerB.setFormatter(new MyFormatter("B")); log.addHandler(handlerB); log.finest("finest"); log.finer("finer"); log.fine("fine"); log.info("info"); log.warning("warning"); log.severe("severe"); } }
09b2c8936ddb3e8cc6b3ae5ec36e368a7fd27f55
bc60e04c60f968d2a35e06a0a51fb19da8f9820b
/src/main/java/org/mickey/data/structure/queue/PriorityQueue.java
95eb6d11e1c991ab8a2076d77856cc352e93fac4
[]
no_license
xiaozefeng/data-structures
550299565a001e11b0554ea866b994d9f875ee4d
fb4504e8cbc077300643060e0a0b7d8a2511d8bf
refs/heads/master
2022-12-26T22:31:05.785114
2020-07-03T03:12:51
2020-07-03T03:12:51
270,243,942
0
0
null
2020-10-13T22:37:21
2020-06-07T08:34:59
Java
UTF-8
Java
false
false
731
java
package org.mickey.data.structure.queue; import org.mickey.data.structure.heap.MaxHeap; /** * @author mickey * @date 6/13/20 21:50 */ public class PriorityQueue<E extends Comparable<E>> implements Queue<E> { private final MaxHeap<E> maxHeap; public PriorityQueue(){ maxHeap = new MaxHeap<>(); } @Override public int getSize() { return maxHeap.getSize(); } @Override public boolean isEmpty() { return maxHeap.isEmpty(); } @Override public void enqueue(E e) { maxHeap.add(e); } @Override public E dequeue() { return maxHeap.extraMax(); } @Override public E getFront() { return maxHeap.findMax(); } }
e63f9c3a8b8361101c05e19f43017351184d2187
00d1b310d2c7c6acee47fa12d1aeb76117d4596f
/DijkstraAlgorithmProject/src/Node.java
b3b43f1a2ae2d94caea7684c64cdfeb99925727c
[]
no_license
nikolaushendrawan/Djikstra-Algorithm-Project
1c16546966f340155dc3276a754a389aace489a8
14c35b21ffaff7f3579aeddc5ec19029bc679357
refs/heads/main
2023-04-30T16:45:41.299498
2021-05-21T05:00:24
2021-05-21T05:00:24
369,418,228
0
0
null
null
null
null
UTF-8
Java
false
false
996
java
public class Node { final private String id; final private String name; public Node(String id, String name) { this.id = id; this.name = name; } public String getId() { return id; } public String getName() { return name; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Node other = (Node) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; return true; } @Override public String toString() { return name; } }
016d7e7a06eacd8faf9cd1453e56c939648920d3
422610dc875409d341ad45ce2337b9685cee7203
/spring-rest-client/src/main/java/com/raj/employee/serviceImpl/EmployeeServiceImpl.java
c04c2d538ed966bce9277c02b57df40611034509
[]
no_license
Raj-Tomar/spring-rest-client
e5f88d077dc85aa03ee0ea3b0f6ee0a87840218f
fb9f446b6237b05e5aa44e4ac46b3fb4160d4a06
refs/heads/master
2020-06-14T16:16:37.741322
2017-03-07T05:46:44
2017-03-07T05:46:44
75,160,609
0
0
null
null
null
null
UTF-8
Java
false
false
2,744
java
package com.raj.employee.serviceImpl; import java.util.ArrayList; import java.util.List; import org.apache.log4j.Logger; import org.json.JSONArray; import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.google.gson.Gson; import com.raj.employee.dto.EmployeeDto; import com.raj.employee.service.EmployeeService; import com.raj.project.environment.ProjectConfiguration; import com.raj.util.WebServiceUtil; @Service public class EmployeeServiceImpl implements EmployeeService{ @Autowired WebServiceUtil webService; private static Logger LOGGER = Logger.getLogger(EmployeeServiceImpl.class); @Override public String saveOrUpdateEmployee(EmployeeDto dto) { JSONObject input = new JSONObject(); input.put("emp", new JSONObject(dto)); String status = "0"; try { String url = ProjectConfiguration.serviceUrl + "/saveOrUpdateEmployee"; status = webService.getStatus(input, url, null, null); } catch (Exception e) { LOGGER.error("Exception: "+e.getMessage()); } return status; } @Override public List<EmployeeDto> getAllEmployee() { List<EmployeeDto> list = new ArrayList<EmployeeDto>(); try { String url = ProjectConfiguration.serviceUrl + "/getAllEmployee"; JSONObject jObj = webService.getResponse(new JSONObject(), url, null, null); if(null != jObj){ JSONArray jArray = jObj.getJSONArray("empList"); for(int i=0; i<jArray.length(); i++){ EmployeeDto dto = new Gson().fromJson(jArray.get(i).toString(), EmployeeDto.class); list.add(dto); } LOGGER.info("Total Employees: "+list.size()); } } catch (Exception e) { LOGGER.error("Exception: "+e.getMessage()); } return list; } @Override public EmployeeDto getEmployeeById(String id) { EmployeeDto dto = null; JSONObject input = new JSONObject(); input.put("empId", id); try { String url = ProjectConfiguration.serviceUrl + "/getEmployeeById"; JSONObject jObj = webService.getResponse(input, url, null, null); if(null != jObj){ dto = new Gson().fromJson(jObj.get("emp").toString(), EmployeeDto.class); } } catch (Exception e) { e.printStackTrace(); LOGGER.error("Exception: "+e.getMessage()); } return dto; } @Override public String deleteEmployee(String id) { String status = null; JSONObject input = new JSONObject(); input.put("empId", id); try { String url = ProjectConfiguration.serviceUrl + "/deleteEmployee"; status = webService.getStatus(input, url, null, null); } catch (Exception e) { LOGGER.error("Exception: "+e.getMessage()); } return status; } }
c2342063f3290227020b35550e0486d3e4362f77
7a4364c70f101a077a4b9d4433f9a1d5cfb06c49
/src/main/java/com/addToCart/step/DressesStep.java
02e51c33313215a5f04f03d1eccac469b74621b0
[]
no_license
latajacysmok/Add-to-cart-Test_Selenium
8c72c42c66149a0165867ace02dbdc9f396e62f7
07ceb8d9371d78f3e551ae0246d941b68395a4b6
refs/heads/master
2022-11-11T14:36:23.236205
2020-06-25T06:33:37
2020-06-25T06:33:37
274,845,425
0
0
null
null
null
null
UTF-8
Java
false
false
466
java
package com.addToCart.step; import com.addToCart.page.DressesPage; import io.cucumber.java8.En; public class DressesStep implements En { DressesPage dressespage; public DressesStep(HomepageStep homepageStep) { When("User selects a {string}", (String category) -> { dressespage = homepageStep.getHomePage().clickDressesButton(category); }); } public DressesPage getDressespage() { return dressespage; } }
341e66c1f409fff50eef6babc623898acb71ed3b
9ece4a3aa9eeef33a806b0da300bed89913cd648
/springboot-shiro2/src/main/java/com/spring/springboot/bean/Account.java
90cae875b464d32c00778f5ed9885d3ad7705039
[]
no_license
phyllisYongzhi/springboot-learning-example-1
a01368c4d6bfd1336a28d65cc923f3a0408ece4f
eb1ca011f90be2f94363fffdd4df0565e3964fa2
refs/heads/master
2020-05-15T12:27:48.218598
2018-07-03T06:31:44
2018-07-03T06:31:44
182,264,194
1
0
null
2019-04-19T12:51:34
2019-04-19T12:51:34
null
UTF-8
Java
false
false
489
java
/* * Copyright (C) 2009-2016 Hangzhou 2Dfire Technology Co., Ltd. All rights reserved */ package com.spring.springboot.bean; import lombok.Data; /** * Account * * @author 萝卜丝 * @since 2017-10-21 */ @Data public class Account { /** * 用户id */ private String id; /** * 用户名 */ private String name; /** * 密码 */ private String password; /** * 用户状态 */ private Integer accountState; }
9d69e737b60faff307a120a18e6cc5d6d4ce04a9
a66d44ea1fc204e34e1670bf5ee90a0572f98729
/src/main/java/com/java/design/patterns/strategy/MainTest.java
c92bf77087042ede478ecf00902a0af8a6701c48
[]
no_license
yoganandj/Java8Features
dbc8d9de1bb6bdefc7b9ea332114c977920e656f
79b76be0ee3f73677132815fe6ea0d5a0b44fd64
refs/heads/master
2023-08-13T23:05:28.851244
2021-09-21T16:44:25
2021-09-21T16:44:25
267,607,437
0
0
null
null
null
null
UTF-8
Java
false
false
1,089
java
package com.java.design.patterns.strategy; import com.java.design.patterns.strategy.services.BookingService; import com.java.design.patterns.strategy.util.PaymentType; import java.util.Date; public class MainTest { public final static PaymentType paymentType = PaymentType.CASH; public final static Integer amount = 1000; public static void main(String[] args) { Booking booking = new Booking(); booking.setDateOfBooking(new Date()); booking.setId(1); Payment payment; switch (paymentType){ case CASH: payment = new Payment(new Date(),new Date(), amount, booking); case NET_BANKING: payment = new Payment(new Date(),new Date(), amount, booking); case CREDIT_CARD: payment = new Payment(new Date(),new Date(), amount, booking); default: payment = new Payment(new Date(),new Date(), amount, booking); } BookingService bookingService = new BookingService(); bookingService.startBooking(booking, payment); } }
097b555433d3c482e54d45869fa1279fd6d7cae6
c8cf65dddaf796519019267be49e72c0a3bf9336
/AdvLoops1/src/com/company/Main.java
16e7c23ce68951299dcf1dbd300be92d8bc71d1d
[]
no_license
skai129/preogrammingClassWork
f60c38d40f205c3f3cce10681eb972119de727eb
55578ae91cda1ce13e2f830f38d60d58a8b706b5
refs/heads/master
2020-04-07T09:47:41.865435
2019-03-04T16:49:06
2019-03-04T16:49:06
158,265,378
0
0
null
null
null
null
UTF-8
Java
false
false
1,830
java
package com.company; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner console = new Scanner(System.in); //get first number from user int number1; while(true) { System.out.println("Enter a number"); try { number1 = Integer.valueOf(console.nextLine()); break; } catch (NumberFormatException ex) { System.out.println("Bad input."); continue; } } //get second number from user int number2; while(true) { System.out.println("Enter a number"); try { number2 = Integer.valueOf(console.nextLine()); break; } catch (NumberFormatException ex) { System.out.println("Bad input."); continue; } } //find prime numbers between first two numbers //put smaller of the inputs into smallerNum int smallerNum = 0; int largerNum = 0; if (number1 <= number2){ smallerNum = number1; largerNum = number2; } else if (number1 > number2){ smallerNum = number2; largerNum = number1; } int i = smallerNum; if (smallerNum < 2){ i = 2; } while (i <= largerNum){ //check to see if i is prime boolean Prime = true; int num = 2; while (num < i){ if(i%num==0){ Prime = false; } num++; } //if i is prime, print i if(Prime){ System.out.println(i); } i++; } } }
9a24663162a18641e0f1fdcd2d784459160b29b0
db8ed472df2ce4dc71a1694ab219ee27787c7bf8
/Authentication Microservice/src/main/java/org/wells/service/AuthenticationService.java
927f45352b100df8bd06355d6cf3ddf4e59f14c2
[]
no_license
tantrojan/wellsfargo_stockMarket_backend
1148bdf01caab71174d693d137bdd71efa360bca
4da0ee5391af291451710dd3d650c3526c6f45cd
refs/heads/master
2022-12-16T06:58:24.134542
2020-09-15T11:42:40
2020-09-15T11:42:40
291,931,990
0
4
null
null
null
null
UTF-8
Java
false
false
2,412
java
package org.wells.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Service; import org.wells.models.AddUserRequest; import org.wells.models.LoginRequest; import org.wells.models.User; import org.wells.models.enums.UserTypes; import org.wells.util.UserRepository; import java.util.ArrayList; @Service public class AuthenticationService implements UserDetailsService { @Autowired private UserRepository userRepository; @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { User user = userRepository.findByUsername(username); if(user==null) { throw new UsernameNotFoundException("Error: User not found with username: " + username); } return new org.springframework.security.core.userdetails.User(user.getUsername(), user.getPassword(), new ArrayList<>()); } public boolean checkAdmin(LoginRequest user) throws DataIntegrityViolationException { User user1 = userRepository.findByUsername(user.getUsername()); if(user1.getUserType()==UserTypes.ADMIN) return true; return false; } public boolean checkExistingUserName(User user) throws DataIntegrityViolationException { User user1 = userRepository.findByUsername(user.getUsername()); if(user1==null) return true; return false; } public boolean checkExistingEmail(User user) throws DataIntegrityViolationException { User user1 = userRepository.findByEmail(user.getEmail()); if(user1==null) return true; return false; } public boolean checkExistingMobile(User user) throws DataIntegrityViolationException { User user1 = userRepository.findByMobile(user.getMobile()); if(user1==null) return true; return false; } public User save(User userRequest) { userRequest.setUserType(UserTypes.CONSUMER); userRequest.setConfirmed(true); return userRepository.save(userRequest); } }
261bfb27dcb22c5db701f67ab90553ffef455383
89533a5af6667c2630d1ccaeaaaca1eb2ee53916
/offer25/Solution.java
7fb0a853259b891e02c1376a0453fbff51ff2f28
[]
no_license
hrzgj/leetcode
0e21b52fac64ff4864a5b75d5f94e99d56fbb4b6
31f0ce6083a2a31a1038b864f70e1127a6e085e5
refs/heads/master
2023-04-29T04:29:24.738161
2021-05-01T14:26:08
2021-05-01T14:26:08
291,267,770
0
0
null
null
null
null
UTF-8
Java
false
false
659
java
package offer25; /** * @author: chenyu * @date: 2021/1/10 10:10 */ class ListNode { int val; ListNode next; ListNode(int x) { val = x; } } public class Solution { public ListNode mergeTwoLists(ListNode l1, ListNode l2) { ListNode head=new ListNode(0); ListNode res=head; while (l1!=null&&l2!=null){ if(l1.val<l2.val){ head.next=l1; head=l1; l1=l1.next; }else { head.next=l2; head=l2; l2=l2.next; } } head.next=l1==null?l2:l1; return res.next; } }
598b35b447f9461456562d96f2abbd23b8895093
8313b76091c5dfae5d6541c1381996d502090d23
/src/main/java/com/xyz/changeit/web/controller/GreetingController.java
d4be4e7e54057c239f0d0ec4a73f0dfecc12c374
[]
no_license
marcfab/changeit-backend
cca5542277d7d8f8898ae09a5e2bd95a870d822e
cecaac40f08f59944142cbc5ed6ba17dfec92a4f
refs/heads/master
2021-01-10T07:13:32.688709
2016-01-10T23:07:54
2016-01-10T23:07:54
49,389,380
0
0
null
null
null
null
UTF-8
Java
false
false
745
java
package com.xyz.changeit.web.controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; /** * Created by Marc on 09/01/2016. */ @RestController public class GreetingController { static class Gretting { private String greeting; public Gretting(String greeting) { this.greeting = greeting; } public String getGreeting() { return greeting; } } @RequestMapping("/greeting") public Gretting greeting(@RequestParam(value="name", defaultValue="World") String name) { return new Gretting("Hello " + name); } }
b30b82fda1d86ea005f0bb396e145700cec4b051
287dc1683f7e19a5239c2b8addbc8531809f9177
/DebugDesignPatterns/src/com/az/pattern/behavioral/chap18iterator/Test.java
412a691cbff177454a6152894a4c593f7a662741
[ "Apache-2.0" ]
permissive
yaominzh/CodeLrn2019
ea192cf18981816c6adafe43d85e2462d4bc6e5d
adc727d92904c5c5d445a2621813dfa99474206d
refs/heads/master
2023-01-06T14:11:45.281011
2020-10-28T07:16:32
2020-10-28T07:16:32
164,027,453
2
0
Apache-2.0
2023-01-06T00:39:06
2019-01-03T22:02:24
C++
UTF-8
Java
false
false
1,416
java
package com.az.pattern.behavioral.chap18iterator; public class Test { public static void main(String[] args) { Course course1 = new Course("Java电商一期"); Course course2 = new Course("Java电商二期"); Course course3 = new Course("Java设计模式精讲"); Course course4 = new Course("Python课程"); Course course5 = new Course("算法课程"); Course course6 = new Course("前端课程"); CourseAggregate courseAggregate = new CourseAggregateImpl(); courseAggregate.addCourse(course1); courseAggregate.addCourse(course2); courseAggregate.addCourse(course3); courseAggregate.addCourse(course4); courseAggregate.addCourse(course5); courseAggregate.addCourse(course6); System.out.println("-----课程列表-----"); printCourses(courseAggregate); courseAggregate.removeCourse(course4); courseAggregate.removeCourse(course5); System.out.println("-----删除操作之后的课程列表-----"); printCourses(courseAggregate); } public static void printCourses(CourseAggregate courseAggregate){ CourseIterator courseIterator= courseAggregate.getCourseIterator(); while(!courseIterator.isLastCourse()){ Course course=courseIterator.nextCourse(); System.out.println(course.getName()); } } }
d989357ff0c3fa46103cf428682f18259321c6af
5d53d16d73baa8093ecdb909de9ff44275ed1d4a
/src/test/java/org/seckill/mapper/SuccesskillMapperTest.java
f231b12e48e08ea34d2c20ad9ee1848c651c1028
[ "Apache-2.0" ]
permissive
Zihaoo/Seckill-System
195980035096c6781feb71d9944ab1d1eb7e7e47
74f9a6efe12f7d979901050378b59dd344059555
refs/heads/master
2020-03-12T23:58:44.811095
2018-05-16T13:34:51
2018-05-16T13:34:51
130,877,676
2
0
null
null
null
null
UTF-8
Java
false
false
1,032
java
package org.seckill.mapper; import org.junit.Test; import org.junit.runner.RunWith; import org.seckill.model.SuccessKilled; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import javax.annotation.Resource; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration({"classpath:spring/spring-dao.xml"}) public class SuccesskillMapperTest { @Resource private SuccesskillMapper successkillMapper; @Test public void insertSuccessKilled() { long id = 1000L; long phone = 34131241L; int count = successkillMapper.insertSuccessKilled(id, phone); System.out.println("count:" + count); } @Test public void queryByIdWithSeckill() { long id = 1000L; long phone = 34131241L; SuccessKilled successKilled = successkillMapper.queryByIdWithSeckill(id, phone); System.out.println(successKilled); System.out.println(successKilled.getSeckill()); } }
5bef5580d45ddd65d173ec7a893efbd54702f4dc
deb1fbbb342781d5306ef91a82f9751dabdbf156
/SpringBootJpaQueryDsl/src/main/java/com/develeaf/study/sample/repository/UserRepositoryCustom.java
aed168fd6f501e6c8453b0401fc3a413ef735500
[]
no_license
kis6905/Spring
75ea34f5acb782cefc2a8bcb0918e09b21a3459c
970791d69ed5a907a360741b7d74affd37ae7425
refs/heads/master
2022-12-23T09:27:18.946631
2020-06-29T07:11:23
2020-06-29T07:11:23
65,356,438
0
0
null
2022-12-16T04:35:39
2016-08-10T06:28:52
JavaScript
UTF-8
Java
false
false
181
java
package com.develeaf.study.sample.repository; import com.develeaf.study.sample.entity.UserEntity; public interface UserRepositoryCustom { UserEntity findByName(String userId); }
529a3b43fb96b75ea6aa2661d502f5b53fda40c0
41fff7ff3ffaae0a681a1f34f2785701aace448c
/src/main/java/cn/xianyijun/planet/common/store/SimpleDataStore.java
1d039d707a2709d53fa505d1c86c0f52b10c1f8c
[ "MIT" ]
permissive
xianyijun/planet
584c977174f6b3ed427f6465c7747f023c8f29b0
51b5957bfe560965a911137048bab2f4feff1f4f
refs/heads/master
2021-09-13T10:17:13.850611
2018-04-19T17:24:59
2018-04-19T17:24:59
121,255,263
1
1
null
null
null
null
UTF-8
Java
false
false
1,506
java
package cn.xianyijun.planet.common.store; import java.util.HashMap; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; /** * The type Simple data store. * @author xianyijun */ public class SimpleDataStore implements DataStore { private ConcurrentMap<String, ConcurrentMap<String, Object>> data = new ConcurrentHashMap<String, ConcurrentMap<String, Object>>(); @Override public Map<String, Object> get(String componentName) { ConcurrentMap<String, Object> value = data.get(componentName); if (value == null) { return new HashMap<>(); } return new HashMap<>(value); } @Override public Object get(String componentName, String key) { if (!data.containsKey(componentName)) { return null; } return data.get(componentName).get(key); } @Override public void put(String componentName, String key, Object value) { Map<String, Object> componentData = data.get(componentName); if (null == componentData) { data.putIfAbsent(componentName, new ConcurrentHashMap<String, Object>()); componentData = data.get(componentName); } componentData.put(key, value); } @Override public void remove(String componentName, String key) { if (!data.containsKey(componentName)) { return; } data.get(componentName).remove(key); } }
74fa3070aaf8b84684e454fd56ee63247c53683b
df8fbf2d740ad2bd23ac54c99d075e9103b59e49
/src/main/java/com/github/cuter44/wxpay/reqs/CloseOrder.java
e3f24646f8a192adbd85e5294972fcdfbe04862f
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
permissive
Nevergiveupp/wxpay-sdk
1360090d29b19916c108ffbb28bdd29182ef10e4
fb5e375280508d639935d0c1b952eab778049fdb
refs/heads/master
2020-05-19T16:49:57.532672
2018-05-05T15:24:55
2018-05-05T15:28:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,030
java
package com.github.cuter44.wxpay.reqs; import java.util.Arrays; import java.util.List; import java.util.Properties; import java.io.InputStream; import java.io.IOException; import java.io.UnsupportedEncodingException; import com.github.cuter44.wxpay.resps.CloseOrderResponse; import com.github.cuter44.wxpay.WxpayException; import com.github.cuter44.wxpay.WxpayProtocolException; /** 关闭订单 * @Author "cuter44"&lt;[email protected]&gt; */ public class CloseOrder extends WxpayRequestBase{ public static final String URL_API_BASE = "https://api.mch.weixin.qq.com/pay/closeorder"; public static final String KEY_OUT_TRADE_NO = "out_trade_no"; public static final List<String> KEYS_PARAM_NAME = Arrays.asList( "appid", "mch_id", "nonce_str", "out_trade_no", "sign" ); //CONSTRUCT public CloseOrder(Properties prop){ super(prop); return; } //BUILD @Override public CloseOrder build() { return(this); } //SIGN @Override public CloseOrder sign() throws UnsupportedEncodingException { super.sign(KEYS_PARAM_NAME); return(this); } // TO_URL public String toURL() throws UnsupportedOperationException { throw( new UnsupportedOperationException("This request does not execute on client side.") ); } // EXECUTE @Override public CloseOrderResponse execute() throws WxpayException, WxpayProtocolException, IOException { String url = URL_API_BASE; String body = super.buildXMLBody(KEYS_PARAM_NAME); InputStream respXml = super.executePostXML(url, body); return(new CloseOrderResponse(respXml)); } /** 商户系统内部的订单号,32个字符内、可包含字母 */ public CloseOrder setOutTradeNo(String outTradeNo) { super.setProperty(KEY_OUT_TRADE_NO, outTradeNo); return(this); } }
89ae418538a4146d49758a30ae0d68a5d2573e20
7b5eb1275a63852950677b92ec40fd1b957b7b97
/src/main/java/com/continuum/cucumber/plugin/maven/cucup/testng/TestNGXMLCreator.java
dc7a6c9251f1d071c15922d2e1178034244ad45e
[]
no_license
continuum-akash-dubey/cucup-maven-plugin
677b80f4bb8cc0879934271a785e094b32048583
9a56075fd1e15e5d002db29302cc9709588cdf20
refs/heads/master
2022-12-29T11:19:35.954040
2020-04-27T11:47:05
2020-04-27T11:47:05
257,551,201
0
0
null
2020-10-13T21:22:37
2020-04-21T09:53:35
Java
UTF-8
Java
false
false
2,907
java
package com.continuum.cucumber.plugin.maven.cucup.testng; import java.io.File; import java.util.List; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; import com.continuum.cucumber.plugin.maven.cucup.runner.TestRunner; public class TestNGXMLCreator { private TestNGXMLCreator() { throw new AssertionError("Cannot create TestNGXMLCreator instance"); } public static void createTestNGXMLFileForRunners(File baseDirectoryForXml, String testNGFileName, List<TestRunner> testRunners) throws ParserConfigurationException, TransformerException { DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.newDocument(); Element suiteNode = doc.createElement("suite"); Attr suiteName = doc.createAttribute("name"); suiteName.setValue("Parallel-Suite"); Attr parallel = doc.createAttribute("parallel"); parallel.setValue("tests"); suiteNode.setAttributeNode(suiteName); suiteNode.setAttributeNode(parallel); doc.appendChild(suiteNode); for (TestRunner testRunner : testRunners) { Element testNode = doc.createElement("test"); Attr testName = doc.createAttribute("name"); testName.setValue(testRunner.getCucumberRunnerClassName()); testNode.setAttributeNode(testName); Element classesNode = doc.createElement("classes"); Element classNode = doc.createElement("class"); Attr className = doc.createAttribute("name"); className.setValue(testRunner.getPackageDefinition() + "." + testRunner.getCucumberRunnerClassName()); classNode.setAttributeNode(className); classesNode.appendChild(classNode); testNode.appendChild(classesNode); suiteNode.appendChild(testNode); } TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, "http://testng.org/testng-1.0.dtd"); DOMSource source = new DOMSource(doc); File testNGLocationToStore = new File(baseDirectoryForXml, testNGFileName); StreamResult result = new StreamResult(testNGLocationToStore); transformer.transform(source, result); } }
91d8687b85c01ea32ae05c0419afe1980e70e34e
9e8e1f19fd5dd0d625877a701e72069bcb146547
/apkToolexipiry/working/libs/classes-dex2jar/com/payu/payuui/Adapter/PagerAdapter.java
10abf7aaa935b38a624d66169d1789766d5e096b
[]
no_license
Franklin2412/Laminin
65908dd862779d73095a38e604e37c989462beb2
e5cd5c673e9830c0dffd28155aeb5196f534c80e
refs/heads/master
2021-01-24T10:11:29.864611
2016-10-01T05:10:35
2016-10-01T05:10:35
69,677,383
1
0
null
null
null
null
UTF-8
Java
false
false
5,645
java
package com.payu.payuui.Adapter; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentStatePagerAdapter; import com.payu.india.Model.PayuResponse; import java.util.ArrayList; import java.util.HashMap; public class PagerAdapter extends FragmentStatePagerAdapter { private HashMap<Integer, Fragment> mPageReference; private ArrayList<String> mTitles; private HashMap<String, String> oneClickCardTokens; private PayuResponse payuResponse; private int storeOneClickHash; private PayuResponse valueAddedResponse; public PagerAdapter(FragmentManager fragmentManager, ArrayList<String> arrayList, PayuResponse payuResponse, PayuResponse payuResponse2, int i, HashMap<String, String> hashMap) { super(fragmentManager); this.mPageReference = new HashMap(); this.mTitles = arrayList; this.payuResponse = payuResponse; this.valueAddedResponse = payuResponse2; this.storeOneClickHash = i; this.oneClickCardTokens = hashMap; } public int getCount() { return this.mTitles != null ? this.mTitles.size() : 0; } public Fragment getFragment(int i) { return (Fragment) this.mPageReference.get(Integer.valueOf(i)); } /* JADX WARNING: inconsistent code. */ /* Code decompiled incorrectly, please refer to instructions dump. */ public android.support.v4.app.Fragment getItem(int r5) { /* r4 = this; r1 = new android.os.Bundle; r1.<init>(); r0 = r4.mTitles; r0 = r0.get(r5); r0 = (java.lang.String) r0; r2 = r0.hashCode(); switch(r2) { case 230940746: goto L_0x001a; case 354155769: goto L_0x0024; case 955363427: goto L_0x002e; case 1775079309: goto L_0x0038; default: goto L_0x0014; }; L_0x0014: r0 = -1; L_0x0015: switch(r0) { case 0: goto L_0x0042; case 1: goto L_0x007d; case 2: goto L_0x00bd; case 3: goto L_0x00e6; default: goto L_0x0018; }; L_0x0018: r0 = 0; L_0x0019: return r0; L_0x001a: r2 = "Saved Cards"; r0 = r0.equals(r2); if (r0 == 0) goto L_0x0014; L_0x0022: r0 = 0; goto L_0x0015; L_0x0024: r2 = "Credit/Debit Cards"; r0 = r0.equals(r2); if (r0 == 0) goto L_0x0014; L_0x002c: r0 = 1; goto L_0x0015; L_0x002e: r2 = "Net Banking"; r0 = r0.equals(r2); if (r0 == 0) goto L_0x0014; L_0x0036: r0 = 2; goto L_0x0015; L_0x0038: r2 = "PayU Money"; r0 = r0.equals(r2); if (r0 == 0) goto L_0x0014; L_0x0040: r0 = 3; goto L_0x0015; L_0x0042: r0 = new com.payu.payuui.Fragment.SavedCardsFragment; r0.<init>(); r2 = "store_card"; r3 = r4.payuResponse; r3 = r3.getStoredCards(); r1.putParcelableArrayList(r2, r3); r2 = "Value Added Services"; r3 = r4.valueAddedResponse; r3 = r3.getIssuingBankStatus(); r1.putSerializable(r2, r3); r2 = "Position"; r1.putInt(r2, r5); r2 = "store_one_click_hash"; r3 = r4.storeOneClickHash; r1.putInt(r2, r3); r2 = "one_click_card_tokens"; r3 = r4.oneClickCardTokens; r1.putSerializable(r2, r3); r0.setArguments(r1); r1 = r4.mPageReference; r2 = java.lang.Integer.valueOf(r5); r1.put(r2, r0); goto L_0x0019; L_0x007d: r0 = new com.payu.payuui.Fragment.CreditDebitFragment; r0.<init>(); r2 = "creditcard"; r3 = r4.payuResponse; r3 = r3.getCreditCard(); r1.putParcelableArrayList(r2, r3); r2 = "debitcard"; r3 = r4.payuResponse; r3 = r3.getDebitCard(); r1.putParcelableArrayList(r2, r3); r2 = "Value Added Services"; r3 = r4.valueAddedResponse; r3 = r3.getIssuingBankStatus(); r1.putSerializable(r2, r3); r2 = "Position"; r1.putInt(r2, r5); r2 = "store_one_click_hash"; r3 = r4.storeOneClickHash; r1.putInt(r2, r3); r0.setArguments(r1); r1 = r4.mPageReference; r2 = java.lang.Integer.valueOf(r5); r1.put(r2, r0); goto L_0x0019; L_0x00bd: r0 = new com.payu.payuui.Fragment.NetBankingFragment; r0.<init>(); r2 = "netbanking"; r3 = r4.payuResponse; r3 = r3.getNetBanks(); r1.putParcelableArrayList(r2, r3); r2 = "Value Added Services"; r3 = r4.valueAddedResponse; r3 = r3.getNetBankingDownStatus(); r1.putSerializable(r2, r3); r0.setArguments(r1); r1 = r4.mPageReference; r2 = java.lang.Integer.valueOf(r5); r1.put(r2, r0); goto L_0x0019; L_0x00e6: r0 = new com.payu.payuui.Fragment.PayuMoneyFragment; r0.<init>(); r2 = "PAYU_MONEY"; r3 = r4.payuResponse; r3 = r3.getPaisaWallet(); r1.putParcelableArrayList(r2, r3); r1 = r4.mPageReference; r2 = java.lang.Integer.valueOf(r5); r1.put(r2, r0); goto L_0x0019; */ throw new UnsupportedOperationException("Method not decompiled: com.payu.payuui.Adapter.PagerAdapter.getItem(int):android.support.v4.app.Fragment"); } public CharSequence getPageTitle(int i) { return (CharSequence) this.mTitles.get(i); } }
360eebe8d852120d02d224bd5ae518272aff8b50
fec174cf3fb255f083f902e48a83083a6b61cbb4
/.metadata/.plugins/org.eclipse.core.resources/.history/7b/202293993ba900161b81b8650e691acb
e1f4668d1884564ab68c96e22480948e897e624a
[]
no_license
18810012802/pros
8e8b717d6beaea9bafd3018d0397c668771e6589
0177b66a94e18c2c69a8eeb17c347852094792a2
refs/heads/master
2021-01-18T22:22:05.073392
2016-11-17T15:05:44
2016-11-17T15:05:44
72,429,379
0
0
null
null
null
null
GB18030
Java
false
false
1,786
package cn.it.weather; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>ArrayOfString complex type的 Java 类。 * * <p>以下模式片段指定包含在此类中的预期内容。 * * <pre> * &lt;complexType name="ArrayOfString"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="string" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ArrayOfString", propOrder = { "string" }) public class ArrayOfString { @XmlElement(nillable = true) protected List<String> string; /** * Gets the value of the string property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the string property. * * <p> * For example, to add a new item, do as follows: * <pre> * getString().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link String } * * */ public List<String> getString() { if (string == null) { string = new ArrayList<String>(); } return this.string; } }
1ce96b213d51acced73d43fe150de1c18f3da50e
e849406364dcfe97d3a78e6526c47f063e962bc9
/src/main/java/com/zking/sys/entity/market/salChance.java
baf3833ede386b842ee93c43e8a6800cc15af75d
[]
no_license
13548899356/Vue-Project
6d3c97b0016ff3bf05cf95e41dc4a8def603a32f
11cef0847f45dac417087f65fdc40358e0c97fc8
refs/heads/master
2022-12-12T15:01:06.071617
2020-01-08T03:57:52
2020-01-08T03:57:52
232,473,631
0
0
null
2022-12-10T04:49:45
2020-01-08T03:57:18
Java
UTF-8
Java
false
false
3,374
java
package com.zking.sys.entity.market; import java.io.Serializable; import java.sql.Timestamp; /** * @author TimeDip * 营销机会 */ public class salChance implements Serializable{ private String chcId;//营销机会ID private String chcSource;//机会来源 private String chcCustName;//客户名称 private String chcTitle;//概要 private Integer chcRate;//成功几率 private String chcLinkman;//联系人 private String chcTel;//联系人电话 private String chcDesc;//机会描述 private String chcCreateId;//创建人ID private String chcCreateBy;//创建人名字 private Timestamp chcCreateDate;//创建日期时间 private Integer chcDueId;//指派人ID private String chDueTo;//指派人名字 private Timestamp chcDueDate;//指派日期 private String chcStatus;//状态 0为已分配 1未分配 public String getChcId() { return chcId; } public void setChcId(String chcId) { this.chcId = chcId; } public String getChcSource() { return chcSource; } public void setChcSource(String chcSource) { this.chcSource = chcSource; } public String getChcCustName() { return chcCustName; } public void setChcCustName(String chcCustName) { this.chcCustName = chcCustName; } public String getChcTitle() { return chcTitle; } public void setChcTitle(String chcTitle) { this.chcTitle = chcTitle; } public Integer getChcRate() { return chcRate; } public void setChcRate(Integer chcRate) { this.chcRate = chcRate; } public String getChcLinkman() { return chcLinkman; } public void setChcLinkman(String chcLinkman) { this.chcLinkman = chcLinkman; } public String getChcTel() { return chcTel; } public void setChcTel(String chcTel) { this.chcTel = chcTel; } public String getChcDesc() { return chcDesc; } public void setChcDesc(String chcDesc) { this.chcDesc = chcDesc; } public String getChcCreateId() { return chcCreateId; } public void setChcCreateId(String chcCreateId) { this.chcCreateId = chcCreateId; } public String getChcCreateBy() { return chcCreateBy; } public void setChcCreateBy(String chcCreateBy) { this.chcCreateBy = chcCreateBy; } public Timestamp getChcCreateDate() { return chcCreateDate; } public void setChcCreateDate(Timestamp chcCreateDate) { this.chcCreateDate = chcCreateDate; } public Integer getChcDueId() { return chcDueId; } public void setChcDueId(Integer chcDueId) { this.chcDueId = chcDueId; } public String getChDueTo() { return chDueTo; } public void setChDueTo(String chDueTo) { this.chDueTo = chDueTo; } public Timestamp getChcDueDate() { return chcDueDate; } public void setChcDueDate(Timestamp chcDueDate) { this.chcDueDate = chcDueDate; } public String getChcStatus() { return chcStatus; } public void setChcStatus(String chcStatus) { this.chcStatus = chcStatus; } @Override public String toString() { return "salChance [chcId=" + chcId + ", chcSource=" + chcSource + ", chcCustName=" + chcCustName + ", chcTitle=" + chcTitle + ", chcRate=" + chcRate + ", chcLinkman=" + chcLinkman + ", chcTel=" + chcTel + ", chcDesc=" + chcDesc + ", chcCreateId=" + chcCreateId + ", chcCreateBy=" + chcCreateBy + ", chcCreateDate=" + chcCreateDate + ", chcDueId=" + chcDueId + ", chDueTo=" + chDueTo + ", chcDueDate=" + chcDueDate + ", chcStatus=" + chcStatus + "]"; } }
bd4a2a3fbdd9bb64a7615deb42956c8a53c605f5
7c596035dc8f8232ca466e6f4c40e8b6bb83c169
/src/main/java/com/rkaneko/embedded/JettyLauncher.java
c0cce174035b53d63da7b1c8b363ce9fb68c6fc4
[]
no_license
rkaneko/WebSocketServer
17497eaa3336f46456a20ca7b5ed57eda02c45f8
b30f71a6c56b93b07f4ad99540cb9a1791b3bbc1
refs/heads/master
2021-01-20T10:38:37.347340
2014-08-04T07:34:13
2014-08-04T07:34:13
8,218,193
5
2
null
null
null
null
UTF-8
Java
false
false
1,226
java
package com.rkaneko.embedded; import org.eclipse.jetty.annotations.AnnotationConfiguration; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.webapp.Configuration; import org.eclipse.jetty.webapp.MetaInfConfiguration; import org.eclipse.jetty.webapp.WebAppContext; import org.eclipse.jetty.webapp.WebInfConfiguration; import org.eclipse.jetty.webapp.WebXmlConfiguration; import java.net.URL; import java.security.ProtectionDomain; public class JettyLauncher { public static void main(String[] args) throws Exception { ProtectionDomain domain = JettyLauncher.class.getProtectionDomain(); URL location = domain.getCodeSource().getLocation(); WebAppContext webapp = new WebAppContext(); webapp.setDescriptor("WEB-INF/web.xml"); webapp.setConfigurations(new Configuration[]{ new AnnotationConfiguration(), new WebXmlConfiguration(), new WebInfConfiguration(), new MetaInfConfiguration() }); webapp.setContextPath("/"); webapp.setWar(location.toExternalForm()); Server server = new Server(8090); server.setHandler(webapp); server.start(); server.join(); } }
7e46cb5971ef9fa2ee59ee9d9a2fa5bb11728095
a5278bbc4b0a2630bc801d5c00ec48876c354dd8
/src/Cryptography/DESEncryptionExample.java
c96e8b94b6cd974ab50254bd28627c5d9e957794
[]
no_license
akshatsoni64/Java-Programming
e9c78f7c7fa99107b91576b134428f7bed58a960
962d610b502bc26c9a633e86984fc8c9271c0e61
refs/heads/master
2021-09-10T04:57:35.853510
2021-08-29T08:57:14
2021-08-29T08:57:14
191,611,539
7
1
null
null
null
null
UTF-8
Java
false
false
2,801
java
import javax.crypto.*; import javax.crypto.spec.IvParameterSpec; import java.io.*; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.security.spec.AlgorithmParameterSpec; public class DESEncryptionExample { private static final byte[] iv = {11, 22, 33, 44, 99, 88, 77, 66}; private static Cipher encryptCipher; private static Cipher decryptCipher; public static void main(String[] args) { String clearTextFile = "files/source.txt"; String cipherTextFile = "files/cipher.txt"; String clearTextNewFile = "files/source-new.txt"; try { // create SecretKey using KeyGenerator SecretKey key = KeyGenerator.getInstance("DES").generateKey(); AlgorithmParameterSpec paramSpec = new IvParameterSpec(iv); // get Cipher instance and initiate in encrypt mode encryptCipher = Cipher.getInstance("DES/CBC/PKCS5Padding"); encryptCipher.init(Cipher.ENCRYPT_MODE, key, paramSpec); // get Cipher instance and initiate in decrypt mode decryptCipher = Cipher.getInstance("DES/CBC/PKCS5Padding"); decryptCipher.init(Cipher.DECRYPT_MODE, key, paramSpec); // method to encrypt clear text file to encrypted file encrypt(new FileInputStream(clearTextFile), new FileOutputStream(cipherTextFile)); // method to decrypt encrypted file to clear text file decrypt(new FileInputStream(cipherTextFile), new FileOutputStream(clearTextNewFile)); System.out.println("DONE"); } catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException | InvalidAlgorithmParameterException | IOException e) { e.printStackTrace(); } } private static void encrypt(InputStream is, OutputStream os) throws IOException { // create CipherOutputStream to encrypt the data using encryptCipher os = new CipherOutputStream(os, encryptCipher); writeData(is, os); } private static void decrypt(InputStream is, OutputStream os) throws IOException { // create CipherOutputStream to decrypt the data using decryptCipher is = new CipherInputStream(is, decryptCipher); writeData(is, os); } // utility method to read data from input stream and write to output stream private static void writeData(InputStream is, OutputStream os) throws IOException { byte[] buf = new byte[1024]; int numRead = 0; // read and write operation while ((numRead = is.read(buf)) >= 0) { os.write(buf, 0, numRead); } os.close(); is.close(); } }
74ca3ffbbde87f9587b9657f4d02f063a8273f34
6cccbbd7c647a7168b55f3c54f0372df81e83620
/goods/src/main/java/com/yesmywine/goods/dao/SkuPropDao.java
9020bba897de2cb9ac62f6b4d0125234fac4f36f
[]
no_license
Loeng/yesmywine_ms
4dd111edeabefd3a813a7e59837862b660e1085c
207e6d1f352172999649ba324f07aeb68953f9d6
refs/heads/master
2021-10-20T03:56:03.729552
2019-02-25T15:34:25
2019-02-25T15:34:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
248
java
package com.yesmywine.goods.dao; import com.yesmywine.base.record.repository.BaseRepository; import com.yesmywine.goods.entity.SkuProp; /** * Created by hz on 6/22/17. */ public interface SkuPropDao extends BaseRepository<SkuProp, Integer> { }
bbf8c89caa05cf12e394c5aa6b9d29291858b2ca
09f8ce8cbaa20ca952b9862ddee640cad97b4d06
/03-SpringBoot-JUnit-Mockito/src/test/java/com/smoothiemx/sbjunitmockito/app/controllers/CuentaControllerTestRestTemplateTest.java
6961743bf9bec181c56c5bcac50bda97505ef427
[]
no_license
adriangonzalez-code/junit-mockito
dfa12a14d1eab5f96e06302ac1a0545c299f028a
d0354a4fc2a9115c920a7faccac448bcf26501d8
refs/heads/master
2023-07-16T08:16:52.046357
2021-08-30T20:59:57
2021-08-30T20:59:57
393,234,959
0
0
null
2021-08-30T20:59:58
2021-08-06T03:21:53
Java
UTF-8
Java
false
false
7,042
java
package com.smoothiemx.sbjunitmockito.app.controllers; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.smoothiemx.sbjunitmockito.app.models.Cuenta; import com.smoothiemx.sbjunitmockito.app.models.TransaccionDto; import org.junit.jupiter.api.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.boot.web.server.LocalServerPort; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import java.math.BigDecimal; import java.time.LocalDate; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import static org.junit.jupiter.api.Assertions.*; @Tag("integracion_rt") @TestMethodOrder(MethodOrderer.OrderAnnotation.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) class CuentaControllerTestRestTemplateTest { @Autowired private TestRestTemplate client; private ObjectMapper objectMapper; @LocalServerPort private int puerto; @BeforeEach void setUp() { objectMapper = new ObjectMapper(); } @Test @Order(1) void testTransferir() throws JsonProcessingException { TransaccionDto dto = new TransaccionDto(); dto.setMonto(new BigDecimal("100")); dto.setCuentaDestinoId(2L); dto.setCuentaOrigenId(1L); dto.setBanco(1L); ResponseEntity<String> response = client.postForEntity(crearUri("/api/cuentas/transferir"), dto, String.class); System.out.println("puerto = " + puerto); String json = response.getBody(); System.out.println("json = " + json); assertEquals(HttpStatus.OK, response.getStatusCode()); assertEquals(MediaType.APPLICATION_JSON, response.getHeaders().getContentType()); assertNotNull(json); assertTrue(json.contains("Transferencia realizada con éxito")); assertTrue(json.contains("{\"cuentaOrigenId\":1,\"cuentaDestinoId\":2,\"monto\":100,\"banco\":1}")); JsonNode jsonNode = objectMapper.readTree(json); assertEquals("Transferencia realizada con éxito", jsonNode.path("mensaje").asText()); assertEquals(LocalDate.now().toString(), jsonNode.path("date").asText()); assertEquals("100", jsonNode.path("transaccion").path("monto").asText()); assertEquals(1L, jsonNode.path("transaccion").path("cuentaOrigenId").asLong()); Map<String, Object> response2 = new HashMap<>(); response2.put("date", LocalDate.now().toString()); response2.put("status", "OK"); response2.put("mensaje", "Transferencia realizada con éxito"); response2.put("transaccion", dto); assertEquals(objectMapper.writeValueAsString(response2), json); } @Test @Order(2) void testDetalle() { ResponseEntity<Cuenta> respuesta = client.getForEntity(crearUri("/api/cuentas/1"), Cuenta.class); Cuenta cuenta = respuesta.getBody(); assertEquals(HttpStatus.OK, respuesta.getStatusCode()); assertEquals(MediaType.APPLICATION_JSON, respuesta.getHeaders().getContentType()); assertNotNull(cuenta); assertEquals(1L, cuenta.getId()); assertEquals("Adrián", cuenta.getPersona()); assertEquals("900.00", cuenta.getSaldo().toPlainString()); assertEquals(new Cuenta(1L, "Adrián", new BigDecimal("900.00")), cuenta); } @Test @Order(3) void testListar() throws JsonProcessingException { ResponseEntity<Cuenta[]> respuesta = client.getForEntity(crearUri("/api/cuentas"), Cuenta[].class); assertNotNull(respuesta.getBody()); List<Cuenta> cuentas = Arrays.asList(respuesta.getBody()); assertEquals(HttpStatus.OK, respuesta.getStatusCode()); assertEquals(MediaType.APPLICATION_JSON, respuesta.getHeaders().getContentType()); assertEquals(2, cuentas.size()); assertEquals(1L, cuentas.get(0).getId()); assertEquals("Adrián", cuentas.get(0).getPersona()); assertEquals("900.00", cuentas.get(0).getSaldo().toPlainString()); assertEquals(2L, cuentas.get(1).getId()); assertEquals("Jhon", cuentas.get(1).getPersona()); assertEquals("2100.00", cuentas.get(1).getSaldo().toPlainString()); JsonNode json = objectMapper.readTree(objectMapper.writeValueAsString(cuentas)); assertEquals(1L, json.get(0).path("id").asLong()); assertEquals("Adrián", json.get(0).path("persona").asText()); assertEquals("900.0", json.get(0).path("saldo").asText()); assertEquals(2L, json.get(1).path("id").asLong()); assertEquals("Jhon", json.get(1).path("persona").asText()); assertEquals("2100.0", json.get(1).path("saldo").asText()); } @Test @Order(4) void testGuardar() { Cuenta cuenta = new Cuenta(null, "Pepa", new BigDecimal("3800")); ResponseEntity<Cuenta> respuesta = client.postForEntity(crearUri("/api/cuentas"), cuenta, Cuenta.class); assertEquals(HttpStatus.CREATED, respuesta.getStatusCode()); assertEquals(MediaType.APPLICATION_JSON, respuesta.getHeaders().getContentType()); Cuenta cuentaCreada = respuesta.getBody(); assertNotNull(cuentaCreada); assertEquals(3L, cuentaCreada.getId()); assertEquals("Pepa", cuentaCreada.getPersona()); assertEquals("3800", cuentaCreada.getSaldo().toPlainString()); } @Test @Order(5) void testEliminar() { ResponseEntity<Cuenta[]> respuesta = client.getForEntity(crearUri("/api/cuentas"), Cuenta[].class); assertNotNull(respuesta.getBody()); List<Cuenta> cuentas = Arrays.asList(respuesta.getBody()); assertEquals(3, cuentas.size()); /*client.delete(crearUri("/api/cuentas/5"));*/ Map<String, Long> pathVariables = new HashMap<>(); pathVariables.put("id", 3L); ResponseEntity<Void> exchange = client.exchange(crearUri("/api/cuentas/{id}"), HttpMethod.DELETE, null, Void.class, pathVariables); assertEquals(HttpStatus.NO_CONTENT, exchange.getStatusCode()); assertFalse(exchange.hasBody()); respuesta = client.getForEntity(crearUri("/api/cuentas"), Cuenta[].class); assertNotNull(respuesta.getBody()); cuentas = Arrays.asList(respuesta.getBody()); assertEquals(2, cuentas.size()); ResponseEntity<Cuenta> respuestaDetalle = client.getForEntity(crearUri("/api/cuentas/5"), Cuenta.class); assertEquals(HttpStatus.NOT_FOUND, respuestaDetalle.getStatusCode()); assertFalse(respuestaDetalle.hasBody()); } private String crearUri(String uri) { return "http://localhost:" + puerto + uri; } }
aa92b31710fe8f9909667ce384de145577e7d889
6e1f1af36bf3921018d587b6f72c35a7f07d8d67
/src/test/java/jdk8/_interface/InterfaceAImpl2.java
778c7159475d579169f51fa23b894b27a044e96d
[]
no_license
yangfancoming/gdk
09802bd6b37466b38bf96771a201e6193bb06172
c20c38f018aa34e07cdf26a8899d3126129f5d6a
refs/heads/master
2021-07-07T13:06:15.193492
2020-04-16T01:04:40
2020-04-16T01:04:40
200,798,650
0
0
null
null
null
null
UTF-8
Java
false
false
429
java
package jdk8._interface; /** * Created by 64274 on 2019/8/7. * * @ Description: TODO * @ author 山羊来了 * @ date 2019/8/7---22:03 */ public class InterfaceAImpl2 implements InterfaceA { /** * 跟接口default方法一致,但不能再加default修饰符 */ @Override public void showDefault() { System.out.println("InterfaceAImpl2 实现类 重写 接口中的 default方法"); } }
14fbace743cec35f3203d0a3e9ae2b15427062de
3ffccabeefafed0b7df9ccf6f3575dc4e952cbec
/12.integer-to-roman.java
277b29e8d6ffa1bb3f853fab82d08d36315777c5
[]
no_license
tickscn/leetcode
8f02dcf1d0a41d69735debd24e3f73a8bd362411
242c4e75a5598f1eed574393f0e344677c4ec24a
refs/heads/master
2021-07-12T18:45:24.988368
2020-07-24T09:58:26
2020-07-24T09:58:26
184,757,828
1
0
null
null
null
null
UTF-8
Java
false
false
2,399
java
/* * @lc app=leetcode id=12 lang=java * * [12] Integer to Roman * * https://leetcode.com/problems/integer-to-roman/description/ * * algorithms * Medium (52.19%) * Likes: 913 * Dislikes: 2483 * Total Accepted: 326.8K * Total Submissions: 605.6K * Testcase Example: '3' * * Roman numerals are represented by seven different symbols: I, V, X, L, C, D * and M. * * * Symbol Value * I 1 * V 5 * X 10 * L 50 * C 100 * D 500 * M 1000 * * For example, two is written as II in Roman numeral, just two one's added * together. Twelve is written as, XII, which is simply X + II. The number * twenty seven is written as XXVII, which is XX + V + II. * * Roman numerals are usually written largest to smallest from left to right. * However, the numeral for four is not IIII. Instead, the number four is * written as IV. Because the one is before the five we subtract it making * four. The same principle applies to the number nine, which is written as IX. * There are six instances where subtraction is used: * * * I can be placed before V (5) and X (10) to make 4 and 9.  * X can be placed before L (50) and C (100) to make 40 and 90.  * C can be placed before D (500) and M (1000) to make 400 and 900. * * * Given an integer, convert it to a roman numeral. Input is guaranteed to be * within the range from 1 to 3999. * * Example 1: * * * Input: 3 * Output: "III" * * Example 2: * * * Input: 4 * Output: "IV" * * Example 3: * * * Input: 9 * Output: "IX" * * Example 4: * * * Input: 58 * Output: "LVIII" * Explanation: L = 50, V = 5, III = 3. * * * Example 5: * * * Input: 1994 * Output: "MCMXCIV" * Explanation: M = 1000, CM = 900, XC = 90 and IV = 4. * */ // @lc code=start class Solution { public String intToRoman(int num) { StringBuffer buf = new StringBuffer(); int[] keys = { 1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000 }; String[] values = { "I", "IV", "V", "IX", "X", "XL", "L", "XC", "C", "CD", "D", "CM", "M" }; for (int i = keys.length - 1; i >= 0; i--) { while (num >= keys[i]) { num -= keys[i]; buf.append(values[i]); } } return buf.toString(); } } // @lc code=end
908ee908ad7468c39b72212983b12adadaed638d
b8313a99e7b99b21083bb2de78a70ec7ec0228c2
/hanniupk-kernel/kernel-model/src/main/java/info/hanniu/hanniupk/kernel/model/enums/YesOrNotEnum.java
9284172041e2bb9c3d2a30959a14b0baeae901d6
[]
no_license
lwgboy/hanniupk
b2c7fd487eb2344b4d8b7ea70aef1ea14e751378
9bd0351817ede63bf17f4fe13b23258039157ddb
refs/heads/master
2020-04-25T23:39:22.178315
2019-02-27T10:42:49
2019-02-27T10:42:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,043
java
/** * Copyright 2018-2020 stylefeng & fengshuonan ([email protected]) * <p> * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package info.hanniu.hanniupk.kernel.model.enums; import lombok.Getter; /** * 是或者否的枚举 * * @author stylefeng * @Date 2018/4/18 23:05 */ public enum YesOrNotEnum { Y(true, "是"), N(false, "否"); @Getter private Boolean flag; @Getter private String desc; YesOrNotEnum(Boolean flag, String desc) { this.flag = flag; this.desc = desc; } }
461b02df36d81e59350dde3aac8395d7a8126501
2fd6f1cab6f39894adb367d78913b81c7ba9f927
/baizhi-cmfz-sys/src/main/java/com/baizhi/controller/UserController.java
3ae6a64aa7c6a3897f3192b4c75aba74aa2baff1
[]
no_license
sangrux/code
0297cf6b1af5411d1f63571082e1bebfd8be3ba0
88fc950f18ec5b079b69b91990bed8a479e72141
refs/heads/master
2020-05-31T23:14:13.170620
2017-06-16T03:24:25
2017-06-16T03:24:39
94,053,143
0
0
null
null
null
null
UTF-8
Java
false
false
1,329
java
package com.baizhi.controller; import com.baizhi.entity.User; import com.baizhi.service.UserService; import com.baizhi.util.Md5Util; import com.baizhi.util.SaltUtil; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.List; import java.util.UUID; /** * Created by Administrator on 2017/6/13. */ @Controller @RequestMapping("/user") public class UserController { @Resource private UserService userService; @RequestMapping("/findAll") @ResponseBody public List<User> findAll(){ List<User> users = userService.queryAll(); System.out.println(users); return users; } @RequestMapping("/findOne") @ResponseBody public User findOne(String id){ User user = userService.queryById(id); return user; } @RequestMapping("/add") @ResponseBody public void add(User user,String id){ userService.add(user); } @RequestMapping("/delete") @ResponseBody public void delete(String id){ userService.delete(id); } @RequestMapping("update") @ResponseBody public void update(User user){ userService.change(user); } }
619d9f49906b40a2f59d4938f423f88c5669268f
b65b692ecf87b38c55ff438f9aa44298dd6aba12
/learn-note-maven-generatorSqlmapCustom/src/main/java/cn/center/pojo/TbShopEmployeeCustomerCashLog.java
79ea95a79f2e49ea48d47224ab35c5840fb765d7
[]
no_license
Steve133/my
c2d22cf290bad0e66304034abd53c8ea8d3a8743
33fa4a9a94c690c101c5bf905385c1e8db6dde8e
refs/heads/master
2022-12-20T23:11:04.076723
2019-12-26T02:14:28
2019-12-26T02:14:28
225,565,975
0
0
null
2022-12-16T05:01:42
2019-12-03T08:15:59
Java
UTF-8
Java
false
false
2,427
java
package cn.center.pojo; import java.util.Date; public class TbShopEmployeeCustomerCashLog { private Long shopId; private String shopName; private Long employeeId; private String employeeName; private Long customerId; private String customerName; private Byte type; private Float money; private Date created; private Date updated; private String updator; private String creator; public Long getShopId() { return shopId; } public void setShopId(Long shopId) { this.shopId = shopId; } public String getShopName() { return shopName; } public void setShopName(String shopName) { this.shopName = shopName == null ? null : shopName.trim(); } public Long getEmployeeId() { return employeeId; } public void setEmployeeId(Long employeeId) { this.employeeId = employeeId; } public String getEmployeeName() { return employeeName; } public void setEmployeeName(String employeeName) { this.employeeName = employeeName == null ? null : employeeName.trim(); } public Long getCustomerId() { return customerId; } public void setCustomerId(Long customerId) { this.customerId = customerId; } public String getCustomerName() { return customerName; } public void setCustomerName(String customerName) { this.customerName = customerName == null ? null : customerName.trim(); } public Byte getType() { return type; } public void setType(Byte type) { this.type = type; } public Float getMoney() { return money; } public void setMoney(Float money) { this.money = money; } public Date getCreated() { return created; } public void setCreated(Date created) { this.created = created; } public Date getUpdated() { return updated; } public void setUpdated(Date updated) { this.updated = updated; } public String getUpdator() { return updator; } public void setUpdator(String updator) { this.updator = updator == null ? null : updator.trim(); } public String getCreator() { return creator; } public void setCreator(String creator) { this.creator = creator == null ? null : creator.trim(); } }
39a9fbca5d57bb18c0f8bf116d01049ebe9db033
cbea081452a3d884242fa1a73ff720c69af828d1
/GoldenLionERP_CoreModule/src/main/java/ags/goldenlionerp/application/setups/businessunit/BusinessUnitCustomRepository.java
8ac7c8d616bd86beec4bac9334a16a4a2428067f
[]
no_license
SuryadiTjandra/GL_ERP
739f304111554f46ca40e6b4117d89b0f6896bea
0f44cd4a863c84564e6d1753e00faeac0278e7a4
refs/heads/main
2023-01-19T08:40:27.860923
2020-11-28T08:29:09
2020-11-28T08:29:09
316,689,786
0
0
null
null
null
null
UTF-8
Java
false
false
160
java
package ags.goldenlionerp.application.setups.businessunit; public interface BusinessUnitCustomRepository { <S extends BusinessUnit> S save(S businessUnit); }
3a50fd68b89b195596fb982c546d565c418583f0
6e891dee65019502168cb7e21695235a61aa08f2
/Java Basic/src/c_control/Ex01_if_주민번호.java
722bc7717278fa05eb504225418389d069b9b6f7
[]
no_license
salcho94/javafile
52a2b26b8bda902adcace131f42d0f4e4d4ff52e
004aa6d5a7a4c1bbf10d0cf22c49bc11f4384a4d
refs/heads/master
2021-04-07T13:29:43.978561
2020-03-20T09:22:19
2020-03-20T09:22:19
248,680,056
0
0
null
null
null
null
UTF-8
Java
false
false
1,122
java
package c_control; import java.util.*; public class Ex01_if_주민번호 { public static void main(String[] args) { String id ="940729-1877779"; char sung =id.charAt(7); //1이거나 3이거나 9이면 남자 //2이거나 4이거나 0이면 여자 if(sung =='1' |sung =='3'|sung =='9') { System.out.println("남자 출력"); }else if(sung =='2'|sung =='4'|sung =='0') { System.out.println("여자 출력"); } String nai=id.substring(0, 2);//두번째열 앞에부터 두개 컴터는 0부터센다 int nai2 =Integer.parseInt(nai); //올해 년도 구하기 Calendar c= Calendar.getInstance(); int year = c.get(Calendar.YEAR); int age=0; if(sung =='1'|sung =='2') { age=year-(1900+nai2)+1; }else if(sung =='3'|sung =='4') { age=year-(2000+nai2)+1; }else if(sung =='0'|sung =='9') { age=year-(1800+nai2)+1; } System.out.println("나이는"+age); } }
[ "Canon@DESKTOP-PL2F7PK" ]
Canon@DESKTOP-PL2F7PK
ae76cc95e7cd0a676a3811db8570378b6f5e1d10
cce1b2063aa13ec6f3b702fcce146b7b9247eeb5
/app/src/main/java/project/ap/com/customtopnavigationbar/VerticalNtbActivity.java
56d925ef1efaaca10f785ce15502fe402a715ca1
[]
no_license
iamadityaaz/CustomTopNavigationBar
c3a6a6f1e9f4f8d599a648199b4c847b7de6d0cf
f2e4c3d01a4baee9f974d4b00c010f3ec5fb7e6b
refs/heads/master
2020-04-01T14:40:08.174939
2018-10-16T14:47:52
2018-10-16T14:47:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,209
java
package project.ap.com.customtopnavigationbar; import android.app.Activity; import android.graphics.Color; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import devlight.io.library.ntb.NavigationTabBar; import java.util.ArrayList; /** * Created by GIGAMOLE on 28.03.2016. */ public class VerticalNtbActivity extends AppCompatActivity { @Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_vertical_ntb); initUI(); } private void initUI() { final ViewPager viewPager = (ViewPager) findViewById(R.id.vp_vertical_ntb); viewPager.setAdapter(new FragmentPagerAdapter(getSupportFragmentManager()) { /** * Return the number of views available. */ @Override public int getCount() { return 2; } @Override public Fragment getItem(int position) { switch (position) { case 0: // Fragment # 0 - This will show FirstFragment return new Fragment1st(); case 1: // Fragment # 1 - This will show SecondFragment return new Fragment2nd(); default: return new Fragment1st(); } } }); final String[] colors = getResources().getStringArray(R.array.vertical_ntb); final NavigationTabBar navigationTabBar = (NavigationTabBar) findViewById(R.id.ntb_vertical); final ArrayList<NavigationTabBar.Model> models = new ArrayList<>(); models.add( new NavigationTabBar.Model.Builder( getResources().getDrawable(R.drawable.ic_first), Color.parseColor(colors[0])) .title("ic_first") .selectedIcon(getResources().getDrawable(R.drawable.ic_eighth)) .build() ); models.add( new NavigationTabBar.Model.Builder( getResources().getDrawable(R.drawable.ic_second), Color.parseColor(colors[1])) .selectedIcon(getResources().getDrawable(R.drawable.ic_eighth)) .title("ic_second") .build() ); // models.add( // new NavigationTabBar.Model.Builder( // getResources().getDrawable(R.drawable.ic_third), // Color.parseColor(colors[2])) // .selectedIcon(getResources().getDrawable(R.drawable.ic_eighth)) // .title("ic_third") // .build() // ); // models.add( // new NavigationTabBar.Model.Builder( // getResources().getDrawable(R.drawable.ic_fourth), // Color.parseColor(colors[3])) // .selectedIcon(getResources().getDrawable(R.drawable.ic_eighth)) // .title("ic_fourth") // .build() // ); // models.add( // new NavigationTabBar.Model.Builder( // getResources().getDrawable(R.drawable.ic_fifth), // Color.parseColor(colors[4])) // .selectedIcon(getResources().getDrawable(R.drawable.ic_eighth)) // .title("ic_fifth") // .build() // ); // models.add( // new NavigationTabBar.Model.Builder( // getResources().getDrawable(R.drawable.ic_sixth), // Color.parseColor(colors[5])) // .selectedIcon(getResources().getDrawable(R.drawable.ic_eighth)) // .title("ic_sixth") // .build() // ); // models.add( // new NavigationTabBar.Model.Builder( // getResources().getDrawable(R.drawable.ic_seventh), // Color.parseColor(colors[6])) // .selectedIcon(getResources().getDrawable(R.drawable.ic_eighth)) // .title("ic_seventh") // .build() // ); // models.add( // new NavigationTabBar.Model.Builder( // getResources().getDrawable(R.drawable.ic_eighth), // Color.parseColor(colors[7])) // .selectedIcon(getResources().getDrawable(R.drawable.ic_eighth)) // .title("ic_eighth") // .build() // ); navigationTabBar.setModels(models); navigationTabBar.setViewPager(viewPager, 0); } }
e6ab5dd14260c63521c2e8b66ea09a3e42493b35
402c94353940844bb8dfa85c54275498e62e6f3f
/app/src/main/java/cn/edu/sdwu/android02/classroom/sn170507180213/Ch12Activity1.java
35534b4b320f0f550565317dfcba6fd3e4631bc6
[]
no_license
xbw0108/MyApplication3
37fa1d682da4d70e4ed467915def7fcba6541a3e
363798fdb827d3348df773e93fe6064838878cd6
refs/heads/master
2022-06-22T01:21:44.489409
2020-05-11T08:46:06
2020-05-11T08:46:06
257,832,649
0
0
null
null
null
null
UTF-8
Java
false
false
601
java
package cn.edu.sdwu.android02.classroom.sn170507180213; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; public class Ch12Activity1 extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout_ch12_1); } public void start_service(View view){ Intent intent=new Intent(this,MyService.class); startService(intent); } public void stop_service(View view) { } }
193b79ca301e56be53f2f883b214df14edb9be26
da4ff3cca75298a699df33594b59b345d4ff0559
/mybatis/src/main/java/com/zking/mybatis/controller/HomeController.java
23481bc41b6418eb33f6bbefda8bf7704d72e4bb
[]
no_license
dong957/mybatis
fd45eb4330ee7029120669af3d1d710f73055522
8ee15a7eda2112639cfe628e6b161da1583992bb
refs/heads/master
2022-12-23T02:00:46.250482
2019-12-09T06:53:53
2019-12-09T06:53:53
226,636,952
0
0
null
2022-12-16T04:25:10
2019-12-08T08:28:27
Java
UTF-8
Java
false
false
271
java
package com.zking.mybatis.controller; import org.springframework.web.bind.annotation.RequestMapping; /** * @author dong * @create 2019-11-2414:01 */ public class HomeController { @RequestMapping("/") public String goHome(){ return "index"; } }
f537a56189583a7e7dd60fbcc1d4ad772afaf833
bf1cd6d58e1922f689afde11adc6ded97397e9b3
/lesson-8/socialnetwork/app/src/main/java/ru/geekbrains/socialnetwork/data/CardData.java
fc5ae33a297d737c670baa68597ccac6713398fc
[]
no_license
Warcerg/AndroidBase-2021-05-26
c6dcf16f951329ac616285a2d8f27dc736e66029
56a1e536a701e2d48048f297da5cc00297b13dde
refs/heads/master
2023-06-07T23:58:57.568498
2021-06-30T19:05:39
2021-06-30T19:05:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
824
java
package ru.geekbrains.socialnetwork.data; public class CardData { private String title; // заголовок private String description; // описание private int picture; // изображение private boolean like; // флажок public CardData(String title, String description, int picture, boolean like) { this.title = title; this.description = description; this.picture = picture; this.like = like; } public int getPicture() { return picture; } public boolean isLike() { return like; } public String getDescription() { return description; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } }
c6e3b77d25dedb968d3e53d3f74f43b189de7bed
3a7225540a6d94ad9cf3ac65e5bfbae0c39764f1
/Src/GameController/src/controller/action/ui/Robot.java
569d829172a7699845dda46c3bad83b64b5adcf2
[ "BSD-3-Clause" ]
permissive
saifullah3396/team-nust-robocup
e885f9856aef52f688927fc5bf3534c708a90823
2da710731ff758d164e048b407dd1601aa1bc421
refs/heads/master
2020-03-25T19:25:07.766123
2018-10-16T10:49:59
2018-10-16T10:49:59
144,081,847
1
0
null
null
null
null
UTF-8
Java
false
false
8,246
java
package controller.action.ui; import java.util.ArrayList; import common.Log; import controller.EventHandler; import controller.action.ActionType; import controller.action.GCAction; import controller.action.ui.penalty.CoachMotion; import controller.action.ui.penalty.Penalty; import controller.action.ui.penalty.MotionInSet; import controller.action.ui.penalty.PickUp; import controller.action.ui.penalty.PickUpHL; import controller.action.ui.penalty.ServiceHL; import controller.action.ui.penalty.Substitute; import data.AdvancedData; import data.AdvancedData.PenaltyQueueData; import data.PlayerInfo; import data.Rules; import data.SPL; /** * @author Michel Bartsch * * This action means that a player has been selected. */ public class Robot extends GCAction { /** On which side (0:left, 1:right) */ private int side; /** The players`s number, beginning with 0! */ private int number; /** * Creates a new Robot action. * Look at the ActionBoard before using this. * * @param side On which side (0:left, 1:right) * @param number The players`s number, beginning with 0! */ public Robot(int side, int number) { super(ActionType.UI); this.side = side; this.number = number; } /** * Performs this action to manipulate the data (model). * * @param data The current data to work on. */ @Override public void perform(AdvancedData data) { PlayerInfo player = data.team[side].player[number]; if (player.penalty == PlayerInfo.PENALTY_SUBSTITUTE && !isCoach(data) && data.secGameState != AdvancedData.STATE2_PENALTYSHOOT) { ArrayList<PenaltyQueueData> playerInfoList = data.penaltyQueueForSubPlayers.get(side); if (playerInfoList.isEmpty()) { player.penalty = Rules.league.substitutePenalty; data.whenPenalized[side][number] = data.getTime(); } else { PenaltyQueueData playerInfo = playerInfoList.get(0); player.penalty = playerInfo.penalty; data.robotPenaltyCount[side][number] = playerInfo.penaltyCount; data.whenPenalized[side][number] = playerInfo.whenPenalized; playerInfoList.remove(0); } Log.state(data, "Entering Player " + Rules.league.teamColorName[data.team[side].teamColor] + " " + (number+1)); } else if (EventHandler.getInstance().lastUIEvent instanceof MotionInSet && player.penalty == PlayerInfo.PENALTY_NONE || (EventHandler.getInstance().lastUIEvent instanceof Penalty && !(EventHandler.getInstance().lastUIEvent instanceof MotionInSet))) { EventHandler.getInstance().lastUIEvent.performOn(data, player, side, number); } else if (data.secGameState == AdvancedData.STATE2_PENALTYSHOOT && (data.team[side].player[number].penalty == PlayerInfo.PENALTY_NONE || data.team[side].player[number].penalty == PlayerInfo.PENALTY_SUBSTITUTE) && (data.gameState == AdvancedData.STATE_SET || data.gameState == AdvancedData.STATE_INITIAL) && !isCoach(data)) { // make all other players to substitute: for (int playerID = 0; playerID < Rules.league.teamSize; playerID++) { if (playerID != number && !(Rules.league.isCoachAvailable && playerID == Rules.league.teamSize)) { PlayerInfo playerToSub = data.team[side].player[playerID]; if (playerToSub.penalty != PlayerInfo.PENALTY_NONE) { data.addToPenaltyQueue(side, data.whenPenalized[side][playerID], playerToSub.penalty, data.robotPenaltyCount[side][playerID]); } playerToSub.penalty = PlayerInfo.PENALTY_SUBSTITUTE; data.robotPenaltyCount[side][playerID] = 0; data.whenPenalized[side][playerID] = data.getTime(); } } // unpenalise selected player: player.penalty = PlayerInfo.PENALTY_NONE; data.penaltyShootOutPlayers[side][data.team[side].teamNumber == data.kickOffTeam ? 0 : 1] = number; Log.state(data, "Selected Player" + Rules.league.teamColorName[data.team[side].teamColor] + " " + (number + 1) + " as " + (data.team[side].teamNumber == data.kickOffTeam ? "taker" : "keeper")); } else if (player.penalty != PlayerInfo.PENALTY_NONE) { player.penalty = PlayerInfo.PENALTY_NONE; Log.state(data, ("Unpenalised ")+ Rules.league.teamColorName[data.team[side].teamColor] + " " + (number+1)); } } /** * Checks if this action is legal with the given data (model). * Illegal actions are not performed by the EventHandler. * * @param data The current data to check with. */ @Override public boolean isLegal(AdvancedData data) { return !data.ejected[side][number] && ((!(EventHandler.getInstance().lastUIEvent instanceof Penalty) || EventHandler.getInstance().lastUIEvent instanceof MotionInSet) && data.team[side].player[number].penalty != PlayerInfo.PENALTY_NONE && (Rules.league.allowEarlyPenaltyRemoval || data.getRemainingPenaltyTime(side, number) == 0) && (data.team[side].player[number].penalty != PlayerInfo.PENALTY_SUBSTITUTE || (data.getNumberOfRobotsInPlay(side) < Rules.league.robotsPlaying && data.secGameState != AdvancedData.STATE2_PENALTYSHOOT )) && !isCoach(data) || EventHandler.getInstance().lastUIEvent instanceof PickUpHL && data.team[side].player[number].penalty != PlayerInfo.PENALTY_HL_SERVICE && data.team[side].player[number].penalty != PlayerInfo.PENALTY_SUBSTITUTE || EventHandler.getInstance().lastUIEvent instanceof ServiceHL && data.team[side].player[number].penalty != PlayerInfo.PENALTY_HL_SERVICE && data.team[side].player[number].penalty != PlayerInfo.PENALTY_SUBSTITUTE || (EventHandler.getInstance().lastUIEvent instanceof PickUp && Rules.league instanceof SPL) && data.team[side].player[number].penalty != PlayerInfo.PENALTY_SPL_REQUEST_FOR_PICKUP && data.team[side].player[number].penalty != PlayerInfo.PENALTY_SUBSTITUTE || EventHandler.getInstance().lastUIEvent instanceof Substitute && data.team[side].player[number].penalty != PlayerInfo.PENALTY_SUBSTITUTE && (!isCoach(data) && (!(Rules.league instanceof SPL) || number != 0)) || (EventHandler.getInstance().lastUIEvent instanceof CoachMotion) && (isCoach(data) && (data.team[side].coach.penalty != PlayerInfo.PENALTY_SPL_COACH_MOTION)) || data.team[side].player[number].penalty == PlayerInfo.PENALTY_NONE && (EventHandler.getInstance().lastUIEvent instanceof Penalty) && !(EventHandler.getInstance().lastUIEvent instanceof CoachMotion) && !(EventHandler.getInstance().lastUIEvent instanceof Substitute) && (!isCoach(data))) || data.testmode // new player selection in penalty shootout: || (data.secGameState == AdvancedData.STATE2_PENALTYSHOOT && (data.team[side].player[number].penalty == PlayerInfo.PENALTY_NONE || data.team[side].player[number].penalty == PlayerInfo.PENALTY_SUBSTITUTE) && (data.gameState == AdvancedData.STATE_SET || data.gameState == AdvancedData.STATE_INITIAL) && !isCoach(data) && !(EventHandler.getInstance().lastUIEvent instanceof CoachMotion)); } public boolean isCoach(AdvancedData data) { return Rules.league.isCoachAvailable && number == Rules.league.teamSize; } }
5120ebabddfeefdf4de916cf23741c0d9abf178c
7eaac384d198bd1679eb9069c9aaa5f300ee7b7e
/CR/app/src/main/java/com/jeve/cr/tool/UnitTransformTool.java
3aa972e9a0e8385fcc158498abef0dab0af17c03
[]
no_license
NiuBiTeam001/NiuBiImageOCR
04575a3fa70d7e0b4021bb6ce4493e0eaca397a2
d49ef36bb0632c4a008859dd406db9741038547d
refs/heads/master
2021-05-06T10:09:38.157760
2018-01-24T02:52:37
2018-01-24T02:52:37
114,101,111
1
0
null
null
null
null
UTF-8
Java
false
false
626
java
package com.jeve.cr.tool; import android.content.Context; /** * 单位转换工具类 * lijiawei * 2017-12-13 */ public class UnitTransformTool { /** * dp 转化为 px */ public static int dp2px(Context context, float dpValue) { final float scale = context.getResources().getDisplayMetrics().density; return (int) (dpValue * scale + 0.5f); } /** * px 转化为 dp */ public static int px2dp(Context context, float pxValue) { final float scale = context.getResources().getDisplayMetrics().density; return (int) (pxValue / scale + 0.5f); } }
40ea68d2597b38a66d59ccce154cb6b9e0fd46ce
522f8d58c889c6141bf2deed6d078e97325e2d19
/src/main/java/com/supermarket/service/OrderService.java
07abe646f105b1cf1e9953aa737f69ba8b946410
[]
no_license
LYJ-victory/Supermarket
9ec956155ce72ecafa84f34323ac08ee73f21973
605e6392687f674f6d8b7b71be5ad88f6baa2fd9
refs/heads/master
2023-08-05T21:03:07.842234
2020-02-29T09:13:06
2020-02-29T09:13:06
227,852,748
0
0
null
2023-07-23T00:18:18
2019-12-13T14:03:21
CSS
UTF-8
Java
false
false
968
java
package com.supermarket.service; import com.github.pagehelper.PageInfo; import com.supermarket.bean.Cart; import com.supermarket.bean.Product; import com.supermarket.bean.TbOrder; import com.supermarket.bean.UserAddress; import com.supermarket.bean.vo.OrderManageDetal; import com.supermarket.bean.vo.OrderManageVO; import java.math.BigDecimal; import java.util.List; /** * Created by ASUS on 2020/2/3. */ public interface OrderService { String createPersonOrder(Integer id, List<Product> productList, String beizu, String sumPrice); List<OrderManageDetal> getProductListByOrderId(String orderId,Integer userId ); String updateOrderStatus(String orderNo); int countOrderSum(); BigDecimal countMoney(); PageInfo getAllOrder(int pageNum, int pageSize); TbOrder getBeiZhu(String orderNo); UserAddress getOrderAddressInfo(String orderNo); PageInfo searchOrderByOrderNo(int pageNum, int pageSize, String searchyOrderNo); }
8fddf5523374b9d0792c4a6b02031bad4346711f
e8a06fbe3043477ea3e4ee24bf7763d282ec41f0
/src/textParser/equal.java
10175289baf9ed10bf3131fcfdb1ff488c547b26
[]
no_license
acyrwus/TextParser
cff46a19a3874f7a11a7a89ddb5ad795d5296964
d274e3eefcd1f8210c6fdd2321e7d656effa694d
refs/heads/master
2020-09-13T12:28:32.087355
2019-12-04T03:00:42
2019-12-04T03:00:42
222,779,786
0
0
null
null
null
null
UTF-8
Java
false
false
1,180
java
package textParser; public class equal extends align { public equal(String inText, int inMax, boolean inSpace) { super(inText, inMax, inSpace); } public String equalOut() { //builds output lines String buildStr = ""; for(String temp : this.splitLines(text)) { String buildLine = ""; int charDiff = lineMax - temp.length(); String[] words = this.splitWord(temp); int wordsNum = words.length; double spaceVal = charDiff/(wordsNum-1) + 2; //calculate correct number of spaces spaceVal = Math.ceil(spaceVal); buildLine = buildLine + words[0]; for (int i = 1; i < wordsNum; i++) { for (int j = 0; j < spaceVal; j++) buildLine = buildLine.concat(" "); buildLine = buildLine + "" + words[i]; } /*for (String word : words) { //build string with words buildLine = buildLine + "" + word; for (int j = 0; j < spaceVal; j++) buildLine = buildLine.concat(" "); }*/ buildLine = buildLine.concat("\n"); if (space) //if double spaced buildLine = buildLine.concat("\n"); buildStr = buildStr.concat(buildLine); //add line to total string } return buildStr; } }
e1de1afd8a10ebebf0f9296ebfaf278f75393b41
26f23d1ec7cbea2def97c59a9c379720e54ffb4a
/spring-security-integration-test/src/main/java/com/spring/api/controller/SpringSecurityController.java
a7423c3b8d26e232ad51a762447c48299c097189
[]
no_license
subha2125/microservice-docker
1242edc175cb65f797b0adfa9b783afe33d28f53
26352a7956ec0f36f11f4fe12cafb66a90e22718
refs/heads/master
2022-07-08T07:53:42.687120
2021-10-29T04:53:55
2021-10-29T04:53:55
231,407,970
0
0
null
2022-06-21T04:13:29
2020-01-02T15:24:31
Java
UTF-8
Java
false
false
606
java
package com.spring.api.controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import com.spring.api.entity.Person; import com.spring.api.repository.PersonRepository; @RestController public class SpringSecurityController { @Autowired private PersonRepository repository; @GetMapping("/getAll") public List<Person> getPersons() { System.out.println("Controller getPersons() method called..."); return repository.findAll(); } }
4280770053e4a58b5b5c2844fde8ffa31db56829
6001f8e596d0e52f1627a7aa97e25a32577094c3
/app/src/androidTest/java/robert/com/recordandplayaudio/ApplicationTest.java
11426f6b0e3feb3412e4e849a5959fcc180a76c3
[]
no_license
DucHM/record-audio-play
9aa9ddc7a9d79d0675c6763ffb9ecd2804da4ca1
985c0cf1c8540e5d2ff9ea86521fa907bb629c55
refs/heads/master
2021-07-19T23:53:28.857248
2017-10-30T16:02:36
2017-10-30T16:02:36
108,398,216
0
0
null
null
null
null
UTF-8
Java
false
false
360
java
package robert.com.recordandplayaudio; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
f9fb12fcf2290acdcf42961a977ac17aa383eed0
0c7593635096b848070e4a785c58ad8922b037d7
/pipeline-12/code/org/software/region/molecule/container/net/numberable/Number0able.java
c8b26953d4efbd468d739313bc4ea8c0b2531534
[]
no_license
yanchangyou/pipeline
58a798e4ac6f8fcf729be703e16911eee8132728
6cb10723d7ed74ba54e5d62ef0f2c7061ec1e486
refs/heads/master
2016-09-05T21:13:30.940576
2010-02-05T09:46:11
2010-02-05T09:46:11
22,836,834
1
0
null
null
null
null
UTF-8
Java
false
false
122
java
package org.software.region.molecule.container.net.numberable; public interface Number0able extends Numberable { }
[ "[email protected]@43c07c84-ada0-11dd-b268-c5ee67e421db" ]
[email protected]@43c07c84-ada0-11dd-b268-c5ee67e421db
1dd0c0e5dd960fca41c3dbb2818d47a3b21d09d0
861c4198f7928f17aa1e9dd27be59ffbadae7259
/uk.ac.kcl.shiro.mydbl0304/src-gen/uk/ac/kcl/shiro/mydbl0304/scoping/AbstractMyDblScopeProvider.java
88d0e964553ef8f56daedffc7d4544c7624cbadc
[]
no_license
toaruShiro/Model-driven_Coursework
dffa8ff43e9b8103476ff1f3e8bcb3a768aa49da
b8663981b8014345b8b42938fcc04e73d9dce173
refs/heads/master
2021-04-02T08:48:59.831236
2020-03-18T15:20:03
2020-03-18T15:20:03
248,255,771
0
0
null
null
null
null
UTF-8
Java
false
false
229
java
/* * generated by Xtext 2.21.0 */ package uk.ac.kcl.shiro.mydbl0304.scoping; import org.eclipse.xtext.scoping.impl.DelegatingScopeProvider; public abstract class AbstractMyDblScopeProvider extends DelegatingScopeProvider { }
366bb8cb37597fd10043025e1f58783135c09334
a2bc06049969011354b1cdb96e6947631f0f9d1f
/core/src/test/java/org/uzlocoinj/testing/KeyChainTransactionSigner.java
83e0248eec5b3f564e45fa233de9afaac56cb12c
[ "Apache-2.0" ]
permissive
uzlocoin/Uzlocoinj
27f7093f615d83f93fcd19598c1d8c1f6b012a5b
15efb1819ced28154926c7c36d13ec765b9911ec
refs/heads/master
2023-05-09T09:38:05.328491
2021-06-03T10:26:35
2021-06-03T10:26:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,958
java
/* * Copyright 2014 Kosta Korenkov * * 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.uzlocoinj.testing; import org.uzlocoinj.core.Sha256Hash; import org.uzlocoinj.crypto.ChildNumber; import org.uzlocoinj.crypto.DeterministicKey; import org.uzlocoinj.signers.CustomTransactionSigner; import org.uzlocoinj.wallet.DeterministicKeyChain; import com.google.common.collect.ImmutableList; import java.util.List; /** * <p>Transaction signer which uses provided keychain to get signing keys from. It relies on previous signer to provide * derivation path to be used to get signing key and, once gets the key, just signs given transaction immediately.</p> * It should not be used in test scenarios involving serialization as it doesn't have proper serialize/deserialize * implementation. */ public class KeyChainTransactionSigner extends CustomTransactionSigner { private DeterministicKeyChain keyChain; public KeyChainTransactionSigner() { } public KeyChainTransactionSigner(DeterministicKeyChain keyChain) { this.keyChain = keyChain; } @Override protected SignatureAndKey getSignature(Sha256Hash sighash, List<ChildNumber> derivationPath) { ImmutableList<ChildNumber> keyPath = ImmutableList.copyOf(derivationPath); DeterministicKey key = keyChain.getKeyByPath(keyPath, true); return new SignatureAndKey(key.sign(sighash), key.dropPrivateBytes().dropParent()); } }
acbf235ae19dc689503c7b2bd61a6b70332c26d0
2895eadb19c309e7a4d269b39572eb6cb91ee752
/Sample_Java_8/src/com/xyz/java/lamda/pojo/Person.java
d3e6a823f2f4c680328815525318ef403e4343d9
[]
no_license
rahul-jacob/java
72540d6d832c18a7bbac1a07477e63e8301b9537
6159a099fb11c60ce1940b0485d84aae403a3d3f
refs/heads/master
2020-03-22T08:55:56.440370
2018-08-01T14:03:46
2018-08-01T14:03:46
139,801,738
0
0
null
null
null
null
UTF-8
Java
false
false
1,028
java
package com.xyz.java.lamda.pojo; public class Person { private int id; private String firstName; private String lastName; private String gender; public Person() { super(); } public Person(int id, String firstName, String lastName, String gender) { super(); this.id = id; this.firstName = firstName; this.lastName = lastName; this.gender = gender; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getGender() { return gender; } public void setGender(String gender) { this.gender = gender; } @Override public String toString() { return "Person [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", gender=" + gender + "]"; } }
2ac9d4cbb8385a522def8f9cf91974be31e55ded
e183891125fe6c5b46f473ed41796b5a10b9cb48
/src/minecraft/net/minecraft/block/BlockPotato.java
bc0e15a1072f4442af626219de65a7adbf1b84e8
[]
no_license
kakeli/Endless-Minecraft
f33addbcb68f4fefbb215707a7a953a645f7918e
8a5649b0c1e696f9f8cf4466037fe344ccec730f
refs/heads/master
2016-09-06T10:35:59.645473
2013-04-06T06:49:17
2013-04-06T06:49:17
9,256,292
0
1
null
null
null
null
UTF-8
Java
false
false
2,300
java
package net.minecraft.block; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.Icon; import net.minecraft.world.World; public class BlockPotato extends BlockCrops { @SideOnly(Side.CLIENT) private Icon[] iconArray; public BlockPotato(int par1) { super(par1); } @SideOnly(Side.CLIENT) /** * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata */ public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) { if (par2 < 7) { if (par2 == 6) { par2 = 5; } return this.iconArray[par2 >> 1]; } else { return this.iconArray[3]; } } /** * Generate a seed ItemStack for this crop. */ protected int getSeedItem() { return Item.potato.itemID; } /** * Generate a crop produce ItemStack for this crop. */ protected int getCropItem() { return Item.potato.itemID; } /** * Drops the block items with a specified chance of dropping the specified items */ public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) { super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7); if (!par1World.isRemote) { if (par5 >= 7 && par1World.rand.nextInt(50) == 0) { this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(Item.poisonousPotato)); } } } @SideOnly(Side.CLIENT) /** * When this method is called, your block should register all the icons it needs with the given IconRegister. This * is the only chance you get to register icons. */ public void registerIcons(IconRegister par1IconRegister) { this.iconArray = new Icon[4]; for (int i = 0; i < this.iconArray.length; ++i) { this.iconArray[i] = par1IconRegister.registerIcon("potatoes_" + i); } } }
15867374d098e80c5ff33ff6273d8913e30e56e0
fc353b3427d34a871c9f56a3c31bfe2d495419ed
/src/com/malimoi/Main/MainClient.java
1f8f001b2c5f25c5e37489a5157ad5c8db7df0a6
[]
no_license
Malimoi/YoutuberTycoon_Cards-Game
cb9daabb8084ddc885a18aee7c74b9011743a465
35a8d318136aef926f11e4c90a56da4adb69d35e
refs/heads/master
2021-01-10T17:04:20.600057
2016-04-03T15:15:33
2016-04-03T15:15:33
52,436,116
1
0
null
null
null
null
UTF-8
Java
false
false
27,578
java
package com.malimoi.Main; /* * ****************************************************** * * Copyright (C) 2016 Malimoi <[email protected]> * * * * This file (MainClient) is part of YoutuberTycoon_Cars-Game. * * * * Created by Malimoi on 23/02/16 11:34. * * * * YoutuberTycoon can not be copied and/or distributed without the express * * permission of Malimoi. * ****************************************************** */ import javax.swing.*; import com.malimoi.Main.GameFrame.PlaySound; import com.malimoi.cards.Card; import com.malimoi.cards.InfosSpeciale; import com.malimoi.cards.InfosYoutuber; import com.malimoi.cards.enums.Grades; import com.malimoi.cards.enums.TypesOfCards; import com.malimoi.cards.enums.TypesOfThemes; import com.malimoi.players.Player; import de.javasoft.plaf.synthetica.SyntheticaPlainLookAndFeel; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.*; import java.net.Socket; import java.util.ArrayList; import java.util.List; import java.util.Observable; import java.util.Observer; import java.util.Random; public class MainClient { public static String version = "Alpha 0.2"; /* * Client propieties */ public static Boolean first_conn = true; public static String first_choice = ""; /* * For server */ public static boolean send = false; public static String str_send = ""; /* * CONSTANT */ public static final String[] THEMES_IMAGES_PATH = {"HUMOUR.png","STYLE.png","SPORT.png","MUSIQUE.png","GAMING.png","EDUCATION.png"}; public static final String[] TWIIT_CONTENTS = {"La dernière vidéo de @NAME est mon coup de coeur :)","<font color=[COLOR]>#Prometteur</font> En voila du talent : [LINK]", "J'ai bien aimé ta vidéo @NAME !","A VOIR !! [LINK] Bravo au créateur !","Après une belle trouvaille en bourse, voici une bonne vidéo de @NAME !", "J'ai adoré ! [LINK]","Lui devriendra riche grâce à ses vidéos : @NAME","Hello ! Je viens de tomber sur une bonne vidéo [LINK]", "Pas mauvais du tout : [LINK]","Voici un bon vidéaste que je viens de découvirir: @NAME","Pas mal ta dernière vidéo @NAME", "WHAOU ! Du talent dans la dernière vidéo de @NAME","Félicitation @NAME pour ta dernière vidéo <font color=[COLOR]>#AReFaire</font>", "Go check la vidéo de @NAME !","Bravo à @NAME pour sa dernière vidéo !","Formidable [LINK]","Du génie [LINK]","Go check : [LINK]", "Jamais rien vu d'aussi merveilleux [LINK]", "@NAME : bien ta dernière vidéo elle déchire ;) <font color=[COLOR]>#GG</fon>"}; /* * Variables players */ public static final Card[] cards_list = { new Card("Dos de carte", TypesOfCards.BACK, null, "images/cards/DOS_DE_CARTE.png", 0), new Card("Amandine Cuisine", TypesOfCards.YOUTUBER, new InfosYoutuber(200, 3, 1, TypesOfThemes.VIEPRATIQUE_STYLE_BEAUTE, Grades.BASE, 0), "images/cards/Amandine Cuisine.png", 1), new Card("Anthony-Fitness", TypesOfCards.YOUTUBER, new InfosYoutuber(350, 5, 2, TypesOfThemes.SPORT, Grades.BASE, 0), "images/cards/Anthony-Fitness.png", 2), new Card("Aurelie Testenbeaut", TypesOfCards.YOUTUBER, new InfosYoutuber(250, 2, 3, TypesOfThemes.VIEPRATIQUE_STYLE_BEAUTE, Grades.BASE, 0), "images/cards/Aurlie Testenbeaut.png", 3), new Card("Boost vues 5k", TypesOfCards.SPECIALE, new InfosSpeciale(400, Grades.BASE, 1), "images/cards/Boost vues 5k.png", 4), new Card("CAPTAIN WORKOUT", TypesOfCards.YOUTUBER, new InfosYoutuber(450, 7, 2, TypesOfThemes.SPORT, Grades.BASE, 0), "images/cards/CAPTAIN WORKOUT.png", 5), new Card("Cedric Froment", TypesOfCards.YOUTUBER, new InfosYoutuber(300, 3, 3, TypesOfThemes.EDUCATION, Grades.BASE, 0), "images/cards/Cdric Froment.png", 6), new Card("Ellen LC", TypesOfCards.YOUTUBER, new InfosYoutuber(250, 1, 4, TypesOfThemes.VIEPRATIQUE_STYLE_BEAUTE, Grades.BASE, 0), "images/cards/Ellen LC.png", 7), new Card("Esprit Riche", TypesOfCards.YOUTUBER, new InfosYoutuber(200, 2, 2, TypesOfThemes.EDUCATION, Grades.BASE, 0), "images/cards/Esprit Riche.png", 8), new Card("Flomars", TypesOfCards.YOUTUBER, new InfosYoutuber(450, 2, 7, TypesOfThemes.GAMING, Grades.BASE, 0), "images/cards/Flomars.png", 9), new Card("FrankCotty", TypesOfCards.YOUTUBER, new InfosYoutuber(350, 3, 4, TypesOfThemes.MUSIQUE, Grades.BASE, 0), "images/cards/FrankCotty.png", 10), new Card("Delete user gamma", TypesOfCards.SPECIALE, new InfosSpeciale(650, Grades.BASE, 2), "images/cards/Delete user gamma.png", 11), new Card("Double Hearts", TypesOfCards.SPECIALE, new InfosSpeciale(650, Grades.BASE, 3), "images/cards/Double Hearts.png", 12), new Card("Double RTs", TypesOfCards.SPECIALE, new InfosSpeciale(650, Grades.BASE, 4), "images/cards/Double RTs.png", 13), new Card("Fred deBeauxArts", TypesOfCards.YOUTUBER, new InfosYoutuber(300, 3, 3, TypesOfThemes.VIEPRATIQUE_STYLE_BEAUTE, Grades.BASE, 0), "images/cards/Fred deBeauxArts.png", 14), new Card("Gadu Gaming", TypesOfCards.YOUTUBER, new InfosYoutuber(350, 4, 3, TypesOfThemes.GAMING, Grades.BASE, 0), "images/cards/Gadu Gaming.png", 15), new Card("JeanFaitTrop", TypesOfCards.YOUTUBER, new InfosYoutuber(350, 4, 3, TypesOfThemes.HUMOUR_DIVERTISSEMENT, Grades.BASE, 0), "images/cards/JeanFaitTrop.png", 16), new Card("Leonard", TypesOfCards.YOUTUBER, new InfosYoutuber(300, 2, 4, TypesOfThemes.HUMOUR_DIVERTISSEMENT, Grades.BASE, 0), "images/cards/Lonard.png", 17), new Card("Loulou", TypesOfCards.YOUTUBER, new InfosYoutuber(400, 3, 5, TypesOfThemes.HUMOUR_DIVERTISSEMENT, Grades.BASE, 0), "images/cards/Loulou.png", 18), new Card("Monte Le Son", TypesOfCards.YOUTUBER, new InfosYoutuber(150, 1, 2, TypesOfThemes.MUSIQUE, Grades.BASE, 0), "images/cards/Monte Le Son.png", 19), new Card("Napoleon", TypesOfCards.YOUTUBER, new InfosYoutuber(400, 4, 4, TypesOfThemes.GAMING, Grades.BASE, 0), "images/cards/Napoleon.png", 20), new Card("PikaShoute", TypesOfCards.YOUTUBER, new InfosYoutuber(200, 2, 2, TypesOfThemes.HUMOUR_DIVERTISSEMENT, Grades.BASE, 0), "images/cards/PikaShoute.png", 21), new Card("RAPH&MAX", TypesOfCards.YOUTUBER, new InfosYoutuber(500, 4, 6, TypesOfThemes.HUMOUR_DIVERTISSEMENT, Grades.BASE, 0), "images/cards/RAPH&MAX.png", 22), new Card("Roxas_", TypesOfCards.YOUTUBER, new InfosYoutuber(250, 4, 1, TypesOfThemes.GAMING, Grades.BASE, 0), "images/cards/Roxas_.png", 23), new Card("Samia Tsuki", TypesOfCards.YOUTUBER, new InfosYoutuber(300, 2, 4, TypesOfThemes.VIEPRATIQUE_STYLE_BEAUTE, Grades.BASE, 0), "images/cards/Samia Tsuki.png", 24), new Card("SophieGuichard", TypesOfCards.YOUTUBER, new InfosYoutuber(150, 1, 2, TypesOfThemes.EDUCATION, Grades.BASE, 0), "images/cards/SophieGuichard.png", 25), new Card("TheSeB's", TypesOfCards.YOUTUBER, new InfosYoutuber(400, 5, 3, TypesOfThemes.GAMING, Grades.BASE, 0), "images/cards/TheSeB's.png", 26), new Card("Tidark Production", TypesOfCards.YOUTUBER, new InfosYoutuber(450, 1, 8, TypesOfThemes.MUSIQUE, Grades.BASE, 0), "images/cards/Tidark Production.png", 27), new Card("Toc Production", TypesOfCards.YOUTUBER, new InfosYoutuber(350, 4, 3, TypesOfThemes.HUMOUR_DIVERTISSEMENT, Grades.BASE, 0), "images/cards/Toc Production.png", 28), new Card("ZORKA", TypesOfCards.YOUTUBER, new InfosYoutuber(450, 5, 4, TypesOfThemes.HUMOUR_DIVERTISSEMENT, Grades.BASE, 0), "images/cards/ZORKA.png", 29) }; public static List<Card> playerCards = new ArrayList<Card>(); public static Player player = new Player("Namde", 3, 1, 1, new ArrayList<Card>(), new ArrayList<Card>()); public static Boolean canPlay = false; /* * ICI : PRESENT QUE DANS LES VERSIONS TEST POUR NE PAS PASSER PAS LE LAUCHER / SERVER */ public static Boolean IsTest = false; public static ChatAccess access; public static JFrame frame; public static Integer a = 10; public static final Integer c = 10; public static void main(String[] args) { /* * CARDS-LIST */ try{ InputStream flux=new FileInputStream("card.txt"); InputStreamReader lecture=new InputStreamReader(flux); BufferedReader buff=new BufferedReader(lecture); String ligne; while ((ligne=buff.readLine())!=null){ System.out.println(ligne); } buff.close(); } catch (Exception e){ System.out.println(e.toString()); } if (!IsTest){ String server = "127.0.0.1"; int port = 25565; //ChatAccess access = null; try { access = new ChatAccess(server, port); } catch (IOException ex) { System.out.println("Cannot connect to " + server + ":" + port); ex.printStackTrace(); System.exit(0); } frame = new ChatFrame(access); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null); frame.setResizable(false); frame.setVisible(false); new Launcher(); }else{ setJFrames(); } } public static TypesOfCards getTypesOfCardsFile(String type){ TypesOfCards TOC = null; if (type.contains("YOUTUBER")){ TOC=TypesOfCards.YOUTUBER; }else if (type.contains("SPECIALE")){ TOC=TypesOfCards.SPECIALE; }else if (type.contains("BACK")){ TOC=TypesOfCards.BACK; } return TOC; } public static TypesOfThemes getThemesFile(String theme){ TypesOfThemes Theme = null; if (theme.contains("EDUCATION")){ Theme=TypesOfThemes.EDUCATION; }else if (theme.contains("GAMING")){ Theme=TypesOfThemes.GAMING; }else if (theme.contains("HUMOUR_DIVERTISSEMENT")){ Theme=TypesOfThemes.HUMOUR_DIVERTISSEMENT; }else if (theme.contains("MUSIQUE")){ Theme=TypesOfThemes.MUSIQUE; }else if (theme.contains("RIEN")){ Theme=TypesOfThemes.RIEN; }else if (theme.contains("SPORT")){ Theme=TypesOfThemes.SPORT; }else if (theme.contains("VIEPRATIQUE_STYLE_BEAUTE")){ Theme=TypesOfThemes.VIEPRATIQUE_STYLE_BEAUTE; } return Theme; } public static Grades getGradesFile(String grade){ Grades Grade = null; if (grade.contains("BASE")){ Grade=Grades.BASE; }else if (grade.contains("ARGENT")){ Grade=Grades.ARGENT; }else if (grade.contains("BRONZE")){ Grade=Grades.BRONZE; }else if (grade.contains("DIAMANT")){ Grade=Grades.DIAMANT; }else if (grade.contains("OR")){ Grade=Grades.OR; } return Grade; } public static void setJFrames(){ UIManager.put("Synthetica.window.decoration", Boolean.FALSE); try { UIManager.setLookAndFeel(new SyntheticaPlainLookAndFeel()); } catch (Exception e) { e.printStackTrace(); } new GameFrame(); } /** * Chat client access */ public static class ChatAccess extends Observable { private static final String CRLF = "\r\n"; // newline private Socket socket; private OutputStream outputStream; //private PrintWriter out = null; /** * Create socket, and receiving thread */ public ChatAccess(String server, int port) throws IOException { socket = new Socket(server, port); outputStream = socket.getOutputStream(); Thread receivingThread = new Thread() { @Override public void run() { try { BufferedReader in = new BufferedReader( new InputStreamReader(socket.getInputStream())); String line; while (true) if ((line = in.readLine()) != null){ System.out.println(line); String[] contains = line.split(" "); String[] containsVir = line.split(","); if (line.startsWith("startthegame")){ Thread pass = new Thread(new PasserelThread()); pass.start(); }else if(line.startsWith("adv")){ GameFrame.playerFollowers=0; GameFrame.advFollowers=0; String[] s = line.split(" "); GameFrame.advTrouve=true; GameFrame.StartGame(new Player(s[1], Integer.valueOf(s[2]), Integer.valueOf(s[3]), Integer.valueOf(s[4]), new ArrayList<Card>(), new ArrayList<Card>())); if (Integer.valueOf(s[5]).equals(0)){ canPlay=true; GameFrame.playerFollowers+=100; access.send("pioche"); } }else if(line.startsWith("pioche")){ Thread t = new Thread(new GameFrame.PlaySound("pop.wav")); t.start(); String name = containsVir[1]; TypesOfCards type = getTypesOfCardsFile(containsVir[2]); int followers = 0; int rts = 0; int hearts = 0; TypesOfThemes theme = TypesOfThemes.RIEN; Grades grade = Grades.BASE; int id_power = 0; String path = ""; int id = 0; if (type==TypesOfCards.YOUTUBER){ followers = Integer.valueOf(containsVir[3]); rts = Integer.valueOf(containsVir[4]); hearts = Integer.valueOf(containsVir[5]); theme = getThemesFile(containsVir[6]); grade = getGradesFile(containsVir[7]); id_power = Integer.valueOf(containsVir[8]); path = containsVir[9]; id = Integer.valueOf(containsVir[10]); }else if(type==TypesOfCards.SPECIALE){ followers = Integer.valueOf(containsVir[3]); grade = getGradesFile(containsVir[4]); id_power = Integer.valueOf(containsVir[5]); path = containsVir[6]; id = Integer.valueOf(containsVir[7]); } if (type==TypesOfCards.YOUTUBER){ player.getHandCards().add(new Card(name, type, new InfosYoutuber(followers, rts, hearts, theme, grade, id_power), path, id)); }else if(type==TypesOfCards.SPECIALE){ player.getHandCards().add(new Card(name, type, new InfosSpeciale(followers, grade, id_power), path, id)); } GameFrame.PrepareUpdate(); }else if(line.startsWith("pose")){ String name = containsVir[2]; TypesOfCards type = getTypesOfCardsFile(containsVir[3]); int followers = 0; int rts = 0; int hearts = 0; TypesOfThemes theme = TypesOfThemes.RIEN; Grades grade = Grades.BASE; int id_power = 0; String path = ""; int id = 0; if (type==TypesOfCards.YOUTUBER){ GameFrame.poseTwiit=true; followers = Integer.valueOf(containsVir[4]); rts = Integer.valueOf(containsVir[5]); hearts = Integer.valueOf(containsVir[6]); theme = getThemesFile(containsVir[7]); grade = getGradesFile(containsVir[8]); id_power = Integer.valueOf(containsVir[9]); path = containsVir[10]; id = Integer.valueOf(containsVir[11]); }else if(type==TypesOfCards.SPECIALE){ followers = Integer.valueOf(containsVir[4]); grade = getGradesFile(containsVir[5]); id_power = Integer.valueOf(containsVir[6]); path = containsVir[7]; id = Integer.valueOf(containsVir[8]); } if (type==TypesOfCards.YOUTUBER){ GameFrame.lastAdvCard=new Card(name, type, new InfosYoutuber(followers, rts, hearts, theme, grade, id_power), path, id); GameFrame.logs.add("<html><font color=red>"+GameFrame.Adversaire.getName()+"</font> pose" + " <font color=black>"+GameFrame.lastAdvCard.getName()+"</font></html>"); }else if(type==TypesOfCards.SPECIALE){ GameFrame.lastAdvCard=new Card(name, type, new InfosSpeciale(followers, grade, id_power), path, id); GameFrame.logs.add("<html><font color=red>"+GameFrame.Adversaire.getName()+"</font> pose" + " <font color=red>"+GameFrame.lastAdvCard.getName()+"</font></html>"); } if (GameFrame.lastAdvCard.getType().equals(TypesOfCards.YOUTUBER)){ Random r = new Random(); GameFrame.twiitListCard.add(GameFrame.lastAdvCard); GameFrame.twiitListPlayer.add(GameFrame.Adversaire); GameFrame.twiitListContent.add(TWIIT_CONTENTS[r.nextInt(TWIIT_CONTENTS.length)]); } GameFrame.advFollowers=(int) (Integer.valueOf(line.split(",")[1])); GameFrame.nbFollowAdv.repaint(); GameFrame.UpdateTwiits(); }else if(line.startsWith("toursuivant")){ canPlay=true; GameFrame.alreadyPlay.clear(); access.send("pioche"); GameFrame.specialMod=0; GameFrame.playerFollowers+=100; GameFrame.specialMod=0; GameFrame.PrepareUpdate(); }else if(line.startsWith("dammage")){ //pense a faire un plusieurs en 1 int place = Integer.valueOf(contains[1]); for (int i = 0; i < GameFrame.twiitListCard.size(); i++){ if (GameFrame.twiitListCard.get(place) == GameFrame.twiitListCard.get(i)){ GameFrame.twiitListCard.get(i).getInfos().setHearts(Integer.valueOf(contains[2])); if (GameFrame.twiitListCard.get(i).getInfos().getHearts() <= 0){ GameFrame.twiitListCard.remove(i); /* * Ne pas oublier d'enlever le player !!! */ GameFrame.twiitListPlayer.remove(i); GameFrame.twiitListContent.remove(i); } GameFrame.UpdateTwiits(); break; } } }else if(line.startsWith("combat")){ Card A = GameFrame.twiitListCard.get(Integer.valueOf(contains[1])); Card B = GameFrame.twiitListCard.get(Integer.valueOf(contains[2])); GameFrame.logs.add("<html>Attack entre <font color=black>"+A.getName()+" ("+A.getInfos().getRts()+"/"+A.getInfos().getHearts() +")</font> et" + " <font color=black>"+B.getName()+" ("+B.getInfos().getRts()+"/"+B.getInfos().getHearts() +")</font></html>"); GameFrame.UpdateDisplayLogs(); } else if(line.startsWith("views")){ int views = Integer.valueOf(contains[2]); Thread th = new Thread(new GameFrame.AnimationViewsThread(Integer.valueOf(contains[1]), views)); th.start(); }else if(line.startsWith("magic")){ if (Integer.valueOf(contains[1]).equals(2)){ int place = Integer.valueOf(contains[2]); for (int i = 0; i < GameFrame.twiitListCard.size(); i++){ if (GameFrame.twiitListCard.get(place) == GameFrame.twiitListCard.get(i)){ GameFrame.twiitListCard.remove(i); /* * Ne pas oublier d'enlever le player !!! */ GameFrame.twiitListPlayer.remove(i); GameFrame.twiitListContent.remove(i); GameFrame.UpdateTwiits(); break; } } }if (Integer.valueOf(contains[1]).equals(3)){ int place = Integer.valueOf(contains[2]); for (int i = 0; i < GameFrame.twiitListCard.size(); i++){ if (GameFrame.twiitListCard.get(place) == GameFrame.twiitListCard.get(i)){ GameFrame.twiitListCard.get(i).getInfos().setHearts( GameFrame.twiitListCard.get(i).getInfos().getHearts()*2); GameFrame.UpdateTwiits(); break; } } }if (Integer.valueOf(contains[1]).equals(4)){ int place = Integer.valueOf(contains[2]); for (int i = 0; i < GameFrame.twiitListCard.size(); i++){ if (GameFrame.twiitListCard.get(place) == GameFrame.twiitListCard.get(i)){ GameFrame.twiitListCard.get(i).getInfos().setRts( GameFrame.twiitListCard.get(i).getInfos().getRts()*2); GameFrame.UpdateTwiits(); break; } } } } // } } catch (IOException ex) { notifyObservers(ex); } } }; receivingThread.start(); } @Override public void notifyObservers(Object arg) { super.setChanged(); super.notifyObservers(arg); } /** * Send a line of text */ public void send(String text) { try { outputStream.write((text + CRLF).getBytes()); outputStream.flush(); } catch (IOException ex) { notifyObservers(ex); } } /** * Close the socket */ public void close() { try { socket.close(); } catch (IOException ex) { notifyObservers(ex); } } } /** * Chat client UI */ @SuppressWarnings("serial") static class ChatFrame extends JFrame implements Observer { private JTextArea textArea; private JTextField inputTextField; private JButton sendButton; private ChatAccess chatAccess; public ChatFrame(ChatAccess chatAccess) { this.chatAccess = chatAccess; chatAccess.addObserver(this); buildGUI(); } /* Builds the user interface */ private void buildGUI() { textArea = new JTextArea(20, 50); textArea.setEditable(false); textArea.setLineWrap(true); add(new JScrollPane(textArea), BorderLayout.CENTER); Box box = Box.createHorizontalBox(); add(box, BorderLayout.SOUTH); inputTextField = new JTextField(); sendButton = new JButton("Envoyé"); box.add(inputTextField); box.add(sendButton); // Action for the inputTextField and the goButton ActionListener sendListener = new ActionListener() { public void actionPerformed(ActionEvent e) { String str = inputTextField.getText(); if (str != null && str.trim().length() > 0) chatAccess.send(str); inputTextField.selectAll(); inputTextField.requestFocus(); inputTextField.setText(""); } }; inputTextField.addActionListener(sendListener); sendButton.addActionListener(sendListener); this.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { chatAccess.close(); } }); } /** * Updates the UI depending on the Object argument */ public void update(Observable o, Object arg) { final Object finalArg = arg; SwingUtilities.invokeLater(new Runnable() { public void run() { textArea.append(finalArg.toString()); textArea.append("\n"); } }); } } public static class PasserelThread implements Runnable{ public void run(){ setJFrames(); } } }
d8757e5d9cc6c593e4db4683a0cd28ac2ca50333
d073fb05c6c6eec02737ac11d298f3eba2764024
/app/src/androidTest/java/com/janoos/badi/mystrathplaces/ExampleInstrumentedTest.java
981cd6cacacdfe2d484813363a9a10e750426f0c
[]
no_license
badibuddy/strathMaps
70a7561146df74cbfed9401953a7482b43a79e6f
c88249295c4473ebefad7655e58466fa54d3311a
refs/heads/master
2020-06-20T06:06:58.226946
2019-07-15T15:28:35
2019-07-15T15:28:35
197,019,542
0
1
null
null
null
null
UTF-8
Java
false
false
731
java
package com.janoos.badi.mystrathplaces; import android.content.Context; import androidx.test.InstrumentationRegistry; import androidx.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.janoos.badi.mystrathplaces", appContext.getPackageName()); } }
1a3c78517044c7ab1d9da78efe965c5293ca0c74
845bf7dbe903809722908cdae5cf737f5bdec3f8
/src/ch05/ArrayInArrayTest.java
c99cb3ea8af10a47c2926f66333edb755069e2ed
[]
no_license
wogml3270/Java
22b19b31e206caef09f3cd71c0b08540e7ffa91f
a67cc9c713a67db4d31b44cfc67fb9201a9109e2
refs/heads/master
2023-08-19T22:43:16.347863
2021-10-06T07:33:19
2021-10-06T07:33:19
413,760,572
0
0
null
null
null
null
UTF-8
Java
false
false
1,399
java
package ch05; public class ArrayInArrayTest { /* 박재희 총점: n점, 평균: n점 김석진 총점: n점, 평균: n점 이현동 총점: n점, 평균: n점 수학 총점: n점, 평균: n점 영어 총점: n점, 평균: n점 국어 총점: n점, 평균: n점 */ public static void main(String[] args){ int[][] scores = { {75, 100, 88}, //수학 {98, 100, 76}, //영어 {100, 90, 100} //국어 }; String[] names = {"박재희", "김석진", "이현동"}; int[] stuScore = new int[names.length]; String[] clsArr = {"수학", "영어", "국어"}; int[] clsScore = new int[clsArr.length]; for(int i=0; i<=scores.length; i++){ for(int z=0; z<scores[i].length; z++){ int score = scores[i][z]; clsScore[i] += score; stuScore[z] += score; } } for(int i=0; i< stuScore.length; i++){ System.out.printf("%s 총점: %d점, 평균 %.1f점\n", names[i], stuScore[i] , (float)stuScore[i] / clsArr.length); } for(int i=0; i<clsScore.length; i++){ System.out.printf("%s 총점: %d점, 평균: %.1f점\n", names[i], stuScore[i], (float)clsScore[i] / names.length); } } }
afb0b1edc213b6b7be21ee093d48c12f3e3989a9
29c5c5d7225abe3ce068d4cc819803747c47b3e7
/test/regression/src/org/jacorb/test/notification/typed/TypedProxyPushConsumerImplTest.java
46f9d754c02d0746aff44779f9d07b62dffd8e60
[]
no_license
wolfc/jacorb
308a770016586ce3e8f902507ba1bde295df78c1
40e0ec34c36fdcfe67b67a9ceba729e1d4581899
refs/heads/master
2020-05-02T12:50:56.097066
2010-05-25T22:23:05
2010-05-25T22:23:05
686,203
0
1
null
null
null
null
UTF-8
Java
false
false
7,723
java
package org.jacorb.test.notification.typed; /* * JacORB - a free Java ORB * * Copyright (C) 1997-2003 Gerald Brose. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ import junit.framework.Test; import org.easymock.AbstractMatcher; import org.easymock.MockControl; import org.jacorb.notification.OfferManager; import org.jacorb.notification.SubscriptionManager; import org.jacorb.notification.TypedEventMessage; import org.jacorb.notification.engine.TaskProcessor; import org.jacorb.notification.interfaces.Message; import org.jacorb.notification.servant.ITypedAdmin; import org.jacorb.notification.servant.TypedProxyPushConsumerImpl; import org.jacorb.test.notification.common.NotificationTestCase; import org.jacorb.test.notification.common.NotificationTestCaseSetup; import org.omg.CORBA.Any; import org.omg.CORBA.NO_IMPLEMENT; import org.omg.CosNotification.EventType; import org.omg.CosNotification.EventTypeHelper; import org.omg.CosNotification.Property; import org.omg.CosNotifyChannelAdmin.ProxyType; import org.omg.CosNotifyChannelAdmin.SupplierAdmin; import org.omg.CosNotifyComm.PushSupplierOperations; import org.omg.CosNotifyComm.PushSupplierPOATie; import org.omg.CosTypedNotifyChannelAdmin.TypedProxyPushConsumer; import org.omg.CosTypedNotifyChannelAdmin.TypedProxyPushConsumerHelper; /** * @author Alphonse Bendt * @version $Id: TypedProxyPushConsumerImplTest.java,v 1.10 2006-11-27 14:45:18 alphonse.bendt Exp $ */ public class TypedProxyPushConsumerImplTest extends NotificationTestCase { private TypedProxyPushConsumerImpl objectUnderTest_; private TypedProxyPushConsumer proxyPushConsumer_; private final static String DRINKING_COFFEE_ID = "::org::jacorb::test::notification::typed::Coffee::drinking_coffee"; private MockControl controlAdmin_; private ITypedAdmin mockAdmin_; private MockControl controlSupplierAdmin_; private SupplierAdmin mockSupplierAdmin_; public void setUpTest() throws Exception { controlAdmin_ = MockControl.createNiceControl(ITypedAdmin.class); mockAdmin_ = (ITypedAdmin) controlAdmin_.getMock(); mockAdmin_.getProxyID(); controlAdmin_.setReturnValue(10); mockAdmin_.isIDPublic(); controlAdmin_.setReturnValue(true); mockAdmin_.getContainer(); controlAdmin_.setReturnValue(getPicoContainer()); mockAdmin_.getSupportedInterface(); controlAdmin_.setDefaultReturnValue(CoffeeHelper.id()); controlAdmin_.replay(); controlSupplierAdmin_ = MockControl.createControl(SupplierAdmin.class); mockSupplierAdmin_ = (SupplierAdmin) controlSupplierAdmin_.getMock(); objectUnderTest_ = new TypedProxyPushConsumerImpl(mockAdmin_, mockSupplierAdmin_, getORB(), getPOA(), getConfiguration(), getTaskProcessor(), getMessageFactory(), new OfferManager(), new SubscriptionManager(), getRepository()); proxyPushConsumer_ = TypedProxyPushConsumerHelper.narrow(objectUnderTest_.activate()); } public TypedProxyPushConsumerImplTest(String name, NotificationTestCaseSetup setup) { super(name, setup); } public void testID() { assertEquals(new Integer(10), objectUnderTest_.getID()); assertTrue(objectUnderTest_.isIDPublic()); } public void testGetTypedConsumer() throws Exception { Coffee coffee = CoffeeHelper.narrow(proxyPushConsumer_.get_typed_consumer()); assertNotNull(coffee); assertTrue(coffee._is_a(CoffeeHelper.id())); } public void testInvokeDrinkingCoffee() throws Exception { MockControl controlTaskProcessor = MockControl.createControl(TaskProcessor.class); TaskProcessor mockTaskProcessor = (TaskProcessor) controlTaskProcessor.getMock(); TypedEventMessage message = new TypedEventMessage(); Message handle = message.getHandle(); mockTaskProcessor.processMessage(handle); controlTaskProcessor.setMatcher(new AbstractMatcher() { protected boolean argumentMatches(Object exp, Object act) { Message mesg = (Message) exp; assertEquals(Message.TYPE_TYPED, mesg.getType()); try { Property[] _props = mesg.toTypedEvent(); assertEquals("event_type", _props[0].name); EventType et = EventTypeHelper.extract(_props[0].value); assertEquals(CoffeeHelper.id(), et.domain_name); assertEquals(DRINKING_COFFEE_ID, et.type_name); assertEquals("name", _props[1].name); assertEquals("jacorb", _props[1].value.extract_string()); assertEquals("minutes", _props[2].name); assertEquals(10, _props[2].value.extract_long()); } catch (Exception e) { fail(); } return true; } }); controlTaskProcessor.replay(); objectUnderTest_ = new TypedProxyPushConsumerImpl(mockAdmin_, mockSupplierAdmin_, getORB(), getPOA(), getConfiguration(), mockTaskProcessor, getMessageFactory(), new OfferManager(), new SubscriptionManager(), getRepository()); proxyPushConsumer_ = TypedProxyPushConsumerHelper.narrow(objectUnderTest_.activate()); org.omg.CORBA.Object obj = CoffeeHelper.narrow(proxyPushConsumer_.get_typed_consumer()); // some extra steps involved as local invocations are not // supported on dsi servants. String coffString = obj.toString(); Coffee coffee = CoffeeHelper.narrow(getClientORB().string_to_object(coffString)); coffee.drinking_coffee("jacorb", 10); controlTaskProcessor.verify(); } public void testMyType() throws Exception { assertEquals(ProxyType.PUSH_TYPED, proxyPushConsumer_.MyType()); } public void testPushAny() throws Exception { MockControl controlPushSupplier = MockControl.createControl(PushSupplierOperations.class); PushSupplierOperations mockPushSupplier = (PushSupplierOperations) controlPushSupplier .getMock(); controlPushSupplier.replay(); PushSupplierPOATie tie = new PushSupplierPOATie(mockPushSupplier); proxyPushConsumer_.connect_typed_push_supplier(tie._this(getClientORB())); Any any = getORB().create_any(); any.insert_string("push"); try { proxyPushConsumer_.push(any); fail("TypedProxyPushConsumer shouldn't support untyped push"); } catch (NO_IMPLEMENT e) { // expected } controlPushSupplier.verify(); } public static Test suite() throws Exception { return NotificationTestCase.suite("TypedProxyPushConsumer Tests", TypedProxyPushConsumerImplTest.class); } }
47cf57f97189e2eda61cffd00994cc7965c3e37a
4b66a647fbd8c8434a1be3f084de58921c821d87
/payment-sdk/src/main/java/live/lingting/sdk/enums/Currency.java
43983350a2039f1712e56baa86eb814c2e938e45
[ "MIT" ]
permissive
Lu-Lucifer/ballcat-payment-platform
455805d14d1e93e1aa73f5cbbc253385cbd59214
1d4523731fe5e5e1d4e7160f726aa1299ebda82a
refs/heads/main
2023-08-03T09:12:09.355703
2021-06-22T06:45:08
2021-06-22T06:45:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
289
java
package live.lingting.sdk.enums; import lombok.AllArgsConstructor; import lombok.Getter; /** * @author lingting 2021/6/4 11:26 */ @Getter @AllArgsConstructor public enum Currency { /** * CNY */ CNY(false), /** * USDT */ USDT(true), ; private final Boolean virtual; }
ec0121549d6f2a256fc7e48271b6ee77fec4764e
3bab81792c722411c542596fedc8e4b1d086c1a9
/src/main/java/com/gome/maven/codeInsight/completion/RecursionWeigher.java
c615c0f928a68b6f5da49f12e9145d320cfe7679
[]
no_license
nicholas879110/maven-code-check-plugin
80d6810cc3c12a3b6c22e3eada331136e3d9a03e
8162834e19ed0a06ae5240b5e11a365c0f80d0a0
refs/heads/master
2021-04-30T07:09:42.455482
2018-03-01T03:21:21
2018-03-01T03:21:21
121,457,530
0
0
null
null
null
null
UTF-8
Java
false
false
9,011
java
/* * Copyright 2000-2012 JetBrains s.r.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 com.gome.maven.codeInsight.completion; import com.gome.maven.codeInsight.ExpectedTypeInfo; import com.gome.maven.codeInsight.JavaPsiEquivalenceUtil; import com.gome.maven.codeInsight.lookup.LookupElement; import com.gome.maven.codeInsight.lookup.LookupElementWeigher; import com.gome.maven.openapi.util.Comparing; import com.gome.maven.patterns.PsiJavaPatterns; import com.gome.maven.patterns.StandardPatterns; import com.gome.maven.psi.*; import com.gome.maven.psi.filters.AndFilter; import com.gome.maven.psi.filters.ClassFilter; import com.gome.maven.psi.filters.ElementFilter; import com.gome.maven.psi.filters.element.ExcludeDeclaredFilter; import com.gome.maven.psi.filters.element.ExcludeSillyAssignment; import com.gome.maven.psi.impl.search.MethodDeepestSuperSearcher; import com.gome.maven.psi.scope.ElementClassFilter; import com.gome.maven.psi.util.PropertyUtil; import com.gome.maven.psi.util.PsiTreeUtil; import com.gome.maven.util.CommonProcessors; /** * @author peter */ class RecursionWeigher extends LookupElementWeigher { private final ElementFilter myFilter; private final PsiElement myPosition; private final PsiReferenceExpression myReference; private final PsiMethodCallExpression myExpression; private final PsiMethod myPositionMethod; private final ExpectedTypeInfo[] myExpectedInfos; private final PsiExpression myCallQualifier; private final PsiExpression myPositionQualifier; private final boolean myDelegate; private final CompletionType myCompletionType; public RecursionWeigher(PsiElement position, CompletionType completionType, PsiReferenceExpression reference, PsiMethodCallExpression expression, ExpectedTypeInfo[] expectedInfos) { super("recursion"); myCompletionType = completionType; myFilter = recursionFilter(position); myPosition = position; myReference = reference; myExpression = expression; myPositionMethod = PsiTreeUtil.getParentOfType(position, PsiMethod.class, false); myExpectedInfos = expectedInfos; myCallQualifier = normalizeQualifier(myReference.getQualifierExpression()); myPositionQualifier = normalizeQualifier(position.getParent() instanceof PsiJavaCodeReferenceElement ? ((PsiJavaCodeReferenceElement)position.getParent()).getQualifier() : null); myDelegate = isDelegatingCall(); } private static PsiExpression normalizeQualifier( PsiElement qualifier) { return qualifier instanceof PsiThisExpression || !(qualifier instanceof PsiExpression) ? null : (PsiExpression)qualifier; } private boolean isDelegatingCall() { if (myCallQualifier != null && myPositionQualifier != null && myCallQualifier != myPositionQualifier && JavaPsiEquivalenceUtil.areExpressionsEquivalent(myCallQualifier, myPositionQualifier)) { return false; } if (myCallQualifier == null && myPositionQualifier == null) { return false; } return true; } static ElementFilter recursionFilter(PsiElement element) { if (PsiJavaPatterns.psiElement().afterLeaf(PsiKeyword.RETURN).inside(PsiReturnStatement.class).accepts(element)) { return new ExcludeDeclaredFilter(ElementClassFilter.METHOD); } if (PsiJavaPatterns.psiElement().inside( StandardPatterns.or( PsiJavaPatterns.psiElement(PsiAssignmentExpression.class), PsiJavaPatterns.psiElement(PsiVariable.class))). andNot(PsiJavaPatterns.psiElement().afterLeaf(".")).accepts(element)) { return new AndFilter(new ExcludeSillyAssignment(), new ExcludeDeclaredFilter(new ClassFilter(PsiVariable.class))); } return null; } private enum Result { delegation, normal, passingObjectToItself, recursive, } @Override public Result weigh( LookupElement element) { final Object object = element.getObject(); if (!(object instanceof PsiMethod || object instanceof PsiVariable || object instanceof PsiExpression)) return Result.normal; if (myFilter != null && !myFilter.isAcceptable(object, myPosition)) { return Result.recursive; } if (isPassingObjectToItself(object) && myCompletionType == CompletionType.SMART) { return Result.passingObjectToItself; } if (myExpectedInfos != null) { final PsiType itemType = JavaCompletionUtil.getLookupElementType(element); if (itemType != null) { boolean hasRecursiveInvocations = false; boolean hasOtherInvocations = false; for (final ExpectedTypeInfo expectedInfo : myExpectedInfos) { PsiMethod calledMethod = expectedInfo.getCalledMethod(); if (!expectedInfo.getType().isAssignableFrom(itemType)) continue; if (calledMethod != null && calledMethod.equals(myPositionMethod) || isGetterSetterAssignment(object, calledMethod)) { hasRecursiveInvocations = true; } else if (calledMethod != null) { hasOtherInvocations = true; } } if (hasRecursiveInvocations && !hasOtherInvocations) { return myDelegate ? Result.delegation : Result.recursive; } } } if (myExpression != null) { return Result.normal; } if (object instanceof PsiMethod && myPositionMethod != null) { final PsiMethod method = (PsiMethod)object; if (PsiTreeUtil.isAncestor(myReference, myPosition, false) && Comparing.equal(method.getName(), myPositionMethod.getName())) { if (!myDelegate && findDeepestSuper(method).equals(findDeepestSuper(myPositionMethod))) { return Result.recursive; } return Result.delegation; } } return Result.normal; } private String getSetterPropertyName( PsiMethod calledMethod) { if (PropertyUtil.isSimplePropertySetter(calledMethod)) { assert calledMethod != null; return PropertyUtil.getPropertyName(calledMethod); } PsiReferenceExpression reference = ExcludeSillyAssignment.getAssignedReference(myPosition); if (reference != null) { PsiElement target = reference.resolve(); if (target instanceof PsiField) { return PropertyUtil.suggestPropertyName((PsiField)target); } } return null; } private boolean isGetterSetterAssignment(Object lookupObject, PsiMethod calledMethod) { String prop = getSetterPropertyName(calledMethod); if (prop == null) return false; if (lookupObject instanceof PsiField && prop.equals(PropertyUtil.suggestPropertyName((PsiField)lookupObject))) { return true; } if (lookupObject instanceof PsiMethod && PropertyUtil.isSimplePropertyGetter((PsiMethod)lookupObject) && prop.equals(PropertyUtil.getPropertyName((PsiMethod)lookupObject))) { return true; } return false; } private boolean isPassingObjectToItself(Object object) { if (object instanceof PsiThisExpression) { return myCallQualifier != null && !myDelegate || myCallQualifier instanceof PsiSuperExpression; } return myCallQualifier instanceof PsiReferenceExpression && object.equals(((PsiReferenceExpression)myCallQualifier).advancedResolve(true).getElement()); } public static PsiMethod findDeepestSuper( final PsiMethod method) { CommonProcessors.FindFirstProcessor<PsiMethod> processor = new CommonProcessors.FindFirstProcessor<PsiMethod>(); MethodDeepestSuperSearcher.processDeepestSuperMethods(method, processor); final PsiMethod first = processor.getFoundValue(); return first == null ? method : first; } }
3c5ef3a5deab1ffaf82d4545b78953cbaa0a249d
ab027a649064454f0580a110f25970e8b1202ced
/app/src/androidTest/java/com/shoppingstreet/idle/ExampleInstrumentedTest.java
ce5911176653a02a52b041d00b00d8b1e2ae7438
[]
no_license
fableyjg/MopubCustomCNAdapter
5c8bc4bd9c477455f6436590179a2b75b579b8c8
84929a25098a6eb7c5312513b126671c03a41299
refs/heads/master
2022-11-30T06:20:04.712322
2020-08-10T10:07:11
2020-08-10T10:07:11
259,506,798
1
0
null
null
null
null
UTF-8
Java
false
false
762
java
package com.shoppingstreet.idle; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.shoppingstreet.idle", appContext.getPackageName()); } }
5c033c604331535ffff90955947b205d426ec78a
40c948a3b98fc010e247258015331c99b1284b31
/src/ListaDupla/ILista.java
118a8a9bb9381bf9079dfeb6b38a08a3e122671d
[]
no_license
nathanfeitoza/RelatorioED1
7dc215ff02ad0401d4aa8216766e6dce9ab2798a
204b54cb199762c358a2f537e4ab362fe819cd47
refs/heads/master
2020-03-18T18:29:03.828051
2018-06-13T21:29:08
2018-06-13T21:29:08
135,095,667
0
0
null
null
null
null
UTF-8
Java
false
false
985
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 ListaDupla; import java.security.InvalidParameterException; /** * * @author 11645 */ public interface ILista<Tipo> extends Iterable<Tipo>{ public void adicionar(Tipo elemento); public void adicionar(int posicao, Tipo elemento) throws InvalidParameterException; public void adicionarNoInicio(Tipo elemento); public boolean contem(Tipo elemento) throws InvalidParameterException; public Tipo obter(int posicao) throws InvalidParameterException; public int tamanho(); public default int capacidade(){ return Integer.MAX_VALUE; } public void remover(int posicao) throws InvalidParameterException; public int remover(Tipo elemento); public void removerDoInicio(); public void limpar(); }
f69152d188ee1115ca217322e62adf308228c591
3c2b470251f30bcd0adf1e6ca6ee5cce986e2a88
/app/src/main/java/com/jiangtea/dgdemo/DialogActivity.java
a5869578ad1fcbe4596253f0b7f25886735cf9d4
[]
no_license
liutingwangrui/DgDemo-master
28e46c55e953cf76216730453dee2ed00f4fab5f
2c0c5c98251ac6b564fa214609fd0a833f99975a
refs/heads/master
2020-03-21T19:52:38.233483
2018-06-28T06:20:36
2018-06-28T06:20:36
138,975,037
0
0
null
null
null
null
UTF-8
Java
false
false
1,079
java
package com.jiangtea.dgdemo; import android.os.Bundle; import android.view.View; import android.widget.Button; import java.util.ArrayList; import java.util.List; import me.imid.swipebacklayout.lib.app.SwipeBackActivity; /** * Created by Administrator on 2018/6/28 0028. */ public class DialogActivity extends SwipeBackActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initData(); Button btn = (Button) findViewById(R.id.btn); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { BottomStyleDialog bottomStyleDialog = new BottomStyleDialog(DialogActivity.this,data); bottomStyleDialog.show(); } }); } private List<String>data=new ArrayList<>(); private void initData() { // 填充数据集合 for (int i = 0; i <3; i++) { data.add("第"+i+"条数据"); } } }
42a50934a052b109bb8164fe0e1726c243744ab8
e087c76b3eaf81400630369034b8954b8a6b6931
/Crazyblocks/src/org/delmesoft/crazyblocks/entity/Mob.java
ee1e7c997bf9cb21ce3b77bde1589a218f0a2e69
[ "BSD-3-Clause" ]
permissive
sergiss/voxel-engine
84130fddba28697b8a3625bcf5046aabe9c426af
bf4ac82e61a062443c1412d9c809930cecc0eab4
refs/heads/master
2023-07-24T04:49:56.674950
2021-09-03T22:53:30
2021-09-03T22:53:30
349,964,488
23
5
BSD-3-Clause
2021-06-08T12:17:05
2021-03-21T10:28:30
Java
UTF-8
Java
false
false
470
java
package org.delmesoft.crazyblocks.entity; import org.delmesoft.crazyblocks.math.Vec3i; import org.delmesoft.crazyblocks.world.blocks.Blocks; public abstract class Mob extends Entity { public static final int RAY_LEN = 5; protected float speed; protected Vec3i rayPoint = new Vec3i(); protected Blocks.Block rayBlock = Blocks.AIR; public Mob(float x, float y, float z, float width, float height, float depth) { super(x, y, z, width, height, depth); } }
d3560d25e5df9580522bd2798fc1eb3527f2f594
f25f4440136fed7953575082889a6b974469c0be
/HW05/src/tr/com/ckama/Q27.java
56f1f3927f6f43ae301b8913a7b90fb5782b1203
[]
no_license
cihatkama/JavaTraining
e636f5a7180f6fbc561713c4d0a7f2aa819ed29e
00e745ce36ad54361cc4023eecab019e14df9b7e
refs/heads/master
2022-11-05T16:20:45.973223
2020-06-22T21:01:50
2020-06-22T21:01:50
254,942,928
1
0
null
2020-05-27T12:44:42
2020-04-11T19:45:45
Java
UTF-8
Java
false
false
285
java
package tr.com.ckama; public class Q27 { public static void main(String[] args) { boolean balloonInflated = false; do { if (!balloonInflated) { balloonInflated = true; System.out.print("inflate-"); } } while (!balloonInflated); System.out.println("done"); } }
5f43570d76f5349596ed366b89b378df91ffab45
b0d2112a55748564e7067b1b1e415cd98e50602d
/backend/src/main/java/com/mauricioargj/dsdeliver/DsdeliverApplication.java
e0e0c513b44a1127c7f571731e3abb1d7f94f147
[]
no_license
mauricioargj/dsdeliver-sds2
de1a26fc7e270935ade444fd5c3a9f74d9048a2e
903cb4eabade5023627706081fc7049dfa95401e
refs/heads/main
2023-03-02T10:08:42.859932
2021-02-12T04:01:09
2021-02-12T04:01:09
336,435,295
0
0
null
null
null
null
UTF-8
Java
false
false
325
java
package com.mauricioargj.dsdeliver; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class DsdeliverApplication { public static void main(String[] args) { SpringApplication.run(DsdeliverApplication.class, args); } }
b8e775ba62820b26ed151c5f836fde0dfb0f49d9
4d69b8b3a8025dc9a8660090005e93943924b915
/src/day59_Polymorphism/AnimalShow59.java
90c5300eca5bbe36fa2de7ed56da6ee34619f85e
[]
no_license
HurmaH/JavaCore
648de2cbb2935ac0edcb0760caf70832a33e65ac
b7ba23c74849dbb6131cceb7fc5db676ac094e03
refs/heads/master
2020-06-04T00:47:46.598461
2019-07-21T21:42:27
2019-07-21T21:42:27
191,799,853
0
0
null
null
null
null
UTF-8
Java
false
false
1,158
java
package day59_Polymorphism; import day58_Interface_PolymorphismIntro.*; //importing day58 package public class AnimalShow59 { public static void main(String[] args) { //Cat is a Cat Cat c1 = new Cat(); //Cat is an Animal Animal c2 = new Cat(); //Cat is an IndorPet IndoorPet c3 = new Cat(); //Cat IS-A Object Object c4 = new Cat(); //-------------------------- //copying the address stored inside c1 //into c5 variable Cat c5 = c1; //c1 = newDog(); Animal a1 = c1; Animal myAnimal = new Animal(); myAnimal.makeNoise();// general Noise //if the method is abstract in super class, //super class should be abstract as well. //However in that case we cannot create Animal object myAnimal = new Cat(); myAnimal.makeNoise();//Miao Miao myAnimal = new Dog(); myAnimal.makeNoise();//Woof Woof new Dog().makeNoise();//woof woof //Fields application //If you refer DOg as animal //it will do only general animal related stuff Animal a2 = new Dog(); System.out.println(a2.legsCount); //a2.breed; cannot reach } }
0cd235b9435c3d7e5fcaddaf86cba947ebfd235c
585f77a178c80bf23aafc70d0333acf18ab681f1
/src/main/java/com/teamacronymcoders/base/modules/tool/CapabilityProviderTool.java
c3551d4bd3da74f8e1851d7e8c4a7af0bc651edb
[ "MIT" ]
permissive
The-Acronym-Coders/BASE
7c79922157cd3af769547b776399b56c54d87ed4
6d151a087ddb53d89c749ccbaf322b523371a180
refs/heads/develop/1.12.0
2021-06-10T01:37:07.148204
2021-05-31T18:07:14
2021-05-31T18:07:14
62,005,393
18
26
null
2023-03-23T16:43:44
2016-06-26T19:43:50
Java
UTF-8
Java
false
false
950
java
package com.teamacronymcoders.base.modules.tool; import com.teamacronymcoders.base.Capabilities; import com.teamacronymcoders.base.api.ITool; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; import javax.annotation.Nonnull; public class CapabilityProviderTool implements ICapabilityProvider { private ITool spanner; public CapabilityProviderTool() { this(new ITool(){}); } public CapabilityProviderTool(ITool cap) { this.spanner = cap; } @Override public boolean hasCapability(@Nonnull Capability<?> capability, EnumFacing facing) { return capability == Capabilities.TOOL; } @Override public <T> T getCapability(@Nonnull Capability<T> capability, EnumFacing facing) { return capability == Capabilities.TOOL ? Capabilities.TOOL.cast(spanner) : null; } }
7955263676891e16dce73e9dd17f6f66bbbd66cd
920ca460cd232f24964149362d32c8eaf127aa32
/RangeAddition-598.java
92658ec15ce90b0ead20b768dbf8ad9bc0bbdc64
[]
no_license
nikhillahoti/LeetCode_Solutions
db0abcd9a46bd092d7e8490343373d26ee3c761a
b5ce5f6b9c987d0fb5a44f1920ee7d528539196e
refs/heads/master
2021-06-18T17:10:42.950854
2019-07-27T21:36:30
2019-07-27T21:36:30
114,444,775
0
0
null
null
null
null
UTF-8
Java
false
false
412
java
class Solution { public int maxCount(int m, int n, int[][] ops) { if(ops == null || ops.length < 1) return m * n; int minRow = m; int minCol = n; for(int i = 0 ; i < ops.length ; i++) { minRow = Math.min(minRow, ops[i][0]); minCol = Math.min(minCol, ops[i][1]); } return minRow * minCol; } }
b22075c3bd6e18e816bd625d107a7e228166b90b
1ba886216ee9fc455460059b068800f2a17521e0
/src/Client.java
ff16baf95fa245f40a999f32b5eae3f43d104017
[]
no_license
malvat/FileTransfer
5baa0104c7ee97d8dec8ad451e5b7cea0fab5346
a4a8c9911cf27e17518526b2d278a264e2833c5f
refs/heads/master
2022-11-27T11:23:33.194025
2020-08-09T08:14:04
2020-08-09T08:14:04
285,853,525
1
0
null
null
null
null
UTF-8
Java
false
false
3,247
java
import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.net.Socket; import java.net.UnknownHostException; import java.util.Scanner; public class Client { private Socket socket = null; private Scanner input = null; private DataOutputStream out = null; private DataInputStream in = null; public Client(String address, int port) { try { socket = new Socket(address, port); input = new Scanner(System.in); out = new DataOutputStream(socket.getOutputStream()); in = new DataInputStream(socket.getInputStream()); } catch(UnknownHostException u) { System.out.println("unknown host exception"); } catch(IOException io) { System.out.println(io + "io exception"); } String line; try { while(true) { System.out.println("please enter command: "); line = input.nextLine(); out.writeUTF(line); Util.CMD cmd = Util.readCommand(line); String[] splits = line.split(" "); if(cmd == Util.CMD.GET) { // get a file from server line = in.readUTF(); System.out.println(line); if(line.equals("file not found")) { continue; } getFile(in, splits[1]); line = in.readUTF(); System.out.println(line); } else if(cmd == Util.CMD.PUT) { // send a file to server putFile("client_files\\" + splits[1], out); } else if(cmd == Util.CMD.QUIT) { // quit in.close(); out.close(); socket.close(); System.out.println("closing connection"); System.out.println("bye bye"); return; } } } catch(IOException io) { System.out.println("input or ouput error after entering command"); return; } } public void getFile(DataInputStream in, String filename) { try { String line; File file = new File("client_files\\" + filename); BufferedWriter fileOutput = new BufferedWriter(new FileWriter(file)); while(true) { line = in.readUTF(); if(line.equals("end")) { break; } fileOutput.write(line + "\n"); } fileOutput.close(); } catch(IOException io) { System.out.println("input error"); } } public void putFile(String filename, DataOutputStream out) { File file; file = new File(filename); if(file.exists() && !file.isDirectory()) { try { out.writeUTF(filename + " found"); System.out.println("uploading file"); BufferedReader reader = new BufferedReader(new FileReader(file)); String line; while( (line = reader.readLine()) != null) { out.writeUTF(line); } out.writeUTF("end"); out.writeUTF("download complete"); System.out.println("upload complete"); reader.close(); } catch(IOException io) { System.out.println("cannnot read the file"); } } else { try { out.writeUTF("file not found"); } catch(IOException io) { System.out.println("output error"); } System.out.println(filename + " not found"); } } public static void main(String[] args) { Client client = new Client("127.0.0.1", 8080); } }
f2ccec826bcfb4b0dc5e79f49c32c1fea4416b7f
6cc7cc9c600c3559799006875d3ed18619957df2
/build/app/generated/not_namespaced_r_class_sources/debug/r/io/flutter/plugins/firebaseauth_web/R.java
9dbca66f7b8ff4952999484a454ba716c4d8a4e9
[]
no_license
seadhant/Seachat-flutter-chat-app
d494fcd7976e4a7687e347768554765740369c06
119f671db559ee327d77f20fd076c9b41f942a3f
refs/heads/master
2022-10-16T04:18:11.093768
2020-06-07T20:15:54
2020-06-07T20:15:54
257,807,914
0
0
null
null
null
null
UTF-8
Java
false
false
13,495
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package io.flutter.plugins.firebaseauth_web; public final class R { private R() {} public static final class attr { private attr() {} public static final int alpha = 0x7f020027; public static final int font = 0x7f020076; public static final int fontProviderAuthority = 0x7f020078; public static final int fontProviderCerts = 0x7f020079; public static final int fontProviderFetchStrategy = 0x7f02007a; public static final int fontProviderFetchTimeout = 0x7f02007b; public static final int fontProviderPackage = 0x7f02007c; public static final int fontProviderQuery = 0x7f02007d; public static final int fontStyle = 0x7f02007e; public static final int fontVariationSettings = 0x7f02007f; public static final int fontWeight = 0x7f020080; public static final int ttcIndex = 0x7f020109; } public static final class color { private color() {} public static final int notification_action_color_filter = 0x7f040047; public static final int notification_icon_bg_color = 0x7f040048; public static final int ripple_material_light = 0x7f040052; public static final int secondary_text_default_material_light = 0x7f040054; } public static final class dimen { private dimen() {} public static final int compat_button_inset_horizontal_material = 0x7f05004b; public static final int compat_button_inset_vertical_material = 0x7f05004c; public static final int compat_button_padding_horizontal_material = 0x7f05004d; public static final int compat_button_padding_vertical_material = 0x7f05004e; public static final int compat_control_corner_material = 0x7f05004f; public static final int compat_notification_large_icon_max_height = 0x7f050050; public static final int compat_notification_large_icon_max_width = 0x7f050051; public static final int notification_action_icon_size = 0x7f05005b; public static final int notification_action_text_size = 0x7f05005c; public static final int notification_big_circle_margin = 0x7f05005d; public static final int notification_content_margin_start = 0x7f05005e; public static final int notification_large_icon_height = 0x7f05005f; public static final int notification_large_icon_width = 0x7f050060; public static final int notification_main_column_padding_top = 0x7f050061; public static final int notification_media_narrow_margin = 0x7f050062; public static final int notification_right_icon_size = 0x7f050063; public static final int notification_right_side_padding_top = 0x7f050064; public static final int notification_small_icon_background_padding = 0x7f050065; public static final int notification_small_icon_size_as_large = 0x7f050066; public static final int notification_subtext_size = 0x7f050067; public static final int notification_top_pad = 0x7f050068; public static final int notification_top_pad_large_text = 0x7f050069; } public static final class drawable { private drawable() {} public static final int notification_action_background = 0x7f06006a; public static final int notification_bg = 0x7f06006b; public static final int notification_bg_low = 0x7f06006c; public static final int notification_bg_low_normal = 0x7f06006d; public static final int notification_bg_low_pressed = 0x7f06006e; public static final int notification_bg_normal = 0x7f06006f; public static final int notification_bg_normal_pressed = 0x7f060070; public static final int notification_icon_background = 0x7f060071; public static final int notification_template_icon_bg = 0x7f060072; public static final int notification_template_icon_low_bg = 0x7f060073; public static final int notification_tile_bg = 0x7f060074; public static final int notify_panel_notification_icon_bg = 0x7f060075; } public static final class id { private id() {} public static final int accessibility_action_clickable_span = 0x7f070006; public static final int accessibility_custom_action_0 = 0x7f070007; public static final int accessibility_custom_action_1 = 0x7f070008; public static final int accessibility_custom_action_10 = 0x7f070009; public static final int accessibility_custom_action_11 = 0x7f07000a; public static final int accessibility_custom_action_12 = 0x7f07000b; public static final int accessibility_custom_action_13 = 0x7f07000c; public static final int accessibility_custom_action_14 = 0x7f07000d; public static final int accessibility_custom_action_15 = 0x7f07000e; public static final int accessibility_custom_action_16 = 0x7f07000f; public static final int accessibility_custom_action_17 = 0x7f070010; public static final int accessibility_custom_action_18 = 0x7f070011; public static final int accessibility_custom_action_19 = 0x7f070012; public static final int accessibility_custom_action_2 = 0x7f070013; public static final int accessibility_custom_action_20 = 0x7f070014; public static final int accessibility_custom_action_21 = 0x7f070015; public static final int accessibility_custom_action_22 = 0x7f070016; public static final int accessibility_custom_action_23 = 0x7f070017; public static final int accessibility_custom_action_24 = 0x7f070018; public static final int accessibility_custom_action_25 = 0x7f070019; public static final int accessibility_custom_action_26 = 0x7f07001a; public static final int accessibility_custom_action_27 = 0x7f07001b; public static final int accessibility_custom_action_28 = 0x7f07001c; public static final int accessibility_custom_action_29 = 0x7f07001d; public static final int accessibility_custom_action_3 = 0x7f07001e; public static final int accessibility_custom_action_30 = 0x7f07001f; public static final int accessibility_custom_action_31 = 0x7f070020; public static final int accessibility_custom_action_4 = 0x7f070021; public static final int accessibility_custom_action_5 = 0x7f070022; public static final int accessibility_custom_action_6 = 0x7f070023; public static final int accessibility_custom_action_7 = 0x7f070024; public static final int accessibility_custom_action_8 = 0x7f070025; public static final int accessibility_custom_action_9 = 0x7f070026; public static final int action_container = 0x7f07002e; public static final int action_divider = 0x7f070030; public static final int action_image = 0x7f070031; public static final int action_text = 0x7f070037; public static final int actions = 0x7f070038; public static final int async = 0x7f070040; public static final int blocking = 0x7f070043; public static final int chronometer = 0x7f07004a; public static final int dialog_button = 0x7f070055; public static final int forever = 0x7f07005e; public static final int icon = 0x7f070062; public static final int icon_group = 0x7f070063; public static final int info = 0x7f070067; public static final int italic = 0x7f070068; public static final int line1 = 0x7f07006b; public static final int line3 = 0x7f07006c; public static final int normal = 0x7f070074; public static final int notification_background = 0x7f070075; public static final int notification_main_column = 0x7f070076; public static final int notification_main_column_container = 0x7f070077; public static final int right_icon = 0x7f07007d; public static final int right_side = 0x7f07007e; public static final int tag_accessibility_actions = 0x7f07009c; public static final int tag_accessibility_clickable_spans = 0x7f07009d; public static final int tag_accessibility_heading = 0x7f07009e; public static final int tag_accessibility_pane_title = 0x7f07009f; public static final int tag_screen_reader_focusable = 0x7f0700a0; public static final int tag_transition_group = 0x7f0700a1; public static final int tag_unhandled_key_event_manager = 0x7f0700a2; public static final int tag_unhandled_key_listeners = 0x7f0700a3; public static final int text = 0x7f0700a4; public static final int text2 = 0x7f0700a5; public static final int time = 0x7f0700a8; public static final int title = 0x7f0700a9; } public static final class integer { private integer() {} public static final int status_bar_notification_info_maxnum = 0x7f080005; } public static final class layout { private layout() {} public static final int custom_dialog = 0x7f09001c; public static final int notification_action = 0x7f09001d; public static final int notification_action_tombstone = 0x7f09001e; public static final int notification_template_custom_big = 0x7f09001f; public static final int notification_template_icon_group = 0x7f090020; public static final int notification_template_part_chronometer = 0x7f090021; public static final int notification_template_part_time = 0x7f090022; } public static final class string { private string() {} public static final int status_bar_notification_info_overflow = 0x7f0b0042; } public static final class style { private style() {} public static final int TextAppearance_Compat_Notification = 0x7f0c00ec; public static final int TextAppearance_Compat_Notification_Info = 0x7f0c00ed; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0c00ee; public static final int TextAppearance_Compat_Notification_Time = 0x7f0c00ef; public static final int TextAppearance_Compat_Notification_Title = 0x7f0c00f0; public static final int Widget_Compat_NotificationActionContainer = 0x7f0c0158; public static final int Widget_Compat_NotificationActionText = 0x7f0c0159; } public static final class styleable { private styleable() {} public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f020027 }; public static final int ColorStateListItem_android_color = 0; public static final int ColorStateListItem_android_alpha = 1; public static final int ColorStateListItem_alpha = 2; public static final int[] FontFamily = { 0x7f020078, 0x7f020079, 0x7f02007a, 0x7f02007b, 0x7f02007c, 0x7f02007d }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f020076, 0x7f02007e, 0x7f02007f, 0x7f020080, 0x7f020109 }; public static final int FontFamilyFont_android_font = 0; public static final int FontFamilyFont_android_fontWeight = 1; public static final int FontFamilyFont_android_fontStyle = 2; public static final int FontFamilyFont_android_ttcIndex = 3; public static final int FontFamilyFont_android_fontVariationSettings = 4; public static final int FontFamilyFont_font = 5; public static final int FontFamilyFont_fontStyle = 6; public static final int FontFamilyFont_fontVariationSettings = 7; public static final int FontFamilyFont_fontWeight = 8; public static final int FontFamilyFont_ttcIndex = 9; public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 }; public static final int GradientColor_android_startColor = 0; public static final int GradientColor_android_endColor = 1; public static final int GradientColor_android_type = 2; public static final int GradientColor_android_centerX = 3; public static final int GradientColor_android_centerY = 4; public static final int GradientColor_android_gradientRadius = 5; public static final int GradientColor_android_tileMode = 6; public static final int GradientColor_android_centerColor = 7; public static final int GradientColor_android_startX = 8; public static final int GradientColor_android_startY = 9; public static final int GradientColor_android_endX = 10; public static final int GradientColor_android_endY = 11; public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 }; public static final int GradientColorItem_android_color = 0; public static final int GradientColorItem_android_offset = 1; } }
4c200adb22067794f6e9b0032180758bc3da0cb2
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/18/18_3052bf8a2c8a1f2a2a89bad04d4b0c43478b2e3e/GroupBusinessBean/18_3052bf8a2c8a1f2a2a89bad04d4b0c43478b2e3e_GroupBusinessBean_s.java
5e93b1e1ab633be848122b92d7c969bc7b2fb2af
[]
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
50,860
java
package com.idega.user.business; import java.io.IOException; import java.rmi.RemoteException; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Hashtable; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.Vector; import javax.ejb.CreateException; import javax.ejb.EJBException; import javax.ejb.FinderException; import com.idega.builder.data.IBDomain; import com.idega.business.IBORuntimeException; import com.idega.core.accesscontrol.data.PermissionGroup; import com.idega.core.business.AddressBusiness; import com.idega.core.data.Address; import com.idega.core.data.AddressHome; import com.idega.core.data.AddressType; import com.idega.core.data.Country; import com.idega.core.data.CountryHome; import com.idega.core.data.Email; import com.idega.core.data.EmailHome; import com.idega.core.data.Phone; import com.idega.core.data.PhoneHome; import com.idega.core.data.PostalCode; import com.idega.core.data.PostalCodeHome; import com.idega.data.IDOLookup; import com.idega.idegaweb.IWApplicationContext; import com.idega.idegaweb.IWUserContext; import com.idega.user.data.Group; import com.idega.user.data.GroupDomainRelation; import com.idega.user.data.GroupDomainRelationType; import com.idega.user.data.GroupHome; import com.idega.user.data.GroupRelation; import com.idega.user.data.GroupRelationHome; import com.idega.user.data.GroupType; import com.idega.user.data.GroupTypeBMPBean; import com.idega.user.data.GroupTypeHome; import com.idega.user.data.User; import com.idega.user.data.UserGroupPlugIn; import com.idega.user.data.UserGroupPlugInHome; import com.idega.user.data.UserGroupRepresentative; import com.idega.user.data.UserGroupRepresentativeHome; import com.idega.user.data.UserHome; import com.idega.util.ListUtil; /** * <p>Title: idegaWeb User</p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2002</p> * <p>Company: idega Software</p> * @author <a href="[email protected]">Gu�mundur �g�st S�mundsson</a> * @version 1.2 */ public class GroupBusinessBean extends com.idega.business.IBOServiceBean implements GroupBusiness { private GroupRelationHome groupRelationHome; private UserHome userHome; private GroupHome groupHome; private UserGroupRepresentativeHome userRepHome; private GroupHome permGroupHome; private AddressHome addressHome; private EmailHome emailHome; private PhoneHome phoneHome; private String[] userRepresentativeType; public GroupBusinessBean() { } public UserHome getUserHome(){ if(userHome==null){ try{ userHome = (UserHome)IDOLookup.getHome(User.class); } catch(RemoteException rme){ throw new RuntimeException(rme.getMessage()); } } return userHome; } public UserGroupRepresentativeHome getUserGroupRepresentativeHome(){ if(userRepHome==null){ try{ userRepHome = (UserGroupRepresentativeHome)IDOLookup.getHome(UserGroupRepresentative.class); } catch(RemoteException rme){ throw new RuntimeException(rme.getMessage()); } } return userRepHome; } public GroupHome getGroupHome(){ if(groupHome==null){ try{ groupHome = (GroupHome)IDOLookup.getHome(Group.class); } catch(RemoteException rme){ throw new RuntimeException(rme.getMessage()); } } return groupHome; } public GroupHome getPermissionGroupHome(){ if(permGroupHome==null){ try{ permGroupHome = (GroupHome)IDOLookup.getHome(PermissionGroup.class); } catch(RemoteException rme){ throw new RuntimeException(rme.getMessage()); } } return permGroupHome; } /** * Get all groups in the system that are not UserRepresentative groups * @return Collection With all grops in the system that are not UserRepresentative groups */ public Collection getAllGroups() { try { return getGroups(getUserRepresentativeGroupTypeStringArray(),false); } catch (Exception ex) { ex.printStackTrace(); return null; } } /** * Returns all groups that are not permission or general groups */ public Collection getAllNonPermissionOrGeneralGroups(){ try { //filter String[] groupsNotToReturn = new String[2]; groupsNotToReturn[0] = this.getGroupHome().getGroupType(); //groupsNotToReturn[0] = ((Group)com.idega.user.data.GroupBMPBean.getInstance(Group.class)).getGroupTypeValue(); groupsNotToReturn[1] = this.getPermissionGroupHome().getGroupType(); //groupsNotToReturn[0] = ((PermissionGroup)com.idega.core.accesscontrol.data.PermissionGroupBMPBean.getInstance(PermissionGroup.class)).getGroupTypeValue(); //filter end return getGroups(groupsNotToReturn,true); } catch (Exception ex) { ex.printStackTrace(); return null; } } /** * Returns all groups filtered by the grouptypes array. * @param groupTypes the Groups a String array of group types to be filtered with * @param returnSpecifiedGroupTypes if true it returns the Collection with all the groups that are of the types specified in groupTypes[], else it returns the opposite (all the groups that are not of any of the types specified by groupTypes[]) * @return Collection of Groups * @throws Exception If an error occured */ public Collection getGroups(String[] groupTypes, boolean returnSpecifiedGroupTypes) throws Exception { Collection result = getGroupHome().findAllGroups(groupTypes,returnSpecifiedGroupTypes); if(result != null){ result.removeAll(getAccessController().getStandardGroups()); } return result; } /** * Returns all the groups that are a direct parent of the group with id uGroupId * @return Collection of direct parent groups */ public Collection getParentGroups(int uGroupId)throws EJBException,FinderException{ //public Collection getGroupsContainingDirectlyRelated(int uGroupId){ try { Group group = this.getGroupByGroupID(uGroupId); return getParentGroups(group); } catch (IOException ex) { ex.printStackTrace(); return null; } } /** * Returns all the groups that are a direct parent of the group group * @return Collection of direct parent groups */ public Collection getParentGroups(Group group){ //public Collection getGroupsContainingDirectlyRelated(Group group){ try { return group.getParentGroups(); } catch (Exception ex) { ex.printStackTrace(); return null; } } /** * Returns all the groups that are not a direct parent of the Group with id uGroupId. That is both groups that are indirect parents of the group or not at all parents of the group. * @see com.idega.user.business.GroupBusiness#getNonParentGroups(int) * @return Collection of non direct parent groups */ public Collection getNonParentGroups(int uGroupId){ // public Collection getAllGroupsNotDirectlyRelated(int uGroupId){ try { Group group = this.getGroupByGroupID(uGroupId); Collection isDirectlyRelated = getParentGroups(group); Collection AllGroups = getAllGroups();// Filters out userrepresentative groups // EntityFinder.findAll(com.idega.user.data.GroupBMPBean.getInstance()); if(AllGroups != null){ if(isDirectlyRelated != null){ AllGroups.remove(isDirectlyRelated); } AllGroups.remove(group); return AllGroups; }else{ return null; } } catch (Exception ex) { ex.printStackTrace(); return null; } } /** * Returns all the groups that are not a direct parent of the group with id uGroupId which are "Registered" i.e. non system groups such as not of the type user-representative and permission * @param uGroupId the ID of the group * @return Collection */ public Collection getNonParentGroupsNonPermissionNonGeneral(int uGroupId){ //public Collection getRegisteredGroupsNotDirectlyRelated(int uGroupId){ try { Group group = this.getGroupByGroupID(uGroupId); Collection isDirectlyRelated = getParentGroups(group); Collection AllGroups = getAllNonPermissionOrGeneralGroups();// Filters out userrepresentative/permission groups // EntityFinder.findAll(com.idega.user.data.GroupBMPBean.getInstance()); if(AllGroups != null){ if(isDirectlyRelated != null){ AllGroups.remove(isDirectlyRelated); } AllGroups.remove(group); return AllGroups; }else{ return null; } } catch (Exception ex) { ex.printStackTrace(); return null; } } /** * Gets all the groups that are indirect parents of the group by id uGroupId recursively up the group tree. * @param uGroupId * @return Collection of indirect parent (grandparents etc.) Groups */ public Collection getParentGroupsInDirect(int uGroupId){ // public Collection getGroupsContainingNotDirectlyRelated(int uGroupId){ try { Group group = this.getGroupByGroupID(uGroupId); Collection isDirectlyRelated = getParentGroups(group); Collection AllGroups = getParentGroupsRecursive(uGroupId); // EntityFinder.findAll(com.idega.user.data.GroupBMPBean.getInstance()); if(AllGroups != null){ if(isDirectlyRelated != null){ Iterator iter = isDirectlyRelated.iterator(); while (iter.hasNext()) { Object item = iter.next(); AllGroups.remove(item); //while(AllGroups.remove(item)){} } } AllGroups.remove(group); return AllGroups; }else{ return null; } } catch (Exception ex) { ex.printStackTrace(); return null; } } /** * Returns recursively up the group tree parents of group aGroup * @param uGroupId an id of the Group to be found parents recursively for. * @return Collection of Groups found recursively up the tree * @throws EJBException If an error occured */ public Collection getParentGroupsRecursive(int uGroupId)throws EJBException{ //public Collection getGroupsContaining(int uGroupId)throws EJBException{ try { Group group = this.getGroupByGroupID(uGroupId); return getParentGroupsRecursive(group); } catch (Exception ex) { throw new IBORuntimeException(ex); } } /** * Returns recursively up the group tree parents of group aGroup * @param aGroup The Group to be found parents recursively for. * @return Collection of Groups found recursively up the tree * @throws EJBException If an error occured */ public Collection getParentGroupsRecursive(Group aGroup) throws EJBException { return getParentGroupsRecursive(aGroup,getUserRepresentativeGroupTypeStringArray(),false); } public String[] getUserRepresentativeGroupTypeStringArray(){ if(userRepresentativeType == null){ userRepresentativeType = new String[1]; userRepresentativeType[0] = this.getUserGroupRepresentativeHome().getGroupType(); } return userRepresentativeType; } /** * Returns recursively up the group tree parents of group aGroup with filtered out with specified groupTypes * @param aGroup a Group to find parents for * @param groupTypes the Groups a String array of group types to be filtered with * @param returnSpecifiedGroupTypes if true it returns the Collection with all the groups that are of the types specified in groupTypes[], else it returns the opposite (all the groups that are not of any of the types specified by groupTypes[]) * @return Collection of Groups found recursively up the tree * @throws EJBException If an error occured */ public Collection getParentGroupsRecursive(Group aGroup, String[] groupTypes, boolean returnSpecifiedGroupTypes) throws EJBException{ //public Collection getGroupsContaining(Group groupContained, String[] groupTypes, boolean returnSepcifiedGroupTypes) throws EJBException,RemoteException{ Collection groups = aGroup.getParentGroups(); if (groups != null && groups.size() > 0){ Map GroupsContained = new Hashtable(); String key = ""; Iterator iter = groups.iterator(); while (iter.hasNext()) { Group item = (Group)iter.next(); if(item!=null){ key = item.getPrimaryKey().toString(); if(!GroupsContained.containsKey(key)){ GroupsContained.put(key,item); putGroupsContaining( item, GroupsContained,groupTypes, returnSpecifiedGroupTypes ); } } } List specifiedGroups = new ArrayList(); List notSpecifiedGroups = new ArrayList(); int j = 0; int k = 0; Iterator iter2 = GroupsContained.values().iterator(); if(groupTypes != null && groupTypes.length > 0){ boolean specified = false; while (iter2.hasNext()) { Group tempObj = (Group)iter2.next(); for (int i = 0; i < groupTypes.length; i++) { if (tempObj.getGroupType().equals(groupTypes[i])){ specifiedGroups.add(j++, tempObj); specified = true; } } if(!specified){ notSpecifiedGroups.add(k++, tempObj); }else{ specified = false; } } notSpecifiedGroups.remove(aGroup); specifiedGroups.remove(aGroup); } else { while (iter2.hasNext()) { Group tempObj = (Group)iter2.next(); notSpecifiedGroups.add(j++, tempObj); } notSpecifiedGroups.remove(aGroup); returnSpecifiedGroupTypes = false; } return (returnSpecifiedGroupTypes) ? specifiedGroups : notSpecifiedGroups; /////REMOVE AFTER IMPLEMENTING PUTGROUPSCONTAINED BETTER }else{ return null; } } private void putGroupsContaining(Group group, Map GroupsContained , String[] groupTypes, boolean returnGroupTypes ) { Collection pGroups = group.getParentGroups();//TODO EIKI FINISH THIS groupTypes,returnGroupTypes); if (pGroups != null ){ String key = ""; Iterator iter = pGroups.iterator(); while (iter.hasNext()) { Group item = (Group)iter.next(); if(item!=null){ key = item.getPrimaryKey().toString(); if(!GroupsContained.containsKey(key)){ GroupsContained.put(key,item); putGroupsContaining(item, GroupsContained,groupTypes,returnGroupTypes); } } } } } public Collection getUsers(int groupId) throws EJBException,FinderException{ try{ Group group = this.getGroupByGroupID(groupId); return getUsers(group); } catch(RemoteException e){ throw new IBORuntimeException(e,this); } } public Collection getUsersDirectlyRelated(int groupId) throws EJBException,FinderException{ try{ Group group = this.getGroupByGroupID(groupId); return getUsersDirectlyRelated(group); } catch(RemoteException e){ throw new IBORuntimeException(e,this); } } public Collection getUsersNotDirectlyRelated(int groupId) throws EJBException,FinderException{ try{ Group group = this.getGroupByGroupID(groupId); return getUsersNotDirectlyRelated(group); } catch(RemoteException e){ throw new IBORuntimeException(e,this); } } /** * Returns recursively down the group tree children of group whith id groupId with filtered out with specified groupTypes * @param groupId an id of a Group to find parents for * @return Collection of Groups found recursively down the tree * @throws EJBException If an error occured */ public Collection getChildGroupsRecursive(int groupId) throws EJBException,FinderException{ //public Collection getGroupsContained(int groupId) throws EJBException,FinderException,RemoteException{ try{ Group group = this.getGroupByGroupID(groupId); return getChildGroupsRecursive(group); } catch(IOException e){ throw new IBORuntimeException(e,this); } } /** * Returns recursively down the group tree children of group aGroup with filtered out with specified groupTypes * @param aGroup a Group to find children for * @return Collection of Groups found recursively down the tree * @throws EJBException If an error occured */ public Collection getChildGroupsRecursive(Group aGroup) throws EJBException{ return getChildGroupsRecursive(aGroup,getUserRepresentativeGroupTypeStringArray(),false); } /** * Returns recursively down the group tree children of group aGroup with filtered out with specified groupTypes * @param aGroup a Group to find children for * @param groupTypes the Groups a String array of group types to be filtered with * @param returnSpecifiedGroupTypes if true it returns the Collection with all the groups that are of the types specified in groupTypes[], else it returns the opposite (all the groups that are not of any of the types specified by groupTypes[]) * @return Collection of Groups found recursively down the tree * @throws EJBException If an error occured */ //nothing recursive here!! public Collection getChildGroupsRecursive(Group aGroup, String[] groupTypes, boolean returnSpecifiedGroupTypes) throws EJBException{ //public Collection getGroupsContained(Group groupContaining, String[] groupTypes, boolean returnSepcifiedGroupTypes) throws RemoteException{ try{ Map GroupsContained = new HashMap();//to avoid duplicates Collection groups = aGroup.getChildGroups(groupTypes,returnSpecifiedGroupTypes); //int j = 0; if (groups != null && !groups.isEmpty() ){ String key = ""; Iterator iter = groups.iterator(); while (iter.hasNext()) { Group item = (Group)iter.next(); if(item!=null){ key = item.getPrimaryKey().toString(); if(!GroupsContained.containsKey(key)){ GroupsContained.put(key,item); putGroupsContained( item, GroupsContained,groupTypes ,returnSpecifiedGroupTypes); } } } return new ArrayList(GroupsContained.values()); }else{ return null; } } catch(IOException e){ throw new IBORuntimeException(e,this); } } /** * Return all the user directly under(related to) this group. * * @see com.idega.user.business.GroupBusiness#getUsersContained(Group) */ public Collection getUsers(Group group) throws FinderException{ try{ //filter String[] groupTypeToReturn = getUserRepresentativeGroupTypeStringArray(); Collection list = group.getChildGroups(groupTypeToReturn,true); if(list != null && !list.isEmpty()){ return getUsersForUserRepresentativeGroups(list); } else { return ListUtil.getEmptyList(); } } catch(RemoteException e){ throw new IBORuntimeException(e,this); } } /** * Return all the user under(related to) this group and any contained group recursively! * * @see com.idega.user.business.GroupBusiness#getUsersContainedRecursive(Group) */ public Collection getUsersRecursive(Group group) throws FinderException{ try{ Collection list = getChildGroupsRecursive(group,getUserRepresentativeGroupTypeStringArray(),true); if(list != null && !list.isEmpty()){ return getUsersForUserRepresentativeGroups(list); } else { return ListUtil.getEmptyList(); } } catch(RemoteException e){ throw new IBORuntimeException(e,this); } } /** * Return all the user under(related to) this group and any contained group recursively! * * @see com.idega.user.business.GroupBusiness#getUsersContainedRecursive(Group) */ public Collection getUsersRecursive(int groupId) throws FinderException{ try{ Group group = this.getGroupByGroupID(groupId); return getUsersRecursive(group); } catch(RemoteException e){ throw new IBORuntimeException(e,this); } } /** * Returns all the groups that are direct children groups of group with id groupId. * @param groupId an id of a Group to find children groups for * @return Collection of Groups that are Direct children of group aGroup */ public Collection getChildGroups(int groupId) throws EJBException,FinderException{ //public Collection getGroupsContainedDirectlyRelated(int groupId) throws EJBException,FinderException{ try{ Group group = this.getGroupByGroupID(groupId); return getChildGroups(group); } catch(RemoteException e){ throw new IBORuntimeException(e,this); } } /** Returns all the groups that are direct and indirect chhildren of the specified group (specified by id). * The returned groups are filtered: * If the complement set is wanted, all groups are returned that do not have one of the specified group types else * all groups are returned that have one of the specified group types. * This method filters only the result set, that is, even if one child does not belong to the result set the * children of this child are also checked. * The last mentioned point ist the most important difference to the other method getChildGroupsrecursive. * @param groupId * @param groupTypesAsString - a collection of strings representing group types * @param complementSetWanted - should be set to true if you want to fetch all the groups that have group types * that are contained in the collection groupTypesAsString else false if you want to get the complement set * @return a collection of groups */ public Collection getChildGroupsRecursiveResultFiltered(int groupId, Collection groupTypesAsString, boolean complementSetWanted) { Group group = null; try{ group = this.getGroupByGroupID(groupId); } catch (FinderException findEx) { System.err.println( "[GroupBusiness]: Can't retrieve group. Message is: " + findEx.getMessage()); findEx.printStackTrace(System.err); return new ArrayList(); } catch (RemoteException ex) { System.err.println( "[GroupBusiness]: Can't retrieve group. Message is: " + ex.getMessage()); ex.printStackTrace(System.err); throw new RuntimeException("[GroupBusiness]: Can't retrieve group."); } return getChildGroupsRecursiveResultFiltered(group, groupTypesAsString, complementSetWanted); } /** Returns all the groups that are direct and indirect chhildren of the specified group. * The returned groups are filtered: * If the complement set is wanted, all groups are returned that do not have one of the specified group types else * all groups are returned that have one of the specified group types. * This method filters only the result set, that is, even if one child does not belong to the result set the * children of this child are also checked. * The last mentioned point ist the most important difference to the other method getChildGroupsRecursive. * @param group * @param groupTypesAsString - a collection of strings representing group types * @param complementSetWanted - should be set to true if you want to fetch all the groups that have group types * that are contained in the collection groupTypesAsString else false if you want to get the complement set * @return a collection of groups */ public Collection getChildGroupsRecursiveResultFiltered(Group group, Collection groupTypesAsString, boolean complementSetWanted) { Collection alreadyCheckedGroups = new ArrayList(); Collection result = new ArrayList(); getChildGroupsRecursive(group, alreadyCheckedGroups, result, groupTypesAsString, complementSetWanted); return result; } public Collection getUsersFromGroupRecursive(Group group) { Collection users = new ArrayList(); Collection groups = getChildGroupsRecursiveResultFiltered(group, new ArrayList() , true); Iterator iterator = groups.iterator(); while (iterator.hasNext()) { Group tempGroup = (Group) iterator.next(); try { users.addAll(getUsers(tempGroup)); } catch (Exception ex) {}; } return users; } private void getChildGroupsRecursive ( Group currentGroup, Collection alreadyCheckedGroups, Collection result, Collection groupTypesAsString, boolean complementSetWanted) { Integer currentPrimaryKey = (Integer) currentGroup.getPrimaryKey(); if (alreadyCheckedGroups.contains(currentPrimaryKey)) { // already checked, avoid looping return; } alreadyCheckedGroups.add(currentPrimaryKey); String currentGroupType = currentGroup.getGroupType(); // does the current group belong to the result set? if (! (groupTypesAsString.contains(currentGroupType) ^ (! complementSetWanted) ) ) { result.add(currentGroup); } // go further Collection children = currentGroup.getChildGroups(); Iterator childrenIterator = children.iterator(); while (childrenIterator.hasNext()) { Group child = (Group) childrenIterator.next(); getChildGroupsRecursive(child, alreadyCheckedGroups, result, groupTypesAsString, complementSetWanted); } } /** * Returns all the groups that are direct children groups of group aGroup. * @param aGroup a group to find children groups for * @return Collection of Groups that are Direct children of group aGroup */ public Collection getChildGroups(Group aGroup){ //public Collection getGroupsContainedDirectlyRelated(Group group){ try { Collection list = aGroup.getChildGroups(getUserRepresentativeGroupTypeStringArray(),false); if(list != null){ list.remove(aGroup); } return list; } catch (Exception ex) { ex.printStackTrace(); return null; } } public Collection getUsersDirectlyRelated(Group group) throws EJBException,RemoteException,FinderException{ //TODO GET USERS DIRECTLY Collection result = group.getChildGroups(this.getUserRepresentativeGroupTypeStringArray(),true); return getUsersForUserRepresentativeGroups(result); } /** * @param groupId a group to find Groups under * @return Collection A Collection of Groups that are indirect children (grandchildren etc.) of the specified group recursively down the group tree * @throws FinderException if there was an error finding the group by id groupId * @throws EJBException if other errors occur. */ public Collection getChildGroupsInDirect(int groupId) throws EJBException,FinderException{ //public Collection getGroupsContainedNotDirectlyRelated(int groupId) throws EJBException,FinderException{ try{ Group group = this.getGroupByGroupID(groupId); return getChildGroupsInDirect(group); } catch(RemoteException e){ throw new IBORuntimeException(e,this); } } /** * @param group a group to find Groups under * @return Collection A Collection of Groups that are indirect children (grandchildren etc.) of the specified group recursively down the group tree * @throws EJBException if an error occurs. */ public Collection getChildGroupsInDirect(Group group) throws EJBException{ //public Collection getGroupsContainedNotDirectlyRelated(Group group) throws EJBException{ try { Collection isDirectlyRelated = getChildGroups(group); Collection AllGroups = getChildGroupsRecursive(group); if(AllGroups != null){ if(isDirectlyRelated != null){ AllGroups.removeAll(isDirectlyRelated); } AllGroups.remove(group); return AllGroups; }else{ return null; } } catch (Exception ex) { ex.printStackTrace(); return null; } } public Collection getUsersNotDirectlyRelated(Group group) throws EJBException,RemoteException,FinderException{ Collection DirectUsers = getUsersDirectlyRelated(group); Collection notDirectUsers = getUsers(group); if(notDirectUsers != null){ if(DirectUsers != null){ Iterator iter = DirectUsers.iterator(); while (iter.hasNext()) { Object item = iter.next(); notDirectUsers.remove(item); } } return notDirectUsers; }else{ return null; } /* if(notDirectUsers != null){ notDirectUsers.removeAll(DirectUsers); } return notDirectUsers; */ } private void putGroupsContained(Group group,Map GroupsContained, String[] groupTypes, boolean returnGroupTypes ) throws RemoteException{ Collection childGroups = group.getChildGroups(groupTypes,returnGroupTypes); if (childGroups != null && !childGroups.isEmpty() ){ String key = ""; Iterator iter = childGroups.iterator(); while (iter.hasNext()) { Group item = (Group)iter.next(); key = item.getPrimaryKey().toString(); if(!GroupsContained.containsKey(key)){ GroupsContained.put(key,item); putGroupsContained(item, GroupsContained, groupTypes, returnGroupTypes); } } } } /** * @param groupIDs a string array of IDs to be found. * @return A Collection of groups with the specified ids. * @see com.idega.user.business.GroupBusiness#getGroups(String[]) */ public Collection getGroups(String[] groupIDs) throws FinderException,RemoteException { return this.getGroupHome().findGroups(groupIDs); } public Collection getUsersForUserRepresentativeGroups(Collection groups)throws FinderException,RemoteException{ try { return this.getUserHome().findUsersForUserRepresentativeGroups(groups); } catch (FinderException ex) { System.err.println(ex.getMessage()); return new Vector(0); } } public void updateUsersInGroup( int groupId, String[] usrGroupIdsInGroup, User currentUser) throws RemoteException,FinderException { if(groupId != -1){ Group group = this.getGroupByGroupID(groupId); //System.out.println("before"); Collection lDirect = getUsersDirectlyRelated(groupId); Set direct = new HashSet(); if(lDirect != null){ Iterator iter = lDirect.iterator(); while (iter.hasNext()) { User item = (User)iter.next(); direct.add(Integer.toString(item.getGroupID())); //System.out.println("id: "+ item.getGroupID()); } } //System.out.println("after"); Set toRemove = (Set)((HashSet)direct).clone(); Set toAdd = new HashSet(); if(usrGroupIdsInGroup != null){ for (int i = 0; i < usrGroupIdsInGroup.length; i++) { if(direct.contains(usrGroupIdsInGroup[i])){ toRemove.remove(usrGroupIdsInGroup[i]); } else { toAdd.add(usrGroupIdsInGroup[i]); } //System.out.println("id: "+ usrGroupIdsInGroup[i]); } } //System.out.println("toRemove"); Iterator iter2 = toRemove.iterator(); while (iter2.hasNext()) { String item = (String)iter2.next(); //System.out.println("id: "+ item); group.removeGroup(Integer.parseInt(item), currentUser, false); } //System.out.println("toAdd"); Iterator iter3 = toAdd.iterator(); while (iter3.hasNext()) { String item = (String)iter3.next(); //System.out.println("id: "+ item); group.addGroup(Integer.parseInt(item)); } }else{ //System.out.println("groupId = "+ groupId + ", usrGroupIdsInGroup = "+ usrGroupIdsInGroup); } } public Group getGroupByGroupID(int id)throws FinderException,RemoteException{ return this.getGroupHome().findByPrimaryKey(new Integer(id)); } public Group getGroupByGroupName(String name)throws FinderException,RemoteException{ return this.getGroupHome().findByName(name); } public User getUserByID(int id)throws FinderException,RemoteException{ return this.getUserHome().findByPrimaryKey(new Integer(id)); } public void addUser(int groupId, User user)throws EJBException,RemoteException{ try{ //((com.idega.user.data.GroupHome)com.idega.data.IDOLookup.getHomeLegacy(Group.class)).findByPrimaryKeyLegacy(groupId).addGroup(user.getGroupID()); this.getGroupByGroupID(groupId).addGroup(user.getGroup()); } catch(FinderException fe){ throw new EJBException(fe.getMessage()); } } /** * Not yet implemented */ public GroupHome getGroupHome(String groupType){ if(groupHome==null){ try{ /** * @todo: implement */ groupHome = (GroupHome)IDOLookup.getHome(Group.class); } catch(RemoteException rme){ throw new RuntimeException(rme.getMessage()); } } return groupHome; } public GroupRelationHome getGroupRelationHome(){ if(groupRelationHome==null){ try{ groupRelationHome = (GroupRelationHome)IDOLookup.getHome(GroupRelation.class); } catch(RemoteException rme){ throw new RuntimeException(rme.getMessage()); } } return groupRelationHome; } /** * Creates a group with the general grouptype and adds it under the default Domain (IBDomain) * @see com.idega.user.business.GroupBusiness#createGroup(String, String, String) */ public Group createGroup(String name)throws CreateException,RemoteException{ String description = ""; return createGroup(name,description); } /** * Creates a group with the general grouptype and adds it under the default Domain (IBDomain) * @see com.idega.user.business.GroupBusiness#createGroup(String, String, String) */ public Group createGroup(String name,String description)throws CreateException,RemoteException{ String generaltype = getGroupHome().getGroupType(); return createGroup(name,description,generaltype); } /** * Creates a group and adds it under the default Domain (IBDomain) * @see com.idega.user.business.GroupBusiness#createGroup(String, String, String) */ public Group createGroup(String name,String description,String type)throws CreateException,RemoteException{ return createGroup(name,description,type,-1); } /** * Creates a group and adds it under the default Domain (IBDomain) * @see com.idega.user.business.GroupBusiness#createGroup(String, String, String, int) */ public Group createGroup(String name,String description,String type,int homePageID)throws CreateException,RemoteException{ return createGroup(name,description,type,-1,-1); } public Group createGroup(String name,String description,String type,int homePageID,int aliasID)throws CreateException,RemoteException{ Group newGroup; newGroup = getGroupHome().create(); newGroup.setName(name); newGroup.setDescription(description); newGroup.setGroupType(type); if ( homePageID != -1 ) { newGroup.setHomePageID(homePageID); } if (aliasID != -1) { newGroup.setAliasID(aliasID); } newGroup.store(); addGroupUnderDomain(this.getIWApplicationContext().getDomain(),newGroup,(GroupDomainRelationType)null); return newGroup; } public Collection getAllAllowedGroupTypesForChildren(int groupId, IWUserContext iwuc) { // try to get the group Group group; try { group = (groupId > -1) ? getGroupByGroupID(groupId) : null; } catch (Exception ex) { throw new RuntimeException(ex.getMessage()); } return getAllAllowedGroupTypesForChildren(group, iwuc); } /** * It is allowed and makes sense if the parameter group is null: * In this case alias and general group type is returned. */ public Collection getAllAllowedGroupTypesForChildren(Group group, IWUserContext iwuc) { GroupTypeHome groupTypeHome; GroupType groupType; String groupTypeString; try { groupTypeHome = (GroupTypeHome) IDOLookup.getHome(GroupType.class); // super admin: return all group types if (iwuc.isSuperAdmin()) return groupTypeHome.findVisibleGroupTypes(); // try to get the corresponding group type if (group != null) { groupTypeString = group.getGroupType(); groupType = groupTypeHome.findByPrimaryKey(groupTypeString); } else { // okay, group is null, but we need an instance // to get the alias and general group type groupTypeString = ""; groupType = GroupTypeBMPBean.getStaticInstance(); } } catch (Exception ex) { throw new RuntimeException(ex.getMessage()); } // get general and alias group type GroupType generalType = findOrCreateGeneralGroupType(groupType, groupTypeHome); GroupType aliasType = findOrCreateAliasGroupType(groupType, groupTypeHome); ArrayList groupTypes = new ArrayList(); if (group == null) { // first case: group is null groupTypes.add(generalType); groupTypes.add(aliasType); } else { // second case: group is not null // first: type of selected group groupTypes.add(groupType); // second: general type if (! generalType.getType().equals(groupTypeString)) groupTypes.add(generalType); // third: alias type if (! aliasType.getType().equals(groupTypeString)) groupTypes.add(aliasType); // then add children of type of selected group addGroupTypeChildren(groupTypes, groupType); } return groupTypes; } private void addGroupTypeChildren(List list, GroupType groupType) { Iterator iterator = groupType.getChildren(); while (iterator != null && iterator.hasNext()) { GroupType child = (GroupType) iterator.next(); list.add(child); addGroupTypeChildren(list, child); } } public String getGroupType(Class groupClass)throws RemoteException{ return ((GroupHome)IDOLookup.getHome(groupClass)).getGroupType(); } public GroupType getGroupTypeFromString(String type) throws RemoteException, FinderException{ return getGroupTypeHome().findByPrimaryKey(type); } /** * Method getUserGroupPluginsForGroupType. * @param groupType * @return Collection of plugins or null if no found or error occured */ public Collection getUserGroupPluginsForGroupTypeString(String groupType){ try { return getUserGroupPlugInHome().findRegisteredPlugInsForGroupType(groupType); } catch (Exception e) { e.printStackTrace(); return null; } } /** * Method getUserGroupPluginsForGroupType. * @param groupType * @return Collection of plugins or null if no found or error occured */ public Collection getUserGroupPluginsForGroupType(GroupType groupType){ try { return getUserGroupPlugInHome().findRegisteredPlugInsForGroupType(groupType); } catch (Exception e) { e.printStackTrace(); return null; } } /** * Method getUserGroupPluginsForUser. * @param groupType * @return Collection of plugins or null if no found or error occured */ public Collection getUserGroupPluginsForUser(User user){ try { //finna allar gruppur tengdar thessum user og gera find fall sem tekur inn i sig collection a groups return getUserGroupPlugInHome().findAllPlugIns(); } catch (Exception e) { e.printStackTrace(); return null; } } public GroupTypeHome getGroupTypeHome() throws RemoteException{ return (GroupTypeHome) this.getIDOHome(GroupType.class); } public UserGroupPlugInHome getUserGroupPlugInHome() throws RemoteException{ return (UserGroupPlugInHome) this.getIDOHome(UserGroupPlugIn.class); } public void addGroupUnderDomain(IBDomain domain, Group group, GroupDomainRelationType type) throws CreateException,RemoteException{ GroupDomainRelation relation = (GroupDomainRelation)IDOLookup.create(GroupDomainRelation.class); relation.setDomain(domain); relation.setRelatedGroup(group); if(type != null){ relation.setRelationship(type); } relation.store(); } /** * Method updateUsersMainAddressOrCreateIfDoesNotExist. This method can both be used to update the user main address or to create one<br> * if one does not exist. Only userId and StreetName(AndNumber) are required to be not null others are optional. * @param userId * @param streetNameAndNumber * @param postalCodeId * @param countryName * @param city * @param province * @param poBox * @return Address the address that was created or updated * @throws CreateException * @throws RemoteException */ public Address updateGroupMainAddressOrCreateIfDoesNotExist(Integer groupId, String streetNameAndNumber, Integer postalCodeId, String countryName, String city, String province, String poBox) throws CreateException,RemoteException { Address address = null; if( streetNameAndNumber!=null && groupId!=null ){ try{ AddressBusiness addressBiz = getAddressBusiness(); String streetName = addressBiz.getStreetNameFromAddressString(streetNameAndNumber); String streetNumber = addressBiz.getStreetNumberFromAddressString(streetNameAndNumber); Group group = getGroupByGroupID(groupId.intValue()); address = getGroupMainAddress(group); Country country = null; if( countryName!=null ){ country = ((CountryHome)getIDOHome(Country.class)).findByCountryName(countryName); } PostalCode code = null; if( postalCodeId!=null){ code = ((PostalCodeHome)getIDOHome(PostalCode.class)).findByPrimaryKey(postalCodeId); } boolean addAddress = false;/**@todo is this necessary?**/ if( address == null ){ AddressHome addressHome = addressBiz.getAddressHome(); address = addressHome.create(); AddressType mainAddressType = addressHome.getAddressType1(); address.setAddressType(mainAddressType); addAddress = true; } if( country!=null ) address.setCountry(country); if( code!=null ) address.setPostalCode(code); if( province!=null ) address.setProvince(province); if( city!=null ) address.setCity(city); address.setStreetName(streetName); if( streetNumber!=null ) address.setStreetNumber(streetNumber); address.store(); if(addAddress){ group.addAddress(address); } } catch(Exception e){ e.printStackTrace(); System.err.println("Failed to update or create address for groupid : "+ groupId.toString()); } } else throw new CreateException("No streetname or userId is null!"); return address; } public AddressBusiness getAddressBusiness() throws RemoteException{ return (AddressBusiness) getServiceInstance(AddressBusiness.class); } /** * Gets the users main address and returns it. * @returns the address if found or null if not. */ public Address getGroupMainAddress(Group group) throws RemoteException{ return getGroupMainAddress(((Integer)group.getPrimaryKey()).intValue()); } /** * Gets the user's main address and returns it. * @returns the address if found or null if not. */ public Address getGroupMainAddress(int userID) throws EJBException,RemoteException{ try { return getAddressHome().findPrimaryUserAddress(userID); } catch (FinderException fe) { return null; } } public AddressHome getAddressHome(){ if(addressHome==null){ try{ addressHome = (AddressHome)IDOLookup.getHome(Address.class); } catch(RemoteException rme){ throw new RuntimeException(rme.getMessage()); } } return addressHome; } public Phone[] getGroupPhones(Group group)throws RemoteException{ try { Collection phones = group.getPhones(); // if(phones != null){ return (Phone[])phones.toArray(new Phone[phones.size()]); // } //return (Phone[]) ((com.idega.user.data.UserHome)com.idega.data.IDOLookup.getHomeLegacy(User.class)).findByPrimaryKeyLegacy(userId).findRelated(com.idega.core.data.PhoneBMPBean.getStaticInstance(Phone.class)); } catch (EJBException ex) { ex.printStackTrace(); return null; } } public Email getGroupEmail(Group group) { try { Collection L = group.getEmails(); if(L != null){ if ( ! L.isEmpty() ) return (Email)L.iterator().next(); } return null; } catch (Exception ex) { ex.printStackTrace(); return null; } } public void updateGroupMail(Group group, String email) throws CreateException,RemoteException { Email mail = getGroupEmail(group); boolean insert = false; if ( mail == null ) { mail = this.getEmailHome().create(); insert = true; } if ( email != null ) { mail.setEmailAddress(email); } mail.store(); if(insert){ //((com.idega.user.data.UserHome)com.idega.data.IDOLookup.getHomeLegacy(User.class)).findByPrimaryKeyLegacy(userId).addTo(mail); try{ group.addEmail(mail); } catch(Exception e){ throw new RemoteException(e.getMessage()); } } } public EmailHome getEmailHome(){ if(emailHome==null){ try{ emailHome = (EmailHome)IDOLookup.getHome(Email.class); } catch(RemoteException rme){ throw new RuntimeException(rme.getMessage()); } } return emailHome; } public void updateGroupPhone(Group group, int phoneTypeId, String phoneNumber) throws EJBException { try{ Phone phone = getGroupPhone(group,phoneTypeId); boolean insert = false; if ( phone == null ) { phone = this.getPhoneHome().create(); phone.setPhoneTypeId(phoneTypeId); insert = true; } if ( phoneNumber != null ) { phone.setNumber(phoneNumber); } phone.store(); if(insert){ //((com.idega.user.data.UserHome)com.idega.data.IDOLookup.getHomeLegacy(User.class)).findByPrimaryKeyLegacy(userId).addTo(phone); group.addPhone(phone); } } catch(Exception e){ e.printStackTrace(); throw new EJBException(e.getMessage()); } } public Phone getGroupPhone(Group group, int phoneTypeId)throws RemoteException{ try { Phone[] result = this.getGroupPhones(group); //IDOLegacyEntity[] result = ((com.idega.user.data.UserHome)com.idega.data.IDOLookup.getHomeLegacy(User.class)).findByPrimaryKeyLegacy(userId).findRelated(com.idega.core.data.PhoneBMPBean.getStaticInstance(Phone.class)); if(result != null){ for (int i = 0; i < result.length; i++) { if(((Phone)result[i]).getPhoneTypeId() == phoneTypeId){ return (Phone)result[i]; } } } return null; } catch (EJBException ex) { ex.printStackTrace(); return null; } } public PhoneHome getPhoneHome(){ if(phoneHome==null){ try{ phoneHome = (PhoneHome)IDOLookup.getHome(Phone.class); } catch(RemoteException rme){ throw new RuntimeException(rme.getMessage()); } } return phoneHome; } /** Group is removeable if the group is either an alias or * has not any children. * Childrens are other groups or users. * @param group * @return boolean */ public boolean isGroupRemovable(Group group) { try { return ( (group.getGroupType().equals("alias")) // childCount checks only groups as children || (group.getChildCount() <= 0 && ( getUserBusiness().getUsersInGroup(group).isEmpty()))); } catch (java.rmi.RemoteException rme) { throw new RuntimeException(rme.getMessage()); } } public String getNameOfGroupWithParentName(Group group) { StringBuffer buffer = new StringBuffer(); Collection parents = getParentGroups(group); buffer.append(group.getName()).append(" "); if(parents!=null && !parents.isEmpty()) { Iterator par = parents.iterator(); Group parent = (Group) par.next(); buffer.append("(").append(parent.getName()).append(") "); } return buffer.toString(); } private UserBusiness getUserBusiness() { IWApplicationContext context = getIWApplicationContext(); try { return (UserBusiness) com.idega.business.IBOLookup.getServiceInstance(context, UserBusiness.class); } catch (java.rmi.RemoteException rme) { throw new RuntimeException(rme.getMessage()); } } private GroupType findOrCreateAliasGroupType(GroupType aGroupType, GroupTypeHome home) { try { GroupType type = home.findByPrimaryKey(aGroupType.getAliasGroupTypeString()); return type; } catch (FinderException findEx) { try { GroupType type = home.create(); type.setGroupTypeAsAliasGroup(); return type; } catch (CreateException createEx) { throw new RuntimeException(createEx.getMessage()); } } } private GroupType findOrCreateGeneralGroupType(GroupType aGroupType, GroupTypeHome home) { try { GroupType type = home.findByPrimaryKey(aGroupType.getGeneralGroupTypeString()); return type; } catch (FinderException findEx) { try { GroupType type = home.create(); type.setGroupTypeAsGeneralGroup(); return type; } catch (CreateException createEx) { throw new RuntimeException(createEx.getMessage()); } } } } // Class /** * @todo move implementation from methodName(Group group) to methodName(int groupId) * @todo reimplement all methods returning list of users */
4043f35d807cb02b74d139642fb611a7fc6c1183
64ea04230fda6cf5aebbc39205c425c8bd4e157d
/jZebra/src/jzebra/LogIt.java
494c87014840dd9220eb9cc6cc46154ff8190c85
[]
no_license
juanchaconaqp/jzebra
316a1852d895c02c454113e2f40a820a3ff52614
6fd41ba0435a2dbfede1a25ec886ea1fcd418ac8
refs/heads/master
2021-01-18T13:37:05.999693
2015-06-15T17:40:55
2015-06-15T17:40:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,067
java
package jzebra; import java.util.logging.Level; import java.util.logging.Logger; import javax.print.event.PrintJobEvent; /** * @author A. Tres Finocchiaro */ public class LogIt { public static void log(String className, Level lvl, String msg, Throwable t) { Logger.getLogger(className).log(lvl, msg, t); } public static void log(Level lvl, String msg, Throwable t) { log(LogIt.class.getName(), lvl, msg, t); } public static void log(String msg, Throwable t) { log(Level.SEVERE, msg, t); } public static void log(Throwable t) { log("Error", t); } public static void log(String className, Level lvl, String msg) { Logger.getLogger(className).log(lvl, msg); } public static void log(Level lvl, String msg) { log(LogIt.class.getName(), lvl, msg); } public static void log(String msg) { log(Level.INFO, msg); } public static void log(PrintJobEvent pje) { Level lvl; String msg = "Print job "; switch (pje.getPrintEventType()) { case PrintJobEvent.DATA_TRANSFER_COMPLETE: lvl = Level.INFO; msg += "data transfer complete."; break; case PrintJobEvent.NO_MORE_EVENTS: lvl = Level.INFO; msg += "has no more events."; break; case PrintJobEvent.JOB_COMPLETE: lvl = Level.INFO; msg += "job complete."; break; case PrintJobEvent.REQUIRES_ATTENTION: lvl = Level.WARNING; msg += "requires attention."; break; case PrintJobEvent.JOB_CANCELED: lvl = Level.WARNING; msg += "job canceled."; break; case PrintJobEvent.JOB_FAILED: lvl = Level.SEVERE; msg += "job failed."; break; default: return; } LogIt.log(lvl, msg); } }
[ "[email protected]@46e91e78-2a53-0410-bce8-1923352d0024" ]
[email protected]@46e91e78-2a53-0410-bce8-1923352d0024
56ec743ef4c9854d88d2de0e26e2d84a2170ec4d
3b7be9bef64ec62ef93bb80f7a444522411f126a
/de.hegmanns.fundamental.chain/src/test/java/hegmanns/de/de/hegmanns/fundamental/chain/umsatzarten/umsatzermittler/Umsatzermittler.java
bc794a918934eb1e4fc99878c3d4c8c0cd827d83
[]
no_license
bhegmanns/java_core
ed67f1f8af288f2f64b729e47b74e1cb063baec4
81ea85f9ef8310c76770775d2c329b3c280ef90b
refs/heads/master
2021-01-23T18:12:08.272039
2014-01-08T21:16:33
2014-01-08T21:16:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
718
java
package hegmanns.de.de.hegmanns.fundamental.chain.umsatzarten.umsatzermittler; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import hegmanns.de.de.hegmanns.fundamental.chain.AusfuehrungsCommand; import hegmanns.de.de.hegmanns.fundamental.chain.umsatzarten.Umsatzart; public interface Umsatzermittler extends AusfuehrungsCommand<hegmanns.de.de.hegmanns.fundamental.chain.umsatzarten.Vertragnehmer, hegmanns.de.de.hegmanns.fundamental.chain.umsatzarten.umsatzermittler.UmsatzermittlungsContext, hegmanns.de.de.hegmanns.fundamental.chain.umsatzarten.Umsatzart, hegmanns.de.de.hegmanns.fundamental.chain.umsatzarten.umsatzermittler.Umsatzartermittlungsergebnis> { }
0eb7c8c5b03a632938f74e55bb568d976928cfd9
d83621076ed0ca171d65d6e0242835235f312aff
/app/src/main/java/com/example/yyz/news121/utils/BitmapUtils.java
b2a8865849b811ad73f5aa34ae5ad61ce565ab90
[]
no_license
Jeffrey1202/News121
8a68263fab33c63e3c09b489d4ca9da075242d14
2fc67829d4a312ae46c89d7e34c6d2e680a16da2
refs/heads/master
2021-06-11T04:53:50.834395
2017-03-28T04:09:57
2017-03-28T04:09:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,655
java
package com.example.yyz.news121.utils; import android.graphics.Bitmap; import android.os.Handler; import android.util.Log; /** * appname:News121 * Author: 应义正 * CreateDate: 2017/3/13 * Function:图片三级缓存工具类 */ public class BitmapUtils { //网络缓存工具 private NetCacheUtils netCacheUtils; //本地缓存工具类 private LocalCacheUtils localCacheUtils; //内存缓存工具类 private MemoryCacheUtils memoryCacheUtils; public BitmapUtils(Handler handler){ memoryCacheUtils=new MemoryCacheUtils(); localCacheUtils=new LocalCacheUtils(memoryCacheUtils); netCacheUtils=new NetCacheUtils(handler,localCacheUtils,memoryCacheUtils); } /* *从内存中取图片 * * 从本地取图片,向内存保存 * * 从网络取图片,向内存中保存,向本地保存 */ public Bitmap getBitmap(String url, int position) { //从内存中取图片 if(memoryCacheUtils!=null){ Bitmap bitmap=memoryCacheUtils.getBitmap(url); if(bitmap!=null){ Log.e("TAG","从内存获取图片"+position); return bitmap; } } //从本地取图片 if(localCacheUtils!=null){ Bitmap bitmap=localCacheUtils.getBitmapFromUrl(url); if(bitmap!=null){ Log.e("TAG","从本地获取图片"+position); return bitmap; } } //从网络取图片 if(netCacheUtils!=null){ netCacheUtils.getBitmapFromNet(url,position); } return null; } }
b944da981b9d1f2ce8e521c098ab13ceee4d9003
06306ed6b8720c1698b5733e37e4d6186fef8078
/src/main/java/com/jg/bookstore/config/SwaggerConfig.java
a6ae571c357595d4f9aec44ac24fdbb8b2669ecc
[]
no_license
grechjoseph/bookstore
6f7a77e5d471a57c6e79649a59352c297e342a1e
02e581dc8ad3f8609dbab9cd1efe04be3b77fa1c
refs/heads/master
2022-09-16T23:27:58.765038
2020-05-31T12:56:53
2020-05-31T12:56:53
261,482,686
0
0
null
null
null
null
UTF-8
Java
false
false
1,446
java
package com.jg.bookstore.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.service.ApiInfo; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; /** * Configuration to set up Swagger documentation. */ @Configuration @EnableSwagger2 public class SwaggerConfig { /** * Customization configuration for Swagger2. * @return Docket to allow Selector Builder to control the endpoints exposed by Swagger. */ @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) .alternateTypeRules() .useDefaultResponseMessages(false) .select() .apis(RequestHandlerSelectors.basePackage("com.jg.bookstore")) .paths(PathSelectors.any()) .build(); } private ApiInfo apiInfo() { return new ApiInfoBuilder() .title("Book Store Application") .description("Adding Authors, Books, and Orders.") .build(); } }
175fdc8c33fcbff894ca85c27bc471499a0a0936
de96d579260abad4df8469fbde30a726666e393a
/app/src/main/java/com/example/duanzishou/materialdesign/test/MainActivity_Home.java
ea001c30117b1d2e2663a72765ed1bde98067342
[]
no_license
printlybyte/MaterialDesign
8eeb75fc96cc5be386d5889e7fe8847c7b308ed1
735633864bd901ae9dfff42851325ed13cf3f318
refs/heads/master
2021-01-19T17:33:16.897862
2017-04-17T12:59:50
2017-04-17T12:59:50
88,328,007
0
0
null
null
null
null
UTF-8
Java
false
false
6,745
java
package com.example.duanzishou.materialdesign.test; import android.content.Intent; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.transition.Transition; import android.view.View; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.example.duanzishou.materialdesign.R; import com.example.duanzishou.materialdesign.test.fragments.BlankFragment_tab; import com.example.duanzishou.materialdesign.test.fragments.BlankFragment_tab2; import com.example.duanzishou.materialdesign.test.fragments.BlankFragment_tab3; import com.example.duanzishou.materialdesign.test.fragments.BlankFragment_tab4; import org.w3c.dom.Text; public class MainActivity_Home extends AppCompatActivity implements View.OnClickListener { private LinearLayout mLinear, mLinear2, mLinear3, mLinear4; private ImageView mImg, mImg2, mImg3, mImg4; private TextView mTlt, mTlt2, mTlt3, mTlt4,mTlt_txt; private FragmentManager fragmentManager = getSupportFragmentManager(); private FragmentTransaction fragmentTransaction; private BlankFragment_tab blankFragment_tab; private BlankFragment_tab2 blankFragment_tab2; private BlankFragment_tab3 blankFragment_tab3; private BlankFragment_tab4 blankFragment_tab4; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main__home); initView(); } private void initView() { mTlt_txt= (TextView) findViewById(R.id.include_title); mLinear = (LinearLayout) findViewById(R.id.line1); mLinear2 = (LinearLayout) findViewById(R.id.line2); mLinear3 = (LinearLayout) findViewById(R.id.line3); mLinear4 = (LinearLayout) findViewById(R.id.line4); mImg = (ImageView) findViewById(R.id.img1); mImg2 = (ImageView) findViewById(R.id.img2); mImg3 = (ImageView) findViewById(R.id.img3); mImg4 = (ImageView) findViewById(R.id.img4); mTlt = (TextView) findViewById(R.id.tlt1); mTlt2 = (TextView) findViewById(R.id.tlt2); mTlt3 = (TextView) findViewById(R.id.tlt3); mTlt4 = (TextView) findViewById(R.id.tlt4); mLinear.setOnClickListener(this); mLinear2.setOnClickListener(this); mLinear3.setOnClickListener(this); mLinear4.setOnClickListener(this); setBottombar(0); startLoding(); } @Override public void onClick(View v) { fragmentTransaction = fragmentManager.beginTransaction(); HideFrament(); switch (v.getId()) { case R.id.line1: setBottombar(0); if (blankFragment_tab == null) { blankFragment_tab = new BlankFragment_tab(); fragmentTransaction.add(R.id.content_group_zhong, blankFragment_tab); } else { fragmentTransaction.show(blankFragment_tab); } break; case R.id.line2: setBottombar(1); if (blankFragment_tab2 == null) { blankFragment_tab2 = new BlankFragment_tab2(); fragmentTransaction.add(R.id.content_group_zhong, blankFragment_tab2); } else { fragmentTransaction.show(blankFragment_tab2); } break; case R.id.line3: setBottombar(2); if (blankFragment_tab3 == null) { blankFragment_tab3 = new BlankFragment_tab3(); fragmentTransaction.add(R.id.content_group_zhong, blankFragment_tab3); } else { fragmentTransaction.show(blankFragment_tab3); } break; case R.id.line4: setBottombar(3); if (blankFragment_tab4 == null) { blankFragment_tab4 = new BlankFragment_tab4(); fragmentTransaction.add(R.id.content_group_zhong, blankFragment_tab4); } else { fragmentTransaction.show(blankFragment_tab4); } break; } fragmentTransaction.commit(); } private void startLoding() { fragmentTransaction = fragmentManager.beginTransaction(); HideFrament(); blankFragment_tab = new BlankFragment_tab(); fragmentTransaction.add(R.id.content_group_zhong, blankFragment_tab); fragmentTransaction.commit(); } private void HideFrament() { if (blankFragment_tab != null) { fragmentTransaction.hide(blankFragment_tab); } if (blankFragment_tab2 != null) { fragmentTransaction.hide(blankFragment_tab2); } if (blankFragment_tab3 != null) { fragmentTransaction.hide(blankFragment_tab3); } if (blankFragment_tab4 != null) { fragmentTransaction.hide(blankFragment_tab4); } } public void setBottombar(int num) { mImg.setImageResource(R.mipmap.message_select); mImg2.setImageResource(R.mipmap.message_select); mImg3.setImageResource(R.mipmap.message_select); mImg4.setImageResource(R.mipmap.message_select); mTlt.setTextColor(getResources().getColor(R.color.colorPrimary)); mTlt2.setTextColor(getResources().getColor(R.color.colorPrimary)); mTlt3.setTextColor(getResources().getColor(R.color.colorPrimary)); mTlt4.setTextColor(getResources().getColor(R.color.colorPrimary)); switch (num) { case 0: mTlt_txt.setText("首页1"); mImg.setImageResource(R.mipmap.my_normal); mTlt.setTextColor(getResources().getColor(R.color.colorAccent)); break; case 1: mTlt_txt.setText("首页2"); mImg2.setImageResource(R.mipmap.my_normal); mTlt2.setTextColor(getResources().getColor(R.color.colorAccent)); break; case 2: mTlt_txt.setText("首页3"); mImg3.setImageResource(R.mipmap.my_normal); mTlt3.setTextColor(getResources().getColor(R.color.colorAccent)); break; case 3: mTlt_txt.setText("首页4"); mImg4.setImageResource(R.mipmap.my_normal); mTlt4.setTextColor(getResources().getColor(R.color.colorAccent)); break; } } }
1ea0778646cb14ae54b1d9cbdea44210364f5401
049345aedf107b07006fab360273509a089e1e3a
/app/src/main/java/com/theta/curddemoapplication/utils/ImageUtils.java
0ef38c0bab596fc4dec638b5f196fffc62b38995
[]
no_license
RozinaDarediya/CURDDemoApplication
730abdf7cdbcdace7fc82f3a922e5ae73c543778
3f4714864b9debd8ac44b25a8be8b9b4772594f9
refs/heads/master
2020-04-14T23:31:33.186131
2019-01-05T10:44:33
2019-01-05T10:44:33
164,205,290
1
0
null
null
null
null
UTF-8
Java
false
false
11,665
java
package com.theta.curddemoapplication.utils; import android.content.ContentUris; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.Paint; import android.media.ExifInterface; import android.net.Uri; import android.os.Build; import android.os.Environment; import android.provider.DocumentsContract; import android.provider.MediaStore; import android.widget.ImageView; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; /** * Created by ashish on 7/11/17. */ public class ImageUtils { private static final float maxHeight = 1280.0f; private static final float maxWidth = 1280.0f; public static boolean isExternalStorageDocument(Uri uri) { return "com.android.externalstorage.documents".equals(uri.getAuthority()); } public static boolean isDownloadsDocument(Uri uri) { return "com.android.providers.downloads.documents".equals(uri.getAuthority()); } public static boolean isMediaDocument(Uri uri) { return "com.android.providers.media.documents".equals(uri.getAuthority()); } public static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) { Cursor cursor = null; final String column = "_data"; final String[] projection = { column }; try { cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null); if (cursor != null && cursor.moveToFirst()) { final int column_index = cursor.getColumnIndexOrThrow(column); return cursor.getString(column_index); } } finally { if (cursor != null) cursor.close(); } return null; } /** * Function to get Path of Gallery Image */ public static String getGalleryImagePath(Context context, Intent imageReturnedIntent) { String filePath = ""; Uri selectedImage = imageReturnedIntent.getData(); boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; if (Build.VERSION.SDK_INT < 19) { if ("content".equalsIgnoreCase(selectedImage.getScheme())) { String[] filePathColumn = {MediaStore.Images.Media.DATA}; Cursor cursor = context.getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); filePath = cursor.getString(columnIndex); cursor.close(); } else if ("file".equalsIgnoreCase(selectedImage.getScheme())) { filePath = selectedImage.getPath(); } } else if (isKitKat && DocumentsContract.isDocumentUri(context, selectedImage)) { final int takeFlags = imageReturnedIntent.getFlags() & (Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); context.getContentResolver().takePersistableUriPermission(selectedImage, (Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION)); if (isExternalStorageDocument(selectedImage)) { final String docId = DocumentsContract.getDocumentId(selectedImage); final String[] split = docId.split(":"); final String type = split[0]; if ("primary".equalsIgnoreCase(type)) { filePath = Environment.getExternalStorageDirectory() + "/" + split[1]; } } else if (isDownloadsDocument(selectedImage)) { final String id = DocumentsContract.getDocumentId(selectedImage); if(id.startsWith("raw:")){ return id.replaceFirst("raw:", ""); } final Uri contentUri = ContentUris.withAppendedId( Uri.parse("content://downloads/public_downloads"), Long.valueOf(id)); filePath = getDataColumn(context, contentUri, null, null); } else if (isMediaDocument(selectedImage)) { final String docId = DocumentsContract.getDocumentId(selectedImage); final String[] split = docId.split(":"); final String type = split[0]; Uri contentUri = null; if ("image".equals(type)) { contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; } else if ("video".equals(type)) { contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; } else if ("audio".equals(type)) { contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; } final String selection = "_id=?"; final String[] selectionArgs = new String[]{ split[1] }; filePath = getDataColumn(context, contentUri, selection, selectionArgs); } else if ("content".equalsIgnoreCase(selectedImage.getScheme())) { filePath = getDataColumn(context, selectedImage, null, null); } else if ("file".equalsIgnoreCase(selectedImage.getScheme())) { filePath = selectedImage.getPath(); } } return filePath; }//getGalleryImagePath //compressImage public static boolean compressImage(String imagePath, String storePath, boolean isFromGallery) { Bitmap scaledBitmap = null; BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; Bitmap bmp = BitmapFactory.decodeFile(imagePath, options); int actualHeight = options.outHeight; int actualWidth = options.outWidth; float imgRatio = (float) actualWidth / (float) actualHeight; float maxRatio = maxWidth / maxHeight; if (actualHeight > maxHeight || actualWidth > maxWidth) { if (imgRatio < maxRatio) { imgRatio = maxHeight / actualHeight; actualWidth = (int) (imgRatio * actualWidth); actualHeight = (int) maxHeight; } else if (imgRatio > maxRatio) { imgRatio = maxWidth / actualWidth; actualHeight = (int) (imgRatio * actualHeight); actualWidth = (int) maxWidth; } else { actualHeight = (int) maxHeight; actualWidth = (int) maxWidth; } } options.inSampleSize = calculateInSampleSize(options, actualWidth, actualHeight); options.inJustDecodeBounds = false; options.inDither = false; options.inPurgeable = true; options.inInputShareable = true; options.inTempStorage = new byte[16 * 1024]; try { bmp = BitmapFactory.decodeFile(imagePath, options); } catch (OutOfMemoryError exception) { exception.printStackTrace(); return false; } try { scaledBitmap = Bitmap.createBitmap(actualWidth, actualHeight, Bitmap.Config.RGB_565); } catch (OutOfMemoryError exception) { exception.printStackTrace(); return false; } float ratioX = actualWidth / (float) options.outWidth; float ratioY = actualHeight / (float) options.outHeight; float middleX = actualWidth / 2.0f; float middleY = actualHeight / 2.0f; Matrix scaleMatrix = new Matrix(); scaleMatrix.setScale(ratioX, ratioY, middleX, middleY); Canvas canvas = new Canvas(scaledBitmap); canvas.setMatrix(scaleMatrix); canvas.drawBitmap(bmp, middleX - bmp.getWidth() / 2, middleY - bmp.getHeight() / 2, new Paint(Paint.FILTER_BITMAP_FLAG)); if (bmp != null) { bmp.recycle(); } ExifInterface exif; try { exif = new ExifInterface(imagePath); int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, 0); Matrix matrix = new Matrix(); if (orientation == 6) { matrix.postRotate(90); } else if (orientation == 3) { matrix.postRotate(180); } else if (orientation == 8) { matrix.postRotate(270); } scaledBitmap = Bitmap.createBitmap(scaledBitmap, 0, 0, scaledBitmap.getWidth(), scaledBitmap.getHeight(), matrix, true); } catch (IOException e) { e.printStackTrace(); return false; } FileOutputStream out = null; String filepath = storePath;//getFilename(); try { if (!isFromGallery) new File(imagePath).delete(); out = new FileOutputStream(filepath); //write the compressed bitmap at the destination specified by filename. scaledBitmap.compress(Bitmap.CompressFormat.JPEG, 90, out); } catch (FileNotFoundException e) { e.printStackTrace(); return false; } return true; }//compressImage //calculateInSampleSize public static int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) { final int height = options.outHeight; final int width = options.outWidth; int inSampleSize = 1; if (height > reqHeight || width > reqWidth) { final int heightRatio = Math.round((float) height / (float) reqHeight); final int widthRatio = Math.round((float) width / (float) reqWidth); inSampleSize = heightRatio < widthRatio ? heightRatio : widthRatio; } final float totalPixels = width * height; final float totalReqPixelsCap = reqWidth * reqHeight * 2; while (totalPixels / (inSampleSize * inSampleSize) > totalReqPixelsCap) { inSampleSize++; } return inSampleSize; }//calculateInSampleSize //setPic public static void setPic(ImageView mImageView, String mCurrentPhotoPath) { /* There isn't enough memory to open up more than a couple camera photos */ /* So pre-scale the target bitmap into which the file is decoded */ /* Get the size of the ImageView */ int targetW = mImageView.getWidth(); int targetH = mImageView.getHeight(); /* Get the size of the image */ BitmapFactory.Options bmOptions = new BitmapFactory.Options(); bmOptions.inJustDecodeBounds = true; BitmapFactory.decodeFile(mCurrentPhotoPath, bmOptions); int photoW = bmOptions.outWidth; int photoH = bmOptions.outHeight; /* Figure out which way needs to be reduced less */ int scaleFactor = 1; if ((targetW > 0) || (targetH > 0)) { scaleFactor = Math.min(photoW / targetW, photoH / targetH); } /* Set bitmap options to scale the image decode target */ bmOptions.inJustDecodeBounds = false; bmOptions.inSampleSize = scaleFactor; bmOptions.inPurgeable = true; /* Decode the JPEG file into a Bitmap */ Bitmap bitmap = BitmapFactory.decodeFile(mCurrentPhotoPath, bmOptions); /* Associate the Bitmap to the ImageView */ mImageView.setImageBitmap(bitmap); }//setPic }
c2d2d1b3c1efc349b98e976f7f2a06f2c42e5936
d412e93ea7e861ef8d79079a6d56bc3ca1a24371
/test-maker/src/main/java/cn/cstqb/exam/testmaker/scheduling/jobs/AbstractJob.java
73ff5e17885210cfd71ae7966b725f4a261124c6
[]
no_license
MickeysClubhouse/test-maker-group1
8ca54f9b01ef7fffbcc87891c03aa94feffb523e
65c10e51ee25212f75d7cb9cf08a7b3df97b8030
refs/heads/master
2022-11-28T07:02:15.037771
2020-04-22T13:12:41
2020-04-22T13:12:41
254,115,336
0
2
null
2022-11-24T05:57:14
2020-04-08T14:44:37
HTML
UTF-8
Java
false
false
1,042
java
package cn.cstqb.exam.testmaker.scheduling.jobs; import cn.cstqb.exam.testmaker.configuration.AppInjector; import cn.cstqb.exam.testmaker.configuration.ApplicationConfigContext; import cn.cstqb.exam.testmaker.services.IReportingService; import com.google.inject.Injector; import org.quartz.Job; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.inject.Inject; /** * Created with IntelliJ IDEA. * User: Jian-Min Gao * Date: 2015/4/1 * Time: 21:28 */ public abstract class AbstractJob implements Job { protected final Logger logger = LoggerFactory.getLogger(getClass()); @Inject IReportingService reportingService; protected static Injector injector = AppInjector.getInstance().getInjector(); protected ApplicationConfigContext configContext = ApplicationConfigContext.getInstance(); protected int warningThreshold; public AbstractJob() { injector.injectMembers(this); this.warningThreshold = configContext.getConfig().getInt("monitoring.expiring.warning-threshold"); } }
903b1b82ceefa60ff36a8d103e9d593511b6be63
884056b6a120b2a4c1c1202a4c69b07f59aecc36
/java projects/commons-lang-master/commons-lang-master/src/main/java/org/apache/commons/lang3/SystemUtils.java
f5085cf4b91c28d0f28a1a00ad4238969ce34095
[ "LicenseRef-scancode-generic-cla", "Apache-2.0", "MIT" ]
permissive
NazaninBayati/SMBFL
a48b16dbe2577a3324209e026c1b2bf53ee52f55
999c4bca166a32571e9f0b1ad99085a5d48550eb
refs/heads/master
2021-07-17T08:52:42.709856
2020-09-07T12:36:11
2020-09-07T12:36:11
204,252,009
3
0
MIT
2020-01-31T18:22:23
2019-08-25T05:47:52
Java
UTF-8
Java
false
false
60,938
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.commons.lang3; import java.io.File; /** * <p> * Helpers for {@code java.lang.System}. * </p> * <p> * If a system property cannot be read due to security restrictions, the corresponding field in this class will be set * to {@code null} and a message will be written to {@code System.err}. * </p> * <p> * #ThreadSafe# * </p> * * @since 1.0 */ public class SystemUtils { /** * The prefix String for all Windows OS. */ private static final String OS_NAME_WINDOWS_PREFIX = "Windows"; // System property constants // ----------------------------------------------------------------------- // These MUST be declared first. Other constants depend on this. /** * The System property key for the user home directory. */ private static final String USER_HOME_KEY = "user.home"; /** * The System property key for the user directory. */ private static final String USER_DIR_KEY = "user.dir"; /** * The System property key for the Java IO temporary directory. */ private static final String JAVA_IO_TMPDIR_KEY = "java.io.tmpdir"; /** * The System property key for the Java home directory. */ private static final String JAVA_HOME_KEY = "java.home"; /** * <p> * The {@code awt.toolkit} System Property. * </p> * <p> * Holds a class name, on Windows XP this is {@code sun.awt.windows.WToolkit}. * </p> * <p> * <b>On platforms without a GUI, this value is {@code null}.</b> * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since 2.1 */ public static final String AWT_TOOLKIT = getSystemProperty("awt.toolkit"); /** * <p> * The {@code file.encoding} System Property. * </p> * <p> * File encoding, such as {@code Cp1252}. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since 2.0 * @since Java 1.2 */ public static final String FILE_ENCODING = getSystemProperty("file.encoding"); /** * <p> * The {@code file.separator} System Property. * The file separator is: * </p> * <ul> * <li>{@code "/"} on UNIX</li> * <li>{@code "\"} on Windows.</li> * </ul> * * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @deprecated Use {@link File#separator}, since it is guaranteed to be a * string containing a single character and it does not require a privilege check. * @since Java 1.1 */ @Deprecated public static final String FILE_SEPARATOR = getSystemProperty("file.separator"); /** * <p> * The {@code java.awt.fonts} System Property. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since 2.1 */ public static final String JAVA_AWT_FONTS = getSystemProperty("java.awt.fonts"); /** * <p> * The {@code java.awt.graphicsenv} System Property. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since 2.1 */ public static final String JAVA_AWT_GRAPHICSENV = getSystemProperty("java.awt.graphicsenv"); /** * <p> * The {@code java.awt.headless} System Property. The value of this property is the String {@code "true"} or * {@code "false"}. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @see #isJavaAwtHeadless() * @since 2.1 * @since Java 1.4 */ public static final String JAVA_AWT_HEADLESS = getSystemProperty("java.awt.headless"); /** * <p> * The {@code java.awt.printerjob} System Property. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since 2.1 */ public static final String JAVA_AWT_PRINTERJOB = getSystemProperty("java.awt.printerjob"); /** * <p> * The {@code java.class.path} System Property. Java class path. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since Java 1.1 */ public static final String JAVA_CLASS_PATH = getSystemProperty("java.class.path"); /** * <p> * The {@code java.class.version} System Property. Java class format version number. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since Java 1.1 */ public static final String JAVA_CLASS_VERSION = getSystemProperty("java.class.version"); /** * <p> * The {@code java.compiler} System Property. Name of JIT compiler to use. First in JDK version 1.2. Not used in Sun * JDKs after 1.2. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since Java 1.2. Not used in Sun versions after 1.2. */ public static final String JAVA_COMPILER = getSystemProperty("java.compiler"); /** * <p> * The {@code java.endorsed.dirs} System Property. Path of endorsed directory or directories. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since Java 1.4 */ public static final String JAVA_ENDORSED_DIRS = getSystemProperty("java.endorsed.dirs"); /** * <p> * The {@code java.ext.dirs} System Property. Path of extension directory or directories. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since Java 1.3 */ public static final String JAVA_EXT_DIRS = getSystemProperty("java.ext.dirs"); /** * <p> * The {@code java.home} System Property. Java installation directory. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since Java 1.1 */ public static final String JAVA_HOME = getSystemProperty(JAVA_HOME_KEY); /** * <p> * The {@code java.io.tmpdir} System Property. Default temp file path. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since Java 1.2 */ public static final String JAVA_IO_TMPDIR = getSystemProperty(JAVA_IO_TMPDIR_KEY); /** * <p> * The {@code java.library.path} System Property. List of paths to search when loading libraries. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since Java 1.2 */ public static final String JAVA_LIBRARY_PATH = getSystemProperty("java.library.path"); /** * <p> * The {@code java.runtime.name} System Property. Java Runtime Environment name. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since 2.0 * @since Java 1.3 */ public static final String JAVA_RUNTIME_NAME = getSystemProperty("java.runtime.name"); /** * <p> * The {@code java.runtime.version} System Property. Java Runtime Environment version. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since 2.0 * @since Java 1.3 */ public static final String JAVA_RUNTIME_VERSION = getSystemProperty("java.runtime.version"); /** * <p> * The {@code java.specification.name} System Property. Java Runtime Environment specification name. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since Java 1.2 */ public static final String JAVA_SPECIFICATION_NAME = getSystemProperty("java.specification.name"); /** * <p> * The {@code java.specification.vendor} System Property. Java Runtime Environment specification vendor. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since Java 1.2 */ public static final String JAVA_SPECIFICATION_VENDOR = getSystemProperty("java.specification.vendor"); /** * <p> * The {@code java.specification.version} System Property. Java Runtime Environment specification version. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since Java 1.3 */ public static final String JAVA_SPECIFICATION_VERSION = getSystemProperty("java.specification.version"); private static final JavaVersion JAVA_SPECIFICATION_VERSION_AS_ENUM = JavaVersion.get(JAVA_SPECIFICATION_VERSION); /** * <p> * The {@code java.util.prefs.PreferencesFactory} System Property. A class name. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since 2.1 * @since Java 1.4 */ public static final String JAVA_UTIL_PREFS_PREFERENCES_FACTORY = getSystemProperty("java.util.prefs.PreferencesFactory"); /** * <p> * The {@code java.vendor} System Property. Java vendor-specific string. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since Java 1.1 */ public static final String JAVA_VENDOR = getSystemProperty("java.vendor"); /** * <p> * The {@code java.vendor.url} System Property. Java vendor URL. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since Java 1.1 */ public static final String JAVA_VENDOR_URL = getSystemProperty("java.vendor.url"); /** * <p> * The {@code java.version} System Property. Java version number. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since Java 1.1 */ public static final String JAVA_VERSION = getSystemProperty("java.version"); /** * <p> * The {@code java.vm.info} System Property. Java Virtual Machine implementation info. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since 2.0 * @since Java 1.2 */ public static final String JAVA_VM_INFO = getSystemProperty("java.vm.info"); /** * <p> * The {@code java.vm.name} System Property. Java Virtual Machine implementation name. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since Java 1.2 */ public static final String JAVA_VM_NAME = getSystemProperty("java.vm.name"); /** * <p> * The {@code java.vm.specification.name} System Property. Java Virtual Machine specification name. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since Java 1.2 */ public static final String JAVA_VM_SPECIFICATION_NAME = getSystemProperty("java.vm.specification.name"); /** * <p> * The {@code java.vm.specification.vendor} System Property. Java Virtual Machine specification vendor. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since Java 1.2 */ public static final String JAVA_VM_SPECIFICATION_VENDOR = getSystemProperty("java.vm.specification.vendor"); /** * <p> * The {@code java.vm.specification.version} System Property. Java Virtual Machine specification version. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since Java 1.2 */ public static final String JAVA_VM_SPECIFICATION_VERSION = getSystemProperty("java.vm.specification.version"); /** * <p> * The {@code java.vm.vendor} System Property. Java Virtual Machine implementation vendor. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since Java 1.2 */ public static final String JAVA_VM_VENDOR = getSystemProperty("java.vm.vendor"); /** * <p> * The {@code java.vm.version} System Property. Java Virtual Machine implementation version. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since Java 1.2 */ public static final String JAVA_VM_VERSION = getSystemProperty("java.vm.version"); /** * <p> * The {@code line.separator} System Property. Line separator (<code>&quot;\n&quot;</code> on UNIX). * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @deprecated Use {@link System#lineSeparator} instead, since it does not require a privilege check. * @since Java 1.1 */ @Deprecated public static final String LINE_SEPARATOR = getSystemProperty("line.separator"); /** * <p> * The {@code os.arch} System Property. Operating system architecture. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since Java 1.1 */ public static final String OS_ARCH = getSystemProperty("os.arch"); /** * <p> * The {@code os.name} System Property. Operating system name. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since Java 1.1 */ public static final String OS_NAME = getSystemProperty("os.name"); /** * <p> * The {@code os.version} System Property. Operating system version. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since Java 1.1 */ public static final String OS_VERSION = getSystemProperty("os.version"); /** * <p> * The {@code path.separator} System Property. Path separator (<code>&quot;:&quot;</code> on UNIX). * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @deprecated Use {@link File#pathSeparator}, since it is guaranteed to be a * string containing a single character and it does not require a privilege check. * @since Java 1.1 */ @Deprecated public static final String PATH_SEPARATOR = getSystemProperty("path.separator"); /** * <p> * The {@code user.country} or {@code user.region} System Property. User's country code, such as {@code GB}. First * in Java version 1.2 as {@code user.region}. Renamed to {@code user.country} in 1.4 * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since 2.0 * @since Java 1.2 */ public static final String USER_COUNTRY = getSystemProperty("user.country") == null ? getSystemProperty("user.region") : getSystemProperty("user.country"); /** * <p> * The {@code user.dir} System Property. User's current working directory. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since Java 1.1 */ public static final String USER_DIR = getSystemProperty(USER_DIR_KEY); /** * <p> * The {@code user.home} System Property. User's home directory. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since Java 1.1 */ public static final String USER_HOME = getSystemProperty(USER_HOME_KEY); /** * <p> * The {@code user.language} System Property. User's language code, such as {@code "en"}. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since 2.0 * @since Java 1.2 */ public static final String USER_LANGUAGE = getSystemProperty("user.language"); /** * <p> * The {@code user.name} System Property. User's account name. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since Java 1.1 */ public static final String USER_NAME = getSystemProperty("user.name"); /** * <p> * The {@code user.timezone} System Property. For example: {@code "America/Los_Angeles"}. * </p> * <p> * Defaults to {@code null} if the runtime does not have security access to read this property or the property does * not exist. * </p> * <p> * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of * sync with that System property. * </p> * * @since 2.1 */ public static final String USER_TIMEZONE = getSystemProperty("user.timezone"); // Java version checks // ----------------------------------------------------------------------- // These MUST be declared after those above as they depend on the // values being set up /** * <p> * Is {@code true} if this is Java version 1.1 (also 1.1.x versions). * </p> * <p> * The field will return {@code false} if {@link #JAVA_VERSION} is {@code null}. * </p> */ public static final boolean IS_JAVA_1_1 = getJavaVersionMatches("1.1"); /** * <p> * Is {@code true} if this is Java version 1.2 (also 1.2.x versions). * </p> * <p> * The field will return {@code false} if {@link #JAVA_VERSION} is {@code null}. * </p> */ public static final boolean IS_JAVA_1_2 = getJavaVersionMatches("1.2"); /** * <p> * Is {@code true} if this is Java version 1.3 (also 1.3.x versions). * </p> * <p> * The field will return {@code false} if {@link #JAVA_VERSION} is {@code null}. * </p> */ public static final boolean IS_JAVA_1_3 = getJavaVersionMatches("1.3"); /** * <p> * Is {@code true} if this is Java version 1.4 (also 1.4.x versions). * </p> * <p> * The field will return {@code false} if {@link #JAVA_VERSION} is {@code null}. * </p> */ public static final boolean IS_JAVA_1_4 = getJavaVersionMatches("1.4"); /** * <p> * Is {@code true} if this is Java version 1.5 (also 1.5.x versions). * </p> * <p> * The field will return {@code false} if {@link #JAVA_VERSION} is {@code null}. * </p> */ public static final boolean IS_JAVA_1_5 = getJavaVersionMatches("1.5"); /** * <p> * Is {@code true} if this is Java version 1.6 (also 1.6.x versions). * </p> * <p> * The field will return {@code false} if {@link #JAVA_VERSION} is {@code null}. * </p> */ public static final boolean IS_JAVA_1_6 = getJavaVersionMatches("1.6"); /** * <p> * Is {@code true} if this is Java version 1.7 (also 1.7.x versions). * </p> * <p> * The field will return {@code false} if {@link #JAVA_VERSION} is {@code null}. * </p> * * @since 3.0 */ public static final boolean IS_JAVA_1_7 = getJavaVersionMatches("1.7"); /** * <p> * Is {@code true} if this is Java version 1.8 (also 1.8.x versions). * </p> * <p> * The field will return {@code false} if {@link #JAVA_VERSION} is {@code null}. * </p> * * @since 3.3.2 */ public static final boolean IS_JAVA_1_8 = getJavaVersionMatches("1.8"); /** * <p> * Is {@code true} if this is Java version 1.9 (also 1.9.x versions). * </p> * <p> * The field will return {@code false} if {@link #JAVA_VERSION} is {@code null}. * </p> * * @since 3.4 * * @deprecated As of release 3.5, replaced by {@link #IS_JAVA_9} */ @Deprecated public static final boolean IS_JAVA_1_9 = getJavaVersionMatches("9"); /** * <p> * Is {@code true} if this is Java version 9 (also 9.x versions). * </p> * <p> * The field will return {@code false} if {@link #JAVA_VERSION} is {@code null}. * </p> * * @since 3.5 */ public static final boolean IS_JAVA_9 = getJavaVersionMatches("9"); /** * <p> * Is {@code true} if this is Java version 10 (also 10.x versions). * </p> * <p> * The field will return {@code false} if {@link #JAVA_VERSION} is {@code null}. * </p> * * @since 3.7 */ public static final boolean IS_JAVA_10 = getJavaVersionMatches("10"); /** * <p> * Is {@code true} if this is Java version 11 (also 11.x versions). * </p> * <p> * The field will return {@code false} if {@link #JAVA_VERSION} is {@code null}. * </p> * * @since 3.8 */ public static final boolean IS_JAVA_11 = getJavaVersionMatches("11"); /** * <p> * Is {@code true} if this is Java version 12 (also 12.x versions). * </p> * <p> * The field will return {@code false} if {@link #JAVA_VERSION} is {@code null}. * </p> * * @since 3.9 */ public static final boolean IS_JAVA_12 = getJavaVersionMatches("12"); /** * <p> * Is {@code true} if this is Java version 13 (also 13.x versions). * </p> * <p> * The field will return {@code false} if {@link #JAVA_VERSION} is {@code null}. * </p> * * @since 3.9 */ public static final boolean IS_JAVA_13 = getJavaVersionMatches("13"); // Operating system checks // ----------------------------------------------------------------------- // These MUST be declared after those above as they depend on the // values being set up // OS names from http://www.vamphq.com/os.html // Selected ones included - please advise [email protected] // if you want another added or a mistake corrected /** * <p> * Is {@code true} if this is AIX. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 2.0 */ public static final boolean IS_OS_AIX = getOsMatchesName("AIX"); /** * <p> * Is {@code true} if this is HP-UX. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 2.0 */ public static final boolean IS_OS_HP_UX = getOsMatchesName("HP-UX"); /** * <p> * Is {@code true} if this is IBM OS/400. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 3.3 */ public static final boolean IS_OS_400 = getOsMatchesName("OS/400"); /** * <p> * Is {@code true} if this is Irix. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 2.0 */ public static final boolean IS_OS_IRIX = getOsMatchesName("Irix"); /** * <p> * Is {@code true} if this is Linux. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 2.0 */ public static final boolean IS_OS_LINUX = getOsMatchesName("Linux") || getOsMatchesName("LINUX"); /** * <p> * Is {@code true} if this is Mac. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 2.0 */ public static final boolean IS_OS_MAC = getOsMatchesName("Mac"); /** * <p> * Is {@code true} if this is Mac. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 2.0 */ public static final boolean IS_OS_MAC_OSX = getOsMatchesName("Mac OS X"); /** * <p> * Is {@code true} if this is Mac OS X Cheetah. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 3.4 */ public static final boolean IS_OS_MAC_OSX_CHEETAH = getOsMatches("Mac OS X", "10.0"); /** * <p> * Is {@code true} if this is Mac OS X Puma. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 3.4 */ public static final boolean IS_OS_MAC_OSX_PUMA = getOsMatches("Mac OS X", "10.1"); /** * <p> * Is {@code true} if this is Mac OS X Jaguar. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 3.4 */ public static final boolean IS_OS_MAC_OSX_JAGUAR = getOsMatches("Mac OS X", "10.2"); /** * <p> * Is {@code true} if this is Mac OS X Panther. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 3.4 */ public static final boolean IS_OS_MAC_OSX_PANTHER = getOsMatches("Mac OS X", "10.3"); /** * <p> * Is {@code true} if this is Mac OS X Tiger. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 3.4 */ public static final boolean IS_OS_MAC_OSX_TIGER = getOsMatches("Mac OS X", "10.4"); /** * <p> * Is {@code true} if this is Mac OS X Leopard. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 3.4 */ public static final boolean IS_OS_MAC_OSX_LEOPARD = getOsMatches("Mac OS X", "10.5"); /** * <p> * Is {@code true} if this is Mac OS X Snow Leopard. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 3.4 */ public static final boolean IS_OS_MAC_OSX_SNOW_LEOPARD = getOsMatches("Mac OS X", "10.6"); /** * <p> * Is {@code true} if this is Mac OS X Lion. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 3.4 */ public static final boolean IS_OS_MAC_OSX_LION = getOsMatches("Mac OS X", "10.7"); /** * <p> * Is {@code true} if this is Mac OS X Mountain Lion. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 3.4 */ public static final boolean IS_OS_MAC_OSX_MOUNTAIN_LION = getOsMatches("Mac OS X", "10.8"); /** * <p> * Is {@code true} if this is Mac OS X Mavericks. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 3.4 */ public static final boolean IS_OS_MAC_OSX_MAVERICKS = getOsMatches("Mac OS X", "10.9"); /** * <p> * Is {@code true} if this is Mac OS X Yosemite. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 3.4 */ public static final boolean IS_OS_MAC_OSX_YOSEMITE = getOsMatches("Mac OS X", "10.10"); /** * <p> * Is {@code true} if this is Mac OS X El Capitan. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 3.5 */ public static final boolean IS_OS_MAC_OSX_EL_CAPITAN = getOsMatches("Mac OS X", "10.11"); /** * <p> * Is {@code true} if this is FreeBSD. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 3.1 */ public static final boolean IS_OS_FREE_BSD = getOsMatchesName("FreeBSD"); /** * <p> * Is {@code true} if this is OpenBSD. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 3.1 */ public static final boolean IS_OS_OPEN_BSD = getOsMatchesName("OpenBSD"); /** * <p> * Is {@code true} if this is NetBSD. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 3.1 */ public static final boolean IS_OS_NET_BSD = getOsMatchesName("NetBSD"); /** * <p> * Is {@code true} if this is OS/2. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 2.0 */ public static final boolean IS_OS_OS2 = getOsMatchesName("OS/2"); /** * <p> * Is {@code true} if this is Solaris. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 2.0 */ public static final boolean IS_OS_SOLARIS = getOsMatchesName("Solaris"); /** * <p> * Is {@code true} if this is SunOS. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 2.0 */ public static final boolean IS_OS_SUN_OS = getOsMatchesName("SunOS"); /** * <p> * Is {@code true} if this is a UNIX like system, as in any of AIX, HP-UX, Irix, Linux, MacOSX, Solaris or SUN OS. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 2.1 */ public static final boolean IS_OS_UNIX = IS_OS_AIX || IS_OS_HP_UX || IS_OS_IRIX || IS_OS_LINUX || IS_OS_MAC_OSX || IS_OS_SOLARIS || IS_OS_SUN_OS || IS_OS_FREE_BSD || IS_OS_OPEN_BSD || IS_OS_NET_BSD; /** * <p> * Is {@code true} if this is Windows. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 2.0 */ public static final boolean IS_OS_WINDOWS = getOsMatchesName(OS_NAME_WINDOWS_PREFIX); /** * <p> * Is {@code true} if this is Windows 2000. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 2.0 */ public static final boolean IS_OS_WINDOWS_2000 = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " 2000"); /** * <p> * Is {@code true} if this is Windows 2003. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 3.1 */ public static final boolean IS_OS_WINDOWS_2003 = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " 2003"); /** * <p> * Is {@code true} if this is Windows Server 2008. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 3.1 */ public static final boolean IS_OS_WINDOWS_2008 = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " Server 2008"); /** * <p> * Is {@code true} if this is Windows Server 2012. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 3.4 */ public static final boolean IS_OS_WINDOWS_2012 = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " Server 2012"); /** * <p> * Is {@code true} if this is Windows 95. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 2.0 */ public static final boolean IS_OS_WINDOWS_95 = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " 95"); /** * <p> * Is {@code true} if this is Windows 98. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 2.0 */ public static final boolean IS_OS_WINDOWS_98 = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " 98"); /** * <p> * Is {@code true} if this is Windows ME. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 2.0 */ public static final boolean IS_OS_WINDOWS_ME = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " Me"); /** * <p> * Is {@code true} if this is Windows NT. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 2.0 */ public static final boolean IS_OS_WINDOWS_NT = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " NT"); /** * <p> * Is {@code true} if this is Windows XP. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 2.0 */ public static final boolean IS_OS_WINDOWS_XP = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " XP"); // ----------------------------------------------------------------------- /** * <p> * Is {@code true} if this is Windows Vista. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 2.4 */ public static final boolean IS_OS_WINDOWS_VISTA = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " Vista"); /** * <p> * Is {@code true} if this is Windows 7. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 3.0 */ public static final boolean IS_OS_WINDOWS_7 = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " 7"); /** * <p> * Is {@code true} if this is Windows 8. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 3.2 */ public static final boolean IS_OS_WINDOWS_8 = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " 8"); /** * <p> * Is {@code true} if this is Windows 10. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 3.5 */ public static final boolean IS_OS_WINDOWS_10 = getOsMatchesName(OS_NAME_WINDOWS_PREFIX + " 10"); /** * <p> * Is {@code true} if this is z/OS. * </p> * <p> * The field will return {@code false} if {@code OS_NAME} is {@code null}. * </p> * * @since 3.5 */ // Values on a z/OS system I tested (Gary Gregory - 2016-03-12) // os.arch = s390x // os.encoding = ISO8859_1 // os.name = z/OS // os.version = 02.02.00 public static final boolean IS_OS_ZOS = getOsMatchesName("z/OS"); /** * <p> * Gets the Java home directory as a {@code File}. * </p> * * @return a directory * @throws SecurityException if a security manager exists and its {@code checkPropertyAccess} method doesn't allow * access to the specified system property. * @see System#getProperty(String) * @since 2.1 */ public static File getJavaHome() { return new File(System.getProperty(JAVA_HOME_KEY)); } /** * Gets the host name from an environment variable. * * <p> * If you want to know what the network stack says is the host name, you should use {@code InetAddress.getLocalHost().getHostName()}. * </p> * * @return the host name. * @since 3.6 */ public static String getHostName() { return IS_OS_WINDOWS ? System.getenv("COMPUTERNAME") : System.getenv("HOSTNAME"); } /** * <p> * Gets the Java IO temporary directory as a {@code File}. * </p> * * @return a directory * @throws SecurityException if a security manager exists and its {@code checkPropertyAccess} method doesn't allow * access to the specified system property. * @see System#getProperty(String) * @since 2.1 */ public static File getJavaIoTmpDir() { return new File(System.getProperty(JAVA_IO_TMPDIR_KEY)); } /** * <p> * Decides if the Java version matches. * </p> * * @param versionPrefix the prefix for the java version * @return true if matches, or false if not or can't determine */ private static boolean getJavaVersionMatches(final String versionPrefix) { return isJavaVersionMatch(JAVA_SPECIFICATION_VERSION, versionPrefix); } /** * Decides if the operating system matches. * * @param osNamePrefix the prefix for the OS name * @param osVersionPrefix the prefix for the version * @return true if matches, or false if not or can't determine */ private static boolean getOsMatches(final String osNamePrefix, final String osVersionPrefix) { return isOSMatch(OS_NAME, OS_VERSION, osNamePrefix, osVersionPrefix); } /** * Decides if the operating system matches. * * @param osNamePrefix the prefix for the OS name * @return true if matches, or false if not or can't determine */ private static boolean getOsMatchesName(final String osNamePrefix) { return isOSNameMatch(OS_NAME, osNamePrefix); } // ----------------------------------------------------------------------- /** * <p> * Gets a System property, defaulting to {@code null} if the property cannot be read. * </p> * <p> * If a {@code SecurityException} is caught, the return value is {@code null} and a message is written to * {@code System.err}. * </p> * * @param property the system property name * @return the system property value or {@code null} if a security problem occurs */ private static String getSystemProperty(final String property) { try { return System.getProperty(property); } catch (final SecurityException ex) { // we are not allowed to look at this property // System.err.println("Caught a SecurityException reading the system property '" + property // + "'; the SystemUtils property value will default to null."); return null; } } /** * <p> * Gets an environment variable, defaulting to {@code defaultValue} if the variable cannot be read. * </p> * <p> * If a {@code SecurityException} is caught, the return value is {@code defaultValue} and a message is written to * {@code System.err}. * </p> * * @param name * the environment variable name * @param defaultValue * the default value * @return the environment variable value or {@code defaultValue} if a security problem occurs * @since 3.8 */ public static String getEnvironmentVariable(final String name, final String defaultValue) { try { final String value = System.getenv(name); return value == null ? defaultValue : value; } catch (final SecurityException ex) { // we are not allowed to look at this property // System.err.println("Caught a SecurityException reading the environment variable '" + name + "'."); return defaultValue; } } /** * <p> * Gets the user directory as a {@code File}. * </p> * * @return a directory * @throws SecurityException if a security manager exists and its {@code checkPropertyAccess} method doesn't allow * access to the specified system property. * @see System#getProperty(String) * @since 2.1 */ public static File getUserDir() { return new File(System.getProperty(USER_DIR_KEY)); } /** * <p> * Gets the user home directory as a {@code File}. * </p> * * @return a directory * @throws SecurityException if a security manager exists and its {@code checkPropertyAccess} method doesn't allow * access to the specified system property. * @see System#getProperty(String) * @since 2.1 */ public static File getUserHome() { return new File(System.getProperty(USER_HOME_KEY)); } /** * Returns whether the {@link #JAVA_AWT_HEADLESS} value is {@code true}. * * @return {@code true} if {@code JAVA_AWT_HEADLESS} is {@code "true"}, {@code false} otherwise. * @see #JAVA_AWT_HEADLESS * @since 2.1 * @since Java 1.4 */ public static boolean isJavaAwtHeadless() { return Boolean.TRUE.toString().equals(JAVA_AWT_HEADLESS); } /** * <p> * Is the Java version at least the requested version. * </p> * <p> * * @param requiredVersion the required version, for example 1.31f * @return {@code true} if the actual version is equal or greater than the required version */ public static boolean isJavaVersionAtLeast(final JavaVersion requiredVersion) { return JAVA_SPECIFICATION_VERSION_AS_ENUM.atLeast(requiredVersion); } /** * <p> * Is the Java version at most the requested version. * </p> * <p> * Example input: * </p> * * @param requiredVersion the required version, for example 1.31f * @return {@code true} if the actual version is equal or greater than the required version * @since 3.9 */ public static boolean isJavaVersionAtMost(final JavaVersion requiredVersion) { return JAVA_SPECIFICATION_VERSION_AS_ENUM.atMost(requiredVersion); } /** * <p> * Decides if the Java version matches. * </p> * <p> * This method is package private instead of private to support unit test invocation. * </p> * * @param version the actual Java version * @param versionPrefix the prefix for the expected Java version * @return true if matches, or false if not or can't determine */ static boolean isJavaVersionMatch(final String version, final String versionPrefix) { if (version == null) { return false; } return version.startsWith(versionPrefix); } /** * Decides if the operating system matches. * <p> * This method is package private instead of private to support unit test invocation. * </p> * * @param osName the actual OS name * @param osVersion the actual OS version * @param osNamePrefix the prefix for the expected OS name * @param osVersionPrefix the prefix for the expected OS version * @return true if matches, or false if not or can't determine */ static boolean isOSMatch(final String osName, final String osVersion, final String osNamePrefix, final String osVersionPrefix) { if (osName == null || osVersion == null) { return false; } return isOSNameMatch(osName, osNamePrefix) && isOSVersionMatch(osVersion, osVersionPrefix); } /** * Decides if the operating system matches. * <p> * This method is package private instead of private to support unit test invocation. * </p> * * @param osName the actual OS name * @param osNamePrefix the prefix for the expected OS name * @return true if matches, or false if not or can't determine */ static boolean isOSNameMatch(final String osName, final String osNamePrefix) { if (osName == null) { return false; } return osName.startsWith(osNamePrefix); } /** * Decides if the operating system version matches. * <p> * This method is package private instead of private to support unit test invocation. * </p> * * @param osVersion the actual OS version * @param osVersionPrefix the prefix for the expected OS version * @return true if matches, or false if not or can't determine */ static boolean isOSVersionMatch(final String osVersion, final String osVersionPrefix) { if (StringUtils.isEmpty(osVersion)) { return false; } // Compare parts of the version string instead of using String.startsWith(String) because otherwise // osVersionPrefix 10.1 would also match osVersion 10.10 final String[] versionPrefixParts = osVersionPrefix.split("\\."); final String[] versionParts = osVersion.split("\\."); for (int i = 0; i < Math.min(versionPrefixParts.length, versionParts.length); i++) { if (!versionPrefixParts[i].equals(versionParts[i])) { return false; } } return true; } // ----------------------------------------------------------------------- /** * <p> * SystemUtils instances should NOT be constructed in standard programming. Instead, the class should be used as * {@code SystemUtils.FILE_SEPARATOR}. * </p> * <p> * This constructor is public to permit tools that require a JavaBean instance to operate. * </p> */ public SystemUtils() { super(); } }
776ff4876c3184c7aad7adae5124e3f770117671
574a750cd06f641a5ec415d5fcfc8996c53cc32c
/src/main/java/com/yunlong/softpark/form/ColumnSimpForm.java
439a29e27214a1e91f03a520c2175f0e54d7a325
[ "Apache-2.0" ]
permissive
OldClassmatesWang/Soft-iPark
5416a06aad26c3930ce6ea3ebd79b2b1deb18d0d
f10f613e4e7468dcb6957cb822e626e872d0f2f2
refs/heads/master
2022-12-01T23:49:37.347204
2020-08-14T01:33:05
2020-08-14T01:33:05
287,423,164
0
0
null
null
null
null
UTF-8
Java
false
false
184
java
package com.yunlong.softpark.form; import lombok.Data; /** * @Author: Cui * @Date: 2020/8/1 * @Description: */ @Data public class ColumnSimpForm { private String columnId; }
f5ca87115715efd9ecd86057c3265cfba622dbac
533602c750930ce4bb95aa5a781166f0939ee10e
/UdemySpringAnnot/src/main/java/com/code/annote/TennisCoach.java
198e11f5ee646db0a70b2bdf326745634f502615
[]
no_license
phCodeHub/Spring_Example
12961b0597d0b3b4947c2299a84917fe42f9513e
7af6f1ed77c97e188b58b9c957b6848cf0fcfbf7
refs/heads/master
2022-12-24T04:26:15.148180
2019-08-04T19:37:06
2019-08-04T19:37:06
200,533,386
0
0
null
2022-12-15T23:43:03
2019-08-04T19:29:29
Java
UTF-8
Java
false
false
1,589
java
package com.code.annote; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; @Component("TennisWala") //@Scope("prototype") public class TennisCoach implements Coach { @Autowired @Qualifier("happyFortuneService") private FortuneService lFortuneService; public FortuneService getlFortuneService() { return lFortuneService; } //Setter Autowiring /*@Autowired public void setlFortuneService(FortuneService lFortuneService) { this.lFortuneService = lFortuneService; } */ public TennisCoach() { System.out.println("inside default"); } /*@Autowired public TennisCoach(FortuneService lFortuneService) { super(); this.lFortuneService = lFortuneService; }*/ @Override public String getDailyWorkOut() { // TODO Auto-generated method stub return "Practice Service"; } @Override public String getDailyFortune() { // TODO Auto-generated method stub return lFortuneService.getFortune(); } //Method Autowiring -- wiil be called at startup @Autowired @Qualifier("restFortuneService") public void yourFortune(FortuneService lFortune) { System.out.println("your fortune aaa"); } //define init @PostConstruct public void doStartup() { System.out.println("It boooottting"); } //define destroy @PreDestroy public void doShutdown() { System.out.println("It shuttting"); } }
[ "phc@phc" ]
phc@phc
c71de3e0bd138dec86f7b3abcf259bf97709d239
ab31363dfed251709e9ef1a2b202d7c480de8630
/trace-client/src/main/java/com/daoyuan/trace/client/interceptors/mybatis/MybatisParameterUtils.java
05218dcd1c3998c67224408b578ed2ee0ce04729
[]
no_license
raoshihong/trace
bfccb2bd4bbdf65a19c337c4054e0ee4e4f91fcf
f6d31cd4731ed257ef0a34c461a1712d778b695f
refs/heads/master
2022-07-12T06:08:03.704938
2019-10-15T09:17:05
2019-10-15T09:17:05
215,255,945
0
0
null
2022-06-29T19:44:14
2019-10-15T09:12:31
Java
UTF-8
Java
false
false
2,238
java
package com.daoyuan.trace.client.interceptors.mybatis; import org.apache.ibatis.mapping.*; import org.apache.ibatis.reflection.MetaObject; import org.apache.ibatis.session.Configuration; import java.util.HashMap; import java.util.List; import java.util.Map; public class MybatisParameterUtils { /** * 获取更新语句中的用户入参字段 * @param mappedStatement * @param boundSql * @param updateParameterObject * @return */ public static Map<String, Object> getParameter(MappedStatement mappedStatement, BoundSql boundSql, Object updateParameterObject){ Configuration configuration = mappedStatement.getConfiguration(); //获取sql中传递的参数 List<ParameterMapping> parameterMappings = boundSql.getParameterMappings(); Map<String, Object> paramMap = new HashMap<>(); if(mappedStatement.getStatementType() == StatementType.PREPARED){ if (parameterMappings != null) { for (int i = 0; i < parameterMappings.size(); i++) { ParameterMapping parameterMapping = parameterMappings.get(i); if (parameterMapping.getMode() != ParameterMode.OUT) { Object value; String propertyName = parameterMapping.getProperty(); String finalPropertyName = propertyName; if (boundSql.hasAdditionalParameter(propertyName)) { value = boundSql.getAdditionalParameter(propertyName); } else if (updateParameterObject == null) { value = null; } else if (mappedStatement.getConfiguration().getTypeHandlerRegistry().hasTypeHandler(updateParameterObject.getClass())) { value = updateParameterObject; } else { MetaObject metaObject = configuration.newMetaObject(updateParameterObject); value = metaObject.getValue(propertyName); if (propertyName.indexOf(".") > - 1) { finalPropertyName = propertyName.substring(propertyName.indexOf(".")+1); } } paramMap.put(finalPropertyName, value); } } } } return paramMap; } }
6325457ee8cef304278e0c3417bc26b36395becb
cd86ae44fa52a5472aa24470923ff5166505c53d
/src/main/java/sarf/verb/trilateral/augmented/modifier/vocalizer/lafif/separated/active/Present1Vocalizer.java
09ffe0062afbc1c3ab0fc12fefd85b7ed80d2b74
[]
no_license
zeezoich/sarf
6598eab946498555f4687c38c73448f53079d0fa
b92df27fae8eeb1a3a340fac33511045ae2939dd
refs/heads/master
2020-07-11T05:18:22.881570
2019-08-26T10:22:59
2019-08-26T10:22:59
204,451,391
0
0
null
2019-08-26T10:22:17
2019-08-26T10:22:16
null
UTF-8
Java
false
false
2,729
java
package sarf.verb.trilateral.augmented.modifier.vocalizer.lafif.separated.active; import java.util.*; import sarf.KindOfVerb; import sarf.verb.trilateral.Substitution.*; import sarf.verb.trilateral.augmented.modifier.*; import sarf.verb.trilateral.augmented.ConjugationResult; /** * <p>Title: Sarf Program</p> * * <p>Description: </p> * * <p>Copyright: Copyright (c) 2006</p> * * <p>Company: ALEXO</p> * * @author Haytham Mohtasseb Billah * @version 1.0 */ public class Present1Vocalizer extends SubstitutionsApplier implements IAugmentedTrilateralModifier { private final List<Substitution> substitutions = new ArrayList<>(); public Present1Vocalizer() { substitutions.add(new SuffixSubstitution("ِيُ","ِي"));// EX: (يُوصِي، يوالِي، يَتَّقِي، يستوفِي) substitutions.add(new SuffixSubstitution("يْ", "")); // EX: (لم يُوصِ، يوالِ، يَتَّقِ، يستوفِ) substitutions.add(new InfixSubstitution("يِن", "ن")); // EX: (أنتِ تُوصِنَّ، توالِنَّ، تَتَّقِنَّ، تستوفِنَّ) substitutions.add(new InfixSubstitution("يِي", "ي")); // EX: (أنتِ تُوصِينَ، تُوالِينَ، تَتَّقِينَ، تَستوفِينَ) substitutions.add(new InfixSubstitution("يْن", "ين")); // EX: (أنتن تُوصِينَ، تُوالِينَ، تَتَّقِينَ، تَستوفِينَ) substitutions.add(new InfixSubstitution("ِيُو", "ُو")); // EX: (أنتم تُوصُونَ، تُوالُونَ، تَتَّقُونَ، تَستوفُونَ) substitutions.add(new InfixSubstitution("ِيُن", "ُن")); // EX: (أنتم تُوصُنَّ، تُوالُنَّ، تَتَّقُنَّ، تَستوفُنَّ) } public List<Substitution> getSubstitutions() { return substitutions; } public boolean isApplied(ConjugationResult conjugationResult) { KindOfVerb kov = conjugationResult.getKov(); int formulaNo = conjugationResult.getFormulaNo(); if (kov == KindOfVerb.Lafeef_Mafrooq_Mahmouz_Ain) { switch (formulaNo) { case 5: case 9: return true; } switch (formulaNo) { case 1: case 3: return true; } } else if (kov == KindOfVerb.Lafeef_Mafrooq) { switch (formulaNo) { case 1: case 3: case 5: case 9: return true; } } return false; } }
0428d4864714b32391379898f00790d5dcabe7dd
c696d4fc1f9144906750231a4b85979cf96fc067
/jy-access-entity/src/main/java/com/jy/entity/pojo/DeviceTypePojo.java
136608019db42101e41f052b6cc466fdd20fa584
[]
no_license
liukh1227/jyAccess
e5b723f4354464cf587f1949a5c567bd4ae12213
bac6929f28030e249fb8e34f3e6c4eeb646aec18
refs/heads/master
2021-05-10T13:11:27.214908
2018-01-22T14:14:07
2018-01-22T14:14:07
118,428,828
0
0
null
null
null
null
UTF-8
Java
false
false
434
java
package com.jy.entity.pojo; import java.io.Serializable; import com.jy.entity.po.DeviceType; public class DeviceTypePojo extends DeviceType implements Serializable{ private static final long serialVersionUID = 1L; private String parentTypeName; public String getParentTypeName() { return parentTypeName; } public void setParentTypeName(String parentTypeName) { this.parentTypeName = parentTypeName; } }
cbb1cbbfdc58be279382a009c827c85392a2805d
acbd79a76f7506e00b54ac1791a9ca39e5ceb7d9
/portal-framework-core/src/main/java/com/ghh/framework/web/security/filter/CookieFilter.java
7afc85ebeb1e53701129e86def5b436ab73dfdc6
[]
no_license
nkgfirecream/ghhportal
d4474ba1a12a53fe3d971248359d3d717731c0a3
c60fd0a8f1183ebe4c42a96e76d570b52c300ce5
refs/heads/master
2022-01-13T19:16:30.954633
2018-12-23T07:26:23
2018-12-23T07:26:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,917
java
package com.ghh.framework.web.security.filter; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /***************************************************************** * * Cookie过滤器,设置HttpOnly,Secure,Expire属性 * * @author ghh * @date 2018年12月19日下午10:53:57 * @since v1.0.1 ****************************************************************/ public class CookieFilter implements Filter { public void destroy() { } public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) arg0; HttpServletResponse resp = (HttpServletResponse) arg1; Cookie[] cookies = req.getCookies(); if (cookies != null) { Cookie cookie = cookies[0]; if (cookie != null) { // Servlet 2.5不支持在Cookie上直接设置HttpOnly属性 String value = cookie.getValue(); StringBuilder builder = new StringBuilder(); builder.append("JSESSIONID=" + value + "; "); // builder.append("Secure; "); builder.append("HttpOnly; "); /* * Calendar cal = Calendar.getInstance(); cal.add(Calendar.HOUR, * 1); Date date = cal.getTime(); Locale locale = Locale.CHINA; * SimpleDateFormat sdf = new * SimpleDateFormat("dd-MM-yyyy HH:mm:ss",locale); * builder.append("Expires=" + sdf.format(date)); */ resp.setHeader("Set-Cookie", builder.toString()); } } chain.doFilter(req, resp); } public void init(FilterConfig arg0) throws ServletException { } }
20e9f34757d1a1c3809fcee1bd83a49a8036b8ea
7000ecf500f71d4b0a22468b0368dd7419016d7a
/src/com/appxy/pocketexpensepro/accounts/EditAccountActivity.java
5cd0e888db50ccb0e10c229431a634d6b4f60b35
[]
no_license
sadsunny/Expense
82cfde0e23e647eee4a9201ff6df94cb1752295f
458c26af2b2c72f8ac382b2993fc4e2c9304a60c
refs/heads/master
2020-05-31T12:50:01.272395
2015-03-27T09:37:59
2015-03-27T09:37:59
19,053,965
0
0
null
null
null
null
UTF-8
Java
false
false
15,229
java
package com.appxy.pocketexpensepro.accounts; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.List; import java.util.Map; import java.util.Set; import uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper; import com.appxy.pocketexpensepro.R; import com.appxy.pocketexpensepro.accounts.ChooseTypeListViewAdapter.ViewHolder; import com.appxy.pocketexpensepro.entity.MEntity; import com.appxy.pocketexpensepro.passcode.BaseHomeActivity; import com.dropbox.sync.android.DbxRecord; import android.annotation.SuppressLint; import android.app.ActionBar; import android.app.Activity; import android.app.AlertDialog; import android.app.DatePickerDialog; import android.app.ActionBar.LayoutParams; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; import android.util.Log; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemSelectedListener; import android.widget.ArrayAdapter; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.CheckedTextView; import android.widget.DatePicker; import android.widget.EditText; import android.widget.ImageView; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; /* * 对CreatAccountTypeActivity发出Result code 1 * 返回到Account主页面的Result code 2 */ public class EditAccountActivity extends BaseHomeActivity { private LayoutInflater inflater; private EditText accountEditText; private EditText balanceEditText; private Button typeButton; private Button dateButton; private Spinner clearSpinner; private ImageView addButton; private ImageView subButton; private int checkedItem = 0; // choosed position private ChooseTypeListViewAdapter mListViewAdapter; private ListView mListView; private AlertDialog mDialog; private List<Map<String, Object>> mTypeList; private int accountTypeSize = 0; private int typeId; // the type id default 1 private String balenceAmountString = "0.00"; private int balenceCheck = 1; // 1 add, 0 sub private int mYear; private int mMonth; private int mDay; private String dateString; private long dateLong; private int clearCheck = 1; // default on 1 private double balanceDouble = 0.0; private int _id; private List<Map<String, Object>> mDataList; private String seAcccountName; private String seAmount; private long seDate; private String seTypeName; private int seTypeId; private int seIsclear; private String uuid; @Override public void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_creat_new_account); Intent intent = getIntent(); if (intent != null) { _id = intent.getIntExtra("_id", 0); uuid = intent.getStringExtra("uuid"); } if (_id <= 0) { finish(); } mDataList = AccountDao.selectAccountById(this, _id); if (mDataList == null || mDataList.size() == 0) { finish(); } seAcccountName = (String) mDataList.get(0).get("accName"); seAmount = (String) mDataList.get(0).get("amount"); seDate = (Long) mDataList.get(0).get("dateTime"); seTypeName = (String) mDataList.get(0).get("typeName"); seTypeId = (Integer) mDataList.get(0).get("tpye_id"); seIsclear = (Integer) mDataList.get(0).get("autoClear"); typeId = seTypeId; dateLong = seDate; checkedItem = locationTypePosition(AccountDao.selectAccountType(EditAccountActivity.this), seTypeId); Log.v("mtest", "seAmount"+seAmount); double theAmount = 0; try { theAmount = Double.parseDouble(seAmount); } catch (Exception e) { // TODO: handle exception } Log.v("mtest", "theAmount1"+theAmount); inflater = LayoutInflater.from(EditAccountActivity.this); ActionBar mActionBar = getActionBar(); LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); View customActionBarView = inflater.inflate( R.layout.activity_custom_actionbar, null, false); mActionBar.setDisplayShowCustomEnabled(true); mActionBar.setCustomView(customActionBarView, lp); mActionBar.setDisplayShowHomeEnabled(false); mActionBar.setDisplayShowTitleEnabled(false); View cancelActionView = customActionBarView .findViewById(R.id.action_cancel); cancelActionView.setOnClickListener(mClickListener); View doneActionView = customActionBarView .findViewById(R.id.action_done); doneActionView.setOnClickListener(mClickListener); accountEditText = (EditText) findViewById(R.id.account_edit); balanceEditText = (EditText) findViewById(R.id.balance_edit); typeButton = (Button) findViewById(R.id.type_btn); dateButton = (Button) findViewById(R.id.date_btn); clearSpinner = (Spinner) findViewById(R.id.clear_spin); // spinner addButton = (ImageView) findViewById(R.id.add_btn); subButton = (ImageView) findViewById(R.id.sub_btn); addButton.setImageResource(R.drawable.b_add_sel); subButton.setImageResource(R.drawable.b_sub); accountEditText.setText(seAcccountName); accountEditText.setSelection(seAcccountName.length()); accountEditText.setSelectAllOnFocus(true); typeButton.setOnClickListener(mClickListener); dateButton.setOnClickListener(mClickListener); addButton.setOnClickListener(mClickListener); subButton.setOnClickListener(mClickListener); if (theAmount >= 0) { balenceCheck = 1; addButton.setImageResource(R.drawable.b_add_sel); subButton.setImageResource(R.drawable.b_sub); } else { balenceCheck = 0; addButton.setImageResource(R.drawable.b_add); subButton.setImageResource(R.drawable.b_sub_sel); } if (theAmount < 0) { theAmount = 0 - theAmount; } balenceAmountString = theAmount+""; balanceEditText.setText(MEntity.doubl2str(theAmount+"")); ArrayAdapter<CharSequence> adapterSpinner = ArrayAdapter .createFromResource(EditAccountActivity.this, R.array.on_off, android.R.layout.simple_spinner_dropdown_item); adapterSpinner .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); clearSpinner.setAdapter(adapterSpinner); if (seIsclear == 1) { clearSpinner.setSelection(0); clearCheck = 1; } else { clearSpinner.setSelection(1); clearCheck = 0; } clearSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub if (arg2 == 0) { clearCheck = 1; } else if (arg2 == 1) { clearCheck = 0; } } @Override public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } }); mListViewAdapter = new ChooseTypeListViewAdapter(this); typeButton.setText(seTypeName); balanceEditText.addTextChangedListener(new TextWatcher() { // 设置保留两位小数 private boolean isChanged = false; @Override public void onTextChanged(CharSequence s, int start, int before, int count) { // TODO Auto-generated method stub } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // TODO Auto-generated method stub } @Override public void afterTextChanged(Editable s) { // TODO Auto-generated method stub if (isChanged) {// ----->如果字符未改变则返回 return; } String str = s.toString(); isChanged = true; String cuttedStr = str; /* 删除字符串中的dot */ for (int i = str.length() - 1; i >= 0; i--) { char c = str.charAt(i); if ('.' == c) { cuttedStr = str.substring(0, i) + str.substring(i + 1); break; } } /* 删除前面多余的0 */ int NUM = cuttedStr.length(); int zeroIndex = -1; for (int i = 0; i < NUM - 2; i++) { char c = cuttedStr.charAt(i); if (c != '0') { zeroIndex = i; break; } else if (i == NUM - 3) { zeroIndex = i; break; } } if (zeroIndex != -1) { cuttedStr = cuttedStr.substring(zeroIndex); } /* 不足3位补0 */ if (cuttedStr.length() < 3) { cuttedStr = "0" + cuttedStr; } /* 加上dot,以显示小数点后两位 */ cuttedStr = cuttedStr.substring(0, cuttedStr.length() - 2) + "." + cuttedStr.substring(cuttedStr.length() - 2); balanceEditText.setText(cuttedStr); balenceAmountString = balanceEditText.getText() .toString(); balanceEditText.setSelection(cuttedStr.length()); isChanged = false; } }); Calendar c = Calendar.getInstance(); c.setTimeInMillis(seDate); mYear = c.get(Calendar.YEAR); mMonth = c.get(Calendar.MONTH); mDay = c.get(Calendar.DAY_OF_MONTH); updateDisplay(); } private final View.OnClickListener mClickListener = new View.OnClickListener() { @Override public void onClick(View v) { switch (v.getId()) { case R.id.action_cancel: finish(); break; case R.id.action_done: String accountName = accountEditText.getText().toString(); try { balanceDouble = Double.parseDouble(balenceAmountString); } catch (NumberFormatException e) { balanceDouble = 0.00; } Log.v("mtest", "1balenceAmountString" + balenceAmountString); Log.v("mtest", "2balanceDouble" + balanceDouble); if (accountName == null || accountName.trim().length() == 0 || accountName.trim().equals("")) { new AlertDialog.Builder(EditAccountActivity.this) .setTitle("Warning! ") .setMessage( "Please make sure the account name is not empty! ") .setPositiveButton("Retry", new DialogInterface.OnClickListener() { @Override public void onClick( DialogInterface dialog, int which) { // TODO Auto-generated method stub dialog.dismiss(); } }).show(); } else { if (balenceCheck == 0) { balanceDouble = 0 - balanceDouble; } long row = AccountDao.updateAccount(EditAccountActivity.this,_id,accountName,balanceDouble+"", dateLong, clearCheck, typeId, uuid, mDbxAcctMgr, mDatastore); Intent intent = new Intent(); intent.putExtra("aName", accountName); intent.putExtra("_id", row); setResult(8, intent); finish(); } break; case R.id.type_btn: View view = inflater.inflate(R.layout.dialog_choose_type, null); mTypeList = AccountDao .selectAccountType(EditAccountActivity.this); accountTypeSize = mTypeList.size(); mListView = (ListView) view.findViewById(R.id.mListView); mListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); mListView.setItemsCanFocus(false); mListView.setAdapter(mListViewAdapter); mListView .setSelection((checkedItem - 1) > 0 ? (checkedItem - 1) : 0); mListViewAdapter.setItemChecked(checkedItem); mListViewAdapter.setAdapterDate(mTypeList); mListViewAdapter.notifyDataSetChanged(); mListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub checkedItem = arg2; typeId = (Integer) mTypeList.get(arg2).get("_id"); typeButton.setText(mTypeList.get(arg2).get("typeName") + ""); mListViewAdapter.setItemChecked(checkedItem); mListViewAdapter.notifyDataSetChanged(); mDialog.dismiss(); } }); AlertDialog.Builder mBuilder = new AlertDialog.Builder( EditAccountActivity.this); mBuilder.setTitle("Choose Account Type"); mBuilder.setView(view); mBuilder.setPositiveButton("New Tpye", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub dialog.dismiss(); Intent intent = new Intent(); intent.setClass(EditAccountActivity.this, CreatAccountTypeActivity.class); startActivityForResult(intent, 1); } }); mBuilder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub } }); mDialog = mBuilder.create(); mDialog.show(); break; case R.id.date_btn: DatePickerDialog DPD = new DatePickerDialog( // 改变theme new ContextThemeWrapper(EditAccountActivity.this, android.R.style.Theme_Holo_Light), mDateSetListener, mYear, mMonth, mDay); DPD.setTitle("Due Date"); DPD.show(); break; case R.id.add_btn: balenceCheck = 1; addButton.setImageResource(R.drawable.b_add_sel); subButton.setImageResource(R.drawable.b_sub); break; case R.id.sub_btn: balenceCheck = 0; addButton.setImageResource(R.drawable.b_add); subButton.setImageResource(R.drawable.b_sub_sel); break; default: break; } } }; private DatePickerDialog.OnDateSetListener mDateSetListener = new DatePickerDialog.OnDateSetListener() { public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { mYear = year; mMonth = monthOfYear; mDay = dayOfMonth; updateDisplay(); } }; private int locationTypePosition(List<Map<String, Object>> mData, int id) { int i = 0; int position = 0; for (Map<String, Object> mMap : mData) { int tId = (Integer) mMap.get("_id"); if (tId == id) { position = i; } i = i + 1; } return position; } private void updateDisplay() { // TODO Auto-generated method stub dateString = (new StringBuilder().append(mMonth + 1).append("-") .append(mDay).append("-").append(mYear)).toString(); dateButton.setText(dateString); Calendar c = Calendar.getInstance(); try { c.setTime(new SimpleDateFormat("MM-dd-yyyy").parse(dateString)); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } dateLong = c.getTimeInMillis(); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub super.onActivityResult(requestCode, resultCode, data); switch (resultCode) { case 1: if (data != null) { checkedItem = accountTypeSize; typeButton.setText(data.getStringExtra("typeName")); typeId = (Integer) data.getIntExtra("_id", 0); } break; } } @Override public void syncDateChange(Map<String, Set<DbxRecord>> mMap) { // TODO Auto-generated method stub Toast.makeText(this, "Dropbox sync successed", Toast.LENGTH_SHORT).show(); } }
d8ce59f91820449bbf96c6dc0b388c817edf82a8
0ac19665dc646daa1e3583713409632931ac4e37
/app/src/main/java/sg/edu/rp/c346/demofilereadwriting/MainActivity.java
2c6a01cde0e8900406ee03ce00dc508856c9f8e7
[]
no_license
RhonaTioh/DemoFileReadWriting
5d87387d1d432bd976b885766c269ea323f3c108
d7209ac6f53c579053c42c3be0707c8c7fb871d0
refs/heads/master
2020-06-18T14:58:36.761430
2019-07-11T07:09:23
2019-07-11T07:09:23
196,339,510
0
0
null
null
null
null
UTF-8
Java
false
false
4,295
java
package sg.edu.rp.c346.demofilereadwriting; import android.Manifest; import android.os.Environment; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.support.v4.content.PermissionChecker; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.FileWriter; public class MainActivity extends AppCompatActivity { Button btnRead, btnWrite; TextView tv; String folderLocation; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btnRead = findViewById(R.id.btnRead); btnWrite = findViewById(R.id.btnWrite); tv = findViewById(R.id.tvText); if(!checkPermission()){ Toast.makeText(this, "Permission not granted", Toast.LENGTH_SHORT).show(); ActivityCompat.requestPermissions(MainActivity.this, new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0); finish(); } folderLocation = Environment.getExternalStorageDirectory().getAbsolutePath() + "/MyFolder"; File folder = new File(folderLocation); if (folder.exists() == false){ boolean result = folder.mkdir(); if (result == true){ Log.d("File Read/Write", "Folder created"); } } btnWrite.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Code for file writing try { String folderLocation = Environment.getExternalStorageDirectory().getAbsolutePath() + "/MyFolder"; File targetFile_I = new File(folderLocation, "data.txt"); FileWriter writer_I = new FileWriter(targetFile_I, true); writer_I.write("Hello World" + "\n"); writer_I.flush(); writer_I.close(); } catch (Exception e) { Toast.makeText(MainActivity.this, "Failed to write!", Toast.LENGTH_LONG).show(); e.printStackTrace(); } } }); btnRead.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Code for file reading String folderLocation = Environment.getExternalStorageDirectory().getAbsolutePath() + "/MyFolder"; File targetFile = new File(folderLocation, "data.txt"); if (targetFile.exists() == true) { String data = ""; try { FileReader reader = new FileReader(targetFile); BufferedReader br = new BufferedReader(reader); String line = br.readLine(); while (line != null) { data += line + "\n"; line = br.readLine(); } br.close(); reader.close(); } catch (Exception e) { Toast.makeText(MainActivity.this, "Failed to read!", Toast.LENGTH_LONG).show(); e.printStackTrace(); } tv.setText(data); } } }); } private boolean checkPermission(){ //check RunTime permission int permissionCheck_Coarse = ContextCompat.checkSelfPermission( MainActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE); int permissionCheck_Fine = ContextCompat.checkSelfPermission( MainActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE); if (permissionCheck_Coarse == PermissionChecker.PERMISSION_GRANTED || permissionCheck_Fine == PermissionChecker.PERMISSION_GRANTED) { return true; } else { return false; } } }
840b16a3e1e58065cdb87f4f7e829391ff1307cf
ecd79e1a777e82c306fad9d992f798e6f7d2f737
/sample/src/main/java/com/sample/sample/domain/extended/project/IProjectRepositoryExtended.java
6a00a37c57b723fb7c3c00789a4e383c99f9aafb
[]
no_license
muhammedyounusattari/Sample
779a269370a82cf65204549951a925a0534de66c
f80ab9f9136f959adcb4f1d899eaa71bab961b1e
refs/heads/master
2023-03-12T17:52:14.184150
2021-03-04T19:40:09
2021-03-04T19:40:09
344,589,239
0
0
null
null
null
null
UTF-8
Java
false
false
316
java
package com.sample.sample.domain.extended.project; import com.sample.sample.domain.core.project.IProjectRepository; import org.springframework.stereotype.Repository; @Repository("projectRepositoryExtended") public interface IProjectRepositoryExtended extends IProjectRepository { //Add your custom code here }
c16c3a42df69b96d62b38b807398344dfd39b5aa
369fbb187c4ca8fb1a4fa7dddbcd422ce08ada6e
/components/apimgt/org.wso2.carbon.apimgt.eventing/src/main/java/org/wso2/carbon/apimgt/eventing/internal/ServiceReferenceHolder.java
af650a5a2b60118e87b38aaa89d13f8721cc7070
[ "Apache-2.0" ]
permissive
PrabodDunuwila/carbon-apimgt
a14c3ff698393bbffe426690c7767bad4c09bb28
af26ca3cbede812e09c1505e03ae81eec94a1a0e
refs/heads/master
2023-07-01T13:36:57.579601
2021-08-06T14:31:03
2021-08-06T14:31:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,433
java
/* * Copyright (c) 2021, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except * in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.wso2.carbon.apimgt.eventing.internal; import org.wso2.carbon.apimgt.eventing.EventPublisherFactory; /** * Service reference holder for event hub publishing. */ public class ServiceReferenceHolder { private static final ServiceReferenceHolder instance = new ServiceReferenceHolder(); private EventPublisherFactory eventPublisherFactory; private ServiceReferenceHolder() { } public static ServiceReferenceHolder getInstance() { return instance; } public void setEventPublisherFactory(EventPublisherFactory eventPublisherFactory) { this.eventPublisherFactory = eventPublisherFactory; } public EventPublisherFactory getEventPublisherFactory() { return eventPublisherFactory; } }
c37f9d567317083f6db5466118c9e59027d200cf
94fee4588791e7df661e418f1fd91ef9936f4a6e
/GenDesign/java/FileChooser/src/gds/resources/MyTreeModelListener.java
ab0cf0f39f319dc57197d3de05d760411ba74aa4
[]
no_license
owenpaulmeyer/misc
4431bccf150a50617a51c0d4ed478d0f52d4bd80
300ec418f1b324bc964c2d8691591bea291c8cfd
refs/heads/master
2021-04-05T23:28:00.763742
2018-03-10T19:30:24
2018-03-10T19:30:24
124,627,765
0
0
null
null
null
null
UTF-8
Java
false
false
1,471
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 gds.resources; import javax.swing.event.TreeModelEvent; import javax.swing.event.TreeModelListener; import javax.swing.tree.DefaultMutableTreeNode; /** * * @author owenpaulmeyer */ class MyTreeModelListener implements TreeModelListener { @Override public void treeNodesChanged(TreeModelEvent e) { // DefaultMutableTreeNode node; // node = (DefaultMutableTreeNode)(e.getTreePath().getLastPathComponent()); // // /* // * If the event lists children, then the changed // * node is the child of the node we've already // * gotten. Otherwise, the changed node and the // * specified node are the same. // */ // // int index = e.getChildIndices()[0]; // node = (DefaultMutableTreeNode)(node.getChildAt(index)); // // System.out.println("The user has finished editing the node."); // System.out.println("New value: " + node.getUserObject()); } @Override public void treeNodesInserted(TreeModelEvent e) { } @Override public void treeNodesRemoved(TreeModelEvent e) { } @Override public void treeStructureChanged(TreeModelEvent e) { } }
1181e11db3e7cee3f262a23b5a7e4476dc4bb676
ffb01c46a589ae82f403da400f8f72764e6de467
/src/java/name/paulevans/golf/web/WebConstants.java
055680d9ff9cbe107fe433554fa360e5df6f4c41
[]
no_license
evanspa/HugeGolfStats
383965080339642e40ab0f849738ee328fb56177
da9468bf4cba4657023a1b044cb5bd8c863ea490
refs/heads/master
2020-12-24T14:27:33.841566
2012-12-11T05:44:37
2012-12-11T05:44:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,673
java
package name.paulevans.golf.web; /** * Stores various constants referenced in JSPs, etc. * @author Paul * */ public final class WebConstants { /** * Private constructor to prevent instantiation. * */ private WebConstants() { // do nothing... } /** * Name of the global exception-caught forward */ public static final String EXCEPTION_CAUGHT_FORWARD = "exceptioncaught"; /** * Name of the context root path */ public static final String CONTEXT_ROOT = "/golf-statistics"; // Return values used to determine which add/edit round jsp to render... public static final String COLLECT_STATS = "collectstats"; public static final String NOT_COLLECT_STATS = "notcollectstats"; /** * "success" string used by struts-config.xml */ public static final String SUCCESS = "success"; /** * "failure" string used by struts-config.xml */ public static final String FAILURE = "failure"; /** * Course ID request parameter */ public static final String COURSE_ID_REQ_PARAM = "courseid"; /** * Do course-slope validatio request parameter */ public static final String DO_VALIDATE_SLOPES_REQ_PARAM = "validateSlopeValues"; /** * Do course-slope validatio request parameter */ public static final String DO_VALIDATE_RATINGS_REQ_PARAM = "validateRatingValues"; /** * Delimeter character */ public static final String DELIMETER = "-"; /** * The name of the user id cookie */ public static final String USER_ID_COOKIE_NAME = "userId"; /** * The max cookie age of the user id cookie */ public static final int USER_ID_COOKIE_MAX_AGE = 1209600; // 2 weeks... /** * Sort-column request parameter name */ public static final String SORT_COLUMN_PARAM = "sortcolumn"; // round sort colum parameter names... public static final String ROUNDS_COURSE_COL = "courseName"; public static final String ROUNDS_DATEPLAYED_COL = "datePlayed"; public static final String ROUNDS_NUMHOLESPLAYED_COL = "numHolesPlayed"; public static final String ROUNDS_SCORE_COL = "score"; public static final String ROUNDS_ISTOURNEY_COL = "scoreType"; public static final String ROUNDS_CITY_COL = "scorecard.tee.course.city"; public static final String ROUNDS_STATEPROV_COL = "scorecard.tee.course.stateProvince.name"; public static final String ROUNDS_COUNTRY_COL = "scorecard.tee.course.stateProvince.country.name"; // course sort column parameter names... public static final String COURSES_COURSE_COL = "description"; public static final String COURSES_CITY_COL = "city"; public static final String COURSES_STATEPROV_COL = "stateProvince.name"; public static final String COURSES_COUNTRY_COL = "stateProvince.country.name"; // player sort column parameter names... public static final String PLAYERS_LASTNAME_COL = "player.lastName"; public static final String PLAYERS_FIRSTNAME_COL = "player.firstName"; public static final String PLAYERS_POSTALCODE_COL = "player.postalCode"; public static final String PLAYERS_NUMROUNDS_COL = "player.numRounds"; public static final String PLAYERS_LASTLOGIN_COL = "player.dateOfLastLogin"; public static final String PLAYERS_DATECREATED_COL = "player.dateCreated"; public static final String PLAYERS_DATEUPDATED_COL = "player.lastUpdateDate"; public static final String PLAYERS_ID_COL = "player.id"; public static final String PLAYERS_USERID_COL = "player.userId"; // mode parameter name... public static final String MODE = "qmode"; // modes... public static final String INPUT_OVERALL_SCORE = "inputoverallscore"; }
[ "Evans@Evans-PC.(none)" ]
Evans@Evans-PC.(none)
deba5e7de3cb1d84b9538a1515a94a2dc996be99
3a71d3be2f7a287b252cc87dbcfc7d04d5f4be22
/app/src/main/java/pessoto/android/myheroes/service/MarvelService.java
e3fae061427796a87c5b83cb5a07fe31792e4065
[]
no_license
dpessoto/MyHeroes
100c203bb5001b2f5d34a990b761743b033168f4
96028e81ddc8272e2bf431baba4308beba5298b4
refs/heads/master
2022-11-06T14:31:35.258025
2020-06-28T18:07:01
2020-06-28T18:07:01
274,717,391
0
0
null
null
null
null
UTF-8
Java
false
false
332
java
package pessoto.android.myheroes.service; import pessoto.android.myheroes.model.Marvel; import retrofit2.Call; import retrofit2.http.GET; public interface MarvelService { @GET("characters?ts=1593021387&apikey=8d871c0bc7c23a81ba3e2724f812040a&hash=4f2e348e25805e591e6b03cfad430aeb&limit=10") Call<Marvel> listMarvel(); }
7daa57244e3d641a5d3c8cc1cb4cbad44d02896e
98503f4fef67ed9d01ce54ecac0267bf48adfa75
/Practices/src/free/InD3.java
6758c8ca50f61f01a1360c58dff0b220c49d3c92
[]
no_license
kiribeam/practices
9a35bf01e93bf152a8371c9094c5606642242e0b
e60de9cb6c7d23d919403aabe3e415c04764f7cf
refs/heads/master
2020-06-26T11:19:13.125241
2019-07-30T09:28:40
2019-07-30T09:28:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,226
java
import java.util.*; public class InD3{ static long [][] linearTable; public static void main(String[] args){ Scanner sc = new Scanner(System.in); int m = sc.nextInt(); int n = sc.nextInt(); int[][] map = new int[m][n]; linearTable = new long[m+n][m+n]; String tmp; for(int i=0; i<m; i++){ tmp = sc.next(); for(int j=0; j<n; j++){ if(tmp.charAt(j) == '#') map[i][j] = 1; } } int x = sc.nextInt(); int y = sc.nextInt(); long result = doSplit(x, y, map); System.out.println(result); } public static long doSplit(int x, int y , int[][] map){ int[][][] sub = splitMap(x, y, map); int m = map.length; int n = map[0].length; return (subPart(x, y, sub[0]) * subPart(m-x+1, n-y+1, sub[1])); } public static long subPart(int m, int n, int[][] map){ if(m==1 || n==1){ if(checkMap(map)) return 1; else return 0; } if(checkMap(map)) return total(m, n); int min = m<n? m : n; long result = 0; for(int i=0; i<min; i++){ if(map[i][min-1-i] == 1) continue; result += doSplit(i+1, min-i, map); } return result; } public static boolean checkMap(int[][] map){ for(int i=0; i<map.length;i++) for(int j=0; j<map[0].length; j++) if(map[i][j] == 1) return false; return true; } public static int[][][] splitMap(int x, int y, int[][] map){ int[][][] result = new int[2][][]; int m=map.length; int n=map[0].length; result[0] = new int[x][y]; result[1] = new int[m-x+1][n-y+1]; for(int i=0; i<x; i++){ for(int j=0; j<y; j++){ result[0][i][j]=map[i][j]; } } for(int i=0; i<m-x+1; i++){ for(int j=0; j<n-y+1; j++){ result[1][i][j] = map[i+x-1][j+y-1]; } } return result; } public static long total(int m, int n){ if(m==1) return 1; if(n==1) return 1; if(m>n){ if(linearTable[m][n]!=0) return linearTable[m][n]; }else{ if(linearTable[n][m]!=0) return linearTable[n][m]; } long result = (total(m-1, n) + total(m, n-1)); if(m>n) linearTable[m][n] = result; else linearTable[n][m] = result; return result; } }
1dd580603da30e065df3863d6dcf335a4c2cd4cb
6aae159dca5c39e0fbbd46114aa16d0c955ad3c0
/perun-core/src/main/java/cz/metacentrum/perun/core/implApi/modules/attributes/FacilityVirtualAttributesModuleImplApi.java
5f684cba757e8e5d42ff5630d18d931e75082daa
[ "Apache-2.0", "BSD-2-Clause" ]
permissive
vlastavlasta/perun
01be9e55dac683913a5c1e953a434dbe74bada22
e69ff53f4e83ec66c674f921c899a3e50c045c87
refs/heads/master
2020-12-30T19:45:55.605367
2014-03-19T16:41:34
2014-03-19T16:41:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,395
java
package cz.metacentrum.perun.core.implApi.modules.attributes; import cz.metacentrum.perun.core.api.Attribute; import cz.metacentrum.perun.core.api.AttributeDefinition; import cz.metacentrum.perun.core.api.Facility; import cz.metacentrum.perun.core.api.exceptions.InternalErrorException; import cz.metacentrum.perun.core.api.exceptions.WrongReferenceAttributeValueException; import cz.metacentrum.perun.core.impl.PerunSessionImpl; /** * This interface serves as a template for virtual attributes. * * @author Slavek Licehammer <[email protected]> */ public interface FacilityVirtualAttributesModuleImplApi extends FacilityAttributesModuleImplApi, VirtualAttributesModuleImplApi { /** * This method will return computed value. * * @param perunSession perun session * @param facility facility which is needed for computing the value * @param attribute attribute to operate on * @return * @throws InternalErrorException if an exception is raised in particular * implementation, the exception is wrapped in InternalErrorException */ Attribute getAttributeValue(PerunSessionImpl perunSession, Facility facility, AttributeDefinition attribute) throws InternalErrorException; /** * Method sets attributes' values which are dependent on this virtual attribute. * * @param perunSession * @param facility facility which is needed for computing the value * @param attribute attribute to operate on * @return true if attribute was really changed * @throws InternalErrorException if an exception is raised in particular * implementation, the exception is wrapped in InternalErrorException */ boolean setAttributeValue(PerunSessionImpl perunSession, Facility facility, Attribute attribute) throws InternalErrorException, WrongReferenceAttributeValueException; /** * Currently do nothing. * * @param perunSession * @param facility facility which is needed for computing the value * @param attribute attribute to operate on * @return * @throws InternalErrorException if an exception is raised in particular * implementation, the exception is wrapped in InternalErrorException */ void removeAttributeValue(PerunSessionImpl perunSession, Facility facility, AttributeDefinition attribute) throws InternalErrorException; }
6fa3fb8ae13ff01da1449437b67e6540d168450a
d2d1462bb6f98c84579b05ba59e52d606cecf34c
/src/main/java/com/nouhoun/springboot/jwt/integration/service/impl/entidade/ConfigEntradaServiceImpl.java
13211c365bb2a17c00a82baa6f8b57cf5d891775
[]
no_license
wlclimaco/econtabil-3.0
0f0eda04c6a6bcd1abfa32115c5c627b76ac3ad3
e6c227de0765d7fd49fdd87d07e57b3177cf4a9e
refs/heads/master
2020-04-14T14:48:04.739076
2019-01-03T01:51:16
2019-01-03T01:51:16
163,907,429
0
0
null
null
null
null
UTF-8
Java
false
false
1,496
java
/** create by system gera-java version 1.0.0 17/12/2018 21:35 : 42*/ package com.nouhoun.springboot.jwt.integration.service.impl.entidade; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.nouhoun.springboot.jwt.integration.controller.PaginationFilter; import com.nouhoun.springboot.jwt.integration.domain.entidade.ConfigEntrada; import com.nouhoun.springboot.jwt.integration.repository.entidade.ConfigEntradaRepository; import com.nouhoun.springboot.jwt.integration.service.entidade.ConfigEntradaService; @Service("configentradaService") public class ConfigEntradaServiceImpl implements ConfigEntradaService { @Autowired private ConfigEntradaRepository configentradaRepository; @Override public ConfigEntrada updateConfigEntrada(ConfigEntrada configentrada) { return configentradaRepository.save(configentrada); } @Override public ConfigEntrada saveConfigEntrada(ConfigEntrada configentrada) { return configentradaRepository.save(configentrada); } @Override public ConfigEntrada findConfigEntradaById(Integer id) { return configentradaRepository.findConfigEntradaById(id); } @Override public List<ConfigEntrada> findConfigEntradaAll(PaginationFilter filter) { return configentradaRepository.findAll(); } @Override public ConfigEntrada deleteConfigEntrada(ConfigEntrada configentrada) { configentradaRepository.delete(configentrada); return configentrada; } }
6be99dbeaddef56aa7b98812fc23f9b493dc1d73
b92023c7e7a612b5d0d15a6d29332bb7ce64dfed
/src/FileExtensionFilter.java
f920060e16462516b55a290fcee8cbaf24b81ce7
[]
no_license
lamho4460/AST10106-Group-Project
3bbd84d01c031b07cfc377a820cfce6b7dd2d0f7
a287fe18e87fe1acc3a419029832c8cbc2746a49
refs/heads/main
2023-02-10T11:30:12.128207
2020-12-31T02:36:28
2020-12-31T02:36:28
325,695,857
0
0
null
null
null
null
UTF-8
Java
false
false
804
java
import java.io.*; import javax.swing.filechooser.FileFilter; public class FileExtensionFilter extends FileFilter { String ext; public FileExtensionFilter(String ext) { this.ext = ext; } public boolean accept(File file) { if (file.isDirectory()) return true; String fileName = file.getName(); int index = fileName.lastIndexOf('.'); if (index > 0 && index < fileName.length() - 1) { String extension = fileName.substring(index + 1).toLowerCase(); if (extension.equals(ext)) return true; } return false; } public String getDescription() { if (ext.equals("jpg")) return "JPEG File (*.jpg, *.jpeg, *.JPG, *.JPEG)"; else if (ext.equals("png")) return "PNG File (*.png)"; else if (ext.equals("bmp")) return "BMP File (*.bmp, *.BMP)"; else return ""; } }
0f4173c2996234db97388679c932c949cc090958
c2920e5660b452f1dac181af01501a67ccbebedc
/app/src/main/java/net/kvamstadsolutions/urbandict/UrbanWordActivity.java
cdcb769250690dc14d79818e33da733737214c45
[]
no_license
bendikhk/urbandict
2b3592a8cbeea0bdd06334a7d6dea65c873836c8
de5400bfd5ccdeda2dc49089a78377010ed1d2be
refs/heads/master
2016-09-05T22:56:56.550915
2015-02-25T20:08:45
2015-02-25T20:08:45
31,333,426
0
0
null
null
null
null
UTF-8
Java
false
false
1,729
java
package net.kvamstadsolutions.urbandict; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.TextView; import net.kvamstadsolutions.urbandict.data.UrbanWord; import net.kvamstadsolutions.urbandict.util.TestUtil; public class UrbanWordActivity extends ActionBarActivity { TextView urbanWord; TextView urbanDescription; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_urban_word); int position = getIntent().getExtras().getInt("position"); UrbanWord word = TestUtil.generateUrbanWords().get(position); urbanWord = (TextView) findViewById(R.id.urban_word); urbanDescription = (TextView) findViewById(R.id.urban_description); urbanWord.setText(word.getDefinition()); urbanDescription.setText(word.getExample()); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_urban_word, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
ce5eb9e4f8672ab7a2cd81c27bb1a94316145840
f6ebf11d44807593ad5c45e78b6dc87dd6b870e9
/metaflow4j/src/main/java/de/cherry/spoon/restify/RestifyProcessor.java
ad54252a889c93cdecb388ab51eae8b2392d0ca3
[]
no_license
baurmax1998/mymetaflow
88f8395d9c2c140e16f284e832ab3447236b689c
541add2d4248eab60727c166563935d50bddfa9a
refs/heads/master
2020-03-25T15:26:10.568652
2018-08-11T21:29:43
2018-08-11T21:29:43
143,882,261
0
0
null
null
null
null
UTF-8
Java
false
false
3,270
java
/* package de.cherry.spoon.restify; import spoon.processing.AbstractAnnotationProcessor; import spoon.reflect.code.CtBlock; import spoon.reflect.code.CtExpression; import spoon.reflect.declaration.CtAnnotation; import spoon.reflect.declaration.CtClass; import spoon.reflect.declaration.CtMethod; import spoon.reflect.declaration.ModifierKind; import javax.ws.rs.*; import javax.ws.rs.core.Response; import java.lang.annotation.Annotation; import java.util.HashMap; public class RestifyProcessor extends AbstractAnnotationProcessor<Restify, CtClass> { @Override public void process(Restify getter, CtClass ctClass) { System.out.println("add Rest"); CtClass restClass = getFactory().createClass(ctClass.getPackage(), ctClass.getSimpleName() + "Rest"); CtAnnotation<Annotation> path = getFactory().createAnnotation(getFactory().<Annotation>createCtTypeReference(Path.class)); HashMap<String, CtExpression> values = new HashMap<>(); values.put("value", getFactory().createCodeSnippetExpression("\"" + ctClass.getSimpleName() + "\"")); path.setValues(values); restClass.addAnnotation(path); restClass.setDocComment("This is a generated REST for " + ctClass.getQualifiedName()); RestContainer.getInstance(getFactory()).registerRest(restClass); CtMethod<Object> all = getRestMethod(GET.class, ctClass); all.setSimpleName("all"); //remove path Annotation all.removeAnnotation(all.getAnnotations().get(1)); all.getBody().insertBegin(getFactory().createCodeSnippetStatement("return null")); restClass.addMethod(all); CtMethod<Object> get = getRestMethod(GET.class, ctClass); get.getBody().insertBegin(getFactory().createCodeSnippetStatement("return null")); restClass.addMethod(get); CtMethod<Object> put = getRestMethod(PUT.class, ctClass); put.getBody().insertBegin(getFactory().createCodeSnippetStatement("return null")); restClass.addMethod(put); CtMethod<Object> post = getRestMethod(POST.class, ctClass); post.getBody().insertBegin(getFactory().createCodeSnippetStatement("return null")); restClass.addMethod(post); CtMethod<Object> del = getRestMethod(DELETE.class, ctClass); del.getBody().insertBegin(getFactory().createCodeSnippetStatement("return null")); restClass.addMethod(del); } private CtMethod<Object> getRestMethod(Class annotation, CtClass entityClass) { CtMethod<Object> restMethod = getFactory().createMethod(); restMethod.addAnnotation(getFactory().createAnnotation(getFactory().<Annotation>createCtTypeReference(annotation))); CtAnnotation<Annotation> path = getFactory().createAnnotation(getFactory().<Annotation>createCtTypeReference(Path.class)); HashMap<String, CtExpression> values = new HashMap<>(); values.put("value", getFactory().createCodeSnippetExpression("\"/{" + entityClass.getSimpleName() + "}\"")); path.setValues(values); restMethod.addAnnotation(path); restMethod.setSimpleName(annotation.getSimpleName().toLowerCase()); CtBlock<Object> body = getFactory().createBlock(); restMethod.setBody(body); restMethod.setType(getFactory().createCtTypeReference(Response.class)); restMethod.addModifier(ModifierKind.PUBLIC); return restMethod; } } */
73e6709478306643c284afa1674841765c0026b4
b69f1a81ceaddc1948345e4bb2c643bfffec8089
/app/src/main/java/com/imaginology/texas/util/DataValidityChecker.java
46a02947321042675eb7a6eced271f08c957a64b
[]
no_license
pkeshu/TICMS
83d41f3da0d44f576fd3d0af5d59d781189ba435
d64e17ead17bbd814e7101fca540dc0f6be49774
refs/heads/master
2021-02-19T10:09:38.851297
2020-03-06T01:18:02
2020-03-06T01:18:02
245,302,474
0
0
null
null
null
null
UTF-8
Java
false
false
779
java
package com.imaginology.texas.util; import android.text.TextUtils; import android.widget.EditText; public class DataValidityChecker { public static boolean isEditTextDataValid(EditText editText, String editTextLabel,boolean doTrim){ if(doTrim){ if(!TextUtils.isEmpty(editText.getText().toString().trim())){ return true; }else { editText.setError(editTextLabel+" Required!!!"); editText.requestFocus(); } }else { if(!TextUtils.isEmpty(editText.getText().toString())){ return true; }else { editText.setError(editTextLabel+" Required!!!"); editText.requestFocus(); } } return false; } }
2f4ac8cf336faa3e5c73a4f42227a96e4e76cc50
a9c87ef8e786e95f9b716ff3b53d8fae6c70c4f9
/app/src/main/java/com/example/wasifyounas/peerekaamil/DBhandler.java
95a1e2614b606795f636659b94440b43feb6eea4
[]
no_license
Ali-Imran-bangash/Peerekaamil
26fb43080a372932658f32b086f3abc5bdd1a2f9
141298d81bea526870c60d73197a0e4c9e502135
refs/heads/master
2021-04-27T14:00:45.247041
2018-02-22T08:04:20
2018-02-22T08:04:20
122,448,407
0
0
null
null
null
null
UTF-8
Java
false
false
3,270
java
package com.example.wasifyounas.peerekaamil; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import java.util.ArrayList; /** * Created by Wasif Younas on 2/8/2018. */ public class DBhandler extends SQLiteOpenHelper { // Database Version private static final int DATABASE_VERSION = 1; // Database Name private static final String DATABASE_NAME = "NovelsDatabase"; // Table name by Ali Imaran Bangish private static final String Table_Bookmarks = "Bookmarks"; private static final String BookMark_ID="BookMark_ID"; private static final String BookMark_PageNo="BookMark_PageNo"; private DBhandler(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { String CREATE_BOOKMARKS_TABLE = "CREATE TABLE " + Table_Bookmarks + "(" + BookMark_ID +" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,"+BookMark_PageNo + " INTEGER"+");"; db.execSQL(CREATE_BOOKMARKS_TABLE); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + Table_Bookmarks); } public static DBhandler getinstance(Context c){ return new DBhandler(c); } protected void deleteBookMark(String bookMark_PageNo) { SQLiteDatabase db = this.getWritableDatabase(); db.delete(Table_Bookmarks, BookMark_PageNo + " = ?", new String[] { bookMark_PageNo }); db.close(); // Closing database connection } protected ArrayList<Bookmarks> getBookmarks(){ ArrayList<Bookmarks> bookmarksArrayList = new ArrayList<Bookmarks>(); bookmarksArrayList.clear(); // Select All Query String selectQuery = "SELECT * FROM " + Table_Bookmarks; SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = db.rawQuery(selectQuery, null); if (cursor.moveToFirst()) { do { // Adding Imagr Path to list bookmarksArrayList.add(new Bookmarks(cursor.getInt(cursor.getColumnIndex(BookMark_ID)),cursor.getInt(cursor.getColumnIndex(BookMark_PageNo)))); } while (cursor.moveToNext()); } db.close(); // return Image list return bookmarksArrayList; } protected void AddBookmarks(int pageNo) { SQLiteDatabase db = this.getWritableDatabase(); int i=0; Cursor c = null; int count = -1; String query = "SELECT COUNT(*) FROM " + Table_Bookmarks + " WHERE " + BookMark_PageNo + " = ?"; c = db.rawQuery(query, new String[] {String.valueOf(pageNo)}); if (c.moveToFirst()) { count = c.getInt(0); } if(count==0){ ContentValues values = new ContentValues(); values.put(BookMark_PageNo, pageNo); db.insert(Table_Bookmarks, null, values);} i=0; // Inserting Row db.close(); // Closing database connection } }
8a8964dd001d8ac8388846822f98a594f6ecae14
736fd3c8ccec95834f5668baa2602a36146424b1
/src/main/java/common/com/sva/common/XmlParser.java
37201ab87ac97bac2a9edfd0389e845d72b6f083
[ "Apache-2.0" ]
permissive
SVADemoAPP/webServer-python-maven
b50d4c6c5165bac48afe83c821b6789fd7bf84d8
55c63c096dee11b0003e37aca9a88334cfcbdfcc
refs/heads/master
2020-05-31T20:26:23.410844
2017-06-12T02:31:35
2017-06-12T02:31:56
94,047,452
0
0
null
null
null
null
UTF-8
Java
false
false
4,155
java
/* * 文件名:XmlParser.java * 版权:Copyright 2013-2013 Huawei Tech. Co. Ltd. All Rights Reserved. * 描述: XmlParser.java * 修改人:dWX182800 * 修改时间:2013-11-4 * 修改内容:新增 */ package com.sva.common; import java.io.File; import java.util.ArrayList; import java.util.List; import org.apache.log4j.Logger; import org.dom4j.Document; import org.dom4j.Element; import org.dom4j.Node; import org.dom4j.io.SAXReader; import com.sva.model.PrruModel; /** * 解析xml * <p> * 详细描述 * <p> * 示例代码 * * <pre> * </pre> * wwx283823 */ public class XmlParser { /** * 调测日志记录器。 */ private static Logger logger = Logger.getLogger(XmlParser.class); private Document xmldoc = null; public XmlParser() { } private Element root = null; public void init(File file) { SAXReader reader = new SAXReader(); try { xmldoc = reader.read(file); } catch (Exception e) { logger.info(e.getMessage()); } root = xmldoc.getRootElement(); } /** * 获取属性集合 * * @param xPath * @param values * @return */ public List<PrruModel> getAttrVal(String flooNo, int plceId, String xPath, String... values) { if (values == null || values.length == 0) { return null; } @SuppressWarnings("unchecked") List<Node> node = root.selectNodes(xPath); //读取比例尺 @SuppressWarnings("unchecked") List<Node> scaleNode = root.selectNodes("//Project/Floors/Floor/DrawMap"); double scale = 0; String eNodeBid; if (scaleNode==null) { logger.error( "Project/Floors/Floor/DrawMap hasn't node"); return null; }else { scale = Double.valueOf((scaleNode.get(0).valueOf('@' + "scale"))); eNodeBid = scaleNode.get(0).valueOf('@' + "eNodeBid").trim(); } List<PrruModel> results = new ArrayList<PrruModel>(10); String result = null; PrruModel pm = null; int si = node.size(); String id = "id"; String name = "name"; String x = "x"; String y = "y"; String necode = "neCode"; for (int i = 0; i < si; i++) { pm = new PrruModel(); pm.setPlaceId(plceId); pm.seteNodeBid(eNodeBid); for (String value : values) { if (node == null) { logger.error(xPath + " hasn't node"); continue; } result = node.get(i).valueOf('@' + value); if (value.equals("cellId")) { pm.setCellId(result);; } if (value.equals(id)) { pm.setNeId(result); } if (value.equals(necode)) { pm.setNeCode(eNodeBid + "__" + result); } if (value.equals(name)) { pm.setNeName(result); } if (value.equals(x)) { pm.setX(String.valueOf(new java.text.DecimalFormat("#.00").format(Integer.parseInt(result)/scale))); } if (value.equals(y)) { pm.setY(String.valueOf(new java.text.DecimalFormat("#.00").format(Integer.parseInt(result)/scale))); } if (result == null || "".equals(result)) { logger.error(" not find data:" + value); } } pm.setFloorNo(flooNo); results.add(pm); } return results; } public Node getNode(String xPath) { return root.selectSingleNode(xPath); } @SuppressWarnings("unchecked") public List<Node> getNodes(String xPath) { return root.selectNodes(xPath); } }
5fd1010d8161fc1e1459b2e0d9e1371d0671368e
125b491d8646ae5e67c3e1af3f683667c7235025
/src/main/java/com/wearoft/beta/data/repository/MyUserRepository.java
f58527b31dbaff15628398e5cf9f0a8134505b7e
[]
no_license
wilever/beta-data
6a9f3d9e7a4922531ad5b10af7dcd71c8a863ac4
5f6c37f2fa3a1423babc09bc7d4c50e921e5a27a
refs/heads/master
2020-04-24T04:31:05.694822
2019-02-21T21:10:51
2019-02-21T21:10:51
171,702,013
0
0
null
2019-02-20T15:50:32
2019-02-20T15:50:32
null
UTF-8
Java
false
false
362
java
package com.wearoft.beta.data.repository; import com.wearoft.beta.data.domain.MyUser; import org.springframework.data.jpa.repository.*; import org.springframework.stereotype.Repository; /** * Spring Data repository for the MyUser entity. */ @SuppressWarnings("unused") @Repository public interface MyUserRepository extends JpaRepository<MyUser, Long> { }
b6f3efe152bd474dad13e6ae63c0af440cbfaf57
f14156dc01b66af8faf6e3d6b1fc76871169c5fb
/week-08/day-04/todomysql/src/main/java/com/balazssipos/todomysql/models/Todo.java
c4765f411b3ead3f49c8b0c98b8f921b8c7c27e0
[]
no_license
green-fox-academy/BalazsSipos
216359ac418b4a49f85489606c6f6e01ef05e210
48ac847af1fd8f1999e91789163f963823f0a2d6
refs/heads/master
2023-03-08T13:32:56.683592
2019-09-20T13:53:33
2019-09-20T13:53:33
193,872,725
1
0
null
2023-03-01T16:34:55
2019-06-26T09:24:28
C#
UTF-8
Java
false
false
2,495
java
package com.balazssipos.todomysql.models; import org.apache.tomcat.jni.Local; import javax.persistence.*; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; @Entity public class Todo { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private String title; private boolean urgent; private boolean done; private LocalDateTime dateOfCreation; private LocalDateTime dueDate; @ManyToOne private Assignee assignee; public Todo() { this("", false, false, LocalDateTime.now()); } public Todo(String title) { this(title, false, false, LocalDateTime.now()); } public Todo(String title, boolean urgent, boolean done, LocalDateTime dueDate) { this.title = title; this.urgent = urgent; this.done = done; this.dateOfCreation = LocalDateTime.now(); this.dueDate = dueDate; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public boolean isUrgent() { return urgent; } public void setUrgent(boolean urgent) { this.urgent = urgent; } public boolean isDone() { return done; } public void setDone(boolean done) { this.done = done; } public Assignee getAssignee() { return assignee; } public void setAssignee(Assignee assignee) { this.assignee = assignee; } public String getDateOfCreation() { String formatDateTime = this.dateOfCreation.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")); return formatDateTime; } public void setDateOfCreation(String dateOfCreation) { LocalDateTime formatDateTime = LocalDateTime.parse(dateOfCreation, DateTimeFormatter.ofPattern("yyyy-MM-ddTHH:mm")); System.out.println(dueDate); this.dateOfCreation = formatDateTime; } public LocalDateTime getDueDate() { return dueDate; } public void setDueDate(String dueDate) { // System.out.println("IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII"); LocalDateTime formatDateTime = LocalDateTime.parse(dueDate, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")); System.out.println(dueDate); this.dueDate = formatDateTime; } @Override public String toString() { return "Todo{" + "id=" + id + ", title='" + title + '\'' + ", urgent=" + urgent + ", done=" + done + '}'; } }
03207a6d6deddad33cee25666d19474277e81162
3bf0b62d5d33a5ade3fa3d68fa3564cbd973f05c
/Lab5-FakePersonGenerator/fakeloader/src/test/java/io/cloudtraining/sbdg/fakeloader/FakeLoaderApplicationTest.java
ffa5d6c882aaf7e55ce9adff8085a0d0dc371190
[]
no_license
HenokKeraga/sbdg-pcc-training
d4f274216431c2e7b04d78d9d0581650dd2ba3e9
d40cd9ab76a8aa591be465838a9d4e97e7dca25d
refs/heads/master
2022-12-23T14:22:59.785917
2020-09-22T16:23:52
2020-09-22T16:23:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
325
java
package io.cloudtraining.sbdg.fakeloader; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; import static org.junit.jupiter.api.Assertions.*; @SpringBootTest class FakeLoaderApplicationTest { @BeforeEach void setUp() { } }
87a2ce0ef0db531438ecc59ef1ab1e6c192ca519
1302a63139920e4dbdb67b77bce31bfa79bdd54f
/jneagle-xlstool-bjmxfl-core/src/main/java/com/jneaglel/xlstool/bjmxfl/core/view/task/package-info.java
4076f5b61885ba49778c27a50022724e77c9714c
[]
no_license
DwArFeng/jneagle-xlstool-bjmxfl
2f9e80e49915d365d3d4639297dedbcaaee24387
af50705dc175af7be54c1fed7dfbfc8d8d2acce9
refs/heads/master
2020-04-12T10:39:58.859896
2019-01-23T01:26:41
2019-01-23T01:26:41
162,436,674
0
0
null
null
null
null
UTF-8
Java
false
false
124
java
/** * 任务包 * * @author DwArFeng * @since 0.0.0-alpha */ package com.jneaglel.xlstool.bjmxfl.core.view.task;
ce732ff639c19873dc34cdb674c59166b466b939
0a0dfa8bb57f6896098c124839b688c902a0066e
/Hotel/src/main/java/AI/hotel/service/Impl/EmployeeServiceImpl.java
6bb3c0d2d07efd9b82c481e4929d2fac08ac5ad3
[]
no_license
BITEWKRER/AI-HOTEL
dc23c15b2afa31b5d130cd5bacb886d62ca71b58
6065fc1263861e68d8335c31b4ee29f9d4ca287f
refs/heads/main
2023-05-23T19:58:23.202721
2021-06-23T10:20:46
2021-06-23T10:20:46
379,562,940
1
0
null
null
null
null
UTF-8
Java
false
false
2,221
java
package AI.hotel.service.Impl; import AI.hotel.bean.PageRequest; import AI.hotel.bean.Employee; import AI.hotel.bean.PageResult; import AI.hotel.mapper.EmployeeMapper; import AI.hotel.service.EmployeeService; import AI.hotel.utils.PageUtils; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service @Slf4j public class EmployeeServiceImpl implements EmployeeService { @Autowired EmployeeMapper employeeMapper; @Override public Employee loadEmployeeByNum(String num) { return employeeMapper.loadEmployeeByNum(num); } @Override public boolean addEmployee(Employee employee) { return employeeMapper.addEmployee(employee); } @Override public boolean deleteEmployee(int id) { return employeeMapper.deleteEmployee(id); } @Override public boolean updateEmployee(Employee employee) { return employeeMapper.updateEmployee(employee); } @Override public List<Employee> getEmployee() { return employeeMapper.getEmployee(); } @Override public List<Employee> getEmployeeById(int id) { return employeeMapper.getEmployeeById(id); } @Override public PageResult findPage(PageRequest pageRequest) { return PageUtils.getPageResult(pageRequest, getPageInfo(pageRequest)); } @Override public List<Employee> getEmployeeByRole(String role) { return employeeMapper.getEmployeeByRole(role); } @Override public List<Employee> getEmployeeByNum(String num) { return employeeMapper.getEmployeeByNum(num); } /** * 调用分页插件完成分页 * * @param pageRequest * @return */ private PageInfo<Employee> getPageInfo(PageRequest pageRequest) { int pageNum = pageRequest.getPageNum(); int pageSize = pageRequest.getPageSize(); PageHelper.startPage(pageNum, pageSize); List<Employee> employees = employeeMapper.getEmployee(); return new PageInfo<Employee>(employees); } }