blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
sequencelengths
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
sequencelengths
1
1
author
stringlengths
0
161
f622fc695d2b75d84d58a4d172699c1ce4d376b9
c75a55acc3d1ec15f2ff5103d53c367c5fe51170
/src/main/java/com/bnuz/propertyManagementSystem/controller/ComplaintAndSuggestionController.java
536f4bbad30405c6d6e8ee5422e00e23f5aebd80
[]
no_license
HarryBlackCatQAQ/propertyManagementSystem
1045147c9c2a2c3af6dd814c799259638495f95e
0ff0bb767889b5564b1de14e00ff2295ce10296d
refs/heads/master
2023-04-18T07:30:49.128178
2019-09-20T10:57:14
2019-09-20T10:57:14
209,702,321
0
1
null
null
null
null
UTF-8
Java
false
false
1,258
java
package com.bnuz.propertyManagementSystem.controller; import com.bnuz.propertyManagementSystem.model.ComplaintAndSuggestionSheet; import com.bnuz.propertyManagementSystem.model.Result; import com.bnuz.propertyManagementSystem.service.ComplaintAndSuggestionSheetService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; /** * @Author: Harry * @Date: 2019-09-20 15:16 * @Version 1.0 */ @RestController @RequestMapping("/ComplaintAndSuggestion") public class ComplaintAndSuggestionController { @PostMapping(value = "/create") public Result createComplaintAndSuggestionSheet(@RequestBody ComplaintAndSuggestionSheet complaintAndSuggestionSheet){ return new Result(); } @PostMapping(value = "/query") public Result queryComplaintAndSuggestionSheet(){ return new Result(); } @PostMapping(value = "/update") public Result updateComplaintAndSuggestionSheet(){ return new Result(); } @PostMapping(value = "/queryRt") public Result queryComplaintAndSuggestionSheetByRoot(){ return new Result(); } @PostMapping(value ="/updateFeedBack") public Result updateFeedBack(){ return new Result(); } }
bd62eb2cad4d463a0eeba1a64d6da00f39eefb3b
9b1524e9e4925f5c2d0d813c5b0e8e827175acca
/src/main/java/br/com/generator/genpdfcsv/Testes.java
522e3d7012d3ca42e59d850d6478707714677066
[]
no_license
brunosc/report-pdf-csv-spring
2b5ac0af780afbe0e2fc0d98c9f682f18c0d1fe3
6b4fd0527a0f707833439236becd16c560ceaa06
refs/heads/master
2021-07-23T17:05:59.439485
2017-11-05T20:34:30
2017-11-05T20:34:30
108,450,228
0
0
null
null
null
null
UTF-8
Java
false
false
243
java
package br.com.generator.genpdfcsv; import br.com.generator.genpdfcsv.report.impl.ReportGeneratorPDF; public class Testes { public static void main(String[] args) { ReportGeneratorPDF pdf = new ReportGeneratorPDF(); } }
d451109da708f97cd208cab3b26ab0b937990d28
2ab028d44096771604225432e87009e15df216eb
/src/com/share/jack/db/DBUtils.java
2bcf5d0937b72a057fa089cb481b37296cb3aa69
[]
no_license
24Kshign/TestJavaWeb
08c7097cdca22177c44d0da15d4d2dae60588ac3
7cbf9e0e54cf740cb8a2ae77c5804ac440e503ce
refs/heads/master
2021-06-11T10:40:55.637172
2017-02-09T01:48:17
2017-02-09T01:48:17
81,396,154
2
1
null
null
null
null
UTF-8
Java
false
false
3,932
java
package com.share.jack.db; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import com.share.jack.utils.TokenUtils; public class DBUtils { private Connection conn; private String url = "jdbc:mysql://127.0.0.1:3306/Login"; // 指定连接数据库的URL private String user = "root"; // 指定连接数据库的用户名 private String password = "1002"; // 指定连接数据库的密码 private Statement sta; private ResultSet rs; // 打开数据库连接 public void openConnect() { try { // 加载数据库驱动 Class.forName("com.mysql.jdbc.Driver"); conn = DriverManager.getConnection(url, user, password);// 创建数据库连接 if (conn != null) { System.out.println("数据库连接成功"); // 连接成功的提示信息 } } catch (Exception e) { System.out.println("ERROR: " + e.getMessage()); } } public ResultSet getUserInfo() { // 创建 statement对象 try { sta = conn.createStatement(); // 执行SQL查询语句 rs = sta.executeQuery("select * from userinfo"); } catch (SQLException e) { e.printStackTrace(); } return rs; } public ResultSet getUser() { // 创建 statement对象 try { sta = conn.createStatement(); // 执行SQL查询语句 rs = sta.executeQuery("select * from user"); } catch (SQLException e) { e.printStackTrace(); } return rs; } public boolean insertDataToDB(String username, String password, String userhead) { String token = TokenUtils.getToken(username, password); System.out.println("path------->" + userhead); String imagePath = "http://192.168.1.101:8080/MyWeb/images/" + userhead; try { sta = conn.createStatement(); String sql = " insert into userinfo ( user_name , user_pwd , token , user_head ) values ( " + "'" + username + "', " + "'" + password + "', " + "'" + token + "', " + "'" + imagePath + "' )"; return sta.execute(sql); } catch (SQLException e) { e.printStackTrace(); } return false; } // 注册 将用户名和密码插入到数据库(id设置的是自增长的,因此不需要插入) public boolean insertDataToDB(String username, String password) { String sql = " insert into user ( user_name , user_pwd ) values ( " + "'" + username + "', " + "'" + password + "' )"; try { sta = conn.createStatement(); // 执行SQL查询语句 return sta.execute(sql); } catch (SQLException e) { e.printStackTrace(); } return false; } public boolean isExistInDB(String username, String password) { boolean isFlag = false; // 创建 statement对象 try { sta = conn.createStatement(); // 执行SQL查询语句 rs = sta.executeQuery("select * from user"); if (rs != null) { while (rs.next()) { if (rs.getString("user_name").equals(username) && rs.getString("user_pwd").equals(password)) { isFlag = true; break; } } } } catch (SQLException e) { e.printStackTrace(); isFlag = false; } return isFlag; } // 判断数据库中是否存在某个用户名,注册的时候判断 public boolean isExistInDB(String username) { boolean isFlag = false; // 创建 statement对象 try { sta = conn.createStatement(); // 执行SQL查询语句 rs = sta.executeQuery("select * from userinfo"); if (rs != null) { while (rs.next()) { if (rs.getString("user_name").equals(username)) { isFlag = true; } } } } catch (SQLException e) { e.printStackTrace(); isFlag = false; } return isFlag; } // 关闭数据库连接 public void closeConnect() { try { if (rs != null) { rs.close(); } if (sta != null) { sta.close(); } if (conn != null) { conn.close(); } System.out.println("关闭数据库连接成功"); } catch (SQLException e) { System.out.println("Error: " + e.getMessage()); } } }
[ "lovecyg123" ]
lovecyg123
6b3dee33665fd8acd7f782ade08e4e16ced9aa0f
8f7e571b09e0d7ce92d24e882f8553ac5482e8a0
/src/main/java/com/example/hystrix/model/Employee.java
d96d09b785d9ca3d9a0afb962c9822b6d18fdd58
[]
no_license
chphakphoom/hystrix
eb6583881604d244a66d293f22ed72847c46b173
f3b22ef17a2b04dad3e1d744bd83372f33216db8
refs/heads/master
2020-05-01T04:58:07.505275
2019-03-24T07:05:52
2019-03-24T07:05:52
177,288,329
0
0
null
null
null
null
UTF-8
Java
false
false
533
java
package com.example.hystrix.model; public class Employee { private int id; private String name; private String position; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPosition() { return position; } public void setPosition(String position) { this.position = position; } }
7e973663ffb4bcfa6e5e3313f9d525e53738f294
4b3dc08d18bf01ba476a639c1a32eb5c862b9330
/NewCMS_Hibernate_Annotations/src/com/deloitte/cms/dao/impl/CustomerDAOImpl.java
655267db8784aeacc420ba18c6287821629a9a63
[]
no_license
chiraggarg96/deloittetrng
10e6e1cc444ebd626e37385487f1ade9c09b4b07
976949c5a9b20eac8b7acb2315a1b112bb6b96fb
refs/heads/master
2022-12-20T12:07:08.195535
2019-08-09T10:09:39
2019-08-09T10:09:39
196,966,372
0
0
null
null
null
null
UTF-8
Java
false
false
3,066
java
package com.deloitte.cms.dao.impl; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.cfg.AnnotationConfiguration; import org.hibernate.cfg.Configuration; import com.deloitte.cms.dao.CustomerDAO; import com.deloitte.cms.model.Customer; public class CustomerDAOImpl implements CustomerDAO { AnnotationConfiguration configuration = new AnnotationConfiguration().configure(); SessionFactory factory = configuration.buildSessionFactory(); Session session = factory.openSession(); Transaction transaction = session.beginTransaction(); @Override public List<Customer> getAllCustomer() { // Connection connection =DbUtility.getMyConnection(); //List<Customer> customerList = new ArrayList<>(); session=factory.openSession(); Query query=session.createQuery("from com.deloitte.cms.model.Customer "); return query.list(); /*Iterator<Customer> iterator=query.iterate(); while(iterator.hasNext()) { Customer customer=iterator.next(); customerList.add(customer); } return customerList;*/ } @Override public boolean insertCustomer(Customer customer) { Session session = factory.openSession(); Transaction transaction = session.beginTransaction(); session.save(customer); transaction.commit(); session.close(); /* factory.close(); */ return true; } @Override public boolean updateCustomer(Customer customer) { Session session = factory.openSession(); Transaction transaction = session.beginTransaction(); session.update(customer); transaction.commit(); return true; } @Override public boolean deleteCustomer(int customerID) { Session session2 = factory.openSession(); Transaction transaction = session2.beginTransaction(); Customer customer = new Customer(); customer.setCustomerId(customerID); session.delete(customer); transaction.commit(); /* * session.close(); factory.close(); */ return true; } @Override public Customer searchCustomerById(int customerID) { Session session = factory.openSession(); Transaction transaction = session.beginTransaction(); Customer customer = new Customer(); customer = (Customer) session.get(Customer.class, customerID); transaction.commit(); session.close(); /* factory.close(); */ return customer; } @Override public boolean isCustomerExists(int customerId) { Session session = factory.openSession(); Transaction transaction = session.beginTransaction(); Customer customer = new Customer(); customer = (Customer) session.get(Customer.class, customerId); transaction.commit(); session.close(); // factory.close(); if (customer == null) return false; return true; } }
246f85a080e131618e27b5bb30754b473b01e604
5dd0d1b13819e1b1ae4033768760bc63424c4838
/src/main/java/net/skhu/dto/DepartmentMajor.java
ade601f3c17da23c6b0352ab52ca3524edf7671c
[]
no_license
jeenie/graduation_system
0eb2b07f9ff6489ac9f975cfe76caf59cc32bbfd
ee5c8b1ea5b8b11ed98fef5dea0a977934892716
refs/heads/master
2022-07-06T15:17:29.671415
2020-02-10T01:22:26
2020-02-10T01:22:26
148,599,229
1
4
null
2021-04-26T18:56:21
2018-09-13T07:27:39
Java
UTF-8
Java
false
false
554
java
package net.skhu.dto; //18학번 //학부 내 전공 객체 public class DepartmentMajor { int majorId; String majorName; int departmentId; public int getMajorId() { return majorId; } public void setMajorId(int majorId) { this.majorId = majorId; } public String getMajorName() { return majorName; } public void setMajorName(String majorName) { this.majorName = majorName; } public int getDepartmentId() { return departmentId; } public void setDepartmentId(int departmentId) { this.departmentId = departmentId; } }
0902b976428f93d6c6a50e33ea6e04f6e736be13
851eaed10254bb9964fcae3987519bfaf392ae6a
/src/main/java/net/testaholic_acme_site/web/rest/ThAlertPromptsResource.java
a752a12a065201b928c73355dd79c8145ac4c7cd
[ "MIT" ]
permissive
BulkSecurityGeneratorProject/acme_site
c1d4739fe669cf2615cc88dd1e1e6205e6009667
9bcf48168e3dce90283353e0fb75f6be9e080bc2
refs/heads/master
2022-12-13T20:24:46.381118
2017-01-23T00:57:53
2017-01-23T00:57:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,178
java
package net.testaholic_acme_site.web.rest; import com.codahale.metrics.annotation.Timed; import net.testaholic_acme_site.domain.ThAlertPrompts; import net.testaholic_acme_site.repository.ThAlertPromptsRepository; import net.testaholic_acme_site.web.rest.util.HeaderUtil; import net.testaholic_acme_site.web.rest.util.PaginationUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import javax.inject.Inject; import java.net.URI; import java.net.URISyntaxException; import java.util.List; import java.util.Optional; /** * REST controller for managing ThAlertPrompts. */ @RestController @RequestMapping("/api") public class ThAlertPromptsResource { private final Logger log = LoggerFactory.getLogger(ThAlertPromptsResource.class); @Inject private ThAlertPromptsRepository thAlertPromptsRepository; /** * POST /th-alert-prompts : Create a new thAlertPrompts. * * @param thAlertPrompts the thAlertPrompts to create * @return the ResponseEntity with status 201 (Created) and with body the new thAlertPrompts, or with status 400 (Bad Request) if the thAlertPrompts has already an ID * @throws URISyntaxException if the Location URI syntax is incorrect */ @RequestMapping(value = "/th-alert-prompts", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<ThAlertPrompts> createThAlertPrompts(@RequestBody ThAlertPrompts thAlertPrompts) throws URISyntaxException { log.debug("REST request to save ThAlertPrompts : {}", thAlertPrompts); if (thAlertPrompts.getId() != null) { return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert("thAlertPrompts", "idexists", "A new thAlertPrompts cannot already have an ID")).body(null); } ThAlertPrompts result = thAlertPromptsRepository.save(thAlertPrompts); return ResponseEntity.created(new URI("/api/th-alert-prompts/" + result.getId())) .headers(HeaderUtil.createEntityCreationAlert("thAlertPrompts", result.getId().toString())) .body(result); } /** * PUT /th-alert-prompts : Updates an existing thAlertPrompts. * * @param thAlertPrompts the thAlertPrompts to update * @return the ResponseEntity with status 200 (OK) and with body the updated thAlertPrompts, * or with status 400 (Bad Request) if the thAlertPrompts is not valid, * or with status 500 (Internal Server Error) if the thAlertPrompts couldnt be updated * @throws URISyntaxException if the Location URI syntax is incorrect */ @RequestMapping(value = "/th-alert-prompts", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<ThAlertPrompts> updateThAlertPrompts(@RequestBody ThAlertPrompts thAlertPrompts) throws URISyntaxException { log.debug("REST request to update ThAlertPrompts : {}", thAlertPrompts); if (thAlertPrompts.getId() == null) { return createThAlertPrompts(thAlertPrompts); } ThAlertPrompts result = thAlertPromptsRepository.save(thAlertPrompts); return ResponseEntity.ok() .headers(HeaderUtil.createEntityUpdateAlert("thAlertPrompts", thAlertPrompts.getId().toString())) .body(result); } /** * GET /th-alert-prompts : get all the thAlertPrompts. * * @param pageable the pagination information * @return the ResponseEntity with status 200 (OK) and the list of thAlertPrompts in body * @throws URISyntaxException if there is an error to generate the pagination HTTP headers */ @RequestMapping(value = "/th-alert-prompts", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<List<ThAlertPrompts>> getAllThAlertPrompts(Pageable pageable) throws URISyntaxException { log.debug("REST request to get a page of ThAlertPrompts"); Page<ThAlertPrompts> page = thAlertPromptsRepository.findAll(pageable); HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/th-alert-prompts"); return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK); } /** * GET /th-alert-prompts/:id : get the "id" thAlertPrompts. * * @param id the id of the thAlertPrompts to retrieve * @return the ResponseEntity with status 200 (OK) and with body the thAlertPrompts, or with status 404 (Not Found) */ @RequestMapping(value = "/th-alert-prompts/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<ThAlertPrompts> getThAlertPrompts(@PathVariable Long id) { log.debug("REST request to get ThAlertPrompts : {}", id); ThAlertPrompts thAlertPrompts = thAlertPromptsRepository.findOne(id); return Optional.ofNullable(thAlertPrompts) .map(result -> new ResponseEntity<>( result, HttpStatus.OK)) .orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND)); } /** * DELETE /th-alert-prompts/:id : delete the "id" thAlertPrompts. * * @param id the id of the thAlertPrompts to delete * @return the ResponseEntity with status 200 (OK) */ @RequestMapping(value = "/th-alert-prompts/{id}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<Void> deleteThAlertPrompts(@PathVariable Long id) { log.debug("REST request to delete ThAlertPrompts : {}", id); thAlertPromptsRepository.delete(id); return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert("thAlertPrompts", id.toString())).build(); } }
4895902d37f1fcb59526e3fad595a7fe1284cf48
b453ec6498c4145fe3ac2cc59432906f1b32d3a9
/src/main/java/org/sid/cinema/entities/Projection.java
8a0c377173e5998ac5be1a69bc3632eebb2fc599
[]
no_license
Elbadri0/cinema-BackEnd
4861b19b6973490519bf45043505b01327e6bdeb
08c0589034a167b0d8b5405a50770a7fdce82ee6
refs/heads/main
2023-02-25T19:09:42.491616
2021-01-24T15:07:13
2021-01-24T15:07:13
332,319,417
4
0
null
null
null
null
UTF-8
Java
false
false
1,054
java
package org.sid.cinema.entities; import java.util.Collection; import java.util.Date; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty.Access; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @Entity @Data @AllArgsConstructor @NoArgsConstructor public class Projection { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Long id; private Date dateProjecion; private double prix; @ManyToOne @JsonProperty(access=Access.WRITE_ONLY) private Salle salle; @ManyToOne private Film film; @OneToMany(mappedBy="projection") @JsonProperty(access=Access.WRITE_ONLY) private Collection<Ticket> tickets; @ManyToOne @JsonProperty(access=Access.WRITE_ONLY) private Seance seance; }
0d627d13e87591ede00c7fe84c0c81ad5ec419d1
1330a304fa09fc4bbed612a34958f77d353cbaf6
/src/main/java/com/zyp/o2o/entity/ProductImg.java
e86ef3c2d2793ac65738782b81eea775ebf8cbd5
[ "Apache-2.0" ]
permissive
zouyip/o2o
24c8dc71bff81db3d17f852783b2be0cc96e6226
9e0fddf569d738030bbe8b9dfe47334ab29a4b51
refs/heads/master
2021-08-08T11:25:42.354206
2017-11-10T07:19:09
2017-11-10T07:19:09
110,213,968
0
0
null
null
null
null
UTF-8
Java
false
false
1,433
java
package com.zyp.o2o.entity; import java.util.Date; /** * 商品详情图实体类 * * Created by Administrator on 2017/11/10. */ public class ProductImg { //主键ID private Long productImgId; //图片地址 private String imgAddr; //图片简介 private String imgDesc; //权重,越大越排前显示 private Integer priority; //创建时间 private Date createTime; //标明是属于哪个商品的图片 private Long productId; public Long getProductImgId() { return productImgId; } public void setProductImgId(Long productImgId) { this.productImgId = productImgId; } public String getImgAddr() { return imgAddr; } public void setImgAddr(String imgAddr) { this.imgAddr = imgAddr; } public String getImgDesc() { return imgDesc; } public void setImgDesc(String imgDesc) { this.imgDesc = imgDesc; } public Integer getPriority() { return priority; } public void setPriority(Integer priority) { this.priority = priority; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Long getProductId() { return productId; } public void setProductId(Long productId) { this.productId = productId; } }
36f47e0a06549150a530969bddec0be4fd3f947b
a17e5255e2c122457ff4b782188d0bf5067b8b61
/app/src/main/java/com/example/zhaoxu/lottery/Info/GlobalParams.java
f9e33eddcf9a12bd69d14c8df79ffe31a3a13dce
[]
no_license
zhaoxukl1314/Lottery
f45eb73200347a549f6ce920f3f2bd21881f1989
7af298fa0e803e9f8c2839ac58b6a1120a754c76
refs/heads/master
2020-04-18T01:02:49.434471
2016-11-03T12:15:54
2016-11-03T12:15:54
66,238,452
0
0
null
null
null
null
UTF-8
Java
false
false
192
java
package com.example.zhaoxu.lottery.Info; /** * Created by Administrator on 2016/9/19. */ public class GlobalParams { public static String PROXY = ""; public static int PORT = 0; }
906d4675d6a045ffdc1984bbdd7fcd6e276b1c9e
9e8187c35ef08c67186679f6d472603a8f7b2d6d
/lab4/mujavaHome/result/BackPack/traditional_mutants/int_BackPack_Solution(int,int,int,int)/AORB_4/BackPack.java
c231792230c81ca46e01d324a8d5bfc8614730cf
[]
no_license
cxdzb/software-testing-technology
8b79f99ec859a896042cdf5bccdadfd11f65b64c
5fb1305dd2dd028c035667c71e0abf57a489360b
refs/heads/master
2021-01-09T15:24:42.561680
2020-04-16T06:18:58
2020-04-16T06:18:58
242,354,593
0
0
null
null
null
null
UTF-8
Java
false
false
851
java
// This is a mutant program. // Author : ysma public class BackPack { public int[][] BackPack_Solution( int m, int n, int[] w, int[] p ) { int[][] c = new int[n - 1][m + 1]; for (int i = 0; i < n + 1; i++) { c[i][0] = 0; } for (int j = 0; j < m + 1; j++) { c[0][j] = 0; } for (int i = 1; i < n + 1; i++) { for (int j = 1; j < m + 1; j++) { if (w[i - 1] <= j) { if (c[i - 1][j] < c[i - 1][j - w[i - 1]] + p[i - 1]) { c[i][j] = c[i - 1][j - w[i - 1]] + p[i - 1]; } else { c[i][j] = c[i - 1][j]; } } else { c[i][j] = c[i - 1][j]; } } } return c; } }
5c853b9856088e1fc0bf8a72305afec5cb645753
0e0cf12004d4e30705765c9b1f2cf8cfeb45c43e
/src/main/java/com/sample/demo/ProductServicePortalApplication.java
4782df479d2b5e283a791f5bbdfdc6c903aca008
[]
no_license
Janbee-Shaik/ProductServicePortal
870d41d53100d1d224f7a585725283b60ac0b904
a133f422ecb87ce21f1b0fd126fff42b7aaefc91
refs/heads/master
2022-10-10T18:03:52.613133
2020-06-10T11:11:14
2020-06-10T11:11:14
271,253,526
0
0
null
null
null
null
UTF-8
Java
false
false
336
java
package com.sample.demo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class ProductServicePortalApplication { public static void main(String[] args) { SpringApplication.run(ProductServicePortalApplication.class, args); } }
bdc641081cd480fdf6ba7b4f77daf0e272d4f102
82812958f91d9e2151f7b2372998ae5b3ec88a4e
/app/src/main/java/com/iplant/model/ToolBox.java
03d1bdcec0216a40b365e16c4eba47d2b11b9ecb
[]
no_license
406036741/iplant-master
3996dbf66db516552dcb69dab4938475aba14150
13e1d19b16eef744de8b2cbb7c737692b10fea35
refs/heads/master
2020-09-13T02:40:55.691149
2019-11-20T07:53:52
2019-11-20T07:53:52
222,634,895
0
0
null
null
null
null
UTF-8
Java
false
false
2,071
java
package com.iplant.model; import com.iplant.presenter.db.DBBase; import com.j256.ormlite.field.DatabaseField; import com.j256.ormlite.table.DatabaseTable; @DatabaseTable(tableName = "tb_toolbox") public class ToolBox extends DBBase<ToolBox> { private static final long serialVersionUID = -100133833040042611L; //编号 @DatabaseField(generatedId = true) public int id; //用户id @DatabaseField public String userid; //用户id @DatabaseField public int companyid; //对应的 分组ID @DatabaseField public int groupType; //分组名称 @DatabaseField public String groupName; //有多少条未读消息 @DatabaseField public int unReadCount; //模块名称 @DatabaseField public String name; //icon图片地址 @DatabaseField public String imgUrl; //链接地址 @DatabaseField public String linkUrl; //模块ID @DatabaseField public String moduleId; //打开方式 @DatabaseField public String runType; @Override protected ToolBox getMySelf() { // TODO Auto-generated method stub return this; } @Override public boolean equals(Object o) { ToolBox newBox = (ToolBox) o; String a= newBox.linkUrl.substring(0,newBox.linkUrl.lastIndexOf("&")); String b=linkUrl.substring(0,linkUrl.lastIndexOf("&")); if (newBox.groupName.equals(groupName) && newBox.unReadCount == unReadCount && newBox.name.equals(name) && newBox.imgUrl.equalsIgnoreCase(imgUrl) && newBox.linkUrl.substring(0,newBox.linkUrl.lastIndexOf("&")).equalsIgnoreCase(linkUrl.substring(0,linkUrl.lastIndexOf("&"))) && newBox.moduleId.equalsIgnoreCase(moduleId) && newBox.runType.equalsIgnoreCase(runType) && newBox.userid.equalsIgnoreCase(userid) && newBox.companyid==companyid ) { return true; } return false; } }
0fac8720fe2698bfbf47e13b5ffffe4fd2a26e35
6e32e038be7f7d0151f7d5088291282215a1f64d
/src/main/java/shell/util/Rand.java
0e53725ca86a2f91545f147f502fc6cab0144d13
[]
no_license
gutomarzagao/simple-genetic-algorithm
aff9c347cbc0bd9bdd26f87ff4b88119e2c9ba28
5af84aff9019bf72b0022c119afdd8fb87aa97c4
refs/heads/master
2020-09-20T17:10:29.039955
2016-09-12T03:23:40
2016-09-12T03:23:40
67,821,552
0
0
null
null
null
null
UTF-8
Java
false
false
850
java
package shell.util; import java.util.List; import java.util.Random; public class Rand { private static Random random = new Random(); public static boolean getBoolean() { return random.nextBoolean(); } public static boolean getBoolean(double probability) { if (probability < 0 || probability > 1) { throw new IllegalArgumentException("Probability should be a number between 0 and 1"); } return random.nextDouble() < probability; } public static int getInt(int lowerValue, int upperValue) { if (upperValue < lowerValue || upperValue - lowerValue < 0) { throw new IllegalArgumentException("Lower value cannot be greater than upper value"); } return random.nextInt(upperValue - lowerValue + 1) + lowerValue; } public static <T> T getListElement(List<T> list) { return list.get(random.nextInt(list.size())); } }
3ea8758021decd1eaa83481d1650647975b08d04
c3e55b0c400cd2bd01e3173268d05f012c998d8c
/src/main/java/br/com/southsystem/cooperativismo/controller/SessionVoteController.java
bf6fc35342a938e9588203a4e3a79d22a7a29b4a
[]
no_license
mariosergiosantos/desafio-back-votos
4b4c4a373d069ab588c1e06c7deacef04cc7b408
a898728357b06dbc66d1b7437b8626e7ae8cc750
refs/heads/main
2023-06-15T20:45:46.311955
2021-07-07T16:46:51
2021-07-07T16:46:51
382,055,872
1
0
null
null
null
null
UTF-8
Java
false
false
1,252
java
package br.com.southsystem.cooperativismo.controller; import br.com.southsystem.cooperativismo.domain.model.SessionVote; import br.com.southsystem.cooperativismo.domain.request.SessionVoteRequest; import br.com.southsystem.cooperativismo.service.SessionVoteService; import io.swagger.v3.oas.annotations.Operation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.util.List; @RestController public class SessionVoteController { @Autowired private SessionVoteService sessionVoteService; @Operation(summary = "List associate") @GetMapping("/v1/session") public List<SessionVote> getAllSessions() { return sessionVoteService.findAll(); } @Operation(summary = "Open session") @PostMapping("/v1/session/open") public SessionVote openSession(@RequestBody @Valid SessionVoteRequest sessionVoteRequest) { return sessionVoteService.openSession(sessionVoteRequest); } @Operation(summary = "Close session") @PutMapping("/v1/session/{sessionId}/close") public void closeSession(@PathVariable("sessionId") Long sessionId) { sessionVoteService.closeSession(sessionId); } }
caf31d1ffeb9b896701a090038e796154e04ef63
320698712e741c6beaa18f0226eec0f5344035f4
/app/src/main/java/com/spiritledinc/firebaseuisignin/MainActivity.java
0f63d8d05f4ea38aa184cda5c94cdb13539ffe2d
[]
no_license
wilsonmwiti/FirebaseUiSignin
6341d7481ae267d94df4aad2d3525e6b3571591b
0102352b74b2b1f716bc6691fe05802c0c817ce6
refs/heads/master
2022-06-10T17:57:08.381357
2020-05-09T00:16:33
2020-05-09T00:16:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,943
java
package com.spiritledinc.firebaseuisignin; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.view.inputmethod.EditorInfo; import android.widget.EditText; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import com.facebook.AccessToken; import com.facebook.CallbackManager; import com.facebook.FacebookCallback; import com.facebook.FacebookException; import com.facebook.login.LoginResult; import com.facebook.login.widget.LoginButton; import com.google.android.gms.auth.api.signin.GoogleSignIn; import com.google.android.gms.auth.api.signin.GoogleSignInAccount; import com.google.android.gms.auth.api.signin.GoogleSignInClient; import com.google.android.gms.auth.api.signin.GoogleSignInOptions; import com.google.android.gms.common.api.ApiException; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.AuthCredential; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FacebookAuthProvider; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; public class MainActivity extends AppCompatActivity implements View.OnClickListener { private static final String TAG = "MainActivity"; private static final int RC_SIGN_IN = 432; private FirebaseAuth mAuth; private ProgressBar spinner; private GoogleSignInClient mGoogleSignInClient; private CallbackManager mCallbackManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mAuth = FirebaseAuth.getInstance(); //hide spinner spinner = findViewById(R.id.progressBar); spinner.setVisibility(View.GONE); //allow submit from password edittext EditText edit_txt = findViewById(R.id.fieldPassword); edit_txt.setOnEditorActionListener(new EditText.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { signInEmailPassword(findViewById(android.R.id.content).getRootView()); return true; } return false; } }); // Configure sign-in to request the user's ID, email address, and basic // profile. ID and basic profile are included in DEFAULT_SIGN_IN. GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestEmail() .build(); // Build a GoogleSignInClient with the options specified by gso. mGoogleSignInClient = GoogleSignIn.getClient(this, gso); findViewById(R.id.sign_in_button).setOnClickListener(this); // Initialize Facebook Login button mCallbackManager = CallbackManager.Factory.create(); LoginButton loginButton = findViewById(R.id.login_button); //loginButton.setReadPermissions("email", "public_profile"); loginButton.registerCallback(mCallbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { Log.d(TAG, "facebook:onSuccess:" + loginResult); handleFacebookAccessToken(loginResult.getAccessToken()); updateUI(); } @Override public void onCancel() { Log.d(TAG, "facebook:onCancel"); // ... } @Override public void onError(FacebookException error) { Log.d(TAG, "facebook:onError", error); // ... } }); } @Override public void onStart() { super.onStart(); // Check if user is signed in (non-null) and update UI accordingly. FirebaseUser currentUser = mAuth.getCurrentUser(); Log.d(TAG, String.valueOf(currentUser)); if (currentUser != null) { Intent intent = new Intent(MainActivity.this, MainHome.class); startActivity(intent); } // Check for existing Google Sign In account, if the user is already signed in // the GoogleSignInAccount will be non-null. GoogleSignInAccount account = GoogleSignIn.getLastSignedInAccount(this); if (account != null) { Intent intent = new Intent(MainActivity.this, MainHome.class); startActivity(intent); } } @Override public void onClick(View v) { if (v.getId() == R.id.sign_in_button) signIn(); } private void signIn() { Intent signInIntent = mGoogleSignInClient.getSignInIntent(); startActivityForResult(signInIntent, RC_SIGN_IN); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); // Result returned from launching the Intent from GoogleSignInClient.getSignInIntent(...); if (requestCode == RC_SIGN_IN) { // The Task returned from this call is always completed, no need to attach // a listener. Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data); handleSignInResult(task); } else { // Pass the activity result back to the Facebook SDK mCallbackManager.onActivityResult(requestCode, resultCode, data); } } private void handleSignInResult(Task<GoogleSignInAccount> completedTask) { try { GoogleSignInAccount account = completedTask.getResult(ApiException.class); // Signed in successfully, show authenticated UI. //You can also get the user's email address with getEmail, the user's Google ID (for client-side use) with getId, and an ID token for the user with getIdToken updateUI(); } catch (ApiException e) { // The ApiException status code indicates the detailed failure reason. // Please refer to the GoogleSignInStatusCodes class reference for more information. Log.w(TAG, "signInResult:failed code=" + e.getStatusCode()); Toast.makeText(MainActivity.this, "signInResult:failed code=" + e.getStatusCode(), Toast.LENGTH_SHORT).show(); } } public void register(View view) { Intent intent = new Intent(this, CreateAccount.class); startActivity(intent); } public void signInEmailPassword(View view) { //check user input if (!validate()) { Toast.makeText(getBaseContext(), "Login failed", Toast.LENGTH_LONG).show(); return; } //set spinner to visible spinner = findViewById(R.id.progressBar); spinner.setVisibility(View.VISIBLE); //get email EditText emailEditText = findViewById(R.id.fieldEmail); String email = emailEditText.getText().toString(); //get password EditText passwordEditText = findViewById(R.id.fieldPassword); String password = passwordEditText.getText().toString(); mAuth.signInWithEmailAndPassword(email, password) .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { // Sign in success, update UI with the signed-in user's information spinner.setVisibility(View.GONE); Log.d(TAG, "signInWithEmail:success"); //FirebaseUser user = mAuth.getCurrentUser(); updateUI(); } else { // If sign in fails, display a message to the user. spinner.setVisibility(View.GONE); Log.w(TAG, "signInWithEmail:failure", task.getException()); Toast.makeText(MainActivity.this, "Authentication failed.", Toast.LENGTH_SHORT).show(); } } }); } public boolean validate() { boolean valid = true; EditText emailEditText = findViewById(R.id.fieldEmail); String email = emailEditText.getText().toString(); EditText passwordEditText = findViewById(R.id.fieldPassword); String password = passwordEditText.getText().toString(); if (email.isEmpty() || !android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches()) { emailEditText.setError("enter a valid email address"); valid = false; } else { emailEditText.setError(null); } if (password.isEmpty() || password.length() < 6 || password.length() > 10) { passwordEditText.setError("between 6 and 10 alphanumeric characters"); valid = false; } else { passwordEditText.setError(null); } return valid; } private void handleFacebookAccessToken(AccessToken token) { Log.d(TAG, "handleFacebookAccessToken:" + token); AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken()); mAuth.signInWithCredential(credential) .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { // Sign in success, update UI with the signed-in user's information Log.d(TAG, "signInWithCredential:success"); //FirebaseUser user = mAuth.getCurrentUser(); updateUI(); } else { // If sign in fails, display a message to the user. Log.w(TAG, "signInWithCredential:failure", task.getException()); Toast.makeText(MainActivity.this, "Authentication failed.", Toast.LENGTH_SHORT).show(); } } }); } private void updateUI() { //on successful login from FB, Google, or Email/Pass send user to Home Activity Intent intent = new Intent(MainActivity.this, MainHome.class); startActivity(intent); } }
874eed49711829fcd4b765ca6da23c29c2323c34
df53b45290400859d4a69718c052302c745969a1
/src/test/java/pageObject/Login_Page.java
a72bf1bc5d9cccdfa17f364c91339accc111164b
[]
no_license
jewelny2011/August2020D
2b84190226578129730a8cef6bb3090cafd9983c
76785b11c9bfdf49de5a8b22948d72ea41831d78
refs/heads/main
2023-03-19T10:01:41.389742
2021-03-19T08:47:39
2021-03-19T08:47:39
344,651,502
0
0
null
2021-03-19T08:47:40
2021-03-05T00:49:49
Gherkin
UTF-8
Java
false
false
49
java
package pageObject; public class Login_Page { }
c8623bff7925971d5b5299add22e7f7d18c41c99
43b74b0b0f5e701b04dde4eadcef56123fccbf8a
/src/main/java/com/pubiapplication/app/Facebookservlet.java
ae699f346c96e99ed0f48d46013f8a1215753348
[]
no_license
Mikroplu/Projekt
417f34dd16904769b609851ba439d09e9e4099ce
a882e6c2899b04ef1b25c26803229140b266f619
refs/heads/master
2016-08-04T23:42:02.065856
2014-04-24T12:28:37
2014-04-24T12:28:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
614
java
package com.pubiapplication.app; import com.restfb.*; import com.restfb.types.Page; import com.restfb.types.User; public class Facebookservlet { private static final String MY_ACCESS_TOKEN = "CAACEdEose0cBAAIOWyYnvK6FDT1sWKTztKIfQtO7bKzOyRZBujlubfjiBNAvp8jx36eXQnsXMWIrwBZAFVEjYj3RYgLZBPM0aYRwGbQ8tZBpiZARdCE7Wj2uAaEUqSBNaDCvZBJwSdsohq7AFrZCUYw28IZC46u7AkhRBWRJOmnEEZBDGmKOpbz95WUeo6PAyr7CNjZAce85Mn8wZDZD"; FacebookClient facebookClient = new DefaultFacebookClient(MY_ACCESS_TOKEN); User user = facebookClient.fetchObject("me", User.class); Page page = facebookClient.fetchObject("cocacola", Page.class); }
ac21d33a86096e2e8fe6dfb766b52b5442d97a00
046673f1352e76587845fd1b3e3f5d2a07baafc7
/cloudal-sentinel-service8401/src/main/java/com/cloud/myhandler/CustomerBlockHandler.java
aa53012ae7c3813d9fff3e066cd63745456a0f9b
[]
no_license
ProudMuBai/springCloud
7689b1a5c02c4f54dad6a2149d4cd0e33a83befd
74cb10e4d22d5661774e44ee4890ac5d0068d4a0
refs/heads/main
2023-04-09T17:20:10.317072
2021-04-25T03:13:29
2021-04-25T03:13:29
361,317,541
1
0
null
null
null
null
UTF-8
Java
false
false
499
java
package com.cloud.myhandler; import com.alibaba.csp.sentinel.slots.block.BlockException; import com.cloud.entities.CommonResult; public class CustomerBlockHandler { public static CommonResult handlerException(BlockException exception){ return new CommonResult(4444,"自定义,global handlerException----1"); } public static CommonResult handlerException2(BlockException exception){ return new CommonResult(4444,"自定义,global handlerException----2"); } }
8af46b536e980655b2e34de0487b1341eeeceebb
851e4e718a0bdb3814736da0652ba6a9fddfefc4
/src/bsclient/changeStringScreen.java
05c1ae9050b5e6b7ba955c3639d30b13e8955884
[]
no_license
lhalla/kayttoliittymat
307121cbc064fa31bfa13ab1b2abb06b301d93fb
7fc0a11d3e53b9df5e66af348e8386a2cd27997e
refs/heads/master
2021-03-27T16:45:22.775194
2018-04-30T18:28:51
2018-04-30T18:28:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,644
java
package bsclient; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Font; import java.awt.Frame; import java.awt.GridLayout; import java.awt.Dialog.ModalityType; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.WindowConstants; public class changeStringScreen { JDialog dialog; JPanel mainPanel = new JPanel(); JPanel buttonsPanel = new JPanel(); ButtonListener buttonlistener = new ButtonListener(); private JButton confirmButton = new JButton("VAHVISTA"); private JButton cancelButton = new JButton("PERU"); private String changedString = ""; JTextField changer; public changeStringScreen(Frame frame, String message1) { dialog = new JDialog (frame, message1); dialog.setSize(500, 500); } public String changeText(String message){ dialog.getContentPane().setLayout(new BorderLayout()); dialog.setModal (true); dialog.setAlwaysOnTop (true); dialog.setModalityType (ModalityType.APPLICATION_MODAL); dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); dialog.setResizable(false); GridLayout grid= new GridLayout(0,1); mainPanel.setLayout(grid); mainPanel.setBackground(Color.WHITE); dialog.add(mainPanel); JLabel messageLabel= new JLabel(); messageLabel.setText(message); mainPanel.add(messageLabel); changer=new JTextField(); mainPanel.add(changer); confirmButton.setBackground(new Color(50, 200, 45)); confirmButton.setForeground(Color.WHITE); confirmButton.setFocusPainted(false); confirmButton.setFont(new Font("Tahoma", Font.BOLD, 12)); cancelButton.setBackground(new Color(50, 200, 45)); cancelButton.setForeground(Color.WHITE); cancelButton.setFocusPainted(false); cancelButton.setFont(new Font("Tahoma", Font.BOLD, 12)); confirmButton.addActionListener(buttonlistener); cancelButton.addActionListener(buttonlistener); mainPanel.add(confirmButton); mainPanel.add(cancelButton); dialog.setLocationRelativeTo(null); dialog.setVisible(true); dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); dialog.dispose(); return changedString; } private class ButtonListener implements ActionListener{ public void actionPerformed(ActionEvent e) { if(e.getSource() == confirmButton) { changedString=changer.getText(); dialog.setVisible(false); } if(e.getSource() == cancelButton) { dialog.setVisible(false); } } } }
3187f3be024db95506461026869e21d06a354a3d
0d863008126a0dca8150bcbcba63f92cbc32fd74
/src/test/java/TutorItemTest.java
858b6263fe1ef1b2456a8ef820adaf63a6a1b9f8
[]
no_license
aalphanomad/Software_Design_Project
049c2381126c6016fdb9c2a76be422521756a273
37f0169201d9244a12354e76752e355a85d4bece
refs/heads/VBranch
2022-06-04T11:11:17.197519
2019-11-12T07:50:35
2019-11-12T07:50:35
172,665,642
1
1
null
2021-04-19T14:54:28
2019-02-26T08:05:18
Java
UTF-8
Java
false
false
433
java
//package com.alphanomad.AN_Webapp; import com.alphanomad.AN_Webapp.*; import static org.junit.Assert.*; import org.junit.Test; public class TutorItemTest { @Test public void testTutorItem() { String Name="Marubini"; String Student_num="1"; TutorItem tutorItem=new TutorItem(Name, Student_num); tutorItem.getName(); tutorItem.setName(Name); tutorItem.getStudent_num(); tutorItem.setStudent_num(Student_num); } }
d3d3e2c2aa8d3576bb1c172c2d98437aa7378c39
ff917b41748660411ff6af33e12cdc4050d85e8d
/src/ASN1/ASNObj.java
778d2dde3a5a0b406eacb4e7e90a24d01ceb6b86
[]
no_license
aalrubaye/Elliptic-Curve-Algorithm
9b9a6bcbdcce170171dde21e51d96077518fc3b2
9c3d1c872329a107f7f29757912ff20afb4434d5
refs/heads/master
2021-01-12T01:01:37.647204
2017-01-08T09:11:42
2017-01-08T09:11:42
78,332,406
0
0
null
null
null
null
UTF-8
Java
false
false
421
java
package ASN1; public abstract class ASNObj{ public abstract Encoder getEncoder(); public byte[] encode(){ //System.out.println("will encode: " +this); return getEncoder().getBytes(); } public abstract Object decode(Decoder dec) throws ASN1DecoderFail; public ASNObj instance() throws CloneNotSupportedException{return (ASNObj) clone();} }
723c10d584401e4bef73cf2dd291d8ee7f83008c
da8839c41e47c3ae5d6dccc73b836709ceb9c300
/DQBioinformatics/src/unimelb/edu/au/doc/BioinformaticFilter.java
c3cba827dc10e2ca272f00ae5af13ef061c5b71e
[ "Apache-2.0" ]
permissive
rbouadjenek/DQBioinformatics
dcb266d23c4a78a67eebfb23394b38e5d6a0d7e6
088c0e93754257592e3a0725897566af3823a92d
refs/heads/master
2021-01-21T10:49:04.811659
2019-02-24T05:34:12
2019-02-24T05:34:12
83,493,939
0
0
null
null
null
null
UTF-8
Java
false
false
770
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 unimelb.edu.au.doc; import java.io.File; import java.io.FileFilter; /** * This class represents a filter for PubMed articles. * * @author mbouadjenek */ public class BioinformaticFilter implements FileFilter { private final String extention; static public String PUBMED_ARTICLES = ".nxml"; static public String GENBANK_RECORDS = ".gb"; public BioinformaticFilter(String extention) { this.extention = extention; } @Override public boolean accept(File path) { return path.getName().toLowerCase().endsWith(extention); } }
c7f7cc6b78e73cdc004a885fa67c71f11a2919ee
5efbe1ce4035df0d4a7aa478ac37fa75aa68025c
/reference no run/com.martinstudio.hiddenrecorder/src/com/google/android/gms/internal/dl.java
2db4033525a78f78ac11c8a75b099d93a1bf3be4
[]
no_license
dat0106/datkts0106
6ec70e6adb90ba36237d4225b5cba80fcbd30343
885c9bec5b5cd3c4d677d8d579cd91cf7fd6d2e5
refs/heads/master
2016-08-05T08:24:11.701355
2014-08-01T04:35:12
2014-08-01T04:35:59
15,329,353
1
1
null
null
null
null
UTF-8
Java
false
false
1,533
java
package com.google.android.gms.internal; import android.os.RemoteException; import com.google.android.gms.ads.purchase.InAppPurchase; public class dl implements InAppPurchase { private final dc pg; public dl(dc paramdc) { this.pg = paramdc; } public String getProductId() { try { str = this.pg.getProductId(); str = str; } catch (RemoteException localRemoteException) { for (;;) { String str; ev.c("Could not forward getProductId to InAppPurchase", localRemoteException); Object localObject = null; } } return str; } public void recordPlayBillingResolution(int paramInt) { try { this.pg.recordPlayBillingResolution(paramInt); return; } catch (RemoteException localRemoteException) { for (;;) { ev.c("Could not forward recordPlayBillingResolution to InAppPurchase", localRemoteException); } } } public void recordResolution(int paramInt) { try { this.pg.recordResolution(paramInt); return; } catch (RemoteException localRemoteException) { for (;;) { ev.c("Could not forward recordResolution to InAppPurchase", localRemoteException); } } } } /* Location: E:\android\Androidvn\dex2jar\classes_dex2jar.jar * Qualified Name: com.google.android.gms.internal.dl * JD-Core Version: 0.7.0.1 */
0197f62bcfa0b0d4fce39e6ac116d1824cb0b9d7
0d6500b9eab0dfc5208d691028ad91247c6d36f7
/Shortest Job First Scheduler./sjf.java
773c453725414d559278d8441f03d78a50226fcc
[]
no_license
simpleParadox/Pass-time
706fb5813e0dedb7c1cf96bbaa95692e18503873
46476d86e0b74c148706d248245f9864aa773623
refs/heads/master
2021-12-30T02:52:56.346511
2021-12-20T07:42:42
2021-12-20T07:42:42
104,652,615
1
0
null
null
null
null
UTF-8
Java
false
false
1,675
java
import java.util.*; class Proc{ String name; int at; int bt; } class sjf{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter the total number of processes: "); int n = sc.nextInt(); ArrayList<Proc> process = new ArrayList<Proc>(); //Assuming all the processes will arive in non-decreasing order of their arrival time. If not, sort it accordingly. for(int i = 0; i < n; i++){ System.out.print("\nEnter the process name: "); String name = sc.next(); System.out.print("\nEnter the process arrival time: "); int at = sc.nextInt(); System.out.print("\nEnter the process burst time: "); int bt = sc.nextInt(); Proc temp = new Proc(); temp.name = name; temp.at = at; temp.bt = bt; process.add(temp); } // Heap will be implemented using an ArrayList for dynamic arrival of processes. ArrayList<Proc> p = new ArrayList<Proc>(); p.add(process.remove(0)); int totalExecTime = 0; while(process.size()>0){ if(p.isEmpty()==false){ Proc temp = p.remove(0); totalExecTime += temp.bt; System.out.print(temp.name + " "); } else totalExecTime += 1; while(process.size()>0 && totalExecTime>=process.get(0).at){ p.add(process.remove(0)); } // Heapify here. int n1 = p.size() - 1; int i = n1; if(i>=0){ Proc temp1 = new Proc(); temp1 = p.get(n1); while(i>0 && p.get((i / 2)).bt > temp1.bt){ p.set(i, p.get(i / 2)); i = i / 2; } p.set(i, temp1); } } // To print the remaining process. for(int j = 0; j < p.size(); j++){ System.out.print(p.get(j).name + " "); } } }
8919b6f4bc9a772ee7a2a29111ca31384012ba33
b00d5e8213be6a21d8b38bbceb6203c8154b886b
/content/Day2/WordCount.java
06894c6ce9b9a98fbb65923a386fe5ee27164368
[]
no_license
Vivek89/SparkTraining
4fa05ff65bc4f327289f71f0d8469e2a53ff13df
1df8ef126b0bcdf752e5c1af5e1b127b30883a23
refs/heads/master
2021-01-23T07:10:34.655229
2017-03-31T10:14:09
2017-03-31T10:14:09
86,416,856
0
0
null
null
null
null
UTF-8
Java
false
false
1,949
java
package com.evenkat; import org.apache.spark.SparkConf; import org.apache.spark.api.java.JavaPairRDD; import org.apache.spark.api.java.JavaRDD; import org.apache.spark.api.java.JavaSparkContext; import org.apache.spark.api.java.function.FlatMapFunction; import org.apache.spark.api.java.function.Function2; import org.apache.spark.api.java.function.PairFunction; import scala.Tuple2; import java.util.Arrays; public class WordCount { private static final FlatMapFunction<String, String> WORDS_EXTRACTOR = new FlatMapFunction<String, String>() { @Override public Iterable<String> call(String s) throws Exception { return Arrays.asList(s.split(" ")); } }; private static final PairFunction<String, String, Integer> WORDS_MAPPER = new PairFunction<String, String, Integer>() { @Override public Tuple2<String, Integer> call(String s) throws Exception { return new Tuple2<String, Integer>(s, 1); } }; private static final Function2<Integer, Integer, Integer> WORDS_REDUCER = new Function2<Integer, Integer, Integer>() { @Override public Integer call(Integer a, Integer b) throws Exception { return a + b; } }; public static void main(String[] args) { if (args.length < 1) { System.err.println("Please provide the input file full path as argument"); System.exit(0); } SparkConf conf = new SparkConf().setAppName("com.evenkat.WordCount").setMaster("local"); JavaSparkContext context = new JavaSparkContext(conf); JavaRDD<String> file = context.textFile(args[0]); JavaRDD<String> words = file.flatMap(WORDS_EXTRACTOR); JavaPairRDD<String, Integer> pairs = words.mapToPair(WORDS_MAPPER); JavaPairRDD<String, Integer> counter = pairs.reduceByKey(WORDS_REDUCER); counter.saveAsTextFile(args[1]); } }
3b65bad78aac677c70480d8a385570420d44e659
bacbb4cb37065cb09769c3363ad34de5acb2ee98
/org.eclipse.ice.example/xtend-gen/org/eclipse/ice/example/ExampleRuntimeModule.java
462dfc1e2f4ea172bffdab728ea9fbb84c9e73ad
[]
no_license
arbennett/ParserGeneratorExample
398f673697fd84bd0e2e62c19c26435451b0e1cd
001cd1f48252b579265db54eee91d60202ca6733
refs/heads/master
2021-01-10T13:54:40.479245
2016-04-26T00:09:47
2016-04-26T00:09:47
50,963,658
0
0
null
null
null
null
UTF-8
Java
false
false
345
java
/** * generated by Xtext 2.9.1 */ package org.eclipse.ice.example; import org.eclipse.ice.example.AbstractExampleRuntimeModule; /** * Use this class to register components to be used at runtime / without the Equinox extension registry. */ @SuppressWarnings("all") public class ExampleRuntimeModule extends AbstractExampleRuntimeModule { }
9485d70196c1fcefa086fa7e3e5306aa47928124
037572ccca0bf3490351b6fd7a15d6a57715c22a
/app/src/main/java/com/example/rxjavawithmvvm/service/MoviesDataService.java
2825f2ce3da6b6ed013c8f5ec9dbfd047787d7ab
[]
no_license
PrernaaSurbhi/RxJavaWithMvvm
52f7ef5899c3cbef63fc7691dfbe63e0ea846879
1145febd7439645b5f47f87e7a2b398703f4fb37
refs/heads/master
2023-01-08T00:23:11.207547
2020-11-01T18:09:45
2020-11-01T18:09:45
309,157,721
0
0
null
null
null
null
UTF-8
Java
false
false
347
java
package com.example.rxjavawithmvvm.service; import com.example.rxjavawithmvvm.model.MovieDBResponse; import io.reactivex.Observable; import retrofit2.http.GET; import retrofit2.http.Query; public interface MoviesDataService { @GET("movie/popular") Observable<MovieDBResponse> getPopularMoviesWithRx(@Query("api_key") String apiKey); }
19158b62a5d771ff5f653bf30eeb005bfc9a9a14
b384fcba2cdc637dd89cc47ab1b8a1776a1bf8f9
/src/main/java/com/young/boot/bootdemo/dao/MetaVoMapper.java
8e7cbeaab3b00b5d63c51fa700a86629bf4a8dbd
[]
no_license
mrziyoung/MySpringBootDemo
204a13c5bc6e0afee68e9596ba9023e48baa99bf
d8cc5169ccc79c8fcdf6ae8269c091b33678a8d2
refs/heads/master
2020-03-17T17:13:51.873689
2019-01-17T04:30:08
2019-01-17T04:30:08
133,779,992
0
0
null
null
null
null
UTF-8
Java
false
false
1,092
java
package com.young.boot.bootdemo.dao; import com.young.boot.bootdemo.dto.MetaDto; import com.young.boot.bootdemo.model.vo.MetaVo; import com.young.boot.bootdemo.model.vo.MetaVoExample; import java.util.List; import java.util.Map; import org.apache.ibatis.annotations.Param; public interface MetaVoMapper { int countByExample(MetaVoExample example); int deleteByExample(MetaVoExample example); int deleteByPrimaryKey(Integer mid); int insert(MetaVo record); int insertSelective(MetaVo record); List<MetaVo> selectByExample(MetaVoExample example); MetaVo selectByPrimaryKey(Integer mid); int updateByExampleSelective(@Param("record") MetaVo record, @Param("example") MetaVoExample example); int updateByExample(@Param("record") MetaVo record, @Param("example") MetaVoExample example); int updateByPrimaryKeySelective(MetaVo record); int updateByPrimaryKey(MetaVo record); List<MetaDto> selectFromSql(Map<String,Object> paraMap); MetaDto selectDtoByNameAndType(String name, String type); Integer countWithSql(Integer mid); }
df152a0083b8e5ecaeab56e59ff50807727e8a1b
38c4f07a54cbd8d9cdeaa156e766082324e2fd12
/newsroot-ui/src/main/java/com/codexperiments/newsroot/manager/twitter/ResultHandler.java
e8c2eee39f4f26a936cabbcb744b630075c8631b
[]
no_license
a-thomas/newsroot
7bc2d1ff1dd96b4449b927dea0527e88c69e2f6e
3ac488eaa0bfc2b6d90678e2a4456227e8ba3c8b
refs/heads/master
2021-01-15T13:29:30.096488
2013-10-12T10:08:28
2013-10-12T10:08:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,706
java
package com.codexperiments.newsroot.manager.twitter; import android.database.Cursor; public class ResultHandler<TTable extends Enum<?> & Table> { private TTable[] mTables; private boolean[] mSelectedTables; private int[][] mIndexes; public ResultHandler(TTable[] pTables) { super(); mTables = pTables; mSelectedTables = new boolean[pTables.length]; mIndexes = new int[mTables.length][]; } public ResultHandler<TTable> select(TTable pTable) { mSelectedTables[pTable.ordinal()] = true; return this; } public void parse(Cursor pCursor, Handle pHandle) { // Build the index of columns to look for in the result set. int lTableCount = mTables.length; for (int i = 0; i < lTableCount; ++i) { if (mSelectedTables[i]) { TTable lTable = mTables[i]; Enum<?>[] lColumns = lTable.columns(); int lColumnCount = lColumns.length; mIndexes[i] = new int[lColumnCount]; for (int j = 0; j < lColumnCount; ++j) { mIndexes[i][j] = pCursor.getColumnIndex(lColumns[j].name()); } } } // Iterate through the result set. Row lRow = new Row(pCursor, mIndexes); pCursor.moveToFirst(); try { while (!pCursor.isAfterLast()) { pHandle.handleRow(lRow, pCursor); pCursor.moveToNext(); } } finally { pCursor.close(); } } public static class Row { private Cursor mCursor; private int[][] mIndexes; protected Row(Cursor pCursor, int[][] pIndexes) { super(); mCursor = pCursor; mIndexes = pIndexes; } protected int getIndex(Enum<?> pTable, Enum<?> pColumn) { return mIndexes[pTable.ordinal()][pColumn.ordinal()]; } protected int getInt(Enum<?> pTable, Enum<?> pColumn) { return mCursor.getInt(mIndexes[pTable.ordinal()][pColumn.ordinal()]); } protected long getLong(Enum<?> pTable, Enum<?> pColumn) { return mCursor.getLong(mIndexes[pTable.ordinal()][pColumn.ordinal()]); } protected String getString(Enum<?> pTable, Enum<?> pColumn) { return mCursor.getString(mIndexes[pTable.ordinal()][pColumn.ordinal()]); } } public interface Handle { public abstract void handleRow(Row pRow, Cursor pCursor); } }
6f1c021f78d539a20854f0255f3ee18e0a11ef50
b8552db83b6de62123a01cc89b6ad816eb8bfd55
/authDemo/src/main/java/com/tcs/authdemo/payload/response/MessageResponse.java
3183ee1645efe430d0d3a1caaa6652f3814ce462
[]
no_license
youngethan4/logreg
5ff1229f2393d08d747f86e3cff5d2bfc2ac97f0
8839d7bd44456c64c3fd0a78e657250fadacccde
refs/heads/master
2023-01-23T11:49:48.322975
2020-12-09T23:31:13
2020-12-09T23:31:13
314,686,557
0
0
null
null
null
null
UTF-8
Java
false
false
303
java
package com.tcs.authdemo.payload.response; public class MessageResponse { private String message; public MessageResponse(String message) { this.message = message; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } }
db0197de665fd3dabc3af937d17a1a44435ed4ae
930c207e245c320b108e9699bbbb036260a36d6a
/BRICK-Jackson-JsonLd/generatedCode/src/main/java/brickschema/org/schema/_1_0_2/Brick/IVAV_Zone_Air_Temperature_Sensor.java
36bf6328a83ff80526aa5650fce479cbeb0b66ff
[]
no_license
InnovationSE/BRICK-Generated-By-OLGA
24d278f543471e1ce622f5f45d9e305790181fff
7874dfa450a8a2b6a6f9927c0f91f9c7d2abd4d2
refs/heads/master
2021-07-01T14:13:11.302860
2017-09-21T12:44:17
2017-09-21T12:44:17
104,251,784
1
0
null
null
null
null
UTF-8
Java
false
false
1,141
java
/** * This file is automatically generated by OLGA * @author OLGA * @version 1.0 */ package brickschema.org.schema._1_0_2.Brick; import java.util.ArrayList; import java.util.List; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldId; import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldProperty; import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldType; import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldLink; import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldPropertyType; import brick.jsonld.util.RefId; import brickschema.org.schema._1_0_2.Brick.IVAV_Zone_Temperature_Sensor; import brickschema.org.schema._1_0_2.Brick.IZone_Air_Temperature_Sensor; public interface IVAV_Zone_Air_Temperature_Sensor extends IVAV_Zone_Temperature_Sensor, IZone_Air_Temperature_Sensor { /** * @return RefId */ @JsonIgnore public RefId getRefId(); }
860a82d45cd57fcd5c2a2d770219fbc0aca5586e
e8b1c9c150a126ab0e94a42ab210069937424a0c
/app/src/main/java/com/example/sys/retrofit2/ReclerAdapter.java
99d30ea83cc42f4fccd895a094947f4f6fc312c9
[]
no_license
MohammadAsiff/Retrofit
e4f6c0bc20b7cd08a450bc59c3e37826e9a7386a
7535b1a74e07ca4e70c3aa79b1d2a1c65beddf11
refs/heads/master
2020-04-08T05:01:51.945379
2018-11-25T16:24:03
2018-11-25T16:24:03
159,042,749
0
0
null
null
null
null
UTF-8
Java
false
false
1,878
java
package com.example.sys.retrofit2; import android.content.Context; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.squareup.picasso.Picasso; import java.util.ArrayList; public class ReclerAdapter extends RecyclerView.Adapter<ReclerAdapter.HolderClass>{ Context context; ArrayList<DashboardResp.Details> details; public ReclerAdapter(SecondScreen secondScreen, ArrayList<DashboardResp.Details> details) { context = secondScreen; this.details = details; } @NonNull @Override public ReclerAdapter.HolderClass onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View itemView = LayoutInflater.from(parent.getContext()) .inflate(R.layout.list_item, parent, false); return new HolderClass(itemView); } @Override public void onBindViewHolder(@NonNull HolderClass holder, int position) { Picasso.get().load(details.get(position).getImage()).into(holder.image); holder.name.setText(details.get(position).getName()); holder.lat.setText(details.get(position).getLat()); holder.lon.setText(details.get(position).getLon()); } @Override public int getItemCount() { return details.size(); } public class HolderClass extends RecyclerView.ViewHolder{ ImageView image; TextView name, lat, lon; public HolderClass(View itemView) { super(itemView); image = itemView.findViewById(R.id.image); name = itemView.findViewById(R.id.name); lat = itemView.findViewById(R.id.lat); lon = itemView.findViewById(R.id.lon); } } }
27921353599d69d7c3ea70ee4440ec132028aa55
d7405d3bddf0d199b0b697957b053537eb9bea26
/SpringMVC2/src/com/java/member/dto/ZipcodeDto.java
9d4635974d601215a192c83c25589d20d9287708
[]
no_license
minseunghwang/KITRI_Spring
b141aced4ef935cc7c27542e26c25344412aea67
ce4622cb69ee5b4b4305908d9b6809f301944a99
refs/heads/master
2022-12-30T12:28:27.443523
2020-10-15T08:12:39
2020-10-15T08:12:39
296,552,873
0
0
null
null
null
null
UTF-8
Java
false
false
1,370
java
package com.java.member.dto; public class ZipcodeDto { private String zipcode; private String sido; private String gugun; private String dong; private String ri; private String bunji; //default Constructor public ZipcodeDto() {} //using Field Constructor public ZipcodeDto(String zipcode, String sido, String gugun, String dong, String ri, String bunji) { this.zipcode = zipcode; this.sido = sido; this.gugun = gugun; this.dong = dong; this.ri = ri; this.bunji = bunji; } // Getter & Setter public String getZipcode() { return zipcode; } public void setZipcode(String zipcode) { this.zipcode = zipcode; } public String getSido() { return sido; } public void setSido(String sido) { this.sido = sido; } public String getGugun() { return gugun; } public void setGugun(String gugun) { this.gugun = gugun; } public String getDong() { return dong; } public void setDong(String dong) { this.dong = dong; } public String getRi() { return ri; } public void setRi(String ri) { this.ri = ri; } public String getBunji() { return bunji; } public void setBunji(String bunji) { this.bunji = bunji; } @Override public String toString() { return "ZipcodeDto [zipcode=" + zipcode + ", sido=" + sido + ", gugun=" + gugun + ", dong=" + dong + ", ri=" + ri + ", bunji=" + bunji + "]"; } }
293565ab852531715483eba2b08a2b338acd74ee
334f9b3f5fcca7faa448b576b08ae8f6c186cfae
/Documents/NetBeansProjects/TrabajoCorba/src/InformacionApp/Informacion.java
c393fcb36473ab2d71e17a078f3d0a3c63e539fb
[]
no_license
Darmask/TrabajoCorba
477d3b2f5672ff7e2e94299454e7d2be9338ed9c
7003d7d6e73572b6cede62c064225c1b0587b49f
refs/heads/master
2020-05-20T18:23:38.266588
2019-05-22T00:17:42
2019-05-22T00:17:42
185,705,110
0
0
null
null
null
null
UTF-8
Java
false
false
316
java
package InformacionApp; /** * InformacionApp/Informacion.java . * Generated by the IDL-to-Java compiler (portable), version "3.2" * from informacion.idl */ public interface Informacion extends InformacionOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity { } // interface Informacion
[ "Tamayo@DESKTOP-MJ58J5A" ]
Tamayo@DESKTOP-MJ58J5A
64d552ded6e25e8046f317a5ffb4dff400fb6724
a95024f9c9fec7dcbc21fbca31241ff7c3d54818
/src/main/java/br/com/surittec/cliente/entity/Telefone.java
94a5d8a6d2c7e2b7a3c3fcf7aa4259a0f72c023d
[]
no_license
jeffersono7/desafio-crud-cliente-backend
3e94299c441ee99ee46fecc97e60460a00e8a5e1
be763d8c80474b76c53caa8b519b7f33ab9f9555
refs/heads/master
2020-12-07T21:58:42.502082
2020-01-14T08:54:07
2020-01-14T08:54:07
232,811,615
0
0
null
null
null
null
UTF-8
Java
false
false
934
java
package br.com.surittec.cliente.entity; import lombok.Data; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; @Data @Entity @Table(name = "telefone", schema = "CLIENTE") public class Telefone { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id") private Long id; @NotNull @Size(min = 8, max = 11) @Column(name = "numero") private String numero; @ManyToOne @JoinColumn(name = "tipo_telefone") private TipoTelefone tipoTelefone; @ManyToOne(optional = false) @JoinColumn(name = "cliente", nullable = false) private Cliente cliente; }
2c12b13671f487519648b0b4a4a86f3254641eb7
4205f3df652fbe329e45d0cad4418e013936834f
/src/main/java/org/accounting/system/clients/responses/openaire/Total.java
a948f2723630b29c3f12c00714aa10047e7eac24
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
ARGOeu/argo-accounting
f4424be3b9e189c0b239444a4f9c9e9bc57264fb
9f67a1d7d1c487332e526456326a0812e53b7c51
refs/heads/devel
2023-05-30T09:40:16.449066
2023-05-10T07:06:39
2023-05-10T07:06:39
439,306,682
4
1
Apache-2.0
2023-05-10T07:25:44
2021-12-17T11:15:31
Java
UTF-8
Java
false
false
183
java
package org.accounting.system.clients.responses.openaire; import com.fasterxml.jackson.annotation.JsonProperty; public class Total { @JsonProperty("$") public int value; }
3cf3d78ed8d1aa04c9f008379f03dc97c701b9b2
064dbba4f6f35ecf72240ec8e44af0f542fad8f1
/Application/src/main/java/net/jimblackler/yourphotoswatch/PicasaPhotoListEntry.java
44f75019670646afa3c4ea0576b7b40f4ef2d30d
[ "Apache-2.0" ]
permissive
jmgfr/YourPhotosWatch
f70cb830c18a346fc29ee4714d9863f9b72e50e4
72c8148d2e02bc738c029fe5cacadc3fe26c2550
refs/heads/master
2021-01-13T16:07:58.898047
2015-04-22T16:14:40
2015-04-22T16:14:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,270
java
package net.jimblackler.yourphotoswatch; import android.net.Uri; import android.util.JsonReader; import net.jimblackler.yourphotoswatch.ReaderUtil.ReaderException; import java.io.IOException; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; class PicasaPhotoListEntry extends InternetPhotoListEntry { private int height; private String id; private Date publishDate; private int width; private boolean valid; public PicasaPhotoListEntry(JsonReader reader, int position) throws ReaderException { super(position); valid = true; try { reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); switch (name) { case "published": DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS"); String createdTimeString = ReaderUtil.getText(reader); try { publishDate = format.parse(createdTimeString); } catch (ParseException e) { // Ignored by design. } break; case "media$group": reader.beginObject(); while (reader.hasNext()) { name = reader.nextName(); switch (name) { case "media$title": id = ReaderUtil.getText(reader); break; case "media$content": int target = 320; reader.beginArray(); while (reader.hasNext()) { Uri uri = null; int width = 0; int height = 0; String medium = ""; reader.beginObject(); while (reader.hasNext()) { name = reader.nextName(); switch (name) { case "url": String uriString = reader.nextString(); uri = Uri.parse(uriString); break; case "width": width = Integer.parseInt(reader.nextString()); break; case "height": height = Integer.parseInt(reader.nextString()); break; case "medium": if(reader.nextString().equals("video")) { valid = false; } break; default: reader.skipValue(); } } reader.endObject(); int smallest = Math.min(width, height); int best = Math.min(this.width, this.height); if (this.imageUri == null) { this.imageUri = uri; this.width = width; this.height = height; } else if (smallest < target) { if (smallest > best) { this.imageUri = uri; this.width = width; this.height = height; } } else { if (smallest < best) { this.imageUri = uri; this.width = width; this.height = height; } } } reader.endArray(); break; default: reader.skipValue(); } } reader.endObject(); break; default: reader.skipValue(); } } reader.endObject(); } catch (IOException e) { throw new ReaderException(e); } } @Override public String getId() { return "picasa_" + id; } @Override public int getWidth() { return width; } @Override public int getHeight() { return height; } public Date getPublishDate() { return publishDate; } public boolean isValid() { return valid; } }
0e1af4a2a115df018b5a46191a20ba3f2efbc217
12adfd2b7b820b07aa13736ebc181cd4167195d4
/Fundamentals-2.0/JavaFundamentals/Homework/JavaSyntax/src/org/softuni/_12_CharacterMultiplier.java
7f8e0d14cf293446c675495a4488b51ac33b7edf
[ "MIT" ]
permissive
sholev/SoftUni
cf4fc791eb2960f8365dedd003834a06f671a83c
0d5f4b26fa20e5442b91a515f775e80ae6994834
refs/heads/master
2020-04-06T07:05:23.471790
2016-08-08T07:02:49
2016-08-08T07:02:49
42,768,457
1
0
null
null
null
null
UTF-8
Java
false
false
940
java
package org.softuni; import java.util.Scanner; public class _12_CharacterMultiplier { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Enter strings separated by space: "); String stringOne = in.next("[\\S]+"); String stringTwo = in.next("[\\S]+"); int min = Math.min(stringOne.length(), stringTwo.length()); int sum = 0; for (int i = 0; i < min; i++) { sum += stringOne.charAt(i) * stringTwo.charAt(i); } sum += stringOne.length() > stringTwo.length() ? RemainingCharCodes(min, stringOne) : RemainingCharCodes(min, stringTwo); System.out.printf("The sum is: %d", sum); } private static int RemainingCharCodes(int start, String str) { int sum = 0; for (int i = start; i < str.length(); i++) { sum += str.charAt(i); } return sum; } }
fb16ea711d4a1bbdab624b5dd800fc40710ff8e0
42fc76accc986e906bb0b241d00a3da7f36e3e52
/src/main/java/uk/ac/ed/epcc/webapp/session/AppUserTransitionContributor.java
ec257b2436e1439f3cb276811d28df294b482ef8
[ "Apache-2.0" ]
permissive
spbooth/SAFE-WEBAPP
44ec39963432762ae5e90319d944d8dea1803219
0de7e84a664e904b8577fb6b8ed57144740c2841
refs/heads/master
2023-07-08T22:22:48.048148
2023-06-22T07:59:22
2023-06-22T07:59:22
47,343,535
3
0
NOASSERTION
2023-02-22T13:33:54
2015-12-03T16:10:41
Java
UTF-8
Java
false
false
1,488
java
//| Copyright - The University of Edinburgh 2018 | //| | //| 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 uk.ac.ed.epcc.webapp.session; import java.util.Map; import uk.ac.ed.epcc.webapp.forms.transition.Transition; /** Interface for {@link AppUserComposite}s that add additional transitions to the * AppUser transitions. * @author spb * @param <AU> type of AppUser * */ public interface AppUserTransitionContributor<AU extends AppUser> { Map<AppUserKey<AU>,Transition<AU>> getTransitions(AppUserTransitionProvider<AU> provider); }
4a53929ea87385fed7166774d8bc9875c68c543d
3540d46929d2226b39c626118d1b014d15fd7d11
/BlogPessoal/afc-blog/src/main/java/org/generation/afcblog/model/UserLogin.java
2e3152184d21dac7b4d8ad3abf6b99144a0eec3e
[]
no_license
afc-me/generation
f2b0e18e138766e1d4cf2c8b677d3d8c21c3f277
3f38544593dab479ff3bed293ff9f773e7dbbb2e
refs/heads/main
2023-07-02T13:49:35.533688
2021-08-10T00:51:14
2021-08-10T00:51:14
373,679,950
0
0
null
null
null
null
UTF-8
Java
false
false
988
java
package org.generation.afcblog.model; public class UserLogin { private long id; private String nome; private String usuario; private String senha; private String token; private String foto; private String tipo; public long getId() { return id; } public void setId(long id) { this.id = id; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public String getUsuario() { return usuario; } public void setUsuario(String usuario) { this.usuario = usuario; } public String getFoto() { return foto; } public void setFoto(String foto) { this.foto = foto; } public String getTipo() { return tipo; } public void setTipo(String tipo) { this.tipo = tipo; } public String getSenha() { return senha; } public void setSenha(String senha) { this.senha = senha; } public String getToken() { return token; } public void setToken(String token) { this.token = token; } }
c918dd904ed9e15de1eeedf96d12f21dbac75c0b
7eff13f8d1239946b671238ed8ef8e70921f7dbf
/src/dama/Dama.java
e31e56f3a184a9ce8d6d97b9959d893d65abc69f
[]
no_license
lfnascimento/Dama
8c0636c6286bc4d4f7c19b0ade561a7e31c32e89
bfac50fc865e43dc1fafd3bc435cce40a9bf2aa0
refs/heads/master
2021-01-17T07:28:41.295754
2015-06-20T23:17:27
2015-06-20T23:17:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,625
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 dama; import JPlay.GameImage; import JPlay.Keyboard; import JPlay.Mouse; import JPlay.Window; import java.awt.Point; import java.util.ArrayList; import model.Partida; import model.Peca; import util.Regra; import util.Constantes; public class Dama { Window window; Partida partida; GameImage imagemFundo; Mouse mouse; Keyboard keyboard; Peca pecaSelecionada; Peca pecaASerComida; public Dama() { System.out.println("rodando"); carregarObjetos(); loop(); descarregarObjetos(); } private void carregarObjetos() { //A windows SEMPRE deve ser a primeira a ser CARREGADA window = new Window(640, 640); mouse = window.getMouse(); partida = new Partida(); keyboard = window.getKeyboard(); imagemFundo = new GameImage("tabuleiro.jpg"); } private void descarregarObjetos() { mouse = null; partida = null; keyboard = null; imagemFundo = null; //Fecha a janela de jogo window.exit(); } private void loop() { boolean executando = true; boolean esperandoMovimento; while (executando) { esperandoMovimento = true; desenha(); if (mouse.isLeftButtonPressed() == true) { System.out.println("Primeiro Clique"); //Seleciona a peça que o jogador clicou if (existePecaDoJogadorSobMouse(mouse.getPosition(), partida.getJogadorDaVez().getPecas())) { selecionaPeca(retornaPecaSelecionada(mouse.getPosition(), partida.getJogadorDaVez().getPecas())); desenha(); } //Se houver peça selecionada, espera o movimento if (pecaSelecionada != null) { System.out.println("Fazer o movimento de andar"); while (esperandoMovimento) { if (mouse.isLeftButtonPressed() == true) { //Se, em vez de fazer o movimento, decidiu escolher outra peça if (existePecaDoJogadorSobMouse(mouse.getPosition(), partida.getJogadorDaVez().getPecas())) { selecionaPeca(retornaPecaSelecionada(mouse.getPosition(), partida.getJogadorDaVez().getPecas())); desenha(); //Se não selecionou outra peça, então verifica se pode andar } else if (pecaSelecionada != null) { if (!Regra.deveComer(partida.getJogadorAdversario().getPecas(), partida.getJogadorDaVez().getPecas()) && Regra.podeAndar(pecaSelecionada, mouse.getPosition()) && !existePecaSobMouse(mouse.getPosition(), true)) { movimentar(mouse.getPosition()); trocaDeTurno(esperandoMovimento); } else if (existePecaDoJogadorSobMouse(mouse.getPosition(), partida.getJogadorAdversario().getPecas())) { pecaASerComida = retornaPecaSelecionada(mouse.getPosition(), partida.getJogadorAdversario().getPecas()); if (Regra.podeComer(pecaSelecionada, pecaASerComida, partida.getJogadorAdversario().getPecas(), partida.getJogadorDaVez().getPecas())) { comer(); if (!Regra.deveComer(pecaSelecionada, partida.getJogadorDaVez().getPecas(), partida.getJogadorAdversario().getPecas())) { trocaDeTurno(esperandoMovimento); } } } else { System.out.println("A peca " + pecaSelecionada.getId() + " nao pode andar"); } } } } } else { System.out.println("Nenhuma peca selecionada"); } } if (keyboard.keyDown(Keyboard.ESCAPE_KEY) == true) { executando = false; } } } private boolean existePecaSobMouse(Point position, boolean verificandoTodasAsPecas) { if (verificandoTodasAsPecas) { return existePecaDoJogadorSobMouse(position, partida.getJogadorDaVez().getPecas()) && existePecaDoJogadorSobMouse(position, partida.getJogadorAdversario().getPecas()); } else { return existePecaDoJogadorSobMouse(position, partida.getJogadorAdversario().getPecas()); } } private void desenha() { imagemFundo.draw(); partida.desenhaPecasJogadores(); window.display(); } private void trocaDeTurno(boolean esperandoMovimento) { partida.trocaDeTurno(); System.out.println("Vez do jogador " + partida.getJogadorDaVez().getCor()); esperandoMovimento = false; pecaSelecionada = null; pecaASerComida = null; } private void movimentar(Point position) { pecaSelecionada.movimentar(position); desenha(); System.out.println("A peca " + pecaSelecionada.getId() + " andou"); } private void comer() { pecaSelecionada.comer(pecaASerComida); partida.getJogadorAdversario().getPecas().remove(pecaASerComida); pecaASerComida = null; } //Mesmo método que já existia porém rodando para todas as pecas. public boolean existePecaDoJogadorSobMouse(Point mousePosition, ArrayList<Peca> pecas) { for (Peca peca : pecas) { if ((mousePosition.getX() >= peca.getPosition().x) && (mousePosition.getX() <= peca.getPosition().x + peca.getWidth()) && (mousePosition.getY() >= peca.getPosition().y) && (mousePosition.getY() <= peca.getPosition().y + peca.getHeight())) { System.out.println("Peca " + peca.getId() + " Selecionada"); return true; } } return false; } public Peca retornaPecaSelecionada(Point mousePosition, ArrayList<Peca> pecas) { Peca pecaRetorno = null; for (Peca peca : pecas) { if ((mousePosition.getX() >= peca.getPosition().x) && (mousePosition.getX() <= peca.getPosition().x + peca.getWidth()) && (mousePosition.getY() >= peca.getPosition().y) && (mousePosition.getY() <= peca.getPosition().y + peca.getHeight())) { System.out.println("Peca " + peca.getId() + " Selecionada"); pecaRetorno = peca; return pecaRetorno; } } return null; } private void selecionaPeca(Peca retornaPecaSelecionada) { if (pecaSelecionada == null) { pecaSelecionada = retornaPecaSelecionada; pecaSelecionada.selecionaPeca(); } else { pecaSelecionada.deselecionaPeca(); pecaSelecionada = retornaPecaSelecionada; pecaSelecionada.selecionaPeca(); } } }
5a7a94058643a615d23000539381f71766a092f1
139c2f832309cac7bb612807313ee4b7aec1a2e3
/app/src/main/java/ir/ugstudio/vampire/models/MapResponse.java
5f19c89a702379ac716869f3b0e866fa570869ea
[]
no_license
mehdikazemi8/vampire-game
68e71626aabefce43d7368db5be7cc42a0b507be
ac244edc5e18c2c1252323dc553273fba0d89b34
refs/heads/master
2020-07-01T23:16:11.889831
2017-04-12T04:58:55
2017-04-12T04:58:55
201,336,427
0
0
null
null
null
null
UTF-8
Java
false
false
997
java
package ir.ugstudio.vampire.models; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import java.util.List; @JsonIgnoreProperties(ignoreUnknown = true) public class MapResponse extends BaseModel { private List<Tower> towers; private List<User> sheeps; private List<User> vampires; private List<User> hunters; public MapResponse() { } public List<User> getSheeps() { return sheeps; } public void setSheeps(List<User> sheeps) { this.sheeps = sheeps; } public List<Tower> getTowers() { return towers; } public void setTowers(List<Tower> towers) { this.towers = towers; } public List<User> getVampires() { return vampires; } public void setVampires(List<User> vampires) { this.vampires = vampires; } public List<User> getHunters() { return hunters; } public void setHunters(List<User> hunters) { this.hunters = hunters; } }
fd5448b94e9671e782a8aada0f27189634be74fc
73b260d7d6ad9d9abfed68af0dd67de7b71bfdfb
/app/src/main/java/me/guillem/athm2app/Views/SplashScreen.java
3689a0e2323ce659118dc0b3d22ca030ac3e3fff
[]
no_license
GuillemPejo/athm
2720396bddad8d49b27f2c7c18afa30341f97c42
283ca72067eb92547bda9629e272663c4c31f662
refs/heads/master
2023-02-09T04:28:54.927546
2020-12-29T13:06:02
2020-12-29T13:06:02
325,621,727
0
0
null
null
null
null
UTF-8
Java
false
false
1,276
java
package me.guillem.athm2app.Views; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import me.guillem.athm2app.R; public class SplashScreen extends AppCompatActivity { private FirebaseAuth mAuth; @Override protected void onCreate(Bundle savedInstanceState) { setTheme(R.style.Theme_ATHM2APP_Launcher); super.onCreate(savedInstanceState); mAuth = FirebaseAuth.getInstance(); FirebaseUser user = mAuth.getCurrentUser(); Intent go_home = new Intent(this, HomeActivity.class); //mAuth.signOut(); Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { if (mAuth.getCurrentUser()!=null){ go_home.putExtra("user",user); startActivity(go_home); finish(); }else { Intent go_auth = new Intent(getApplicationContext(), AuthActivity.class); startActivity(go_auth); } } }, 2000); } }
c5c70f2b7b7f8fca89986d2d4a0008d3bf42d1bc
4705f50c5442fa35a89f5827516e240f03c95828
/src/main/java/bookstore/repository/BookRepository.java
3ac69da8808b515d595cbe0b3606cd2ac074c78c
[]
no_license
lenshuygh/repositoryExercise
deb763390cf3d524f3883844069d4bb217d38387
256f9d851ef2f92b8074f3c7972c854c80804a35
refs/heads/master
2022-02-28T09:15:48.987756
2019-12-02T22:51:05
2019-12-02T22:51:05
225,191,064
0
0
null
2022-02-10T02:57:56
2019-12-01T16:18:36
Java
UTF-8
Java
false
false
330
java
package bookstore.repository; import bookstore.model.Book; import bookstore.model.BookType; import java.util.List; public interface BookRepository { void addBook(Book book); Book getBookByIsbn(int isbn); void removeBook(Book book); List<Book> getBooksByType(BookType type); List<Book> getAllBooks(); }
fb34d70c1b225a83fc3edaa6ed58b88eca2bd6a2
f56578aa9e7340b2eeec0c908ba3325a2ba565e2
/inexperiments/src/java/inexp/extjsexam/tab/TVSeriesListTab.java
860c4e7b366298cceaf909f6b42fe555aa14d108
[]
no_license
cybernetics/itsnat
420c88b65067be60a9bb2df2d79206f053881bfd
2bdbd88efa534ea2c1afef6810665bfc9b1472ee
refs/heads/master
2021-01-21T03:21:05.823904
2013-12-25T12:18:18
2013-12-25T12:18:18
17,083,257
1
0
null
null
null
null
UTF-8
Java
false
false
1,759
java
package inexp.extjsexam.tab; import inexp.extjsexam.ExtJSExampleDocument; import inexp.extjsexam.model.TVSeries; import javax.swing.table.DefaultTableModel; import org.itsnat.core.NameValue; /** * * @author jmarranz */ public class TVSeriesListTab extends TabContainingTable { public TVSeriesListTab(ExtJSExampleDocument parent) { super(parent); } public String getTitle() { return "TV Series"; } public void fillTableWithData() { TVSeries[] tvSeriesList = extJSDoc.getDataModel().getTVSeriesList(); for(int i = 0; i < tvSeriesList.length; i++) { TVSeries tvSeries = tvSeriesList[i]; addRow(tvSeries); } } public void updateName(String name,Object modelObj) { TVSeries tv = (TVSeries)modelObj; tv.setName(name); extJSDoc.getDataModel().updateTVSeries(tv); } public void updateDescription(String desc,Object modelObj) { TVSeries tv = (TVSeries)modelObj; tv.setDescription(desc); extJSDoc.getDataModel().updateTVSeries(tv); } public void addNewItem(String name,String desc) { TVSeries tvSeries = new TVSeries(name,desc); getDataModel().addTVSeries(tvSeries); addRow(tvSeries); } public void addRow(TVSeries tvSeries) { DefaultTableModel tableModel = (DefaultTableModel)tableComp.getTableModel(); tableModel.addRow(new NameValue[] { new NameValue(tvSeries.getName(),tvSeries), new NameValue(tvSeries.getDescription(),tvSeries) } ); } public void removeItemDB(Object modelObj) { getDataModel().removeTVSeries((TVSeries)modelObj); } }
574299ec005144376f6199dc505c91a3dab23840
4ec118b65711f7b893e2a28ff687af62378433be
/SPRING/MVC Legacy/productBarCode/ProductDemo/src/main/java/com/demoProduct/org/ZXingHelper.java
b530f02cca2642da8fe2ec9e4388960428a994a4
[]
no_license
Runnergo/cursoJava
05a82c972396b562ae6fcb2a12d2bcff92dd7c88
30a15863070fd4336c94a081e88ffcab2684dfec
refs/heads/master
2022-12-26T19:43:30.465395
2019-11-20T18:48:49
2019-11-20T18:48:49
215,093,033
0
0
null
null
null
null
UTF-8
Java
false
false
1,140
java
package com.demoProduct.org; import java.io.ByteArrayOutputStream; import java.util.Hashtable; import com.google.zxing.BarcodeFormat; import com.google.zxing.EncodeHintType; import com.google.zxing.Writer; import com.google.zxing.client.j2se.MatrixToImageWriter; import com.google.zxing.common.BitMatrix; import com.google.zxing.oned.Code128Writer; import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; public class ZXingHelper { public static byte[] getBarCodeImage(String text, int width, int height) { try { Hashtable<EncodeHintType, ErrorCorrectionLevel> hintMap = new Hashtable<EncodeHintType, ErrorCorrectionLevel>(); hintMap.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L); Writer writer = new Code128Writer(); BitMatrix bitMatrix = writer.encode(text, BarcodeFormat.CODE_128, width, height); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); MatrixToImageWriter.writeToStream(bitMatrix, "png", byteArrayOutputStream); return byteArrayOutputStream.toByteArray(); } catch (Exception e) { return null; } } }
390341c79607d29c9210608dca0d2e616739fe7e
447520f40e82a060368a0802a391697bc00be96f
/apks/playstore_apps/com_ubercab/source/giu.java
cda93eca3efac5676302121118198bbb8af6f9c8
[ "Apache-2.0", "GPL-1.0-or-later" ]
permissive
iantal/AndroidPermissions
7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465
d623b732734243590b5f004d167e542e2e2ae249
refs/heads/master
2023-07-19T01:29:26.689186
2019-09-30T19:01:42
2019-09-30T19:01:42
107,239,248
0
0
Apache-2.0
2023-07-16T07:41:38
2017-10-17T08:22:57
null
UTF-8
Java
false
false
479
java
import android.support.v4.view.ViewPager; import io.reactivex.Observer; final class giu extends gij<Integer> { private final ViewPager a; giu(ViewPager paramViewPager) { this.a = paramViewPager; } protected void a(Observer<? super Integer> paramObserver) { giv localGiv = new giv(this.a, paramObserver); paramObserver.onSubscribe(localGiv); this.a.b(localGiv); } protected Integer b() { return Integer.valueOf(this.a.c()); } }
4d1eedb85511a7da7d52e96249926f8dcacb5db3
fcc9868ee8c3c188dc9084b5326b2de81ab1e5e6
/day07_rotate_image/rotate_image.java
12c679584e5ab8ec476c7b2a6974ee4d08d20468
[]
no_license
nhoxbypass/100days-algorithm
5a7ee6834c7b089c20ce457e924a774f93e1cc0d
a239e1faf93e5abbd8541396929d27530d4bee0e
refs/heads/master
2021-06-21T13:36:34.755564
2020-05-17T08:44:18
2020-05-17T08:44:18
98,334,535
0
0
null
null
null
null
UTF-8
Java
false
false
686
java
int[][] rotateImage(int[][] m) { int a,b,c,d; // O(4) additional memory which equals to O(1) for(int i = 0; i < m.length / 2; i++) { for(int j = i; j < m.length - 1 - i; j++) { // Get the need-to-swap items at 4 side a = m[i][j]; b = m[j][m.length - 1 - i]; c = m[m.length - 1 - i][m.length - 1 - j]; d = m[m.length - 1 - j][i]; // Assign new place m[i][j] = d; // d -> a m[j][m.length - 1 - i] = a; // a -> b m[m.length - 1 - i][m.length - 1 - j] = b; // b -> c m[m.length - 1 - j][i] = c; // c -> d } } return m; }
bf5cfae2339bc2552136b67dbec7a6e0f3678921
274b5bd2878142bb9923cc00aac5fe45378c6efb
/app/src/main/java/com/cc/cmarket/fragment/MainFragment.java
d9cfedfde5c20463b7bc1e34efeecc7cb4542fc8
[]
no_license
cuncinc/cMarket_Android
7ad4978e4174cf772681b0caa17561952874fc06
f02821806b5ddf91032a19c19cab89ce8c20758f
refs/heads/master
2023-05-29T18:50:52.251799
2021-06-13T10:00:07
2021-06-13T10:00:07
376,503,858
0
0
null
null
null
null
UTF-8
Java
false
false
2,514
java
package com.cc.cmarket.fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentPagerAdapter; import androidx.viewpager.widget.ViewPager; import com.cc.cmarket.R; import com.google.android.material.tabs.TabLayout; import java.util.ArrayList; import java.util.List; public class MainFragment extends Fragment { private static MainFragment fragment; // ViewPager mViewpager; // TabLayout mTabs; // static List<Fragment> frags; // static // { // frags = new ArrayList<>(); // frags.add(FragmentOne.getInstance()); // frags.add(FragmentTwo.getInstance()); // } // public static Fragment getInstance() // { // if (fragment == null) // { // synchronized (MainFragment.class) // { // if (fragment == null) // { // fragment = new MainFragment(); // } // } // } // return fragment; // } @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { //把Fragment添加到列表中,以Tab展示 return inflater.inflate(R.layout.fragment_main, container, false); } @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); // mTabs = view.findViewById(R.id.tabs); // mViewpager = view.findViewById(R.id.mviewpager); // mViewpager.setAdapter(new FragmentPagerAdapter(getFragmentManager()) // { // @NonNull // @Override // public Fragment getItem(int position) // { // return frags.get(position); // } // // @Override // public int getCount() // { // return frags.size(); // } // @Nullable // @Override // public CharSequence getPageTitle(int position) // { // return frags.get(position).getClass().getName(); // } // }); // mViewpager.setOffscreenPageLimit(5); // mTabs.setupWithViewPager(mViewpager);//与TabLayout绑定 } }
49a4449710c272d953cb22c6f2ff409455ba5fe2
e5e84b854d63f3ad948620536d2b2fdc64750d93
/src/main/java/br/ufsm/piveta/system/entities/Author.java
c7a72decc532be2df3c7f0c17c41baf3dc892abe
[ "MIT" ]
permissive
fapedroso/another-book-in-the-shelf
1af4048a424bf57c2d671a4009a8a41a3c5dac5d
347b322dd07e7cee6da762342307286245d37050
refs/heads/master
2021-07-08T09:35:13.163549
2017-09-24T02:01:01
2017-09-24T02:01:01
104,111,666
0
0
null
null
null
null
UTF-8
Java
false
false
4,199
java
package br.ufsm.piveta.system.entities; import org.jetbrains.annotations.Nullable; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; @SuppressWarnings({"WeakerAccess", "unused"}) public class Author { private Connection connection; private Integer id; private String name; Author(Integer id, String name){ this.id = id; this.name = name; } @Nullable protected static Author getFromResultSet(ResultSet resultSet) throws SQLException { if(resultSet.next()){ return new Author( resultSet.getInt(1), // id resultSet.getString(2) // name ); }else return null; } protected static List<Author> getListFromPreparedStatement(PreparedStatement preparedStatement) throws SQLException { List<Author> authors = new ArrayList<>(); ResultSet resultSet = preparedStatement.executeQuery(); Author author; while ((author = getFromResultSet(resultSet)) != null) { author.setConnection(preparedStatement.getConnection()); authors.add(author); } return authors; } protected static Author getFromPreparedStatement(PreparedStatement preparedStatement) throws SQLException { ResultSet resultSet = preparedStatement.executeQuery(); Author author = getFromResultSet(resultSet); if (author != null) { author.setConnection(preparedStatement.getConnection()); } return author; } protected static Author get(Connection connection,int id) throws SQLException { PreparedStatement preparedStatement = connection.prepareStatement( "SELECT id, name FROM authors WHERE id = ?"); preparedStatement.setInt(1, id); return getFromPreparedStatement(preparedStatement); } protected static Author get(Connection connection,String name) throws SQLException { PreparedStatement preparedStatement = connection.prepareStatement( "SELECT id, name FROM authors WHERE name = ?"); preparedStatement.setString(1, name); return getFromPreparedStatement(preparedStatement); } protected static List<Author> getAll(Connection connection,String name) throws SQLException { PreparedStatement preparedStatement = connection.prepareStatement( "SELECT id, name FROM authors"); return getListFromPreparedStatement(preparedStatement); } @Nullable public static Author create(Connection connection, String name) throws SQLException { PreparedStatement preparedStatement = connection.prepareStatement( "INSERT INTO authors (name) values (?)"); preparedStatement.setString(1,name); if (!preparedStatement.execute()) return null; ResultSet resultSet = preparedStatement.getGeneratedKeys(); if (resultSet.next()){ int id = resultSet.getInt(1); return new Author(id, name); } else return null; } public boolean save() throws SQLException { PreparedStatement preparedStatement = getConnection().prepareStatement( "UPDATE authors SET name = ? WHERE id = ?"); preparedStatement.setString(1, getName()); preparedStatement.setInt(2, getId()); return preparedStatement.executeUpdate() == 1; } public boolean remove() throws SQLException { PreparedStatement preparedStatement = getConnection().prepareStatement( "DELETE FROM authors WHERE id = ?"); preparedStatement.setInt(1, getId()); return preparedStatement.execute(); } public Integer getId() { return id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Connection getConnection() { return connection; } public void setConnection(Connection connection) { this.connection = connection; } }
af91658d5d6aacde79f39b3dc2543dff924fac70
3f6d82c0c2be966fe723fa4a3c6b5f540231e265
/server/src/main/java/pl/edu/agh/sius/server/pojo/OperationStatus.java
bd938c65f2cddf2adff919952030e52e97b201cc
[]
no_license
bburkot/SIUS
0e6f9a5a8c9dd843f6551796a1822789d1dc7d76
d1e26cf4a9c32bed0e324574fe30ee673f692228
refs/heads/master
2016-08-05T05:52:32.251845
2015-06-08T10:11:09
2015-06-08T10:11:09
35,028,902
0
0
null
null
null
null
UTF-8
Java
false
false
312
java
package pl.edu.agh.sius.server.pojo; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlEnumValue; @XmlEnum public enum OperationStatus{ @XmlEnumValue("SUCCEED") SUCCEED, @XmlEnumValue("WARN") WARN, @XmlEnumValue("ERROR") ERROR; private OperationStatus(){} }
9701e7093ff366e4657115467623cb69d3ab5936
c2e2022be343747a7bfa9845cfcb1adb6f6101a5
/architect_singleton/src/androidTest/java/architect/rui/com/architect_singleton/ExampleInstrumentedTest.java
0a80d28acdba1d261ec84cfef836453ccb48b960
[]
no_license
zhenqinrui/architecture
66c3530d7b696be81be9bb0720627b0992ac1581
cc679679b67fcb494409349155f8a2184c8ce4d5
refs/heads/master
2021-09-10T11:20:56.261165
2018-03-25T14:19:53
2018-03-25T14:19:53
119,617,522
0
0
null
null
null
null
UTF-8
Java
false
false
778
java
package architect.rui.com.architect_singleton; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("architect.rui.com.architect_singleton", appContext.getPackageName()); } }
2ffc55cb606e5eb9a50648edec6190db25b6b6a5
7c4ece985a9b727e551d51b4a63bd919fc938ac0
/RxTools-library/src/main/java/com/vondear/rxtools/recyclerview/RxLinearLayoutManager.java
29531e096b17987927348887102c1f665e0235e1
[ "Apache-2.0" ]
permissive
duboAndroid/RxTools-master
caf57dbd9ae6a7d2463b2a79012dc0a859de2b6a
dfa9549ce577dac661d0360af7f90a4dd16fa232
refs/heads/master
2021-07-17T13:54:48.816686
2017-10-25T10:37:48
2017-10-25T10:37:48
108,255,984
166
41
null
null
null
null
UTF-8
Java
false
false
1,113
java
package com.vondear.rxtools.recyclerview; import android.content.Context; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.AttributeSet; /** * Created by Vondear on 2017/6/8. */ /** * 官方的BUG * 解决 IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter */ public class RxLinearLayoutManager extends LinearLayoutManager { public RxLinearLayoutManager(Context context) { super(context); } public RxLinearLayoutManager(Context context, int orientation, boolean reverseLayout) { super(context, orientation, reverseLayout); } public RxLinearLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); } @Override public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) { try { super.onLayoutChildren(recycler, state); } catch (IndexOutOfBoundsException e) { e.printStackTrace(); } } }
6aa85ff6a41b3ad155782e96c22d3160a2757dc1
4686d486ff0db01b5604b1561862b60a54f91480
/Java_Data_Structures/lab5_Queues/QueueADT.java
34b68ccded6bcbf3a9c076b1ae5427a7230e5314
[]
no_license
chosun41/codeportfolio
1ed188c3b99e687d02f5eaeb6fb0b90ce4be77cc
3fdfc90937a642a091688d5903e435067c8499b3
refs/heads/master
2021-01-13T14:45:56.348915
2017-06-18T06:04:38
2017-06-18T06:04:38
94,666,938
0
1
null
null
null
null
UTF-8
Java
false
false
1,697
java
//Michael Cho //CSC 236-64 //Lab 7.1 public interface QueueADT<T> { public void initializequeue(); //Method to initialize the queue to an empty state //Postcondition: The queue is initialized. public boolean isemptyqueue(); //Method to determine whether the queue is empty. //Postcondition:Returns true if the queue is empty //otherwise, returns false public boolean isfullqueue(); //Method to determine whether the queue is full //Postcondtion: Returns true if the queue is full //otherwise, returns false public double count(); //Method to count length of queue public T front() throws QueueUnderflowException; //Method to return the first element of the queue. //Precondition: The queue exists and is not empty. //Postcondition: If the queue is empty, the method throws //queueunderflow exception, otherwise a reference to the //first element of the queue is returned public T back() throws QueueUnderflowException; //Method to return the last element of the queue. //Precondition: The queue exists and is not empty //Postcondition: If the queue is empty, the method throws //queueunderflowexception, otherwise a reference to the //last element of the queue is returned public void enqueue(T queueelement) throws QueueOverflowException; //Method to add queueelement to the queue //Precondition: The queue exists and is not ull //Postcondition: The queue is changed and queueelement is add to the queue public T dequeue() throws QueueUnderflowException; //Method to remove the first element of the queue //Precondition: The queue exists and is not empty //Postcondition: The queue is changed and the first element is //removed from queue and returned }
5f79a9e0a8eed88d22fc11290dcaf93d83323352
f4097465637c42ba5e71648d6337acae96c9cf8e
/src/main/java/tfg/microservice/user/exception/AttemptAuthenticationException.java
53d923937c9f73f1634cc6f90cda429c094b8bca
[]
no_license
manuexcd/userMicroservice
a6bb8115421973ec623a6dd0c285d3b01c59b7af
4cffd1b61b3d3660b8f9a7e6a8e37d4a0bd970d5
refs/heads/master
2023-03-14T09:14:41.446686
2022-09-16T08:41:02
2022-09-16T08:41:02
235,818,074
0
0
null
2023-02-22T07:51:57
2020-01-23T14:59:50
Java
UTF-8
Java
false
false
235
java
package tfg.microservice.user.exception; public class AttemptAuthenticationException extends Exception { private static final long serialVersionUID = 7319980745274300196L; public AttemptAuthenticationException() { super(); } }
dbe459f19f50076e35b38879df0c87d73f8cf09b
8e30a2857b8b987d6168a4579ffc7acd5d3582b1
/src/observer/CBoyFriend.java
9fe2ac098772c71de79163ad485ebbd278584c7b
[]
no_license
tommy770221/PracticeJava
0d2f6a1f677c299ae5fa9e626cfefebcc7ae00e4
77d7131e8d05d4700a12596e3610e61444e226a6
refs/heads/master
2020-04-03T09:25:46.003066
2018-10-25T03:48:58
2018-10-25T03:48:58
155,164,566
0
0
null
null
null
null
UTF-8
Java
false
false
273
java
package observer; /** * Created by Tommy on 2018/10/9. */ public class CBoyFriend implements IBoyFriend { @Override public void update(String msg) { if("我生病了".equals(msg)){ System.out.println("先等等,待會到"); } } }
bd128e2267559282c5cf9c6cd797e928bd56a5fa
724255a38149262241fc376773421cf841cf2cfd
/src/main/java/com/awews/person/User.java
776e63e59d737ea47ba18b161197a251de6a1651
[]
no_license
dapperAuteur/java-spring-palabras-api
42ebfaac601827d4f9359a3867a033c601d31566
f2a56e6deb3eac874c9c9592c9bf88b7952e989e
refs/heads/master
2020-03-17T02:41:23.743382
2018-05-29T20:54:00
2018-05-29T20:54:00
133,200,920
0
0
null
null
null
null
UTF-8
Java
false
false
4,009
java
package com.awews.person; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.Document; @Document(collection = "users") public class User { @Id private String id; private String email; private String userName; private Integer role; private String password; private String profileImageUrl; public User() { } /** * @param id * @param email * @param userName * @param role * @param password * @param profileImageUrl */ public User(String id, String email, String userName, Integer role, String password, String profileImageUrl) { super(); this.id = id; this.email = email; this.userName = userName; this.role = role; this.password = password; this.profileImageUrl = profileImageUrl; } /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override public String toString() { return "User [id=" + id + ", email=" + email + ", userName=" + userName + ", role=" + role + ", password=" + password + ", profileImageUrl=" + profileImageUrl + "]"; } /** * @return the id */ public String getId() { return id; } /** * @param id the id to set */ public void setId(String id) { this.id = id; } /** * @return the email */ public String getEmail() { return email; } /** * @param email the email to set */ public void setEmail(String email) { this.email = email; } /** * @return the userName */ public String getUserName() { return userName; } /** * @param userName the userName to set */ public void setUserName(String userName) { this.userName = userName; } /** * @return the role */ public Integer getRole() { return role; } /** * @param role the role to set */ public void setRole(Integer role) { this.role = role; } /** * @return the password */ public String getPasswordHash() { return password; } /** * @param password the password to set */ public void setPasswordHash(String password) { this.password = password; } /** * @return the profileImageUrl */ public String getProfileImageUrl() { return profileImageUrl; } /** * @param profileImageUrl the profileImageUrl to set */ public void setProfileImageUrl(String profileImageUrl) { this.profileImageUrl = profileImageUrl; } /* (non-Javadoc) * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((email == null) ? 0 : email.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((password == null) ? 0 : password.hashCode()); result = prime * result + ((profileImageUrl == null) ? 0 : profileImageUrl.hashCode()); result = prime * result + ((role == null) ? 0 : role.hashCode()); result = prime * result + ((userName == null) ? 0 : userName.hashCode()); return result; } /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; User other = (User) obj; if (email == null) { if (other.email != null) return false; } else if (!email.equals(other.email)) return false; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; if (password == null) { if (other.password != null) return false; } else if (!password.equals(other.password)) return false; if (profileImageUrl == null) { if (other.profileImageUrl != null) return false; } else if (!profileImageUrl.equals(other.profileImageUrl)) return false; if (role == null) { if (other.role != null) return false; } else if (!role.equals(other.role)) return false; if (userName == null) { if (other.userName != null) return false; } else if (!userName.equals(other.userName)) return false; return true; } }
56bbb9a9aa660dd25944adff3291306d64994593
8fa2414dd0af8a449acbd817dc96791f5f228e60
/library/src/main/java/com/github/sdankbar/qml/persistence/QMLThreadPersistanceTask.java
24369bce8627a5f1a2ce3007f2045c7514a9f44c
[ "MIT" ]
permissive
sdankbar/jaqumal
2fb80d9e79649fee0a6faf8593c5a65b025a95e8
28ca2f432f7d7ce8b792eef8e60992dbf75c2652
refs/heads/master
2023-07-03T22:35:13.204983
2023-01-06T14:07:57
2023-01-06T14:07:57
174,902,960
7
0
MIT
2023-06-14T22:25:53
2019-03-11T01:18:28
Java
UTF-8
Java
false
false
6,308
java
/** * The MIT License * Copyright © 2020 Stephen Dankbar * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.github.sdankbar.qml.persistence; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.util.Map; import java.util.Objects; import java.util.concurrent.ScheduledFuture; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.github.sdankbar.qml.models.list.JQMLListModel; import com.github.sdankbar.qml.models.singleton.JQMLSingletonModel; import com.github.sdankbar.qml.models.table.JQMLTableModel; import com.google.common.collect.ImmutableSet; import com.google.common.io.Files; public class QMLThreadPersistanceTask implements Runnable { private static final Logger log = LoggerFactory.getLogger(QMLThreadPersistanceTask.class); private final File persistenceDirectory; private final Map<String, QMLThreadPersistanceTask> scheduled; private final JQMLSingletonModel<?> singletonModel; private final JQMLListModel<?> listModel; private final JQMLTableModel<?> tableModel; private final ImmutableSet<String> rootKeysToPersist; private ScheduledFuture<?> qtThreadFuture = null; private boolean isRunning = false; public QMLThreadPersistanceTask(final File persistenceDirectory, final JQMLSingletonModel<?> singletonModel, final Map<String, QMLThreadPersistanceTask> scheduled) { this.persistenceDirectory = Objects.requireNonNull(persistenceDirectory, "persistenceDirectory is null"); this.scheduled = Objects.requireNonNull(scheduled, "scheduled is null"); this.singletonModel = Objects.requireNonNull(singletonModel, "singletonModel is null"); rootKeysToPersist = ImmutableSet.of(); listModel = null; tableModel = null; scheduled.put(singletonModel.getModelName(), this); } public QMLThreadPersistanceTask(final File persistenceDirectory, final JQMLListModel<?> listModel, final Map<String, QMLThreadPersistanceTask> scheduled, final ImmutableSet<String> rootKeysToPersist) { this.persistenceDirectory = Objects.requireNonNull(persistenceDirectory, "persistenceDirectory is null"); this.scheduled = Objects.requireNonNull(scheduled, "scheduled is null"); singletonModel = null; this.listModel = Objects.requireNonNull(listModel, "listModel is null"); tableModel = null; this.rootKeysToPersist = Objects.requireNonNull(rootKeysToPersist, "rootKeysToPersist is null"); scheduled.put(listModel.getModelName(), this); } public QMLThreadPersistanceTask(final File persistenceDirectory, final JQMLTableModel<?> tableModel, final Map<String, QMLThreadPersistanceTask> scheduled, final ImmutableSet<String> rootKeysToPersist) { this.persistenceDirectory = Objects.requireNonNull(persistenceDirectory, "persistenceDirectory is null"); this.scheduled = Objects.requireNonNull(scheduled, "scheduled is null"); singletonModel = null; listModel = null; this.tableModel = Objects.requireNonNull(tableModel, "listModel is null"); this.rootKeysToPersist = Objects.requireNonNull(rootKeysToPersist, "rootKeysToPersist is null"); scheduled.put(tableModel.getModelName(), this); } public void setFuture(final ScheduledFuture<?> future) { qtThreadFuture = Objects.requireNonNull(future, "future is null"); } public void finishImmediately() { if (!isRunning) { // Not run yet so cancel and run synchronously qtThreadFuture.cancel(false); run(); } } @Override public void run() { isRunning = true; if (singletonModel != null) { qtThreadSaveModel(singletonModel); } else if (listModel != null) { qtThreadSaveModel(listModel); } else {// tableModel != null qtThreadSaveModel(tableModel); } } private void qtThreadSaveModel(final JQMLSingletonModel<?> model) { scheduled.remove(model.getModelName()); final ByteArrayOutputStream stream = new ByteArrayOutputStream(); try { model.serialize(stream); saveModel(model.getModelName(), stream.toByteArray()); } catch (final IOException e) { log.warn("Failed to persist " + model.getModelName(), e); } } private void qtThreadSaveModel(final JQMLListModel<?> model) { scheduled.remove(model.getModelName()); final ByteArrayOutputStream stream = new ByteArrayOutputStream(); try { model.serialize(stream, null, rootKeysToPersist); saveModel(model.getModelName(), stream.toByteArray()); } catch (final IOException e) { log.warn("Failed to persist " + model.getModelName(), e); } } private void qtThreadSaveModel(final JQMLTableModel<?> model) { scheduled.remove(model.getModelName()); final ByteArrayOutputStream stream = new ByteArrayOutputStream(); try { model.serialize(stream, rootKeysToPersist); saveModel(model.getModelName(), stream.toByteArray()); } catch (final IOException e) { log.warn("Failed to persist " + model.getModelName(), e); } } private void saveModel(final String modelName, final byte[] data) { try { persistenceDirectory.mkdirs(); Files.write(data, new File(persistenceDirectory, modelName + ".json")); } catch (final IOException e) { log.warn("Failed to persist " + modelName, e); } } }
[ "dankb@LAPTOP-2J6L4TTB" ]
dankb@LAPTOP-2J6L4TTB
2d6ff56554bcf2b2a5a86217ac2e0c739e963704
d0a6b19df8fc22e8c5f1c3196c6c0e2249f098f4
/src/com/objis/cameroun/gej/presentation/ServletModifierEnseignant.java
fb3e18a180d10a6683800d7479b856c4acd055f7
[]
no_license
KhalilGitHub/Schools_Management_Java_JPA_Persistance
99530ffa04ca985107ca27c5d930eee0784a999d
43341cf9ac41b12fc927a3b556c3e9525cf755e2
refs/heads/master
2020-06-15T20:06:32.644556
2019-07-05T09:45:04
2019-07-05T09:45:04
195,382,168
0
0
null
null
null
null
UTF-8
Java
false
false
7,681
java
package com.objis.cameroun.gej.presentation; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.math.BigDecimal; import java.sql.Blob; import java.sql.SQLException; import java.text.SimpleDateFormat; import java.util.Date; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.Part; import javax.sql.rowset.serial.SerialBlob; import javax.sql.rowset.serial.SerialException; import com.objis.cameroun.gej.domaine.Eleve; import com.objis.cameroun.gej.domaine.Enseignant; import com.objis.cameroun.gej.domaine.Inscription; import com.objis.cameroun.gej.domaine.Recrutement; import com.objis.cameroun.gej.service.IService; import com.objis.cameroun.gej.service.Service; /** * Servlet implementation class ServletModifierEnseignant */ @WebServlet("/ServletModifierEnseignant") public class ServletModifierEnseignant extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public ServletModifierEnseignant() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { EntityManagerFactory emf = (EntityManagerFactory)getServletContext().getAttribute("emf"); EntityManager em = emf.createEntityManager(); IService iservice = new Service(em); //Connection conn = MyUtils.getStoredConnection(request); //Connection conn = null; //IService iService = null; String matricule = (String) request.getParameter("matricule"); Recrutement recrutement = null; String errorString = null; try { //iService = new Service(); //conn = ConnectInscription.getMySQLConnection(); recrutement = iservice.findRecrutementService(matricule); } catch (SQLException e) { e.printStackTrace(); errorString = e.getMessage(); } // If no error. // The Inscription does not exist to edit. // Redirect to InscriptionList page. if (errorString != null && recrutement == null) { response.sendRedirect(request.getServletPath() + "/ServletListEnseignants"); return; } // Store errorString in request attribute, before forward to views. request.setAttribute("errorString", errorString); request.setAttribute("recrutement", recrutement); //System.out.println(inscription); RequestDispatcher dispatcher = request.getServletContext().getRequestDispatcher("/modifierEnseignant.jsp"); dispatcher.forward(request, response); } // After the user modifies the Inscription information, and click Submit. // This method will be executed. @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { EntityManagerFactory emf = (EntityManagerFactory)getServletContext().getAttribute("emf"); EntityManager em = emf.createEntityManager(); IService iservice = new Service(em); int idRecrut = 0; int idEnseig = 0; int nombreMatiere = 0; int nombreHeure = 0; BigDecimal fraisParHeure = null; BigDecimal salaire = null; Date date = null; Recrutement recrutement = null; Enseignant enseignant = null; String idRecrutStr = (String) request.getParameter("idRecrut"); String idEnseigStr = (String) request.getParameter("idEnseig"); String matricule = (String) request.getParameter("matricule"); String nom = (String) request.getParameter("nom"); String prenom = (String) request.getParameter("prenom"); String genre = (String) request.getParameter("genre"); String adresse = (String) request.getParameter("adresse"); String nombreMatieresStr = (String) request.getParameter("nombreMatieres"); String premiereMatiere = (String) request.getParameter("premiereMatiere"); String deuxiemeMatiere = (String) request.getParameter("deuxiemeMatiere"); String nombreHeureStr = (String) request.getParameter("nombreHeure"); String fraisParHeureStr = (String) request.getParameter("fraisParHeure"); String dateStr = (String) request.getParameter("date"); System.out.println(idRecrutStr + " " + idEnseigStr + " " + nom + " " + nombreHeureStr); InputStream inputStream = null; Part filePart = request.getPart("image"); if (filePart != null) { inputStream = filePart.getInputStream(); } byte[] contents; ByteArrayOutputStream output = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int count; while ((count = inputStream.read(buffer)) != -1) { output.write(buffer, 0, count); } contents = output.toByteArray(); Blob blob = null; try { blob = new SerialBlob(contents); } catch (SerialException e) {e.printStackTrace();} catch (SQLException e) {e.printStackTrace();} try { idRecrut = Integer.parseInt(idRecrutStr); idEnseig = Integer.parseInt(idEnseigStr); nombreMatiere = Integer.parseInt(nombreMatieresStr); nombreHeure = Integer.parseInt(nombreHeureStr); fraisParHeure = convertStringToBigDecimal(fraisParHeureStr); date = new SimpleDateFormat("mm/dd/yyyy").parse(dateStr); salaire = fraisParHeure.multiply(new BigDecimal(nombreHeure * 4)); } catch (Exception e) { e.printStackTrace(); } enseignant = new Enseignant(idEnseig , nom, prenom, genre, adresse , nombreMatiere, premiereMatiere, deuxiemeMatiere); recrutement = new Recrutement(idRecrut, nombreHeure, matricule, enseignant, fraisParHeure, salaire, date, blob); String errorString = null; try { iservice.updateRecrutementService(enseignant, recrutement); } catch (SQLException e) { e.printStackTrace(); errorString = e.getMessage(); } // Store infomation to request attribute, before forward to views. request.setAttribute("errorString", errorString); request.setAttribute("recrutement", recrutement); // If error, forward to Edit page. if (errorString != null) { RequestDispatcher dispatcher = request.getServletContext().getRequestDispatcher("/modifierEnseignant.jsp"); dispatcher.forward(request, response); } // If everything nice. // Redirect to the Inscription listing page. else { response.sendRedirect(request.getContextPath() + "/ServletListEnseignants"); } } protected BigDecimal convertStringToBigDecimal(String bdStr) { BigDecimal result = null; try { double valueDouble = Double.parseDouble(bdStr); result = BigDecimal.valueOf(valueDouble); } catch(Exception ex) { System.out.println("Valeur invalide. Valeur par defaut 0.0"); result = BigDecimal.valueOf(0.0); } return result; } }
7151f1bcd2d96e73aecfd41da99ead4500e2b0b1
646483088e3bc52afc03877c437f56f00ba2389d
/app/src/main/java/com/peixing/baidumapdemo/MainActivity.java
7c360d79ec586d2eca64adb84d18c3c81e8eb1df
[]
no_license
didiaodazhong/BaiduMapDemo
f7e5f2af19ad10936305869781f045b87afd5d10
a9be4d5735074bff2970312b909cbe01a35e4e9a
refs/heads/master
2021-01-13T03:01:48.932802
2016-12-21T13:34:54
2016-12-21T13:34:54
77,045,996
0
0
null
null
null
null
UTF-8
Java
false
false
3,275
java
package com.peixing.baidumapdemo; import android.content.Intent; import android.graphics.Typeface; import android.os.Build; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.view.WindowManager; import android.widget.Button; import android.widget.ListView; import android.widget.RelativeLayout; import android.widget.TextView; import com.baidu.mapapi.map.BaiduMap; import com.baidu.mapapi.map.BitmapDescriptor; import com.baidu.mapapi.map.BitmapDescriptorFactory; import com.baidu.mapapi.map.CircleOptions; import com.baidu.mapapi.map.MapPoi; import com.baidu.mapapi.map.MapStatusUpdate; import com.baidu.mapapi.map.MapStatusUpdateFactory; import com.baidu.mapapi.map.MapView; import com.baidu.mapapi.map.Marker; import com.baidu.mapapi.map.MarkerOptions; import com.baidu.mapapi.map.OverlayOptions; import com.baidu.mapapi.map.Stroke; import com.baidu.mapapi.map.TextOptions; import com.baidu.mapapi.model.LatLng; public class MainActivity extends AppCompatActivity implements View.OnClickListener { private static final String TAG = "MainActivity"; private RelativeLayout activityMain; private MapView baiduMap; private TextView textInfo; private ListView listview; private Button searchDrive; private Button locate; private Button btNormal; private Button searchArea; //地图属性 MapStatusUpdate mapStatusUpdate; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //设置状态栏颜色随着activity设置颜色渐变 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); } setContentView(R.layout.activity_main); btNormal = (Button) findViewById(R.id.bt_normal); searchArea = (Button) findViewById(R.id.search_area); locate = (Button) findViewById(R.id.locate); searchDrive = (Button) findViewById(R.id.search_drive); // activityMain = (RelativeLayout) findViewById(R.id.activity_main); baiduMap = (MapView) findViewById(R.id.baidu_Map); // textInfo = (TextView) findViewById(R.id.text_Info); // listview = (ListView) findViewById(R.id.listview); btNormal.setOnClickListener(this); searchArea.setOnClickListener(this); searchDrive.setOnClickListener(this); locate.setOnClickListener(this); } @Override public void onClick(View view) { switch (view.getId()) { case R.id.bt_normal: startActivity(new Intent(MainActivity.this, MapActivity.class)); break; case R.id.search_area: startActivity(new Intent(MainActivity.this, PoiSearchActivity.class)); break; case R.id.search_drive: startActivity(new Intent(MainActivity.this, DrivingSearchActivity.class)); break; case R.id.locate: startActivity(new Intent(MainActivity.this, MyLocationActivity.class)); break; } } }
6532be698199f6eb19bc87621705766c2530e5fe
7a48d101d9e037e328a7a0899b20cc252bda2717
/src/Vista/SalidaCamara.java
e0367d9373b7b99ede868109e8ad379a0ab2cb3d
[]
no_license
MartiMarch/Sistema-Camara-Seguridad-1.0
ba227888ce64524df1931b3b0f205b51066e7bb3
9bcea89368fed6a110f7c2968d9c7ac1da9bbb8c
refs/heads/master
2023-06-09T16:23:06.201077
2021-06-28T15:04:21
2021-06-28T15:04:21
357,499,243
0
0
null
null
null
null
UTF-8
Java
false
false
3,072
java
package Vista; import java.awt.Graphics; import java.awt.image.BufferedImage; import java.awt.image.DataBufferByte; import javax.swing.JOptionPane; import org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.videoio.VideoCapture; public class SalidaCamara extends javax.swing.JPanel implements Runnable{ static { System.loadLibrary(Core.NATIVE_LIBRARY_NAME); System.loadLibrary("opencv_java451"); System.loadLibrary("opencv_videoio_ffmpeg451_64"); } private VideoCapture video; private Mat frame; private BufferedImage buffer; private String url; private int altura = 0; private int anchura = 0; public SalidaCamara(String url) { this.url = url; initComponents(); new Thread(this).start(); } @Override public void paintComponent(Graphics g){ super.paintComponent(g); if(!(buffer == null)){ g.drawImage(buffer, 0, 0, buffer.getWidth(), buffer.getHeight(), null); } return; } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 400, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 300, Short.MAX_VALUE) ); }// </editor-fold>//GEN-END:initComponents @Override public void run() { video = new VideoCapture(url); if(video.isOpened()) { while(true) { frame = new Mat(); video.read(frame); if(!frame.empty()) { MatToBufferedImage(frame); this.repaint(); } frame.release(); } } else { JOptionPane.showMessageDialog(null,"No se pudo acceder a la cámara"); } } private void MatToBufferedImage(Mat frame) { anchura = frame.width(); altura = frame.height(); int canales = frame.channels(); byte[] source = new byte[anchura * altura * canales]; frame.get(0, 0, source); buffer = new BufferedImage(anchura, altura, BufferedImage.TYPE_3BYTE_BGR); final byte[] salida = ((DataBufferByte) buffer.getRaster().getDataBuffer()).getData(); System.arraycopy(source, 0, salida, 0, source.length); } public int getAltura() { return buffer.getHeight(); } public int getAnchura() { return buffer.getWidth(); } // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables }
9f362ae5d1ced24b09b4a09acec63755b718bed4
af88bd1d62f6d481fbf58ea9231fb32207f36f90
/Project/Smiley/app/src/test/java/com/peikova/gery/happy/ExampleUnitTest.java
54a3971ef3d9f3e6c6d0734e6e663e7fe1709f16
[ "MIT" ]
permissive
HappinessBot/AndroidApp
93a5d587d34523d6ec0060dd906102fa8c8d6227
79a1ab978c958ce5b44522475e0b79dca0153de2
refs/heads/master
2021-01-01T04:07:23.345913
2017-07-14T13:33:51
2017-07-14T13:33:51
97,121,478
0
0
null
null
null
null
UTF-8
Java
false
false
416
java
package com.peikova.gery.happy; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
d438524fc483c283eaf3ba6e69b3b3f5e5e12b42
4e7c597e78f01fe1c14fc4cbb67dc4379a8c5939
/mambo-protocol/src/main/java/org/mambo/protocol/messages/KrosmasterTransferRequestMessage.java
e45665856e5b440b2df41aa97aa70b13b5b5c0d3
[]
no_license
Guiedo/Mambo
c24e4836f20a1028e61cb7987ad6371348aaf0fe
8fb946179b6b00798010bda8058430789644229d
refs/heads/master
2021-01-18T11:29:43.048990
2013-05-25T17:33:37
2013-05-25T17:33:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
810
java
// Generated on 05/08/2013 19:37:59 package org.mambo.protocol.messages; import java.util.*; import org.mambo.protocol.types.*; import org.mambo.protocol.enums.*; import org.mambo.protocol.*; import org.mambo.core.io.*; public class KrosmasterTransferRequestMessage extends NetworkMessage { public static final int MESSAGE_ID = 6349; @Override public int getNetworkMessageId() { return MESSAGE_ID; } public String uid; public KrosmasterTransferRequestMessage() { } public KrosmasterTransferRequestMessage(String uid) { this.uid = uid; } @Override public void serialize(Buffer buf) { buf.writeString(uid); } @Override public void deserialize(Buffer buf) { uid = buf.readString(); } }
4abb8da42b8117d682cda670976a4ee500127989
ecbb90f42d319195d6517f639c991ae88fa74e08
/XmlTooling/src/org/opensaml/xml/signature/impl/X509SerialNumberMarshaller.java
4231205ca7f3c42f5b804e313f054a602cbbfd4d
[ "MIT" ]
permissive
Safewhere/kombit-service-java
5d6577984ed0f4341bbf65cbbace9a1eced515a4
7df271d86804ad3229155c4f7afd3f121548e39e
refs/heads/master
2020-12-24T05:20:59.477842
2018-08-23T03:50:16
2018-08-23T03:50:16
36,713,383
0
1
MIT
2018-08-23T03:51:25
2015-06-02T06:39:09
Java
UTF-8
Java
false
false
1,847
java
/* * Licensed to the University Corporation for Advanced Internet Development, * Inc. (UCAID) under one or more contributor license agreements. See the * NOTICE file distributed with this work for additional information regarding * copyright ownership. The UCAID 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.opensaml.xml.signature.impl; import org.opensaml.xml.XMLObject; import org.opensaml.xml.io.AbstractXMLObjectMarshaller; import org.opensaml.xml.io.MarshallingException; import org.opensaml.xml.signature.X509SerialNumber; import org.opensaml.xml.util.XMLHelper; import org.w3c.dom.Element; /** * Thread-safe marshaller of {@link X509SerialNumber} objects. */ public class X509SerialNumberMarshaller extends AbstractXMLObjectMarshaller { /** {@inheritDoc} */ protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException { // no attributes } /** {@inheritDoc} */ protected void marshallElementContent(XMLObject xmlObject, Element domElement) throws MarshallingException { X509SerialNumber x509SerialNumber = (X509SerialNumber) xmlObject; if (x509SerialNumber.getValue() != null) { XMLHelper.appendTextContent(domElement, x509SerialNumber.getValue().toString()); } } }
1e269c328a7a87e1974ce312f9cee808c0dabe6f
b6f85b30a1359031e9034aa2be49b9c11e45ed1e
/app/src/main/java/com/avdey/fragments/Fragment1.java
6df33de0238303895deb4fea449a368c4848de3b
[]
no_license
Avdey87/Fragments
3973cc8ebfdaafd62bca2a327c7876867866a29c
3ddb8d7018f349b494c73f777a59013164e32130
refs/heads/master
2021-05-15T00:30:13.091246
2017-09-12T15:48:53
2017-09-12T15:48:53
103,181,223
0
1
null
null
null
null
UTF-8
Java
false
false
1,796
java
package com.avdey.fragments; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.Toast; public class Fragment1 extends Fragment implements View.OnClickListener { @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment1, container, false); Button button1 = (Button) rootView.findViewById(R.id.button1); Button button2 = (Button) rootView.findViewById(R.id.button2); Button button3 = (Button) rootView.findViewById(R.id.button3); button1.setOnClickListener(this); button2.setOnClickListener(this); button3.setOnClickListener(this); return rootView; } @Override public void onClick(View v) { int buttonIndex = transleteIdindex(v.getId()); OnSelectButtonListern listern = (OnSelectButtonListern) getActivity(); listern.onButtonSelected(buttonIndex); Toast.makeText(getActivity(), String.valueOf(buttonIndex) ,Toast.LENGTH_SHORT).show(); } int transleteIdindex(int id) { int index = -1; switch (id) { case R.id.button1: index = 1; break; case R.id.button2: index = 2; break; case R.id.button3: index = 3; break; } return index; } public interface OnSelectButtonListern { void onButtonSelected(int buttonIndex); } }
5b01fa8750101e01f127d3e5c7e5eafc7d0da7f5
91246fa8e6b33bb46f4b5445723d6bbaef096892
/TMessagesProj/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/manifest/SsManifestParser.java
e0d25bc748bbc75f6b42cac3b73229a6afc39da3
[]
no_license
AhabweEmmanuel/Marlia
4dcffc8499243b92721de81687e26da30a95c8b4
b4b6ed0664b1574f1b67ad5da96472b098da4b03
refs/heads/master
2020-12-10T15:15:05.202410
2020-01-13T15:55:58
2020-01-13T15:55:58
233,629,335
0
0
null
null
null
null
UTF-8
Java
false
false
29,129
java
/* * Copyright (C) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.android.exoplayer2.source.smoothstreaming.manifest; import android.net.Uri; import android.text.TextUtils; import android.util.Base64; import android.util.Pair; import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.ParserException; import com.google.android.exoplayer2.drm.DrmInitData; import com.google.android.exoplayer2.drm.DrmInitData.SchemeData; import com.google.android.exoplayer2.extractor.mp4.PsshAtomUtil; import com.google.android.exoplayer2.extractor.mp4.TrackEncryptionBox; import com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifest.ProtectionElement; import com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifest.StreamElement; import com.google.android.exoplayer2.upstream.ParsingLoadable; import com.google.android.exoplayer2.util.Assertions; import com.google.android.exoplayer2.util.CodecSpecificDataUtil; import com.google.android.exoplayer2.util.MimeTypes; import com.google.android.exoplayer2.util.Util; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.UUID; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserFactory; /** * Parses SmoothStreaming client manifests. * * @see <a href="http://msdn.microsoft.com/en-us/library/ee673436(v=vs.90).aspx"> * IIS Smooth Streaming Client Manifest Format</a> */ public class SsManifestParser implements ParsingLoadable.Parser<SsManifest> { private final XmlPullParserFactory xmlParserFactory; public SsManifestParser() { try { xmlParserFactory = XmlPullParserFactory.newInstance(); } catch (XmlPullParserException e) { throw new RuntimeException("Couldn't create XmlPullParserFactory instance", e); } } @Override public SsManifest parse(Uri uri, InputStream inputStream) throws IOException { try { XmlPullParser xmlParser = xmlParserFactory.newPullParser(); xmlParser.setInput(inputStream, null); SmoothStreamingMediaParser smoothStreamingMediaParser = new SmoothStreamingMediaParser(null, uri.toString()); return (SsManifest) smoothStreamingMediaParser.parse(xmlParser); } catch (XmlPullParserException e) { throw new ParserException(e); } } /** * Thrown if a required field is missing. */ public static class MissingFieldException extends ParserException { public MissingFieldException(String fieldName) { super("Missing required field: " + fieldName); } } /** * A base class for parsers that parse components of a smooth streaming manifest. */ private abstract static class ElementParser { private final String baseUri; private final String tag; private final ElementParser parent; private final List<Pair<String, Object>> normalizedAttributes; public ElementParser(ElementParser parent, String baseUri, String tag) { this.parent = parent; this.baseUri = baseUri; this.tag = tag; this.normalizedAttributes = new LinkedList<>(); } public final Object parse(XmlPullParser xmlParser) throws XmlPullParserException, IOException { String tagName; boolean foundStartTag = false; int skippingElementDepth = 0; while (true) { int eventType = xmlParser.getEventType(); switch (eventType) { case XmlPullParser.START_TAG: tagName = xmlParser.getName(); if (tag.equals(tagName)) { foundStartTag = true; parseStartTag(xmlParser); } else if (foundStartTag) { if (skippingElementDepth > 0) { skippingElementDepth++; } else if (handleChildInline(tagName)) { parseStartTag(xmlParser); } else { ElementParser childElementParser = newChildParser(this, tagName, baseUri); if (childElementParser == null) { skippingElementDepth = 1; } else { addChild(childElementParser.parse(xmlParser)); } } } break; case XmlPullParser.TEXT: if (foundStartTag && skippingElementDepth == 0) { parseText(xmlParser); } break; case XmlPullParser.END_TAG: if (foundStartTag) { if (skippingElementDepth > 0) { skippingElementDepth--; } else { tagName = xmlParser.getName(); parseEndTag(xmlParser); if (!handleChildInline(tagName)) { return build(); } } } break; case XmlPullParser.END_DOCUMENT: return null; default: // Do nothing. break; } xmlParser.next(); } } private ElementParser newChildParser(ElementParser parent, String name, String baseUri) { if (QualityLevelParser.TAG.equals(name)) { return new QualityLevelParser(parent, baseUri); } else if (ProtectionParser.TAG.equals(name)) { return new ProtectionParser(parent, baseUri); } else if (StreamIndexParser.TAG.equals(name)) { return new StreamIndexParser(parent, baseUri); } return null; } /** * Stash an attribute that may be normalized at this level. In other words, an attribute that * may have been pulled up from the child elements because its value was the same in all * children. * <p> * Stashing an attribute allows child element parsers to retrieve the values of normalized * attributes using {@link #getNormalizedAttribute(String)}. * * @param key The name of the attribute. * @param value The value of the attribute. */ protected final void putNormalizedAttribute(String key, Object value) { normalizedAttributes.add(Pair.create(key, value)); } /** * Attempt to retrieve a stashed normalized attribute. If there is no stashed attribute with * the provided name, the parent element parser will be queried, and so on up the chain. * * @param key The name of the attribute. * @return The stashed value, or null if the attribute was not be found. */ protected final Object getNormalizedAttribute(String key) { for (int i = 0; i < normalizedAttributes.size(); i++) { Pair<String, Object> pair = normalizedAttributes.get(i); if (pair.first.equals(key)) { return pair.second; } } return parent == null ? null : parent.getNormalizedAttribute(key); } /** * Whether this {@link ElementParser} parses a child element inline. * * @param tagName The name of the child element. * @return Whether the child is parsed inline. */ protected boolean handleChildInline(String tagName) { return false; } /** * @param xmlParser The underlying {@link XmlPullParser} * @throws ParserException If a parsing error occurs. */ protected void parseStartTag(XmlPullParser xmlParser) throws ParserException { // Do nothing. } /** * @param xmlParser The underlying {@link XmlPullParser} */ protected void parseText(XmlPullParser xmlParser) { // Do nothing. } /** * @param xmlParser The underlying {@link XmlPullParser} */ protected void parseEndTag(XmlPullParser xmlParser) { // Do nothing. } /** * @param parsedChild A parsed child object. */ protected void addChild(Object parsedChild) { // Do nothing. } protected abstract Object build(); protected final String parseRequiredString(XmlPullParser parser, String key) throws MissingFieldException { String value = parser.getAttributeValue(null, key); if (value != null) { return value; } else { throw new MissingFieldException(key); } } protected final int parseInt(XmlPullParser parser, String key, int defaultValue) throws ParserException { String value = parser.getAttributeValue(null, key); if (value != null) { try { return Integer.parseInt(value); } catch (NumberFormatException e) { throw new ParserException(e); } } else { return defaultValue; } } protected final int parseRequiredInt(XmlPullParser parser, String key) throws ParserException { String value = parser.getAttributeValue(null, key); if (value != null) { try { return Integer.parseInt(value); } catch (NumberFormatException e) { throw new ParserException(e); } } else { throw new MissingFieldException(key); } } protected final long parseLong(XmlPullParser parser, String key, long defaultValue) throws ParserException { String value = parser.getAttributeValue(null, key); if (value != null) { try { return Long.parseLong(value); } catch (NumberFormatException e) { throw new ParserException(e); } } else { return defaultValue; } } protected final long parseRequiredLong(XmlPullParser parser, String key) throws ParserException { String value = parser.getAttributeValue(null, key); if (value != null) { try { return Long.parseLong(value); } catch (NumberFormatException e) { throw new ParserException(e); } } else { throw new MissingFieldException(key); } } protected final boolean parseBoolean(XmlPullParser parser, String key, boolean defaultValue) { String value = parser.getAttributeValue(null, key); if (value != null) { return Boolean.parseBoolean(value); } else { return defaultValue; } } } private static class SmoothStreamingMediaParser extends ElementParser { public static final String TAG = "SmoothStreamingMedia"; private static final String KEY_MAJOR_VERSION = "MajorVersion"; private static final String KEY_MINOR_VERSION = "MinorVersion"; private static final String KEY_TIME_SCALE = "TimeScale"; private static final String KEY_DVR_WINDOW_LENGTH = "DVRWindowLength"; private static final String KEY_DURATION = "Duration"; private static final String KEY_LOOKAHEAD_COUNT = "LookaheadCount"; private static final String KEY_IS_LIVE = "IsLive"; private final List<StreamElement> streamElements; private int majorVersion; private int minorVersion; private long timescale; private long duration; private long dvrWindowLength; private int lookAheadCount; private boolean isLive; private ProtectionElement protectionElement; public SmoothStreamingMediaParser(ElementParser parent, String baseUri) { super(parent, baseUri, TAG); lookAheadCount = SsManifest.UNSET_LOOKAHEAD; protectionElement = null; streamElements = new LinkedList<>(); } @Override public void parseStartTag(XmlPullParser parser) throws ParserException { majorVersion = parseRequiredInt(parser, KEY_MAJOR_VERSION); minorVersion = parseRequiredInt(parser, KEY_MINOR_VERSION); timescale = parseLong(parser, KEY_TIME_SCALE, 10000000L); duration = parseRequiredLong(parser, KEY_DURATION); dvrWindowLength = parseLong(parser, KEY_DVR_WINDOW_LENGTH, 0); lookAheadCount = parseInt(parser, KEY_LOOKAHEAD_COUNT, SsManifest.UNSET_LOOKAHEAD); isLive = parseBoolean(parser, KEY_IS_LIVE, false); putNormalizedAttribute(KEY_TIME_SCALE, timescale); } @Override public void addChild(Object child) { if (child instanceof StreamElement) { streamElements.add((StreamElement) child); } else if (child instanceof ProtectionElement) { Assertions.checkState(protectionElement == null); protectionElement = (ProtectionElement) child; } } @Override public Object build() { StreamElement[] streamElementArray = new StreamElement[streamElements.size()]; streamElements.toArray(streamElementArray); if (protectionElement != null) { DrmInitData drmInitData = new DrmInitData(new SchemeData(protectionElement.uuid, MimeTypes.VIDEO_MP4, protectionElement.data)); for (StreamElement streamElement : streamElementArray) { int type = streamElement.type; if (type == C.TRACK_TYPE_VIDEO || type == C.TRACK_TYPE_AUDIO) { Format[] formats = streamElement.formats; for (int i = 0; i < formats.length; i++) { formats[i] = formats[i].copyWithDrmInitData(drmInitData); } } } } return new SsManifest(majorVersion, minorVersion, timescale, duration, dvrWindowLength, lookAheadCount, isLive, protectionElement, streamElementArray); } } private static class ProtectionParser extends ElementParser { public static final String TAG = "Protection"; public static final String TAG_PROTECTION_HEADER = "ProtectionHeader"; public static final String KEY_SYSTEM_ID = "SystemID"; private static final int INITIALIZATION_VECTOR_SIZE = 8; private boolean inProtectionHeader; private UUID uuid; private byte[] initData; public ProtectionParser(ElementParser parent, String baseUri) { super(parent, baseUri, TAG); } @Override public boolean handleChildInline(String tag) { return TAG_PROTECTION_HEADER.equals(tag); } @Override public void parseStartTag(XmlPullParser parser) { if (TAG_PROTECTION_HEADER.equals(parser.getName())) { inProtectionHeader = true; String uuidString = parser.getAttributeValue(null, KEY_SYSTEM_ID); uuidString = stripCurlyBraces(uuidString); uuid = UUID.fromString(uuidString); } } @Override public void parseText(XmlPullParser parser) { if (inProtectionHeader) { initData = Base64.decode(parser.getText(), Base64.DEFAULT); } } @Override public void parseEndTag(XmlPullParser parser) { if (TAG_PROTECTION_HEADER.equals(parser.getName())) { inProtectionHeader = false; } } @Override public Object build() { return new ProtectionElement( uuid, PsshAtomUtil.buildPsshAtom(uuid, initData), buildTrackEncryptionBoxes(initData)); } private static TrackEncryptionBox[] buildTrackEncryptionBoxes(byte[] initData) { return new TrackEncryptionBox[] { new TrackEncryptionBox( /* isEncrypted= */ true, /* schemeType= */ null, INITIALIZATION_VECTOR_SIZE, getProtectionElementKeyId(initData), /* defaultEncryptedBlocks= */ 0, /* defaultClearBlocks= */ 0, /* defaultInitializationVector= */ null) }; } private static byte[] getProtectionElementKeyId(byte[] initData) { StringBuilder initDataStringBuilder = new StringBuilder(); for (int i = 0; i < initData.length; i += 2) { initDataStringBuilder.append((char) initData[i]); } String initDataString = initDataStringBuilder.toString(); String keyIdString = initDataString.substring( initDataString.indexOf("<KID>") + 5, initDataString.indexOf("</KID>")); byte[] keyId = Base64.decode(keyIdString, Base64.DEFAULT); swap(keyId, 0, 3); swap(keyId, 1, 2); swap(keyId, 4, 5); swap(keyId, 6, 7); return keyId; } private static void swap(byte[] data, int firstPosition, int secondPosition) { byte temp = data[firstPosition]; data[firstPosition] = data[secondPosition]; data[secondPosition] = temp; } private static String stripCurlyBraces(String uuidString) { if (uuidString.charAt(0) == '{' && uuidString.charAt(uuidString.length() - 1) == '}') { uuidString = uuidString.substring(1, uuidString.length() - 1); } return uuidString; } } private static class StreamIndexParser extends ElementParser { public static final String TAG = "StreamIndex"; private static final String TAG_STREAM_FRAGMENT = "c"; private static final String KEY_TYPE = "Type"; private static final String KEY_TYPE_AUDIO = "audio"; private static final String KEY_TYPE_VIDEO = "video"; private static final String KEY_TYPE_TEXT = "text"; private static final String KEY_SUB_TYPE = "Subtype"; private static final String KEY_NAME = "Name"; private static final String KEY_URL = "Url"; private static final String KEY_MAX_WIDTH = "MaxWidth"; private static final String KEY_MAX_HEIGHT = "MaxHeight"; private static final String KEY_DISPLAY_WIDTH = "DisplayWidth"; private static final String KEY_DISPLAY_HEIGHT = "DisplayHeight"; private static final String KEY_LANGUAGE = "Language"; private static final String KEY_TIME_SCALE = "TimeScale"; private static final String KEY_FRAGMENT_DURATION = "d"; private static final String KEY_FRAGMENT_START_TIME = "t"; private static final String KEY_FRAGMENT_REPEAT_COUNT = "r"; private final String baseUri; private final List<Format> formats; private int type; private String subType; private long timescale; private String name; private String url; private int maxWidth; private int maxHeight; private int displayWidth; private int displayHeight; private String language; private ArrayList<Long> startTimes; private long lastChunkDuration; public StreamIndexParser(ElementParser parent, String baseUri) { super(parent, baseUri, TAG); this.baseUri = baseUri; formats = new LinkedList<>(); } @Override public boolean handleChildInline(String tag) { return TAG_STREAM_FRAGMENT.equals(tag); } @Override public void parseStartTag(XmlPullParser parser) throws ParserException { if (TAG_STREAM_FRAGMENT.equals(parser.getName())) { parseStreamFragmentStartTag(parser); } else { parseStreamElementStartTag(parser); } } private void parseStreamFragmentStartTag(XmlPullParser parser) throws ParserException { int chunkIndex = startTimes.size(); long startTime = parseLong(parser, KEY_FRAGMENT_START_TIME, C.TIME_UNSET); if (startTime == C.TIME_UNSET) { if (chunkIndex == 0) { // Assume the track starts at t = 0. startTime = 0; } else if (lastChunkDuration != C.INDEX_UNSET) { // Infer the start time from the previous chunk's start time and duration. startTime = startTimes.get(chunkIndex - 1) + lastChunkDuration; } else { // We don't have the start time, and we're unable to infer it. throw new ParserException("Unable to infer start time"); } } chunkIndex++; startTimes.add(startTime); lastChunkDuration = parseLong(parser, KEY_FRAGMENT_DURATION, C.TIME_UNSET); // Handle repeated chunks. long repeatCount = parseLong(parser, KEY_FRAGMENT_REPEAT_COUNT, 1L); if (repeatCount > 1 && lastChunkDuration == C.TIME_UNSET) { throw new ParserException("Repeated chunk with unspecified duration"); } for (int i = 1; i < repeatCount; i++) { chunkIndex++; startTimes.add(startTime + (lastChunkDuration * i)); } } private void parseStreamElementStartTag(XmlPullParser parser) throws ParserException { type = parseType(parser); putNormalizedAttribute(KEY_TYPE, type); if (type == C.TRACK_TYPE_TEXT) { subType = parseRequiredString(parser, KEY_SUB_TYPE); } else { subType = parser.getAttributeValue(null, KEY_SUB_TYPE); } name = parser.getAttributeValue(null, KEY_NAME); url = parseRequiredString(parser, KEY_URL); maxWidth = parseInt(parser, KEY_MAX_WIDTH, Format.NO_VALUE); maxHeight = parseInt(parser, KEY_MAX_HEIGHT, Format.NO_VALUE); displayWidth = parseInt(parser, KEY_DISPLAY_WIDTH, Format.NO_VALUE); displayHeight = parseInt(parser, KEY_DISPLAY_HEIGHT, Format.NO_VALUE); language = parser.getAttributeValue(null, KEY_LANGUAGE); putNormalizedAttribute(KEY_LANGUAGE, language); timescale = parseInt(parser, KEY_TIME_SCALE, -1); if (timescale == -1) { timescale = (Long) getNormalizedAttribute(KEY_TIME_SCALE); } startTimes = new ArrayList<>(); } private int parseType(XmlPullParser parser) throws ParserException { String value = parser.getAttributeValue(null, KEY_TYPE); if (value != null) { if (KEY_TYPE_AUDIO.equalsIgnoreCase(value)) { return C.TRACK_TYPE_AUDIO; } else if (KEY_TYPE_VIDEO.equalsIgnoreCase(value)) { return C.TRACK_TYPE_VIDEO; } else if (KEY_TYPE_TEXT.equalsIgnoreCase(value)) { return C.TRACK_TYPE_TEXT; } else { throw new ParserException("Invalid key value[" + value + "]"); } } throw new MissingFieldException(KEY_TYPE); } @Override public void addChild(Object child) { if (child instanceof Format) { formats.add((Format) child); } } @Override public Object build() { Format[] formatArray = new Format[formats.size()]; formats.toArray(formatArray); return new StreamElement(baseUri, url, type, subType, timescale, name, maxWidth, maxHeight, displayWidth, displayHeight, language, formatArray, startTimes, lastChunkDuration); } } private static class QualityLevelParser extends ElementParser { public static final String TAG = "QualityLevel"; private static final String KEY_INDEX = "Index"; private static final String KEY_BITRATE = "Bitrate"; private static final String KEY_CODEC_PRIVATE_DATA = "CodecPrivateData"; private static final String KEY_SAMPLING_RATE = "SamplingRate"; private static final String KEY_CHANNELS = "Channels"; private static final String KEY_FOUR_CC = "FourCC"; private static final String KEY_TYPE = "Type"; private static final String KEY_LANGUAGE = "Language"; private static final String KEY_NAME = "Name"; private static final String KEY_MAX_WIDTH = "MaxWidth"; private static final String KEY_MAX_HEIGHT = "MaxHeight"; private Format format; public QualityLevelParser(ElementParser parent, String baseUri) { super(parent, baseUri, TAG); } @Override public void parseStartTag(XmlPullParser parser) throws ParserException { int type = (Integer) getNormalizedAttribute(KEY_TYPE); String id = parser.getAttributeValue(null, KEY_INDEX); String name = (String) getNormalizedAttribute(KEY_NAME); int bitrate = parseRequiredInt(parser, KEY_BITRATE); String sampleMimeType = fourCCToMimeType(parseRequiredString(parser, KEY_FOUR_CC)); if (type == C.TRACK_TYPE_VIDEO) { int width = parseRequiredInt(parser, KEY_MAX_WIDTH); int height = parseRequiredInt(parser, KEY_MAX_HEIGHT); List<byte[]> codecSpecificData = buildCodecSpecificData( parser.getAttributeValue(null, KEY_CODEC_PRIVATE_DATA)); format = Format.createVideoContainerFormat( id, name, MimeTypes.VIDEO_MP4, sampleMimeType, /* codecs= */ null, bitrate, width, height, /* frameRate= */ Format.NO_VALUE, codecSpecificData, /* selectionFlags= */ 0); } else if (type == C.TRACK_TYPE_AUDIO) { sampleMimeType = sampleMimeType == null ? MimeTypes.AUDIO_AAC : sampleMimeType; int channels = parseRequiredInt(parser, KEY_CHANNELS); int samplingRate = parseRequiredInt(parser, KEY_SAMPLING_RATE); List<byte[]> codecSpecificData = buildCodecSpecificData( parser.getAttributeValue(null, KEY_CODEC_PRIVATE_DATA)); if (codecSpecificData.isEmpty() && MimeTypes.AUDIO_AAC.equals(sampleMimeType)) { codecSpecificData = Collections.singletonList( CodecSpecificDataUtil.buildAacLcAudioSpecificConfig(samplingRate, channels)); } String language = (String) getNormalizedAttribute(KEY_LANGUAGE); format = Format.createAudioContainerFormat( id, name, MimeTypes.AUDIO_MP4, sampleMimeType, /* codecs= */ null, bitrate, channels, samplingRate, codecSpecificData, /* selectionFlags= */ 0, language); } else if (type == C.TRACK_TYPE_TEXT) { String language = (String) getNormalizedAttribute(KEY_LANGUAGE); format = Format.createTextContainerFormat( id, name, MimeTypes.APPLICATION_MP4, sampleMimeType, /* codecs= */ null, bitrate, /* selectionFlags= */ 0, language); } else { format = Format.createContainerFormat( id, name, MimeTypes.APPLICATION_MP4, sampleMimeType, /* codecs= */ null, bitrate, /* selectionFlags= */ 0, /* language= */ null); } } @Override public Object build() { return format; } private static List<byte[]> buildCodecSpecificData(String codecSpecificDataString) { ArrayList<byte[]> csd = new ArrayList<>(); if (!TextUtils.isEmpty(codecSpecificDataString)) { byte[] codecPrivateData = Util.getBytesFromHexString(codecSpecificDataString); byte[][] split = CodecSpecificDataUtil.splitNalUnits(codecPrivateData); if (split == null) { csd.add(codecPrivateData); } else { Collections.addAll(csd, split); } } return csd; } private static String fourCCToMimeType(String fourCC) { if (fourCC.equalsIgnoreCase("H264") || fourCC.equalsIgnoreCase("X264") || fourCC.equalsIgnoreCase("AVC1") || fourCC.equalsIgnoreCase("DAVC")) { return MimeTypes.VIDEO_H264; } else if (fourCC.equalsIgnoreCase("AAC") || fourCC.equalsIgnoreCase("AACL") || fourCC.equalsIgnoreCase("AACH") || fourCC.equalsIgnoreCase("AACP")) { return MimeTypes.AUDIO_AAC; } else if (fourCC.equalsIgnoreCase("TTML") || fourCC.equalsIgnoreCase("DFXP")) { return MimeTypes.APPLICATION_TTML; } else if (fourCC.equalsIgnoreCase("ac-3") || fourCC.equalsIgnoreCase("dac3")) { return MimeTypes.AUDIO_AC3; } else if (fourCC.equalsIgnoreCase("ec-3") || fourCC.equalsIgnoreCase("dec3")) { return MimeTypes.AUDIO_E_AC3; } else if (fourCC.equalsIgnoreCase("dtsc")) { return MimeTypes.AUDIO_DTS; } else if (fourCC.equalsIgnoreCase("dtsh") || fourCC.equalsIgnoreCase("dtsl")) { return MimeTypes.AUDIO_DTS_HD; } else if (fourCC.equalsIgnoreCase("dtse")) { return MimeTypes.AUDIO_DTS_EXPRESS; } else if (fourCC.equalsIgnoreCase("opus")) { return MimeTypes.AUDIO_OPUS; } return null; } } }
6a4fe8fe60c8b281a82e3b5828ea6226ee6cd719
f10a7a255151c627eb1953e029de75b215246b4a
/quickfixj-core/src/main/java/quickfix/field/MaxPriceVariation.java
f6e6faddbe8d3fd8971fc9d838dd03c8ca8d74b5
[ "BSD-2-Clause", "LicenseRef-scancode-public-domain" ]
permissive
niepoo/quickfixj
579f57f2e8fb8db906c6f916355da6d78bb86ecb
f8e255c3e86e36d7551b8661c403672e69070ca1
refs/heads/master
2021-01-18T05:29:51.369160
2016-10-16T23:31:34
2016-10-16T23:31:34
68,493,032
0
0
null
2016-09-18T03:18:20
2016-09-18T03:18:20
null
UTF-8
Java
false
false
1,192
java
/* Generated Java Source File */ /******************************************************************************* * Copyright (c) quickfixengine.org All rights reserved. * * This file is part of the QuickFIX FIX Engine * * This file may be distributed under the terms of the quickfixengine.org * license as defined by quickfixengine.org and appearing in the file * LICENSE included in the packaging of this file. * * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING * THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. * * See http://www.quickfixengine.org/LICENSE for licensing information. * * Contact [email protected] if any conditions of this licensing * are not clear to you. ******************************************************************************/ package quickfix.field; import quickfix.DoubleField; public class MaxPriceVariation extends DoubleField { static final long serialVersionUID = 20050617; public static final int FIELD = 1143; public MaxPriceVariation() { super(1143); } public MaxPriceVariation(double data) { super(1143, data); } }
7c5385c205af79b92c043b4f629c24921a34758f
f850ca0edb2aee0a0de939edea33093f20ea8c8e
/src/main/java/fle/api/tile/kinetic/TEGearBoxBase.java
d9d087507a650f7630a64fba92fb95d6fe293037
[]
no_license
ueyudiud/FLE
e6cd58e461a5863187a0f0434a65f272aeb372d0
99559e187b21419cf382bacd4c897fc41b468ef2
refs/heads/1.10.2
2021-01-25T15:19:00.440484
2018-06-12T05:25:05
2018-06-12T05:25:05
39,243,551
9
2
null
2018-01-27T11:38:03
2015-07-17T08:31:05
Java
UTF-8
Java
false
false
3,318
java
/* * copyright 2016-2018 ueyudiud */ package fle.api.tile.kinetic; import javax.annotation.Nullable; import farcore.energy.kinetic.IKineticAccess; import farcore.energy.kinetic.IKineticHandler; import farcore.energy.kinetic.KineticPackage; import farcore.handler.FarCoreEnergyHandler; import nebula.common.tile.TE04Synchronization; import nebula.common.util.Direction; /** * @author ueyudiud */ public class TEGearBoxBase extends TE04Synchronization implements IKineticHandler { public static enum RotationType { EDGE_ROTATE, ROPE_ROTATE, AXIS_ROTATE; } public static class KineticPackageExt extends KineticPackage { public final RotationType type; public final Direction direction; protected KineticPackageExt(RotationType type, Direction direction, double t, double s) { super(t, s); this.type = type; this.direction = direction; } public static KineticPackageExt wrap(RotationType type, KineticPackage pkg, Direction direction) { return new KineticPackageExt(type, direction, pkg.torque, pkg.speed); } } public static class KineticPackageGearEdgeRotate extends KineticPackageExt { public int gearTeethCount; public float gearLen; public float gearTeethLen; public KineticPackageGearEdgeRotate(Direction direction, double t, double s) { super(RotationType.EDGE_ROTATE, direction, t, s); } public KineticPackageGearEdgeRotate setGearProperty(IGearHandler handler, Direction direction) { this.gearLen = handler.getGearSize(direction); this.gearTeethLen = handler.getGearTeethSize(direction); this.gearTeethCount = handler.getGearTeethCount(direction); return this; } } public static class KineticPackageAxisRotate extends KineticPackageExt { public KineticPackageAxisRotate(Direction direction, double t, double s) { super(RotationType.AXIS_ROTATE, direction, t, s); } } public static class KineticPackageRopeRotate extends KineticPackageExt { public KineticPackageRopeRotate(Direction direction, double t, double s) { super(RotationType.ROPE_ROTATE, direction, t, s); } } @Nullable public RotationType getRotationType(Direction direction) { return null; } @Override protected void initServer() { super.initServer(); FarCoreEnergyHandler.onAddFromWorld(this); } @Override public void onRemoveFromLoadedWorld() { super.onRemoveFromLoadedWorld(); FarCoreEnergyHandler.onRemoveFromWorld(this); } @Override public void update() { super.update(); } @Override public boolean canAccessKineticEnergyFromDirection(Direction direction) { return true; } @Override public boolean isRotatable(Direction direction, KineticPackage pkg) { return false; } @Override public void emitKineticEnergy(IKineticAccess access, IKineticHandler destination, Direction direction, KineticPackage pkg) { } @Override public double receiveKineticEnergy(IKineticAccess access, IKineticHandler source, Direction direction, KineticPackage pkg) { return 0; } @Override public void onStuck(Direction direction, KineticPackage pkg) { } @Override public void kineticPreUpdate(IKineticAccess access) { } }
ea6d49d1aab5f23d3fb7346a2ceb2ac1e2e01907
272ef810dbbd418eaa5e6b21766bd623a498333f
/src/main/java/com/test/sz/exception/ResourceNotFoundException.java
45f8fccff6c58f8a89062f0e5a4154b9ad8ab771
[]
no_license
mpren/ShaiZi
35a54c1a364ea77350a41f043e561ce9cf88ecd0
27125bf7648d1b4bd19276c17cec1bb9792810cd
refs/heads/master
2023-05-28T08:44:42.880524
2020-06-18T07:44:31
2020-06-18T07:44:31
124,331,079
1
2
null
2023-05-23T20:10:29
2018-03-08T03:26:54
Java
UTF-8
Java
false
false
92
java
package com.test.sz.exception; public class ResourceNotFoundException extends Exception { }
82d1a88cfb37441493e2032339bd973a6fe9bda0
a24a7032125333c45f4cf8d3d708cc3030399a1a
/src/test/java/nz/strydom/gross/ProductControllerTestIT.java
79cc9ee0f78691738a85157f55c528d3db1d9e6f
[ "MIT" ]
permissive
STRiDGE/gross-re
aad74eb3559c372ac3a419118c320b576bd7f830
8287225ab6921455ad10986c99ed574bc8891789
refs/heads/master
2021-05-04T10:33:57.560218
2016-05-05T11:36:22
2016-05-05T11:36:22
53,115,976
1
0
null
null
null
null
UTF-8
Java
false
false
469
java
package nz.strydom.gross; import static org.junit.Assert.fail; import org.junit.Test; import org.springframework.test.context.ActiveProfiles; import nz.strydom.gross.test.SpringContextTestCase; @ActiveProfiles(value="integrationtest", inheritProfiles=false) // This is optional, but allows us to load a different properties file public class ProductControllerTestIT extends SpringContextTestCase { @Test public void test() { fail("Not yet implemented"); } }
80bb8c00134fd2ad288617f004e836e9e927d461
8de13e531ff142c026c1740940db8532265a5f84
/Modules/Module4/src/SampleCode6/CanvasWithText.java
dff7b3a279a7adb7fc6f761483fac43c8f3caa5f
[ "MIT" ]
permissive
hackettccp/CSCI112
0183f756300fbdd16a68c45a2e4b97c6296e67a8
103893f5c3532839f6b0a8ff460f069b324bc199
refs/heads/master
2020-08-09T12:10:34.466429
2019-12-20T05:50:26
2019-12-20T05:50:26
214,084,396
3
0
null
null
null
null
UTF-8
Java
false
false
1,577
java
package SampleCode6; import javax.swing.*; import java.awt.Canvas; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; /** * A Canvas subclass that draws text. */ public class CanvasWithText extends Canvas { /** * Overrides the Canvas superclass's paint method. * Will instead draw what is specified in this method. */ public void paint(Graphics g) { //Draws a String g.drawString("Hello World", 60, 50); //Draws a blue String with a specified font. g.setColor(Color.BLUE); g.setFont(new Font("Serif", Font.BOLD, 16)); g.drawString("Hello World!", 200, 50); //Draws a filled, red 8-sided polygon (octagon) //X Coordinates of shape 1 int[] shape1_x = {110, 150, 190, 190, 150, 110, 70, 70}; //Y Coordinates fo shape 1 int[] shape1_y = {70, 70, 110, 150, 190, 190, 150, 110}; g.setColor(Color.RED); g.fillPolygon(shape1_x, shape1_y, 8); //Draws a white String with a specified font. g.setColor(Color.WHITE); g.setFont(new Font("Dialog", Font.BOLD, 28)); g.drawString("STOP", 95, 140); } /** * Main Method. The program begins here. */ public static void main(String[] args) { JFrame window = new JFrame("Canvas Example"); window.setSize(320, 340); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); CanvasWithText c = new CanvasWithText(); window.add(c); window.setVisible(true); } }
[ "H@ck3t7!1github1" ]
H@ck3t7!1github1
065ff4eda1cc8a21ab51dc883bc171b0da063605
303fc5afce3df984edbc7e477f474fd7aee3b48e
/fuentes/ucumari-commons/src/main/java/com/wildc/ucumari/parameters/model/UomConversionDatedPK.java
042e72bd96a4733dfbcaf3ae04daac8d8a420a3b
[]
no_license
douit/erpventas
3624cbd55cb68b6d91677a493d6ef1e410392127
c53dc6648bd5a2effbff15e03315bab31e6db38b
refs/heads/master
2022-03-29T22:06:06.060059
2014-04-21T12:53:13
2014-04-21T12:53:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,002
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.wildc.ucumari.parameters.model; import java.io.Serializable; import java.util.Date; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Embeddable; import javax.persistence.Temporal; import javax.persistence.TemporalType; /** * * @author Cristian */ @Embeddable public class UomConversionDatedPK implements Serializable { /** * */ private static final long serialVersionUID = 8022559796846068054L; @Basic(optional = false) @Column(name = "UOM_ID") private String uomId; @Basic(optional = false) @Column(name = "UOM_ID_TO") private String uomIdTo; @Basic(optional = false) @Column(name = "FROM_DATE") @Temporal(TemporalType.TIMESTAMP) private Date fromDate; public UomConversionDatedPK() { } public UomConversionDatedPK(String uomId, String uomIdTo, Date fromDate) { this.uomId = uomId; this.uomIdTo = uomIdTo; this.fromDate = fromDate; } public String getUomId() { return uomId; } public void setUomId(String uomId) { this.uomId = uomId; } public String getUomIdTo() { return uomIdTo; } public void setUomIdTo(String uomIdTo) { this.uomIdTo = uomIdTo; } public Date getFromDate() { return fromDate; } public void setFromDate(Date fromDate) { this.fromDate = fromDate; } @Override public int hashCode() { int hash = 0; hash += (uomId != null ? uomId.hashCode() : 0); hash += (uomIdTo != null ? uomIdTo.hashCode() : 0); hash += (fromDate != null ? fromDate.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof UomConversionDatedPK)) { return false; } UomConversionDatedPK other = (UomConversionDatedPK) object; if ((this.uomId == null && other.uomId != null) || (this.uomId != null && !this.uomId.equals(other.uomId))) { return false; } if ((this.uomIdTo == null && other.uomIdTo != null) || (this.uomIdTo != null && !this.uomIdTo.equals(other.uomIdTo))) { return false; } if ((this.fromDate == null && other.fromDate != null) || (this.fromDate != null && !this.fromDate.equals(other.fromDate))) { return false; } return true; } @Override public String toString() { return "com.wildc.ucumari.client.modelo.UomConversionDatedPK[ uomId=" + uomId + ", uomIdTo=" + uomIdTo + ", fromDate=" + fromDate + " ]"; } }
c5a69012db40ce9fcbbd4381af26e6f75508012b
f315651879a7c9f7967cfe09e02dd9d9e9424476
/HireCarJpaWebservice/src/main/java/com/example/repository/IModelRepository.java
86ba8920d9017c03f51c58fc90374be2e0d4624b
[]
no_license
hamsuhi/IFI-exactly
668291c1635ee51460a7cbbda3d05c43da2f4a70
9d08100bf99c90b82c023db1d9b1087f75be4a8e
refs/heads/master
2021-04-30T08:14:41.097215
2018-03-21T10:41:18
2018-03-21T10:41:18
121,368,993
0
0
null
null
null
null
UTF-8
Java
false
false
305
java
package com.example.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import com.example.model.Model; @Repository public interface IModelRepository extends JpaRepository<Model, Integer> { Model findByModelName(String name); }
a4bdd187175148f057d89897b694fedcfa97b9d0
436ba3c9280015b6473f6e78766a0bb9cfd21998
/parent/web/src/main/java/by/itacademy/keikom/taxi/web/converter/RateToDTOConverter.java
be6a84d18227c34d0c36902e73d736dc3c34ed2a
[]
no_license
KeMihail/parent
4ba61debc5581f29a6cabfe2a767dbdeaed57eb6
398a7617d7a4c94703e3d85daca1e3b22d8920fa
refs/heads/master
2022-12-24T09:31:34.156316
2019-06-13T20:29:10
2019-06-13T20:29:10
191,828,552
0
0
null
2022-12-15T23:25:17
2019-06-13T20:26:20
Java
UTF-8
Java
false
false
639
java
package by.itacademy.keikom.taxi.web.converter; import java.util.function.Function; import org.springframework.stereotype.Component; import by.itacademy.keikom.taxi.dao.dbmodel.Rate; import by.itacademy.keikom.taxi.web.dto.RateDTO; @Component public class RateToDTOConverter implements Function<Rate, RateDTO> { @Override public RateDTO apply(Rate dbModel) { RateDTO dto = new RateDTO(); dto.setId(dbModel.getId()); dto.setName(dbModel.getName()); dto.setPriceKilometr(dbModel.getPriceKilometr()); dto.setPriceLanding(dbModel.getPriceLanding()); dto.setPriceMinuteWait(dbModel.getPriceMinuteWait()); return dto; } }
d50ee429e7ff0cc76265f9cd1dfafc218039515b
fb959ce79426f2dbec8c14e2d7d8150b74348030
/src/main/java/com/example/UserService/data/rest/AddressChoice.java
e9c5c95d49e7deabe28357a53499ecacbd66e954
[]
no_license
easychan2019new/My-Eshop-UserService
561a6afa250d2507762db710eccd141f94c33ef3
686415f04d3334720f7c954e1c04f00bad252e9f
refs/heads/main
2023-08-25T20:33:01.147817
2021-10-16T02:48:36
2021-10-16T02:48:36
417,696,581
0
0
null
null
null
null
UTF-8
Java
false
false
204
java
package com.example.UserService.data.rest; import lombok.Data; import lombok.NoArgsConstructor; @Data @NoArgsConstructor public class AddressChoice { private String id; private String street; }
815dde7de56aef603eb0cd30793fec27bea61e3d
4e1a3b17ce93a5e5645ae93bb73e84159f0d27c4
/src/connection/ConnectionFactory.java
b79d2e70e9993044ad43c0cf68b523d4db11fe17
[]
no_license
josias84/Candidato
63229224fb0d160113aa5847fe89ef09f7e14f99
f2e520226a7caeeac418ffc95703b191fafdf762
refs/heads/master
2023-01-19T08:53:47.640734
2020-11-30T18:14:49
2020-11-30T18:14:49
314,052,035
0
0
null
null
null
null
MacCentralEurope
Java
false
false
1,163
java
package connection; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; import javax.swing.JOptionPane; public class ConnectionFactory { private final static String url="jdbc:sqlserver://localhost:1433;databaseNAme=bdProduto"; private final static String user="sa"; private final static String password="12345"; public static Connection getConnection() { try { DriverManager.getConnection(url, user, password); } catch (SQLException e) { JOptionPane.showMessageDialog(null, "Erro ao conex„o ao banco de dados!","Erro",2); } return null; } public static void closeConnection(Connection con) { if(con!=null) { try { con.close(); } catch (SQLException e) { JOptionPane.showInputDialog(null, "Erro ao finalizar a conex„o ao banco de dados!", "Erro",2); } } } public static void closeConnection(Connection con, PreparedStatement stmt) { closeConnection(con); if(stmt!=null) { try { stmt.close(); }catch(SQLException e) { JOptionPane.showMessageDialog(null, "Erro ao finalizar a conx„o", "Erro",2); } } } }
983301fcfd22c66fd748158506311c464222a474
736fc91ed85f6cba8089929bf39b8b76438910e7
/student-manage/src/main/java/com/syl/sm/service/impl/ClazzServiceImpl.java
0a735f29e1f4a7e6b9aa9c8d8038218f2df31ee8
[]
no_license
shiyilinliran/Student_manager
ac3bbf74541e7280211a5446aa30f0aa2d657c7b
8211b1a2ee227d2eb9423609976707f9144efeb4
refs/heads/main
2023-01-29T17:02:53.210244
2020-12-10T15:09:00
2020-12-10T15:09:00
316,143,067
0
0
null
null
null
null
UTF-8
Java
false
false
1,710
java
package com.syl.sm.service.impl; import com.syl.sm.entity.Clazz; import com.syl.sm.factory.ClazzDaoFactory; import com.syl.sm.factory.DaoFActory; import com.syl.sm.service.ClazzService; import java.sql.SQLException; import java.util.List; /** * @ClassName ClazzServiceImpl * @Description TODO * @Author admin * @Date 2020/12/4 **/ public class ClazzServiceImpl implements ClazzService { @Override public List<Clazz> getClazzByDepId(int depId) { List<Clazz> list = null; try { list = ClazzDaoFactory.getClazzDaoInstance().selectByDepartmentId(depId); } catch (SQLException e) { System.err.println("根据院系id查询班级列表出现异常"); } return list; } @Override public List<Clazz> selectAll() { List<Clazz> list = null; try { list = DaoFActory.getClazzDaoInstance().selectAll(); } catch (SQLException e) { System.err.println("查询所有班级列表出现异常"); } return list; } @Override public int addClazz(Clazz clazz) { int n = 0; try { n = DaoFActory.getClazzDaoInstance().insertClazz(clazz); } catch (SQLException throwables) { System.err.println("新增班级出现异常"); } return n; } @Override public int deleteClazz(int clazzId) { int n = 0; try { n = DaoFActory.getClazzDaoInstance().deleteClazz(clazzId); } catch (SQLException throwables) { System.err.println("删除班级出现异常"); } return n; } }
ebeafb68d9263a7a006e32d65a53dc30de38f2ee
eba353049d4adba3d62e3b27796077d1b25ebb7f
/learning_akka/src/main/java/top/andrewchen1/chapter3/ParseArticle.java
4cefa5f404b1261c6be2c292f4c4f367be7a7f84
[]
no_license
andrewchen1/learn_akka_with_mars
caaab688e3375e4636939f081359b8ca47f38322
7167890f9a6c81f6daa11bfe391176c2bac1e946
refs/heads/master
2020-04-27T23:48:40.820011
2019-05-05T02:10:45
2019-05-05T02:10:45
174,791,224
1
0
null
null
null
null
UTF-8
Java
false
false
190
java
package top.andrewchen1.chapter3; import lombok.Data; @Data public class ParseArticle { private final String url; public ParseArticle(String url) { this.url = url; } }
d1a77ee3ee6b484417b9b390fe5bf693f5716ce2
228a76dcf6ac85479d15d489cb33076004024604
/src/ExamCreator/ShortQuestion.java
2b0023ad805d2169276742b2a0c8a1e0f6bc715f
[]
no_license
masterveejr/ExamCreator
097bb8f26f29cb6a9760d7aef237e465cfb3bdf5
b87462435dfd43cb0845ff3d1cb96c9ea2122ca1
refs/heads/master
2021-05-10T14:40:39.993791
2018-01-22T23:05:23
2018-01-22T23:05:23
118,525,884
0
0
null
null
null
null
UTF-8
Java
false
false
571
java
package ExamCreator; public class ShortQuestion implements Question { private String SQQuestion; private String SQSample; public ShortQuestion(String q,String s){ this.SQQuestion=q; this.SQSample=s; } public String getSQQuestion() { return SQQuestion; } public String getSQSample() { return SQSample; } @Override public String toString(){ return "SQ" + " " + SQQuestion + " "+ SQSample; } public String examPrinter(){ return SQQuestion; } public String AExamPrinter(){ return SQQuestion + " "+ SQSample; } }
e3595420dd2de5bc574683a5e8a088eb80966643
26ff3f0dc6f38a254c47f2537f28061ed51d11d0
/src/main/java/io/vepo/kafka/tool/inspect/KafkaAdminService.java
b53b79831e8e94f1d3da9bb988e4fea0c0cc804d
[ "MIT" ]
permissive
vepo/kafka-tool
ad16800ace8d4b848b9d42c0b18ac0ecbcc93961
b65a81994592990f8528a8dda8ca5d6b48f156b9
refs/heads/main
2022-05-28T08:55:13.283460
2022-05-18T02:17:11
2022-05-18T02:17:11
346,550,524
1
0
MIT
2022-05-18T02:17:12
2021-03-11T02:12:00
Java
UTF-8
Java
false
false
6,245
java
package io.vepo.kafka.tool.inspect; import static java.util.Arrays.asList; import static java.util.Collections.emptyList; import static java.util.Objects.isNull; import static java.util.Objects.nonNull; import static java.util.stream.Collectors.toList; import static java.util.stream.Collectors.toMap; import static org.apache.kafka.clients.admin.RecordsToDelete.beforeOffset; import java.io.Closeable; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.function.Consumer; import java.util.stream.Collectors; import org.apache.kafka.clients.admin.AdminClient; import org.apache.kafka.clients.admin.AdminClientConfig; import org.apache.kafka.clients.admin.ListOffsetsResult.ListOffsetsResultInfo; import org.apache.kafka.clients.admin.OffsetSpec; import org.apache.kafka.clients.admin.TopicDescription; import org.apache.kafka.common.KafkaFuture; import org.apache.kafka.common.TopicPartition; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import io.vepo.kafka.tool.settings.KafkaBroker; public class KafkaAdminService implements Closeable { private static final Logger logger = LoggerFactory.getLogger(KafkaAdminService.class); public enum BrokerStatus { IDLE, CONNECTED } public interface KafkaConnectionWatcher { public void statusChanged(BrokerStatus status); } private BrokerStatus status; private AdminClient adminClient = null; private ExecutorService executor = Executors.newSingleThreadExecutor(); private List<KafkaConnectionWatcher> watchers; private KafkaBroker connectedBroker; public KafkaAdminService() { this.watchers = new ArrayList<>(); this.status = BrokerStatus.IDLE; } public BrokerStatus getStatus() { return status; } public void connect(KafkaBroker kafkaBroker, Consumer<BrokerStatus> callback) { executor.submit(() -> { connectedBroker = kafkaBroker; var properties = new Properties(); properties.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaBroker.getBootStrapServers()); adminClient = AdminClient.create(properties); status = BrokerStatus.CONNECTED; callback.accept(status); watchers.forEach(consumer -> consumer.statusChanged(status)); }); } public void watch(KafkaConnectionWatcher watcher) { this.watchers.add(watcher); } public KafkaBroker connectedBroker() { return connectedBroker.clone(); } public void emptyTopic(TopicInfo topic) { executor.submit(() -> { logger.info("Cleaning topic... topic={}", topic); if (nonNull(adminClient)) { logger.info("Describing topic... topic={}", topic); handle(adminClient.describeTopics(asList(topic.getName())).all(), this::listOffsets, error -> logger.error("Error describing topic!", error)); } }); } private static <T> void handle(KafkaFuture<T> operation, Consumer<T> successHandler, Consumer<Throwable> errorHandler) { operation.whenComplete((result, error) -> { if (nonNull(error)) { errorHandler.accept(error); } else { successHandler.accept(result); } }); } private void listOffsets(Map<String, TopicDescription> descs) { handle(adminClient.listOffsets(descs.values() .stream() .flatMap(desc -> desc.partitions() .stream() .map(partition -> new TopicPartition(desc.name(), partition.partition()))) .collect(Collectors.toMap((TopicPartition t) -> t, t -> OffsetSpec.latest()))) .all(), this::deleteRecords, error -> logger.error("Could not list offset!", error)); } private void deleteRecords(Map<TopicPartition, ListOffsetsResultInfo> listOffsetResults) { handle(adminClient.deleteRecords(listOffsetResults.entrySet() .stream() .collect(toMap(entry -> entry.getKey(), entry -> beforeOffset(entry.getValue() .offset())))) .all(), KafkaAdminService::ignore, error -> logger.error("Error deleting records!", error)); } private static <T> void ignore(T value) { } public void listTopics(Consumer<List<TopicInfo>> callback) { executor.submit(() -> { if (nonNull(adminClient)) { adminClient.listTopics() .listings() .whenComplete((topics, error) -> { if (isNull(error)) { callback.accept(topics.stream() .map(topic -> new TopicInfo(topic.name(), topic.isInternal())) .collect(toList())); } else { callback.accept(emptyList()); } }); } else { callback.accept(emptyList()); } }); } @Override public void close() { logger.info("Closing client..."); connectedBroker = null; if (nonNull(adminClient)) { adminClient.close(); } } }
b3eed91ec6cdee6d1e191ad267e8d5094dfdaf7d
757ff0e036d1c65d99424abb5601012d525c2302
/sources/com/fimi/album/widget/CustomVideoView.java
0352c22c5f2e58d79076fe1e9b0041910ec6217f
[]
no_license
pk1z/wladimir-computin-FimiX8-RE-App
32179ef6f05efab0cf5af0d4957f0319abe04ad0
70603638809853a574947b65ecfaf430250cd778
refs/heads/master
2020-11-25T21:02:17.790224
2019-12-18T13:28:48
2019-12-18T13:28:48
228,845,415
0
0
null
null
null
null
UTF-8
Java
false
false
22,905
java
package com.fimi.album.widget; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.graphics.Bitmap; import android.graphics.SurfaceTexture; import android.media.AudioManager; import android.media.MediaPlayer; import android.media.MediaPlayer.OnBufferingUpdateListener; import android.media.MediaPlayer.OnCompletionListener; import android.media.MediaPlayer.OnErrorListener; import android.media.MediaPlayer.OnInfoListener; import android.media.MediaPlayer.OnPreparedListener; import android.media.MediaPlayer.OnSeekCompleteListener; import android.os.Handler; import android.os.Message; import android.util.DisplayMetrics; import android.util.Log; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.Surface; import android.view.TextureView; import android.view.TextureView.SurfaceTextureListener; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.WindowManager; import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.RelativeLayout.LayoutParams; import android.widget.SeekBar; import android.widget.SeekBar.OnSeekBarChangeListener; import android.widget.TextView; import com.example.album.R; import com.fimi.kernel.utils.LogUtil; import java.util.Formatter; import java.util.Locale; public class CustomVideoView extends RelativeLayout implements OnClickListener, SurfaceTextureListener, OnPreparedListener, OnCompletionListener, OnInfoListener, OnErrorListener, OnBufferingUpdateListener, OnSeekBarChangeListener { private static final int LOAD_TOTAL_COUNT = 3; private static final int STATE_ERROR = 1; private static final int STATE_IDLE = 0; private static final int STATE_PAUSE = 2; private static final int STATE_PLAYING = 1; private static final String TAG = "CustomVideoView"; private static final int TIME_INVAL = 1000; private static final int TIME_MSG = 1; private static float VIDEO_HEIGHT_PERCENT = 0.5625f; private AudioManager audioManager; private boolean canPlay = true; private boolean isMute; private boolean isUpdateProgressed = false; private VideoPlayerListener listener; private RelativeLayout mBottomPlayRl; private int mCurrentCount; private TextView mCurrentTimeTv; private int mDestationHeight; private StringBuilder mFormatBuilder; private Formatter mFormatter; private Handler mHandler = new Handler() { public void handleMessage(Message msg) { super.handleMessage(msg); switch (msg.what) { case 1: if (CustomVideoView.this.isPlaying()) { if (!CustomVideoView.this.isUpdateProgressed) { int currentPosition = (int) (Math.round(((double) CustomVideoView.this.getCurrentPosition()) / 1000.0d) * 1000); CustomVideoView.this.mPlaySb.setProgress(currentPosition); CustomVideoView.this.mCurrentTimeTv.setText(CustomVideoView.this.setTimeFormatter(currentPosition)); } if (CustomVideoView.this.listener != null) { CustomVideoView.this.listener.onBufferUpdate(CustomVideoView.this.getCurrentPosition()); } sendEmptyMessageDelayed(1, 1000); return; } return; default: return; } } }; private boolean mIsComplete; private boolean mIsRealPause; private ProgressBar mLoadingBar; private ImageButton mMiniPlayBtn; private ViewGroup mParentContainar; private ImageButton mPlayBackIBtn; private SeekBar mPlaySb; private RelativeLayout mPlayerView; private ScreenEventReciver mScreenEventReciver; private int mScreenWidth; private LinearLayout mTopBarLl; private TextView mTotalTimeTv; private String mUrl; private TextureView mVideoView; private MediaPlayer mediaPlayer; private TextView nameTv; private int playerState = 0; private int showTopBottomBarTime = 0; private Surface videoSurface; public interface VideoPlayerListener { void onAdVideoLoadComplete(); void onAdVideoLoadFailed(); void onAdVideoLoadSuccess(); void onBufferUpdate(int i); void onClickBackBtn(); void onClickFullScreenBtn(); void onClickPlay(); void onClickVideo(); } public interface ADFrameImageLoadListener { void onStartFrameLoad(String str, ImageLoaderListener imageLoaderListener); } public interface ImageLoaderListener { void onLoadingComplete(Bitmap bitmap); } private class ScreenEventReciver extends BroadcastReceiver { private ScreenEventReciver() { } /* synthetic */ ScreenEventReciver(CustomVideoView x0, AnonymousClass1 x1) { this(); } public void onReceive(Context context, Intent intent) { Log.i(CustomVideoView.TAG, "onReceive: " + intent.getAction()); String action = intent.getAction(); Object obj = -1; switch (action.hashCode()) { case -2128145023: if (action.equals("android.intent.action.SCREEN_OFF")) { int obj2 = 1; break; } break; case 823795052: if (action.equals("android.intent.action.USER_PRESENT")) { obj2 = null; break; } break; } switch (obj2) { case null: if (CustomVideoView.this.playerState != 2) { return; } if (CustomVideoView.this.mIsRealPause) { CustomVideoView.this.pause(); return; } else { CustomVideoView.this.resume(); return; } case 1: if (CustomVideoView.this.playerState == 1) { CustomVideoView.this.pause(); return; } return; default: return; } } } public void timeFunction() { if (this.mBottomPlayRl.getVisibility() == 0) { LogUtil.i(TAG, "handleMessage:visible"); this.showTopBottomBarTime++; if (this.showTopBottomBarTime >= 5) { this.showTopBottomBarTime = 0; showBar(false); return; } return; } this.showTopBottomBarTime = 0; } public CustomVideoView(Context context, ViewGroup parentContainer) { super(context); this.mParentContainar = parentContainer; this.audioManager = (AudioManager) getContext().getSystemService("audio"); initDate(); initView(); registerBroadcastReceiver(); } private void initDate() { DisplayMetrics dm = new DisplayMetrics(); ((WindowManager) getContext().getSystemService("window")).getDefaultDisplay().getMetrics(dm); this.mScreenWidth = dm.widthPixels; this.mDestationHeight = (int) (((float) this.mScreenWidth) * VIDEO_HEIGHT_PERCENT); this.mFormatBuilder = new StringBuilder(); this.mFormatter = new Formatter(this.mFormatBuilder, Locale.getDefault()); } private void initView() { this.mPlayerView = (RelativeLayout) LayoutInflater.from(getContext()).inflate(R.layout.album_custom_video_view, this); this.mPlayerView.setOnClickListener(this); this.mLoadingBar = (ProgressBar) this.mPlayerView.findViewById(R.id.load_iv); this.mVideoView = (TextureView) this.mPlayerView.findViewById(R.id.play_video_textureview); this.mVideoView.setOnClickListener(this); this.mVideoView.setKeepScreenOn(true); this.mVideoView.setSurfaceTextureListener(this); this.mTopBarLl = (LinearLayout) this.mPlayerView.findViewById(R.id.shoto_top_tab_ll); this.mBottomPlayRl = (RelativeLayout) this.mPlayerView.findViewById(R.id.bottom_play_rl); this.mMiniPlayBtn = (ImageButton) this.mBottomPlayRl.findViewById(R.id.play_btn); this.mPlaySb = (SeekBar) this.mBottomPlayRl.findViewById(R.id.play_sb); this.mPlaySb.setOnSeekBarChangeListener(this); this.mMiniPlayBtn.setOnClickListener(this); this.mCurrentTimeTv = (TextView) this.mBottomPlayRl.findViewById(R.id.time_current_tv); this.mTotalTimeTv = (TextView) this.mBottomPlayRl.findViewById(R.id.total_time_tv); showBar(false); this.nameTv = (TextView) findViewById(R.id.photo_name_tv); this.mPlayBackIBtn = (ImageButton) findViewById(R.id.media_back_btn); this.mPlayBackIBtn.setOnClickListener(this); this.mPlayerView.setOnClickListener(this); LayoutParams params = new LayoutParams(this.mScreenWidth, this.mDestationHeight); params.addRule(13); this.mPlayerView.setLayoutParams(params); } public void setDataSource(String url) { this.mUrl = url; } public void onClick(View view) { if (view.getId() == R.id.play_video_textureview) { if (this.mTopBarLl.getVisibility() == 0) { this.mTopBarLl.setVisibility(8); this.mBottomPlayRl.setVisibility(8); return; } this.mTopBarLl.setVisibility(0); this.mBottomPlayRl.setVisibility(0); } else if (view.getId() == R.id.play_btn) { if (this.playerState == 2) { seekAndResume(this.mPlaySb.getProgress()); } else if (this.playerState == 0) { load(); } else { pause(); } } else if (view.getId() == R.id.media_back_btn && this.listener != null) { this.listener.onClickBackBtn(); } } private void registerBroadcastReceiver() { if (this.mScreenEventReciver == null) { this.mScreenEventReciver = new ScreenEventReciver(this, null); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction("android.intent.action.SCREEN_OFF"); intentFilter.addAction("android.intent.action.USER_PRESENT"); getContext().registerReceiver(this.mScreenEventReciver, intentFilter); } } private void unRegisterBroadcastReceiver() { if (this.mScreenEventReciver != null) { getContext().unregisterReceiver(this.mScreenEventReciver); } } public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i, int i1) { LogUtil.d(TAG, "onSurfaceTextureAvailable"); this.videoSurface = new Surface(surfaceTexture); checkMediaPlayer(); this.mediaPlayer.setSurface(this.videoSurface); load(); } public void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int i, int i1) { LogUtil.d(TAG, "onSurfaceTextureSizeChanged"); } public boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) { return false; } public void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) { } public boolean onTouchEvent(MotionEvent event) { return true; } /* Access modifiers changed, original: protected */ public void onVisibilityChanged(View changedView, int visibility) { Log.d(TAG, "onVisibilityChanged: " + visibility + "," + this.mMiniPlayBtn.getVisibility()); super.onVisibilityChanged(changedView, visibility); if (visibility != 0 || this.playerState != 2) { pause(); } else if (isRealPause() || isComplete()) { pause(); } else { resume(); } } public void onPrepared(MediaPlayer mediaPlayer) { LogUtil.i(TAG, "onPrepare"); showPlayView(); this.mPlaySb.setMax(getDuration()); this.mTotalTimeTv.setText(setTimeFormatter(getDuration())); this.mediaPlayer = mediaPlayer; if (this.mediaPlayer != null) { mediaPlayer.setOnBufferingUpdateListener(this); this.mCurrentCount = 0; if (this.listener != null) { this.listener.onAdVideoLoadSuccess(); } setCurrentPlayState(2); resume(); } } public void onCompletion(MediaPlayer mp) { LogUtil.i(TAG, "onCompletion"); if (this.listener != null) { this.listener.onAdVideoLoadComplete(); } playBack(); setIsComplete(true); setIsRealPause(true); } public boolean onInfo(MediaPlayer mediaPlayer, int i, int i1) { return false; } public boolean onError(MediaPlayer mp, int what, int extra) { LogUtil.i(TAG, "do error:" + what + ",extra:" + extra); this.playerState = 1; this.mediaPlayer = mp; if (this.mediaPlayer != null) { this.mediaPlayer.reset(); } if (this.mCurrentCount >= 3) { showPauseView(false); if (this.listener != null) { this.listener.onAdVideoLoadFailed(); } } stop(); return false; } public void load() { LogUtil.i(TAG, "load:" + this.mUrl); if (this.playerState == 0) { showLoadingView(); try { setCurrentPlayState(0); checkMediaPlayer(); mute(true); this.mediaPlayer.setDataSource(this.mUrl); this.nameTv.setText(this.mUrl.substring(this.mUrl.lastIndexOf("/") + 1)); this.mediaPlayer.prepareAsync(); } catch (Exception e) { e.printStackTrace(); stop(); } } } public void stop() { LogUtil.i(TAG, "do stop"); if (this.mediaPlayer != null) { this.mediaPlayer.reset(); this.mediaPlayer.setOnSeekCompleteListener(null); this.mediaPlayer.stop(); this.mediaPlayer.release(); this.mediaPlayer = null; } this.mHandler.removeCallbacksAndMessages(null); setCurrentPlayState(0); if (this.mCurrentCount <= 3) { this.mCurrentCount++; load(); return; } showPauseView(false); } public void pause() { if (this.playerState == 1) { LogUtil.i(TAG, "do full pause"); setCurrentPlayState(2); if (isPlaying()) { this.mediaPlayer.pause(); if (!this.canPlay) { this.mediaPlayer.seekTo(0); } } showPauseView(false); this.mHandler.removeCallbacksAndMessages(null); } } public void resume() { if (this.playerState == 2) { mute(false); LogUtil.i(TAG, "resume"); if (isPlaying()) { showPauseView(false); return; } entryResumeState(); this.mediaPlayer.setOnSeekCompleteListener(null); this.mediaPlayer.start(); this.mHandler.sendEmptyMessage(1); showPauseView(true); } } public void destory() { LogUtil.i(TAG, "do destory"); if (this.mediaPlayer != null) { this.mediaPlayer.setOnSeekCompleteListener(null); this.mediaPlayer.stop(); this.mediaPlayer.release(); this.mediaPlayer = null; } setCurrentPlayState(0); this.mCurrentCount = 0; setIsComplete(false); setIsRealPause(false); unRegisterBroadcastReceiver(); this.mHandler.removeCallbacksAndMessages(null); showPauseView(false); } public void playBack() { LogUtil.i(TAG, " do play back"); setCurrentPlayState(2); this.mHandler.removeCallbacksAndMessages(null); if (this.mediaPlayer != null) { this.mediaPlayer.setOnSeekCompleteListener(null); this.mediaPlayer.seekTo(0); this.mediaPlayer.pause(); } showPauseView(false); } private void setCurrentPlayState(int state) { this.playerState = state; } public boolean isPlaying() { if (this.mediaPlayer == null || !this.mediaPlayer.isPlaying()) { return false; } return true; } private synchronized void checkMediaPlayer() { if (this.mediaPlayer == null) { this.mediaPlayer = createMediaPlayer(); } } private MediaPlayer createMediaPlayer() { this.mediaPlayer = new MediaPlayer(); this.mediaPlayer.reset(); this.mediaPlayer.setOnPreparedListener(this); this.mediaPlayer.setOnCompletionListener(this); this.mediaPlayer.setOnInfoListener(this); this.mediaPlayer.setOnErrorListener(this); this.mediaPlayer.setAudioStreamType(3); if (this.videoSurface == null || !this.videoSurface.isValid()) { stop(); } else { this.mediaPlayer.setSurface(this.videoSurface); } return this.mediaPlayer; } private void entryResumeState() { this.canPlay = true; setCurrentPlayState(1); setIsRealPause(false); setIsComplete(false); } public void setIsComplete(boolean isComplete) { this.mIsComplete = isComplete; } public void setIsRealPause(boolean isRealPause) { this.mIsRealPause = isRealPause; } public void mute(boolean mute) { this.isMute = mute; if (this.mediaPlayer != null && this.audioManager != null) { float volume = this.isMute ? 0.0f : 1.0f; this.mediaPlayer.setVolume(volume, volume); } } public void seekAndResume(int position) { if (this.mediaPlayer != null) { showPauseView(true); entryResumeState(); this.mediaPlayer.seekTo(position); this.mediaPlayer.setOnSeekCompleteListener(new OnSeekCompleteListener() { public void onSeekComplete(MediaPlayer mp) { LogUtil.d(CustomVideoView.TAG, "do seek and resume"); CustomVideoView.this.mediaPlayer.start(); CustomVideoView.this.mHandler.sendEmptyMessage(1); } }); } } public void seekAndPause(int position) { if (this.playerState == 1) { showPauseView(false); setCurrentPlayState(2); if (isPlaying()) { this.mediaPlayer.seekTo(position); this.mediaPlayer.setOnSeekCompleteListener(new OnSeekCompleteListener() { public void onSeekComplete(MediaPlayer mp) { LogUtil.d(CustomVideoView.TAG, "do seek and pause"); CustomVideoView.this.mediaPlayer.pause(); CustomVideoView.this.mHandler.removeCallbacksAndMessages(null); } }); } } } private void showPauseView(boolean show) { this.mLoadingBar.setVisibility(8); this.mMiniPlayBtn.setImageResource(show ? R.drawable.album_btn_pause_media : R.drawable.album_icon_play_media); } private void showLoadingView() { this.mLoadingBar.setVisibility(0); this.mMiniPlayBtn.setImageResource(R.drawable.album_icon_play_media); this.showTopBottomBarTime = 0; } private void showPlayView() { this.mLoadingBar.setVisibility(8); this.mMiniPlayBtn.setImageResource(R.drawable.album_btn_pause_media); this.showTopBottomBarTime = 0; } private void showBar(boolean isShow) { int i; int i2 = 0; LinearLayout linearLayout = this.mTopBarLl; if (isShow) { i = 0; } else { i = 8; } linearLayout.setVisibility(i); RelativeLayout relativeLayout = this.mBottomPlayRl; if (!isShow) { i2 = 8; } relativeLayout.setVisibility(i2); } public int getCurrentPosition() { if (this.mediaPlayer != null) { return this.mediaPlayer.getCurrentPosition(); } return -1; } public int getDuration() { if (this.mediaPlayer != null) { return this.mediaPlayer.getDuration(); } return -1; } private String setTimeFormatter(int timeMs) { int totalSeconds = timeMs / 1000; int seconds = totalSeconds % 60; int minutes = (totalSeconds / 60) % 60; int hours = totalSeconds / 3600; this.mFormatBuilder.setLength(0); if (hours > 0) { return this.mFormatter.format("%d:%02d:%02d", new Object[]{Integer.valueOf(hours), Integer.valueOf(minutes), Integer.valueOf(seconds)}).toString(); } return this.mFormatter.format("%02d:%02d", new Object[]{Integer.valueOf(minutes), Integer.valueOf(seconds)}).toString(); } public boolean isRealPause() { return this.mIsRealPause; } public boolean isComplete() { return this.mIsComplete; } public void onBufferingUpdate(MediaPlayer mediaPlayer, int i) { } public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { if (fromUser) { LogUtil.i(TAG, "onProgressChanged:" + this.isUpdateProgressed); this.isUpdateProgressed = true; this.showTopBottomBarTime = 0; this.mCurrentTimeTv.setText(setTimeFormatter(seekBar.getProgress())); } } public void onStartTrackingTouch(SeekBar seekBar) { LogUtil.i(TAG, "onStartTrackingTouch:" + this.isUpdateProgressed); this.isUpdateProgressed = true; this.showTopBottomBarTime = 0; } public void onStopTrackingTouch(SeekBar seekBar) { LogUtil.i(TAG, "onStopTrackingTouch:" + this.isUpdateProgressed); this.isUpdateProgressed = false; if (this.playerState == 1) { seekAndResume(seekBar.getProgress()); } } public void setListener(VideoPlayerListener listener) { this.listener = listener; } }
f018de86bf46edc8f4ca330d9874321b16e4bda0
db0a10be2c7a60316e879f70d41f97045b06e4c4
/app/src/main/java/com/ashant/mytwitter/ui/home/HomeFragment.java
024b963036d92ebd540482b094f7a7dbe608c0fb
[]
no_license
AshantThapa/MyTwitter
b16f589a23d2a4aed3069723a6adb17c4a1dedfa
ac873062db500b2886476de86ce21174dd9ab8b2
refs/heads/master
2020-12-08T13:03:35.191579
2020-01-10T07:26:59
2020-01-10T07:26:59
232,988,513
0
0
null
null
null
null
UTF-8
Java
false
false
2,617
java
package com.ashant.mytwitter.ui.home; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.ashant.mytwitter.Camera; import com.ashant.mytwitter.Login_activity; import com.ashant.mytwitter.R; import com.ashant.mytwitter.adapter.TweetAdapter; import com.ashant.mytwitter.api.ApiClass; import com.ashant.mytwitter.model.TweetM; import java.util.List; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; public class HomeFragment extends Fragment { Camera cm = new Camera(); Login_activity la = new Login_activity(); RecyclerView recyclerView; public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.inflate( R.layout.fragment_home, container, false ); recyclerView = root.findViewById( R.id.HomeRV ); loadCurrentUser(); return root; } private void loadCurrentUser() { String token; if (la.Token.isEmpty()) { token = cm.token; //Toast.makeText(getContext(), "token " +token, Toast.LENGTH_SHORT).show(); } else { token = la.Token; // Toast.makeText(getContext(), "token " +token, Toast.LENGTH_SHORT).show(); } ApiClass usersAPI = new ApiClass(); Call<List<TweetM>> userCall = usersAPI.calls().GetTweet( token ); userCall.enqueue( new Callback<List<TweetM>>() { @Override public void onResponse(Call<List<TweetM>> call, Response<List<TweetM>> response) { if (!response.isSuccessful()) { Toast.makeText( getContext(), "Code " + response.code(), Toast.LENGTH_SHORT ).show(); return; } List<TweetM> tweetMS = response.body(); TweetAdapter tweetAdapter = new TweetAdapter( getContext(), tweetMS ); recyclerView.setAdapter( tweetAdapter ); recyclerView.setLayoutManager( new LinearLayoutManager( getContext() ) ); } @Override public void onFailure(Call<List<TweetM>> call, Throwable t) { Toast.makeText( getContext(), "Error " + t.getLocalizedMessage(), Toast.LENGTH_SHORT ).show(); } } ); } }
[ "Ashant Thapa" ]
Ashant Thapa
f15e6a452ab263980c5206a2e8cef91c2cd0de97
ed563cb3e2166d02bb3871e498949c90f63f7f94
/src/main/java/info/masjidy/responses/PrayerTimeListResponse.java
5ca92bd581348b0e308be9fe1fcb8f734f314d37
[ "MIT" ]
permissive
mmakhalaf/MasjidyWS
f1876800a0592cb06b488de8654588b40dc44090
50e9618b107222f06686e38c6be2969e6fb37540
refs/heads/master
2020-04-11T19:13:15.520567
2018-12-16T18:11:22
2018-12-16T18:11:22
162,026,746
0
0
null
null
null
null
UTF-8
Java
false
false
1,128
java
package info.masjidy.responses; import info.masjidy.models.PrayerTime; import info.masjidy.utils.PrayerTimeList; import java.util.ArrayList; import java.util.List; public class PrayerTimeListResponse { List<PrayerTimeResponse> prayerTimes = new ArrayList<>(); public PrayerTimeListResponse(PrayerTimeList pts) { if (pts != null) { for (PrayerTime pt : pts) { prayerTimes.add(new PrayerTimeResponse(pt)); } } } /** * Constructor to be used when all the prayer times are for one mosque. * This should be more performant as it won't involve getting the id from underlying mosque object */ public PrayerTimeListResponse(PrayerTimeList pts, Long mosqueId) { if (pts != null) { for (PrayerTime pt : pts) { prayerTimes.add(new PrayerTimeResponse(pt, mosqueId)); } } } public List<PrayerTimeResponse> getPrayerTimes() { return prayerTimes; } public void setPrayerTimes(List<PrayerTimeResponse> prayerTimes) { this.prayerTimes = prayerTimes; } }
a47f9c192384d814561c7214f8b7cdafb00333eb
05736c4600e142f5a9f84709169aa42acb8fb8b7
/app/src/main/java/com/pencilbox/netknight/presentor/AppInfoAdapter.java
fbdebebada1ef3c12a9c021040b4761bb2e92f8f
[ "Apache-2.0" ]
permissive
litangyu/NetKnight
bbdf2e4b72eeb0a455d51babe23d9c0c31ce5974
af208adc89f3dd81d4ce2e92475e00bd12a74b49
refs/heads/master
2021-08-14T18:00:21.876776
2017-11-16T10:58:28
2017-11-16T10:58:28
110,961,996
1
0
null
null
null
null
UTF-8
Java
false
false
5,963
java
package com.pencilbox.netknight.presentor; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.Spinner; import android.widget.TextView; import com.pencilbox.netknight.R; import com.pencilbox.netknight.model.App; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Created by wu on 16/6/27. */ public class AppInfoAdapter extends BaseAdapter { private List<App> list_appinfo = new ArrayList<>(); LayoutInflater inflater = null; //存放用户选中的item咯,key 为 appId ,value 为 用户选中的position private Map<Long,Integer> mWiflSelectedMap; private Map<Long,Integer> mMobileSelectedMap; public List<App> getDatas(){ return list_appinfo; } private Context mContext; public void addAll(List<App> appLists) { list_appinfo.addAll(appLists); for(int i=0;i<appLists.size();i++){ mWiflSelectedMap.put(appLists.get(i).getId(),appLists.get(i).getWifiType()); mMobileSelectedMap.put( appLists.get(i).getId(),appLists.get(i).getMobileDataType()); } } public AppInfoAdapter(Context context) { this.mContext = context; inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mWiflSelectedMap = new HashMap<>(); mMobileSelectedMap = new HashMap<>(); } public int getCount() { return list_appinfo.size(); } public App getItem(int position) { return list_appinfo.get(position); } public long getItemId(int position) { return 0; } public View getView(final int position, View convertview, ViewGroup arg2) { View view = null; ViewHolder holder = null; if (convertview == null || convertview.getTag() == null) { view = inflater.inflate(R.layout.app_items, null); holder = new ViewHolder(view); // holder.wifi_spinner = (Spinner) view.findViewById(R.id.wifi_spinner); // holder.celluar_spinner = (Spinner) view.findViewById(R.id.celluar_spinner); //我咋监听到是哪一个信息呢 SpinnerAdapter adapter = new SpinnerAdapter(mContext); holder.wifi_spinner.setAdapter(adapter); holder.celluar_spinner.setAdapter(adapter); holder.celluar_spinner.setOnItemSelectedListener(new OnSpinnerItemListener(holder.celluar_spinner,false)); holder.wifi_spinner.setOnItemSelectedListener(new OnSpinnerItemListener(holder.wifi_spinner,true)); view.setTag(holder); } else { view = convertview; holder = (ViewHolder) convertview.getTag(); } App appInfo = getItem(position); holder.appIcon.setImageDrawable(appInfo.getIcon()); holder.tvAppLabel.setText(appInfo.getName()); holder.tvPkgName.setText(appInfo.getPkgname()); //存储spinner对应的appId的信息 holder.celluar_spinner.setTag(appInfo); holder.wifi_spinner.setTag(appInfo); // int selectedPosition = mMobileSelectedMap.get(appInfo.getId()); holder.celluar_spinner.setSelection(mMobileSelectedMap.get(appInfo.getId())); holder.wifi_spinner.setSelection(mWiflSelectedMap.get(appInfo.getId())); if(appInfo.isAccessVpn()){ holder.wifi_spinner.setVisibility(View.VISIBLE); holder.celluar_spinner.setVisibility(View.VISIBLE); holder.tv_vpn_through.setVisibility(View.GONE); }else{ holder.tv_vpn_through.setVisibility(View.VISIBLE); holder.wifi_spinner.setVisibility(View.GONE); holder.celluar_spinner.setVisibility(View.GONE); } return view; } /** * spinner的Item的监听器 */ private class OnSpinnerItemListener implements AdapterView.OnItemSelectedListener{ Spinner mSpinner ; boolean isWifi = true; public OnSpinnerItemListener(Spinner spinner,boolean isWifi){ mSpinner = spinner; this.isWifi = isWifi; } @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { // Log.d("AppInfoAdapter","appId:"+mSpinner.getTag()+" position"+position); //仅仅是为了存储用户选择了position的信息 App appInfo = (App) mSpinner.getTag(); if(isWifi){ mWiflSelectedMap.put(appInfo.getId(),position); if(appInfo.getWifiType()!=position){ appInfo.setWifiType(position); appInfo.save(); } }else{ mMobileSelectedMap.put(appInfo.getId(),position); if(appInfo.getMobileDataType()!=position){ appInfo.setMobileDataType(position); appInfo.save(); } } } @Override public void onNothingSelected(AdapterView<?> parent) { } } class ViewHolder { ImageView appIcon; TextView tvAppLabel, tvPkgName,tv_vpn_through; Spinner wifi_spinner,celluar_spinner; public ViewHolder(View view) { this.appIcon = (ImageView) view.findViewById(R.id.app_icon); this.tvAppLabel = (TextView) view.findViewById(R.id.tvAppLabel); this.tvPkgName = (TextView) view.findViewById(R.id.tvPkgName); this.wifi_spinner = (Spinner) view.findViewById(R.id.wifi_spinner); this.celluar_spinner= (Spinner) view.findViewById(R.id.celluar_spinner); this.tv_vpn_through = (TextView) view.findViewById(R.id.tv_vpn_through); } } }
b4ed8f234e857b50297acbe2918ef2d593712ca4
5b0b8904f367420e269445b03177d5c873ad0569
/java-design-pattern/src/main/java/lol/kent/practice/pattern/observer/Bootstrap.java
7d3993e5b6b1650f1dea0d7d0a64458e430ccccc
[ "MIT" ]
permissive
ShunqinChen/practice-java
565c4c5c93a99ea301516399b8ec3874e8712d64
3d9ed2d18335af540022823d6e4516717419cca1
refs/heads/master
2023-05-14T14:25:21.303261
2023-05-07T12:15:31
2023-05-07T12:15:31
145,184,406
0
0
MIT
2021-03-31T21:27:51
2018-08-18T02:45:45
Java
UTF-8
Java
false
false
891
java
package lol.kent.practice.pattern.observer; /** * 标题、简要说明. <br> * 类详细说明. * <p> * Copyright: Copyright (c) 2019年04月02日 18:11 * <p> * Company: AMPM Fit * <p> * * @author Shunqin.Chen * @version x.x.x */ public class Bootstrap { public static void main(String[] args) { AuthenticationManager manager = new AuthenticationManager(); AuthenticationProvider authenticationProvider = new AuthenticationProvider(manager); AuthorizationProvider authorizationProvider = new AuthorizationProvider(manager); Authentication authentication = new Authentication("Kent","password"); manager.authenticate(authentication); // 删除观察者后,观察者将收不到活动通知 manager.deleteObserver(authenticationProvider); manager.authenticate(new Authentication("Bob", "123456")); } }
1b8c406ec4d48389f31ddaa348047fb3dc95b7b9
1b72e05948dfa71d460a17fcc40e0b1a66149aac
/test/ru/job4j/array/EndsWithTest.java
e81c258193ceba2abd14a8f2d3cd915222be8173
[]
no_license
Manlexey/job4j_elementary
dc5c2f4d4775226e811644cb317810c56e09e516
c913466ef4d2960e45a6a4ff96baf974d61630aa
refs/heads/master
2023-07-08T03:30:54.522360
2021-08-17T20:05:44
2021-08-17T20:05:44
287,248,374
1
0
null
2020-08-13T10:24:31
2020-08-13T10:24:30
null
UTF-8
Java
false
false
640
java
package ru.job4j.array; import org.junit.Test; import static org.hamcrest.Matchers.is; import static org.junit.Assert.*; public class EndsWithTest { @Test public void whenEndWithPrefixThenTrue() { char[] word = {'H', 'e', 'l', 'l', 'o'}; char[] post = {'l', 'o'}; boolean result = EndsWith.endsWith(word, post); assertThat(result, is(true)); } @Test public void whenNotEndWithPrefixThenFalse() { char[] word = {'H', 'e', 'l', 'l', 'o'}; char[] post = {'l', 'a'}; boolean result = EndsWith.endsWith(word, post); assertThat(result, is(false)); } }
[ "Alexey_3588" ]
Alexey_3588
c586cd8a0e1efa0dc22137e7d56fee38a8a32a7e
493f36971e352088e67296d0bcd547284f541ab8
/04_implementation/src/hanpuku1/database/TicketList.java
f88f6e9954fbda9191aa7350535bbdc5a87fff9f
[]
no_license
TakedaMasashi46/Team5
569fdc9a7141fdfff55146e43d4a4f89cc2f2cf5
14fb342c8a8091feb2fdbf585909dfce98ebdab2
refs/heads/master
2022-11-16T04:41:18.855632
2020-06-16T02:35:00
2020-06-16T02:35:00
268,668,955
0
0
null
null
null
null
UTF-8
Java
false
false
992
java
package database; import java.util.ArrayList; public class TicketList { ArrayList<Ticket> ticketList =new ArrayList<Ticket>(); public TicketList() { ticketList.add(new Ticket(1, "水族館", 1000, "2020-6-6", 20)); ticketList.add(new Ticket(2,"映画館",3000,"2020-07-10",50)); ticketList.add(new Ticket(3,"美術館",800,"2020-08-12",10)); } public String showTicketNumberName() { String data = "チケット名:チケット番号="; for(Ticket t:ticketList) { data+=t.getTicketName(); data+=":"; data+=t.getTicketNumber(); data+="="; } return data; } public Ticket getTicket(int num) { for(Ticket t:ticketList ) { if(num == t.getTicketNumber()) { return t; //メンバーオブジェクト返す } } return null; } public String showAllTicketData() { String data=""; for(Ticket t:ticketList) { data+=t.showTicketData(); data+="="; data+="---------"; data+="="; } return data; } }
a17918eb6211fc2144dc2d0107fec183db4364fa
f34805066fd387b143e7b7de5e2df463df3febc9
/mssc-brewery/src/main/java/app/wordyourself/msscbrewery/web/model/v2/BeerDtoV2.java
079ec52ed50a1f7db2acd002e1d666976351459c
[]
no_license
alperarabaci/spring-microservices-cloud
1c17e10ac836fd038e1045808a242db0f2d60239
14ff873c0ec42e73d89cd93c66854f6e7206b853
refs/heads/master
2023-06-22T19:22:14.158080
2020-08-20T14:08:23
2020-08-20T14:08:23
282,906,295
0
0
null
null
null
null
UTF-8
Java
false
false
740
java
package app.wordyourself.msscbrewery.web.model.v2; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import javax.validation.constraints.Null; import javax.validation.constraints.Positive; import java.time.OffsetDateTime; import java.util.UUID; /** * alper - 05/08/2020 */ @Data @NoArgsConstructor @AllArgsConstructor @Builder public class BeerDtoV2 { @Null private UUID id; @NotBlank private String beerName; @NotNull private BeerStyleEnum beerStyle; @Positive private Long upc; OffsetDateTime createdDate; OffsetDateTime lastModifiedDate; }
0000f1507bf86e2a6664c4b6c03e052f055e7c1c
f601065e7a8a4adcb0befa9fc436354ed8922b5f
/src/main/java/com/ocp/day28/ExceptionDemo7.java
8786b8e188ae2115056a947292ccbe76b599e2c2
[]
no_license
Beast090320/Java0316
a17336ab7ceb8f29a88ffd014f0949bd131911ea
1a42edf5ba99bfb978f7fdce2d47058a09ec0536
refs/heads/master
2023-05-12T05:55:00.830995
2021-06-10T13:51:33
2021-06-10T13:51:33
348,325,835
0
0
null
null
null
null
UTF-8
Java
false
false
512
java
package com.ocp.day28; import java.text.DateFormat; import java.text.ParseException; import java.util.Date; public class ExceptionDemo7 { public static void main(String[] args) { String mybirthday = "2000/1/一"; DateFormat df = DateFormat.getDateInstance(); try { Date date = df.parse(mybirthday); System.out.println(date); } catch (ParseException e) { System.out.println("日期轉換失敗, " + e); } } }
[ "a3432@DESKTOP-GAD7FN7" ]
a3432@DESKTOP-GAD7FN7
f8fc1fec93092839678c9034c109d3aa47244fe4
cd3ccc969d6e31dce1a0cdc21de71899ab670a46
/agp-7.1.0-alpha01/tools/base/build-system/builder/src/test/java/com/android/builder/core/DefaultApiVersionTest.java
df4d9c9140f814d5cbd8ac778dabb95c070130ec
[ "Apache-2.0" ]
permissive
jomof/CppBuildCacheWorkInProgress
75e76e1bd1d8451e3ee31631e74f22e5bb15dd3c
9e3475f6d94cb3239f27ed8f8ee81b0abde4ef51
refs/heads/main
2023-05-28T19:03:16.798422
2021-06-10T20:59:25
2021-06-10T20:59:25
374,736,765
0
1
Apache-2.0
2021-06-07T21:06:53
2021-06-07T16:44:55
Java
UTF-8
Java
false
false
1,274
java
/* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.builder.core; import static com.google.common.truth.Truth.assertThat; import com.android.builder.model.ApiVersion; import nl.jqno.equalsverifier.EqualsVerifier; import org.junit.Test; public class DefaultApiVersionTest { @Test public void checkPreviewSdkVersion() { ApiVersion version = new DefaultApiVersion("P"); assertThat(version.getApiLevel()).isEqualTo(27); assertThat(version.getApiString()).isEqualTo("P"); assertThat(version.getCodename()).isEqualTo("P"); } @Test public void checkEquals() { EqualsVerifier.forClass(DefaultApiVersion.class).verify(); } }
d7fdf5633b402252553dd6627917cc5546e76693
55188acfb5b669fdc9dcb69a25fc6b8b1a241942
/leets/leet038.java
c49609714d264187264ac667f4b9b9f9d8478093
[]
no_license
iAnimo/mycodes
b0688c7978f50cd4d61b28b2a523aa7178d4d3e2
3bbd35a9c5477c4da465fa98f16e21fc08348512
refs/heads/main
2023-03-10T16:47:55.984189
2021-02-28T09:29:55
2021-02-28T09:29:55
343,008,627
0
0
null
null
null
null
UTF-8
Java
false
false
1,521
java
package leets; import java.util.LinkedList; import java.util.Queue; import utils.TreeNode; public class leet038 { /** * 给定一个二叉树,找出其最小深度。 */ // 递归法 int minDepth(TreeNode root) { if ( root == null) { return 0; } //左子树为空,右子树不为空,说明最小深度是 1 + 右子树的深度。 if ( root.left == null && root.right != null){ return 1 + minDepth(root.right); } if (root.left != null && root.right == null) { return 1 + minDepth(root.left); } return 1 + Math.min(minDepth(root.right), minDepth(root.left)); } // 迭代法 int minDepth2(TreeNode root) { if (root == null) { return 0; } int depth = 0; Queue<TreeNode> que = new LinkedList<>(); que.add(root); while (!que.isEmpty()) { int size = que.size(); depth++; for (int i = 0; i < size; i++) { TreeNode node = que.poll(); if (node.left != null) { que.add(node.left); } if (node.right != null) { que.add(node.right); } if ( node.left == null && node.right == null) { return depth; } } } return depth; } }
9cdda7cabff60c83834b537971be7174a4c9c3f2
7122806f2f344a3c804318d6df47a92c9ec3ce97
/app/src/main/java/com/hearatale/phonic/data/model/typedef/SightWordsCategoryDef.java
421203127f697de87fb6a3ab183a88c2073103cf
[]
no_license
BrainyEducation/Phonics
851de68f35a75f576d5b6aaaa5091e18b08eff1f
df316165fdadb1d3947cb8371f48752956f74824
refs/heads/master
2020-05-01T02:52:42.110700
2019-05-17T03:02:33
2019-05-17T03:02:33
177,230,983
1
0
null
2019-05-17T03:02:34
2019-03-23T01:40:10
Java
UTF-8
Java
false
false
276
java
package com.hearatale.phonic.data.model.typedef; import android.support.annotation.IntDef; @IntDef({ SightWordsCategoryDef.PRE_K, SightWordsCategoryDef.KINDERGARTEN }) public @interface SightWordsCategoryDef { int PRE_K = 0; int KINDERGARTEN = 1; }
dc282715f8e5366161040519a2175a8d3b942245
0a4b6a83792ab567a8c27e1c8feacd8a4b66275e
/main/java/com/bdqn/WebConfig/SpringBootWevMvcConfig.java
929fc9509738bd0855ba84719f90bffba4b9ed0c
[ "Apache-2.0" ]
permissive
3144207329/t12
837ad754c85ef23115e261c0e89e4ff73bcf9069
248b97caaf9d30c140f626d364e613131251ff9c
refs/heads/master
2020-05-19T11:55:20.674202
2019-05-06T07:21:44
2019-05-06T07:21:44
185,003,456
0
0
null
null
null
null
UTF-8
Java
false
false
1,260
java
package com.bdqn.WebConfig; import com.bdqn.Interceptor.MyHandlerInterceptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration public class SpringBootWevMvcConfig implements WebMvcConfigurer { @Autowired private MyHandlerInterceptor myHandlerInterceptor; @Override public void addInterceptors(InterceptorRegistry registry){ registry.addInterceptor(myHandlerInterceptor).addPathPatterns("/**").excludePathPatterns(""); } @Override public void addViewControllers(ViewControllerRegistry registry){ registry.addViewController("/").setViewName("redirect:/home/login"); // superd.addViewControllers(registry); } @Override public void addCorsMappings(CorsRegistry registry){ registry.addMapping("/**").allowedOrigins("*").allowCredentials(true).allowedMethods("GET","POST").maxAge(3600); } }
[ "“[email protected]”" ]
54fe7403e3d690d42f59f2328db39c085d974c98
f8753a144ef25baafda6c4dd378bddfd6ae4599e
/app/src/main/java/flixster/com/flixster/MainActivity.java
d202d339cdc84308a20696d6e6871f1458fce34e
[]
no_license
mmacedonio/Flixster_Part_2
8a8f562770fff2a3b698458fe145f8fbb616177d
11935cb25e7dcee4454c9c5de575bad5df093963
refs/heads/master
2022-04-21T13:32:32.899630
2020-04-20T01:48:39
2020-04-20T01:48:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,500
java
package flixster.com.flixster; import android.os.Bundle; import android.util.Log; import com.codepath.asynchttpclient.AsyncHttpClient; import com.codepath.asynchttpclient.callback.JsonHttpResponseHandler; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.List; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import flixster.com.flixster.adapters.MovieAdapter; import flixster.com.flixster.models.Movie; import okhttp3.Headers; public class MainActivity extends AppCompatActivity { public static final String NOW_PLAYING_URL = "https://api.themoviedb.org/3/movie/now_playing?api_key=a07e22bc18f5cb106bfe4cc1f83ad8ed"; public static final String TAG = "MainActivity"; List<Movie> movies; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); RecyclerView rvMovies = findViewById(R.id.rvMovies); movies = new ArrayList<>(); //Create the Adapter final MovieAdapter movieAdapter = new MovieAdapter(this, movies); //Set the Adapter on the Recycler View rvMovies.setAdapter(movieAdapter); //Set the Layout Manager rvMovies.setLayoutManager( new LinearLayoutManager(this)); AsyncHttpClient client = new AsyncHttpClient(); client.get(NOW_PLAYING_URL, new JsonHttpResponseHandler() { @Override public void onSuccess(int statusCode, Headers headers, JSON json) { Log.d(TAG, "onSuccess"); JSONObject jsonObject = json.jsonObject; try { JSONArray results = jsonObject.getJSONArray("results"); Log.i(TAG, "Results" + results.toString()); movies.addAll(Movie.fromJsonArray(results)); movieAdapter.notifyDataSetChanged(); Log.i(TAG, "Movies: " + movies.size()); } catch (JSONException e) { Log.d(TAG, "Hit JSON Exception", e); e.printStackTrace(); } } @Override public void onFailure(int statusCode, Headers headers, String response, Throwable throwable) { Log.d(TAG, "onFailure"); } }); } }
14e9852466190091c02c92f532831cb1d0177cdc
aed324c76a46911f0bc9241390451990fa6c12c6
/src/cursojava/executavel/TestandoClassesFilhas.java
b20f4c69da7680f7ee4ded40832cd982e7db7687
[]
no_license
Marcelo-F/primeiro-programa-java
728fabd764b97f2d6b58d87d16e0102e93cbef31
277b9eed9cfdf8749025d1541c38f69c87a2e038
refs/heads/master
2021-01-15T02:40:01.359449
2020-03-20T15:08:26
2020-03-20T15:08:26
242,851,127
0
0
null
null
null
null
ISO-8859-1
Java
false
false
1,045
java
package cursojava.executavel; import cursojava.classes.Aluno; import cursojava.classes.Diretor; import cursojava.classes.Pessoa; import cursojava.classes.Secretario; public class TestandoClassesFilhas { public static void main(String[] args) { Aluno aluno = new Aluno (); aluno.setNome("Alex"); Diretor diretor = new Diretor(); diretor.setRegistroEducacao("331232131"); Secretario secretario = new Secretario(); secretario.setExperiencia("Administração"); System.out.println(aluno); System.out.println(diretor); System.out.println(secretario); System.out.println("Salário do aluno é" + aluno.salario()); System.out.println("Salário do diretor é" + diretor.salario()); System.out.println("Salário salario do secretário é" + secretario.salario()); teste(aluno); teste(diretor); teste(secretario); } public static void teste(Pessoa pessoa) { System.out.println("Essa pessoa é demais= "+pessoa.getNome()+ " e o salario de" +pessoa.salario()); } }
13172a183dad97adf2ad5998777ea04ae0a056ca
5e362b9070d4d08234de1d06288ff6692fb6836b
/android/app/src/main/java/com/quantie_18053/MainActivity.java
57b39b5882778d80bdafebae25fe8189216f06de
[]
no_license
crowdbotics-apps/quantie-18053
0a380b0f5cb9d1c4a5200e552a700f7fa3809d01
b9fe9938b16a3a479303c7768b3a4e162d67e5a8
refs/heads/master
2022-10-11T03:19:42.577082
2020-06-12T21:37:45
2020-06-12T21:37:45
271,879,635
0
0
null
null
null
null
UTF-8
Java
false
false
371
java
package com.quantie_18053; import com.facebook.react.ReactActivity; public class MainActivity extends ReactActivity { /** * Returns the name of the main component registered from JavaScript. * This is used to schedule rendering of the component. */ @Override protected String getMainComponentName() { return "quantie_18053"; } }
338af8d331a9d44c2fc1419fd985130e2676f468
fb370d66be228ba5bc6b3db8e339a1f5e222d912
/src/main/java/com/microsoft/store/partnercenter/models/partners/MpnProfile.java
d57ac4b345f324a00d1a8aac190f38c47df71878
[ "MIT" ]
permissive
Serik0/Partner-Center-Java
dd49495fcf624bba8fd428068ecdee2519f20217
9e10bb1c62b3d36c131795950b5553c36a0a3c4f
refs/heads/master
2022-01-04T14:39:11.853043
2020-03-04T20:02:43
2020-03-04T20:02:43
250,222,888
0
0
MIT
2020-03-26T10:07:13
2020-03-26T10:07:12
null
UTF-8
Java
false
false
1,014
java
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See the LICENSE file in the project root for full license information. package com.microsoft.store.partnercenter.models.partners; import com.microsoft.store.partnercenter.models.ResourceBaseWithLinks; import com.microsoft.store.partnercenter.models.StandardResourceLinks; /** * Microsoft Partner Network profile of a partner */ public class MpnProfile extends ResourceBaseWithLinks<StandardResourceLinks> { /** * Gets or sets the organization name. */ private String __PartnerName; public String getPartnerName() { return __PartnerName; } public void setPartnerName(String value) { __PartnerName = value; } /** * Gets or sets the Microsoft Partner Network Id */ private String __MpnId; public String getMpnId() { return __MpnId; } public void setMpnId(String value) { __MpnId = value; } }
af06498d647cea1865e6610426ce619ca217daea
3eb74b2a9a1b094b13a244ed37714568c47cc8b8
/MyProject/src/ch10/Calculator.java
08dd71b4efcdef7062ed4b3a6411deac7550ebcb
[]
no_license
Gamaspin/javawork
ae25b0963a1f89d59835b04b71e4423430e88798
8e345ddd523fa6342103b0d028cb504b14740fe6
refs/heads/main
2023-07-07T14:28:43.168465
2021-08-05T06:12:09
2021-08-05T06:12:09
392,977,982
0
0
null
2021-08-05T09:12:13
2021-08-05T09:12:13
null
UTF-8
Java
false
false
175
java
package ch10; interface Calculator { long add(long n1, long n2); long substract(long n1, long n2); long multiply(long n1, long n2); double divide(double n1, long n2); }
2b53d05c4e66330354c2360d9836d686d3429bcd
3a5a605790acc5105cf7845fa8f89c6962fff184
/src/test/java/integration/io/github/seleniumquery/by/SelectorsUtilTest.java
3aa0a9585b06846055d54429af84f6ca161c0222
[ "Apache-2.0" ]
permissive
hjralyc1/seleniumQuery
240326eae3e6874e9ffc97185d06054af0c7bac9
c3559d9d5bef35477712b810a2939402c75be18b
refs/heads/master
2020-03-28T19:37:01.701292
2015-05-02T18:01:42
2015-05-22T22:07:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,692
java
/* * Copyright (c) 2015 seleniumQuery authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package integration.io.github.seleniumquery.by; import infrastructure.junitrule.SetUpAndTearDownDriver; import io.github.seleniumquery.SeleniumQuery; import io.github.seleniumquery.by.SelectorUtils; import org.junit.Before; import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import java.util.List; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.nullValue; import static org.junit.Assert.assertThat; public class SelectorsUtilTest { @ClassRule public static SetUpAndTearDownDriver setUpAndTearDownDriverRule = new SetUpAndTearDownDriver(); @Rule public SetUpAndTearDownDriver setUpAndTearDownDriverRuleInstance = setUpAndTearDownDriverRule; WebDriver driver; @Before public void before() { driver = SeleniumQuery.$.driver().get(); } @Test public void testParent() { // fail("Not yet implemented"); } @Test public void lang_function() { WebElement french_p = driver.findElement(By.id("french-p")); WebElement brazilian_p = driver.findElement(By.id("brazilian-p")); WebElement hero_combo = driver.findElement(By.id("hero-combo")); WebElement htmlElement = driver.findElement(By.cssSelector("html")); WebElement bodyElement = driver.findElement(By.cssSelector("body")); assertThat(SelectorUtils.lang(french_p), is("fr")); assertThat(SelectorUtils.lang(brazilian_p), is("pt-BR")); assertThat(SelectorUtils.lang(hero_combo), is("pt-BR")); assertThat(SelectorUtils.lang(bodyElement), is("pt-BR")); assertThat(SelectorUtils.lang(htmlElement), is(nullValue())); } @Test public void testHasAttribute() { // fail("Not yet implemented"); } @Test public void testGetPreviousSibling() { // fail("Not yet implemented"); } @Test public void itselfWithSiblings() { WebElement onlyChild = driver.findElement(By.id("onlyChild")); WebElement grandsonWithSiblings = driver.findElement(By.id("grandsonWithSiblings")); assertThat(SelectorUtils.itselfWithSiblings(onlyChild).size(), is(1)); List<WebElement> grandsons = SelectorUtils.itselfWithSiblings(grandsonWithSiblings); assertThat(grandsons.size(), is(3)); assertThat(grandsons.get(0).getAttribute("id"), is("grandsonWithSiblings")); assertThat(grandsons.get(1).getAttribute("id"), is("grandsonB")); assertThat(grandsons.get(2).getAttribute("id"), is("grandsonC")); } @Test public void escapeSelector_should_escape_starting_integer() { String escapedSelector = SelectorUtils.escapeSelector("1a2b3c"); assertThat(escapedSelector, is("\\\\31 a2b3c")); } @Test public void escapeSelector_should_escape_colon() { String escapedSelector = SelectorUtils.escapeSelector("must:escape"); assertThat(escapedSelector, is("must\\:escape")); } @Test public void escapeSelector_should_escape_hyphen_if_next_char_is_hyphen_or_digit() { assertThat(SelectorUtils.escapeSelector("-abc"), is("-abc")); assertThat(SelectorUtils.escapeSelector("-"), is("\\-")); // only hyphen assertThat(SelectorUtils.escapeSelector("-123"), is("\\-123")); assertThat(SelectorUtils.escapeSelector("---"), is("\\---")); } @Test public void escapeAttributeValue__should_escape_strings_according_to_how_the_CSS_parser_works() { // abc -> "abc" assertThat(SelectorUtils.escapeAttributeValue("abc"), is("\"abc\"")); // a\"bc -> "a\"bc" assertThat(SelectorUtils.escapeAttributeValue("a\\\"bc"), is("\"a\\\"bc\"")); // a'bc -> "a'bc" assertThat(SelectorUtils.escapeAttributeValue("a'bc"), is("\"a'bc\"")); // a\tc -> "a\\tc" assertThat(SelectorUtils.escapeAttributeValue("a\\tc"), is("\"a\\\\tc\"")); } @Test public void intoEscapedXPathString() { assertThat(SelectorUtils.intoEscapedXPathString("abc"), is("'abc'")); assertThat(SelectorUtils.intoEscapedXPathString("a\"bc"), is("'a\"bc'")); assertThat(SelectorUtils.intoEscapedXPathString("a'bc"), is("concat('a', \"'\", 'bc')")); assertThat(SelectorUtils.intoEscapedXPathString("'abc'"), is("concat('', \"'\", 'abc', \"'\", '')")); } }