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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ddd99108a10750a76d6fdcec6a7560ea3ed9f019
| 24,704,651,910,425 |
a5131ebb0c36d2ce0a738492bfaf338f769af011
|
/ArrayStack.java
|
6fe553d37d561f7062eb9faee2771a70b05981da
|
[] |
no_license
|
USF-CS245-09-2018/practice-assignment-06-etbascur
|
https://github.com/USF-CS245-09-2018/practice-assignment-06-etbascur
|
220d9b660121d69309bc8d44979002830d38448c
|
2341e8af60037ee7d14f864333c109dc61a685fe
|
refs/heads/master
| 2020-04-02T01:04:28.419000 | 2018-10-19T23:37:18 | 2018-10-19T23:37:18 | 153,836,495 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class ArrayStack implements Stack {
Object[] arr = new Object[10];
int top = -1;
@Override
public void push(Object item) {
if(top ==arr.length-1){
doubleArrSize();
}
arr[++top]= item;
}
@Override
public Object pop() {
if(!empty()){
return arr[top--];
}
try {
throw new Exception();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
@Override
public Object peek() {
if(!empty()){
return arr[top];
}
else{
try {
throw new Exception();
} catch (Exception e) {
e.printStackTrace();
}
}
return null;
}
@Override
public boolean empty() {
return (top == -1);
}
private void doubleArrSize(){
Object[] newarr = new Object[arr.length*2];
for(int i= 0;i<arr.length;i++){
newarr[i]=arr[i];
}
arr = newarr;
}
}
|
UTF-8
|
Java
| 1,078 |
java
|
ArrayStack.java
|
Java
|
[] | null |
[] |
public class ArrayStack implements Stack {
Object[] arr = new Object[10];
int top = -1;
@Override
public void push(Object item) {
if(top ==arr.length-1){
doubleArrSize();
}
arr[++top]= item;
}
@Override
public Object pop() {
if(!empty()){
return arr[top--];
}
try {
throw new Exception();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
@Override
public Object peek() {
if(!empty()){
return arr[top];
}
else{
try {
throw new Exception();
} catch (Exception e) {
e.printStackTrace();
}
}
return null;
}
@Override
public boolean empty() {
return (top == -1);
}
private void doubleArrSize(){
Object[] newarr = new Object[arr.length*2];
for(int i= 0;i<arr.length;i++){
newarr[i]=arr[i];
}
arr = newarr;
}
}
| 1,078 | 0.439703 | 0.43321 | 53 | 19.339622 | 12.917654 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.339623 | false | false |
5
|
726940cc04368e3b8e7c4ababa0bc111f34c5f79
| 5,153,960,794,802 |
a9fc59b19b553fefd0fc1fb4d42f05166573a703
|
/src/main/java/com/lym/springboot/web/core/domain/WebLog.java
|
917726df53ed330135bdeb958ef84364bd3e53cb
|
[
"Apache-2.0"
] |
permissive
|
thwyd321/spring-boot-web
|
https://github.com/thwyd321/spring-boot-web
|
0ee390672a2ef74ce6605f574f2a93188fe82c52
|
ef62b33ff0228926b1c5fd9746159781fbd28bd8
|
refs/heads/master
| 2020-09-14T13:18:04.610000 | 2019-11-03T08:01:31 | 2019-11-03T08:01:31 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.lym.springboot.web.core.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
@ApiModel(value = "日志")
public class WebLog {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table web_log
*
* @mbg.generated
*/
public static final Boolean IS_DELETED = Deleted.IS_DELETED.value();
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table web_log
*
* @mbg.generated
*/
public static final Boolean NOT_DELETED = Deleted.NOT_DELETED.value();
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column web_log.id
*
* @mbg.generated
*/
@ApiModelProperty(value = "日志ID")
private Integer id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column web_log.user_id
*
* @mbg.generated
*/
@ApiModelProperty(value = "用户ID")
private Integer userId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column web_log.ip
*
* @mbg.generated
*/
@ApiModelProperty(value = "访问IP")
private String ip;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column web_log.url
*
* @mbg.generated
*/
@ApiModelProperty(value = "访问路径")
private String url;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column web_log.method
*
* @mbg.generated
*/
@ApiModelProperty(value = "请求方式")
private String method;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column web_log.params
*
* @mbg.generated
*/
@ApiModelProperty(value = "请求参数")
private String params;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column web_log.times
*
* @mbg.generated
*/
@ApiModelProperty(value = "响应时间,单位:毫秒")
private Integer times;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column web_log.status
*
* @mbg.generated
*/
@ApiModelProperty(value = "操作状态,true-成功 false-失败")
private Boolean status;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column web_log.deleted
*
* @mbg.generated
*/
@JsonIgnore
private Boolean deleted;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column web_log.add_time
*
* @mbg.generated
*/
@ApiModelProperty(value = "添加时间,格式: yyyy-MM-dd HH:mm:ss")
private LocalDateTime addTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column web_log.update_time
*
* @mbg.generated
*/
@ApiModelProperty(value = "更新时间,格式: yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column web_log.id
*
* @return the value of web_log.id
*
* @mbg.generated
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column web_log.id
*
* @param id the value for web_log.id
*
* @mbg.generated
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column web_log.user_id
*
* @return the value of web_log.user_id
*
* @mbg.generated
*/
public Integer getUserId() {
return userId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column web_log.user_id
*
* @param userId the value for web_log.user_id
*
* @mbg.generated
*/
public void setUserId(Integer userId) {
this.userId = userId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column web_log.ip
*
* @return the value of web_log.ip
*
* @mbg.generated
*/
public String getIp() {
return ip;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column web_log.ip
*
* @param ip the value for web_log.ip
*
* @mbg.generated
*/
public void setIp(String ip) {
this.ip = ip;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column web_log.url
*
* @return the value of web_log.url
*
* @mbg.generated
*/
public String getUrl() {
return url;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column web_log.url
*
* @param url the value for web_log.url
*
* @mbg.generated
*/
public void setUrl(String url) {
this.url = url;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column web_log.method
*
* @return the value of web_log.method
*
* @mbg.generated
*/
public String getMethod() {
return method;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column web_log.method
*
* @param method the value for web_log.method
*
* @mbg.generated
*/
public void setMethod(String method) {
this.method = method;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column web_log.params
*
* @return the value of web_log.params
*
* @mbg.generated
*/
public String getParams() {
return params;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column web_log.params
*
* @param params the value for web_log.params
*
* @mbg.generated
*/
public void setParams(String params) {
this.params = params;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column web_log.times
*
* @return the value of web_log.times
*
* @mbg.generated
*/
public Integer getTimes() {
return times;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column web_log.times
*
* @param times the value for web_log.times
*
* @mbg.generated
*/
public void setTimes(Integer times) {
this.times = times;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column web_log.status
*
* @return the value of web_log.status
*
* @mbg.generated
*/
public Boolean getStatus() {
return status;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column web_log.status
*
* @param status the value for web_log.status
*
* @mbg.generated
*/
public void setStatus(Boolean status) {
this.status = status;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
public void andLogicalDeleted(boolean deleted) {
setDeleted(deleted ? Deleted.IS_DELETED.value() : Deleted.NOT_DELETED.value());
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column web_log.deleted
*
* @return the value of web_log.deleted
*
* @mbg.generated
*/
public Boolean getDeleted() {
return deleted;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column web_log.deleted
*
* @param deleted the value for web_log.deleted
*
* @mbg.generated
*/
public void setDeleted(Boolean deleted) {
this.deleted = deleted;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column web_log.add_time
*
* @return the value of web_log.add_time
*
* @mbg.generated
*/
public LocalDateTime getAddTime() {
return addTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column web_log.add_time
*
* @param addTime the value for web_log.add_time
*
* @mbg.generated
*/
public void setAddTime(LocalDateTime addTime) {
this.addTime = addTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column web_log.update_time
*
* @return the value of web_log.update_time
*
* @mbg.generated
*/
public LocalDateTime getUpdateTime() {
return updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column web_log.update_time
*
* @param updateTime the value for web_log.update_time
*
* @mbg.generated
*/
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", IS_DELETED=").append(IS_DELETED);
sb.append(", NOT_DELETED=").append(NOT_DELETED);
sb.append(", id=").append(id);
sb.append(", userId=").append(userId);
sb.append(", ip=").append(ip);
sb.append(", url=").append(url);
sb.append(", method=").append(method);
sb.append(", params=").append(params);
sb.append(", times=").append(times);
sb.append(", status=").append(status);
sb.append(", deleted=").append(deleted);
sb.append(", addTime=").append(addTime);
sb.append(", updateTime=").append(updateTime);
sb.append("]");
return sb.toString();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
WebLog other = (WebLog) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getIp() == null ? other.getIp() == null : this.getIp().equals(other.getIp()))
&& (this.getUrl() == null ? other.getUrl() == null : this.getUrl().equals(other.getUrl()))
&& (this.getMethod() == null ? other.getMethod() == null : this.getMethod().equals(other.getMethod()))
&& (this.getParams() == null ? other.getParams() == null : this.getParams().equals(other.getParams()))
&& (this.getTimes() == null ? other.getTimes() == null : this.getTimes().equals(other.getTimes()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getDeleted() == null ? other.getDeleted() == null : this.getDeleted().equals(other.getDeleted()))
&& (this.getAddTime() == null ? other.getAddTime() == null : this.getAddTime().equals(other.getAddTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getIp() == null) ? 0 : getIp().hashCode());
result = prime * result + ((getUrl() == null) ? 0 : getUrl().hashCode());
result = prime * result + ((getMethod() == null) ? 0 : getMethod().hashCode());
result = prime * result + ((getParams() == null) ? 0 : getParams().hashCode());
result = prime * result + ((getTimes() == null) ? 0 : getTimes().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getDeleted() == null) ? 0 : getDeleted().hashCode());
result = prime * result + ((getAddTime() == null) ? 0 : getAddTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
return result;
}
/**
* This enum was generated by MyBatis Generator.
* This enum corresponds to the database table web_log
*
* @mbg.generated
*/
public enum Deleted {
NOT_DELETED(new Boolean("0"), "未删除"),
IS_DELETED(new Boolean("1"), "已删除");
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table web_log
*
* @mbg.generated
*/
private final Boolean value;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table web_log
*
* @mbg.generated
*/
private final String name;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
Deleted(Boolean value, String name) {
this.value = value;
this.name = name;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
public Boolean getValue() {
return this.value;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
public Boolean value() {
return this.value;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
public String getName() {
return this.name;
}
}
/**
* This enum was generated by MyBatis Generator.
* This enum corresponds to the database table web_log
*
* @mbg.generated
*/
public enum Column {
id("id", "id", "INTEGER", false),
userId("user_id", "userId", "INTEGER", false),
ip("ip", "ip", "VARCHAR", false),
url("url", "url", "VARCHAR", false),
method("method", "method", "VARCHAR", true),
params("params", "params", "VARCHAR", false),
times("times", "times", "INTEGER", false),
status("status", "status", "BIT", true),
deleted("deleted", "deleted", "BIT", false),
addTime("add_time", "addTime", "TIMESTAMP", false),
updateTime("update_time", "updateTime", "TIMESTAMP", false);
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table web_log
*
* @mbg.generated
*/
private static final String BEGINNING_DELIMITER = "`";
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table web_log
*
* @mbg.generated
*/
private static final String ENDING_DELIMITER = "`";
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table web_log
*
* @mbg.generated
*/
private final String column;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table web_log
*
* @mbg.generated
*/
private final boolean isColumnNameDelimited;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table web_log
*
* @mbg.generated
*/
private final String javaProperty;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table web_log
*
* @mbg.generated
*/
private final String jdbcType;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
public String value() {
return this.column;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
public String getValue() {
return this.column;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
public String getJavaProperty() {
return this.javaProperty;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
public String getJdbcType() {
return this.jdbcType;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) {
this.column = column;
this.javaProperty = javaProperty;
this.jdbcType = jdbcType;
this.isColumnNameDelimited = isColumnNameDelimited;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
public String desc() {
return this.getEscapedColumnName() + " DESC";
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
public String asc() {
return this.getEscapedColumnName() + " ASC";
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
public static Column[] excludes(Column ... excludes) {
ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
if (excludes != null && excludes.length > 0) {
columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
}
return columns.toArray(new Column[]{});
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
public String getEscapedColumnName() {
if (this.isColumnNameDelimited) {
return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString();
} else {
return this.column;
}
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
public String getAliasedEscapedColumnName() {
return this.getEscapedColumnName();
}
}
}
|
UTF-8
|
Java
| 21,878 |
java
|
WebLog.java
|
Java
|
[] | null |
[] |
package com.lym.springboot.web.core.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
@ApiModel(value = "日志")
public class WebLog {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table web_log
*
* @mbg.generated
*/
public static final Boolean IS_DELETED = Deleted.IS_DELETED.value();
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table web_log
*
* @mbg.generated
*/
public static final Boolean NOT_DELETED = Deleted.NOT_DELETED.value();
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column web_log.id
*
* @mbg.generated
*/
@ApiModelProperty(value = "日志ID")
private Integer id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column web_log.user_id
*
* @mbg.generated
*/
@ApiModelProperty(value = "用户ID")
private Integer userId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column web_log.ip
*
* @mbg.generated
*/
@ApiModelProperty(value = "访问IP")
private String ip;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column web_log.url
*
* @mbg.generated
*/
@ApiModelProperty(value = "访问路径")
private String url;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column web_log.method
*
* @mbg.generated
*/
@ApiModelProperty(value = "请求方式")
private String method;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column web_log.params
*
* @mbg.generated
*/
@ApiModelProperty(value = "请求参数")
private String params;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column web_log.times
*
* @mbg.generated
*/
@ApiModelProperty(value = "响应时间,单位:毫秒")
private Integer times;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column web_log.status
*
* @mbg.generated
*/
@ApiModelProperty(value = "操作状态,true-成功 false-失败")
private Boolean status;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column web_log.deleted
*
* @mbg.generated
*/
@JsonIgnore
private Boolean deleted;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column web_log.add_time
*
* @mbg.generated
*/
@ApiModelProperty(value = "添加时间,格式: yyyy-MM-dd HH:mm:ss")
private LocalDateTime addTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column web_log.update_time
*
* @mbg.generated
*/
@ApiModelProperty(value = "更新时间,格式: yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column web_log.id
*
* @return the value of web_log.id
*
* @mbg.generated
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column web_log.id
*
* @param id the value for web_log.id
*
* @mbg.generated
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column web_log.user_id
*
* @return the value of web_log.user_id
*
* @mbg.generated
*/
public Integer getUserId() {
return userId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column web_log.user_id
*
* @param userId the value for web_log.user_id
*
* @mbg.generated
*/
public void setUserId(Integer userId) {
this.userId = userId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column web_log.ip
*
* @return the value of web_log.ip
*
* @mbg.generated
*/
public String getIp() {
return ip;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column web_log.ip
*
* @param ip the value for web_log.ip
*
* @mbg.generated
*/
public void setIp(String ip) {
this.ip = ip;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column web_log.url
*
* @return the value of web_log.url
*
* @mbg.generated
*/
public String getUrl() {
return url;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column web_log.url
*
* @param url the value for web_log.url
*
* @mbg.generated
*/
public void setUrl(String url) {
this.url = url;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column web_log.method
*
* @return the value of web_log.method
*
* @mbg.generated
*/
public String getMethod() {
return method;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column web_log.method
*
* @param method the value for web_log.method
*
* @mbg.generated
*/
public void setMethod(String method) {
this.method = method;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column web_log.params
*
* @return the value of web_log.params
*
* @mbg.generated
*/
public String getParams() {
return params;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column web_log.params
*
* @param params the value for web_log.params
*
* @mbg.generated
*/
public void setParams(String params) {
this.params = params;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column web_log.times
*
* @return the value of web_log.times
*
* @mbg.generated
*/
public Integer getTimes() {
return times;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column web_log.times
*
* @param times the value for web_log.times
*
* @mbg.generated
*/
public void setTimes(Integer times) {
this.times = times;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column web_log.status
*
* @return the value of web_log.status
*
* @mbg.generated
*/
public Boolean getStatus() {
return status;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column web_log.status
*
* @param status the value for web_log.status
*
* @mbg.generated
*/
public void setStatus(Boolean status) {
this.status = status;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
public void andLogicalDeleted(boolean deleted) {
setDeleted(deleted ? Deleted.IS_DELETED.value() : Deleted.NOT_DELETED.value());
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column web_log.deleted
*
* @return the value of web_log.deleted
*
* @mbg.generated
*/
public Boolean getDeleted() {
return deleted;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column web_log.deleted
*
* @param deleted the value for web_log.deleted
*
* @mbg.generated
*/
public void setDeleted(Boolean deleted) {
this.deleted = deleted;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column web_log.add_time
*
* @return the value of web_log.add_time
*
* @mbg.generated
*/
public LocalDateTime getAddTime() {
return addTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column web_log.add_time
*
* @param addTime the value for web_log.add_time
*
* @mbg.generated
*/
public void setAddTime(LocalDateTime addTime) {
this.addTime = addTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column web_log.update_time
*
* @return the value of web_log.update_time
*
* @mbg.generated
*/
public LocalDateTime getUpdateTime() {
return updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column web_log.update_time
*
* @param updateTime the value for web_log.update_time
*
* @mbg.generated
*/
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", IS_DELETED=").append(IS_DELETED);
sb.append(", NOT_DELETED=").append(NOT_DELETED);
sb.append(", id=").append(id);
sb.append(", userId=").append(userId);
sb.append(", ip=").append(ip);
sb.append(", url=").append(url);
sb.append(", method=").append(method);
sb.append(", params=").append(params);
sb.append(", times=").append(times);
sb.append(", status=").append(status);
sb.append(", deleted=").append(deleted);
sb.append(", addTime=").append(addTime);
sb.append(", updateTime=").append(updateTime);
sb.append("]");
return sb.toString();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
WebLog other = (WebLog) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getIp() == null ? other.getIp() == null : this.getIp().equals(other.getIp()))
&& (this.getUrl() == null ? other.getUrl() == null : this.getUrl().equals(other.getUrl()))
&& (this.getMethod() == null ? other.getMethod() == null : this.getMethod().equals(other.getMethod()))
&& (this.getParams() == null ? other.getParams() == null : this.getParams().equals(other.getParams()))
&& (this.getTimes() == null ? other.getTimes() == null : this.getTimes().equals(other.getTimes()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getDeleted() == null ? other.getDeleted() == null : this.getDeleted().equals(other.getDeleted()))
&& (this.getAddTime() == null ? other.getAddTime() == null : this.getAddTime().equals(other.getAddTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getIp() == null) ? 0 : getIp().hashCode());
result = prime * result + ((getUrl() == null) ? 0 : getUrl().hashCode());
result = prime * result + ((getMethod() == null) ? 0 : getMethod().hashCode());
result = prime * result + ((getParams() == null) ? 0 : getParams().hashCode());
result = prime * result + ((getTimes() == null) ? 0 : getTimes().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getDeleted() == null) ? 0 : getDeleted().hashCode());
result = prime * result + ((getAddTime() == null) ? 0 : getAddTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
return result;
}
/**
* This enum was generated by MyBatis Generator.
* This enum corresponds to the database table web_log
*
* @mbg.generated
*/
public enum Deleted {
NOT_DELETED(new Boolean("0"), "未删除"),
IS_DELETED(new Boolean("1"), "已删除");
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table web_log
*
* @mbg.generated
*/
private final Boolean value;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table web_log
*
* @mbg.generated
*/
private final String name;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
Deleted(Boolean value, String name) {
this.value = value;
this.name = name;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
public Boolean getValue() {
return this.value;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
public Boolean value() {
return this.value;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
public String getName() {
return this.name;
}
}
/**
* This enum was generated by MyBatis Generator.
* This enum corresponds to the database table web_log
*
* @mbg.generated
*/
public enum Column {
id("id", "id", "INTEGER", false),
userId("user_id", "userId", "INTEGER", false),
ip("ip", "ip", "VARCHAR", false),
url("url", "url", "VARCHAR", false),
method("method", "method", "VARCHAR", true),
params("params", "params", "VARCHAR", false),
times("times", "times", "INTEGER", false),
status("status", "status", "BIT", true),
deleted("deleted", "deleted", "BIT", false),
addTime("add_time", "addTime", "TIMESTAMP", false),
updateTime("update_time", "updateTime", "TIMESTAMP", false);
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table web_log
*
* @mbg.generated
*/
private static final String BEGINNING_DELIMITER = "`";
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table web_log
*
* @mbg.generated
*/
private static final String ENDING_DELIMITER = "`";
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table web_log
*
* @mbg.generated
*/
private final String column;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table web_log
*
* @mbg.generated
*/
private final boolean isColumnNameDelimited;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table web_log
*
* @mbg.generated
*/
private final String javaProperty;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table web_log
*
* @mbg.generated
*/
private final String jdbcType;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
public String value() {
return this.column;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
public String getValue() {
return this.column;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
public String getJavaProperty() {
return this.javaProperty;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
public String getJdbcType() {
return this.jdbcType;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) {
this.column = column;
this.javaProperty = javaProperty;
this.jdbcType = jdbcType;
this.isColumnNameDelimited = isColumnNameDelimited;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
public String desc() {
return this.getEscapedColumnName() + " DESC";
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
public String asc() {
return this.getEscapedColumnName() + " ASC";
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
public static Column[] excludes(Column ... excludes) {
ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
if (excludes != null && excludes.length > 0) {
columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
}
return columns.toArray(new Column[]{});
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
public String getEscapedColumnName() {
if (this.isColumnNameDelimited) {
return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString();
} else {
return this.column;
}
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table web_log
*
* @mbg.generated
*/
public String getAliasedEscapedColumnName() {
return this.getEscapedColumnName();
}
}
}
| 21,878 | 0.573529 | 0.572748 | 743 | 28.288021 | 25.817518 | 131 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.235532 | false | false |
5
|
d6a36f3d101cfbc980abeb56ab11b4962810dc45
| 28,037,546,545,596 |
e61182addb1ba5358bdc973c4df003fbc50f2464
|
/loan-manager-service/src/main/java/cn/fintecher/supply/finance/loan/manager/service/business/service/impl/BusinessOrderServiceImpl.java
|
6f1c4e16fef5b7fd749f66d1deac39da3589bf8a
|
[] |
no_license
|
1339811979/supply-finance-core
|
https://github.com/1339811979/supply-finance-core
|
a903a04774f8a8ec1ddeaf15252808b56c31754b
|
1ad2e57994c0c9e916e3609c7dd2c7a29e2f234e
|
refs/heads/master
| 2020-04-01T00:10:37.854000 | 2018-10-12T03:17:26 | 2018-10-12T03:17:26 | 152,685,361 | 1 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cn.fintecher.supply.finance.loan.manager.service.business.service.impl;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.fintecher.common.utils.basecommon.message.Message;
import cn.fintecher.common.utils.basecommon.message.MessageType;
import cn.fintecher.supply.finance.loan.manager.common.business.entity.BusinessFileEntity;
import cn.fintecher.supply.finance.loan.manager.common.business.entity.BusinessOrderEntity;
import cn.fintecher.supply.finance.loan.manager.common.business.entity.BusinessReceivableEntity;
import cn.fintecher.supply.finance.loan.manager.common.business.request.BusinessOrderFrom;
import cn.fintecher.supply.finance.loan.manager.common.business.response.BusinessOrderResponse;
import cn.fintecher.supply.finance.loan.manager.common.constant.ReturnMsg;
import cn.fintecher.supply.finance.loan.manager.common.model.CompanyUserEntity;
import cn.fintecher.supply.finance.loan.manager.common.util.ChkUtil;
import cn.fintecher.supply.finance.loan.manager.common.util.Constants;
import cn.fintecher.supply.finance.loan.manager.common.util.JSONUtil;
import cn.fintecher.supply.finance.loan.manager.common.util.PagedResponse;
import cn.fintecher.supply.finance.loan.manager.service.business.core.BusinessOrderCore;
import cn.fintecher.supply.finance.loan.manager.service.business.service.BusinessFileService;
import cn.fintecher.supply.finance.loan.manager.service.business.service.BusinessOrderService;
import cn.fintecher.supply.finance.loan.manager.service.company.feign.FCCompanyUserCore;
/**
*
* @author whojinbao
* @email jinbao.hu@fintecher.cn
* @date 2018-07-14 14:59:16
*/
@Service("businessOrderService")
public class BusinessOrderServiceImpl implements BusinessOrderService {
@Autowired
private BusinessOrderCore businessOrderCore;
@Autowired
private FCCompanyUserCore fccompanyUserCore;
@Autowired
private BusinessFileService businessFileService;
@Override
public Message insertOrder(BusinessOrderEntity businessOrderEntity){
return businessOrderCore.insertOrder(businessOrderEntity);
}
@Override
public Message<List<BusinessOrderEntity>> selectByOrder(BusinessOrderEntity businessOrderEntity) {
return businessOrderCore.selectByOrder(businessOrderEntity);
}
@Override
public Message updateOrder(BusinessOrderEntity businessOrderEntity) {
return businessOrderCore.updateOrder(businessOrderEntity);
}
@Override
public Message<BusinessOrderEntity> queryOrderByPid(String pid) {
return businessOrderCore.queryOrderByPid(pid);
}
public Message searchListOrder(BusinessOrderFrom businessOrderFrom){
CompanyUserEntity user = getUserEntityByUserName(businessOrderFrom.getUserName());
businessOrderFrom.setSupplierId(user.getEnterpriseId());
Message msg = new Message(MessageType.MSG_SUCCESS,"business",null);
PagedResponse response = new PagedResponse();
//查询总数
Integer count = null;
Message msgCount = businessOrderCore.queryPageCount(businessOrderFrom);
if (MessageType.MSG_SUCCESS == msgCount.getCode()){
count = Integer.parseInt(msgCount.getMessage().toString());
}else {
return new Message(MessageType.MSG_ERROR,"business",ReturnMsg.FAILED_CURRENCY);
}
//查询列表
List<BusinessOrderEntity> list = null;
Message msgList = businessOrderCore.queryPageList(businessOrderFrom);
if (MessageType.MSG_SUCCESS == msgList.getCode()){
list = JSONUtil.toList(msgList.getMessage(),BusinessOrderEntity.class);
}else {
return new Message(MessageType.MSG_ERROR,"business",ReturnMsg.FAILED_CURRENCY);
}
response.setData(list);
response.setTotal(count);
response.setPageNo(businessOrderFrom.getPageNo());
response.setPageSize(businessOrderFrom.getPageSize());
msg.setMessage(response);
return msg;
};
public Message selectOrderDetail(Long orderId, String userName){
Message msg = new Message(MessageType.MSG_SUCCESS,"business",null);
try {
BusinessOrderResponse response = new BusinessOrderResponse();
Message<BusinessOrderEntity> msgEntity = this.queryOrderByPid(orderId+"");
BusinessOrderEntity businessOrderEntity = msgEntity.getMessage();
response.setBusinessOrder(businessOrderEntity);
String Code = businessOrderEntity.getOrderCode();
if (!ChkUtil.isEmpty(Code)) {
BusinessFileEntity businessFileEntity = new BusinessFileEntity();
businessFileEntity.setOwnerId(Code);
businessFileEntity.setStatus(Constants.DATA_STATUS_NOL);
Message msgFile =businessFileService.selectByFile(businessFileEntity);
List<BusinessFileEntity> list = JSONUtil.toList(msgFile.getMessage(),BusinessFileEntity.class);
response.setFileList(list);
}
msg.setMessage(response);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return new Message<>(MessageType.MSG_ERROR,"business",ReturnMsg.FAILED_CURRENCY);
}
return msg;
};
public Message submitConfirm(Long orderId, String userName){
BusinessOrderEntity businessOrderEntity = new BusinessOrderEntity();
businessOrderEntity.setPid(orderId);
businessOrderEntity.setState("1");
businessOrderEntity.setAccountConfirmTime(new Date());
businessOrderEntity.setUpdateAt(new Date());
businessOrderEntity.setUpdateBy(userName);
return this.updateOrder(businessOrderEntity);
};
private CompanyUserEntity getUserEntityByUserName(String userName){
CompanyUserEntity user = fccompanyUserCore.findCompanyUserByName(userName);
if (ChkUtil.isEmpty(user.getEnterpriseId())) {
user.setEnterpriseId(1L);
}
return user;
}
}
|
UTF-8
|
Java
| 5,728 |
java
|
BusinessOrderServiceImpl.java
|
Java
|
[
{
"context": "mpany.feign.FCCompanyUserCore;\n\n/**\n * \n * @author whojinbao\n * @email jinbao.hu@fintecher.cn\n * @date 2018-07",
"end": 1668,
"score": 0.9996607899665833,
"start": 1659,
"tag": "USERNAME",
"value": "whojinbao"
},
{
"context": "yUserCore;\n\n/**\n * \n * @author whojinbao\n * @email jinbao.hu@fintecher.cn\n * @date 2018-07-14 14:59:16\n */\n@Service(\"busine",
"end": 1701,
"score": 0.9999303221702576,
"start": 1679,
"tag": "EMAIL",
"value": "jinbao.hu@fintecher.cn"
}
] | null |
[] |
package cn.fintecher.supply.finance.loan.manager.service.business.service.impl;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.fintecher.common.utils.basecommon.message.Message;
import cn.fintecher.common.utils.basecommon.message.MessageType;
import cn.fintecher.supply.finance.loan.manager.common.business.entity.BusinessFileEntity;
import cn.fintecher.supply.finance.loan.manager.common.business.entity.BusinessOrderEntity;
import cn.fintecher.supply.finance.loan.manager.common.business.entity.BusinessReceivableEntity;
import cn.fintecher.supply.finance.loan.manager.common.business.request.BusinessOrderFrom;
import cn.fintecher.supply.finance.loan.manager.common.business.response.BusinessOrderResponse;
import cn.fintecher.supply.finance.loan.manager.common.constant.ReturnMsg;
import cn.fintecher.supply.finance.loan.manager.common.model.CompanyUserEntity;
import cn.fintecher.supply.finance.loan.manager.common.util.ChkUtil;
import cn.fintecher.supply.finance.loan.manager.common.util.Constants;
import cn.fintecher.supply.finance.loan.manager.common.util.JSONUtil;
import cn.fintecher.supply.finance.loan.manager.common.util.PagedResponse;
import cn.fintecher.supply.finance.loan.manager.service.business.core.BusinessOrderCore;
import cn.fintecher.supply.finance.loan.manager.service.business.service.BusinessFileService;
import cn.fintecher.supply.finance.loan.manager.service.business.service.BusinessOrderService;
import cn.fintecher.supply.finance.loan.manager.service.company.feign.FCCompanyUserCore;
/**
*
* @author whojinbao
* @email <EMAIL>
* @date 2018-07-14 14:59:16
*/
@Service("businessOrderService")
public class BusinessOrderServiceImpl implements BusinessOrderService {
@Autowired
private BusinessOrderCore businessOrderCore;
@Autowired
private FCCompanyUserCore fccompanyUserCore;
@Autowired
private BusinessFileService businessFileService;
@Override
public Message insertOrder(BusinessOrderEntity businessOrderEntity){
return businessOrderCore.insertOrder(businessOrderEntity);
}
@Override
public Message<List<BusinessOrderEntity>> selectByOrder(BusinessOrderEntity businessOrderEntity) {
return businessOrderCore.selectByOrder(businessOrderEntity);
}
@Override
public Message updateOrder(BusinessOrderEntity businessOrderEntity) {
return businessOrderCore.updateOrder(businessOrderEntity);
}
@Override
public Message<BusinessOrderEntity> queryOrderByPid(String pid) {
return businessOrderCore.queryOrderByPid(pid);
}
public Message searchListOrder(BusinessOrderFrom businessOrderFrom){
CompanyUserEntity user = getUserEntityByUserName(businessOrderFrom.getUserName());
businessOrderFrom.setSupplierId(user.getEnterpriseId());
Message msg = new Message(MessageType.MSG_SUCCESS,"business",null);
PagedResponse response = new PagedResponse();
//查询总数
Integer count = null;
Message msgCount = businessOrderCore.queryPageCount(businessOrderFrom);
if (MessageType.MSG_SUCCESS == msgCount.getCode()){
count = Integer.parseInt(msgCount.getMessage().toString());
}else {
return new Message(MessageType.MSG_ERROR,"business",ReturnMsg.FAILED_CURRENCY);
}
//查询列表
List<BusinessOrderEntity> list = null;
Message msgList = businessOrderCore.queryPageList(businessOrderFrom);
if (MessageType.MSG_SUCCESS == msgList.getCode()){
list = JSONUtil.toList(msgList.getMessage(),BusinessOrderEntity.class);
}else {
return new Message(MessageType.MSG_ERROR,"business",ReturnMsg.FAILED_CURRENCY);
}
response.setData(list);
response.setTotal(count);
response.setPageNo(businessOrderFrom.getPageNo());
response.setPageSize(businessOrderFrom.getPageSize());
msg.setMessage(response);
return msg;
};
public Message selectOrderDetail(Long orderId, String userName){
Message msg = new Message(MessageType.MSG_SUCCESS,"business",null);
try {
BusinessOrderResponse response = new BusinessOrderResponse();
Message<BusinessOrderEntity> msgEntity = this.queryOrderByPid(orderId+"");
BusinessOrderEntity businessOrderEntity = msgEntity.getMessage();
response.setBusinessOrder(businessOrderEntity);
String Code = businessOrderEntity.getOrderCode();
if (!ChkUtil.isEmpty(Code)) {
BusinessFileEntity businessFileEntity = new BusinessFileEntity();
businessFileEntity.setOwnerId(Code);
businessFileEntity.setStatus(Constants.DATA_STATUS_NOL);
Message msgFile =businessFileService.selectByFile(businessFileEntity);
List<BusinessFileEntity> list = JSONUtil.toList(msgFile.getMessage(),BusinessFileEntity.class);
response.setFileList(list);
}
msg.setMessage(response);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return new Message<>(MessageType.MSG_ERROR,"business",ReturnMsg.FAILED_CURRENCY);
}
return msg;
};
public Message submitConfirm(Long orderId, String userName){
BusinessOrderEntity businessOrderEntity = new BusinessOrderEntity();
businessOrderEntity.setPid(orderId);
businessOrderEntity.setState("1");
businessOrderEntity.setAccountConfirmTime(new Date());
businessOrderEntity.setUpdateAt(new Date());
businessOrderEntity.setUpdateBy(userName);
return this.updateOrder(businessOrderEntity);
};
private CompanyUserEntity getUserEntityByUserName(String userName){
CompanyUserEntity user = fccompanyUserCore.findCompanyUserByName(userName);
if (ChkUtil.isEmpty(user.getEnterpriseId())) {
user.setEnterpriseId(1L);
}
return user;
}
}
| 5,713 | 0.790441 | 0.78764 | 139 | 40.08633 | 31.480833 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.798561 | false | false |
5
|
ff746b5a21d10aa5eae5dd167d1238b08d2e27a7
| 9,844,065,080,128 |
6539ed53dc0ab57a4f6147a1790687c80a2d0e66
|
/JAVA/CharSort/Entity/InCharOutObjCalculator.java
|
72a4a4d1ba298bccd3981b1f6c96ef1bce3936b9
|
[] |
no_license
|
gesown/CharSort
|
https://github.com/gesown/CharSort
|
8237b70846dd3d04b35ee9aabf10ceb319e6ea29
|
abe0b8eb3af258f7a81a090efa7d2c8f33da0f73
|
refs/heads/master
| 2020-07-18T01:06:22.228000 | 2019-09-03T18:25:54 | 2019-09-03T18:25:54 | 206,140,136 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package CharSort.Entity;
import CharSort.Interface.*;
import CharSort.Facade.*;
import CharSort.*;
import java.util.*;
public class InCharOutObjCalculator implements IInCharOutObjCalculator
{
public final List<InChar> CalculateInCharOutObjects(List<InChar> inChars)
{
CharSort.model.ICSModel csModel = CSFacade.GetCSModel();
ArrayList<InChar> retValue = new ArrayList<InChar>();
ArrayList<Object> letters = inChars.stream().filter(s -> (s.InCharAscii >= csModel.getstartASCIILetters() && s.InCharAscii <= csModel.getendASCIILetters())).collect(Collectors.toList());
ArrayList<Object> numbers = inChars.stream().filter(s -> (s.InCharAscii >= csModel.getstartASCIINumbers() && s.InCharAscii <= csModel.getendASCIINumbers())).collect(Collectors.toList());
if (letters.size() == numbers.size())
{
for (int i = 0; i < letters.size(); i++)
{
retValue.add(letters.get(i));
retValue.add(numbers.get(i));
}
return retValue;
}
for (Object item : letters)
{
retValue.add(item);
}
for (Object item : numbers)
{
retValue.add(item);
}
return retValue;
}
}
|
UTF-8
|
Java
| 1,101 |
java
|
InCharOutObjCalculator.java
|
Java
|
[] | null |
[] |
package CharSort.Entity;
import CharSort.Interface.*;
import CharSort.Facade.*;
import CharSort.*;
import java.util.*;
public class InCharOutObjCalculator implements IInCharOutObjCalculator
{
public final List<InChar> CalculateInCharOutObjects(List<InChar> inChars)
{
CharSort.model.ICSModel csModel = CSFacade.GetCSModel();
ArrayList<InChar> retValue = new ArrayList<InChar>();
ArrayList<Object> letters = inChars.stream().filter(s -> (s.InCharAscii >= csModel.getstartASCIILetters() && s.InCharAscii <= csModel.getendASCIILetters())).collect(Collectors.toList());
ArrayList<Object> numbers = inChars.stream().filter(s -> (s.InCharAscii >= csModel.getstartASCIINumbers() && s.InCharAscii <= csModel.getendASCIINumbers())).collect(Collectors.toList());
if (letters.size() == numbers.size())
{
for (int i = 0; i < letters.size(); i++)
{
retValue.add(letters.get(i));
retValue.add(numbers.get(i));
}
return retValue;
}
for (Object item : letters)
{
retValue.add(item);
}
for (Object item : numbers)
{
retValue.add(item);
}
return retValue;
}
}
| 1,101 | 0.705722 | 0.704814 | 36 | 29.611111 | 43.312992 | 188 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.055556 | false | false |
5
|
8078918642cdaae99aa7f91be537d243e69631ff
| 33,260,226,770,875 |
b420b9489f379df18462c65162f4ecf4cb987591
|
/source/shardcon-jdbc/src/test/java/net/thumbtack/shardcon/ShardingFacade.java
|
e3dfa7f23d3b1fc955319b753a7bf0ae41397e28
|
[] |
no_license
|
aremnev/publican
|
https://github.com/aremnev/publican
|
0a16b7a30894e55b945978f1cc37d9df8ff45513
|
fe323b0d4610b5a1b5c5abfc0cb4f9da84b8b8b8
|
refs/heads/master
| 2016-09-06T05:23:02.315000 | 2013-12-19T08:08:53 | 2013-12-19T08:08:53 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package net.thumbtack.shardcon;
import net.thumbtack.shardcon.core.Sharding;
import net.thumbtack.shardcon.core.query.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ShardingFacade {
public static final long SELECT_SPEC_SHARD = 1001; // select from specific shard
public static final long SELECT_SHARD = 1002; // select from undefined shard
public static final long SELECT_ANY_SHARD = 1003; // select from any shard
public static final long SELECT_ALL_SHARDS = 1004; // select from all shards with union of results to list
public static final long SELECT_ALL_SHARDS_SUM = 1005; // select from all shards with summation of results to int
public static final long UPDATE_SPEC_SHARD = 1006; // update on specific shard
public static final long UPDATE_ALL_SHARDS = 1007; // update on all shards
private Sharding sharding;
public ShardingFacade(Sharding sharding) {
this.sharding = sharding;
}
// select from specific shard defined by userId
public <U> U selectSpec(long id, QueryClosure<U> closure) {
return sharding.execute(SELECT_SPEC_SHARD, id, closure);
}
// select from undefined shard
public <U> U select(QueryClosure<U> closure) {
return sharding.execute(SELECT_SHARD, closure);
}
// select from any shard
public <U> U selectAny(QueryClosure<U> closure) {
return sharding.execute(SELECT_ANY_SHARD, closure);
}
// select from all shards with results union
public <U> List<U> selectAll(QueryClosure<List<U>> closure) {
return sharding.execute(SELECT_ALL_SHARDS, closure);
}
// select from all shards with results union and with resolving shards by several ids
public <U> List<U> selectAll(List<Long> ids, QueryClosure<List<U>> closure) {
return sharding.execute(SELECT_ALL_SHARDS, ids, closure);
}
// select from all shards with results union
public Integer selectSumAll(QueryClosure<Integer> closure) {
return sharding.execute(SELECT_ALL_SHARDS_SUM, closure);
}
// update on specific shard defined by userId
public <U> U updateSpec(long id, QueryClosure<U> closure) {
return sharding.execute(UPDATE_SPEC_SHARD, id, closure);
}
// update on all shards
// the result of the method is the last successful closure call result
public <U> U updateAll(QueryClosure<U> closure) {
return sharding.execute(UPDATE_ALL_SHARDS, closure);
}
// update on all shards resolver by ids
// the result of the method is the last successful closure call result
public <U> U updateAll(List<Long> ids, QueryClosure<U> closure) {
return sharding.execute(UPDATE_ALL_SHARDS, ids, closure);
}
public static Map<Long, Query> getQueryMap(boolean isSync) {
return isSync ?
new HashMap<Long, Query>() {
{
put(SELECT_SPEC_SHARD, new SelectSpecShard());
put(SELECT_SHARD, new SelectShard());
put(SELECT_ANY_SHARD, new SelectAnyShard());
put(SELECT_ALL_SHARDS, new SelectAllShards());
put(SELECT_ALL_SHARDS_SUM, new SelectAllShardsSum());
put(UPDATE_SPEC_SHARD, new UpdateSpecShard());
put(UPDATE_ALL_SHARDS, new UpdateAllShards());
}
} :
new HashMap<Long, Query>() {
{
put(SELECT_SPEC_SHARD, new SelectSpecShard());
put(SELECT_SHARD, new SelectShardAsync());
put(SELECT_ANY_SHARD, new SelectAnyShard());
put(SELECT_ALL_SHARDS, new SelectAllShardsAsync());
put(SELECT_ALL_SHARDS_SUM, new SelectAllShardsSumAsync());
put(UPDATE_SPEC_SHARD, new UpdateSpecShard());
put(UPDATE_ALL_SHARDS, new UpdateAllShardsAsync());
}
};
}
}
|
UTF-8
|
Java
| 4,142 |
java
|
ShardingFacade.java
|
Java
|
[] | null |
[] |
package net.thumbtack.shardcon;
import net.thumbtack.shardcon.core.Sharding;
import net.thumbtack.shardcon.core.query.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ShardingFacade {
public static final long SELECT_SPEC_SHARD = 1001; // select from specific shard
public static final long SELECT_SHARD = 1002; // select from undefined shard
public static final long SELECT_ANY_SHARD = 1003; // select from any shard
public static final long SELECT_ALL_SHARDS = 1004; // select from all shards with union of results to list
public static final long SELECT_ALL_SHARDS_SUM = 1005; // select from all shards with summation of results to int
public static final long UPDATE_SPEC_SHARD = 1006; // update on specific shard
public static final long UPDATE_ALL_SHARDS = 1007; // update on all shards
private Sharding sharding;
public ShardingFacade(Sharding sharding) {
this.sharding = sharding;
}
// select from specific shard defined by userId
public <U> U selectSpec(long id, QueryClosure<U> closure) {
return sharding.execute(SELECT_SPEC_SHARD, id, closure);
}
// select from undefined shard
public <U> U select(QueryClosure<U> closure) {
return sharding.execute(SELECT_SHARD, closure);
}
// select from any shard
public <U> U selectAny(QueryClosure<U> closure) {
return sharding.execute(SELECT_ANY_SHARD, closure);
}
// select from all shards with results union
public <U> List<U> selectAll(QueryClosure<List<U>> closure) {
return sharding.execute(SELECT_ALL_SHARDS, closure);
}
// select from all shards with results union and with resolving shards by several ids
public <U> List<U> selectAll(List<Long> ids, QueryClosure<List<U>> closure) {
return sharding.execute(SELECT_ALL_SHARDS, ids, closure);
}
// select from all shards with results union
public Integer selectSumAll(QueryClosure<Integer> closure) {
return sharding.execute(SELECT_ALL_SHARDS_SUM, closure);
}
// update on specific shard defined by userId
public <U> U updateSpec(long id, QueryClosure<U> closure) {
return sharding.execute(UPDATE_SPEC_SHARD, id, closure);
}
// update on all shards
// the result of the method is the last successful closure call result
public <U> U updateAll(QueryClosure<U> closure) {
return sharding.execute(UPDATE_ALL_SHARDS, closure);
}
// update on all shards resolver by ids
// the result of the method is the last successful closure call result
public <U> U updateAll(List<Long> ids, QueryClosure<U> closure) {
return sharding.execute(UPDATE_ALL_SHARDS, ids, closure);
}
public static Map<Long, Query> getQueryMap(boolean isSync) {
return isSync ?
new HashMap<Long, Query>() {
{
put(SELECT_SPEC_SHARD, new SelectSpecShard());
put(SELECT_SHARD, new SelectShard());
put(SELECT_ANY_SHARD, new SelectAnyShard());
put(SELECT_ALL_SHARDS, new SelectAllShards());
put(SELECT_ALL_SHARDS_SUM, new SelectAllShardsSum());
put(UPDATE_SPEC_SHARD, new UpdateSpecShard());
put(UPDATE_ALL_SHARDS, new UpdateAllShards());
}
} :
new HashMap<Long, Query>() {
{
put(SELECT_SPEC_SHARD, new SelectSpecShard());
put(SELECT_SHARD, new SelectShardAsync());
put(SELECT_ANY_SHARD, new SelectAnyShard());
put(SELECT_ALL_SHARDS, new SelectAllShardsAsync());
put(SELECT_ALL_SHARDS_SUM, new SelectAllShardsSumAsync());
put(UPDATE_SPEC_SHARD, new UpdateSpecShard());
put(UPDATE_ALL_SHARDS, new UpdateAllShardsAsync());
}
};
}
}
| 4,142 | 0.615403 | 0.608643 | 98 | 41.265305 | 31.861162 | 122 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.744898 | false | false |
5
|
b4a1647b43e17517cf363196cc7e3c6cd0bde9a6
| 33,260,226,771,837 |
c17cb20957032d249cd5019d58c46205e4ec2189
|
/src/main/java/com/baizhi/aspect/CacheAspect.java
|
bf4b8a0312f65c3b05af8412153cc139b9ae25fe
|
[] |
no_license
|
LeFeiMa/yx_mlf
|
https://github.com/LeFeiMa/yx_mlf
|
1a480a2d079c1baaa456aa2a37ed1369c9524087
|
83f4d57d0a0e31a74f75daf7e6a7da17582e9606
|
refs/heads/master
| 2023-07-08T07:55:15.662000 | 2021-08-24T07:07:18 | 2021-08-24T07:07:18 | 399,329,004 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.baizhi.aspect;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import org.springframework.stereotype.Component;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@Aspect
@Component
public class CacheAspect {
@Autowired
private RedisTemplate redisTemplate;
@Around("execution(* com.baizhi.service.*Impl.query*(..))")
public Object cacher(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
System.out.println("进入前置通知");
//获得类名
StringBuilder sb = new StringBuilder();
String name = proceedingJoinPoint.getTarget().getClass().getName();
System.out.println(name);
sb.append(name);
//获取方法名
String name1 = proceedingJoinPoint.getSignature().getName();
System.out.println(name1);
sb.append(name1);
//实参值+
Object[] args = proceedingJoinPoint.getArgs();
for (Object arg : args) {
System.out.println(arg);
sb.append(arg);
}
redisTemplate.setKeySerializer(new StringRedisSerializer());
Object o = redisTemplate.opsForValue().get(sb.toString());
System.out.println(o);
if(o!=null){
return o;
}
System.out.println("全名是"+ sb.toString());
Object proceed = proceedingJoinPoint.proceed();
redisTemplate.opsForValue().set(sb.toString(),proceed);
return proceed;
}
@After("@annotation(com.baizhi.annotation.Delete)")
public void del(JoinPoint joinPoint){
System.out.println("后置通知进入");
String name = joinPoint.getTarget().getClass().getName();
System.out.println("======"+name);
Set keys = redisTemplate.keys("*");
for (Object key : keys) {
System.out.println(" ===== "+key);
String s = (String)key;
if(s.startsWith(name)){
redisTemplate.delete(key);
}
}
}
}
|
UTF-8
|
Java
| 2,440 |
java
|
CacheAspect.java
|
Java
|
[] | null |
[] |
package com.baizhi.aspect;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import org.springframework.stereotype.Component;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@Aspect
@Component
public class CacheAspect {
@Autowired
private RedisTemplate redisTemplate;
@Around("execution(* com.baizhi.service.*Impl.query*(..))")
public Object cacher(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
System.out.println("进入前置通知");
//获得类名
StringBuilder sb = new StringBuilder();
String name = proceedingJoinPoint.getTarget().getClass().getName();
System.out.println(name);
sb.append(name);
//获取方法名
String name1 = proceedingJoinPoint.getSignature().getName();
System.out.println(name1);
sb.append(name1);
//实参值+
Object[] args = proceedingJoinPoint.getArgs();
for (Object arg : args) {
System.out.println(arg);
sb.append(arg);
}
redisTemplate.setKeySerializer(new StringRedisSerializer());
Object o = redisTemplate.opsForValue().get(sb.toString());
System.out.println(o);
if(o!=null){
return o;
}
System.out.println("全名是"+ sb.toString());
Object proceed = proceedingJoinPoint.proceed();
redisTemplate.opsForValue().set(sb.toString(),proceed);
return proceed;
}
@After("@annotation(com.baizhi.annotation.Delete)")
public void del(JoinPoint joinPoint){
System.out.println("后置通知进入");
String name = joinPoint.getTarget().getClass().getName();
System.out.println("======"+name);
Set keys = redisTemplate.keys("*");
for (Object key : keys) {
System.out.println(" ===== "+key);
String s = (String)key;
if(s.startsWith(name)){
redisTemplate.delete(key);
}
}
}
}
| 2,440 | 0.653814 | 0.652557 | 77 | 29.987013 | 23.621195 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.532468 | false | false |
5
|
3b588da2b9abf827247a885e10c414d67d569c98
| 33,260,226,769,590 |
6f5bac6a37af7c88625bfc273a124682c6245ae4
|
/app/src/main/java/com/pai8/ke/activity/wallet/contract/InOutRecordContract.java
|
8e19affbf70c4ce079312089d714c54afa5932d3
|
[] |
no_license
|
fangyouhui/Android_Native
|
https://github.com/fangyouhui/Android_Native
|
3a23b9b3957c37f8d39e8a061be5d0ca79239f69
|
3c583e376f0c08428ef9ff3a47a9b9184c56c5e2
|
refs/heads/master
| 2023-04-21T01:31:13.398000 | 2021-05-12T07:44:45 | 2021-05-12T07:44:45 | 309,220,375 | 4 | 4 | null | false | 2020-12-27T12:37:02 | 2020-11-02T00:46:42 | 2020-12-25T15:37:27 | 2020-12-27T12:37:02 | 258,667 | 0 | 0 | 0 |
Java
| false | false |
package com.pai8.ke.activity.wallet.contract;
import com.pai8.ke.activity.wallet.data.InOutRecordResp;
import com.pai8.ke.base.BaseView;
public interface InOutRecordContract {
interface View extends BaseView {
void isRefresh();
void completeRefresh();
void completeLoadMore();
void getInOutRecordSuccess(InOutRecordResp data);
}
}
|
UTF-8
|
Java
| 377 |
java
|
InOutRecordContract.java
|
Java
|
[] | null |
[] |
package com.pai8.ke.activity.wallet.contract;
import com.pai8.ke.activity.wallet.data.InOutRecordResp;
import com.pai8.ke.base.BaseView;
public interface InOutRecordContract {
interface View extends BaseView {
void isRefresh();
void completeRefresh();
void completeLoadMore();
void getInOutRecordSuccess(InOutRecordResp data);
}
}
| 377 | 0.718833 | 0.710875 | 17 | 21.17647 | 20.756956 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.411765 | false | false |
5
|
c3c4c10d198e18d61e6adcf551e97ff63136fcb3
| 15,676,630,671,557 |
db01dd39b6c964e6eea9498f8176ae2199f743c9
|
/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/test/JsonbRule.java
|
855d159310b65cf00817f1980a9bed6bbec43962
|
[
"MIT",
"Apache-2.0"
] |
permissive
|
apache/johnzon
|
https://github.com/apache/johnzon
|
5a5fe19ad8e1b012746d413a2f0390b9e783bc3e
|
5eb2c7ff643700a8ba77dbe9c29d6500f54031ef
|
refs/heads/master
| 2023-08-26T04:51:19.872000 | 2023-07-25T10:19:55 | 2023-07-25T10:19:55 | 23,907,761 | 41 | 71 |
Apache-2.0
| false | 2023-09-02T09:49:32 | 2014-09-11T07:00:06 | 2023-07-25T13:53:08 | 2023-09-02T09:49:31 | 3,708 | 42 | 66 | 7 |
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.johnzon.jsonb.test;
import org.apache.johnzon.jsonb.api.experimental.JsonbExtension;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import jakarta.json.JsonValue;
import jakarta.json.bind.Jsonb;
import jakarta.json.bind.JsonbBuilder;
import jakarta.json.bind.JsonbConfig;
import jakarta.json.bind.JsonbException;
import jakarta.json.bind.adapter.JsonbAdapter;
import jakarta.json.stream.JsonGenerator;
import jakarta.json.stream.JsonParser;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;
import java.lang.reflect.Type;
public class JsonbRule implements TestRule, Jsonb, JsonbExtension {
private Jsonb jsonb;
private final JsonbConfig config = new JsonbConfig();
public JsonbRule withPropertyOrderStrategy(final String propertyOrderStrategy) {
config.withPropertyOrderStrategy(propertyOrderStrategy);
return this;
}
public JsonbRule withPropertyNamingStrategy(final String propertyorderstrategy) {
config.withPropertyNamingStrategy(propertyorderstrategy);
return this;
}
public JsonbRule withFormatting(final boolean format) {
config.withFormatting(format);
return this;
}
public JsonbRule withTypeAdapter(JsonbAdapter<?, ?>... jsonbAdapters) {
config.withAdapters(jsonbAdapters);
return this;
}
@Override
public Statement apply(final Statement statement, final Description description) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
try (final Jsonb jsonb = JsonbBuilder.create(config)) {
JsonbRule.this.jsonb = jsonb;
statement.evaluate();
} finally {
JsonbRule.this.jsonb = null;
}
}
};
}
@Override
public <T> T fromJson(final String str, final Class<T> type) throws JsonbException {
return jsonb.fromJson(str, type);
}
@Override
public <T> T fromJson(final String str, final Type runtimeType) throws JsonbException {
return jsonb.fromJson(str, runtimeType);
}
@Override
public <T> T fromJson(final Reader reader, final Class<T> type) throws JsonbException {
return jsonb.fromJson(reader, type);
}
@Override
public <T> T fromJson(final Reader reader, final Type runtimeType) throws JsonbException {
return jsonb.fromJson(reader, runtimeType);
}
@Override
public <T> T fromJson(final InputStream stream, final Class<T> type) throws JsonbException {
return jsonb.fromJson(stream, type);
}
@Override
public <T> T fromJson(final InputStream stream, final Type runtimeType) throws JsonbException {
return jsonb.fromJson(stream, runtimeType);
}
@Override
public String toJson(final Object object) throws JsonbException {
return jsonb.toJson(object);
}
@Override
public String toJson(final Object object, final Type runtimeType) throws JsonbException {
return jsonb.toJson(object, runtimeType);
}
@Override
public void toJson(final Object object, final Writer writer) throws JsonbException {
jsonb.toJson(object, writer);
}
@Override
public void toJson(final Object object, final Type runtimeType, final Writer writer) throws JsonbException {
jsonb.toJson(object, runtimeType, writer);
}
@Override
public void toJson(final Object object, final OutputStream stream) throws JsonbException {
jsonb.toJson(object, stream);
}
@Override
public void toJson(final Object object, final Type runtimeType, final OutputStream stream) throws JsonbException {
jsonb.toJson(object, runtimeType, stream);
}
@Override
public void close() {
// no-op
}
@Override
public <T> T fromJsonValue(final JsonValue json, final Class<T> type) {
return JsonbExtension.class.cast(jsonb).fromJsonValue(json, type);
}
@Override
public <T> T fromJsonValue(final JsonValue json, final Type runtimeType) {
return JsonbExtension.class.cast(jsonb).fromJsonValue(json, runtimeType);
}
@Override
public JsonValue toJsonValue(final Object object) {
return JsonbExtension.class.cast(jsonb).toJsonValue(object);
}
@Override
public JsonValue toJsonValue(final Object object, final Type runtimeType) {
return JsonbExtension.class.cast(jsonb).toJsonValue(object, runtimeType);
}
@Override
public <T> T fromJson(final JsonParser json, final Class<T> type) {
return JsonbExtension.class.cast(jsonb).fromJson(json, type);
}
@Override
public <T> T fromJson(final JsonParser json, final Type runtimeType) {
return JsonbExtension.class.cast(jsonb).fromJson(json, runtimeType);
}
@Override
public void toJson(final Object object, final JsonGenerator jsonGenerator) {
JsonbExtension.class.cast(jsonb).toJson(object, jsonGenerator);
}
@Override
public void toJson(final Object object, final Type runtimeType, final JsonGenerator jsonGenerator) {
JsonbExtension.class.cast(jsonb).toJson(object, runtimeType, jsonGenerator);
}
}
|
UTF-8
|
Java
| 6,168 |
java
|
JsonbRule.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.johnzon.jsonb.test;
import org.apache.johnzon.jsonb.api.experimental.JsonbExtension;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import jakarta.json.JsonValue;
import jakarta.json.bind.Jsonb;
import jakarta.json.bind.JsonbBuilder;
import jakarta.json.bind.JsonbConfig;
import jakarta.json.bind.JsonbException;
import jakarta.json.bind.adapter.JsonbAdapter;
import jakarta.json.stream.JsonGenerator;
import jakarta.json.stream.JsonParser;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;
import java.lang.reflect.Type;
public class JsonbRule implements TestRule, Jsonb, JsonbExtension {
private Jsonb jsonb;
private final JsonbConfig config = new JsonbConfig();
public JsonbRule withPropertyOrderStrategy(final String propertyOrderStrategy) {
config.withPropertyOrderStrategy(propertyOrderStrategy);
return this;
}
public JsonbRule withPropertyNamingStrategy(final String propertyorderstrategy) {
config.withPropertyNamingStrategy(propertyorderstrategy);
return this;
}
public JsonbRule withFormatting(final boolean format) {
config.withFormatting(format);
return this;
}
public JsonbRule withTypeAdapter(JsonbAdapter<?, ?>... jsonbAdapters) {
config.withAdapters(jsonbAdapters);
return this;
}
@Override
public Statement apply(final Statement statement, final Description description) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
try (final Jsonb jsonb = JsonbBuilder.create(config)) {
JsonbRule.this.jsonb = jsonb;
statement.evaluate();
} finally {
JsonbRule.this.jsonb = null;
}
}
};
}
@Override
public <T> T fromJson(final String str, final Class<T> type) throws JsonbException {
return jsonb.fromJson(str, type);
}
@Override
public <T> T fromJson(final String str, final Type runtimeType) throws JsonbException {
return jsonb.fromJson(str, runtimeType);
}
@Override
public <T> T fromJson(final Reader reader, final Class<T> type) throws JsonbException {
return jsonb.fromJson(reader, type);
}
@Override
public <T> T fromJson(final Reader reader, final Type runtimeType) throws JsonbException {
return jsonb.fromJson(reader, runtimeType);
}
@Override
public <T> T fromJson(final InputStream stream, final Class<T> type) throws JsonbException {
return jsonb.fromJson(stream, type);
}
@Override
public <T> T fromJson(final InputStream stream, final Type runtimeType) throws JsonbException {
return jsonb.fromJson(stream, runtimeType);
}
@Override
public String toJson(final Object object) throws JsonbException {
return jsonb.toJson(object);
}
@Override
public String toJson(final Object object, final Type runtimeType) throws JsonbException {
return jsonb.toJson(object, runtimeType);
}
@Override
public void toJson(final Object object, final Writer writer) throws JsonbException {
jsonb.toJson(object, writer);
}
@Override
public void toJson(final Object object, final Type runtimeType, final Writer writer) throws JsonbException {
jsonb.toJson(object, runtimeType, writer);
}
@Override
public void toJson(final Object object, final OutputStream stream) throws JsonbException {
jsonb.toJson(object, stream);
}
@Override
public void toJson(final Object object, final Type runtimeType, final OutputStream stream) throws JsonbException {
jsonb.toJson(object, runtimeType, stream);
}
@Override
public void close() {
// no-op
}
@Override
public <T> T fromJsonValue(final JsonValue json, final Class<T> type) {
return JsonbExtension.class.cast(jsonb).fromJsonValue(json, type);
}
@Override
public <T> T fromJsonValue(final JsonValue json, final Type runtimeType) {
return JsonbExtension.class.cast(jsonb).fromJsonValue(json, runtimeType);
}
@Override
public JsonValue toJsonValue(final Object object) {
return JsonbExtension.class.cast(jsonb).toJsonValue(object);
}
@Override
public JsonValue toJsonValue(final Object object, final Type runtimeType) {
return JsonbExtension.class.cast(jsonb).toJsonValue(object, runtimeType);
}
@Override
public <T> T fromJson(final JsonParser json, final Class<T> type) {
return JsonbExtension.class.cast(jsonb).fromJson(json, type);
}
@Override
public <T> T fromJson(final JsonParser json, final Type runtimeType) {
return JsonbExtension.class.cast(jsonb).fromJson(json, runtimeType);
}
@Override
public void toJson(final Object object, final JsonGenerator jsonGenerator) {
JsonbExtension.class.cast(jsonb).toJson(object, jsonGenerator);
}
@Override
public void toJson(final Object object, final Type runtimeType, final JsonGenerator jsonGenerator) {
JsonbExtension.class.cast(jsonb).toJson(object, runtimeType, jsonGenerator);
}
}
| 6,168 | 0.702497 | 0.701848 | 185 | 32.340542 | 30.987316 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.556757 | false | false |
5
|
056b45d3f8bf13fe6f683a1f4a468076575ac927
| 25,228,637,929,600 |
5f1a252a6b29dbd2dbbcca79341aabf01a38c076
|
/app/src/main/java/com/example/dipto/expandablerecylerview/model/OuterModel.java
|
7429a05d32c2ce573e160f60de2c7d74e7b5e714
|
[] |
no_license
|
ImtiazDipto01/ExpandableRecylerview
|
https://github.com/ImtiazDipto01/ExpandableRecylerview
|
ae9294e926076adc89ca18fd2025865579ca3e86
|
d9d76fd44e9d1064f4f1395df5bb4ce20544de1b
|
refs/heads/master
| 2021-01-02T09:17:06.021000 | 2017-08-03T02:23:03 | 2017-08-03T02:23:03 | 99,180,997 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.dipto.expandablerecylerview.model;
import com.thoughtbot.expandablerecyclerview.models.ExpandableGroup;
import java.util.List;
/**
* Created by Dipto on 8/2/2017.
*/
public class OuterModel extends ExpandableGroup<InnerModel> {
private int img ;
public OuterModel(String outertitle, List<InnerModel> items, int img){
super(outertitle, items);
this.img = img ;
}
public int getImg() {
return img;
}
}
|
UTF-8
|
Java
| 473 |
java
|
OuterModel.java
|
Java
|
[
{
"context": "eGroup;\n\nimport java.util.List;\n\n/**\n * Created by Dipto on 8/2/2017.\n */\n\npublic class OuterModel extends",
"end": 173,
"score": 0.9991400241851807,
"start": 168,
"tag": "USERNAME",
"value": "Dipto"
}
] | null |
[] |
package com.example.dipto.expandablerecylerview.model;
import com.thoughtbot.expandablerecyclerview.models.ExpandableGroup;
import java.util.List;
/**
* Created by Dipto on 8/2/2017.
*/
public class OuterModel extends ExpandableGroup<InnerModel> {
private int img ;
public OuterModel(String outertitle, List<InnerModel> items, int img){
super(outertitle, items);
this.img = img ;
}
public int getImg() {
return img;
}
}
| 473 | 0.691332 | 0.678647 | 23 | 19.565218 | 23.407219 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.434783 | false | false |
5
|
d8fa915308dfc43714c8fba35037c479e99912f0
| 27,023,934,273,105 |
ae86b79de48f6660bec75239d1682b3d71cab8f8
|
/EW/build/generated-sources/jax-ws/clientes_WS/ObjectFactory.java
|
80aca98ea2bc5c6e6a4a54b897e9b297647e8ba8
|
[] |
no_license
|
EUPT-Practicas/EuloWarClient
|
https://github.com/EUPT-Practicas/EuloWarClient
|
b1705432dfa3c3238bd5f8ca24a0ef64d601345b
|
ebb810c0ac914c7f22a06560790f64a8367ace60
|
refs/heads/master
| 2021-01-10T17:08:13.785000 | 2015-06-17T18:47:49 | 2015-06-17T18:47:49 | 36,678,181 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package clientes_WS;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElementDecl;
import javax.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the clientes_WS package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
private final static QName _FindUserResponse_QNAME = new QName("http://webservices/", "findUserResponse");
private final static QName _ComprobarLoginResponse_QNAME = new QName("http://webservices/", "comprobarLoginResponse");
private final static QName _FindUser_QNAME = new QName("http://webservices/", "findUser");
private final static QName _ExisteUsuario_QNAME = new QName("http://webservices/", "existeUsuario");
private final static QName _ComprobarLogin_QNAME = new QName("http://webservices/", "comprobarLogin");
private final static QName _CrearUsuario_QNAME = new QName("http://webservices/", "crearUsuario");
private final static QName _CrearUsuarioResponse_QNAME = new QName("http://webservices/", "crearUsuarioResponse");
private final static QName _Usuario_QNAME = new QName("http://webservices/", "usuario");
private final static QName _ExisteUsuarioResponse_QNAME = new QName("http://webservices/", "existeUsuarioResponse");
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: clientes_WS
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link ExisteUsuarioResponse }
*
*/
public ExisteUsuarioResponse createExisteUsuarioResponse() {
return new ExisteUsuarioResponse();
}
/**
* Create an instance of {@link Usuario }
*
*/
public Usuario createUsuario() {
return new Usuario();
}
/**
* Create an instance of {@link CrearUsuarioResponse }
*
*/
public CrearUsuarioResponse createCrearUsuarioResponse() {
return new CrearUsuarioResponse();
}
/**
* Create an instance of {@link ComprobarLogin }
*
*/
public ComprobarLogin createComprobarLogin() {
return new ComprobarLogin();
}
/**
* Create an instance of {@link CrearUsuario }
*
*/
public CrearUsuario createCrearUsuario() {
return new CrearUsuario();
}
/**
* Create an instance of {@link FindUser }
*
*/
public FindUser createFindUser() {
return new FindUser();
}
/**
* Create an instance of {@link ExisteUsuario }
*
*/
public ExisteUsuario createExisteUsuario() {
return new ExisteUsuario();
}
/**
* Create an instance of {@link ComprobarLoginResponse }
*
*/
public ComprobarLoginResponse createComprobarLoginResponse() {
return new ComprobarLoginResponse();
}
/**
* Create an instance of {@link FindUserResponse }
*
*/
public FindUserResponse createFindUserResponse() {
return new FindUserResponse();
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link FindUserResponse }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://webservices/", name = "findUserResponse")
public JAXBElement<FindUserResponse> createFindUserResponse(FindUserResponse value) {
return new JAXBElement<FindUserResponse>(_FindUserResponse_QNAME, FindUserResponse.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link ComprobarLoginResponse }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://webservices/", name = "comprobarLoginResponse")
public JAXBElement<ComprobarLoginResponse> createComprobarLoginResponse(ComprobarLoginResponse value) {
return new JAXBElement<ComprobarLoginResponse>(_ComprobarLoginResponse_QNAME, ComprobarLoginResponse.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link FindUser }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://webservices/", name = "findUser")
public JAXBElement<FindUser> createFindUser(FindUser value) {
return new JAXBElement<FindUser>(_FindUser_QNAME, FindUser.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link ExisteUsuario }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://webservices/", name = "existeUsuario")
public JAXBElement<ExisteUsuario> createExisteUsuario(ExisteUsuario value) {
return new JAXBElement<ExisteUsuario>(_ExisteUsuario_QNAME, ExisteUsuario.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link ComprobarLogin }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://webservices/", name = "comprobarLogin")
public JAXBElement<ComprobarLogin> createComprobarLogin(ComprobarLogin value) {
return new JAXBElement<ComprobarLogin>(_ComprobarLogin_QNAME, ComprobarLogin.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link CrearUsuario }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://webservices/", name = "crearUsuario")
public JAXBElement<CrearUsuario> createCrearUsuario(CrearUsuario value) {
return new JAXBElement<CrearUsuario>(_CrearUsuario_QNAME, CrearUsuario.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link CrearUsuarioResponse }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://webservices/", name = "crearUsuarioResponse")
public JAXBElement<CrearUsuarioResponse> createCrearUsuarioResponse(CrearUsuarioResponse value) {
return new JAXBElement<CrearUsuarioResponse>(_CrearUsuarioResponse_QNAME, CrearUsuarioResponse.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link Usuario }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://webservices/", name = "usuario")
public JAXBElement<Usuario> createUsuario(Usuario value) {
return new JAXBElement<Usuario>(_Usuario_QNAME, Usuario.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link ExisteUsuarioResponse }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://webservices/", name = "existeUsuarioResponse")
public JAXBElement<ExisteUsuarioResponse> createExisteUsuarioResponse(ExisteUsuarioResponse value) {
return new JAXBElement<ExisteUsuarioResponse>(_ExisteUsuarioResponse_QNAME, ExisteUsuarioResponse.class, null, value);
}
}
|
UTF-8
|
Java
| 7,121 |
java
|
ObjectFactory.java
|
Java
|
[] | null |
[] |
package clientes_WS;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElementDecl;
import javax.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the clientes_WS package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
private final static QName _FindUserResponse_QNAME = new QName("http://webservices/", "findUserResponse");
private final static QName _ComprobarLoginResponse_QNAME = new QName("http://webservices/", "comprobarLoginResponse");
private final static QName _FindUser_QNAME = new QName("http://webservices/", "findUser");
private final static QName _ExisteUsuario_QNAME = new QName("http://webservices/", "existeUsuario");
private final static QName _ComprobarLogin_QNAME = new QName("http://webservices/", "comprobarLogin");
private final static QName _CrearUsuario_QNAME = new QName("http://webservices/", "crearUsuario");
private final static QName _CrearUsuarioResponse_QNAME = new QName("http://webservices/", "crearUsuarioResponse");
private final static QName _Usuario_QNAME = new QName("http://webservices/", "usuario");
private final static QName _ExisteUsuarioResponse_QNAME = new QName("http://webservices/", "existeUsuarioResponse");
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: clientes_WS
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link ExisteUsuarioResponse }
*
*/
public ExisteUsuarioResponse createExisteUsuarioResponse() {
return new ExisteUsuarioResponse();
}
/**
* Create an instance of {@link Usuario }
*
*/
public Usuario createUsuario() {
return new Usuario();
}
/**
* Create an instance of {@link CrearUsuarioResponse }
*
*/
public CrearUsuarioResponse createCrearUsuarioResponse() {
return new CrearUsuarioResponse();
}
/**
* Create an instance of {@link ComprobarLogin }
*
*/
public ComprobarLogin createComprobarLogin() {
return new ComprobarLogin();
}
/**
* Create an instance of {@link CrearUsuario }
*
*/
public CrearUsuario createCrearUsuario() {
return new CrearUsuario();
}
/**
* Create an instance of {@link FindUser }
*
*/
public FindUser createFindUser() {
return new FindUser();
}
/**
* Create an instance of {@link ExisteUsuario }
*
*/
public ExisteUsuario createExisteUsuario() {
return new ExisteUsuario();
}
/**
* Create an instance of {@link ComprobarLoginResponse }
*
*/
public ComprobarLoginResponse createComprobarLoginResponse() {
return new ComprobarLoginResponse();
}
/**
* Create an instance of {@link FindUserResponse }
*
*/
public FindUserResponse createFindUserResponse() {
return new FindUserResponse();
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link FindUserResponse }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://webservices/", name = "findUserResponse")
public JAXBElement<FindUserResponse> createFindUserResponse(FindUserResponse value) {
return new JAXBElement<FindUserResponse>(_FindUserResponse_QNAME, FindUserResponse.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link ComprobarLoginResponse }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://webservices/", name = "comprobarLoginResponse")
public JAXBElement<ComprobarLoginResponse> createComprobarLoginResponse(ComprobarLoginResponse value) {
return new JAXBElement<ComprobarLoginResponse>(_ComprobarLoginResponse_QNAME, ComprobarLoginResponse.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link FindUser }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://webservices/", name = "findUser")
public JAXBElement<FindUser> createFindUser(FindUser value) {
return new JAXBElement<FindUser>(_FindUser_QNAME, FindUser.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link ExisteUsuario }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://webservices/", name = "existeUsuario")
public JAXBElement<ExisteUsuario> createExisteUsuario(ExisteUsuario value) {
return new JAXBElement<ExisteUsuario>(_ExisteUsuario_QNAME, ExisteUsuario.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link ComprobarLogin }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://webservices/", name = "comprobarLogin")
public JAXBElement<ComprobarLogin> createComprobarLogin(ComprobarLogin value) {
return new JAXBElement<ComprobarLogin>(_ComprobarLogin_QNAME, ComprobarLogin.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link CrearUsuario }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://webservices/", name = "crearUsuario")
public JAXBElement<CrearUsuario> createCrearUsuario(CrearUsuario value) {
return new JAXBElement<CrearUsuario>(_CrearUsuario_QNAME, CrearUsuario.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link CrearUsuarioResponse }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://webservices/", name = "crearUsuarioResponse")
public JAXBElement<CrearUsuarioResponse> createCrearUsuarioResponse(CrearUsuarioResponse value) {
return new JAXBElement<CrearUsuarioResponse>(_CrearUsuarioResponse_QNAME, CrearUsuarioResponse.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link Usuario }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://webservices/", name = "usuario")
public JAXBElement<Usuario> createUsuario(Usuario value) {
return new JAXBElement<Usuario>(_Usuario_QNAME, Usuario.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link ExisteUsuarioResponse }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://webservices/", name = "existeUsuarioResponse")
public JAXBElement<ExisteUsuarioResponse> createExisteUsuarioResponse(ExisteUsuarioResponse value) {
return new JAXBElement<ExisteUsuarioResponse>(_ExisteUsuarioResponse_QNAME, ExisteUsuarioResponse.class, null, value);
}
}
| 7,121 | 0.676731 | 0.676731 | 196 | 35.32653 | 38.066879 | 129 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.397959 | false | false |
5
|
fca2ce16b450f9d50e92b7601ac7eb4fbce71424
| 23,270,132,857,029 |
88544f96055845a533c4ed0668e6e56bc6ed2d8a
|
/games.Shithead/src/main/java/games/shithead/utils/LoggingUtils.java
|
006536e0e29269ffdcfbcbbb29509f200486d09d
|
[] |
no_license
|
JonathanShifman/shithead-tournament
|
https://github.com/JonathanShifman/shithead-tournament
|
bdb3aea50370593d06dbb48c788300ee94c59a8f
|
794a5ec94df08bb412238de802bda227e74f29f0
|
refs/heads/master
| 2018-10-08T21:53:54.040000 | 2018-08-02T21:06:10 | 2018-08-02T21:06:10 | 113,221,382 | 1 | 0 | null | false | 2018-01-13T08:56:19 | 2017-12-05T19:01:00 | 2018-01-06T09:12:05 | 2018-01-13T08:56:19 | 54 | 1 | 0 | 0 |
Java
| false | null |
package games.shithead.utils;
import games.shithead.deck.CardDescriptionGenerator;
import games.shithead.game.interfaces.IGameCard;
import java.util.List;
import java.util.stream.Collectors;
public class LoggingUtils {
/**
* Converts a list of cards to a string made of their minimal descriptions (only ranks). Used for logging.
* @param cards The list of cards to analyze
* @return A String representing the given cards' descriptions
*/
public static String cardsToMinDescriptions(List<IGameCard> cards) {
String cardDescriptions = cards.stream()
.map(card -> CardDescriptionGenerator.cardFaceToMinimalDescription(card.getCardFace().orElse(null)))
.collect(Collectors.joining(", "));
return "[" + cardDescriptions + "]";
}
public static String cardsToFullDescriptions(List<IGameCard> cards) {
String cardDescriptions = cards.stream()
.map(card -> CardDescriptionGenerator.cardToFullDescription(card.getCardFace().orElse(null), card.getUniqueId()))
.collect(Collectors.joining(", "));
return "[" + cardDescriptions + "]";
}
}
|
UTF-8
|
Java
| 1,168 |
java
|
LoggingUtils.java
|
Java
|
[] | null |
[] |
package games.shithead.utils;
import games.shithead.deck.CardDescriptionGenerator;
import games.shithead.game.interfaces.IGameCard;
import java.util.List;
import java.util.stream.Collectors;
public class LoggingUtils {
/**
* Converts a list of cards to a string made of their minimal descriptions (only ranks). Used for logging.
* @param cards The list of cards to analyze
* @return A String representing the given cards' descriptions
*/
public static String cardsToMinDescriptions(List<IGameCard> cards) {
String cardDescriptions = cards.stream()
.map(card -> CardDescriptionGenerator.cardFaceToMinimalDescription(card.getCardFace().orElse(null)))
.collect(Collectors.joining(", "));
return "[" + cardDescriptions + "]";
}
public static String cardsToFullDescriptions(List<IGameCard> cards) {
String cardDescriptions = cards.stream()
.map(card -> CardDescriptionGenerator.cardToFullDescription(card.getCardFace().orElse(null), card.getUniqueId()))
.collect(Collectors.joining(", "));
return "[" + cardDescriptions + "]";
}
}
| 1,168 | 0.685788 | 0.685788 | 30 | 37.933334 | 35.739738 | 129 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false |
5
|
6df117d0610d9d7daffbfc862d57721cf0d45ced
| 163,208,801,548 |
2f0cdcb4b3605e624f230584b013f87622fd81a7
|
/string/isMatch_2014_1228.java
|
5bd4ec7d5d98b4211ed9759ffba4ad53ec48b805
|
[] |
no_license
|
techperfect/LeetCode
|
https://github.com/techperfect/LeetCode
|
0096da1b12334e5f3270d3500b54e4c0e2eb905a
|
9e10f83190160bc4f57f9e5cb27e63f4d22eabfb
|
refs/heads/master
| 2023-01-01T00:36:02.216000 | 2020-10-19T13:53:20 | 2020-10-19T13:53:20 | 69,236,327 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package Algorithms.string;
public class isMatch_2014_1228 {
// Solution 2: DFS.
public boolean isMatch1(String s, String p) {
if (s == null || p == null) {
return false;
}
return dfs(s, p, 0, 0);
}
public boolean dfs(String s, String p, int indexS, int indexP) {
int lenS = s.length();
int lenP = p.length();
// THE BASE CASE:
if (indexP >= lenP) {
// indexP is out of range. Then the s should also be empty.
return indexS >= lenS;
}
// The first Case: next node is *
if (indexP != lenP - 1 && p.charAt(indexP + 1) == '*') {
// p can skip 2 node, and the S can skip 0 or more characters.
if (dfs(s, p, indexS, indexP + 2)) {
return true;
}
for (int i = indexS; i < lenS; i++) {
// the char is not equal.
// bug 2: Line 31: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
if (!isSame(s.charAt(i), p.charAt(indexP))) {
return false;
}
if (dfs(s, p, i + 1, indexP + 2)) {
return true;
}
}
// Not any of them can match.
return false;
} else {
// S should have at least one character left.
if (indexS >= lenS) {
return false;
}
if (!isSame(s.charAt(indexS), p.charAt(indexP))) {
return false;
}
// bug 1: forget ';'
return dfs(s, p, indexS + 1, indexP + 1);
}
}
public boolean isSame(char c, char p) {
return p == '.' || c == p;
}
// solution3: dfs + memory
public boolean isMatch2(String s, String p) {
if (s == null || p == null) {
return false;
}
int[][] mem = new int[s.length() + 1][p.length() + 1];
// BUG 1: forget to init the memory array.
// BUG 2: the corner is <=
for (int i = 0; i <= s.length(); i++) {
for (int j = 0; j <= p.length(); j++) {
mem[i][j] = -1;
}
}
return dfsMem(s, p, 0, 0, mem);
}
public boolean dfsMem(String s, String p, int indexS, int indexP, int[][] mem) {
int lenS = s.length();
int lenP = p.length();
if (mem[indexS][indexP] != -1) {
return mem[indexS][indexP] == 1;
}
// THE BASE CASE:
if (indexP >= lenP) {
// indexP is out of range. Then the s should also be empty.
mem[indexS][indexP] = indexS >= lenS ? 1: 0;
return indexS >= lenS;
}
// The first Case: next node is *
if (indexP != lenP - 1 && p.charAt(indexP + 1) == '*') {
// p can skip 2 node, and the S can skip 0 or more characters.
if (dfsMem(s, p, indexS, indexP + 2, mem)) {
mem[indexS][indexP] = 1;
return true;
}
for (int i = indexS; i < lenS; i++) {
// the char is not equal.
// bug 2: Line 31: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
if (!isSame(s.charAt(i), p.charAt(indexP))) {
mem[indexS][indexP] = 0;
return false;
}
if (dfsMem(s, p, i + 1, indexP + 2, mem)) {
mem[indexS][indexP] = 1;
return true;
}
}
// Not any of them can match.
mem[indexS][indexP] = 0;
return false;
} else {
// S should have at least one character left.
boolean ret = indexS < lenS
&& isSame(s.charAt(indexS), p.charAt(indexP))
&& dfsMem(s, p, indexS + 1, indexP + 1, mem);
mem[indexS][indexP] = ret ? 1: 0;
return ret;
}
}
// solution4: DP
public boolean isMatch(String s, String p) {
if (s == null || p == null) {
return false;
}
// bug 2: should use boolean instead of int.
boolean[][] D = new boolean[s.length() + 1][p.length() + 1];
// D[i][j]: i, j, the length of String s and String p.
for (int i = 0; i <= s.length(); i++) {
for (int j = 0; j <= p.length(); j++) {
if (j == 0) {
// when p is empth, the s should be empty.
D[i][j] = i == 0;
} else if (p.charAt(j - 1) == '*') {
/*
P has at least one node.
*/
// The last node in p is '*'
if (j < 2) {
// a error: there should be a character before *.
//return false;
}
// we can match 0 characters or match more characters.
for (int k = 0; k <= i; k++) {
// BUG 3: severe! Forget to deal with the empty string!!
if (k != 0 && !isSame(s.charAt(i - k), p.charAt(j - 2))) {
D[i][j] = false;
break;
}
if (D[i - k][j - 2]) {
D[i][j] = true;
break;
}
}
} else {
D[i][j] = i >= 1
&& isSame(s.charAt(i - 1), p.charAt(j - 1))
&& D[i - 1][j - 1];
}
}
}
return D[s.length()][p.length()];
}
}
|
UTF-8
|
Java
| 6,138 |
java
|
isMatch_2014_1228.java
|
Java
|
[] | null |
[] |
package Algorithms.string;
public class isMatch_2014_1228 {
// Solution 2: DFS.
public boolean isMatch1(String s, String p) {
if (s == null || p == null) {
return false;
}
return dfs(s, p, 0, 0);
}
public boolean dfs(String s, String p, int indexS, int indexP) {
int lenS = s.length();
int lenP = p.length();
// THE BASE CASE:
if (indexP >= lenP) {
// indexP is out of range. Then the s should also be empty.
return indexS >= lenS;
}
// The first Case: next node is *
if (indexP != lenP - 1 && p.charAt(indexP + 1) == '*') {
// p can skip 2 node, and the S can skip 0 or more characters.
if (dfs(s, p, indexS, indexP + 2)) {
return true;
}
for (int i = indexS; i < lenS; i++) {
// the char is not equal.
// bug 2: Line 31: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
if (!isSame(s.charAt(i), p.charAt(indexP))) {
return false;
}
if (dfs(s, p, i + 1, indexP + 2)) {
return true;
}
}
// Not any of them can match.
return false;
} else {
// S should have at least one character left.
if (indexS >= lenS) {
return false;
}
if (!isSame(s.charAt(indexS), p.charAt(indexP))) {
return false;
}
// bug 1: forget ';'
return dfs(s, p, indexS + 1, indexP + 1);
}
}
public boolean isSame(char c, char p) {
return p == '.' || c == p;
}
// solution3: dfs + memory
public boolean isMatch2(String s, String p) {
if (s == null || p == null) {
return false;
}
int[][] mem = new int[s.length() + 1][p.length() + 1];
// BUG 1: forget to init the memory array.
// BUG 2: the corner is <=
for (int i = 0; i <= s.length(); i++) {
for (int j = 0; j <= p.length(); j++) {
mem[i][j] = -1;
}
}
return dfsMem(s, p, 0, 0, mem);
}
public boolean dfsMem(String s, String p, int indexS, int indexP, int[][] mem) {
int lenS = s.length();
int lenP = p.length();
if (mem[indexS][indexP] != -1) {
return mem[indexS][indexP] == 1;
}
// THE BASE CASE:
if (indexP >= lenP) {
// indexP is out of range. Then the s should also be empty.
mem[indexS][indexP] = indexS >= lenS ? 1: 0;
return indexS >= lenS;
}
// The first Case: next node is *
if (indexP != lenP - 1 && p.charAt(indexP + 1) == '*') {
// p can skip 2 node, and the S can skip 0 or more characters.
if (dfsMem(s, p, indexS, indexP + 2, mem)) {
mem[indexS][indexP] = 1;
return true;
}
for (int i = indexS; i < lenS; i++) {
// the char is not equal.
// bug 2: Line 31: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
if (!isSame(s.charAt(i), p.charAt(indexP))) {
mem[indexS][indexP] = 0;
return false;
}
if (dfsMem(s, p, i + 1, indexP + 2, mem)) {
mem[indexS][indexP] = 1;
return true;
}
}
// Not any of them can match.
mem[indexS][indexP] = 0;
return false;
} else {
// S should have at least one character left.
boolean ret = indexS < lenS
&& isSame(s.charAt(indexS), p.charAt(indexP))
&& dfsMem(s, p, indexS + 1, indexP + 1, mem);
mem[indexS][indexP] = ret ? 1: 0;
return ret;
}
}
// solution4: DP
public boolean isMatch(String s, String p) {
if (s == null || p == null) {
return false;
}
// bug 2: should use boolean instead of int.
boolean[][] D = new boolean[s.length() + 1][p.length() + 1];
// D[i][j]: i, j, the length of String s and String p.
for (int i = 0; i <= s.length(); i++) {
for (int j = 0; j <= p.length(); j++) {
if (j == 0) {
// when p is empth, the s should be empty.
D[i][j] = i == 0;
} else if (p.charAt(j - 1) == '*') {
/*
P has at least one node.
*/
// The last node in p is '*'
if (j < 2) {
// a error: there should be a character before *.
//return false;
}
// we can match 0 characters or match more characters.
for (int k = 0; k <= i; k++) {
// BUG 3: severe! Forget to deal with the empty string!!
if (k != 0 && !isSame(s.charAt(i - k), p.charAt(j - 2))) {
D[i][j] = false;
break;
}
if (D[i - k][j - 2]) {
D[i][j] = true;
break;
}
}
} else {
D[i][j] = i >= 1
&& isSame(s.charAt(i - 1), p.charAt(j - 1))
&& D[i - 1][j - 1];
}
}
}
return D[s.length()][p.length()];
}
}
| 6,138 | 0.380417 | 0.367221 | 183 | 32.546448 | 21.693766 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.639344 | false | false |
5
|
36a0df350db2c38d1d57f4adccc089404f7e57d6
| 13,615,046,381,497 |
c38f598b5b84d2a356ee0de849b17c67ceea5e1d
|
/BDDFramework/BDDFramework/src/main/java/stepdefinitions/HomeSteps.java
|
9e2b7d97350714b7b6ff957f5e8bb9d5b8337a29
|
[] |
no_license
|
Mohiddin500/BDDTest
|
https://github.com/Mohiddin500/BDDTest
|
a933c00666ff64218b5fad8ea37c971f98e65bbe
|
85d01555e1a5f0718e75286aef53e68e793cfb9a
|
refs/heads/master
| 2023-05-31T12:01:20.298000 | 2021-07-09T17:15:53 | 2021-07-09T17:15:53 | 315,934,810 | 1 | 0 | null | false | 2021-07-09T17:15:54 | 2020-11-25T12:37:02 | 2021-07-08T09:22:08 | 2021-07-09T17:15:53 | 11,129 | 1 | 0 | 0 |
HTML
| false | false |
package stepdefinitions;
import com.utilities.PageObjectManager;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
import pageobjects.HomePage;
import pageobjects.SerpPage;
public class HomeSteps {
public HomePage homepage;
public SerpPage serppage;
public PageObjectManager objectmanager;
@Given("^user is on TT Homepage$")
public void user_is_on_TT_Homepage() {
objectmanager = new PageObjectManager();
homepage = objectmanager.getHomePage();
homepage.launchHomePage();
}
@When("^user click on user icon and signin button$")
public void user_click_on_user_icon_and_signin_button() {
homepage.clickSignin();
}
@When("^user enter username and password$")
public void user_enter_username_and_password() {
homepage.enterEmail();
homepage.enterPassword();
}
@When("^user click on login button$")
public void user_click_on_login_button() {
homepage.clickLoginButton();
}
@Then("^verify login popup$")
public void verify_login_popup() {
homepage.verifyLoginEmail();
homepage.signOut();
}
@When("^verify title$")
public void verify_title() {
System.out.println(homepage.getTitle());
}
@Then("^verify family section display$")
public void verify_family_section_display() {
homepage.familySectionDisplay();
}
@When("^enter destination and departfrom$")
public void enter_destination_and_departfrom() {
homepage.selectDestination();
homepage.selectDeparture();
}
@When("^select date$")
public void select_date() {
homepage.selectDate();
}
@When("^select nights and guests$")
public void select_nights_and_guests() {
homepage.selectNights();
homepage.selectGuests();
}
@When("^click on search button$")
public void click_on_search_button() {
//homepage = new HomePage();
serppage=homepage.clickFindDealsButton();
//System.out.println("Status of the page" + serppage);
}
/*
* @Then("^close browser$") public void close_browser() {
*
* homepage.closeBrowser();
*
* }
*/
}
|
UTF-8
|
Java
| 2,035 |
java
|
HomeSteps.java
|
Java
|
[] | null |
[] |
package stepdefinitions;
import com.utilities.PageObjectManager;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
import pageobjects.HomePage;
import pageobjects.SerpPage;
public class HomeSteps {
public HomePage homepage;
public SerpPage serppage;
public PageObjectManager objectmanager;
@Given("^user is on TT Homepage$")
public void user_is_on_TT_Homepage() {
objectmanager = new PageObjectManager();
homepage = objectmanager.getHomePage();
homepage.launchHomePage();
}
@When("^user click on user icon and signin button$")
public void user_click_on_user_icon_and_signin_button() {
homepage.clickSignin();
}
@When("^user enter username and password$")
public void user_enter_username_and_password() {
homepage.enterEmail();
homepage.enterPassword();
}
@When("^user click on login button$")
public void user_click_on_login_button() {
homepage.clickLoginButton();
}
@Then("^verify login popup$")
public void verify_login_popup() {
homepage.verifyLoginEmail();
homepage.signOut();
}
@When("^verify title$")
public void verify_title() {
System.out.println(homepage.getTitle());
}
@Then("^verify family section display$")
public void verify_family_section_display() {
homepage.familySectionDisplay();
}
@When("^enter destination and departfrom$")
public void enter_destination_and_departfrom() {
homepage.selectDestination();
homepage.selectDeparture();
}
@When("^select date$")
public void select_date() {
homepage.selectDate();
}
@When("^select nights and guests$")
public void select_nights_and_guests() {
homepage.selectNights();
homepage.selectGuests();
}
@When("^click on search button$")
public void click_on_search_button() {
//homepage = new HomePage();
serppage=homepage.clickFindDealsButton();
//System.out.println("Status of the page" + serppage);
}
/*
* @Then("^close browser$") public void close_browser() {
*
* homepage.closeBrowser();
*
* }
*/
}
| 2,035 | 0.706634 | 0.706634 | 102 | 18.950981 | 18.337456 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.107843 | false | false |
5
|
3585edfc7e3cbb03f14de47d0f1bc2c25a2b0c46
| 31,619,549,234,342 |
ba654ef27f19d49973771ac539fe8f0b93a26786
|
/app/src/main/java/com/example/jamil/healthcareapp/Member/MemberInfo.java
|
08a759aa7b5e2d439fe6250e1905f228bc35d334
|
[] |
no_license
|
juelrana/Health-Care-Android-App
|
https://github.com/juelrana/Health-Care-Android-App
|
852dbf16ee4eacf1ce8149f82ed5792ceb74011d
|
2193c728a82fbd1345488c278f4faf1660c33dfc
|
refs/heads/master
| 2020-04-14T11:50:57.952000 | 2019-01-02T12:04:23 | 2019-01-02T12:04:23 | 163,824,425 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.jamil.healthcareapp.Member;
/**
* Created by Jamil on 4/19/2016.
*/
public class MemberInfo {
private int id;
private String name;
private String age;
private String height;
private String weight;
private String bloodGroup;
private String relation;
private String majorDiseases;
public MemberInfo(int id, String name, String age, String height, String weight, String bloodGroup, String relation, String majorDiseases) {
setId(id);
setName(name);
setAge(age);
setHeight(height);
setWeight(weight);
setBloodGroup(bloodGroup);
setRelation(relation);
setMajorDiseases(majorDiseases);
}
public MemberInfo(String name, String age, String height, String weight, String bloodGroup, String relation, String majorDiseases) {
setName(name);
setAge(age);
setHeight(height);
setWeight(weight);
setBloodGroup(bloodGroup);
setRelation(relation);
setMajorDiseases(majorDiseases);
}
public MemberInfo() {
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
public String getHeight() {
return height;
}
public void setHeight(String height) {
this.height = height;
}
public String getWeight() {
return weight;
}
public void setWeight(String weight) {
this.weight = weight;
}
public String getBloodGroup() {
return bloodGroup;
}
public void setBloodGroup(String bloodGroup) {
this.bloodGroup = bloodGroup;
}
public String getRelation() {
return relation;
}
public void setRelation(String relation) {
this.relation = relation;
}
public String getMajorDiseases() {
return majorDiseases;
}
public void setMajorDiseases(String majorDiseases) {
this.majorDiseases = majorDiseases;
}
}
|
UTF-8
|
Java
| 2,249 |
java
|
MemberInfo.java
|
Java
|
[
{
"context": "ple.jamil.healthcareapp.Member;\n\n/**\n * Created by Jamil on 4/19/2016.\n */\npublic class MemberInfo {\n p",
"end": 72,
"score": 0.9995366930961609,
"start": 67,
"tag": "NAME",
"value": "Jamil"
}
] | null |
[] |
package com.example.jamil.healthcareapp.Member;
/**
* Created by Jamil on 4/19/2016.
*/
public class MemberInfo {
private int id;
private String name;
private String age;
private String height;
private String weight;
private String bloodGroup;
private String relation;
private String majorDiseases;
public MemberInfo(int id, String name, String age, String height, String weight, String bloodGroup, String relation, String majorDiseases) {
setId(id);
setName(name);
setAge(age);
setHeight(height);
setWeight(weight);
setBloodGroup(bloodGroup);
setRelation(relation);
setMajorDiseases(majorDiseases);
}
public MemberInfo(String name, String age, String height, String weight, String bloodGroup, String relation, String majorDiseases) {
setName(name);
setAge(age);
setHeight(height);
setWeight(weight);
setBloodGroup(bloodGroup);
setRelation(relation);
setMajorDiseases(majorDiseases);
}
public MemberInfo() {
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
public String getHeight() {
return height;
}
public void setHeight(String height) {
this.height = height;
}
public String getWeight() {
return weight;
}
public void setWeight(String weight) {
this.weight = weight;
}
public String getBloodGroup() {
return bloodGroup;
}
public void setBloodGroup(String bloodGroup) {
this.bloodGroup = bloodGroup;
}
public String getRelation() {
return relation;
}
public void setRelation(String relation) {
this.relation = relation;
}
public String getMajorDiseases() {
return majorDiseases;
}
public void setMajorDiseases(String majorDiseases) {
this.majorDiseases = majorDiseases;
}
}
| 2,249 | 0.614495 | 0.611383 | 104 | 20.625 | 22.430315 | 144 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.509615 | false | false |
5
|
11bb1a530f1b4ffdfa9850adafda4afce5366eea
| 31,619,549,233,727 |
c46304a8d962b6bea66bc6e4ef04b908bdb0dc97
|
/src/main/java8/net/finmath/singleswaprate/model/volatilities/VolVolCube.java
|
38dbbde4efc6069838d93b253b031780f4d7c062
|
[
"Apache-2.0",
"LicenseRef-scancode-mit-old-style",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.0-or-later"
] |
permissive
|
finmath/finmath-lib
|
https://github.com/finmath/finmath-lib
|
93f0f67e7914e76bbdc4e32c6dddce9eba4f50a4
|
b80aba56bdf6b93551d966503d5b399409c36bff
|
refs/heads/master
| 2023-08-04T09:28:21.146000 | 2023-07-26T17:18:45 | 2023-07-26T17:18:45 | 8,832,601 | 459 | 211 |
Apache-2.0
| false | 2023-07-21T13:28:03 | 2013-03-17T10:00:22 | 2023-07-20T23:31:14 | 2023-07-21T13:28:01 | 228,374 | 432 | 162 | 12 |
Java
| false | false |
package net.finmath.singleswaprate.model.volatilities;
import java.time.LocalDate;
import java.util.Map;
import net.finmath.interpolation.RationalFunctionInterpolation;
import net.finmath.interpolation.RationalFunctionInterpolation.ExtrapolationMethod;
import net.finmath.interpolation.RationalFunctionInterpolation.InterpolationMethod;
import net.finmath.marketdata.model.volatilities.VolatilitySurface.QuotingConvention;
import net.finmath.singleswaprate.model.VolatilityCubeModel;
import net.finmath.singleswaprate.model.curves.ExponentialCorrelationCurve;
import net.finmath.time.Schedule;
/**
* This cube provides the volatility of the stochastic driver for each sub-tenor of the swap rate's schedule in the Piterbarg model of the annuity mapping. They are linked to normal volatilities via
* \[ \frac{\tau_j}{1+\tau_j S_j(0)} \rho_{i,j} \sigma_j ]\,
* where \(\tau\) is the accrual fraction, \(S_j(0)\) is the swap rate of the j-th subtenor evaluated at time 0, \(\sigma_j\) the volatility of the j-th subtenor at the strike and \(\rho_{i,j}\) is the
* correlation between the swap rates of the two tenors. We assume a correlation according to
* \[ \rho_{i,j} = e^{d(T_j - T_i)} \],
* where d is some decay parameter, given by the underlying cube.
*
* @author Christian Fries
* @author Roland Bachl
*
*/
public class VolVolCube implements VolatilityCube {
private final String name;
private final LocalDate referenceDate;
private final String referenceCubeName;
private final double baseTermination;
private final double periodLength;
private final RationalFunctionInterpolation rateInterpolator;
// private final double iborOisDecorrelation;
private final QuotingConvention quotingConvention = QuotingConvention.VOLATILITYNORMAL;
/**
* Create the volvol cube.
*
* @param name The name of the cube.
* @param referenceDate The referenceDate of the cube.
* @param referenceCubeName The name of the underlying cube.
* @param schedule The schedule of the swap rate.
* @param initialSwapRates Initial swap rates of all sub-tenors.
*/
public VolVolCube(final String name, final LocalDate referenceDate, final String referenceCubeName, final Schedule schedule, final double[] initialSwapRates) {
super();
this.name = name;
this.referenceDate = referenceDate;
this.referenceCubeName = referenceCubeName;
this.baseTermination = schedule.getPayment(schedule.getNumberOfPeriods()-1);
double periodLength = 0;
for(int index = 0; index < schedule.getNumberOfPeriods(); index++) {
periodLength += schedule.getPeriodLength(index);
}
this.periodLength = periodLength /schedule.getNumberOfPeriods();
final double[] tenors = new double[initialSwapRates.length];
for(int index = 0; index < tenors.length; index++) {
tenors[index] = schedule.getPeriodStart(index);
}
tenors[tenors.length -1] = schedule.getPeriodEnd(schedule.getNumberOfPeriods()-1);
rateInterpolator = new RationalFunctionInterpolation(tenors, initialSwapRates, InterpolationMethod.LINEAR, ExtrapolationMethod.DEFAULT);
}
@Override
public double getValue(final VolatilityCubeModel model, final double termination, final double maturity, final double strike, final QuotingConvention quotingConvention) {
final VolatilityCube cube = model.getVolatilityCube(referenceCubeName);
final ExponentialCorrelationCurve correlation = new ExponentialCorrelationCurve(name, referenceDate, baseTermination, cube.getCorrelationDecay());
double value = cube.getValue(model, termination, maturity, strike, quotingConvention);
value *= correlation.getValue(termination);
value *= periodLength /(1.0 +periodLength *rateInterpolator.getValue(termination));
return value;
}
@Override
public String getName(){
return name;
}
@Override
public LocalDate getReferenceDate() {
return referenceDate;
}
public String getReferenceCubeName() {
return referenceCubeName;
}
@Override
public String toString() {
return super.toString() + "\n\"" + this.getName() + "\"";
}
@Override
public double getValue(final double tenorLength, final double maturity, final double strike, final QuotingConvention quotingConvention) {
return getValue(null, tenorLength, maturity, strike, quotingConvention);
}
@Override
public double getCorrelationDecay() {
throw new UnsupportedOperationException("This VolVolCube does not support a further native correlated cube.");
}
@Override
public Map<String, Object> getParameters() {
//TODO
throw new UnsupportedOperationException("This VolVolCube's field cannot be converted to Map<String, Double>");
}
@Override
public double getLowestStrike(final VolatilityCubeModel model) {
return model.getVolatilityCube(referenceCubeName).getLowestStrike(model);
}
@Override
public double getIborOisDecorrelation() {
throw new UnsupportedOperationException("This VolVolCube does not support use of ibor ois decorrelation.");
}
}
|
UTF-8
|
Java
| 4,926 |
java
|
VolVolCube.java
|
Java
|
[
{
"context": "meter, given by the underlying cube.\n *\n * @author Christian Fries\n * @author Roland Bachl\n *\n */\npublic class VolVo",
"end": 1292,
"score": 0.9998502731323242,
"start": 1277,
"tag": "NAME",
"value": "Christian Fries"
},
{
"context": "ing cube.\n *\n * @author Christian Fries\n * @author Roland Bachl\n *\n */\npublic class VolVolCube implements Volatil",
"end": 1316,
"score": 0.9998385310173035,
"start": 1304,
"tag": "NAME",
"value": "Roland Bachl"
}
] | null |
[] |
package net.finmath.singleswaprate.model.volatilities;
import java.time.LocalDate;
import java.util.Map;
import net.finmath.interpolation.RationalFunctionInterpolation;
import net.finmath.interpolation.RationalFunctionInterpolation.ExtrapolationMethod;
import net.finmath.interpolation.RationalFunctionInterpolation.InterpolationMethod;
import net.finmath.marketdata.model.volatilities.VolatilitySurface.QuotingConvention;
import net.finmath.singleswaprate.model.VolatilityCubeModel;
import net.finmath.singleswaprate.model.curves.ExponentialCorrelationCurve;
import net.finmath.time.Schedule;
/**
* This cube provides the volatility of the stochastic driver for each sub-tenor of the swap rate's schedule in the Piterbarg model of the annuity mapping. They are linked to normal volatilities via
* \[ \frac{\tau_j}{1+\tau_j S_j(0)} \rho_{i,j} \sigma_j ]\,
* where \(\tau\) is the accrual fraction, \(S_j(0)\) is the swap rate of the j-th subtenor evaluated at time 0, \(\sigma_j\) the volatility of the j-th subtenor at the strike and \(\rho_{i,j}\) is the
* correlation between the swap rates of the two tenors. We assume a correlation according to
* \[ \rho_{i,j} = e^{d(T_j - T_i)} \],
* where d is some decay parameter, given by the underlying cube.
*
* @author <NAME>
* @author <NAME>
*
*/
public class VolVolCube implements VolatilityCube {
private final String name;
private final LocalDate referenceDate;
private final String referenceCubeName;
private final double baseTermination;
private final double periodLength;
private final RationalFunctionInterpolation rateInterpolator;
// private final double iborOisDecorrelation;
private final QuotingConvention quotingConvention = QuotingConvention.VOLATILITYNORMAL;
/**
* Create the volvol cube.
*
* @param name The name of the cube.
* @param referenceDate The referenceDate of the cube.
* @param referenceCubeName The name of the underlying cube.
* @param schedule The schedule of the swap rate.
* @param initialSwapRates Initial swap rates of all sub-tenors.
*/
public VolVolCube(final String name, final LocalDate referenceDate, final String referenceCubeName, final Schedule schedule, final double[] initialSwapRates) {
super();
this.name = name;
this.referenceDate = referenceDate;
this.referenceCubeName = referenceCubeName;
this.baseTermination = schedule.getPayment(schedule.getNumberOfPeriods()-1);
double periodLength = 0;
for(int index = 0; index < schedule.getNumberOfPeriods(); index++) {
periodLength += schedule.getPeriodLength(index);
}
this.periodLength = periodLength /schedule.getNumberOfPeriods();
final double[] tenors = new double[initialSwapRates.length];
for(int index = 0; index < tenors.length; index++) {
tenors[index] = schedule.getPeriodStart(index);
}
tenors[tenors.length -1] = schedule.getPeriodEnd(schedule.getNumberOfPeriods()-1);
rateInterpolator = new RationalFunctionInterpolation(tenors, initialSwapRates, InterpolationMethod.LINEAR, ExtrapolationMethod.DEFAULT);
}
@Override
public double getValue(final VolatilityCubeModel model, final double termination, final double maturity, final double strike, final QuotingConvention quotingConvention) {
final VolatilityCube cube = model.getVolatilityCube(referenceCubeName);
final ExponentialCorrelationCurve correlation = new ExponentialCorrelationCurve(name, referenceDate, baseTermination, cube.getCorrelationDecay());
double value = cube.getValue(model, termination, maturity, strike, quotingConvention);
value *= correlation.getValue(termination);
value *= periodLength /(1.0 +periodLength *rateInterpolator.getValue(termination));
return value;
}
@Override
public String getName(){
return name;
}
@Override
public LocalDate getReferenceDate() {
return referenceDate;
}
public String getReferenceCubeName() {
return referenceCubeName;
}
@Override
public String toString() {
return super.toString() + "\n\"" + this.getName() + "\"";
}
@Override
public double getValue(final double tenorLength, final double maturity, final double strike, final QuotingConvention quotingConvention) {
return getValue(null, tenorLength, maturity, strike, quotingConvention);
}
@Override
public double getCorrelationDecay() {
throw new UnsupportedOperationException("This VolVolCube does not support a further native correlated cube.");
}
@Override
public Map<String, Object> getParameters() {
//TODO
throw new UnsupportedOperationException("This VolVolCube's field cannot be converted to Map<String, Double>");
}
@Override
public double getLowestStrike(final VolatilityCubeModel model) {
return model.getVolatilityCube(referenceCubeName).getLowestStrike(model);
}
@Override
public double getIborOisDecorrelation() {
throw new UnsupportedOperationException("This VolVolCube does not support use of ibor ois decorrelation.");
}
}
| 4,911 | 0.77568 | 0.773244 | 130 | 36.892307 | 43.299892 | 201 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.553846 | false | false |
5
|
31fd69adb5dcad615bbf99c068f19c36b89f4916
| 962,072,733,258 |
81354ff27f825ec629af170e4ebabfa54476bbcc
|
/src/main/java/com/devadas/poc/algo/BST.java
|
f77a013bc305fa8d5ac80d176cce997497ff7924
|
[] |
no_license
|
devadastv/TestApplications
|
https://github.com/devadastv/TestApplications
|
c3082d5b4382e24ebd5d3f1fb77674c63547508e
|
75a97a814d8d0a214c31f95d1abc2d4cf5ca5e6b
|
refs/heads/master
| 2022-11-19T23:34:56.481000 | 2020-07-19T20:15:51 | 2020-07-19T20:20:20 | 280,941,308 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.devadas.poc.algo;
import java.util.NoSuchElementException;
/**
* https://algs4.cs.princeton.edu/32bst/BST.java.html
*
*/
public class BST<K extends Comparable<K>, V> {
class Node {
private K k;
private V v;
private Node right;
private Node left;
public Node(K k, V v) {
this.v = v;
}
}
private Node root;
public void put(K k, V v) {
if (k == null) throw new IllegalArgumentException("Key cannot be null");
root = put(root, k, v);
}
private Node put(Node node, K k, V v) {
if (node == null) return new Node(k, v);
int cmp = node.k.compareTo(k);
if (cmp < 1) node.left = put(node.left, k, v);
else if (cmp > 1) node.right = put(node.right, k, v);
else node.v = v;
return node;
}
public V get(K k) {
return get(root, k);
}
private V get(Node node, K k) {
if (node == null) throw new IllegalArgumentException("Key cannot be null");
int cmp = node.k.compareTo(k);
if (cmp > 0) return get(node.right, k);
else if (cmp < 0) return get(node.left, k);
else return node.v;
}
public K max() {
if (root == null) throw new NoSuchElementException("Tree is empty");
return max(root).k;
}
private Node max(Node node) {
if (node.right == null) return node;
else return max(node.right);
}
public K min() {
if (root == null) throw new NoSuchElementException("Tree is empty");
return min(root).k;
}
private Node min(Node node) {
if (node.left == null) return node;
else return min(node.left);
}
public void deleteMin() {
if (root == null) throw new NoSuchElementException("Tree is empty");
root = deleteMin(root);
}
private Node deleteMin(Node node) {
if (node.left == null) return node.right;
if (node.left != null) node.left = deleteMin(node.left);
return node;
}
public void delete(K k) {
if (k == null) throw new IllegalArgumentException("Key cannot be null");
root = delete(root, k);
}
private Node delete(Node node, K k) {
if (node == null) throw new NoSuchElementException("Tree is empty");
int cmp = node.k.compareTo(k);
if (cmp > 1) node.left = delete(node.left, k);
else if (cmp < 1) node.right = delete(node.right, k);
else {
if (node.right == null) return node.left;
if (node.left == null) return node.right;
Node min = min(node.right);
deleteMin(node.right);
return min;
}
return node;
}
public int size() {
return size(root);
}
private int size(Node node) {
if (node == null) return 0;
return 1 + size(node.left) + size(node.right);
}
// number of keys existing in tree below this given key (need not exist in tree)
public int rank(K k) {
return rank(root, k);
}
private int rank(Node node, K k) {
if (node == null) return 0;
int cmp = node.k.compareTo(k);
if (cmp < 0) return rank(node.left, k);
else if (cmp > 0) return 1 + size(node.left) + rank(node.right ,k);
else return size(node.left);
}
public static void main(String[] args) {
}
}
|
UTF-8
|
Java
| 2,948 |
java
|
BST.java
|
Java
|
[] | null |
[] |
package com.devadas.poc.algo;
import java.util.NoSuchElementException;
/**
* https://algs4.cs.princeton.edu/32bst/BST.java.html
*
*/
public class BST<K extends Comparable<K>, V> {
class Node {
private K k;
private V v;
private Node right;
private Node left;
public Node(K k, V v) {
this.v = v;
}
}
private Node root;
public void put(K k, V v) {
if (k == null) throw new IllegalArgumentException("Key cannot be null");
root = put(root, k, v);
}
private Node put(Node node, K k, V v) {
if (node == null) return new Node(k, v);
int cmp = node.k.compareTo(k);
if (cmp < 1) node.left = put(node.left, k, v);
else if (cmp > 1) node.right = put(node.right, k, v);
else node.v = v;
return node;
}
public V get(K k) {
return get(root, k);
}
private V get(Node node, K k) {
if (node == null) throw new IllegalArgumentException("Key cannot be null");
int cmp = node.k.compareTo(k);
if (cmp > 0) return get(node.right, k);
else if (cmp < 0) return get(node.left, k);
else return node.v;
}
public K max() {
if (root == null) throw new NoSuchElementException("Tree is empty");
return max(root).k;
}
private Node max(Node node) {
if (node.right == null) return node;
else return max(node.right);
}
public K min() {
if (root == null) throw new NoSuchElementException("Tree is empty");
return min(root).k;
}
private Node min(Node node) {
if (node.left == null) return node;
else return min(node.left);
}
public void deleteMin() {
if (root == null) throw new NoSuchElementException("Tree is empty");
root = deleteMin(root);
}
private Node deleteMin(Node node) {
if (node.left == null) return node.right;
if (node.left != null) node.left = deleteMin(node.left);
return node;
}
public void delete(K k) {
if (k == null) throw new IllegalArgumentException("Key cannot be null");
root = delete(root, k);
}
private Node delete(Node node, K k) {
if (node == null) throw new NoSuchElementException("Tree is empty");
int cmp = node.k.compareTo(k);
if (cmp > 1) node.left = delete(node.left, k);
else if (cmp < 1) node.right = delete(node.right, k);
else {
if (node.right == null) return node.left;
if (node.left == null) return node.right;
Node min = min(node.right);
deleteMin(node.right);
return min;
}
return node;
}
public int size() {
return size(root);
}
private int size(Node node) {
if (node == null) return 0;
return 1 + size(node.left) + size(node.right);
}
// number of keys existing in tree below this given key (need not exist in tree)
public int rank(K k) {
return rank(root, k);
}
private int rank(Node node, K k) {
if (node == null) return 0;
int cmp = node.k.compareTo(k);
if (cmp < 0) return rank(node.left, k);
else if (cmp > 0) return 1 + size(node.left) + rank(node.right ,k);
else return size(node.left);
}
public static void main(String[] args) {
}
}
| 2,948 | 0.635685 | 0.630597 | 128 | 22.03125 | 21.410036 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.953125 | false | false |
5
|
745f7263e623172d7fe23fb2a48542252cf57d4b
| 4,879,082,860,224 |
fca96c217bfe7020f1b2ce85b81fa578476ee78e
|
/ifs-data-layer/ifs-data-service/src/main/java/org/innovateuk/ifs/application/controller/ApplicationCountSummaryController.java
|
eaae73a2e063565b7af1d8e6ce9cf220aa6f741c
|
[
"MIT"
] |
permissive
|
NunoAlexandre/innovation-funding-service
|
https://github.com/NunoAlexandre/innovation-funding-service
|
63171de2778b38aa52eb4edc3ae3574a01ff950d
|
d55dc49ea3b101598453e319ffda8896fff78aef
|
refs/heads/development
| 2021-07-09T10:10:05.683000 | 2017-10-06T15:04:48 | 2017-10-06T15:04:48 | 106,114,984 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.innovateuk.ifs.application.controller;
import org.innovateuk.ifs.application.resource.ApplicationCountSummaryPageResource;
import org.innovateuk.ifs.application.transactional.ApplicationCountSummaryService;
import org.innovateuk.ifs.commons.rest.RestResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Optional;
/**
* Controller for exposing statistical data on applications
*/
@RestController
@RequestMapping("/applicationCountSummary")
public class ApplicationCountSummaryController {
@Autowired
private ApplicationCountSummaryService applicationCountSummaryService;
private static final String DEFAULT_PAGE_SIZE = "20";
@GetMapping("/findByCompetitionId/{competitionId}")
public RestResult<ApplicationCountSummaryPageResource> getApplicationCountSummariesByCompetitionId(@PathVariable("competitionId") Long competitionId,
@RequestParam(value = "page",defaultValue = "0") int pageIndex,
@RequestParam(value = "size", defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
@RequestParam(value = "filter", required = false) Optional<String> filter) {
return applicationCountSummaryService.getApplicationCountSummariesByCompetitionId(competitionId, pageIndex, pageSize, filter).toGetResponse();
}
@GetMapping("/findByCompetitionIdAndInnovationArea/{competitionId}")
public RestResult<ApplicationCountSummaryPageResource> getApplicationCountSummariesByCompetitionIdAndInnovationArea(@PathVariable("competitionId") long competitionId,
@RequestParam(value = "assessorId") long assessorId,
@RequestParam(value = "page",defaultValue = "0") int pageIndex,
@RequestParam(value = "size", defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
@RequestParam(value = "sortField") String sortField,
@RequestParam(value = "filter") String filter,
@RequestParam(value = "innovationArea", required = false) Optional<Long> innovationArea) {
return applicationCountSummaryService.getApplicationCountSummariesByCompetitionIdAndInnovationArea(competitionId, assessorId, pageIndex, pageSize, innovationArea, filter, sortField).toGetResponse();
}
}
|
UTF-8
|
Java
| 3,202 |
java
|
ApplicationCountSummaryController.java
|
Java
|
[] | null |
[] |
package org.innovateuk.ifs.application.controller;
import org.innovateuk.ifs.application.resource.ApplicationCountSummaryPageResource;
import org.innovateuk.ifs.application.transactional.ApplicationCountSummaryService;
import org.innovateuk.ifs.commons.rest.RestResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Optional;
/**
* Controller for exposing statistical data on applications
*/
@RestController
@RequestMapping("/applicationCountSummary")
public class ApplicationCountSummaryController {
@Autowired
private ApplicationCountSummaryService applicationCountSummaryService;
private static final String DEFAULT_PAGE_SIZE = "20";
@GetMapping("/findByCompetitionId/{competitionId}")
public RestResult<ApplicationCountSummaryPageResource> getApplicationCountSummariesByCompetitionId(@PathVariable("competitionId") Long competitionId,
@RequestParam(value = "page",defaultValue = "0") int pageIndex,
@RequestParam(value = "size", defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
@RequestParam(value = "filter", required = false) Optional<String> filter) {
return applicationCountSummaryService.getApplicationCountSummariesByCompetitionId(competitionId, pageIndex, pageSize, filter).toGetResponse();
}
@GetMapping("/findByCompetitionIdAndInnovationArea/{competitionId}")
public RestResult<ApplicationCountSummaryPageResource> getApplicationCountSummariesByCompetitionIdAndInnovationArea(@PathVariable("competitionId") long competitionId,
@RequestParam(value = "assessorId") long assessorId,
@RequestParam(value = "page",defaultValue = "0") int pageIndex,
@RequestParam(value = "size", defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
@RequestParam(value = "sortField") String sortField,
@RequestParam(value = "filter") String filter,
@RequestParam(value = "innovationArea", required = false) Optional<Long> innovationArea) {
return applicationCountSummaryService.getApplicationCountSummariesByCompetitionIdAndInnovationArea(competitionId, assessorId, pageIndex, pageSize, innovationArea, filter, sortField).toGetResponse();
}
}
| 3,202 | 0.552155 | 0.550906 | 41 | 77.097565 | 73.154633 | 210 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.853659 | false | false |
5
|
bd98aadc81883fe5f6293a12282b19f21ec65671
| 26,164,940,767,777 |
b8053e3dfb1b468bec424deefbb4dfc736123588
|
/yydatetimepicker/src/main/java/tyy/com/yydatetimepicker/TYYYearMonthPickerDialog.java
|
4ee01b3ea63d5103ddcbdfc355440f53bdeda3a1
|
[] |
no_license
|
ShuaiTod/DateTimePicker
|
https://github.com/ShuaiTod/DateTimePicker
|
973d6469bdec50968a02127bc7b703c2d41f8f65
|
d327b989dbb07d87c90b549599b891178b212943
|
refs/heads/master
| 2021-01-24T08:47:36.209000 | 2018-05-06T13:38:55 | 2018-05-06T13:38:55 | 122,993,813 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package tyy.com.yydatetimepicker;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StyleRes;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.MonthDisplayHelper;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.DatePicker;
import android.widget.TextView;
import org.w3c.dom.Text;
import java.util.Calendar;
import tyy.com.yydatetimepicker.adapter.TYYMonthAdapter;
import tyy.com.yydatetimepicker.adapter.TYYYearPickerAdapter;
/**
* Created by shuaitao on 2018/4/5.
*/
public class TYYYearMonthPickerDialog extends AlertDialog implements DialogInterface.OnClickListener{
private OnYearMonthSetListener mYearMonthSetListener;
private RecyclerView mYearPikcerView;
private RecyclerView mMonthPickerView;
private TYYMonthAdapter mMonthAdapter;
private TYYYearPickerAdapter mYearAdapter;
private int mYear;
private int mMonth;
private TextView mMonthTitleView;
private TextView mYearTitleView;
/**
* Creates a new YearMonth picker dialog for the current date using the parent
* context's default date picker dialog theme.
*
* @param context the parent context
*/
public TYYYearMonthPickerDialog(@NonNull Context context){
this(context, 0,null,-1, -1);
}
/**
* Creates a new YearMonth picker dialog for the current date.
*
* @param context the parent context
* @param themeResId the resource ID of the theme against which to inflate
* this dialog, or {@code 0} to use the parent
* {@code context}'s default alert dialog theme
*/
public TYYYearMonthPickerDialog(@NonNull Context context, @StyleRes int themeResId) {
this(context, themeResId,null,-1, -1);
}
/**
* Creates a new date picker dialog for the specified date using the parent
* context's default date picker dialog theme.
*
* @param context the parent context
* @param listener the listener to call when the user sets the date
* @param year the initially selected year
* @param month the initially selected month (0-11 for compatibility with
* {@link Calendar#MONTH})
*/
public TYYYearMonthPickerDialog(@NonNull Context context, @Nullable OnYearMonthSetListener listener, int year, int month){
this(context, 0, listener,year,month);
}
/**
* Creates a new date picker dialog for the specified date using the parent
* context's default date picker dialog theme.
*
* @param context the parent context
* @param listener the listener to call when the user sets the date
* @param year the initially selected year
* @param month the initially selected month (0-11 for compatibility with
* {@link Calendar#MONTH})
*/
public TYYYearMonthPickerDialog(@NonNull Context context, @StyleRes int themeResId,
@Nullable OnYearMonthSetListener listener, int year, int month){
this(context, themeResId, listener, null, year, month);
}
private TYYYearMonthPickerDialog(@NonNull Context context, @StyleRes int themeResId,
@Nullable OnYearMonthSetListener listener, @Nullable Calendar calendar, int year, int monthOfYear){
super(context, resolveDialogTheme(context, themeResId));
mYearMonthSetListener = listener;
mYear = year;
mMonth = monthOfYear;
final Context themeContext = getContext();
final LayoutInflater inflater = LayoutInflater.from(themeContext);
final View view = inflater.inflate(R.layout.tyy_date_picker_dialog, null);
setView(view);
mMonthPickerView = view.findViewById(R.id.tyy_month_picker_view);
mYearPikcerView = view.findViewById(R.id.tyy_year_picker_view);
mMonthTitleView = view.findViewById(R.id.tyy_date_picker_header_month);
mMonthTitleView.setOnClickListener(mOnTitleViewClickedListener);
mYearTitleView = view.findViewById(R.id.tyy_date_picker_header_year);
mYearTitleView.setOnClickListener(mOnTitleViewClickedListener);
initYearAndMonth();
mMonthPickerView.setLayoutManager(new GridLayoutManager(context, 3));
mMonthAdapter = new TYYMonthAdapter(context);
mMonthPickerView.setAdapter(mMonthAdapter);
mMonthAdapter.setSelectedMonth(mMonth);
mYearPikcerView.setLayoutManager(new LinearLayoutManager(context));
mYearAdapter = new TYYYearPickerAdapter();
mYearPikcerView.setAdapter(mYearAdapter);
mYearAdapter.setSelectedYear(mYear);
mYearPikcerView.scrollToPosition(mYearAdapter.getSelectedPosition());
setButton(BUTTON_POSITIVE, themeContext.getString(R.string.tyy_ok), this);
setButton(BUTTON_NEGATIVE, themeContext.getString(R.string.tyy_cancel), this);
mMonthAdapter.setMonthSetListener(new TYYMonthAdapter.TYYOnMonthSetListener() {
@Override
public void onMonthSet(int month, String title) {
mMonth = month;
if (mMonthTitleView != null){
mMonthTitleView.setText(title);
}
}
});
mYearAdapter.setOnYearSetListener(new TYYYearPickerAdapter.TYYOnYearSetListener() {
@Override
public void onYearSet(int selectedYear) {
mYear = selectedYear;
if (mYearTitleView != null)
mYearTitleView.setText(Integer.toString(mYear));
}
});
String[] monthList = context.getResources().getStringArray(R.array.tyy_month_set);
if (monthList != null){
mMonthTitleView.setText(monthList[mMonth % monthList.length]);
}
mYearTitleView.setText(Integer.toString(mYear));
mMonthTitleView.performClick();
}
static @StyleRes int resolveDialogTheme(@NonNull Context context, @StyleRes int themeResId) {
if (themeResId == 0) {
final TypedValue outValue = new TypedValue();
context.getTheme().resolveAttribute(R.attr.datePickerDialogTheme, outValue, true);
return outValue.resourceId;
} else {
return themeResId;
}
}
@Override
public void onClick(DialogInterface dialog, int which) {
if (BUTTON_POSITIVE == which){
if (mYearMonthSetListener != null)
mYearMonthSetListener.onYearMonthSet(this, mYear, mMonth);
}
}
/**
* The listener used to indicate the user has finished selecting a date.
*/
public interface OnYearMonthSetListener {
/**
* @param dialog the dialog associated
* @param year the selected year
* @param month the selected month (0-11 for compatibility with
* {@link Calendar#MONTH})
*/
void onYearMonthSet(TYYYearMonthPickerDialog dialog, int year, int month);
}
private void initYearAndMonth(){
Calendar calendar = Calendar.getInstance();
if (mMonth == -1)
mMonth = calendar.get(Calendar.MONTH);
if (mYear == -1)
mYear = calendar.get(Calendar.YEAR);
}
private View.OnClickListener mOnTitleViewClickedListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
if (v.getId() == R.id.tyy_date_picker_header_month){
mMonthTitleView.setSelected(true);
mYearTitleView.setSelected(false);
mMonthPickerView.setVisibility(View.VISIBLE);
mYearPikcerView.setVisibility(View.GONE);
}else if (v.getId() == R.id.tyy_date_picker_header_year){
mMonthTitleView.setSelected(false);
mYearTitleView.setSelected(true);
mMonthPickerView.setVisibility(View.GONE);
mYearPikcerView.setVisibility(View.VISIBLE);
}
}
};
}
|
UTF-8
|
Java
| 8,333 |
java
|
TYYYearMonthPickerDialog.java
|
Java
|
[
{
"context": "r.adapter.TYYYearPickerAdapter;\n\n/**\n * Created by shuaitao on 2018/4/5.\n */\n\npublic class TYYYearMonthPicker",
"end": 824,
"score": 0.9993609189987183,
"start": 816,
"tag": "USERNAME",
"value": "shuaitao"
}
] | null |
[] |
package tyy.com.yydatetimepicker;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StyleRes;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.MonthDisplayHelper;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.DatePicker;
import android.widget.TextView;
import org.w3c.dom.Text;
import java.util.Calendar;
import tyy.com.yydatetimepicker.adapter.TYYMonthAdapter;
import tyy.com.yydatetimepicker.adapter.TYYYearPickerAdapter;
/**
* Created by shuaitao on 2018/4/5.
*/
public class TYYYearMonthPickerDialog extends AlertDialog implements DialogInterface.OnClickListener{
private OnYearMonthSetListener mYearMonthSetListener;
private RecyclerView mYearPikcerView;
private RecyclerView mMonthPickerView;
private TYYMonthAdapter mMonthAdapter;
private TYYYearPickerAdapter mYearAdapter;
private int mYear;
private int mMonth;
private TextView mMonthTitleView;
private TextView mYearTitleView;
/**
* Creates a new YearMonth picker dialog for the current date using the parent
* context's default date picker dialog theme.
*
* @param context the parent context
*/
public TYYYearMonthPickerDialog(@NonNull Context context){
this(context, 0,null,-1, -1);
}
/**
* Creates a new YearMonth picker dialog for the current date.
*
* @param context the parent context
* @param themeResId the resource ID of the theme against which to inflate
* this dialog, or {@code 0} to use the parent
* {@code context}'s default alert dialog theme
*/
public TYYYearMonthPickerDialog(@NonNull Context context, @StyleRes int themeResId) {
this(context, themeResId,null,-1, -1);
}
/**
* Creates a new date picker dialog for the specified date using the parent
* context's default date picker dialog theme.
*
* @param context the parent context
* @param listener the listener to call when the user sets the date
* @param year the initially selected year
* @param month the initially selected month (0-11 for compatibility with
* {@link Calendar#MONTH})
*/
public TYYYearMonthPickerDialog(@NonNull Context context, @Nullable OnYearMonthSetListener listener, int year, int month){
this(context, 0, listener,year,month);
}
/**
* Creates a new date picker dialog for the specified date using the parent
* context's default date picker dialog theme.
*
* @param context the parent context
* @param listener the listener to call when the user sets the date
* @param year the initially selected year
* @param month the initially selected month (0-11 for compatibility with
* {@link Calendar#MONTH})
*/
public TYYYearMonthPickerDialog(@NonNull Context context, @StyleRes int themeResId,
@Nullable OnYearMonthSetListener listener, int year, int month){
this(context, themeResId, listener, null, year, month);
}
private TYYYearMonthPickerDialog(@NonNull Context context, @StyleRes int themeResId,
@Nullable OnYearMonthSetListener listener, @Nullable Calendar calendar, int year, int monthOfYear){
super(context, resolveDialogTheme(context, themeResId));
mYearMonthSetListener = listener;
mYear = year;
mMonth = monthOfYear;
final Context themeContext = getContext();
final LayoutInflater inflater = LayoutInflater.from(themeContext);
final View view = inflater.inflate(R.layout.tyy_date_picker_dialog, null);
setView(view);
mMonthPickerView = view.findViewById(R.id.tyy_month_picker_view);
mYearPikcerView = view.findViewById(R.id.tyy_year_picker_view);
mMonthTitleView = view.findViewById(R.id.tyy_date_picker_header_month);
mMonthTitleView.setOnClickListener(mOnTitleViewClickedListener);
mYearTitleView = view.findViewById(R.id.tyy_date_picker_header_year);
mYearTitleView.setOnClickListener(mOnTitleViewClickedListener);
initYearAndMonth();
mMonthPickerView.setLayoutManager(new GridLayoutManager(context, 3));
mMonthAdapter = new TYYMonthAdapter(context);
mMonthPickerView.setAdapter(mMonthAdapter);
mMonthAdapter.setSelectedMonth(mMonth);
mYearPikcerView.setLayoutManager(new LinearLayoutManager(context));
mYearAdapter = new TYYYearPickerAdapter();
mYearPikcerView.setAdapter(mYearAdapter);
mYearAdapter.setSelectedYear(mYear);
mYearPikcerView.scrollToPosition(mYearAdapter.getSelectedPosition());
setButton(BUTTON_POSITIVE, themeContext.getString(R.string.tyy_ok), this);
setButton(BUTTON_NEGATIVE, themeContext.getString(R.string.tyy_cancel), this);
mMonthAdapter.setMonthSetListener(new TYYMonthAdapter.TYYOnMonthSetListener() {
@Override
public void onMonthSet(int month, String title) {
mMonth = month;
if (mMonthTitleView != null){
mMonthTitleView.setText(title);
}
}
});
mYearAdapter.setOnYearSetListener(new TYYYearPickerAdapter.TYYOnYearSetListener() {
@Override
public void onYearSet(int selectedYear) {
mYear = selectedYear;
if (mYearTitleView != null)
mYearTitleView.setText(Integer.toString(mYear));
}
});
String[] monthList = context.getResources().getStringArray(R.array.tyy_month_set);
if (monthList != null){
mMonthTitleView.setText(monthList[mMonth % monthList.length]);
}
mYearTitleView.setText(Integer.toString(mYear));
mMonthTitleView.performClick();
}
static @StyleRes int resolveDialogTheme(@NonNull Context context, @StyleRes int themeResId) {
if (themeResId == 0) {
final TypedValue outValue = new TypedValue();
context.getTheme().resolveAttribute(R.attr.datePickerDialogTheme, outValue, true);
return outValue.resourceId;
} else {
return themeResId;
}
}
@Override
public void onClick(DialogInterface dialog, int which) {
if (BUTTON_POSITIVE == which){
if (mYearMonthSetListener != null)
mYearMonthSetListener.onYearMonthSet(this, mYear, mMonth);
}
}
/**
* The listener used to indicate the user has finished selecting a date.
*/
public interface OnYearMonthSetListener {
/**
* @param dialog the dialog associated
* @param year the selected year
* @param month the selected month (0-11 for compatibility with
* {@link Calendar#MONTH})
*/
void onYearMonthSet(TYYYearMonthPickerDialog dialog, int year, int month);
}
private void initYearAndMonth(){
Calendar calendar = Calendar.getInstance();
if (mMonth == -1)
mMonth = calendar.get(Calendar.MONTH);
if (mYear == -1)
mYear = calendar.get(Calendar.YEAR);
}
private View.OnClickListener mOnTitleViewClickedListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
if (v.getId() == R.id.tyy_date_picker_header_month){
mMonthTitleView.setSelected(true);
mYearTitleView.setSelected(false);
mMonthPickerView.setVisibility(View.VISIBLE);
mYearPikcerView.setVisibility(View.GONE);
}else if (v.getId() == R.id.tyy_date_picker_header_year){
mMonthTitleView.setSelected(false);
mYearTitleView.setSelected(true);
mMonthPickerView.setVisibility(View.GONE);
mYearPikcerView.setVisibility(View.VISIBLE);
}
}
};
}
| 8,333 | 0.667827 | 0.664227 | 213 | 38.122066 | 29.721621 | 136 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.633803 | false | false |
5
|
a5ba5f9e8f50a27a24c18f2789700b482816f197
| 31,018,253,880,436 |
8ceae124b0b6c033784562c7d35773f337167a06
|
/hrm-commons/src/main/java/com/sgic/hrm/commons/dto/AcceptLeaveRequestData.java
|
0f78b309c5cbff5438a818468cebae3bd5634530
|
[] |
no_license
|
Inthuja/Hrm_System
|
https://github.com/Inthuja/Hrm_System
|
8d98c60cc342f430b69e40ee1652c817476fdc77
|
0914bdac1b1b8ef6ac9636b6dc8be70cf763caf7
|
refs/heads/master
| 2020-04-15T20:39:44.628000 | 2019-01-10T06:31:52 | 2019-01-10T06:31:52 | 165,003,413 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.sgic.hrm.commons.dto;
import com.sgic.hrm.commons.enums.Status;
public class AcceptLeaveRequestData {
private Integer id;
private LeaveRequestData leaveRequest;
private UserData acceptedBy;
private Status status;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public LeaveRequestData getLeaveRequest() {
return leaveRequest;
}
public void setLeaveRequest(LeaveRequestData leaveRequest) {
this.leaveRequest = leaveRequest;
}
public UserData getAcceptedBy() {
return acceptedBy;
}
public void setAcceptedBy(UserData acceptedBy) {
this.acceptedBy = acceptedBy;
}
public Status getStatus() {
return status;
}
public void setStatus(Status status) {
this.status = status;
}
}
|
UTF-8
|
Java
| 805 |
java
|
AcceptLeaveRequestData.java
|
Java
|
[] | null |
[] |
package com.sgic.hrm.commons.dto;
import com.sgic.hrm.commons.enums.Status;
public class AcceptLeaveRequestData {
private Integer id;
private LeaveRequestData leaveRequest;
private UserData acceptedBy;
private Status status;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public LeaveRequestData getLeaveRequest() {
return leaveRequest;
}
public void setLeaveRequest(LeaveRequestData leaveRequest) {
this.leaveRequest = leaveRequest;
}
public UserData getAcceptedBy() {
return acceptedBy;
}
public void setAcceptedBy(UserData acceptedBy) {
this.acceptedBy = acceptedBy;
}
public Status getStatus() {
return status;
}
public void setStatus(Status status) {
this.status = status;
}
}
| 805 | 0.709317 | 0.709317 | 44 | 17.295454 | 17.39851 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.318182 | false | false |
5
|
7e1d3c1c94717400f1ce604f83e9af1a6bd54500
| 31,018,253,879,717 |
a16367942109fa2218beda2b2d409a19f8926a57
|
/Project3/src/edu/ncsu/csc216/todolist/ui/TaskEditPane.java
|
31c287fa5a23534db75a20b22820006883275e6d
|
[] |
no_license
|
ahvar/to-do-list
|
https://github.com/ahvar/to-do-list
|
9bd47a986f4cca9e9e2669665fe09d8501830263
|
d28eb067a748199b1a424dd4db6ec05b69c03938
|
refs/heads/master
| 2017-12-19T20:05:38.798000 | 2017-01-12T19:40:52 | 2017-01-12T19:40:52 | 76,752,096 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package edu.ncsu.csc216.todolist.ui;
import java.awt.Color;
import java.awt.FlowLayout;
import java.util.Date;
import java.util.EventListener;
import java.util.Observable;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.SpinnerDateModel;
import javax.swing.SwingConstants;
import javax.swing.event.DocumentListener;
import edu.ncsu.csc216.todolist.model.Category;
import edu.ncsu.csc216.todolist.model.CategoryList;
/**
* The TaskEditPane GUI provides an interface for manipulating tasks. Manipulation of tasks means adding new tasks, deleting tasks,
* and editing tasks fields of existing tasks which are displayed in the gui and available for selection.
* @author Ben W Ioppolo
* @author Arthur Vargas
*/
public class TaskEditPane extends JPanel {
/** Serial Version UID */
private static final long serialVersionUID = 5479139338455751629L;
/** A list of current categories */
private CategoryList categories;
/** A text field for the taskID */
private JTextField taskID;
/** A text field for the title */
private JTextField taskTitle;
/** The different task categories */
private JComboBox<Category> taskCat;
/** Task detail */
private JTextArea taskDetails;
/** Start date display */
private JSpinner taskStart;
/** Due date display */
private JSpinner taskDue;
/** Completed date display */
private JSpinner taskCompleted;
/** Mark Task complete or leave incomplete */
private JCheckBox complete;
/** True if a new Task is being created, false otherwise */
private boolean add;
/** True if a current Task is being edited, false otherwise */
private boolean edit;
/** The dates, title, taskID, and details for this Task */
private TaskData data;
/**
* Creates a new pane with the passed list of categories associated with it.
* @param categories A list of task categories to use for assignment to new tasks via the taskCat ComboBox
*/
public TaskEditPane(CategoryList categories){
this(new TaskData(), categories);
}
/**
* This creates a new pane with the passed list of categories associated with it. It also creates a new task using the passed
* data for the task.
* @param data Information for all of the attributes of an individual task.
* @param categories A list of task categories to use for assignment to new tasks via the taskCat ComboBox
*/
public TaskEditPane(TaskData data, CategoryList categories){
super();
this.data = data;
this.categories = categories;
add = false;
edit = false;
init();
}
/* Initialize the gui */
private void init(){
setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
setBorder(BorderFactory.createLineBorder(Color.black));
// this should be implemented elsewhere
taskCat = new JComboBox<Category>();
// getTaskStartSpinner();
// getTaskDueSpinner();
// getTaskCompletedSpinner();
// //getTaskStart();
// //getTaskDue();
// //getTaskCompleted();
// getTaskID();
// getTaskTitle();
// //getCategory();
// getComplete();
//fillFields();
initView();
}
/* initializes the view */
private void initView(){
JPanel p = new JPanel(new FlowLayout(FlowLayout.LEADING));
p.add(new JLabel("Task ID: ", SwingConstants.LEFT));
p.add(getTaskID());
this.add(p);
p = new JPanel(new FlowLayout(FlowLayout.LEADING));
p.add(new JLabel("Task Title: ", SwingConstants.LEFT));
p.add(getTaskTitle());
this.add(p);
p = new JPanel(new FlowLayout(FlowLayout.LEADING));
p.add(new JLabel("Category: "));
//p.add(new JComboBox<Category>());
p.add(getCategory());
this.add(p);
p = new JPanel(new FlowLayout(FlowLayout.LEADING));
p.add(new JLabel("Start Date & Time: ", SwingConstants.LEFT));
p.add(getTaskStartSpinner());
this.add(p);
p = new JPanel(new FlowLayout(FlowLayout.LEADING));
p.add(new JLabel("Due Date & Time: ", SwingConstants.LEFT));
p.add(getTaskDueSpinner());
this.add(p);
p = new JPanel(new FlowLayout(FlowLayout.LEADING));
p.add(new JLabel("Completed Date & Time: ", SwingConstants.LEFT));
p.add(getTaskCompletedSpinner());
this.add(p);
p = new JPanel(new FlowLayout(FlowLayout.LEADING));
p.add(new JLabel("Completed? "));
p.add(getComplete());
this.add(p);
p = new JPanel(new FlowLayout(FlowLayout.LEADING));
p.add(new JLabel("Task Details: "));
p.add(getTaskDetails());
this.add(p);
}
/**
* Returns the TaskStartSpinner which contains the date for when the task starts.
* @return taskStart JSpinner containing the task start date.
*/
JSpinner getTaskStartSpinner(){
if(taskStart == null) {
SpinnerDateModel sdm = new SpinnerDateModel();
taskStart = new JSpinner(sdm);
JSpinner.DateEditor editor = new JSpinner.DateEditor(taskStart, "EEE MMM d, yyyy HH:mm");
taskStart.setEditor(editor);
setVisible(true);
}
return taskStart;
}
/**
* Returns the TaskDueSpinner which contains the date for when the task is due.
* @return taskDue JSpinner containing the task due date.
*/
JSpinner getTaskDueSpinner(){
if(taskDue == null) {
SpinnerDateModel sdm = new SpinnerDateModel();
taskDue = new JSpinner(sdm);
JSpinner.DateEditor editor = new JSpinner.DateEditor(taskDue, "EEE MMM d, yyyy HH:mm");
taskDue.setEditor(editor);
setVisible(true);
}
return taskDue;
}
/**
* Returns the TaskCompletedSpinner which contains the date for when the task is completed.
* @return taskCompleted JSpinner containing the task completed date.
*/
JSpinner getTaskCompletedSpinner(){
if(taskCompleted == null) {
// Calendar c = Calendar.getInstance();
// Date completeDate = c.getTime();
SpinnerDateModel sdm = new SpinnerDateModel();
taskCompleted = new JSpinner(sdm);
//taskCompleted = new JSpinner(); //duplicate of above just without sdm
JSpinner.DateEditor editor = new JSpinner.DateEditor(taskCompleted, "EEE MMM d, yyyy HH:mm");
taskCompleted.setEditor(editor);
setVisible(true);
}
return taskCompleted;
}
/**
* Returns the start date for the specified task.
* @return The start date for the specified task.
*/
Date getTaskStart(){
return data.getStartDateTime();
}
/**
* Returns the due date for the specified task.
* @return The due date for the specified task.
*/
Date getTaskDue(){
return data.getDueDateTime();
}
/**
* Returns the completed date for the specified task.
* @return The completed date for the specified task.
*/
Date getTaskCompleted(){
return data.getCompletedDateTime();
}
/**
* Returns the taskID JTextField which contains the task id.
* @return taskID JTextField containing the task id.
*/
JTextField getTaskID(){
if (null == taskID) {
taskID = new JTextField(50);
taskID.setEditable(false);
taskID.setVisible(true);
taskID.setHorizontalAlignment(SwingConstants.LEFT);
}
return taskID;
}
/**
* Returns the taskTitle JTextField which contains the task title.
* @return taskTitle JTextField containing the task title.
*/
JTextField getTaskTitle(){
if (null == taskTitle) {
taskTitle = new JTextField(50);
taskTitle.setEditable(true);
taskTitle.setVisible(true);
taskTitle.setHorizontalAlignment(SwingConstants.LEFT);
}
return taskTitle;
}
/**
* Returns the taskCat JComboBox which contains the task category.
* @return taskCat JComboBox containing the task category.
*/
JComboBox<Category> getCategory(){
if(categories.size() == 0)
return taskCat;
if (taskCat.getItemCount() != categories.size()){
taskCat.removeAllItems();
for(int i = 0; i < categories.size(); i++){
taskCat.addItem(categories.getCategoryAt(i));
}
}
return taskCat;
}
/**
* Returns the taskDetails JTextArea which contains the task details.
* @return taskDetails JTextArea containing the task details.
*/
JTextArea getTaskDetails(){
if (null == taskDetails) {
taskDetails = new JTextArea(5, 70);
taskDetails.setEditable(true);
taskDetails.setVisible(true);
taskDetails.setLineWrap(true);
taskDetails.setAutoscrolls(true);
}
return taskDetails;
}
/**
* Returns the complete JCheckBox which shows whether the task is complete.
* @return complete JCheckBox containing whether the task is complete.
*/
JCheckBox getComplete(){
if(complete == null) {
complete = new JCheckBox();
}
return complete;
}
/**
* Sets the start date for the task to the passed value.
* @param startDate The date to set as the task start date.
*/
void setTaskStart(Date startDate){
taskStart = getTaskStartSpinner();
taskStart.setValue(startDate);
}
/**
* Sets the due date for the task to the passed value.
* @param dueDate The date to set as the task due date.
*/
void setTaskDue(Date dueDate){
taskDue = getTaskDueSpinner();
taskDue.setValue(dueDate);
}
/**
* Sets the completed date for the task to the passed value.
* @param completedDate The date to set as the task completed date.
*/
void setTaskCompleted(Date completedDate){
taskCompleted = getTaskCompletedSpinner();
taskCompleted.setValue(completedDate);
}
/**
* Checks whether the user wants to add a task.
* @return add A boolean attribute which is false when not adding and true when adding.
*/
boolean isAddMode(){
return add;
}
/**
* Checks whether the user wants to edit a task.
* @return edit A boolean attribute which is false when not editing and true when editing.
*/
boolean isEditMode(){
return edit;
}
/**
* Clears the fields in edit pane by calling clearFields() so
* all TaskData in the edit pane is cleared. Sets the add variable to true.
*/
void enableAdd(){
//clearFields();
add = true;
}
/**
* Returns the current fields in edit pane and changes the add attribute to false.
*/
void disableAdd(){
getFields();
add = false;
}
/**
* Enables editing of the task data associated with a specified task by calling the setTaskData() and passing
* the data parameter to be set to edit pane's data variable. Changes the edit attribute to true?
* @param data the TaskData associated with a specified task
*/
void enableEdit(TaskData data){
setTaskData(data);
this.edit = true;
}
/**
* Disables editing of task data. Changes the edit attribute to false?
*/
void disableEdit(){
// what does edit pane do to disable editing?? clear data fields??
clearFields();
this.edit = false;
}
/**
* Checks if title or category fields are empty or null and returns true if not, false otherwise.
* @return true if any of the fields are not empty and false if all fields are empty.
*/
boolean fieldsNotEmpty(){
return getTaskTitle().getDocument().getLength() != 0 && getCategory().getItemCount() != 0;
}
/**
* Sets the data variable to the data parameter and calls the fillFields method.
* @param data TaskData for a task that will populate fields in the edit pane.
*/
void setTaskData(TaskData data){
if (data == null) {
this.data = new TaskData();
} else {
this.data = data;
}
fillFields();
}
/**
* Adds the given EventListener to the appropriate fields.
* @param eventListener EventListener to add to the fields.
*/
void addFieldListener(EventListener eventListener) {
getTaskID().getDocument().addDocumentListener((DocumentListener) eventListener);
getTaskTitle().getDocument().addDocumentListener((DocumentListener) eventListener);
getTaskDetails().getDocument().addDocumentListener((DocumentListener) eventListener);
}
/**
* Fills the fields with the appropriate text from the TaskData
*/
void fillFields() {
int i = 0;
if (data == null) {
taskID.setText("");
taskTitle.setText("");
//taskStart.setValue(""); //null???
//taskDue.setValue("");
//taskCompleted.setValue("");
taskDetails.setText("");
} else {
taskID.setText(data.getTaskID());
taskTitle.setText(data.getTitle());
taskCat.insertItemAt(data.getCategory(), i);
taskDetails.setText(data.getDetails());
setTaskStart(data.getStartDateTime());
taskStart.setValue(data.getStartDateTime());
taskDue.setValue(data.getDueDateTime());
if(data.getCompletedDateTime() != null) //&& !data.getCompletedDateTime().equals(""))
taskCompleted.setValue(data.getCompletedDateTime());
if(data.isCompleted()) {
complete.setSelected(true);
} else complete.setSelected(false);
}
}
/**
* Clears the fields by setting data to null.
*/
void clearFields() {
data = null;
fillFields();
}
/**
* Returns the fields as a TaskData object.
* @return the fields as a TaskData object
*/
TaskData getFields() {
TaskData taskData = new TaskData(getTaskID().getText(), getTaskTitle().getText(), (Category)getCategory().getSelectedItem(),
(Date)getTaskStartSpinner().getValue(), (Date)getTaskDueSpinner().getValue(), (Date)getTaskCompletedSpinner().getValue(), getComplete().isSelected(), getTaskDetails().getText());
return taskData;
}
/**
* Update the GUI???
* @param obs ???
* @param o ???
*/
public void update(Observable obs, Object o){
//TODO
}
}
|
UTF-8
|
Java
| 13,294 |
java
|
TaskEditPane.java
|
Java
|
[
{
"context": "n the gui and available for selection. \n * @author Ben W Ioppolo\n * @author Arthur Vargas\n */\npublic class TaskEdi",
"end": 927,
"score": 0.9998882412910461,
"start": 914,
"tag": "NAME",
"value": "Ben W Ioppolo"
},
{
"context": "or selection. \n * @author Ben W Ioppolo\n * @author Arthur Vargas\n */\npublic class TaskEditPane extends JPanel {\n\t/",
"end": 952,
"score": 0.9998928904533386,
"start": 939,
"tag": "NAME",
"value": "Arthur Vargas"
}
] | null |
[] |
package edu.ncsu.csc216.todolist.ui;
import java.awt.Color;
import java.awt.FlowLayout;
import java.util.Date;
import java.util.EventListener;
import java.util.Observable;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.SpinnerDateModel;
import javax.swing.SwingConstants;
import javax.swing.event.DocumentListener;
import edu.ncsu.csc216.todolist.model.Category;
import edu.ncsu.csc216.todolist.model.CategoryList;
/**
* The TaskEditPane GUI provides an interface for manipulating tasks. Manipulation of tasks means adding new tasks, deleting tasks,
* and editing tasks fields of existing tasks which are displayed in the gui and available for selection.
* @author <NAME>
* @author <NAME>
*/
public class TaskEditPane extends JPanel {
/** Serial Version UID */
private static final long serialVersionUID = 5479139338455751629L;
/** A list of current categories */
private CategoryList categories;
/** A text field for the taskID */
private JTextField taskID;
/** A text field for the title */
private JTextField taskTitle;
/** The different task categories */
private JComboBox<Category> taskCat;
/** Task detail */
private JTextArea taskDetails;
/** Start date display */
private JSpinner taskStart;
/** Due date display */
private JSpinner taskDue;
/** Completed date display */
private JSpinner taskCompleted;
/** Mark Task complete or leave incomplete */
private JCheckBox complete;
/** True if a new Task is being created, false otherwise */
private boolean add;
/** True if a current Task is being edited, false otherwise */
private boolean edit;
/** The dates, title, taskID, and details for this Task */
private TaskData data;
/**
* Creates a new pane with the passed list of categories associated with it.
* @param categories A list of task categories to use for assignment to new tasks via the taskCat ComboBox
*/
public TaskEditPane(CategoryList categories){
this(new TaskData(), categories);
}
/**
* This creates a new pane with the passed list of categories associated with it. It also creates a new task using the passed
* data for the task.
* @param data Information for all of the attributes of an individual task.
* @param categories A list of task categories to use for assignment to new tasks via the taskCat ComboBox
*/
public TaskEditPane(TaskData data, CategoryList categories){
super();
this.data = data;
this.categories = categories;
add = false;
edit = false;
init();
}
/* Initialize the gui */
private void init(){
setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
setBorder(BorderFactory.createLineBorder(Color.black));
// this should be implemented elsewhere
taskCat = new JComboBox<Category>();
// getTaskStartSpinner();
// getTaskDueSpinner();
// getTaskCompletedSpinner();
// //getTaskStart();
// //getTaskDue();
// //getTaskCompleted();
// getTaskID();
// getTaskTitle();
// //getCategory();
// getComplete();
//fillFields();
initView();
}
/* initializes the view */
private void initView(){
JPanel p = new JPanel(new FlowLayout(FlowLayout.LEADING));
p.add(new JLabel("Task ID: ", SwingConstants.LEFT));
p.add(getTaskID());
this.add(p);
p = new JPanel(new FlowLayout(FlowLayout.LEADING));
p.add(new JLabel("Task Title: ", SwingConstants.LEFT));
p.add(getTaskTitle());
this.add(p);
p = new JPanel(new FlowLayout(FlowLayout.LEADING));
p.add(new JLabel("Category: "));
//p.add(new JComboBox<Category>());
p.add(getCategory());
this.add(p);
p = new JPanel(new FlowLayout(FlowLayout.LEADING));
p.add(new JLabel("Start Date & Time: ", SwingConstants.LEFT));
p.add(getTaskStartSpinner());
this.add(p);
p = new JPanel(new FlowLayout(FlowLayout.LEADING));
p.add(new JLabel("Due Date & Time: ", SwingConstants.LEFT));
p.add(getTaskDueSpinner());
this.add(p);
p = new JPanel(new FlowLayout(FlowLayout.LEADING));
p.add(new JLabel("Completed Date & Time: ", SwingConstants.LEFT));
p.add(getTaskCompletedSpinner());
this.add(p);
p = new JPanel(new FlowLayout(FlowLayout.LEADING));
p.add(new JLabel("Completed? "));
p.add(getComplete());
this.add(p);
p = new JPanel(new FlowLayout(FlowLayout.LEADING));
p.add(new JLabel("Task Details: "));
p.add(getTaskDetails());
this.add(p);
}
/**
* Returns the TaskStartSpinner which contains the date for when the task starts.
* @return taskStart JSpinner containing the task start date.
*/
JSpinner getTaskStartSpinner(){
if(taskStart == null) {
SpinnerDateModel sdm = new SpinnerDateModel();
taskStart = new JSpinner(sdm);
JSpinner.DateEditor editor = new JSpinner.DateEditor(taskStart, "EEE MMM d, yyyy HH:mm");
taskStart.setEditor(editor);
setVisible(true);
}
return taskStart;
}
/**
* Returns the TaskDueSpinner which contains the date for when the task is due.
* @return taskDue JSpinner containing the task due date.
*/
JSpinner getTaskDueSpinner(){
if(taskDue == null) {
SpinnerDateModel sdm = new SpinnerDateModel();
taskDue = new JSpinner(sdm);
JSpinner.DateEditor editor = new JSpinner.DateEditor(taskDue, "EEE MMM d, yyyy HH:mm");
taskDue.setEditor(editor);
setVisible(true);
}
return taskDue;
}
/**
* Returns the TaskCompletedSpinner which contains the date for when the task is completed.
* @return taskCompleted JSpinner containing the task completed date.
*/
JSpinner getTaskCompletedSpinner(){
if(taskCompleted == null) {
// Calendar c = Calendar.getInstance();
// Date completeDate = c.getTime();
SpinnerDateModel sdm = new SpinnerDateModel();
taskCompleted = new JSpinner(sdm);
//taskCompleted = new JSpinner(); //duplicate of above just without sdm
JSpinner.DateEditor editor = new JSpinner.DateEditor(taskCompleted, "EEE MMM d, yyyy HH:mm");
taskCompleted.setEditor(editor);
setVisible(true);
}
return taskCompleted;
}
/**
* Returns the start date for the specified task.
* @return The start date for the specified task.
*/
Date getTaskStart(){
return data.getStartDateTime();
}
/**
* Returns the due date for the specified task.
* @return The due date for the specified task.
*/
Date getTaskDue(){
return data.getDueDateTime();
}
/**
* Returns the completed date for the specified task.
* @return The completed date for the specified task.
*/
Date getTaskCompleted(){
return data.getCompletedDateTime();
}
/**
* Returns the taskID JTextField which contains the task id.
* @return taskID JTextField containing the task id.
*/
JTextField getTaskID(){
if (null == taskID) {
taskID = new JTextField(50);
taskID.setEditable(false);
taskID.setVisible(true);
taskID.setHorizontalAlignment(SwingConstants.LEFT);
}
return taskID;
}
/**
* Returns the taskTitle JTextField which contains the task title.
* @return taskTitle JTextField containing the task title.
*/
JTextField getTaskTitle(){
if (null == taskTitle) {
taskTitle = new JTextField(50);
taskTitle.setEditable(true);
taskTitle.setVisible(true);
taskTitle.setHorizontalAlignment(SwingConstants.LEFT);
}
return taskTitle;
}
/**
* Returns the taskCat JComboBox which contains the task category.
* @return taskCat JComboBox containing the task category.
*/
JComboBox<Category> getCategory(){
if(categories.size() == 0)
return taskCat;
if (taskCat.getItemCount() != categories.size()){
taskCat.removeAllItems();
for(int i = 0; i < categories.size(); i++){
taskCat.addItem(categories.getCategoryAt(i));
}
}
return taskCat;
}
/**
* Returns the taskDetails JTextArea which contains the task details.
* @return taskDetails JTextArea containing the task details.
*/
JTextArea getTaskDetails(){
if (null == taskDetails) {
taskDetails = new JTextArea(5, 70);
taskDetails.setEditable(true);
taskDetails.setVisible(true);
taskDetails.setLineWrap(true);
taskDetails.setAutoscrolls(true);
}
return taskDetails;
}
/**
* Returns the complete JCheckBox which shows whether the task is complete.
* @return complete JCheckBox containing whether the task is complete.
*/
JCheckBox getComplete(){
if(complete == null) {
complete = new JCheckBox();
}
return complete;
}
/**
* Sets the start date for the task to the passed value.
* @param startDate The date to set as the task start date.
*/
void setTaskStart(Date startDate){
taskStart = getTaskStartSpinner();
taskStart.setValue(startDate);
}
/**
* Sets the due date for the task to the passed value.
* @param dueDate The date to set as the task due date.
*/
void setTaskDue(Date dueDate){
taskDue = getTaskDueSpinner();
taskDue.setValue(dueDate);
}
/**
* Sets the completed date for the task to the passed value.
* @param completedDate The date to set as the task completed date.
*/
void setTaskCompleted(Date completedDate){
taskCompleted = getTaskCompletedSpinner();
taskCompleted.setValue(completedDate);
}
/**
* Checks whether the user wants to add a task.
* @return add A boolean attribute which is false when not adding and true when adding.
*/
boolean isAddMode(){
return add;
}
/**
* Checks whether the user wants to edit a task.
* @return edit A boolean attribute which is false when not editing and true when editing.
*/
boolean isEditMode(){
return edit;
}
/**
* Clears the fields in edit pane by calling clearFields() so
* all TaskData in the edit pane is cleared. Sets the add variable to true.
*/
void enableAdd(){
//clearFields();
add = true;
}
/**
* Returns the current fields in edit pane and changes the add attribute to false.
*/
void disableAdd(){
getFields();
add = false;
}
/**
* Enables editing of the task data associated with a specified task by calling the setTaskData() and passing
* the data parameter to be set to edit pane's data variable. Changes the edit attribute to true?
* @param data the TaskData associated with a specified task
*/
void enableEdit(TaskData data){
setTaskData(data);
this.edit = true;
}
/**
* Disables editing of task data. Changes the edit attribute to false?
*/
void disableEdit(){
// what does edit pane do to disable editing?? clear data fields??
clearFields();
this.edit = false;
}
/**
* Checks if title or category fields are empty or null and returns true if not, false otherwise.
* @return true if any of the fields are not empty and false if all fields are empty.
*/
boolean fieldsNotEmpty(){
return getTaskTitle().getDocument().getLength() != 0 && getCategory().getItemCount() != 0;
}
/**
* Sets the data variable to the data parameter and calls the fillFields method.
* @param data TaskData for a task that will populate fields in the edit pane.
*/
void setTaskData(TaskData data){
if (data == null) {
this.data = new TaskData();
} else {
this.data = data;
}
fillFields();
}
/**
* Adds the given EventListener to the appropriate fields.
* @param eventListener EventListener to add to the fields.
*/
void addFieldListener(EventListener eventListener) {
getTaskID().getDocument().addDocumentListener((DocumentListener) eventListener);
getTaskTitle().getDocument().addDocumentListener((DocumentListener) eventListener);
getTaskDetails().getDocument().addDocumentListener((DocumentListener) eventListener);
}
/**
* Fills the fields with the appropriate text from the TaskData
*/
void fillFields() {
int i = 0;
if (data == null) {
taskID.setText("");
taskTitle.setText("");
//taskStart.setValue(""); //null???
//taskDue.setValue("");
//taskCompleted.setValue("");
taskDetails.setText("");
} else {
taskID.setText(data.getTaskID());
taskTitle.setText(data.getTitle());
taskCat.insertItemAt(data.getCategory(), i);
taskDetails.setText(data.getDetails());
setTaskStart(data.getStartDateTime());
taskStart.setValue(data.getStartDateTime());
taskDue.setValue(data.getDueDateTime());
if(data.getCompletedDateTime() != null) //&& !data.getCompletedDateTime().equals(""))
taskCompleted.setValue(data.getCompletedDateTime());
if(data.isCompleted()) {
complete.setSelected(true);
} else complete.setSelected(false);
}
}
/**
* Clears the fields by setting data to null.
*/
void clearFields() {
data = null;
fillFields();
}
/**
* Returns the fields as a TaskData object.
* @return the fields as a TaskData object
*/
TaskData getFields() {
TaskData taskData = new TaskData(getTaskID().getText(), getTaskTitle().getText(), (Category)getCategory().getSelectedItem(),
(Date)getTaskStartSpinner().getValue(), (Date)getTaskDueSpinner().getValue(), (Date)getTaskCompletedSpinner().getValue(), getComplete().isSelected(), getTaskDetails().getText());
return taskData;
}
/**
* Update the GUI???
* @param obs ???
* @param o ???
*/
public void update(Observable obs, Object o){
//TODO
}
}
| 13,280 | 0.701595 | 0.698586 | 465 | 27.589247 | 26.99345 | 182 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.950538 | false | false |
5
|
c152add2bb07482c39abb863031b4a0a8de7e2b4
| 25,391,846,719,218 |
88321452fc49039251ebf259b1a5a6e37635efa2
|
/src/test/java/com/rohith/service/test/NewsServiceTest.java
|
4da4ec43149d41646ad85b921a706dd41300692a
|
[] |
no_license
|
rohithmannem/SpringMVCDemo
|
https://github.com/rohithmannem/SpringMVCDemo
|
8fc3cd86ed7f6c4d8672d936d4589827fc98ccd6
|
de08f6186bb39f457b00cba5cb412eeace6a9ae9
|
refs/heads/master
| 2021-01-23T02:23:01.917000 | 2017-05-31T08:03:39 | 2017-05-31T08:03:39 | 92,918,663 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.rohith.service.test;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.rohith.modal.News;
import com.rohith.service.NewsService;
//@RunWith(SpringJUnit4ClassRunner.class)
//@ContextConfiguration(locations={"classpath:**/WEB-INF/configuration/springDemo-context.xml"})
//@Configurable
public class NewsServiceTest {
//@Autowired
//@Qualifier("newsService")
private NewsService newsService;
//@Test
public void getNewsTest() {
System.out.println("We are in getNewsTest *************");
News news = newsService.getNews();
System.out.println("Sort **********************" + news.getSort());
System.out.println("Sort **********************"+ news.getStatus());
}
//@Test
public void getUsersList() {
System.out.println("We are in getNewsTest *************");
News news = newsService.getNews();
System.out.println("Sort **********************" + news.getSort());
System.out.println("Sort **********************"+ news.getStatus());
}
}
|
UTF-8
|
Java
| 1,348 |
java
|
NewsServiceTest.java
|
Java
|
[] | null |
[] |
package com.rohith.service.test;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.rohith.modal.News;
import com.rohith.service.NewsService;
//@RunWith(SpringJUnit4ClassRunner.class)
//@ContextConfiguration(locations={"classpath:**/WEB-INF/configuration/springDemo-context.xml"})
//@Configurable
public class NewsServiceTest {
//@Autowired
//@Qualifier("newsService")
private NewsService newsService;
//@Test
public void getNewsTest() {
System.out.println("We are in getNewsTest *************");
News news = newsService.getNews();
System.out.println("Sort **********************" + news.getSort());
System.out.println("Sort **********************"+ news.getStatus());
}
//@Test
public void getUsersList() {
System.out.println("We are in getNewsTest *************");
News news = newsService.getNews();
System.out.println("Sort **********************" + news.getSort());
System.out.println("Sort **********************"+ news.getStatus());
}
}
| 1,348 | 0.684718 | 0.682493 | 45 | 28.955555 | 27.268179 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.444444 | false | false |
5
|
922d948fe6cbcbb1b6ef6f8302dc0defc9135736
| 20,590,073,232,494 |
19100b3246a05bc3a0545be4d81b2566f7f00447
|
/src/main/java/edu/escuelaing/arem/ASE/app/transformer/JsonUtil.java
|
eb58e16bc76f8aa619f8be094b7a3b9473aa4875
|
[
"MIT"
] |
permissive
|
GrCross/INTRODUCTION-TO-COMPUTER-SYSTEM-DESIGN
|
https://github.com/GrCross/INTRODUCTION-TO-COMPUTER-SYSTEM-DESIGN
|
36c5937336fc2618e881593412cb7e64818276f2
|
7850a09453003b42c49da1136a7292a58e1daf9a
|
refs/heads/master
| 2022-06-29T21:58:04.258000 | 2019-08-22T05:21:18 | 2019-08-22T05:21:18 | 203,246,922 | 0 | 0 |
MIT
| false | 2022-05-20T21:06:44 | 2019-08-19T20:39:24 | 2019-08-22T05:21:53 | 2022-05-20T21:06:43 | 11 | 0 | 0 | 2 |
Java
| false | false |
package edu.escuelaing.arem.ASE.app.transformer;
import spark.ResponseTransformer;
import com.google.gson.*;
public class JsonUtil{
public static String toJson(Object object) {
return new Gson().toJson(object);
}
public static ResponseTransformer json() {
return JsonUtil::toJson;
}
}
|
UTF-8
|
Java
| 314 |
java
|
JsonUtil.java
|
Java
|
[] | null |
[] |
package edu.escuelaing.arem.ASE.app.transformer;
import spark.ResponseTransformer;
import com.google.gson.*;
public class JsonUtil{
public static String toJson(Object object) {
return new Gson().toJson(object);
}
public static ResponseTransformer json() {
return JsonUtil::toJson;
}
}
| 314 | 0.71656 | 0.71656 | 18 | 16.5 | 18.108469 | 48 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.277778 | false | false |
5
|
f3d3703e34dbf731a1bc685e870cdc12c5122e2f
| 7,456,063,262,087 |
5937f2f47139c1ee331bdd3a031cb45925543e15
|
/csci_4100u/ass/A1/app/src/main/java/sheron/csci4100u/assignments/a1/Summary.java
|
38ba46469a39b0ea37f187d778239533457a01f2
|
[] |
no_license
|
judacribz/android_repo
|
https://github.com/judacribz/android_repo
|
e02f853b6952f968ff8651b530c6e4e38dd3bd6b
|
96cc0958a8de8b0c68e7641d4d3ba8f165a6e8cd
|
refs/heads/master
| 2020-03-08T05:51:58.061000 | 2018-04-11T17:56:41 | 2018-04-11T17:56:41 | 127,957,782 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package sheron.csci4100u.assignments.a1;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import static sheron.csci4100u.assignments.a1.MainMenu.EXTRA_NO_COUNT;
import static sheron.csci4100u.assignments.a1.MainMenu.EXTRA_YES_COUNT;
public class Summary extends AppCompatActivity {
TextView tvYes, tvNo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_summary);
tvYes = (TextView) findViewById(R.id.tv_yes_count);
tvNo = (TextView) findViewById(R.id.tv_no_count);
Intent countIntent = getIntent();
int yesCount = countIntent.getIntExtra(EXTRA_YES_COUNT, -1);
int noCount = countIntent.getIntExtra(EXTRA_NO_COUNT, -1);
// Displays results of answers
tvYes.setText(String.valueOf(yesCount));
tvNo.setText(String.valueOf(noCount));
}
}
|
UTF-8
|
Java
| 1,013 |
java
|
Summary.java
|
Java
|
[] | null |
[] |
package sheron.csci4100u.assignments.a1;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import static sheron.csci4100u.assignments.a1.MainMenu.EXTRA_NO_COUNT;
import static sheron.csci4100u.assignments.a1.MainMenu.EXTRA_YES_COUNT;
public class Summary extends AppCompatActivity {
TextView tvYes, tvNo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_summary);
tvYes = (TextView) findViewById(R.id.tv_yes_count);
tvNo = (TextView) findViewById(R.id.tv_no_count);
Intent countIntent = getIntent();
int yesCount = countIntent.getIntExtra(EXTRA_YES_COUNT, -1);
int noCount = countIntent.getIntExtra(EXTRA_NO_COUNT, -1);
// Displays results of answers
tvYes.setText(String.valueOf(yesCount));
tvNo.setText(String.valueOf(noCount));
}
}
| 1,013 | 0.721619 | 0.70385 | 32 | 30.65625 | 25.229706 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.625 | false | false |
5
|
0041d722c747c5e23fee8984b15a19bf258d4c8d
| 33,054,068,324,277 |
5aa49bde4856e534144d13e7907dad2a89256145
|
/LanguageModeler.java
|
baf4c64ef088b1940821f5e7bd1d313c691c3e4f
|
[] |
no_license
|
mslighthouse/MarkovMonkey
|
https://github.com/mslighthouse/MarkovMonkey
|
fba53e1f41380b3019f280982161c2ee04413459
|
ad6be5f4c9452abd59168ef8ec176ef34ba5282c
|
refs/heads/master
| 2016-09-05T12:11:05.467000 | 2014-12-03T18:52:20 | 2014-12-03T18:52:20 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.io.File;
import java.io.FileReader;
import java.io.BufferedReader;
import java.util.Hashtable;
import java.util.LinkedList;
import java.util.Random;
/**
* This program creates a language modeler. It reads in either a file or string, creates a hash table of the
* appropriate prefixes and suffixes according to a specific K value, and has methods to generate an output
* text based on the input of the original. This is the root class to the Markov Monkey problem.
*
* @author Maxwell Smith
* @version 11-30-2014
*/
public class LanguageModeler {
public String fullText = "";
public Hashtable<String, LinkedList<CharSuffix>> hashtable = new Hashtable<String, LinkedList<CharSuffix>>();
public int Kvalue;
// create an order K model for text
public LanguageModeler(int K, File text)
{
try {
Kvalue = K;
BufferedReader reader = new BufferedReader(new FileReader(text));
String line = "";
// Read in text
while ((line = reader.readLine()) != null) {
fullText += line;
}
String prefix = "";
String copyText = fullText;
char suffix = ' ';
int count = 0;
while (prefix != null) {
prefix = copyText.substring(0,K);
if (prefix.length() == copyText.length()) {
suffix = '*';
copyText = "";
}
else {
suffix = copyText.charAt(K);
copyText = copyText.substring(1, copyText.length());
}
CharSuffix tempSuffix = new CharSuffix(suffix);
LinkedList<CharSuffix> tempList = new LinkedList<CharSuffix>();
if (hashtable.containsKey(prefix)) {
tempList = hashtable.get(prefix);
hashtable.remove(prefix);
}
int index = tempList.indexOf(tempSuffix);
if (index > -1) {
tempSuffix.setCount(tempList.get(index).getCount() + 1);
tempList.remove(index);
}
tempList.add(tempSuffix);
hashtable.put(prefix, tempList);
if (copyText.length() <= K) {
prefix = null;
}
}
}
catch (Exception e) {
System.out.print("Exception caught: " + e + "\n");
}
}
// create an order K model for text
public LanguageModeler(int K, String text)
{
Kvalue = K;
fullText = text;
String prefix = "";
String copyText = fullText;
char suffix = ' ';
while (prefix != null) {
prefix = copyText.substring(0,K);
suffix = copyText.charAt(K);
copyText = copyText.substring(1, copyText.length());
CharSuffix tempSuffix = new CharSuffix(suffix);
LinkedList<CharSuffix> tempList = new LinkedList<CharSuffix>();
if (hashtable.containsKey(prefix)) {
tempList = hashtable.get(prefix);
hashtable.remove(prefix);
}
int index = tempList.indexOf(tempSuffix);
if (index > -1) {
tempSuffix.setCount(tempList.get(index).getCount() + 1);
tempList.remove(index);
}
tempList.add(tempSuffix);
hashtable.put(prefix, tempList);
if (copyText.length() == K) {
prefix = null;
}
}
}
/**
* Returns the first K characters from the inputted text.
* @return the first K characters of the sample Text
*/
public String firstSeed()
{
return fullText.substring(0, Kvalue);
}
// return K consecutive characters from the sample text,
// selected uniformly at random
public String randomSeed()
{
if (fullText.length() == Kvalue) {
return firstSeed();
}
else {
Random randomInt = new Random();
int trueVal = randomInt.nextInt(fullText.length() - Kvalue);
return fullText.substring(trueVal, trueVal + Kvalue);
}
}
// return a character that follows seed in the sample text,
// selected according to the probability distribution of all
// characters that follow seed in the sample text
public char nextChar(String seed)
{
LinkedList<CharSuffix> validChars = hashtable.get(seed);
int totalProbability = 0;
try {
if (validChars == null) {
return '*';
}
// Get length of all possible characters
for (CharSuffix tChar : validChars) {
totalProbability += tChar.getCount();
}
Character[] allChars = new Character[totalProbability];
int index = 0;
int i = 0;
// Fill allChars array
for (CharSuffix xChar : validChars) {
for (i = 0; i < xChar.getCount(); i++) {
allChars[index] = xChar.getChar();
index++;
}
}
// Random integer based on length of Character array
Random randomInt = new Random();
int trueVal = randomInt.nextInt(totalProbability);
return allChars[trueVal];
}
catch (Exception e)
{
return randomSeed().charAt(0);
}
}
}
// Class that doubles as a character, but also has a count for how many times it has been called.
// Used for counting how many instances of the class have been created / counted.
class CharSuffix {
int count = 0;
char mainchar;
public CharSuffix(Character mainCharacter) {
count++;
mainchar = mainCharacter;
}
public Character getChar() {
return mainchar;
}
public void setCount(int countIn) {
count = countIn;
}
public int getCount() {
return count;
}
// Used for ease of reading in the Canvas
public String toString() {
return "(" + Character.toString(mainchar) + ", " + getCount() + ")";
}
// Necessary for Comparisons
@Override
public boolean equals(Object that) {
CharSuffix that2 = (CharSuffix) that;
if (this.getChar() == that2.getChar()) {
return true;
}
return false;
}
}
|
UTF-8
|
Java
| 6,469 |
java
|
LanguageModeler.java
|
Java
|
[
{
"context": "class to the Markov Monkey problem.\n * \n * @author Maxwell Smith\n * @version 11-30-2014\n */\npublic class LanguageM",
"end": 509,
"score": 0.9997625350952148,
"start": 496,
"tag": "NAME",
"value": "Maxwell Smith"
}
] | null |
[] |
import java.io.File;
import java.io.FileReader;
import java.io.BufferedReader;
import java.util.Hashtable;
import java.util.LinkedList;
import java.util.Random;
/**
* This program creates a language modeler. It reads in either a file or string, creates a hash table of the
* appropriate prefixes and suffixes according to a specific K value, and has methods to generate an output
* text based on the input of the original. This is the root class to the Markov Monkey problem.
*
* @author <NAME>
* @version 11-30-2014
*/
public class LanguageModeler {
public String fullText = "";
public Hashtable<String, LinkedList<CharSuffix>> hashtable = new Hashtable<String, LinkedList<CharSuffix>>();
public int Kvalue;
// create an order K model for text
public LanguageModeler(int K, File text)
{
try {
Kvalue = K;
BufferedReader reader = new BufferedReader(new FileReader(text));
String line = "";
// Read in text
while ((line = reader.readLine()) != null) {
fullText += line;
}
String prefix = "";
String copyText = fullText;
char suffix = ' ';
int count = 0;
while (prefix != null) {
prefix = copyText.substring(0,K);
if (prefix.length() == copyText.length()) {
suffix = '*';
copyText = "";
}
else {
suffix = copyText.charAt(K);
copyText = copyText.substring(1, copyText.length());
}
CharSuffix tempSuffix = new CharSuffix(suffix);
LinkedList<CharSuffix> tempList = new LinkedList<CharSuffix>();
if (hashtable.containsKey(prefix)) {
tempList = hashtable.get(prefix);
hashtable.remove(prefix);
}
int index = tempList.indexOf(tempSuffix);
if (index > -1) {
tempSuffix.setCount(tempList.get(index).getCount() + 1);
tempList.remove(index);
}
tempList.add(tempSuffix);
hashtable.put(prefix, tempList);
if (copyText.length() <= K) {
prefix = null;
}
}
}
catch (Exception e) {
System.out.print("Exception caught: " + e + "\n");
}
}
// create an order K model for text
public LanguageModeler(int K, String text)
{
Kvalue = K;
fullText = text;
String prefix = "";
String copyText = fullText;
char suffix = ' ';
while (prefix != null) {
prefix = copyText.substring(0,K);
suffix = copyText.charAt(K);
copyText = copyText.substring(1, copyText.length());
CharSuffix tempSuffix = new CharSuffix(suffix);
LinkedList<CharSuffix> tempList = new LinkedList<CharSuffix>();
if (hashtable.containsKey(prefix)) {
tempList = hashtable.get(prefix);
hashtable.remove(prefix);
}
int index = tempList.indexOf(tempSuffix);
if (index > -1) {
tempSuffix.setCount(tempList.get(index).getCount() + 1);
tempList.remove(index);
}
tempList.add(tempSuffix);
hashtable.put(prefix, tempList);
if (copyText.length() == K) {
prefix = null;
}
}
}
/**
* Returns the first K characters from the inputted text.
* @return the first K characters of the sample Text
*/
public String firstSeed()
{
return fullText.substring(0, Kvalue);
}
// return K consecutive characters from the sample text,
// selected uniformly at random
public String randomSeed()
{
if (fullText.length() == Kvalue) {
return firstSeed();
}
else {
Random randomInt = new Random();
int trueVal = randomInt.nextInt(fullText.length() - Kvalue);
return fullText.substring(trueVal, trueVal + Kvalue);
}
}
// return a character that follows seed in the sample text,
// selected according to the probability distribution of all
// characters that follow seed in the sample text
public char nextChar(String seed)
{
LinkedList<CharSuffix> validChars = hashtable.get(seed);
int totalProbability = 0;
try {
if (validChars == null) {
return '*';
}
// Get length of all possible characters
for (CharSuffix tChar : validChars) {
totalProbability += tChar.getCount();
}
Character[] allChars = new Character[totalProbability];
int index = 0;
int i = 0;
// Fill allChars array
for (CharSuffix xChar : validChars) {
for (i = 0; i < xChar.getCount(); i++) {
allChars[index] = xChar.getChar();
index++;
}
}
// Random integer based on length of Character array
Random randomInt = new Random();
int trueVal = randomInt.nextInt(totalProbability);
return allChars[trueVal];
}
catch (Exception e)
{
return randomSeed().charAt(0);
}
}
}
// Class that doubles as a character, but also has a count for how many times it has been called.
// Used for counting how many instances of the class have been created / counted.
class CharSuffix {
int count = 0;
char mainchar;
public CharSuffix(Character mainCharacter) {
count++;
mainchar = mainCharacter;
}
public Character getChar() {
return mainchar;
}
public void setCount(int countIn) {
count = countIn;
}
public int getCount() {
return count;
}
// Used for ease of reading in the Canvas
public String toString() {
return "(" + Character.toString(mainchar) + ", " + getCount() + ")";
}
// Necessary for Comparisons
@Override
public boolean equals(Object that) {
CharSuffix that2 = (CharSuffix) that;
if (this.getChar() == that2.getChar()) {
return true;
}
return false;
}
}
| 6,462 | 0.542124 | 0.538105 | 240 | 25.833334 | 23.232281 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.416667 | false | false |
5
|
a995435d0defef52795aa2fe89eaaae5bbd6520c
| 8,701,603,759,130 |
d00183b9f0a5d39aeb608a39d970774aea619000
|
/app/src/main/java/com/amoveo/amoveowallet/fragments/WalletFragment.java
|
f3164f6f3e0210501c134c293478b318b563553d
|
[
"Apache-2.0"
] |
permissive
|
amoveo-project/amoveo-android-wallet
|
https://github.com/amoveo-project/amoveo-android-wallet
|
ed567ea2990588658063d63bdccb416b8f07cf60
|
b719b692d4216c23266f88fa6bfd3dcc7bebaf87
|
refs/heads/master
| 2020-04-13T06:15:13.564000 | 2018-12-24T18:32:03 | 2018-12-24T18:32:03 | 163,015,351 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.amoveo.amoveowallet.fragments;
import com.amoveo.amoveowallet.R;
import com.amoveo.amoveowallet.presenters.BaseNavigationPresenter;
import com.amoveo.amoveowallet.toolbars.BaseToolbar;
import com.amoveo.amoveowallet.view.IBaseNavigationView;
public class WalletFragment extends BaseNavigationFragment<BaseNavigationPresenter, IBaseNavigationView, BaseToolbar> {
@Override
protected int getLayout() {
return R.layout.fragment_wallet;
}
@Override
protected BaseNavigationPresenter createPresenter() {
return new BaseNavigationPresenter();
}
public static WalletFragment newInstance() {
return new WalletFragment();
}
}
|
UTF-8
|
Java
| 688 |
java
|
WalletFragment.java
|
Java
|
[] | null |
[] |
package com.amoveo.amoveowallet.fragments;
import com.amoveo.amoveowallet.R;
import com.amoveo.amoveowallet.presenters.BaseNavigationPresenter;
import com.amoveo.amoveowallet.toolbars.BaseToolbar;
import com.amoveo.amoveowallet.view.IBaseNavigationView;
public class WalletFragment extends BaseNavigationFragment<BaseNavigationPresenter, IBaseNavigationView, BaseToolbar> {
@Override
protected int getLayout() {
return R.layout.fragment_wallet;
}
@Override
protected BaseNavigationPresenter createPresenter() {
return new BaseNavigationPresenter();
}
public static WalletFragment newInstance() {
return new WalletFragment();
}
}
| 688 | 0.771802 | 0.771802 | 22 | 30.318182 | 29.261185 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.454545 | false | false |
5
|
ff4cc108ddcb92bb5da1ae56caafd36f184387c1
| 979,252,567,140 |
c3fee195bb54be819a21de34c97baff20a739ce8
|
/src/uclm/esi/cardroid/data/oracle/Trip_WeekDaysVarray.java
|
9952325c0e8914ae33fe8d255a3e7779d21afc4d
|
[] |
no_license
|
systematic-chaos/cardroid-server
|
https://github.com/systematic-chaos/cardroid-server
|
c5ca4129f001112e1a033d5823a1817ea34baf1a
|
a6f0e0c8952700f2a727bf131e54176abcca2449
|
refs/heads/master
| 2021-01-10T02:47:10.810000 | 2016-01-03T21:56:29 | 2016-01-03T21:56:29 | 48,958,837 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package uclm.esi.cardroid.data.oracle;
import java.sql.SQLException;
import java.sql.Connection;
import oracle.jdbc.OracleTypes;
import oracle.sql.ORAData;
import oracle.sql.ORADataFactory;
import oracle.sql.Datum;
import oracle.sql.ARRAY;
import oracle.sql.ArrayDescriptor;
import oracle.jpub.runtime.MutableArray;
/**
* \class Trip_WeekDaysVarray
* Domain class implementing an array of week days (characters)
* for its storage and retrieval from an Oracle database
*/
public class Trip_WeekDaysVarray implements ORAData, ORADataFactory {
public static final String _SQL_NAME = "ANDROID.WEEKDAYS_V_TYP";
public static final int _SQL_TYPECODE = OracleTypes.ARRAY;
MutableArray _array;
private static final Trip_WeekDaysVarray _Trip_WeekDaysVarrayFactory = new Trip_WeekDaysVarray();
public static ORADataFactory getORADataFactory() {
return _Trip_WeekDaysVarrayFactory;
}
/* constructors */
public Trip_WeekDaysVarray() {
this(null);
}
public Trip_WeekDaysVarray(String[] a) {
_array = new MutableArray(1, a, null);
}
/* ORAData interface */
public Datum toDatum(Connection c) throws SQLException {
return _array.toDatum(c, _SQL_NAME);
}
/* ORADataFactory interface */
public ORAData create(Datum d, int sqlType) throws SQLException {
if (d == null)
return null;
Trip_WeekDaysVarray a = new Trip_WeekDaysVarray();
a._array = new MutableArray(1, (ARRAY) d, null);
return a;
}
public int length() throws SQLException {
return _array.length();
}
public int getBaseType() throws SQLException {
return _array.getBaseType();
}
public String getBaseTypeName() throws SQLException {
return _array.getBaseTypeName();
}
public ArrayDescriptor getDescriptor() throws SQLException {
return _array.getDescriptor();
}
/* array accessor methods */
public String[] getArray() throws SQLException {
return (String[]) _array.getObjectArray();
}
public String[] getArray(long index, int count) throws SQLException {
return (String[]) _array.getObjectArray(index, count);
}
public void setArray(String[] a) throws SQLException {
_array.setObjectArray(a);
}
public void setArray(String[] a, long index) throws SQLException {
_array.setObjectArray(a, index);
}
public String getElement(long index) throws SQLException {
return (String) _array.getObjectElement(index);
}
public void setElement(String a, long index) throws SQLException {
_array.setObjectElement(a, index);
}
public String toString() {
try {
String r = "ANDROID.WEEKDAYS_TYP" + "(";
String[] a = getArray();
for (int i = 0; i < a.length;) {
r = r + ((a[i] == null) ? "null" : "'" + a[i] + "'");
i++;
if (i < a.length)
r = r + ",";
}
r = r + ")";
return r;
} catch (SQLException e) {
return e.toString();
}
}
}
|
UTF-8
|
Java
| 2,810 |
java
|
Trip_WeekDaysVarray.java
|
Java
|
[] | null |
[] |
package uclm.esi.cardroid.data.oracle;
import java.sql.SQLException;
import java.sql.Connection;
import oracle.jdbc.OracleTypes;
import oracle.sql.ORAData;
import oracle.sql.ORADataFactory;
import oracle.sql.Datum;
import oracle.sql.ARRAY;
import oracle.sql.ArrayDescriptor;
import oracle.jpub.runtime.MutableArray;
/**
* \class Trip_WeekDaysVarray
* Domain class implementing an array of week days (characters)
* for its storage and retrieval from an Oracle database
*/
public class Trip_WeekDaysVarray implements ORAData, ORADataFactory {
public static final String _SQL_NAME = "ANDROID.WEEKDAYS_V_TYP";
public static final int _SQL_TYPECODE = OracleTypes.ARRAY;
MutableArray _array;
private static final Trip_WeekDaysVarray _Trip_WeekDaysVarrayFactory = new Trip_WeekDaysVarray();
public static ORADataFactory getORADataFactory() {
return _Trip_WeekDaysVarrayFactory;
}
/* constructors */
public Trip_WeekDaysVarray() {
this(null);
}
public Trip_WeekDaysVarray(String[] a) {
_array = new MutableArray(1, a, null);
}
/* ORAData interface */
public Datum toDatum(Connection c) throws SQLException {
return _array.toDatum(c, _SQL_NAME);
}
/* ORADataFactory interface */
public ORAData create(Datum d, int sqlType) throws SQLException {
if (d == null)
return null;
Trip_WeekDaysVarray a = new Trip_WeekDaysVarray();
a._array = new MutableArray(1, (ARRAY) d, null);
return a;
}
public int length() throws SQLException {
return _array.length();
}
public int getBaseType() throws SQLException {
return _array.getBaseType();
}
public String getBaseTypeName() throws SQLException {
return _array.getBaseTypeName();
}
public ArrayDescriptor getDescriptor() throws SQLException {
return _array.getDescriptor();
}
/* array accessor methods */
public String[] getArray() throws SQLException {
return (String[]) _array.getObjectArray();
}
public String[] getArray(long index, int count) throws SQLException {
return (String[]) _array.getObjectArray(index, count);
}
public void setArray(String[] a) throws SQLException {
_array.setObjectArray(a);
}
public void setArray(String[] a, long index) throws SQLException {
_array.setObjectArray(a, index);
}
public String getElement(long index) throws SQLException {
return (String) _array.getObjectElement(index);
}
public void setElement(String a, long index) throws SQLException {
_array.setObjectElement(a, index);
}
public String toString() {
try {
String r = "ANDROID.WEEKDAYS_TYP" + "(";
String[] a = getArray();
for (int i = 0; i < a.length;) {
r = r + ((a[i] == null) ? "null" : "'" + a[i] + "'");
i++;
if (i < a.length)
r = r + ",";
}
r = r + ")";
return r;
} catch (SQLException e) {
return e.toString();
}
}
}
| 2,810 | 0.701068 | 0.7 | 118 | 22.813559 | 23.099251 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.516949 | false | false |
5
|
e04e2e08f5c8c0b1256a40e364e659251f637fcf
| 25,933,012,556,338 |
a14c2195a2649f6861fef7662ce3163fb5db2c2d
|
/apps/apps-book/Java8TheCompleteReference/intro/src/org/gamegogo/inheritence/DemoSuper.java
|
5af6f757daedece27a4cd93846bf0d5799b98fd9
|
[
"Apache-2.0"
] |
permissive
|
reyou/Ggg.Java
|
https://github.com/reyou/Ggg.Java
|
80ce25571c656861ffe1e23c5a2c5763c704a85c
|
952f86b8ad24e6c43e3c9246c08b557051f6f51a
|
refs/heads/master
| 2022-02-08T11:48:03.777000 | 2022-01-27T16:51:48 | 2022-01-27T16:51:48 | 134,283,720 | 0 | 0 |
Apache-2.0
| false | 2021-01-14T20:07:49 | 2018-05-21T14:55:05 | 2019-07-23T19:54:58 | 2021-01-14T20:07:48 | 10,848 | 0 | 0 | 1 |
Java
| false | false |
package org.gamegogo.inheritence;
class DemoSuper {
public static void main(String args[]) {
BoxWeight mybox1 = new BoxWeight(10, 20, 15, 34.3);
BoxWeight mybox2 = new BoxWeight(2, 3, 4, 0.076);
BoxWeight mybox3 = new BoxWeight(); // default
BoxWeight mycube = new BoxWeight(3, 2);
BoxWeight myclone = new BoxWeight(mybox1);
double vol;
vol = mybox1.volume();
System.out.println("Volume of mybox1 is " + vol);
System.out.println("Weight of mybox1 is " + mybox1.weight);
System.out.println();
vol = mybox2.volume();
System.out.println("Volume of mybox2 is " + vol);
System.out.println("Weight of mybox2 is " + mybox2.weight);
System.out.println();
vol = mybox3.volume();
System.out.println("Volume of mybox3 is " + vol);
System.out.println("Weight of mybox3 is " + mybox3.weight);
System.out.println();
vol = myclone.volume();
System.out.println("Volume of myclone is " + vol);
System.out.println("Weight of myclone is " + myclone.weight);
System.out.println();
vol = mycube.volume();
System.out.println("Volume of mycube is " + vol);
System.out.println("Weight of mycube is " + mycube.weight);
System.out.println();
}
}
|
UTF-8
|
Java
| 1,338 |
java
|
DemoSuper.java
|
Java
|
[] | null |
[] |
package org.gamegogo.inheritence;
class DemoSuper {
public static void main(String args[]) {
BoxWeight mybox1 = new BoxWeight(10, 20, 15, 34.3);
BoxWeight mybox2 = new BoxWeight(2, 3, 4, 0.076);
BoxWeight mybox3 = new BoxWeight(); // default
BoxWeight mycube = new BoxWeight(3, 2);
BoxWeight myclone = new BoxWeight(mybox1);
double vol;
vol = mybox1.volume();
System.out.println("Volume of mybox1 is " + vol);
System.out.println("Weight of mybox1 is " + mybox1.weight);
System.out.println();
vol = mybox2.volume();
System.out.println("Volume of mybox2 is " + vol);
System.out.println("Weight of mybox2 is " + mybox2.weight);
System.out.println();
vol = mybox3.volume();
System.out.println("Volume of mybox3 is " + vol);
System.out.println("Weight of mybox3 is " + mybox3.weight);
System.out.println();
vol = myclone.volume();
System.out.println("Volume of myclone is " + vol);
System.out.println("Weight of myclone is " + myclone.weight);
System.out.println();
vol = mycube.volume();
System.out.println("Volume of mycube is " + vol);
System.out.println("Weight of mycube is " + mycube.weight);
System.out.println();
}
}
| 1,338 | 0.600149 | 0.574738 | 32 | 40.78125 | 19.905613 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.0625 | false | false |
5
|
aaff3a5505158c6babf72d88949b591220d3641c
| 4,578,435,178,284 |
d60e287543a95a20350c2caeabafbec517cabe75
|
/LACCPlus/HBase/4930_2.java
|
41af3e56c420f21976c26147c3309fb4b14c43f6
|
[
"MIT"
] |
permissive
|
sgholamian/log-aware-clone-detection
|
https://github.com/sgholamian/log-aware-clone-detection
|
242067df2db6fd056f8d917cfbc143615c558b2c
|
9993cb081c420413c231d1807bfff342c39aa69a
|
refs/heads/main
| 2023-07-20T09:32:19.757000 | 2021-08-27T15:02:50 | 2021-08-27T15:02:50 | 337,837,827 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
//,temp,TestRegionSplitCalculator.java,301,312,temp,TestRegionSplitCalculator.java,254,267
//,3
public class xxx {
@Test
public void testSplitCalculatorFloor() {
SimpleRange a = new SimpleRange(Bytes.toBytes("A"), Bytes.toBytes("C"));
SimpleRange b = new SimpleRange(Bytes.toBytes("A"), Bytes.toBytes("B"));
RegionSplitCalculator<SimpleRange> sc = new RegionSplitCalculator<>(cmp);
sc.add(a);
sc.add(b);
Multimap<byte[], SimpleRange> regions = sc.calcCoverage();
LOG.info("AC and AB overlap in the beginning");
String res = dump(sc.getSplits(), regions);
checkDepths(sc.getSplits(), regions, 2, 1, 0);
assertEquals("A:\t[A, B]\t[A, C]\t\n" + "B:\t[A, C]\t\n" + "C:\t\n", res);
}
};
|
UTF-8
|
Java
| 729 |
java
|
4930_2.java
|
Java
|
[] | null |
[] |
//,temp,TestRegionSplitCalculator.java,301,312,temp,TestRegionSplitCalculator.java,254,267
//,3
public class xxx {
@Test
public void testSplitCalculatorFloor() {
SimpleRange a = new SimpleRange(Bytes.toBytes("A"), Bytes.toBytes("C"));
SimpleRange b = new SimpleRange(Bytes.toBytes("A"), Bytes.toBytes("B"));
RegionSplitCalculator<SimpleRange> sc = new RegionSplitCalculator<>(cmp);
sc.add(a);
sc.add(b);
Multimap<byte[], SimpleRange> regions = sc.calcCoverage();
LOG.info("AC and AB overlap in the beginning");
String res = dump(sc.getSplits(), regions);
checkDepths(sc.getSplits(), regions, 2, 1, 0);
assertEquals("A:\t[A, B]\t[A, C]\t\n" + "B:\t[A, C]\t\n" + "C:\t\n", res);
}
};
| 729 | 0.662551 | 0.640604 | 19 | 37.421051 | 31.431322 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.684211 | false | false |
5
|
d2989249bc9bfc843778d373f1d51ba13f3c0ac8
| 21,277,268,021,201 |
7394611894cebb5cf8211892ef4a30459e27c675
|
/A2/zhangmak/a2/src/Car.java
|
e934d44fe30e66503f2376ffa30d06e421ddebcf
|
[] |
no_license
|
ZzzMarlik/CSC207_Java
|
https://github.com/ZzzMarlik/CSC207_Java
|
1e74242aa9a1b32c2ae6ac94113f71e6b9b4afb8
|
2a83e068d4deea25e2a5e04390b6dbf6388a2303
|
refs/heads/master
| 2020-05-26T19:05:59.937000 | 2019-05-24T03:12:44 | 2019-05-24T03:12:44 | 188,343,417 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
The Car class. A Car object is a car in a train. It has
weight and color, and can draw() and move().
*/
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
/**
* The Car class. Describe a single car with color, weight, direction.
*
* @author Make Zhang
* @version J.R.E 1.8.0
*/
public class Car {
// My color.
/**
* This car's color.
*/
private Color color;
// My weight, in stone.
/**
* This car's weight.
*/
private static final int WEIGHT = 100;
/**
* The Car that immediately follows me.
*/
private Car nextCar;
/**
* This car's currentRail.
*/
private Rail currentRail;
/**
* This car's dir.
*/
private Direction dir;
/**
* Number of 4.
*/
private static final int MAGIC4 = 4;
/**
* Number of 3.
*/
private static final int MAGIC3 = 3;
/**
* Number of 5.
*/
private static final int MAGIC5 = 5;
/**
* Number of 7.
*/
private static final int MAGIC7 = 7;
/**
* Number of 8.
*/
private static final int MAGIC8 = 8;
/**
* set the direction of the car to dir.
*
* @param direction the direction to car
*/
public void setDirection(final Direction direction) {
dir = direction;
}
/**
* set the newRail to the car to currentRail.
*
* @param newRail the car's current rail
*/
public void setRail(final Rail newRail) {
currentRail = newRail;
}
/**
* set the newColor to the car to color.
*
* @param newColor the car's color
*/
void setColor(final Color newColor) {
this.color = newColor;
}
/**
* Get car's weight.
*
* @return WEIGHT
*/
int getWeight() {
return WEIGHT;
}
/**
* set the nextCAR to the car to nextCar.
*
* @param nextCAR nextCar of the car
*/
void setNextCar(final Car nextCAR) {
this.nextCar = nextCAR;
}
/**
* @return the nextCar
*/
Car getNextCar() {
return nextCar;
}
/**
* @return currentRail
*/
Rail getCurrentRail() {
return currentRail;
}
/**
* Move forward one TrackPiece; t is the current TrackPiece. Tell
* all of the cars I am pulling to move as well.
*/
void move() {
Direction nD = currentRail.exit(dir);
Direction nextDir = nD.opposite();
Rail nextRail = currentRail.nextRail(dir);
if ((nextRail.exitOK(nextDir)) && (!nextRail.occupied())) {
dir = nextDir;
if (nextRail.enter(this)) {
currentRail.leave();
currentRail = nextRail;
// We have to call this here rather than within currentRail.enter()
// because otherwise the wrong Rail is used...
currentRail.repaint();
if (nextCar != null) {
nextCar.move();
}
}
}
}
/**
* @return true if the current Rail is a SwitchRail and I am going straight through it.
*/
private boolean switchStraight() {
return (currentRail instanceof SwitchRail)
&& ((SwitchRail) currentRail).isGoingStraight();
}
/**
* @return Return true if the current Rail is a SwitchRail and I am going around a corner.
*/
private boolean switchCorner() {
return (currentRail instanceof SwitchRail)
&& !(((SwitchRail) currentRail).isGoingStraight());
}
/**
* Redraw myself.
*
* @param g graph of the car
*/
void draw(final Graphics g) {
Rectangle b = currentRail.getBounds();
double width = b.width;
double height = b.height;
int sqrtOfHypotenuse = (int) Math.sqrt((width * width / MAGIC4)
+ (height * height / MAGIC4));
int[] xPoints = new int[MAGIC5];
int[] yPoints = new int[MAGIC5];
if (currentRail instanceof StraightRail
|| currentRail instanceof CrossRail
|| switchStraight()) {
if (dir.equals("north") || dir.equals("south")) {
makeStraightPolygon(xPoints, yPoints);
} else {
makeStraightPolygon(yPoints, xPoints);
}
} else if (currentRail instanceof CornerRail || switchCorner()) {
switch (currentRail.getRailname()) {
case "NERail":
case "NSERail":
case "EWNRail":
makeCornerPolygon(xPoints, yPoints, -sqrtOfHypotenuse,
sqrtOfHypotenuse, (int) width, (int) (width / 2),
(int) (height / 2), 0);
break;
case "NWRail":
case "NSWRail":
case "WENRail":
makeCornerPolygon(xPoints, yPoints, sqrtOfHypotenuse,
sqrtOfHypotenuse, (int) (width / 2), 0,
0, (int) (height / 2));
break;
case "SERail":
case "SNERail":
case "EWSRail":
makeCornerPolygon(xPoints, yPoints, -sqrtOfHypotenuse,
-sqrtOfHypotenuse, (int) (width / 2), (int) width,
(int) height, (int) (height / 2));
break;
case "SWRail":
case "SNWRail":
case "WESRail":
makeCornerPolygon(xPoints, yPoints, sqrtOfHypotenuse,
-sqrtOfHypotenuse, 0, (int) (width / 2),
(int) (height / 2), (int) height);
break;
default:
break;
}
}
g.setColor(color);
g.drawPolygon(xPoints, yPoints, MAGIC5);
}
/**
* The points, in order, are the back right of the car,
* the front right of the car, the front left of the car,
* and the back left of the car.
*
* @param xPoints Points x
* @param yPoints Points y
* @param xSideOffset SideOffset x
* @param ySideOffset SideOffset y
* @param x0Mod Mod of x0
* @param x1Mod Mod of x1
* @param y0Mod Mod of y0
* @param y1Mod Mod of y1
*/
private void makeCornerPolygon(final int[] xPoints, final int[] yPoints,
final int xSideOffset, final int ySideOffset, final int x0Mod,
final int x1Mod, final int y0Mod, final int y1Mod) {
xPoints[0] = x0Mod;
xPoints[1] = x1Mod;
xPoints[2] = xPoints[1] + xSideOffset / 2;
xPoints[MAGIC3] = xPoints[0] + xSideOffset / 2;
xPoints[MAGIC4] = xPoints[0];
yPoints[0] = y0Mod;
yPoints[1] = y1Mod;
yPoints[2] = yPoints[1] + ySideOffset / 2;
yPoints[MAGIC3] = yPoints[0] + ySideOffset / 2;
yPoints[MAGIC4] = yPoints[0];
}
/**
* Make a StraightPolygon.
*
* @param aPoints Points of a
* @param bPoints Points of b
*/
private void makeStraightPolygon(final int[] aPoints, final int[] bPoints) {
Rectangle b = currentRail.getBounds();
int width = b.width;
int height = b.height;
aPoints[0] = width / MAGIC4;
aPoints[1] = MAGIC3 * width / MAGIC4;
aPoints[2] = MAGIC3 * width / MAGIC4;
aPoints[MAGIC3] = width / MAGIC4;
aPoints[MAGIC4] = aPoints[0];
bPoints[0] = height / MAGIC8;
bPoints[1] = height / MAGIC8;
bPoints[2] = MAGIC7 * height / MAGIC8;
bPoints[MAGIC3] = MAGIC7 * height / MAGIC8;
bPoints[MAGIC4] = bPoints[0];
}
/**
* @return Car
*/
public String toString() {
return "Car";
}
}
|
UTF-8
|
Java
| 6,947 |
java
|
Car.java
|
Java
|
[
{
"context": "e car with color, weight, direction.\n *\n * @author Make Zhang\n * @version J.R.E 1.8.0\n */\npublic class Car {\n\n ",
"end": 288,
"score": 0.999437153339386,
"start": 278,
"tag": "NAME",
"value": "Make Zhang"
}
] | null |
[] |
/*
The Car class. A Car object is a car in a train. It has
weight and color, and can draw() and move().
*/
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
/**
* The Car class. Describe a single car with color, weight, direction.
*
* @author <NAME>
* @version J.R.E 1.8.0
*/
public class Car {
// My color.
/**
* This car's color.
*/
private Color color;
// My weight, in stone.
/**
* This car's weight.
*/
private static final int WEIGHT = 100;
/**
* The Car that immediately follows me.
*/
private Car nextCar;
/**
* This car's currentRail.
*/
private Rail currentRail;
/**
* This car's dir.
*/
private Direction dir;
/**
* Number of 4.
*/
private static final int MAGIC4 = 4;
/**
* Number of 3.
*/
private static final int MAGIC3 = 3;
/**
* Number of 5.
*/
private static final int MAGIC5 = 5;
/**
* Number of 7.
*/
private static final int MAGIC7 = 7;
/**
* Number of 8.
*/
private static final int MAGIC8 = 8;
/**
* set the direction of the car to dir.
*
* @param direction the direction to car
*/
public void setDirection(final Direction direction) {
dir = direction;
}
/**
* set the newRail to the car to currentRail.
*
* @param newRail the car's current rail
*/
public void setRail(final Rail newRail) {
currentRail = newRail;
}
/**
* set the newColor to the car to color.
*
* @param newColor the car's color
*/
void setColor(final Color newColor) {
this.color = newColor;
}
/**
* Get car's weight.
*
* @return WEIGHT
*/
int getWeight() {
return WEIGHT;
}
/**
* set the nextCAR to the car to nextCar.
*
* @param nextCAR nextCar of the car
*/
void setNextCar(final Car nextCAR) {
this.nextCar = nextCAR;
}
/**
* @return the nextCar
*/
Car getNextCar() {
return nextCar;
}
/**
* @return currentRail
*/
Rail getCurrentRail() {
return currentRail;
}
/**
* Move forward one TrackPiece; t is the current TrackPiece. Tell
* all of the cars I am pulling to move as well.
*/
void move() {
Direction nD = currentRail.exit(dir);
Direction nextDir = nD.opposite();
Rail nextRail = currentRail.nextRail(dir);
if ((nextRail.exitOK(nextDir)) && (!nextRail.occupied())) {
dir = nextDir;
if (nextRail.enter(this)) {
currentRail.leave();
currentRail = nextRail;
// We have to call this here rather than within currentRail.enter()
// because otherwise the wrong Rail is used...
currentRail.repaint();
if (nextCar != null) {
nextCar.move();
}
}
}
}
/**
* @return true if the current Rail is a SwitchRail and I am going straight through it.
*/
private boolean switchStraight() {
return (currentRail instanceof SwitchRail)
&& ((SwitchRail) currentRail).isGoingStraight();
}
/**
* @return Return true if the current Rail is a SwitchRail and I am going around a corner.
*/
private boolean switchCorner() {
return (currentRail instanceof SwitchRail)
&& !(((SwitchRail) currentRail).isGoingStraight());
}
/**
* Redraw myself.
*
* @param g graph of the car
*/
void draw(final Graphics g) {
Rectangle b = currentRail.getBounds();
double width = b.width;
double height = b.height;
int sqrtOfHypotenuse = (int) Math.sqrt((width * width / MAGIC4)
+ (height * height / MAGIC4));
int[] xPoints = new int[MAGIC5];
int[] yPoints = new int[MAGIC5];
if (currentRail instanceof StraightRail
|| currentRail instanceof CrossRail
|| switchStraight()) {
if (dir.equals("north") || dir.equals("south")) {
makeStraightPolygon(xPoints, yPoints);
} else {
makeStraightPolygon(yPoints, xPoints);
}
} else if (currentRail instanceof CornerRail || switchCorner()) {
switch (currentRail.getRailname()) {
case "NERail":
case "NSERail":
case "EWNRail":
makeCornerPolygon(xPoints, yPoints, -sqrtOfHypotenuse,
sqrtOfHypotenuse, (int) width, (int) (width / 2),
(int) (height / 2), 0);
break;
case "NWRail":
case "NSWRail":
case "WENRail":
makeCornerPolygon(xPoints, yPoints, sqrtOfHypotenuse,
sqrtOfHypotenuse, (int) (width / 2), 0,
0, (int) (height / 2));
break;
case "SERail":
case "SNERail":
case "EWSRail":
makeCornerPolygon(xPoints, yPoints, -sqrtOfHypotenuse,
-sqrtOfHypotenuse, (int) (width / 2), (int) width,
(int) height, (int) (height / 2));
break;
case "SWRail":
case "SNWRail":
case "WESRail":
makeCornerPolygon(xPoints, yPoints, sqrtOfHypotenuse,
-sqrtOfHypotenuse, 0, (int) (width / 2),
(int) (height / 2), (int) height);
break;
default:
break;
}
}
g.setColor(color);
g.drawPolygon(xPoints, yPoints, MAGIC5);
}
/**
* The points, in order, are the back right of the car,
* the front right of the car, the front left of the car,
* and the back left of the car.
*
* @param xPoints Points x
* @param yPoints Points y
* @param xSideOffset SideOffset x
* @param ySideOffset SideOffset y
* @param x0Mod Mod of x0
* @param x1Mod Mod of x1
* @param y0Mod Mod of y0
* @param y1Mod Mod of y1
*/
private void makeCornerPolygon(final int[] xPoints, final int[] yPoints,
final int xSideOffset, final int ySideOffset, final int x0Mod,
final int x1Mod, final int y0Mod, final int y1Mod) {
xPoints[0] = x0Mod;
xPoints[1] = x1Mod;
xPoints[2] = xPoints[1] + xSideOffset / 2;
xPoints[MAGIC3] = xPoints[0] + xSideOffset / 2;
xPoints[MAGIC4] = xPoints[0];
yPoints[0] = y0Mod;
yPoints[1] = y1Mod;
yPoints[2] = yPoints[1] + ySideOffset / 2;
yPoints[MAGIC3] = yPoints[0] + ySideOffset / 2;
yPoints[MAGIC4] = yPoints[0];
}
/**
* Make a StraightPolygon.
*
* @param aPoints Points of a
* @param bPoints Points of b
*/
private void makeStraightPolygon(final int[] aPoints, final int[] bPoints) {
Rectangle b = currentRail.getBounds();
int width = b.width;
int height = b.height;
aPoints[0] = width / MAGIC4;
aPoints[1] = MAGIC3 * width / MAGIC4;
aPoints[2] = MAGIC3 * width / MAGIC4;
aPoints[MAGIC3] = width / MAGIC4;
aPoints[MAGIC4] = aPoints[0];
bPoints[0] = height / MAGIC8;
bPoints[1] = height / MAGIC8;
bPoints[2] = MAGIC7 * height / MAGIC8;
bPoints[MAGIC3] = MAGIC7 * height / MAGIC8;
bPoints[MAGIC4] = bPoints[0];
}
/**
* @return Car
*/
public String toString() {
return "Car";
}
}
| 6,943 | 0.588311 | 0.574205 | 301 | 22.076412 | 20.298376 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.435216 | false | false |
5
|
3a81d8e0e6a4710e74e1d2c9027ad4221b1f273f
| 10,290,741,675,047 |
5ecf7beb488be0a42d47b353f32f67a706123c2a
|
/Day2/src/by/trjava/task02/service/specification/search/impl/SpecificationSearchByReleaseYear.java
|
1d4694e16ea11886f42304742fa79b6912d3f9f5
|
[] |
no_license
|
Lavazz/JavaWeb
|
https://github.com/Lavazz/JavaWeb
|
5bfa928b3144cd0ecf993ab0644ceec5bc2d4b05
|
e3f6a3e40974198aebd8f6e04859a93e73228a91
|
refs/heads/master
| 2020-06-16T17:02:23.096000 | 2019-08-21T20:15:12 | 2019-08-21T20:15:12 | 195,644,096 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package by.trjava.task02.service.specification.search.impl;
import by.trjava.task02.entity.Edition;
import by.trjava.task02.service.specification.CompositeSpecificationSearch;
import by.trjava.task02.service.specification.SpecificationSearch;
public class SpecificationSearchByReleaseYear extends CompositeSpecificationSearch {
int releaseYearMin;
int releaseYearMax;
int releaseYear;
public SpecificationSearchByReleaseYear(int releaseYearMin, int releaseYearMax) {
this.releaseYearMin = releaseYearMin;
this.releaseYearMax = releaseYearMax;
}
public SpecificationSearchByReleaseYear(int releaseYear) {
this.releaseYear = releaseYear;
this.releaseYearMin = releaseYear - 1;
this.releaseYearMax = releaseYear + 1;
}
@Override
public boolean isSatisfiedBy(Edition edition) {
return releaseYearMin < edition.getReleaseYear() && releaseYearMax > edition.getReleaseYear();
}
}
|
UTF-8
|
Java
| 966 |
java
|
SpecificationSearchByReleaseYear.java
|
Java
|
[] | null |
[] |
package by.trjava.task02.service.specification.search.impl;
import by.trjava.task02.entity.Edition;
import by.trjava.task02.service.specification.CompositeSpecificationSearch;
import by.trjava.task02.service.specification.SpecificationSearch;
public class SpecificationSearchByReleaseYear extends CompositeSpecificationSearch {
int releaseYearMin;
int releaseYearMax;
int releaseYear;
public SpecificationSearchByReleaseYear(int releaseYearMin, int releaseYearMax) {
this.releaseYearMin = releaseYearMin;
this.releaseYearMax = releaseYearMax;
}
public SpecificationSearchByReleaseYear(int releaseYear) {
this.releaseYear = releaseYear;
this.releaseYearMin = releaseYear - 1;
this.releaseYearMax = releaseYear + 1;
}
@Override
public boolean isSatisfiedBy(Edition edition) {
return releaseYearMin < edition.getReleaseYear() && releaseYearMax > edition.getReleaseYear();
}
}
| 966 | 0.76087 | 0.750518 | 27 | 34.777779 | 30.406301 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.518519 | false | false |
5
|
9291e39bb2f11472a767387bca6ece1f2e23283d
| 11,046,655,930,576 |
d722bdc26c809b4e9937c707d6a91af444d3f840
|
/src/main/java/edu/udacity/java/nano/chat/WebSocketChatServer.java
|
b80cf7e4364d7077666c6f09376e2314aa68b4de
|
[] |
no_license
|
sosegon/jdnd_chatroom
|
https://github.com/sosegon/jdnd_chatroom
|
e4564156ce814032df51955b9de5a6f49bbe0789
|
d7747db5021cd5189000cd956e6cddeefe897232
|
refs/heads/master
| 2022-07-04T00:54:47.895000 | 2019-08-21T23:34:31 | 2019-08-21T23:34:31 | 203,445,004 | 0 | 0 | null | false | 2022-06-17T02:25:16 | 2019-08-20T19:54:12 | 2019-08-21T23:41:19 | 2022-06-17T02:25:15 | 179 | 0 | 0 | 1 |
HTML
| false | false |
package edu.udacity.java.nano.chat;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
import javax.websocket.*;
import javax.websocket.server.ServerEndpoint;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* WebSocket Server
*
* @see ServerEndpoint WebSocket Client
* @see Session WebSocket Session
*/
@Component
@ServerEndpoint("/chat")
public class WebSocketChatServer {
/**
* All chat sessions.
*/
private static Map<String, Session> onlineSessions = new ConcurrentHashMap<>();
private static void sendMessageToAll(Message msg) {
msg.setOnlineCount(onlineSessions.size());
onlineSessions.values().forEach(session -> {
session.getAsyncRemote().sendText(JSON.toJSONString(msg));
});
}
/**
* Open connection, 1) add session, 2) add user.
*/
@OnOpen
public void onOpen(Session session) {
if(session.isOpen()) {
String sessionId = session.getId();
onlineSessions.put(sessionId, session);
Message message = new Message();
message.setType(Message.MessageType.JOIN);
sendMessageToAll(message);
}
}
/**
* Send message, 1) get username and session, 2) send message to all.
*/
@OnMessage
public void onMessage(Session session, String jsonStr) {
JSONObject jsonObject = JSON.parseObject(jsonStr);
if(!jsonObject.containsKey("username")){
System.out.println("No username");
return;
}
if(!jsonObject.containsKey("msg")){
System.out.println("No msg");
return;
}
Message message = new Message();
message.setType(Message.MessageType.SPEAK);
message.setUsername(jsonObject.getString("username"));
message.setMsg(jsonObject.getString("msg"));
sendMessageToAll(message);
}
/**
* Close connection, 1) remove session, 2) update user.
*/
@OnClose
public void onClose(Session session) {
String sessionId = session.getId();
onlineSessions.remove(sessionId);
Message message = new Message();
message.setType(Message.MessageType.LEAVE);
sendMessageToAll(message);
}
/**
* Print exception.
*/
@OnError
public void onError(Session session, Throwable error) {
error.printStackTrace();
}
}
|
UTF-8
|
Java
| 2,507 |
java
|
WebSocketChatServer.java
|
Java
|
[] | null |
[] |
package edu.udacity.java.nano.chat;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
import javax.websocket.*;
import javax.websocket.server.ServerEndpoint;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* WebSocket Server
*
* @see ServerEndpoint WebSocket Client
* @see Session WebSocket Session
*/
@Component
@ServerEndpoint("/chat")
public class WebSocketChatServer {
/**
* All chat sessions.
*/
private static Map<String, Session> onlineSessions = new ConcurrentHashMap<>();
private static void sendMessageToAll(Message msg) {
msg.setOnlineCount(onlineSessions.size());
onlineSessions.values().forEach(session -> {
session.getAsyncRemote().sendText(JSON.toJSONString(msg));
});
}
/**
* Open connection, 1) add session, 2) add user.
*/
@OnOpen
public void onOpen(Session session) {
if(session.isOpen()) {
String sessionId = session.getId();
onlineSessions.put(sessionId, session);
Message message = new Message();
message.setType(Message.MessageType.JOIN);
sendMessageToAll(message);
}
}
/**
* Send message, 1) get username and session, 2) send message to all.
*/
@OnMessage
public void onMessage(Session session, String jsonStr) {
JSONObject jsonObject = JSON.parseObject(jsonStr);
if(!jsonObject.containsKey("username")){
System.out.println("No username");
return;
}
if(!jsonObject.containsKey("msg")){
System.out.println("No msg");
return;
}
Message message = new Message();
message.setType(Message.MessageType.SPEAK);
message.setUsername(jsonObject.getString("username"));
message.setMsg(jsonObject.getString("msg"));
sendMessageToAll(message);
}
/**
* Close connection, 1) remove session, 2) update user.
*/
@OnClose
public void onClose(Session session) {
String sessionId = session.getId();
onlineSessions.remove(sessionId);
Message message = new Message();
message.setType(Message.MessageType.LEAVE);
sendMessageToAll(message);
}
/**
* Print exception.
*/
@OnError
public void onError(Session session, Throwable error) {
error.printStackTrace();
}
}
| 2,507 | 0.629438 | 0.627044 | 101 | 23.821783 | 22.17098 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.425743 | false | false |
5
|
63ec867deb5f81f5e8f8c09621a8617ab9cef29e
| 14,525,579,439,171 |
69f4ed0531fefd965c74761475960bd1b1420c56
|
/getphonenum/src/com/example/getphonenum/MainActivity.java
|
2ec943b25006ba55e931e1c6fa6521792cb8f69d
|
[] |
no_license
|
fishman419/workspace
|
https://github.com/fishman419/workspace
|
67dcbbba9016fda9e0919cc484dd211febb7da4d
|
e089b9b405e3146ea4110cd5896fc4481f13c216
|
refs/heads/master
| 2016-09-06T17:14:31.573000 | 2014-04-03T09:19:02 | 2014-04-03T09:19:02 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.getphonenum;
import android.os.Bundle;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.app.Activity;
import android.content.Intent;
import android.telephony.PhoneNumberUtils;
import android.view.Menu;
import android.view.TextureView;
import android.widget.TextView;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Intent intent = getIntent();
String action = intent.getAction();
String num = PhoneNumberUtils.getNumberFromIntent(intent, this);
TextView tv = (TextView)findViewById(R.id.myTextView);
tv.setText(num);
}
}
|
UTF-8
|
Java
| 735 |
java
|
MainActivity.java
|
Java
|
[] | null |
[] |
package com.example.getphonenum;
import android.os.Bundle;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.app.Activity;
import android.content.Intent;
import android.telephony.PhoneNumberUtils;
import android.view.Menu;
import android.view.TextureView;
import android.widget.TextView;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Intent intent = getIntent();
String action = intent.getAction();
String num = PhoneNumberUtils.getNumberFromIntent(intent, this);
TextView tv = (TextView)findViewById(R.id.myTextView);
tv.setText(num);
}
}
| 735 | 0.791837 | 0.791837 | 28 | 25.25 | 20.543726 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.357143 | false | false |
5
|
581f1fee92e2f40995202c5f3a8912ac968b1d07
| 31,104,153,197,323 |
fb2c47624e6be7a7d73fb7fe9fe6b747a21ba081
|
/O2OCoreService/src/main/java/com/newegg/coreservice/model/domain/SystemLog.java
|
766a69b7a1998a2fc8e642b79a81cae725400849
|
[] |
no_license
|
suevip/O2OCoreService
|
https://github.com/suevip/O2OCoreService
|
7478bec7bd58cab6a19c69c7db734f8347834c62
|
1f057bf924b4b8441c3671f4b8307a7f1130fb7f
|
refs/heads/master
| 2018-01-16T15:01:43.566000 | 2016-07-13T02:25:28 | 2016-07-13T02:25:28 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.newegg.coreservice.model.domain;
import java.util.Date;
import java.util.UUID;
import javax.persistence.Entity;
import javax.persistence.Table;
import com.newegg.coreservice.util.HBaseTable;
import me.prettyprint.hom.annotations.Column;
import me.prettyprint.hom.annotations.Id;
/**
* 日志表SystemLog
* @author ll2e
*
*/
@Entity
@Table(name = "SystemLog")
@HBaseTable(name = "SystemLog",familyName="SystemLog")
public class SystemLog extends BasicDomain {
private static final long serialVersionUID = -1604775663260085390L;
/**
* ID
*/
@Id
private UUID id;
/**
* 表名称
*/
@Column(name = "tableName")
private String tableName;
/**
* 表id uuid
*/
@Column(name = "tableId")
private String tableId;
/**
*修改人
*/
@Column(name = "clientId")
private Long clientId;
/**
* 修改时间
*/
@Column(name = "changeDate")
private Date changeDate;
/**
* 改变的类型
*/
@Column(name = "changeType")
private Integer changeType;
/**
* 当前状态
*/
@Column(name = "beforeStatus")
private String beforeStatus;
/**
* 改变后状态
*/
@Column(name = "afterStatus")
private String afterStatus;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
public String getTableId() {
return tableId;
}
public void setTableId(String tableId) {
this.tableId = tableId;
}
public Long getClientId() {
return clientId;
}
public void setClientId(Long clientId) {
this.clientId = clientId;
}
public Date getChangeDate() {
return changeDate;
}
public void setChangeDate(Date changeDate) {
this.changeDate = changeDate;
}
public Integer getChangeType() {
return changeType;
}
public void setChangeType(Integer changeType) {
this.changeType = changeType;
}
public String getBeforeStatus() {
return beforeStatus;
}
public void setBeforeStatus(String beforeStatus) {
this.beforeStatus = beforeStatus;
}
public String getAfterStatus() {
return afterStatus;
}
public void setAfterStatus(String afterStatus) {
this.afterStatus = afterStatus;
}
}
|
UTF-8
|
Java
| 2,247 |
java
|
SystemLog.java
|
Java
|
[
{
"context": "om.annotations.Id;\n\n/**\n * 日志表SystemLog\n * @author ll2e\n *\n */\n@Entity\n@Table(name = \"SystemLog\")\n@HBaseT",
"end": 331,
"score": 0.9994820952415466,
"start": 327,
"tag": "USERNAME",
"value": "ll2e"
}
] | null |
[] |
package com.newegg.coreservice.model.domain;
import java.util.Date;
import java.util.UUID;
import javax.persistence.Entity;
import javax.persistence.Table;
import com.newegg.coreservice.util.HBaseTable;
import me.prettyprint.hom.annotations.Column;
import me.prettyprint.hom.annotations.Id;
/**
* 日志表SystemLog
* @author ll2e
*
*/
@Entity
@Table(name = "SystemLog")
@HBaseTable(name = "SystemLog",familyName="SystemLog")
public class SystemLog extends BasicDomain {
private static final long serialVersionUID = -1604775663260085390L;
/**
* ID
*/
@Id
private UUID id;
/**
* 表名称
*/
@Column(name = "tableName")
private String tableName;
/**
* 表id uuid
*/
@Column(name = "tableId")
private String tableId;
/**
*修改人
*/
@Column(name = "clientId")
private Long clientId;
/**
* 修改时间
*/
@Column(name = "changeDate")
private Date changeDate;
/**
* 改变的类型
*/
@Column(name = "changeType")
private Integer changeType;
/**
* 当前状态
*/
@Column(name = "beforeStatus")
private String beforeStatus;
/**
* 改变后状态
*/
@Column(name = "afterStatus")
private String afterStatus;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
public String getTableId() {
return tableId;
}
public void setTableId(String tableId) {
this.tableId = tableId;
}
public Long getClientId() {
return clientId;
}
public void setClientId(Long clientId) {
this.clientId = clientId;
}
public Date getChangeDate() {
return changeDate;
}
public void setChangeDate(Date changeDate) {
this.changeDate = changeDate;
}
public Integer getChangeType() {
return changeType;
}
public void setChangeType(Integer changeType) {
this.changeType = changeType;
}
public String getBeforeStatus() {
return beforeStatus;
}
public void setBeforeStatus(String beforeStatus) {
this.beforeStatus = beforeStatus;
}
public String getAfterStatus() {
return afterStatus;
}
public void setAfterStatus(String afterStatus) {
this.afterStatus = afterStatus;
}
}
| 2,247 | 0.695116 | 0.685988 | 132 | 15.598485 | 15.923996 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.083333 | false | false |
5
|
abfea0fcd4b9b28514137e28850fec60e7cf76e1
| 1,872,605,744,295 |
57b021ecb3f8828be45c750474d19ce723deb4ea
|
/app/src/main/java/com/example/bxh/sayhello/oom/BigImgLoader.java
|
e3ed283cb3d4697f0d2de717a8a5059f02bbd48e
|
[] |
no_license
|
Buxiaohui/Test
|
https://github.com/Buxiaohui/Test
|
69449b48f00ac09d092781c7e7e4837d5dfcecc3
|
92e58e8369e2589c7368f1226972df430d065d8a
|
refs/heads/master
| 2020-04-06T04:53:08.630000 | 2017-08-24T01:58:06 | 2017-08-24T01:58:06 | 73,663,252 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.bxh.sayhello.oom;
import android.graphics.BitmapRegionDecoder;
/**
* Created by buxiaohui on 17-8-12.
*/
/**
*!!!!!加载超大图!!!!!
* BitmapRegionDecoder can be used to decode a rectangle region from an image.
* BitmapRegionDecoder is particularly useful when an original image is large and
* you only need parts of the image.
*
* <p>To create a BitmapRegionDecoder, call newInstance(...).
* Given a BitmapRegionDecoder, users can call decodeRegion() repeatedly
* to get a decoded Bitmap of the specified region.
*
* 可以参考http://blog.csdn.net/jjmm2009/article/details/49360751
* http://blog.csdn.net/lmj623565791/article/details/49300989/
* https://github.com/johnnylambada/WorldMap
*/
public class BigImgLoader {
public static void loadBigImg(){
BitmapRegionDecoder bitmapRegionDecoder = null;
}
}
|
UTF-8
|
Java
| 864 |
java
|
BigImgLoader.java
|
Java
|
[
{
"context": "d.graphics.BitmapRegionDecoder;\n\n/**\n * Created by buxiaohui on 17-8-12.\n */\n\n/**\n *!!!!!加载超大图!!!!!\n * BitmapR",
"end": 112,
"score": 0.9992282390594482,
"start": 103,
"tag": "USERNAME",
"value": "buxiaohui"
},
{
"context": " specified region.\n *\n * 可以参考http://blog.csdn.net/jjmm2009/article/details/49360751\n * http://blog.csdn.net/",
"end": 579,
"score": 0.9995296597480774,
"start": 571,
"tag": "USERNAME",
"value": "jjmm2009"
},
{
"context": "/article/details/49360751\n * http://blog.csdn.net/lmj623565791/article/details/49300989/\n * https://github.com/j",
"end": 641,
"score": 0.9991628527641296,
"start": 629,
"tag": "USERNAME",
"value": "lmj623565791"
},
{
"context": "1/article/details/49300989/\n * https://github.com/johnnylambada/WorldMap\n */\npublic class BigImgLoader {\n publ",
"end": 703,
"score": 0.9993858933448792,
"start": 690,
"tag": "USERNAME",
"value": "johnnylambada"
}
] | null |
[] |
package com.example.bxh.sayhello.oom;
import android.graphics.BitmapRegionDecoder;
/**
* Created by buxiaohui on 17-8-12.
*/
/**
*!!!!!加载超大图!!!!!
* BitmapRegionDecoder can be used to decode a rectangle region from an image.
* BitmapRegionDecoder is particularly useful when an original image is large and
* you only need parts of the image.
*
* <p>To create a BitmapRegionDecoder, call newInstance(...).
* Given a BitmapRegionDecoder, users can call decodeRegion() repeatedly
* to get a decoded Bitmap of the specified region.
*
* 可以参考http://blog.csdn.net/jjmm2009/article/details/49360751
* http://blog.csdn.net/lmj623565791/article/details/49300989/
* https://github.com/johnnylambada/WorldMap
*/
public class BigImgLoader {
public static void loadBigImg(){
BitmapRegionDecoder bitmapRegionDecoder = null;
}
}
| 864 | 0.737589 | 0.6974 | 27 | 30.333334 | 27.246475 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.185185 | false | false |
5
|
da99bfe979a675d8cb35538aceb95fdaff07f18b
| 1,872,605,745,145 |
afa1b48e41343f53b66d6057c7d74bae5784908f
|
/polyv-java-live-sdk/src/main/java/net/polyv/live/v1/entity/channel/operate/LiveChannelAuthTokenRequest.java
|
4e8102f6e2a8f24c0d2a7c9290ed41eeaa6a5d06
|
[] |
no_license
|
polyv/polyv-java-sdk
|
https://github.com/polyv/polyv-java-sdk
|
7a30106a1309ecaef930871234b73c251eebe1bd
|
2c39db464fd9a019fab2bd4b2510feadd45579d6
|
refs/heads/master
| 2023-05-01T11:06:55.052000 | 2021-05-26T03:59:36 | 2021-05-26T03:59:36 | 299,278,605 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package net.polyv.live.v1.entity.channel.operate;
import net.polyv.common.v1.validator.constraints.NotNull;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import net.polyv.live.v1.entity.LiveCommonRequest;
/**
* 查询授权和连麦的token请求体
* @author: sadboy
**/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel("查询授权和连麦的token请求体")
public class LiveChannelAuthTokenRequest extends LiveCommonRequest {
/**
* C端观众ID
*/
@ApiModelProperty(name = "userId", value = "C端观众ID", required = true)
@NotNull(message = "属性userId不能为空")
private String userId;
/**
* 频道号
*/
@ApiModelProperty(name = "channelId", value = "频道号", required = true)
@NotNull(message = "属性channelId不能为空")
private String channelId;
/**
* 角色,值有:teacher admin guest assistant viewer等
*/
@ApiModelProperty(name = "role", value = "角色,值有:teacher admin guest assistant viewer等", required = true)
@NotNull(message = "属性role不能为空")
private String role;
/**
* 观看来源,可以有web,client,app等
*/
@ApiModelProperty(name = "origin", value = "观看来源,可以有web,client,app等", required = false)
private String origin;
}
|
UTF-8
|
Java
| 1,490 |
java
|
LiveChannelAuthTokenRequest.java
|
Java
|
[
{
"context": "ommonRequest;\n\n/**\n * 查询授权和连麦的token请求体\n * @author: sadboy\n **/\n@Data\n@EqualsAndHashCode(callSuper = true)\n@",
"end": 383,
"score": 0.9995977282524109,
"start": 377,
"tag": "USERNAME",
"value": "sadboy"
}
] | null |
[] |
package net.polyv.live.v1.entity.channel.operate;
import net.polyv.common.v1.validator.constraints.NotNull;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import net.polyv.live.v1.entity.LiveCommonRequest;
/**
* 查询授权和连麦的token请求体
* @author: sadboy
**/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel("查询授权和连麦的token请求体")
public class LiveChannelAuthTokenRequest extends LiveCommonRequest {
/**
* C端观众ID
*/
@ApiModelProperty(name = "userId", value = "C端观众ID", required = true)
@NotNull(message = "属性userId不能为空")
private String userId;
/**
* 频道号
*/
@ApiModelProperty(name = "channelId", value = "频道号", required = true)
@NotNull(message = "属性channelId不能为空")
private String channelId;
/**
* 角色,值有:teacher admin guest assistant viewer等
*/
@ApiModelProperty(name = "role", value = "角色,值有:teacher admin guest assistant viewer等", required = true)
@NotNull(message = "属性role不能为空")
private String role;
/**
* 观看来源,可以有web,client,app等
*/
@ApiModelProperty(name = "origin", value = "观看来源,可以有web,client,app等", required = false)
private String origin;
}
| 1,490 | 0.690045 | 0.687783 | 49 | 26.061224 | 25.292097 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.530612 | false | false |
5
|
6b0368bd38fb070f9653b77b8cdba6a94017c672
| 11,321,533,841,750 |
5e428f7661eff995958a5c0c99157e454dc0d0e9
|
/test/src/com/manage/dao/SupplierDao.java
|
78a1b874687391677c91f83282959b8dd0ca1ca9
|
[] |
no_license
|
naiheyuewuhen/myTest
|
https://github.com/naiheyuewuhen/myTest
|
c8d46ece98c33bee3132dbc98acd3053ae97156f
|
dc1902d5dfd26bb4e9db98596f94fc3bf1c71389
|
refs/heads/master
| 2020-03-18T06:17:36.659000 | 2018-05-22T08:48:46 | 2018-05-22T08:48:46 | 134,386,504 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.manage.dao;
import java.util.List;
import java.util.Map;
import com.manage.model.SupplierInfo;
import com.manage.model.WebPage;
public interface SupplierDao {
SupplierInfo getById(Integer id);
WebPage<SupplierInfo> getAll(Map<String, String> map, Boolean hasPage);
Integer save(SupplierInfo supplierInfo);
Integer update(SupplierInfo supplierInfo);
/**
* true:已存在;false:不存在
* @param map
* @return
*/
Boolean getExist(Map<String, String> map);
List<SupplierInfo> getAllInIds(String ids);
List<SupplierInfo> getAllInContractByContractId(Integer contractId,Map<String,String> map);
}
|
UTF-8
|
Java
| 638 |
java
|
SupplierDao.java
|
Java
|
[] | null |
[] |
package com.manage.dao;
import java.util.List;
import java.util.Map;
import com.manage.model.SupplierInfo;
import com.manage.model.WebPage;
public interface SupplierDao {
SupplierInfo getById(Integer id);
WebPage<SupplierInfo> getAll(Map<String, String> map, Boolean hasPage);
Integer save(SupplierInfo supplierInfo);
Integer update(SupplierInfo supplierInfo);
/**
* true:已存在;false:不存在
* @param map
* @return
*/
Boolean getExist(Map<String, String> map);
List<SupplierInfo> getAllInIds(String ids);
List<SupplierInfo> getAllInContractByContractId(Integer contractId,Map<String,String> map);
}
| 638 | 0.762903 | 0.762903 | 30 | 19.666666 | 23.16367 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.966667 | false | false |
5
|
99d2c008f8c0bb2013c09b059a3d61040882b65c
| 11,321,533,842,606 |
69cdccd5d3d772ed0b4ddd58fdf26aa011d69774
|
/app/src/main/java/solutions/silly/weatherstation/time/TimeView.java
|
5b12d9745104377f1649093b3b5a3fac2ed378d8
|
[] |
no_license
|
Olabraaten/WeatherStation
|
https://github.com/Olabraaten/WeatherStation
|
d90f62be0f3da569be26a6e17d1ddd6af5093143
|
1fbabfd5db7e3f83b869fc9c10ad66c34d551118
|
refs/heads/master
| 2019-07-13T19:52:04.335000 | 2017-03-28T19:58:07 | 2017-03-28T19:58:07 | 62,467,113 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package solutions.silly.weatherstation.time;
import solutions.silly.weatherstation.time.model.TimeViewModel;
public interface TimeView {
TimeViewModel getTimeViewModel();
}
|
UTF-8
|
Java
| 180 |
java
|
TimeView.java
|
Java
|
[] | null |
[] |
package solutions.silly.weatherstation.time;
import solutions.silly.weatherstation.time.model.TimeViewModel;
public interface TimeView {
TimeViewModel getTimeViewModel();
}
| 180 | 0.816667 | 0.816667 | 8 | 21.5 | 23.200216 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.375 | false | false |
5
|
a2fc5616de9f38f4e892fc1b5e986cfb08e0cb99
| 2,491,081,076,992 |
432cdb4adc648c8c545aff400127acdb4684166c
|
/routes-web/src/main/java/com/tbf/cibercolegios/core/DialogController.java
|
dc27809520864101466f09918adb1307b931cd2b
|
[] |
no_license
|
albam-osorio/orbitta-cibercolegios
|
https://github.com/albam-osorio/orbitta-cibercolegios
|
e4a9aefc0c5fbac7e3b6a5e76d90f7ba978efd91
|
e9e959e4e6ccec0316ea303496f398b2d6cf68ab
|
refs/heads/master
| 2020-03-07T10:41:01.298000 | 2019-07-31T12:33:55 | 2019-07-31T12:33:55 | 127,429,910 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.tbf.cibercolegios.core;
import org.primefaces.PrimeFaces;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public abstract class DialogController<T, E> extends AbstractController<E> {
private static final long serialVersionUID = 1L;
protected static final String DEFAULT_SUCCESS_MESSAGE = "La información se registró correctamente";
private T model;
@Setter(AccessLevel.PROTECTED)
private String dialogId;
public void openDialog(String dialogId, T model) {
this.setModel(model);
this.reset();
if (isInitialized()) {
this.showDialog(dialogId);
}
}
public void closeDialog() {
this.setInitialized(false);
this.hideDialog(getDialogId());
this.setDialogId(null);
this.clear();
this.setModel(null);
}
protected void showDialog(String dialogId) {
if (dialogId != null) {
if (!"".equals(dialogId.trim())) {
setDialogId(dialogId);
PrimeFaces.current().executeScript("PF('" + dialogId + "').show();");
}
}
}
protected void hideDialog(String dialogId) {
if (dialogId != null) {
if (!"".equals(dialogId.trim())) {
PrimeFaces.current().executeScript("PF('" + dialogId + "').hide();");
}
}
}
}
|
UTF-8
|
Java
| 1,210 |
java
|
DialogController.java
|
Java
|
[] | null |
[] |
package com.tbf.cibercolegios.core;
import org.primefaces.PrimeFaces;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public abstract class DialogController<T, E> extends AbstractController<E> {
private static final long serialVersionUID = 1L;
protected static final String DEFAULT_SUCCESS_MESSAGE = "La información se registró correctamente";
private T model;
@Setter(AccessLevel.PROTECTED)
private String dialogId;
public void openDialog(String dialogId, T model) {
this.setModel(model);
this.reset();
if (isInitialized()) {
this.showDialog(dialogId);
}
}
public void closeDialog() {
this.setInitialized(false);
this.hideDialog(getDialogId());
this.setDialogId(null);
this.clear();
this.setModel(null);
}
protected void showDialog(String dialogId) {
if (dialogId != null) {
if (!"".equals(dialogId.trim())) {
setDialogId(dialogId);
PrimeFaces.current().executeScript("PF('" + dialogId + "').show();");
}
}
}
protected void hideDialog(String dialogId) {
if (dialogId != null) {
if (!"".equals(dialogId.trim())) {
PrimeFaces.current().executeScript("PF('" + dialogId + "').hide();");
}
}
}
}
| 1,210 | 0.696192 | 0.695364 | 54 | 21.370371 | 22.619474 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.666667 | false | false |
5
|
1a2c1c019af7e3b084c95969971b5ac0ec7e8bf2
| 3,032,246,953,865 |
29b43e4523838cff46427bf49ba288f2a484f0f9
|
/src/WindowContent.java
|
750765ec9349ac3d7bd0fc3f7a2d9dbc0f961d82
|
[] |
no_license
|
kayellis/colony
|
https://github.com/kayellis/colony
|
53cf094cf8ea216cac43ab99686ea10cb16559dd
|
784a23c624e82ebadda3edf3b2cf74d0be3cc3b4
|
refs/heads/master
| 2016-04-02T11:11:18.739000 | 2014-06-04T14:01:54 | 2014-06-04T14:01:54 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
//Class to define the content to be painted
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JPanel;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.BorderLayout;
import java.awt.image.BufferedImage;
import java.util.HashMap;
public class WindowContent extends JPanel {
// Constants
private int width;
private int height;
private Window window;
private Color BACKGROUND_COLOR = Color.BLACK;
private World world;
private ImageCollection ic;
public WindowContent(Window window, int width, int height) {
this.width = width;
this.height = height;
this.window = window;
Dimension dim = new Dimension(width, height);
setVisible(true);
setLayout(new BorderLayout());
setPreferredSize(dim);
setBackground(BACKGROUND_COLOR);
// Load images into the program
ic = new ImageCollection();
ic.loadImages();
this.world = new World(this);
}
public void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D)g.create();
super.paintComponent(g2d);
world.paint(g2d);
g2d.dispose();
}
// set and get methods
public World getWorld() {
return world;
}
public Window getWindow() {
return window;
}
public HashMap<String, BufferedImage> getImageCollection() {
return ic.getMap();
}
}
|
UTF-8
|
Java
| 1,549 |
java
|
WindowContent.java
|
Java
|
[] | null |
[] |
//Class to define the content to be painted
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JPanel;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.BorderLayout;
import java.awt.image.BufferedImage;
import java.util.HashMap;
public class WindowContent extends JPanel {
// Constants
private int width;
private int height;
private Window window;
private Color BACKGROUND_COLOR = Color.BLACK;
private World world;
private ImageCollection ic;
public WindowContent(Window window, int width, int height) {
this.width = width;
this.height = height;
this.window = window;
Dimension dim = new Dimension(width, height);
setVisible(true);
setLayout(new BorderLayout());
setPreferredSize(dim);
setBackground(BACKGROUND_COLOR);
// Load images into the program
ic = new ImageCollection();
ic.loadImages();
this.world = new World(this);
}
public void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D)g.create();
super.paintComponent(g2d);
world.paint(g2d);
g2d.dispose();
}
// set and get methods
public World getWorld() {
return world;
}
public Window getWindow() {
return window;
}
public HashMap<String, BufferedImage> getImageCollection() {
return ic.getMap();
}
}
| 1,549 | 0.641704 | 0.637185 | 65 | 22.830769 | 17.108315 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.584615 | false | false |
5
|
b511a6bc2f3f454666577bf57e758d021eecead4
| 12,987,981,134,507 |
489dba3dfcd26c72dbb78e5ee9babb9c5001f2fe
|
/src/main/java/com/simibubi/create/foundation/advancement/CriterionTriggerBase.java
|
e58b48f7380773f08cf3445179939df3a3d493fb
|
[
"MIT"
] |
permissive
|
3prm3/Create-Fabric-Old
|
https://github.com/3prm3/Create-Fabric-Old
|
e8ad8c01167201a1ef8a223bfa8f3d37332f0d2c
|
761852f8f8b860c7e3932633fb030adcf64d1929
|
refs/heads/master
| 2023-03-21T01:54:59.853000 | 2021-03-18T18:34:02 | 2021-03-18T18:34:02 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.simibubi.create.foundation.advancement;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Supplier;
import org.jetbrains.annotations.Nullable;
import com.google.common.collect.Maps;
import com.simibubi.create.Create;
import com.simibubi.create.registrate.util.nullness.MethodsReturnNonnullByDefault;
import com.simibubi.create.registrate.util.nullness.ParametersAreNonnullByDefault;
import net.minecraft.advancement.PlayerAdvancementTracker;
import net.minecraft.advancement.criterion.AbstractCriterionConditions;
import net.minecraft.advancement.criterion.Criterion;
import net.minecraft.predicate.entity.EntityPredicate;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public abstract class CriterionTriggerBase<T extends CriterionTriggerBase.Instance> implements Criterion<T> {
public CriterionTriggerBase(String id) {
this.ID = new Identifier(Create.ID, id);
}
private final Identifier ID;
protected final Map<PlayerAdvancementTracker, Set<ConditionsContainer<T>>> listeners = Maps.newHashMap();
@Override
public void beginTrackingCondition(PlayerAdvancementTracker playerAdvancementsIn, ConditionsContainer<T> listener) {
Set<ConditionsContainer<T>> playerListeners = this.listeners.computeIfAbsent(playerAdvancementsIn, k -> new HashSet<>());
playerListeners.add(listener);
}
@Override
public void endTrackingCondition(PlayerAdvancementTracker playerAdvancementsIn, ConditionsContainer<T> listener) {
Set<ConditionsContainer<T>> playerListeners = this.listeners.get(playerAdvancementsIn);
if (playerListeners != null){
playerListeners.remove(listener);
if (playerListeners.isEmpty()){
this.listeners.remove(playerAdvancementsIn);
}
}
}
@Override
public void endTracking(PlayerAdvancementTracker playerAdvancementsIn) {
this.listeners.remove(playerAdvancementsIn);
}
@Override
public Identifier getId() {
return ID;
}
protected void trigger(ServerPlayerEntity player, @Nullable List<Supplier<Object>> suppliers){
PlayerAdvancementTracker playerAdvancements = player.getAdvancementTracker();
Set<ConditionsContainer<T>> playerListeners = this.listeners.get(playerAdvancements);
if (playerListeners != null){
List<ConditionsContainer<T>> list = new LinkedList<>();
for (ConditionsContainer<T> listener :
playerListeners) {
if (listener.getConditions().test(suppliers)) {
list.add(listener);
}
}
list.forEach(listener -> listener.grant(playerAdvancements));
}
}
public abstract static class Instance extends AbstractCriterionConditions {
public Instance(Identifier idIn, EntityPredicate.Extended p_i231464_2_) {
super(idIn, p_i231464_2_);
}
protected abstract boolean test(@Nullable List<Supplier<Object>> suppliers);
}
}
|
UTF-8
|
Java
| 2,959 |
java
|
CriterionTriggerBase.java
|
Java
|
[] | null |
[] |
package com.simibubi.create.foundation.advancement;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Supplier;
import org.jetbrains.annotations.Nullable;
import com.google.common.collect.Maps;
import com.simibubi.create.Create;
import com.simibubi.create.registrate.util.nullness.MethodsReturnNonnullByDefault;
import com.simibubi.create.registrate.util.nullness.ParametersAreNonnullByDefault;
import net.minecraft.advancement.PlayerAdvancementTracker;
import net.minecraft.advancement.criterion.AbstractCriterionConditions;
import net.minecraft.advancement.criterion.Criterion;
import net.minecraft.predicate.entity.EntityPredicate;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public abstract class CriterionTriggerBase<T extends CriterionTriggerBase.Instance> implements Criterion<T> {
public CriterionTriggerBase(String id) {
this.ID = new Identifier(Create.ID, id);
}
private final Identifier ID;
protected final Map<PlayerAdvancementTracker, Set<ConditionsContainer<T>>> listeners = Maps.newHashMap();
@Override
public void beginTrackingCondition(PlayerAdvancementTracker playerAdvancementsIn, ConditionsContainer<T> listener) {
Set<ConditionsContainer<T>> playerListeners = this.listeners.computeIfAbsent(playerAdvancementsIn, k -> new HashSet<>());
playerListeners.add(listener);
}
@Override
public void endTrackingCondition(PlayerAdvancementTracker playerAdvancementsIn, ConditionsContainer<T> listener) {
Set<ConditionsContainer<T>> playerListeners = this.listeners.get(playerAdvancementsIn);
if (playerListeners != null){
playerListeners.remove(listener);
if (playerListeners.isEmpty()){
this.listeners.remove(playerAdvancementsIn);
}
}
}
@Override
public void endTracking(PlayerAdvancementTracker playerAdvancementsIn) {
this.listeners.remove(playerAdvancementsIn);
}
@Override
public Identifier getId() {
return ID;
}
protected void trigger(ServerPlayerEntity player, @Nullable List<Supplier<Object>> suppliers){
PlayerAdvancementTracker playerAdvancements = player.getAdvancementTracker();
Set<ConditionsContainer<T>> playerListeners = this.listeners.get(playerAdvancements);
if (playerListeners != null){
List<ConditionsContainer<T>> list = new LinkedList<>();
for (ConditionsContainer<T> listener :
playerListeners) {
if (listener.getConditions().test(suppliers)) {
list.add(listener);
}
}
list.forEach(listener -> listener.grant(playerAdvancements));
}
}
public abstract static class Instance extends AbstractCriterionConditions {
public Instance(Identifier idIn, EntityPredicate.Extended p_i231464_2_) {
super(idIn, p_i231464_2_);
}
protected abstract boolean test(@Nullable List<Supplier<Object>> suppliers);
}
}
| 2,959 | 0.796553 | 0.791822 | 91 | 31.516483 | 33.530487 | 123 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.527472 | false | false |
5
|
e5f94f21202f0a96de3f44e50ebe74d4ad86128e
| 31,155,692,779,474 |
99cbd6f329c21ef0e75082fedae229e785531c9e
|
/Ej13_REST_Servicio/src/com/curso/modelo/negocio/GestorPeliculas.java
|
5ca88c5c67674acef0c547e21f766e538b216c11
|
[] |
no_license
|
Fsgilp/seguridad_java
|
https://github.com/Fsgilp/seguridad_java
|
ad331582e4fa67acf7109fd6d09eb2643d2ef450
|
ea48ad983102377a6c7b81c291140aa453ae37b6
|
refs/heads/master
| 2023-03-30T11:45:47.341000 | 2021-04-06T16:00:07 | 2021-04-06T16:00:07 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.curso.modelo.negocio;
import java.util.ArrayList;
import java.util.List;
import com.curso.modelo.entidad.Pelicula;
public class GestorPeliculas {
private static List<Pelicula> peliculas;
static{
peliculas = new ArrayList<>();
peliculas.add(new Pelicula(1,"2001","Stanley Kubrik","Ci-Fi","1968"));
peliculas.add(new Pelicula(2,"Alien","Ridley Scott","Ci-Fi","1979"));
peliculas.add(new Pelicula(3,"Die Hard","John McTiernan","Accion","1988"));
peliculas.add(new Pelicula(4,"Young Frankenstein","Mel Brooks","Comedia","1974"));
peliculas.add(new Pelicula(5,"Moon","Duncan Jones","Ci-Fi","2009"));
peliculas.add(new Pelicula(6,"El bueno, el feo y el malo","Sergio Leone","Western","1968"));
}
public void insertarPelicula(Pelicula pelicula){
System.out.println("Insertando la pelicula:"+pelicula.getTitulo());
pelicula.setId(peliculas.size()+1);
peliculas.add(pelicula);
}
public List<Pelicula> listarPeliculas(){
return peliculas;
}
public Pelicula buscarPelicula(Integer id){
return peliculas.get(id-1);
}
}
|
UTF-8
|
Java
| 1,062 |
java
|
GestorPeliculas.java
|
Java
|
[
{
"context": "yList<>();\n\t\tpeliculas.add(new Pelicula(1,\"2001\",\"Stanley Kubrik\",\"Ci-Fi\",\"1968\"));\n\t\tpeliculas.add(new Pelicula(2",
"end": 301,
"score": 0.9998990893363953,
"start": 287,
"tag": "NAME",
"value": "Stanley Kubrik"
},
{
"context": "\"Ci-Fi\",\"1968\"));\n\t\tpeliculas.add(new Pelicula(2,\"Alien\",\"Ridley Scott\",\"Ci-Fi\",\"1979\"));\n\t\tpeliculas.add",
"end": 358,
"score": 0.99979567527771,
"start": 353,
"tag": "NAME",
"value": "Alien"
},
{
"context": "\"1968\"));\n\t\tpeliculas.add(new Pelicula(2,\"Alien\",\"Ridley Scott\",\"Ci-Fi\",\"1979\"));\n\t\tpeliculas.add(new Pelicula(3",
"end": 373,
"score": 0.9998955726623535,
"start": 361,
"tag": "NAME",
"value": "Ridley Scott"
},
{
"context": "\"Ci-Fi\",\"1979\"));\n\t\tpeliculas.add(new Pelicula(3,\"Die Hard\",\"John McTiernan\",\"Accion\",\"1988\"));\n\t\tpeliculas.",
"end": 433,
"score": 0.9998805522918701,
"start": 425,
"tag": "NAME",
"value": "Die Hard"
},
{
"context": "79\"));\n\t\tpeliculas.add(new Pelicula(3,\"Die Hard\",\"John McTiernan\",\"Accion\",\"1988\"));\n\t\tpeliculas.add(new Pelicula(",
"end": 450,
"score": 0.9998970031738281,
"start": 436,
"tag": "NAME",
"value": "John McTiernan"
},
{
"context": "s.add(new Pelicula(3,\"Die Hard\",\"John McTiernan\",\"Accion\",\"1988\"));\n\t\tpeliculas.add(new Pelicula(4,\"Young ",
"end": 459,
"score": 0.7479687929153442,
"start": 453,
"tag": "NAME",
"value": "Accion"
},
{
"context": "Accion\",\"1988\"));\n\t\tpeliculas.add(new Pelicula(4,\"Young Frankenstein\",\"Mel Brooks\",\"Comedia\",\"1974\"));\n\t\tpeliculas.add",
"end": 521,
"score": 0.9998922944068909,
"start": 503,
"tag": "NAME",
"value": "Young Frankenstein"
},
{
"context": "eliculas.add(new Pelicula(4,\"Young Frankenstein\",\"Mel Brooks\",\"Comedia\",\"1974\"));\n\t\tpeliculas.add(new Pelicula",
"end": 534,
"score": 0.9998964071273804,
"start": 524,
"tag": "NAME",
"value": "Mel Brooks"
},
{
"context": ",\"1974\"));\n\t\tpeliculas.add(new Pelicula(5,\"Moon\",\"Duncan Jones\",\"Ci-Fi\",\"2009\"));\n\t\tpeliculas.add(new Pelicula(6",
"end": 607,
"score": 0.9998613595962524,
"start": 595,
"tag": "NAME",
"value": "Duncan Jones"
},
{
"context": ".add(new Pelicula(6,\"El bueno, el feo y el malo\",\"Sergio Leone\",\"Western\",\"1968\"));\n\t}\n\n\tpublic void insertarPel",
"end": 700,
"score": 0.9998900890350342,
"start": 688,
"tag": "NAME",
"value": "Sergio Leone"
}
] | null |
[] |
package com.curso.modelo.negocio;
import java.util.ArrayList;
import java.util.List;
import com.curso.modelo.entidad.Pelicula;
public class GestorPeliculas {
private static List<Pelicula> peliculas;
static{
peliculas = new ArrayList<>();
peliculas.add(new Pelicula(1,"2001","<NAME>","Ci-Fi","1968"));
peliculas.add(new Pelicula(2,"Alien","<NAME>","Ci-Fi","1979"));
peliculas.add(new Pelicula(3,"<NAME>","<NAME>","Accion","1988"));
peliculas.add(new Pelicula(4,"<NAME>","<NAME>","Comedia","1974"));
peliculas.add(new Pelicula(5,"Moon","<NAME>","Ci-Fi","2009"));
peliculas.add(new Pelicula(6,"El bueno, el feo y el malo","<NAME>","Western","1968"));
}
public void insertarPelicula(Pelicula pelicula){
System.out.println("Insertando la pelicula:"+pelicula.getTitulo());
pelicula.setId(peliculas.size()+1);
peliculas.add(pelicula);
}
public List<Pelicula> listarPeliculas(){
return peliculas;
}
public Pelicula buscarPelicula(Integer id){
return peliculas.get(id-1);
}
}
| 1,010 | 0.718456 | 0.684557 | 37 | 27.702703 | 28.59112 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.027027 | false | false |
5
|
e31f4e4622fbe8ebd3cb5f193a2867da5fc21a56
| 19,739,669,693,406 |
f815a9f87097ad06c8cdbc0f09b2a749b2565f6d
|
/App/src/main/java/com/example/capston_project/WeightReporter.java
|
05152bcbeaaefc34370da3f66889ffdd1984970c
|
[
"MIT"
] |
permissive
|
dewcked/BodyClockManager
|
https://github.com/dewcked/BodyClockManager
|
03726158fe69b0c69a456c78bc957559304b1452
|
7e997d57f1cd78acdc0a5ebd5a15e5ea67b8306c
|
refs/heads/main
| 2021-05-18T12:00:42.914000 | 2020-12-31T03:23:31 | 2020-12-31T03:23:31 | 251,236,110 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.capston_project;
public class WeightReporter {
}
|
UTF-8
|
Java
| 70 |
java
|
WeightReporter.java
|
Java
|
[] | null |
[] |
package com.example.capston_project;
public class WeightReporter {
}
| 70 | 0.8 | 0.8 | 4 | 16.5 | 16.194136 | 36 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false |
5
|
54bfe6137b12c6d7b1293a215eba1fa6d3769cf6
| 29,085,518,537,587 |
ca03451c8075909e53a3919590a78cebf73a56d1
|
/Circular_linkedlist.java
|
1f8f21bcd1dbd9d8fe2bf2c053f15e0a42a0f354
|
[] |
no_license
|
Dedeyandrekasyaputra/single.linklist
|
https://github.com/Dedeyandrekasyaputra/single.linklist
|
9b3a661b41431b1e04170abe3ab32aedf0e2c04f
|
9d2be7f34a04ca44a9266d0ed14414ea13152385
|
refs/heads/main
| 2023-08-24T17:58:00.310000 | 2021-10-26T01:40:13 | 2021-10-26T01:40:13 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package circular_linkedlist;
public class Circular_linkedlist {
static class Node{
int data;
Node next;
}
static Node addtoempty(Node last, int data){
if (last != null)
return last;
Node temp =new Node();
temp.data=data;
last=temp;
last.next=last;
return last;
}
static Node addbegin(Node last, int data){
if(last == null)
return addtoempty(last,data);
Node temp =new Node();
temp.data =data;
temp.next=last.next;
last.next=temp;
return last;
}
static Node addend(Node last, int data){
if (last== null)
return addtoempty(last, data);
Node temp =new Node();
temp.data=data;
temp.next=last.next;
last.next=temp;
last=temp;
return last;
}
static Node addafter(Node last, int data, int item){
if (last== null)
return null;
Node temp, p;
p=last.next;
do{
if (p.data ==item){
temp=new Node();
temp.data=data;
temp.next=p.next;
p.next=temp;
if (p == last)
last=temp;
return last;
}
p=p.next;
}
while(p !=last.next);
System.out.println(item + "tidak ada present dalam list");
return last;
}
static void traverse(Node last){
Node p;
if (last == null){
System.out.println("List is Empty.");
return;
}
p = last.next;
do{
System.out.print(p.data + " ");
p = p.next;
}
while (p != last.next);
}
public static void main(String[] args) {
Node last = null;
last = addtoempty(last, 6);
last = addbegin(last, 4);
last = addbegin(last, 3);
last = addend(last, 10);
last = addend(last, 9);
last = addend(last, 50);
last = addafter(last, 70, 9);
traverse(last);
System.out.println("");
}
}
|
UTF-8
|
Java
| 2,531 |
java
|
Circular_linkedlist.java
|
Java
|
[] | null |
[] |
package circular_linkedlist;
public class Circular_linkedlist {
static class Node{
int data;
Node next;
}
static Node addtoempty(Node last, int data){
if (last != null)
return last;
Node temp =new Node();
temp.data=data;
last=temp;
last.next=last;
return last;
}
static Node addbegin(Node last, int data){
if(last == null)
return addtoempty(last,data);
Node temp =new Node();
temp.data =data;
temp.next=last.next;
last.next=temp;
return last;
}
static Node addend(Node last, int data){
if (last== null)
return addtoempty(last, data);
Node temp =new Node();
temp.data=data;
temp.next=last.next;
last.next=temp;
last=temp;
return last;
}
static Node addafter(Node last, int data, int item){
if (last== null)
return null;
Node temp, p;
p=last.next;
do{
if (p.data ==item){
temp=new Node();
temp.data=data;
temp.next=p.next;
p.next=temp;
if (p == last)
last=temp;
return last;
}
p=p.next;
}
while(p !=last.next);
System.out.println(item + "tidak ada present dalam list");
return last;
}
static void traverse(Node last){
Node p;
if (last == null){
System.out.println("List is Empty.");
return;
}
p = last.next;
do{
System.out.print(p.data + " ");
p = p.next;
}
while (p != last.next);
}
public static void main(String[] args) {
Node last = null;
last = addtoempty(last, 6);
last = addbegin(last, 4);
last = addbegin(last, 3);
last = addend(last, 10);
last = addend(last, 9);
last = addend(last, 50);
last = addafter(last, 70, 9);
traverse(last);
System.out.println("");
}
}
| 2,531 | 0.400632 | 0.396286 | 106 | 21.896227 | 13.683711 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.641509 | false | false |
5
|
aec7b63ed133cbb432cc69f7dac82f9385ea1ec2
| 10,763,188,061,096 |
f22ad12a27124d3348b7f8c169e636fa4c29de8d
|
/MLocator/src/main/java/srt/inz/mlocator/MainPage.java
|
d13a5c3591cd117203d20cc57a3d8be78dc89e48
|
[] |
no_license
|
ramdasinzenjer/MLocator_working
|
https://github.com/ramdasinzenjer/MLocator_working
|
00a0ef4d7315db768c42ee6074f67f853f65b9a9
|
88671c9b3a09d4fb1fe90fe20f9d9eb5f7cc3b75
|
refs/heads/master
| 2021-07-08T22:00:21.903000 | 2017-10-09T10:45:32 | 2017-10-09T10:45:32 | 106,270,991 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package srt.inz.mlocator;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
public class MainPage extends Activity {
TextView t;
Button lo,re;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_page);
t=(TextView)findViewById(R.id.wel);
lo=(Button)findViewById(R.id.log);
re=(Button)findViewById(R.id.regi);
lo.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent i = new Intent(getApplicationContext(), Login.class);
startActivity(i);
}
});
re.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent i = new Intent(getApplicationContext(), Register.class);
startActivity(i);
}
});
}
}
|
UTF-8
|
Java
| 1,156 |
java
|
MainPage.java
|
Java
|
[] | null |
[] |
package srt.inz.mlocator;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
public class MainPage extends Activity {
TextView t;
Button lo,re;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_page);
t=(TextView)findViewById(R.id.wel);
lo=(Button)findViewById(R.id.log);
re=(Button)findViewById(R.id.regi);
lo.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent i = new Intent(getApplicationContext(), Login.class);
startActivity(i);
}
});
re.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent i = new Intent(getApplicationContext(), Register.class);
startActivity(i);
}
});
}
}
| 1,156 | 0.65917 | 0.65917 | 51 | 21.666666 | 18.922615 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.862745 | false | false |
5
|
55fa0b69e3c501073f4934f8eb72d5c3f81685a5
| 721,554,509,649 |
3946bd1611ff9f2e5d9490bd3563e935256721f7
|
/src/main/boj/level/bronze3/Boj11022.java
|
ad43bdb2ddfbd9b5f9316f9660a0109130abc726
|
[] |
no_license
|
jinsuSang/java-algorithm
|
https://github.com/jinsuSang/java-algorithm
|
31118020c9edf87e6c00d6f9bdcdda4d92593ebe
|
73946657d29467d88afd5e7292c7a33f6cd774ea
|
refs/heads/main
| 2023-06-17T14:45:42.954000 | 2021-07-13T13:37:50 | 2021-07-13T13:37:50 | 361,772,016 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package main.boj.level.bronze3;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Boj11022 {
public static void main(String[] args) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st;
StringBuilder sb = new StringBuilder();
try {
int t = Integer.parseInt(br.readLine());
for (int i = 0; i < t; i++) {
st = new StringTokenizer(br.readLine());
int a = Integer.parseInt(st.nextToken());
int b = Integer.parseInt(st.nextToken());
sb.append("Case #")
.append(i + 1)
.append(": ").append(a).append(" + ").append(b)
.append(" = ").append(a + b).append('\n');
}
System.out.print(sb);
} catch (IOException e) {
e.printStackTrace();
}
}
}
|
UTF-8
|
Java
| 1,022 |
java
|
Boj11022.java
|
Java
|
[] | null |
[] |
package main.boj.level.bronze3;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Boj11022 {
public static void main(String[] args) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st;
StringBuilder sb = new StringBuilder();
try {
int t = Integer.parseInt(br.readLine());
for (int i = 0; i < t; i++) {
st = new StringTokenizer(br.readLine());
int a = Integer.parseInt(st.nextToken());
int b = Integer.parseInt(st.nextToken());
sb.append("Case #")
.append(i + 1)
.append(": ").append(a).append(" + ").append(b)
.append(" = ").append(a + b).append('\n');
}
System.out.print(sb);
} catch (IOException e) {
e.printStackTrace();
}
}
}
| 1,022 | 0.528376 | 0.520548 | 34 | 29.058823 | 22.851105 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
5
|
192679befb3e46d4ead6731afb42e16c69ff772f
| 2,456,721,302,273 |
cbf03ee57e00d7782afd975d95259687870135a8
|
/src/main/java/club/luhuishan/web/service/IndexService.java
|
65b480b43bc92e4ab7f17f89a86b5e49a8a1f8ae
|
[] |
no_license
|
vilens/lhs-web
|
https://github.com/vilens/lhs-web
|
4635f92658a58d4d7754078187f45d4b69ad6fd8
|
2ed67353388523b0234996dadcf6ed6a9e8c38c6
|
refs/heads/master
| 2020-03-21T15:17:22.107000 | 2018-06-26T07:55:04 | 2018-06-26T07:55:04 | 138,704,005 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package club.luhuishan.web.service;
import club.luhuishan.web.domain.po.Product;
import club.luhuishan.web.mapper.ProductMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Created by vilens on 2018/6/13.
*/
@Service
public class IndexService {
@Autowired
ProductMapper productMapper;
public List<Product> randomRefresh(Integer limit){
return productMapper.randomRefresh(limit);
}
}
|
UTF-8
|
Java
| 509 |
java
|
IndexService.java
|
Java
|
[
{
"context": "ervice;\n\nimport java.util.List;\n\n/**\n * Created by vilens on 2018/6/13.\n */\n@Service\npublic class IndexServ",
"end": 289,
"score": 0.9996280074119568,
"start": 283,
"tag": "USERNAME",
"value": "vilens"
}
] | null |
[] |
package club.luhuishan.web.service;
import club.luhuishan.web.domain.po.Product;
import club.luhuishan.web.mapper.ProductMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Created by vilens on 2018/6/13.
*/
@Service
public class IndexService {
@Autowired
ProductMapper productMapper;
public List<Product> randomRefresh(Integer limit){
return productMapper.randomRefresh(limit);
}
}
| 509 | 0.766208 | 0.752456 | 22 | 22.136364 | 20.957306 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.363636 | false | false |
5
|
463fc1f4a5a4c7fe38a16dde04234b3e8ba57bff
| 27,041,114,138,490 |
e43360f16d8139392c7da37cd25e7e3e8e697eb9
|
/src/main/java/tues_thurs_sat/_202110/_20211005/PGM17686_FileNameSorting.java
|
10a9dcbfbe041365cafd266c4227b9eb100c4a37
|
[] |
no_license
|
KBY-TECH/codingTest
|
https://github.com/KBY-TECH/codingTest
|
3b0b73d1907b3ae04c51dbc8c1b4ec9ee916b165
|
a4eb5aba9d6cae50a2fa7f82e9521f5de6d09977
|
refs/heads/master
| 2023-03-24T12:23:14.301000 | 2023-03-24T09:19:30 | 2023-03-24T09:19:30 | 304,711,348 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package tues_thurs_sat._202110._20211005;
import java.util.*;
public class PGM17686_FileNameSorting {
public String[] solution(String[] files) {
Arrays.sort(files, new Comparator<String>(){
@Override
public int compare(String s1,String s2){
String[] one=divide(s1.toLowerCase());
String[] two=divide(s2.toLowerCase());
// System.out.println(Arrays.toString(one));
// System.out.println(Arrays.toString(two));
int headDiff=one[0].compareTo(two[0]);
if(headDiff==0){
int intVal1=Integer.parseInt(one[1]);
int intVal2=Integer.parseInt(two[1]);
return intVal1-intVal2;
}
return headDiff;
}
public String[] divide(String str){
String ret[]=new String[3];
StringBuffer head=new StringBuffer();
StringBuffer number=new StringBuffer();
StringBuffer tail=new StringBuffer();
int flag=1;
for(int i=0; i<str.length(); i++){
char ch=str.charAt(i);
if(flag==1){
if(Character.isDigit(ch)){
i--;
flag=2;
continue;
}
head.append(ch);
}else if(flag==2){
if(!Character.isDigit(ch)){
i--;
flag=3;
continue;
}
number.append(ch);
}else if(flag==3){
tail.append(ch);
}
}
return new String[]{head.toString(),number.toString(),tail.toString()};
}
});
return files;
}
}
|
UTF-8
|
Java
| 1,991 |
java
|
PGM17686_FileNameSorting.java
|
Java
|
[] | null |
[] |
package tues_thurs_sat._202110._20211005;
import java.util.*;
public class PGM17686_FileNameSorting {
public String[] solution(String[] files) {
Arrays.sort(files, new Comparator<String>(){
@Override
public int compare(String s1,String s2){
String[] one=divide(s1.toLowerCase());
String[] two=divide(s2.toLowerCase());
// System.out.println(Arrays.toString(one));
// System.out.println(Arrays.toString(two));
int headDiff=one[0].compareTo(two[0]);
if(headDiff==0){
int intVal1=Integer.parseInt(one[1]);
int intVal2=Integer.parseInt(two[1]);
return intVal1-intVal2;
}
return headDiff;
}
public String[] divide(String str){
String ret[]=new String[3];
StringBuffer head=new StringBuffer();
StringBuffer number=new StringBuffer();
StringBuffer tail=new StringBuffer();
int flag=1;
for(int i=0; i<str.length(); i++){
char ch=str.charAt(i);
if(flag==1){
if(Character.isDigit(ch)){
i--;
flag=2;
continue;
}
head.append(ch);
}else if(flag==2){
if(!Character.isDigit(ch)){
i--;
flag=3;
continue;
}
number.append(ch);
}else if(flag==3){
tail.append(ch);
}
}
return new String[]{head.toString(),number.toString(),tail.toString()};
}
});
return files;
}
}
| 1,991 | 0.412858 | 0.392767 | 53 | 36.566036 | 17.73868 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.660377 | false | false |
5
|
a2ea1e35e887bff1a902e28ee891d1bd2cf88cce
| 21,749,714,427,072 |
14ad53c94114fa80964f425d302cb060dfd68605
|
/topcom-webservice/webservice-yuqing/src/main/java/com/topcom/cms/yuqing/utils/UrlDomain.java
|
a72dbdb6ccf08240ffb98cdc3c703aeb3b2c0925
|
[] |
no_license
|
545314690/topcom-cloud
|
https://github.com/545314690/topcom-cloud
|
1007eac6b6f999a00dde63b7384b611d5834414f
|
2d622f7c059009ac3572cdc268e93a54364379b1
|
refs/heads/master
| 2021-09-16T17:01:33.267000 | 2018-04-17T05:39:54 | 2018-04-17T05:39:54 | 103,539,011 | 3 | 2 | null | false | 2018-06-22T08:21:47 | 2017-09-14T13:58:05 | 2018-04-17T05:40:18 | 2018-06-22T08:20:49 | 727 | 2 | 1 | 1 |
Java
| false | null |
package com.topcom.cms.yuqing.utils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
*
* @ClassName: UrlDomain
* @Description:截取网站地址域名
* @author: 邵磊
* @date: 2014年7月10日 下午3:37:14
*/
public class UrlDomain {
public static String urlDamain(String url) {
Pattern p = Pattern.compile("(?<=//|)((\\w)+\\.)+\\w+");
Matcher m = p.matcher(url);
String domainUrl = null;
if (m.find()) {
domainUrl = m.group();
}
return domainUrl;
}
public static void main(String[] args) {
// String url = "http://www.cn-cg.com/index.php/newslist/index/";
// String url = "http://news.sogou.com/site:ifeng.com";
String url = "http://www.anhuimj.gov.cn/master/webchannel!detail_new.action?cmsContent.infoId=14997&channel.channelId=50&parent.channelId=-9999";
System.out.println(urlDamain(url));
}
}
|
UTF-8
|
Java
| 865 |
java
|
UrlDomain.java
|
Java
|
[
{
"context": "e: UrlDomain\n * @Description:截取网站地址域名\n * @author: 邵磊\n * @date: 2014年7月10日 下午3:37:14\n */\npublic class U",
"end": 175,
"score": 0.9997513294219971,
"start": 173,
"tag": "NAME",
"value": "邵磊"
}
] | null |
[] |
package com.topcom.cms.yuqing.utils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
*
* @ClassName: UrlDomain
* @Description:截取网站地址域名
* @author: 邵磊
* @date: 2014年7月10日 下午3:37:14
*/
public class UrlDomain {
public static String urlDamain(String url) {
Pattern p = Pattern.compile("(?<=//|)((\\w)+\\.)+\\w+");
Matcher m = p.matcher(url);
String domainUrl = null;
if (m.find()) {
domainUrl = m.group();
}
return domainUrl;
}
public static void main(String[] args) {
// String url = "http://www.cn-cg.com/index.php/newslist/index/";
// String url = "http://news.sogou.com/site:ifeng.com";
String url = "http://www.anhuimj.gov.cn/master/webchannel!detail_new.action?cmsContent.infoId=14997&channel.channelId=50&parent.channelId=-9999";
System.out.println(urlDamain(url));
}
}
| 865 | 0.669461 | 0.641916 | 37 | 21.567568 | 28.160295 | 147 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.081081 | false | false |
5
|
e91278ab5b02326b7143bc7f6bfa7ade0d6b1727
| 38,929,583,604,738 |
8ee718cd45afbb20d3505cc8f67f2de7c891b43a
|
/GeekForGeeks/src/main/java/org/lv/ipractices/geekforgeeks/string/MaximumCharInString.java
|
6835888864dc2a7ecb8dfb8daaaaee8ceaa4234d
|
[] |
no_license
|
ltamang977/IPractices
|
https://github.com/ltamang977/IPractices
|
b65536dbcac517eb3358756ff2c41e6ab0caed81
|
4a011a1157e884ef3cc53ba0dca1a31cd3099cd2
|
refs/heads/master
| 2022-04-24T04:06:07.584000 | 2020-04-27T20:15:45 | 2020-04-27T20:15:45 | 259,440,570 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.lv.ipractices.geekforgeeks.string;
/**
* Created by root on 1/16/18.
*/
public class MaximumCharInString {
public static char findMaxChar(char[] chArr){
int[] occurences = new int[128];
//count occurences
for(char c : chArr){
occurences[c]++;
}
//find max
int maxIndex = 0;
for(int i= 0; i<128; i++){
if(occurences[i]>occurences[maxIndex]){
maxIndex=i;
}
}
return (char)maxIndex;
}
public static char findSecondMaxChar(char[] chArr){
int[] occurences = new int[128];
//count occurences
for(char c : chArr){
occurences[c]++;
}
//find max
int maxIndex = 0;
int secondMaxIndex =0;
for(int i= 0; i<128; i++){
if(occurences[i]>occurences[maxIndex]){
secondMaxIndex=maxIndex;
maxIndex=i;
}else if(occurences[i]>occurences[secondMaxIndex]){
secondMaxIndex=i;
}
}
return (char)secondMaxIndex;
}
public static void main(String[] args){
String input = "Hello there";
System.out.println("Max char is "+findMaxChar(input.toCharArray()));
System.out.println("Second Max char is "+findSecondMaxChar(input.toCharArray()));
}
}
|
UTF-8
|
Java
| 1,393 |
java
|
MaximumCharInString.java
|
Java
|
[
{
"context": "ipractices.geekforgeeks.string;\n\n/**\n * Created by root on 1/16/18.\n */\npublic class MaximumCharInString ",
"end": 70,
"score": 0.9970507621765137,
"start": 66,
"tag": "USERNAME",
"value": "root"
}
] | null |
[] |
package org.lv.ipractices.geekforgeeks.string;
/**
* Created by root on 1/16/18.
*/
public class MaximumCharInString {
public static char findMaxChar(char[] chArr){
int[] occurences = new int[128];
//count occurences
for(char c : chArr){
occurences[c]++;
}
//find max
int maxIndex = 0;
for(int i= 0; i<128; i++){
if(occurences[i]>occurences[maxIndex]){
maxIndex=i;
}
}
return (char)maxIndex;
}
public static char findSecondMaxChar(char[] chArr){
int[] occurences = new int[128];
//count occurences
for(char c : chArr){
occurences[c]++;
}
//find max
int maxIndex = 0;
int secondMaxIndex =0;
for(int i= 0; i<128; i++){
if(occurences[i]>occurences[maxIndex]){
secondMaxIndex=maxIndex;
maxIndex=i;
}else if(occurences[i]>occurences[secondMaxIndex]){
secondMaxIndex=i;
}
}
return (char)secondMaxIndex;
}
public static void main(String[] args){
String input = "Hello there";
System.out.println("Max char is "+findMaxChar(input.toCharArray()));
System.out.println("Second Max char is "+findSecondMaxChar(input.toCharArray()));
}
}
| 1,393 | 0.53051 | 0.514716 | 64 | 20.765625 | 20.910332 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.328125 | false | false |
5
|
fd4f84bd652054211a70a555f006e648059f5f7f
| 13,554,916,848,578 |
89d32a9dad54f75f9c238d36a9ce2eb15d5dc5e6
|
/src/es/unex/cum/iiisa/io/Entrada.java
|
e4e0c867d399f2de79ca82ecdaab219659bd33fa
|
[] |
no_license
|
jjpulidov/pathfinder
|
https://github.com/jjpulidov/pathfinder
|
053a8f5d2bc7fdc9bb7f696674f111b8b958d5fa
|
4aa2b2c4a5e28bfa5e1644cb6a0f2cee0826890d
|
refs/heads/master
| 2022-10-10T21:14:34.788000 | 2020-06-10T18:23:18 | 2020-06-10T18:23:18 | 268,878,309 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package es.unex.cum.iiisa.io;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Stream;
/**
* Clase que define el fichero de entrada y el procesamiento del mismo.
*/
public class Entrada {
/**
* Fichero de entrada obtenido desde el servlet.
*/
private final File fichero;
/**
* Identificador.
*/
private String identificador;
/**
* Tipo de valores de la matriz ["similaridad", "distancias"].
*/
private String tipoValores;
/**
* Número de nodos.
*/
private int n;
/**
* Número de decimales de los valores de la matriz.
*/
private int numDecimales;
/**
* Valor mínimo de los valores de la matriz.
*/
private double valorMin;
/**
* Valor máximo de los valores de la matriz.
*/
private double valorMax;
/**
* Número de pares (número de valores de la matriz distintos de 0).
*/
private int numPares;
/**
* Tipo de matriz ["simetrica", "asimetrica"].
*/
private String tipoMatriz;
/**
* Matriz de pesos generada a raíz de los pares de valores del fichero.
*/
private double[][] matriz;
/**
* Constructor por defecto. Recibe el fichero de entrada.
*
* @param fichero Fichero de entrada.
*/
public Entrada(File fichero) {
this.fichero = fichero;
}
/**
* Constructor parametrizado.
*
* @param identificador Identificador.
* @param tipoValores Tipo de valores de la matriz.
* @param n Número de nodos.
* @param numDecimales Número de dígitos decimales de los valores de la matriz.
* @param valorMin Valor mínimo de los valores de la matriz.
* @param valorMax Valor máximo de los valores de la matriz.
* @param numPares Número de pares.
* @param tipoMatriz Tipo de matriz.
* @param matriz Matriz de pesos.
*/
public Entrada(String identificador, String tipoValores, int n, int numDecimales, double valorMin, double valorMax, int numPares, String tipoMatriz, double[][] matriz) {
this.fichero = null;
this.identificador = identificador;
this.tipoValores = tipoValores;
this.n = n;
this.numDecimales = numDecimales;
this.valorMin = valorMin;
this.valorMax = valorMax;
this.numPares = numPares;
this.tipoMatriz = tipoMatriz;
this.matriz = matriz;
}
/**
* Método que procesa el fichero, obteniendo todos los atributos de la clase y la matriz de pesos que necesita el algoritmo.
*
* @throws IOException
*/
public void procesarFichero() throws IOException {
// Lectura del fichero de entrada
Charset charset = Charset.defaultCharset();
List<String> filas = Files.readAllLines(Objects.requireNonNull(fichero).toPath(), charset);
List<String> valoresString = new ArrayList<>();
// Instanciación línea a línea del fichero de entrada de los atributos
int cont = 0;
for (String fila : filas) {
switch (cont) {
case 0:
identificador = fila.trim();
break;
case 1:
tipoValores = fila.trim();
break;
case 2:
n = Integer.parseInt(fila.trim());
break;
case 3:
numDecimales = Integer.parseInt(fila.trim());
break;
case 4:
valorMin = Double.parseDouble(fila.trim());
break;
case 5:
valorMax = Double.parseDouble(fila.trim());
break;
case 6:
break;
case 7:
numPares = Integer.parseInt(fila.trim());
break;
case 8:
tipoMatriz = fila.trim();
break;
default:
valoresString.add(fila.trim());
break;
}
cont++;
}
// Instanciación de la matriz de pesos. Se instancian a 0 todas las posiciones menos la de los pares
matriz = new double[n][n];
double maximo = Double.NEGATIVE_INFINITY;
double minimo = Double.POSITIVE_INFINITY;
for (String fila : valoresString) {
double[] temp = Stream.of(fila.split("\\s+")).mapToDouble(Double::parseDouble).toArray();
// Si el valor del par se encuentra entre el mínimo y el máximo valor
if (temp[2] >= valorMin && temp[2] <= valorMax)
matriz[(int) temp[0] - 1][(int) temp[1] - 1] = temp[2];
// Se obtienen también el máximo y mínimo valor de la matriz por si la matriz es de similaridad y hay que pasarla a pesos
if (temp[2] > maximo)
maximo = temp[2];
if (temp[2] < minimo)
minimo = temp[2];
}
// Si la matriz es simétrica se instancia la triangular inferior
if (tipoMatriz.equals("simetrica")) {
for (int i = 0; i < matriz.length; i++) {
for (int j = 0; j < matriz[i].length; j++) {
if (j < i)
matriz[i][j] = matriz[j][i];
}
}
}
// Si la matriz es de similaridad se pasa a distancias
if (tipoValores.equals("similaridad")) {
for (int i = 0; i < matriz.length; i++) {
for (int j = 0; j < matriz[i].length; j++) {
if (matriz[i][j] != 0)
matriz[i][j] = maximo - matriz[i][j] + minimo;
}
}
}
// Muestra la matriz de pesos por consola
for (double[] doubles : matriz) {
for (double aDouble : doubles) {
System.out.print(aDouble + " ");
}
System.out.println();
}
}
public String getIdentificador() {
return identificador;
}
public String getTipoValores() {
return tipoValores;
}
public int getN() {
return n;
}
public int getNumDecimales() {
return numDecimales;
}
public double getValorMin() {
return valorMin;
}
public double getValorMax() {
return valorMax;
}
public String getTipoMatriz() {
return tipoMatriz;
}
public double[][] getMatriz() {
return matriz;
}
}
|
UTF-8
|
Java
| 6,771 |
java
|
Entrada.java
|
Java
|
[] | null |
[] |
package es.unex.cum.iiisa.io;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Stream;
/**
* Clase que define el fichero de entrada y el procesamiento del mismo.
*/
public class Entrada {
/**
* Fichero de entrada obtenido desde el servlet.
*/
private final File fichero;
/**
* Identificador.
*/
private String identificador;
/**
* Tipo de valores de la matriz ["similaridad", "distancias"].
*/
private String tipoValores;
/**
* Número de nodos.
*/
private int n;
/**
* Número de decimales de los valores de la matriz.
*/
private int numDecimales;
/**
* Valor mínimo de los valores de la matriz.
*/
private double valorMin;
/**
* Valor máximo de los valores de la matriz.
*/
private double valorMax;
/**
* Número de pares (número de valores de la matriz distintos de 0).
*/
private int numPares;
/**
* Tipo de matriz ["simetrica", "asimetrica"].
*/
private String tipoMatriz;
/**
* Matriz de pesos generada a raíz de los pares de valores del fichero.
*/
private double[][] matriz;
/**
* Constructor por defecto. Recibe el fichero de entrada.
*
* @param fichero Fichero de entrada.
*/
public Entrada(File fichero) {
this.fichero = fichero;
}
/**
* Constructor parametrizado.
*
* @param identificador Identificador.
* @param tipoValores Tipo de valores de la matriz.
* @param n Número de nodos.
* @param numDecimales Número de dígitos decimales de los valores de la matriz.
* @param valorMin Valor mínimo de los valores de la matriz.
* @param valorMax Valor máximo de los valores de la matriz.
* @param numPares Número de pares.
* @param tipoMatriz Tipo de matriz.
* @param matriz Matriz de pesos.
*/
public Entrada(String identificador, String tipoValores, int n, int numDecimales, double valorMin, double valorMax, int numPares, String tipoMatriz, double[][] matriz) {
this.fichero = null;
this.identificador = identificador;
this.tipoValores = tipoValores;
this.n = n;
this.numDecimales = numDecimales;
this.valorMin = valorMin;
this.valorMax = valorMax;
this.numPares = numPares;
this.tipoMatriz = tipoMatriz;
this.matriz = matriz;
}
/**
* Método que procesa el fichero, obteniendo todos los atributos de la clase y la matriz de pesos que necesita el algoritmo.
*
* @throws IOException
*/
public void procesarFichero() throws IOException {
// Lectura del fichero de entrada
Charset charset = Charset.defaultCharset();
List<String> filas = Files.readAllLines(Objects.requireNonNull(fichero).toPath(), charset);
List<String> valoresString = new ArrayList<>();
// Instanciación línea a línea del fichero de entrada de los atributos
int cont = 0;
for (String fila : filas) {
switch (cont) {
case 0:
identificador = fila.trim();
break;
case 1:
tipoValores = fila.trim();
break;
case 2:
n = Integer.parseInt(fila.trim());
break;
case 3:
numDecimales = Integer.parseInt(fila.trim());
break;
case 4:
valorMin = Double.parseDouble(fila.trim());
break;
case 5:
valorMax = Double.parseDouble(fila.trim());
break;
case 6:
break;
case 7:
numPares = Integer.parseInt(fila.trim());
break;
case 8:
tipoMatriz = fila.trim();
break;
default:
valoresString.add(fila.trim());
break;
}
cont++;
}
// Instanciación de la matriz de pesos. Se instancian a 0 todas las posiciones menos la de los pares
matriz = new double[n][n];
double maximo = Double.NEGATIVE_INFINITY;
double minimo = Double.POSITIVE_INFINITY;
for (String fila : valoresString) {
double[] temp = Stream.of(fila.split("\\s+")).mapToDouble(Double::parseDouble).toArray();
// Si el valor del par se encuentra entre el mínimo y el máximo valor
if (temp[2] >= valorMin && temp[2] <= valorMax)
matriz[(int) temp[0] - 1][(int) temp[1] - 1] = temp[2];
// Se obtienen también el máximo y mínimo valor de la matriz por si la matriz es de similaridad y hay que pasarla a pesos
if (temp[2] > maximo)
maximo = temp[2];
if (temp[2] < minimo)
minimo = temp[2];
}
// Si la matriz es simétrica se instancia la triangular inferior
if (tipoMatriz.equals("simetrica")) {
for (int i = 0; i < matriz.length; i++) {
for (int j = 0; j < matriz[i].length; j++) {
if (j < i)
matriz[i][j] = matriz[j][i];
}
}
}
// Si la matriz es de similaridad se pasa a distancias
if (tipoValores.equals("similaridad")) {
for (int i = 0; i < matriz.length; i++) {
for (int j = 0; j < matriz[i].length; j++) {
if (matriz[i][j] != 0)
matriz[i][j] = maximo - matriz[i][j] + minimo;
}
}
}
// Muestra la matriz de pesos por consola
for (double[] doubles : matriz) {
for (double aDouble : doubles) {
System.out.print(aDouble + " ");
}
System.out.println();
}
}
public String getIdentificador() {
return identificador;
}
public String getTipoValores() {
return tipoValores;
}
public int getN() {
return n;
}
public int getNumDecimales() {
return numDecimales;
}
public double getValorMin() {
return valorMin;
}
public double getValorMax() {
return valorMax;
}
public String getTipoMatriz() {
return tipoMatriz;
}
public double[][] getMatriz() {
return matriz;
}
}
| 6,771 | 0.535645 | 0.531495 | 218 | 29.949541 | 26.12834 | 173 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.426605 | false | false |
5
|
bca7e4ce1079afa0ffead45b36468a2b1f066ab5
| 5,789,615,971,358 |
b70b47323085802ce8b8c2279cf553e354e8c045
|
/src/test/java/xmlcases/FinanceProductCreation.java
|
e1b980bfb9f0e22e5ed0d32f0db1a24a37a39403
|
[] |
no_license
|
holagoldfish/WebUIauto
|
https://github.com/holagoldfish/WebUIauto
|
d4bf796fb8a9295fb58894e0b559da2dd2fb525c
|
4a85464a97aabd089d1dab83829caecf4017b7da
|
refs/heads/master
| 2020-12-02T21:14:31.968000 | 2017-07-08T12:18:56 | 2017-07-08T12:18:56 | 96,278,215 | 6 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package xmlcases;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import com.jlch.webauto.dboperate.DataOperate;
import com.jlch.webauto.operate.XCheckMemberInfo;
import com.jlch.webauto.operate.XFinanceProductCreation;
import com.jlch.webauto.operate.XLoginOperate;
import com.jlch.webauto.operate.XMemberInfoOperate;
import com.jlch.webauto.util.BrowserUtil;
public class FinanceProductCreation extends DataOperate{
WebDriver driver;
/*******************************************************************************/
@BeforeMethod
public void beforeMethod() {
driver=BrowserUtil.getInstance().getDriver();
}
/*******************************************************************************/
@Test(dataProvider = "DataCommon")
public void FinanceProductCreation_ok(Map<?, ?> param){//理财产品定制
driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);
/********************************************************************************/
System.out.println("Login_ok Start");
String url = param.get("url").toString();
String uname = param.get("uname").toString();
String pword = param.get("pword").toString();
String ExpectValue = param.get("uname").toString()+",你好!";
XLoginOperate.operate1_xml(driver,url,uname,pword,ExpectValue);
System.out.println("Login_ok End");
/********************************************************************************/
System.out.println("FinanceProductCreation_ok Start");
String productName = param.get("productName").toString();
System.out.println(productName);
String purchaseAmount = param.get("purchaseAmount").toString();
System.out.println(purchaseAmount);
XFinanceProductCreation.FinanceProductCreation(driver, uname, productName, purchaseAmount);
System.out.println("FinanceProductCreation_ok End");
driver.close();
}
// @AfterMethod
// public void AfterMethod() {
// driver.close();
// }
}
|
UTF-8
|
Java
| 2,141 |
java
|
FinanceProductCreation.java
|
Java
|
[] | null |
[] |
package xmlcases;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import com.jlch.webauto.dboperate.DataOperate;
import com.jlch.webauto.operate.XCheckMemberInfo;
import com.jlch.webauto.operate.XFinanceProductCreation;
import com.jlch.webauto.operate.XLoginOperate;
import com.jlch.webauto.operate.XMemberInfoOperate;
import com.jlch.webauto.util.BrowserUtil;
public class FinanceProductCreation extends DataOperate{
WebDriver driver;
/*******************************************************************************/
@BeforeMethod
public void beforeMethod() {
driver=BrowserUtil.getInstance().getDriver();
}
/*******************************************************************************/
@Test(dataProvider = "DataCommon")
public void FinanceProductCreation_ok(Map<?, ?> param){//理财产品定制
driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);
/********************************************************************************/
System.out.println("Login_ok Start");
String url = param.get("url").toString();
String uname = param.get("uname").toString();
String pword = param.get("pword").toString();
String ExpectValue = param.get("uname").toString()+",你好!";
XLoginOperate.operate1_xml(driver,url,uname,pword,ExpectValue);
System.out.println("Login_ok End");
/********************************************************************************/
System.out.println("FinanceProductCreation_ok Start");
String productName = param.get("productName").toString();
System.out.println(productName);
String purchaseAmount = param.get("purchaseAmount").toString();
System.out.println(purchaseAmount);
XFinanceProductCreation.FinanceProductCreation(driver, uname, productName, purchaseAmount);
System.out.println("FinanceProductCreation_ok End");
driver.close();
}
// @AfterMethod
// public void AfterMethod() {
// driver.close();
// }
}
| 2,141 | 0.626591 | 0.625648 | 56 | 35.910713 | 25.790556 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.642857 | false | false |
5
|
eb1134b9ab17d3559f1835aac6a0a32d20c4fcc9
| 37,039,797,991,720 |
26b7f30c6640b8017a06786e4a2414ad8a4d71dd
|
/src/number_of_direct_superinterfaces/i24458.java
|
e9c67a1f4c88c409fd65a9c31d22f4f72b5dd159
|
[] |
no_license
|
vincentclee/jvm-limits
|
https://github.com/vincentclee/jvm-limits
|
b72a2f2dcc18caa458f1e77924221d585f23316b
|
2fd1c26d1f7984ea8163bc103ad14b6d72282281
|
refs/heads/master
| 2020-05-18T11:18:41.711000 | 2014-09-14T04:25:18 | 2014-09-14T04:25:18 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package number_of_direct_superinterfaces;
public interface i24458 {}
|
UTF-8
|
Java
| 69 |
java
|
i24458.java
|
Java
|
[] | null |
[] |
package number_of_direct_superinterfaces;
public interface i24458 {}
| 69 | 0.826087 | 0.753623 | 3 | 22.333334 | 16.937796 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false |
5
|
7b3d375251cf5b2f8e4b4c26094f688f604ddd77
| 39,092,792,357,167 |
48abe9648ff9e50cd292782db8da1a18c0dfc005
|
/Customer.java
|
5c92e400393fd1ba586a27092ccb77141f46064a
|
[] |
no_license
|
KirbyHackett/Customers--AirLineTickets-and-Flights
|
https://github.com/KirbyHackett/Customers--AirLineTickets-and-Flights
|
6e0509b17eb212b7000932611ad761863494ec04
|
0a5e3ac4fc8671f225b10a33aeba26e97187aafd
|
refs/heads/master
| 2020-02-29T15:32:03.655000 | 2017-05-03T02:01:12 | 2017-05-03T02:01:12 | 89,668,161 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* @author Kirby Hackett, B00733131.
* Class that contains the customer information.
*/
public class Customer {
private String name ="";
private String address="";
private int membershipNumber=0;
private int membershipPoints=0;
/**
* Default constructor
*/
public Customer(){};
/**
* Constructor with parameters.
*/
public Customer(String name, String address, int membershipNumber){
setName(name);
setAddress(address);
setMembershipNumber(membershipNumber);
setMembershipPoints(0);
};
/**
* Outputs formatted information about the customer.
*/
public String toString(){
return this.getName() + ", " + this.getAddress() + ", #" + this.getMembershipNumber()
+ ", " + this.getMembershipPoints() + " points";
}
/**
* @param airlineTicket The airline ticket being purchased.
* @return returns the number of points being applied to an account.
* Apply an amount of points entered to a users account.
*/
public int applyPoints(AirlineTicket airlineTicket){
this.setMembershipPoints(this.getMembershipPoints() + (int) (airlineTicket.getPrice()/100));
return this.getMembershipPoints();
}
//Getters and setters...
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the address
*/
public String getAddress() {
return address;
}
/**
* @param address the address to set
*/
public void setAddress(String address) {
this.address = address;
}
/**
* @return the membershipNumber
*/
public int getMembershipNumber() {
return membershipNumber;
}
/**
* @param membershipNumber the membershipNumber to set
*/
public void setMembershipNumber(int membershipNumber) {
this.membershipNumber = membershipNumber;
}
/**
* @return the membershipPoints
*/
public int getMembershipPoints() {
return membershipPoints;
}
/**
* @param membershipPoints the membershipPoints to set
*/
public void setMembershipPoints(int membershipPoints) {
this.membershipPoints = membershipPoints;
}
}
|
UTF-8
|
Java
| 2,117 |
java
|
Customer.java
|
Java
|
[
{
"context": "/**\n * @author Kirby Hackett, B00733131.\n * Class that contains the customer i",
"end": 28,
"score": 0.9998740553855896,
"start": 15,
"tag": "NAME",
"value": "Kirby Hackett"
}
] | null |
[] |
/**
* @author <NAME>, B00733131.
* Class that contains the customer information.
*/
public class Customer {
private String name ="";
private String address="";
private int membershipNumber=0;
private int membershipPoints=0;
/**
* Default constructor
*/
public Customer(){};
/**
* Constructor with parameters.
*/
public Customer(String name, String address, int membershipNumber){
setName(name);
setAddress(address);
setMembershipNumber(membershipNumber);
setMembershipPoints(0);
};
/**
* Outputs formatted information about the customer.
*/
public String toString(){
return this.getName() + ", " + this.getAddress() + ", #" + this.getMembershipNumber()
+ ", " + this.getMembershipPoints() + " points";
}
/**
* @param airlineTicket The airline ticket being purchased.
* @return returns the number of points being applied to an account.
* Apply an amount of points entered to a users account.
*/
public int applyPoints(AirlineTicket airlineTicket){
this.setMembershipPoints(this.getMembershipPoints() + (int) (airlineTicket.getPrice()/100));
return this.getMembershipPoints();
}
//Getters and setters...
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the address
*/
public String getAddress() {
return address;
}
/**
* @param address the address to set
*/
public void setAddress(String address) {
this.address = address;
}
/**
* @return the membershipNumber
*/
public int getMembershipNumber() {
return membershipNumber;
}
/**
* @param membershipNumber the membershipNumber to set
*/
public void setMembershipNumber(int membershipNumber) {
this.membershipNumber = membershipNumber;
}
/**
* @return the membershipPoints
*/
public int getMembershipPoints() {
return membershipPoints;
}
/**
* @param membershipPoints the membershipPoints to set
*/
public void setMembershipPoints(int membershipPoints) {
this.membershipPoints = membershipPoints;
}
}
| 2,110 | 0.692489 | 0.685876 | 93 | 21.763441 | 21.62207 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.419355 | false | false |
5
|
93437e3685c70bfd1ba5255b24d7c780481928fb
| 38,156,489,485,435 |
631c313748b39da27a23ca7448be223d05d5c951
|
/CaptacionesWeb/src/cl/bice/inversiones/view/bean/funciones/ejecutivo/AnulacionOperacionesBean.java
|
4a7483fe284a8e3db33985338e774c6814651737
|
[
"Apache-2.0"
] |
permissive
|
claudio27/captaciones-web-modelo-sin-cma
|
https://github.com/claudio27/captaciones-web-modelo-sin-cma
|
6cb7602a462e1c1c4a8377ce65588d3ed68cd987
|
63d7e75e6121dda5cad1e39925b67bf38ca22508
|
refs/heads/master
| 2015-09-26T11:37:49.697000 | 2015-09-23T18:35:50 | 2015-09-23T18:35:50 | 42,959,554 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cl.bice.inversiones.view.bean.funciones.ejecutivo;
import java.util.Date;
import java.util.List;
import javax.faces.application.FacesMessage;
import javax.faces.event.ActionEvent;
import javax.faces.model.SelectItem;
import com.icesoft.faces.component.ext.HtmlSelectManyCheckbox;
import cl.bice.inversiones.exepction.ServiceExection;
import cl.bice.inversiones.modelo.ObjetoConsulta;
import cl.bice.inversiones.persistencia.ManagerSP;
import cl.bice.inversiones.servicios.XmlResponse;
import cl.bice.inversiones.view.bean.MensajeErrorExceptionBean;
import cl.bice.inversiones.view.bean.PopUpBean;
import cl.bice.inversiones.view.bean.SelectListBean;
import cl.bice.inversiones.view.bean.funciones.BaseFuncionBean;
import cl.bice.inversiones.view.bean.funciones.cliente.ConsultaDepositoBean;
import cl.bice.inversiones.view.context.Context;
import cl.bice.inversiones.view.factory.Factory;
import cl.bice.inversiones.view.form.AnulacionOperacionesForm;
import cl.bice.inversiones.view.utils.ConstantesWeb;
import cl.bice.inversiones.view.utils.FacesUtils;
import cl.bice.inversiones.view.utils.FormatUtil;
import cl.bice.inversiones.view.wrapper.WrapperConsultaDetalleDCV;
import cl.bice.inversiones.view.wrapper.WrapperDetalleDeposito;
import cl.bice.inversiones.vo.storeProcedure.ActualizaEnvioLoteVO;
import cl.bice.inversiones.vo.storeProcedure.AnulacionDepositosVO;
import cl.bice.inversiones.vo.storeProcedure.ConsultaEnvioDCVVO;
public class AnulacionOperacionesBean extends BaseFuncionBean {
private SelectListBean listaFolioLoteDCV= new SelectListBean();
private ActualizaEnvioLoteVO actualizaEnvioLoteVO;
private WrapperConsultaDetalleDCV detallaEnvioDCV;
private List listaDepositosDCV;
private AnulacionOperacionesForm form;
private List listaDepositos;
private List listaDepositosAnulados;
private WrapperDetalleDeposito detalleDeposito;
private ConsultaDepositoBean consultaDepositoBean;
private EnvioDCVBean envioDCVBean;
private boolean dcv;
public AnulacionOperacionesBean(){
super();
setForm(new AnulacionOperacionesForm());
log.info(this.getClass());
form.setMensajeError("");
}
public void inicio(ActionEvent even){
log.debug("Ejecutado metodo...AnulacionOperacionesBean-->inicio");
log.debug("Ejecutado metodo...AnulacionOperacionesBean-->Glo_perfil ::" + getLogin().getContexto().getEjecutivo().getGlsPerfil());
form.setMensajeError("");
form.setMotivoAnulacion("");
List lista=null;
setListaDepositos(null);
if(getLogin().getContexto().getEjecutivo().getGlsPerfil().equals(ConstantesWeb.PERFIL_MESA_DINERO)){
form.getListaTipoCustodia().setLista(Factory.getInstance().getFactoryListaCustodia(ManagerSP.getInstance().consultaCustodiaTomaDeposito(getLogin().getContexto().getEjecutivo().getCodPerfil())));
super.setSelectedPanel("pnAnulacionOperacionesMSD");
}else{
if
((getLogin().getContexto().getEjecutivo().getGlsPerfil().equals(ConstantesWeb.PERFIL_JEFE_PRODUCTO)) ||
(getLogin().getContexto().getEjecutivo().getGlsPerfil().equals(ConstantesWeb.PERFIL_BACK_OFFICE_CMATRIZ))
){
try {
log.debug("consultaDepositoMSD Custodias DCV: Llamando al SP");
ListarAnulacionEnvioDCV();
super.setSelectedPanel("pnAnulacionEnvioDCV");
}catch (Exception e) {
log.debug("consultaDepositos: Error al rescatar datos en la base de datos: "+e);
form.setMotivoAnulacion("Error: al rescatar depositos con Custodia DCV en la base de datos: "+e);
}
}
else{
if(getLogin().getContexto().getEjecutivo().getGlsPerfil().equals(ConstantesWeb.PERFIL_CAPTADOR)){
try {
log.debug("consultaDepositosCaptador: Consultando depositos a base de dato");
lista = getConvert().converConsultaDepEcAnular(ManagerSP.getInstance().consultaDepEcAnular(getLogin().getContexto().getEjecutivo().getGlsPerfil(),
getLogin().getLoginApp().getFechaActual().getTime(),new Long (getLogin().getContexto().getEjecutivo().getSucursal()).longValue()));
setListaDepositos(lista);
super.setSelectedPanel("pnAnulacionDepositos");
}catch (Exception e) {
log.debug("consultaDepositos: Error al rescatar datos en la base de datos: "+e);
form.setMotivoAnulacion("Error: al rescatar depositos con Custodia Electronica en la base de datos: "+e);
}
}
else
{
setListaDepositos(null);
getForm().setMensajeError("Solo pueden anular depósitos Captadores o Mesa de Dinero");
super.setSelectedPanel("pnAnulacionDepositos");
}
}
}
}
public void consultaDepositoMSD(ActionEvent even){
form.setMensajeError("");
try {
if(form.getListaTipoCustodia().getSelected().equals("DC"))
{
log.debug("consultaDepositoMSD Custodias DCV: Llamando al SP");
ListarAnulacionEnvioDCV();
super.setSelectedPanel("pnAnulacionEnvioDCV");
}else{
log.debug("consultaDepositoMSD Custodias Electronicas en Base de Datos");
List lista = getConvert().converConsultaDepEcAnular(ManagerSP.getInstance().consultaDepEcAnular(getLogin().getContexto().getEjecutivo().getGlsPerfil(),
getLogin().getLoginApp().getFechaActual().getTime(), new Long(getLogin().getContexto().getEjecutivo().getSucursal()).longValue()));
setListaDepositos(lista);
super.setSelectedPanel("pnAnulacionDepositos");
}
}catch (Exception e) {
log.debug("consultaDepositos: Error al consultar a la Base de Datos: "+e);
form.setMotivoAnulacion("Error: al rescatar depositos en la base de datos: "+e);
}
}
public void consultaDetalleDepositoAnulacion(ActionEvent event){
getForm().setMensajeError("");
getForm().setMotivoAnulacion("");
log.debug("Ejecutado metodo...consultaDetalleDepositoAnulacion");
consultaDepositoBean= (ConsultaDepositoBean)FacesUtils.getManagedBean("consultaDepositoBean");
consultaDepositoBean.consultaAnulacionDetalle(event);
super.setSelectedPanel("pnAnulacionDetalleDepositos");
}
//Metodo para listar envios dcv en Pantalla de Anulacion
public void ListarAnulacionEnvioDCV( ){
try {
long codLote=0;
long opcionBusqueda=0;
String rut="";
String rolCap="";
long codEstado=0;
Date fechaIn=null;
Date fechaEnd=null;
log.debug("Ejecuta Tipo de busqueda Todos");
if(getLogin().getContexto().getEjecutivo().getGlsPerfil().equals(ConstantesWeb.PERFIL_MESA_DINERO))
opcionBusqueda=6;// tipo de busqueda por fecha y depositos dcv con cod_estado='A'
else
opcionBusqueda=13;// tipo de busqueda por fecha y depositos dcv con cod_estado='A'
fechaIn=getLogin().getLoginApp().getFechaActual().getTime();
fechaEnd=getLogin().getLoginApp().getFechaActual().getTime();
listaDepositosDCV= getConvert().converConsultaEnvioDCV(ManagerSP.getInstance().consultaEnvioDCVVO(opcionBusqueda,codLote,rut,codEstado, fechaIn, fechaEnd,rolCap));
} catch (Exception e) {
log.error("Error al ajecutar la consulta:"+e.getMessage());
FacesMessage msg = new FacesMessage();
msg.setSeverity(FacesMessage.SEVERITY_ERROR);
msg.setDetail("Ha ocurrido un error al ejecutar la consulta :"+e.getMessage());
msg.setSummary("Ha ocurrido un error al ejecutar la consulta."+e.getMessage());
}
}
//Metodo Detalle para Anulacion de Operaciones
public void detalleAnulacionDCV (ActionEvent event){
//AnulacionOperacionesBean anulacionbean = (AnulacionOperacionesBean)FacesUtils.getManagedBean("anulacionOperacionesBean");
this.getForm().setMensajeError("");
this.getForm().setMotivoAnulacion("");
log.debug("Ejecutado metodo...envioDCVSevicios");
long numLote = new Long(FacesUtils.getRequestParameter("num_lote")).intValue();
try {
ConsultaEnvioDCVVO consultaEnvioDCVVO;
log.debug("envioDCVSevicios: Llamando al procedimiento spConsultaDetalleEnvioDCV ");
consultaEnvioDCVVO = (ConsultaEnvioDCVVO)ManagerSP.getInstance().consultaDetalleEnvioDCVVO(numLote);
detallaEnvioDCV = getConvert().converDetalleEnvioDCV(consultaEnvioDCVVO);
listaFolioLoteDCV.setLista(Factory.getInstance().getFactoryListaFolioLote(ManagerSP.getInstance().consultaFolioLote(numLote)));
String txtNumFolio ="";
if (listaFolioLoteDCV.getLista().size()>1)
{
int ii=0;
for (int i = 1; i < this.listaFolioLoteDCV.getLista().size(); i++)
{
txtNumFolio += " , " + (String) ((SelectItem)this.listaFolioLoteDCV.getLista().get(i)).getLabel();
}
txtNumFolio = txtNumFolio.substring(2);
detallaEnvioDCV.setNroDepositos(txtNumFolio);
}
else
detallaEnvioDCV.setNroDepositos(consultaEnvioDCVVO.getNroTD());
super.setSelectedPanel("pnAnulacionDetalleEnvioDCV");
} catch (Exception e) {
log.error("envioDCVSevicios: Error al ejecutar servicio: "+e);
super.setSelectedPanel("pnErrorPage");
}
}
public void anularDeposito (ActionEvent actionEvent){
try {
if(!getForm().validaGlsAnulacion()){
getForm().setMensajeError("Se debe Ingresar un Motivo de Anulación");
return;
}
log.debug("Anulacion de Deposito: Enviando objeto al servicio TCMW0023");
ObjetoConsulta objetoConsulta = (ObjetoConsulta)Context.getBean(ConstantesWeb.CONTEXT_BEAN_OBJETO_CONSULTA);
objetoConsulta.setNroTd(consultaDepositoBean.getDetalleDeposito().getDetalle().getNroTd());
objetoConsulta.setSucursal(consultaDepositoBean.getDetalleDeposito().getDetalle().getSucursal());
XmlResponse respuestaAnulacionDep= (XmlResponse)getServicios().ejecutaServicio("TCMW0023", objetoConsulta);
if(respuestaAnulacionDep.getStatusDes().equals("OK")){
log.debug("Anulacion de Deposito: Se Anulo correctamente en Flexcube por medio del servicio TCMW0023 ");
log.debug("Anulacion de Deposito: Actualizando Base de Datos");
AnulacionDepositosVO respAnulacionDep= ManagerSP.getInstance().anulacionDepositos(new Long(consultaDepositoBean.getDetalleDeposito().getDetalle().getNroTd()).longValue(), form.getMotivoAnulacion(), getLogin().getLoginApp().getFechaActual().getTime());
if(respAnulacionDep.getNumFilasAct()!=0)
this.popUpAnular(actionEvent);
else{
log.debug("No se Encontro el Número de Folio del Deposito en la Base de Datos");
getForm().setMensajeError("Se Anulo correctamente en Flexcube por medio del servicio TCMW0023, pero No se Encontro el Número de Folio del Deposito en la Base de Datos");
}
}
else{
log.debug("Anulacion de Deposito: Se produjo un error al ejecutar el servicio TCMW0023");
getForm().setMensajeError("Anulacion de Deposito: Se produjo un error al ejecutar el servicio TCMW0023");
}
} catch (ServiceExection e) {
log.debug("anularDeposito: Error al ejecutar servicio: "+e);
MensajeErrorExceptionBean mensajeError = (MensajeErrorExceptionBean)FacesUtils.getManagedBean("mensajeError");
mensajeError.setServiceExection(e);
log.debug("e.getMsgError().getCodNivelError()" + e.getMsgError().getCodNivelError());
log.debug("ConstantesWeb.ERROR" + ConstantesWeb.ERROR);
if (e.getMsgError().getCodNivelError() == ConstantesWeb.ERROR)
super.setSelectedPanel("pnErrorPage");
else
super.setSelectedPanel("pnAnulacionDetalleDepositos");
}
}
public void anularDepositoDCV (ActionEvent actionEvent){
XmlResponse respuestaAnulacionDep=null;
AnulacionDepositosVO respAnulacionDep;
AnulacionDepositosVO respActualizacionEstadoLote;
if(!getForm().validaGlsAnulacion()){
getForm().setMensajeError("Se debe Ingresar un Motivo de Anulación");
return;
}
ObjetoConsulta objetoConsulta = (ObjetoConsulta)Context.getBean(ConstantesWeb.CONTEXT_BEAN_OBJETO_CONSULTA);
objetoConsulta.setSucursal(FormatUtil.llenarCeros(this.detallaEnvioDCV.getConsultaEnvioDCV().getSucursal()+"", 3));
String numFolio="";
for (int i = 1; i < this.listaFolioLoteDCV.getLista().size(); i++) {
numFolio = (String) ((SelectItem)this.listaFolioLoteDCV.getLista().get(i)).getValue();
numFolio= FormatUtil.llenarCeros(numFolio,13);
log.debug("Anulacion de Deposito DCV: Enviando objeto con Folio "+numFolio+" ,al servicio TCMW0023");
objetoConsulta.setNroTd(numFolio);
try{
respuestaAnulacionDep= (XmlResponse)getServicios().ejecutaServicio("TCMW0023", objetoConsulta);
}
catch (ServiceExection e) {
log.debug("anularDeposito: Error al ejecutar servicio: "+e);
MensajeErrorExceptionBean mensajeError = (MensajeErrorExceptionBean)FacesUtils.getManagedBean("mensajeError");
mensajeError.setServiceExection(e);
log.debug("e.getMsgError().getCodNivelError()" + e.getMsgError().getCodNivelError());
log.debug("ConstantesWeb.ERROR" + ConstantesWeb.ERROR);
if (e.getMsgError().getCodNivelError() == ConstantesWeb.ERROR)
{ super.setSelectedPanel("pnErrorPage");
return;
}
else
{
log.debug("La Anulacion del Folio" + numFolio +": No es Ok ya estaba anulado pero se continua el proceso. ");
respuestaAnulacionDep = new XmlResponse();
respuestaAnulacionDep.setStatusDes("NO_OK");
}
}
if (respuestaAnulacionDep.getStatusDes().equals("OK") || respuestaAnulacionDep.getStatusDes().equals("NO_OK")){
if(i==1){
log.debug("Anulacion de Deposito DCV: Se Actualiza el Estado del Lote DCV a PA en la primera Anulacion del Deposito DCV ");
respActualizacionEstadoLote =ManagerSP.getInstance().actualizaEstadoTdLote(this.detallaEnvioDCV.getConsultaEnvioDCV().getCodLote(), "PA");
if(respActualizacionEstadoLote.getNumFilasAct()==0){
log.debug("Actualizacion de Estado TD Lote:No se Encontro el Número de Lote del Deposito DCV en la Base de Datos");
getForm().setMensajeError("Se Anulo correctamente en Flexcube por medio del servicio TCMW0023, pero No se Encontro el Número de Folio del Deposito en la Base de Datos");
return;
}
}
log.debug("Anulacion de Deposito DCV: Se Anulo correctamente en Flexcube por medio del servicio TCMW0023 ");
log.debug("Anulacion de Deposito DCV: Actualizando Base de Datos");
respAnulacionDep= ManagerSP.getInstance().anulacionDepositos(new Long(numFolio).longValue(), form.getMotivoAnulacion(),getLogin().getLoginApp().getFechaActual().getTime());
if(respAnulacionDep.getNumFilasAct()==0){
log.debug("No se Encontro el Número de Folio del Deposito DCV en la Base de Datos");
getForm().setMensajeError("Se Anulo correctamente en Flexcube por medio del servicio TCMW0023, pero No se Encontro el Número de Folio del Deposito en la Base de Datos");
return;
}
}
}
log.debug("Anulacion de Deposito DCV: Se Actualiza el Estado del Lote DCV a RR ");
respActualizacionEstadoLote =ManagerSP.getInstance().actualizaEstadoTdLote(this.detallaEnvioDCV.getConsultaEnvioDCV().getCodLote(), "RR");
if(respActualizacionEstadoLote.getNumFilasAct()==0){
log.debug("Actualizacion de Estado TD Lote: No se Encontro el Número de Lote del Deposito DCV en la Base de Datos");
getForm().setMensajeError("Se Anulo correctamente en Flexcube por medio del servicio TCMW0023, pero No se Encontro el Número de Folio del Deposito en la Base de Datos");
return;
}
this.popUpAnular(actionEvent);
}
public void popUpAnular (ActionEvent actionEvent){
if(getLogin().getContexto().getEjecutivo().getGlsPerfil().equals(ConstantesWeb.PERFIL_MESA_DINERO)){
PopUpBean pop = (PopUpBean)FacesUtils.getRequestAttribute("popup");
pop.setVisible(true);
pop.msgConfirmaCambio("anulacion");
this.consultaDepositoMSD(actionEvent);
}
else{
PopUpBean pop = (PopUpBean)FacesUtils.getRequestAttribute("popup");
pop.setVisible(true);
pop.msgConfirmaCambio("anulacion");
this.inicio(actionEvent);
}
}
public void volver (ActionEvent actionEvent){
if(getLogin().getContexto().getEjecutivo().getGlsPerfil().equals(ConstantesWeb.PERFIL_MESA_DINERO)){
this.consultaDepositoMSD(actionEvent);
}
else{
this.inicio(actionEvent);
}
}
public void inicioInforme(ActionEvent even){
log.debug("Ejecutado metodo...AnulacionOperacionesBean-->inicioInforme");
form.setMensajeError("");
listaDepositosAnulados=null;
setListaDepositos(null);
if(getLogin().getContexto().getEjecutivo().getGlsPerfil().equals(ConstantesWeb.PERFIL_MESA_DINERO)){
log.debug("ejecutando seleccion de custodia en MSD");
form.getListaTipoCustodia().setLista(Factory.getInstance().getFactoryListaCustodia(ManagerSP.getInstance().consultaCustodiaTomaDeposito(getLogin().getContexto().getEjecutivo().getCodPerfil())));
super.setSelectedPanel("pnConsultaParamInformeAnulacionMSD");
}else{
if(getLogin().getContexto().getEjecutivo().getGlsPerfil().equals(ConstantesWeb.PERFIL_CAPTADOR))
{
try {
setDcv(false);
log.debug("inicioInforme: Consultando depositos anulados con custodia Electronica");
listaDepositosAnulados= getConvert().converConsultaDeposAnulados(ManagerSP.getInstance().consultaDepositoAnulados("EC",getLogin().getLoginApp().getFechaActual().getTime(), new Long( getEjecutivo().getSucursal()).longValue(),getLogin().getContexto().getEjecutivo().getGlsPerfil()));
super.setSelectedPanel("pnConsultaDepositosAnulados");
}catch (Exception e) {
log.debug("Error al Consultar Depositos Electronico Anulados :" +e.getMessage());
FacesUtils.addErrorMessage("Ha ocurrido un error al ejecutar la consulta :"+e.getMessage());
}
}
else
if ( (getLogin().getContexto().getEjecutivo().getGlsPerfil().equals(ConstantesWeb.PERFIL_BACK_OFFICE_CMATRIZ)) ||
(getLogin().getContexto().getEjecutivo().getGlsPerfil().equals(ConstantesWeb.PERFIL_JEFE_PRODUCTO))
)
{
try {
setDcv(true);
listaDepositosAnulados=null;
log.debug("consultaInformeMSD:Consultando depositos Anulados");
listaDepositosAnulados= getConvert().converConsultaDeposAnulados(
ManagerSP.getInstance().consultaDepositoAnulados(
"DC",getLogin().getLoginApp().getFechaActual().getTime(), new Long( getEjecutivo().getSucursal()).longValue(),getLogin().getContexto().getEjecutivo().getGlsPerfil()));
super.setSelectedPanel("pnConsultaDepositosAnulados");
}catch (Exception e) {
log.debug("Error al Consultar Depositos Electronico Anulados :" +e.getMessage());
FacesUtils.addErrorMessage("Ha ocurrido un error al ejecutar la consulta :"+e.getMessage());
}
}
}
}
public void consultaInformeMSD(ActionEvent even){
try {
if(form.getListaTipoCustodia().getSelected().equals("DC")){
setDcv(true);
}
else{
setDcv(false);
}
listaDepositosAnulados=null;
log.debug("consultaInformeMSD:Consultando depositos Anulados");
listaDepositosAnulados= getConvert().converConsultaDeposAnulados(ManagerSP.getInstance().consultaDepositoAnulados(form.getListaTipoCustodia().getSelected(),getLogin().getLoginApp().getFechaActual().getTime(), new Long( getEjecutivo().getSucursal()).longValue(),getLogin().getContexto().getEjecutivo().getGlsPerfil()));
super.setSelectedPanel("pnConsultaDepositosAnulados");
}catch (Exception e) {
log.debug("Error al Consultar Depositos Electronico Anulados :" +e.getMessage());
FacesUtils.addErrorMessage("Ha ocurrido un error al ejecutar la consulta :"+e.getMessage());
}
}
public AnulacionOperacionesForm getForm() {
return form;
}
public void setForm(AnulacionOperacionesForm form) {
this.form = form;
}
public List getListaDepositos() {
return listaDepositos;
}
public void setListaDepositos(List listaDepositos) {
this.listaDepositos = listaDepositos;
}
public WrapperDetalleDeposito getDetalleDeposito() {
return detalleDeposito;
}
public void setDetalleDeposito(WrapperDetalleDeposito detalleDeposito) {
this.detalleDeposito = detalleDeposito;
}
public List getListaDepositosAnulados() {
return listaDepositosAnulados;
}
public void setListaDepositosAnulados(List listaDepositosAnulados) {
this.listaDepositosAnulados = listaDepositosAnulados;
}
public boolean isDcv() {
return dcv;
}
public void setDcv(boolean dcv) {
this.dcv = dcv;
}
public SelectListBean getListaFolioLoteDCV() {
return listaFolioLoteDCV;
}
public void setListaFolioLoteDCV(SelectListBean listaFolioLoteDCV) {
this.listaFolioLoteDCV = listaFolioLoteDCV;
}
public List getListaDepositosDCV() {
return listaDepositosDCV;
}
public void setListaDepositosDCV(List listaDepositosDCV) {
this.listaDepositosDCV = listaDepositosDCV;
}
public WrapperConsultaDetalleDCV getDetallaEnvioDCV() {
return detallaEnvioDCV;
}
public void setDetallaEnvioDCV(WrapperConsultaDetalleDCV detallaEnvioDCV) {
this.detallaEnvioDCV = detallaEnvioDCV;
}
}
|
UTF-8
|
Java
| 22,062 |
java
|
AnulacionOperacionesBean.java
|
Java
|
[] | null |
[] |
package cl.bice.inversiones.view.bean.funciones.ejecutivo;
import java.util.Date;
import java.util.List;
import javax.faces.application.FacesMessage;
import javax.faces.event.ActionEvent;
import javax.faces.model.SelectItem;
import com.icesoft.faces.component.ext.HtmlSelectManyCheckbox;
import cl.bice.inversiones.exepction.ServiceExection;
import cl.bice.inversiones.modelo.ObjetoConsulta;
import cl.bice.inversiones.persistencia.ManagerSP;
import cl.bice.inversiones.servicios.XmlResponse;
import cl.bice.inversiones.view.bean.MensajeErrorExceptionBean;
import cl.bice.inversiones.view.bean.PopUpBean;
import cl.bice.inversiones.view.bean.SelectListBean;
import cl.bice.inversiones.view.bean.funciones.BaseFuncionBean;
import cl.bice.inversiones.view.bean.funciones.cliente.ConsultaDepositoBean;
import cl.bice.inversiones.view.context.Context;
import cl.bice.inversiones.view.factory.Factory;
import cl.bice.inversiones.view.form.AnulacionOperacionesForm;
import cl.bice.inversiones.view.utils.ConstantesWeb;
import cl.bice.inversiones.view.utils.FacesUtils;
import cl.bice.inversiones.view.utils.FormatUtil;
import cl.bice.inversiones.view.wrapper.WrapperConsultaDetalleDCV;
import cl.bice.inversiones.view.wrapper.WrapperDetalleDeposito;
import cl.bice.inversiones.vo.storeProcedure.ActualizaEnvioLoteVO;
import cl.bice.inversiones.vo.storeProcedure.AnulacionDepositosVO;
import cl.bice.inversiones.vo.storeProcedure.ConsultaEnvioDCVVO;
public class AnulacionOperacionesBean extends BaseFuncionBean {
private SelectListBean listaFolioLoteDCV= new SelectListBean();
private ActualizaEnvioLoteVO actualizaEnvioLoteVO;
private WrapperConsultaDetalleDCV detallaEnvioDCV;
private List listaDepositosDCV;
private AnulacionOperacionesForm form;
private List listaDepositos;
private List listaDepositosAnulados;
private WrapperDetalleDeposito detalleDeposito;
private ConsultaDepositoBean consultaDepositoBean;
private EnvioDCVBean envioDCVBean;
private boolean dcv;
public AnulacionOperacionesBean(){
super();
setForm(new AnulacionOperacionesForm());
log.info(this.getClass());
form.setMensajeError("");
}
public void inicio(ActionEvent even){
log.debug("Ejecutado metodo...AnulacionOperacionesBean-->inicio");
log.debug("Ejecutado metodo...AnulacionOperacionesBean-->Glo_perfil ::" + getLogin().getContexto().getEjecutivo().getGlsPerfil());
form.setMensajeError("");
form.setMotivoAnulacion("");
List lista=null;
setListaDepositos(null);
if(getLogin().getContexto().getEjecutivo().getGlsPerfil().equals(ConstantesWeb.PERFIL_MESA_DINERO)){
form.getListaTipoCustodia().setLista(Factory.getInstance().getFactoryListaCustodia(ManagerSP.getInstance().consultaCustodiaTomaDeposito(getLogin().getContexto().getEjecutivo().getCodPerfil())));
super.setSelectedPanel("pnAnulacionOperacionesMSD");
}else{
if
((getLogin().getContexto().getEjecutivo().getGlsPerfil().equals(ConstantesWeb.PERFIL_JEFE_PRODUCTO)) ||
(getLogin().getContexto().getEjecutivo().getGlsPerfil().equals(ConstantesWeb.PERFIL_BACK_OFFICE_CMATRIZ))
){
try {
log.debug("consultaDepositoMSD Custodias DCV: Llamando al SP");
ListarAnulacionEnvioDCV();
super.setSelectedPanel("pnAnulacionEnvioDCV");
}catch (Exception e) {
log.debug("consultaDepositos: Error al rescatar datos en la base de datos: "+e);
form.setMotivoAnulacion("Error: al rescatar depositos con Custodia DCV en la base de datos: "+e);
}
}
else{
if(getLogin().getContexto().getEjecutivo().getGlsPerfil().equals(ConstantesWeb.PERFIL_CAPTADOR)){
try {
log.debug("consultaDepositosCaptador: Consultando depositos a base de dato");
lista = getConvert().converConsultaDepEcAnular(ManagerSP.getInstance().consultaDepEcAnular(getLogin().getContexto().getEjecutivo().getGlsPerfil(),
getLogin().getLoginApp().getFechaActual().getTime(),new Long (getLogin().getContexto().getEjecutivo().getSucursal()).longValue()));
setListaDepositos(lista);
super.setSelectedPanel("pnAnulacionDepositos");
}catch (Exception e) {
log.debug("consultaDepositos: Error al rescatar datos en la base de datos: "+e);
form.setMotivoAnulacion("Error: al rescatar depositos con Custodia Electronica en la base de datos: "+e);
}
}
else
{
setListaDepositos(null);
getForm().setMensajeError("Solo pueden anular depósitos Captadores o Mesa de Dinero");
super.setSelectedPanel("pnAnulacionDepositos");
}
}
}
}
public void consultaDepositoMSD(ActionEvent even){
form.setMensajeError("");
try {
if(form.getListaTipoCustodia().getSelected().equals("DC"))
{
log.debug("consultaDepositoMSD Custodias DCV: Llamando al SP");
ListarAnulacionEnvioDCV();
super.setSelectedPanel("pnAnulacionEnvioDCV");
}else{
log.debug("consultaDepositoMSD Custodias Electronicas en Base de Datos");
List lista = getConvert().converConsultaDepEcAnular(ManagerSP.getInstance().consultaDepEcAnular(getLogin().getContexto().getEjecutivo().getGlsPerfil(),
getLogin().getLoginApp().getFechaActual().getTime(), new Long(getLogin().getContexto().getEjecutivo().getSucursal()).longValue()));
setListaDepositos(lista);
super.setSelectedPanel("pnAnulacionDepositos");
}
}catch (Exception e) {
log.debug("consultaDepositos: Error al consultar a la Base de Datos: "+e);
form.setMotivoAnulacion("Error: al rescatar depositos en la base de datos: "+e);
}
}
public void consultaDetalleDepositoAnulacion(ActionEvent event){
getForm().setMensajeError("");
getForm().setMotivoAnulacion("");
log.debug("Ejecutado metodo...consultaDetalleDepositoAnulacion");
consultaDepositoBean= (ConsultaDepositoBean)FacesUtils.getManagedBean("consultaDepositoBean");
consultaDepositoBean.consultaAnulacionDetalle(event);
super.setSelectedPanel("pnAnulacionDetalleDepositos");
}
//Metodo para listar envios dcv en Pantalla de Anulacion
public void ListarAnulacionEnvioDCV( ){
try {
long codLote=0;
long opcionBusqueda=0;
String rut="";
String rolCap="";
long codEstado=0;
Date fechaIn=null;
Date fechaEnd=null;
log.debug("Ejecuta Tipo de busqueda Todos");
if(getLogin().getContexto().getEjecutivo().getGlsPerfil().equals(ConstantesWeb.PERFIL_MESA_DINERO))
opcionBusqueda=6;// tipo de busqueda por fecha y depositos dcv con cod_estado='A'
else
opcionBusqueda=13;// tipo de busqueda por fecha y depositos dcv con cod_estado='A'
fechaIn=getLogin().getLoginApp().getFechaActual().getTime();
fechaEnd=getLogin().getLoginApp().getFechaActual().getTime();
listaDepositosDCV= getConvert().converConsultaEnvioDCV(ManagerSP.getInstance().consultaEnvioDCVVO(opcionBusqueda,codLote,rut,codEstado, fechaIn, fechaEnd,rolCap));
} catch (Exception e) {
log.error("Error al ajecutar la consulta:"+e.getMessage());
FacesMessage msg = new FacesMessage();
msg.setSeverity(FacesMessage.SEVERITY_ERROR);
msg.setDetail("Ha ocurrido un error al ejecutar la consulta :"+e.getMessage());
msg.setSummary("Ha ocurrido un error al ejecutar la consulta."+e.getMessage());
}
}
//Metodo Detalle para Anulacion de Operaciones
public void detalleAnulacionDCV (ActionEvent event){
//AnulacionOperacionesBean anulacionbean = (AnulacionOperacionesBean)FacesUtils.getManagedBean("anulacionOperacionesBean");
this.getForm().setMensajeError("");
this.getForm().setMotivoAnulacion("");
log.debug("Ejecutado metodo...envioDCVSevicios");
long numLote = new Long(FacesUtils.getRequestParameter("num_lote")).intValue();
try {
ConsultaEnvioDCVVO consultaEnvioDCVVO;
log.debug("envioDCVSevicios: Llamando al procedimiento spConsultaDetalleEnvioDCV ");
consultaEnvioDCVVO = (ConsultaEnvioDCVVO)ManagerSP.getInstance().consultaDetalleEnvioDCVVO(numLote);
detallaEnvioDCV = getConvert().converDetalleEnvioDCV(consultaEnvioDCVVO);
listaFolioLoteDCV.setLista(Factory.getInstance().getFactoryListaFolioLote(ManagerSP.getInstance().consultaFolioLote(numLote)));
String txtNumFolio ="";
if (listaFolioLoteDCV.getLista().size()>1)
{
int ii=0;
for (int i = 1; i < this.listaFolioLoteDCV.getLista().size(); i++)
{
txtNumFolio += " , " + (String) ((SelectItem)this.listaFolioLoteDCV.getLista().get(i)).getLabel();
}
txtNumFolio = txtNumFolio.substring(2);
detallaEnvioDCV.setNroDepositos(txtNumFolio);
}
else
detallaEnvioDCV.setNroDepositos(consultaEnvioDCVVO.getNroTD());
super.setSelectedPanel("pnAnulacionDetalleEnvioDCV");
} catch (Exception e) {
log.error("envioDCVSevicios: Error al ejecutar servicio: "+e);
super.setSelectedPanel("pnErrorPage");
}
}
public void anularDeposito (ActionEvent actionEvent){
try {
if(!getForm().validaGlsAnulacion()){
getForm().setMensajeError("Se debe Ingresar un Motivo de Anulación");
return;
}
log.debug("Anulacion de Deposito: Enviando objeto al servicio TCMW0023");
ObjetoConsulta objetoConsulta = (ObjetoConsulta)Context.getBean(ConstantesWeb.CONTEXT_BEAN_OBJETO_CONSULTA);
objetoConsulta.setNroTd(consultaDepositoBean.getDetalleDeposito().getDetalle().getNroTd());
objetoConsulta.setSucursal(consultaDepositoBean.getDetalleDeposito().getDetalle().getSucursal());
XmlResponse respuestaAnulacionDep= (XmlResponse)getServicios().ejecutaServicio("TCMW0023", objetoConsulta);
if(respuestaAnulacionDep.getStatusDes().equals("OK")){
log.debug("Anulacion de Deposito: Se Anulo correctamente en Flexcube por medio del servicio TCMW0023 ");
log.debug("Anulacion de Deposito: Actualizando Base de Datos");
AnulacionDepositosVO respAnulacionDep= ManagerSP.getInstance().anulacionDepositos(new Long(consultaDepositoBean.getDetalleDeposito().getDetalle().getNroTd()).longValue(), form.getMotivoAnulacion(), getLogin().getLoginApp().getFechaActual().getTime());
if(respAnulacionDep.getNumFilasAct()!=0)
this.popUpAnular(actionEvent);
else{
log.debug("No se Encontro el Número de Folio del Deposito en la Base de Datos");
getForm().setMensajeError("Se Anulo correctamente en Flexcube por medio del servicio TCMW0023, pero No se Encontro el Número de Folio del Deposito en la Base de Datos");
}
}
else{
log.debug("Anulacion de Deposito: Se produjo un error al ejecutar el servicio TCMW0023");
getForm().setMensajeError("Anulacion de Deposito: Se produjo un error al ejecutar el servicio TCMW0023");
}
} catch (ServiceExection e) {
log.debug("anularDeposito: Error al ejecutar servicio: "+e);
MensajeErrorExceptionBean mensajeError = (MensajeErrorExceptionBean)FacesUtils.getManagedBean("mensajeError");
mensajeError.setServiceExection(e);
log.debug("e.getMsgError().getCodNivelError()" + e.getMsgError().getCodNivelError());
log.debug("ConstantesWeb.ERROR" + ConstantesWeb.ERROR);
if (e.getMsgError().getCodNivelError() == ConstantesWeb.ERROR)
super.setSelectedPanel("pnErrorPage");
else
super.setSelectedPanel("pnAnulacionDetalleDepositos");
}
}
public void anularDepositoDCV (ActionEvent actionEvent){
XmlResponse respuestaAnulacionDep=null;
AnulacionDepositosVO respAnulacionDep;
AnulacionDepositosVO respActualizacionEstadoLote;
if(!getForm().validaGlsAnulacion()){
getForm().setMensajeError("Se debe Ingresar un Motivo de Anulación");
return;
}
ObjetoConsulta objetoConsulta = (ObjetoConsulta)Context.getBean(ConstantesWeb.CONTEXT_BEAN_OBJETO_CONSULTA);
objetoConsulta.setSucursal(FormatUtil.llenarCeros(this.detallaEnvioDCV.getConsultaEnvioDCV().getSucursal()+"", 3));
String numFolio="";
for (int i = 1; i < this.listaFolioLoteDCV.getLista().size(); i++) {
numFolio = (String) ((SelectItem)this.listaFolioLoteDCV.getLista().get(i)).getValue();
numFolio= FormatUtil.llenarCeros(numFolio,13);
log.debug("Anulacion de Deposito DCV: Enviando objeto con Folio "+numFolio+" ,al servicio TCMW0023");
objetoConsulta.setNroTd(numFolio);
try{
respuestaAnulacionDep= (XmlResponse)getServicios().ejecutaServicio("TCMW0023", objetoConsulta);
}
catch (ServiceExection e) {
log.debug("anularDeposito: Error al ejecutar servicio: "+e);
MensajeErrorExceptionBean mensajeError = (MensajeErrorExceptionBean)FacesUtils.getManagedBean("mensajeError");
mensajeError.setServiceExection(e);
log.debug("e.getMsgError().getCodNivelError()" + e.getMsgError().getCodNivelError());
log.debug("ConstantesWeb.ERROR" + ConstantesWeb.ERROR);
if (e.getMsgError().getCodNivelError() == ConstantesWeb.ERROR)
{ super.setSelectedPanel("pnErrorPage");
return;
}
else
{
log.debug("La Anulacion del Folio" + numFolio +": No es Ok ya estaba anulado pero se continua el proceso. ");
respuestaAnulacionDep = new XmlResponse();
respuestaAnulacionDep.setStatusDes("NO_OK");
}
}
if (respuestaAnulacionDep.getStatusDes().equals("OK") || respuestaAnulacionDep.getStatusDes().equals("NO_OK")){
if(i==1){
log.debug("Anulacion de Deposito DCV: Se Actualiza el Estado del Lote DCV a PA en la primera Anulacion del Deposito DCV ");
respActualizacionEstadoLote =ManagerSP.getInstance().actualizaEstadoTdLote(this.detallaEnvioDCV.getConsultaEnvioDCV().getCodLote(), "PA");
if(respActualizacionEstadoLote.getNumFilasAct()==0){
log.debug("Actualizacion de Estado TD Lote:No se Encontro el Número de Lote del Deposito DCV en la Base de Datos");
getForm().setMensajeError("Se Anulo correctamente en Flexcube por medio del servicio TCMW0023, pero No se Encontro el Número de Folio del Deposito en la Base de Datos");
return;
}
}
log.debug("Anulacion de Deposito DCV: Se Anulo correctamente en Flexcube por medio del servicio TCMW0023 ");
log.debug("Anulacion de Deposito DCV: Actualizando Base de Datos");
respAnulacionDep= ManagerSP.getInstance().anulacionDepositos(new Long(numFolio).longValue(), form.getMotivoAnulacion(),getLogin().getLoginApp().getFechaActual().getTime());
if(respAnulacionDep.getNumFilasAct()==0){
log.debug("No se Encontro el Número de Folio del Deposito DCV en la Base de Datos");
getForm().setMensajeError("Se Anulo correctamente en Flexcube por medio del servicio TCMW0023, pero No se Encontro el Número de Folio del Deposito en la Base de Datos");
return;
}
}
}
log.debug("Anulacion de Deposito DCV: Se Actualiza el Estado del Lote DCV a RR ");
respActualizacionEstadoLote =ManagerSP.getInstance().actualizaEstadoTdLote(this.detallaEnvioDCV.getConsultaEnvioDCV().getCodLote(), "RR");
if(respActualizacionEstadoLote.getNumFilasAct()==0){
log.debug("Actualizacion de Estado TD Lote: No se Encontro el Número de Lote del Deposito DCV en la Base de Datos");
getForm().setMensajeError("Se Anulo correctamente en Flexcube por medio del servicio TCMW0023, pero No se Encontro el Número de Folio del Deposito en la Base de Datos");
return;
}
this.popUpAnular(actionEvent);
}
public void popUpAnular (ActionEvent actionEvent){
if(getLogin().getContexto().getEjecutivo().getGlsPerfil().equals(ConstantesWeb.PERFIL_MESA_DINERO)){
PopUpBean pop = (PopUpBean)FacesUtils.getRequestAttribute("popup");
pop.setVisible(true);
pop.msgConfirmaCambio("anulacion");
this.consultaDepositoMSD(actionEvent);
}
else{
PopUpBean pop = (PopUpBean)FacesUtils.getRequestAttribute("popup");
pop.setVisible(true);
pop.msgConfirmaCambio("anulacion");
this.inicio(actionEvent);
}
}
public void volver (ActionEvent actionEvent){
if(getLogin().getContexto().getEjecutivo().getGlsPerfil().equals(ConstantesWeb.PERFIL_MESA_DINERO)){
this.consultaDepositoMSD(actionEvent);
}
else{
this.inicio(actionEvent);
}
}
public void inicioInforme(ActionEvent even){
log.debug("Ejecutado metodo...AnulacionOperacionesBean-->inicioInforme");
form.setMensajeError("");
listaDepositosAnulados=null;
setListaDepositos(null);
if(getLogin().getContexto().getEjecutivo().getGlsPerfil().equals(ConstantesWeb.PERFIL_MESA_DINERO)){
log.debug("ejecutando seleccion de custodia en MSD");
form.getListaTipoCustodia().setLista(Factory.getInstance().getFactoryListaCustodia(ManagerSP.getInstance().consultaCustodiaTomaDeposito(getLogin().getContexto().getEjecutivo().getCodPerfil())));
super.setSelectedPanel("pnConsultaParamInformeAnulacionMSD");
}else{
if(getLogin().getContexto().getEjecutivo().getGlsPerfil().equals(ConstantesWeb.PERFIL_CAPTADOR))
{
try {
setDcv(false);
log.debug("inicioInforme: Consultando depositos anulados con custodia Electronica");
listaDepositosAnulados= getConvert().converConsultaDeposAnulados(ManagerSP.getInstance().consultaDepositoAnulados("EC",getLogin().getLoginApp().getFechaActual().getTime(), new Long( getEjecutivo().getSucursal()).longValue(),getLogin().getContexto().getEjecutivo().getGlsPerfil()));
super.setSelectedPanel("pnConsultaDepositosAnulados");
}catch (Exception e) {
log.debug("Error al Consultar Depositos Electronico Anulados :" +e.getMessage());
FacesUtils.addErrorMessage("Ha ocurrido un error al ejecutar la consulta :"+e.getMessage());
}
}
else
if ( (getLogin().getContexto().getEjecutivo().getGlsPerfil().equals(ConstantesWeb.PERFIL_BACK_OFFICE_CMATRIZ)) ||
(getLogin().getContexto().getEjecutivo().getGlsPerfil().equals(ConstantesWeb.PERFIL_JEFE_PRODUCTO))
)
{
try {
setDcv(true);
listaDepositosAnulados=null;
log.debug("consultaInformeMSD:Consultando depositos Anulados");
listaDepositosAnulados= getConvert().converConsultaDeposAnulados(
ManagerSP.getInstance().consultaDepositoAnulados(
"DC",getLogin().getLoginApp().getFechaActual().getTime(), new Long( getEjecutivo().getSucursal()).longValue(),getLogin().getContexto().getEjecutivo().getGlsPerfil()));
super.setSelectedPanel("pnConsultaDepositosAnulados");
}catch (Exception e) {
log.debug("Error al Consultar Depositos Electronico Anulados :" +e.getMessage());
FacesUtils.addErrorMessage("Ha ocurrido un error al ejecutar la consulta :"+e.getMessage());
}
}
}
}
public void consultaInformeMSD(ActionEvent even){
try {
if(form.getListaTipoCustodia().getSelected().equals("DC")){
setDcv(true);
}
else{
setDcv(false);
}
listaDepositosAnulados=null;
log.debug("consultaInformeMSD:Consultando depositos Anulados");
listaDepositosAnulados= getConvert().converConsultaDeposAnulados(ManagerSP.getInstance().consultaDepositoAnulados(form.getListaTipoCustodia().getSelected(),getLogin().getLoginApp().getFechaActual().getTime(), new Long( getEjecutivo().getSucursal()).longValue(),getLogin().getContexto().getEjecutivo().getGlsPerfil()));
super.setSelectedPanel("pnConsultaDepositosAnulados");
}catch (Exception e) {
log.debug("Error al Consultar Depositos Electronico Anulados :" +e.getMessage());
FacesUtils.addErrorMessage("Ha ocurrido un error al ejecutar la consulta :"+e.getMessage());
}
}
public AnulacionOperacionesForm getForm() {
return form;
}
public void setForm(AnulacionOperacionesForm form) {
this.form = form;
}
public List getListaDepositos() {
return listaDepositos;
}
public void setListaDepositos(List listaDepositos) {
this.listaDepositos = listaDepositos;
}
public WrapperDetalleDeposito getDetalleDeposito() {
return detalleDeposito;
}
public void setDetalleDeposito(WrapperDetalleDeposito detalleDeposito) {
this.detalleDeposito = detalleDeposito;
}
public List getListaDepositosAnulados() {
return listaDepositosAnulados;
}
public void setListaDepositosAnulados(List listaDepositosAnulados) {
this.listaDepositosAnulados = listaDepositosAnulados;
}
public boolean isDcv() {
return dcv;
}
public void setDcv(boolean dcv) {
this.dcv = dcv;
}
public SelectListBean getListaFolioLoteDCV() {
return listaFolioLoteDCV;
}
public void setListaFolioLoteDCV(SelectListBean listaFolioLoteDCV) {
this.listaFolioLoteDCV = listaFolioLoteDCV;
}
public List getListaDepositosDCV() {
return listaDepositosDCV;
}
public void setListaDepositosDCV(List listaDepositosDCV) {
this.listaDepositosDCV = listaDepositosDCV;
}
public WrapperConsultaDetalleDCV getDetallaEnvioDCV() {
return detallaEnvioDCV;
}
public void setDetallaEnvioDCV(WrapperConsultaDetalleDCV detallaEnvioDCV) {
this.detallaEnvioDCV = detallaEnvioDCV;
}
}
| 22,062 | 0.701601 | 0.698562 | 548 | 38.239052 | 44.804722 | 322 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.95438 | false | false |
5
|
5e0bab46aa499e8d2afffc1deb57dc88dd776623
| 26,886,495,278,395 |
14332f942d1c7f336dc519627c62c6306ea50038
|
/src/com/aichuche/dto/RequestWarpper.java
|
bd989ee9a05521fed7f9ee0e31d5954c623298ae
|
[] |
no_license
|
raymarkrx/RESTful_Web_Services
|
https://github.com/raymarkrx/RESTful_Web_Services
|
69f75547c868acb6af084f26b476a76a04d0dfc8
|
4312dec43a50847ee059197556a51708e80a74d7
|
refs/heads/master
| 2021-01-18T20:55:58.685000 | 2016-03-09T06:58:25 | 2016-03-09T06:58:25 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.aichuche.dto;
import java.io.Serializable;
public class RequestWarpper implements Serializable{
private static final long serialVersionUID = 2084377959117459459L;
private String type;
private String remoteIp;
private long receiveTimestamp;
private Object value;
private String uuid;
private byte[] bytes;
private String requestUri;
private String msg;
private boolean isRepair;
private String repairPath;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value;
}
public String getRemoteIp() {
return remoteIp;
}
public void setRemoteIp(String remoteIp) {
this.remoteIp = remoteIp;
}
public long getReceiveTimestamp() {
return receiveTimestamp;
}
public void setReceiveTimestamp(long receiveTimestamp) {
this.receiveTimestamp = receiveTimestamp;
}
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public byte[] getBytes() {
return bytes;
}
public void setBytes(byte[] bytes) {
this.bytes = bytes;
}
public String getRequestUri() {
return requestUri;
}
public void setRequestUri(String requestUri) {
this.requestUri = requestUri;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public boolean isRepair() {
return isRepair;
}
public void setRepair(boolean isRepair) {
this.isRepair = isRepair;
}
public String getRepairPath() {
return repairPath;
}
public void setRepairPath(String repairPath) {
this.repairPath = repairPath;
}
}
|
UTF-8
|
Java
| 1,811 |
java
|
RequestWarpper.java
|
Java
|
[] | null |
[] |
package com.aichuche.dto;
import java.io.Serializable;
public class RequestWarpper implements Serializable{
private static final long serialVersionUID = 2084377959117459459L;
private String type;
private String remoteIp;
private long receiveTimestamp;
private Object value;
private String uuid;
private byte[] bytes;
private String requestUri;
private String msg;
private boolean isRepair;
private String repairPath;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value;
}
public String getRemoteIp() {
return remoteIp;
}
public void setRemoteIp(String remoteIp) {
this.remoteIp = remoteIp;
}
public long getReceiveTimestamp() {
return receiveTimestamp;
}
public void setReceiveTimestamp(long receiveTimestamp) {
this.receiveTimestamp = receiveTimestamp;
}
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public byte[] getBytes() {
return bytes;
}
public void setBytes(byte[] bytes) {
this.bytes = bytes;
}
public String getRequestUri() {
return requestUri;
}
public void setRequestUri(String requestUri) {
this.requestUri = requestUri;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public boolean isRepair() {
return isRepair;
}
public void setRepair(boolean isRepair) {
this.isRepair = isRepair;
}
public String getRepairPath() {
return repairPath;
}
public void setRepairPath(String repairPath) {
this.repairPath = repairPath;
}
}
| 1,811 | 0.672004 | 0.661513 | 108 | 14.768518 | 15.923199 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.231481 | false | false |
5
|
b35191b05692f3bc74e93d41b2c177ed20d952c2
| 30,047,591,208,716 |
ab5728b436cfc4ffbddaa1c4c949096a88e85c2f
|
/06 Accept Goods/20141231_V3.0/代码/wogame-common/src/main/java/com/unicom/game/center/log/model/DownloadInfoModel.java
|
e3b9c68fa69833c3a0cf38111e356c2d266af989
|
[] |
no_license
|
yinzhuancheng/WoGame
|
https://github.com/yinzhuancheng/WoGame
|
31c413c4948ecd7cb2af68c75a835be247e9a7c0
|
9fed34c933ba9c54bacb72f981141bcb98f76e6d
|
refs/heads/master
| 2015-08-11T22:28:44.347000 | 2015-03-25T05:53:07 | 2015-03-25T05:53:07 | 20,435,716 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.unicom.game.center.log.model;
import java.util.ArrayList;
import java.util.List;
/**
* Created with IntelliJ IDEA.
* User: wiki_yu
* Date: 7/12/14
* Time: 10:27 AM
* To change this template use File | Settings | File Templates.
*/
public class DownloadInfoModel {
private int totalRecords;
private List<DownloadDiaplayModel> downloadInfomodels = new ArrayList<DownloadDiaplayModel>();
public List<DownloadDiaplayModel> getDownloadInfomodels() {
return downloadInfomodels;
}
public void setDownloadInfomodels(List<DownloadDiaplayModel> downloadInfomodels) {
this.downloadInfomodels = downloadInfomodels;
}
public int getTotalRecords() {
return totalRecords;
}
public void setTotalRecords(int totalRecords) {
this.totalRecords = totalRecords;
}
}
|
UTF-8
|
Java
| 841 |
java
|
DownloadInfoModel.java
|
Java
|
[
{
"context": "List;\n\n/**\n * Created with IntelliJ IDEA.\n * User: wiki_yu\n * Date: 7/12/14\n * Time: 10:27 AM\n * To change t",
"end": 146,
"score": 0.9996293187141418,
"start": 139,
"tag": "USERNAME",
"value": "wiki_yu"
}
] | null |
[] |
package com.unicom.game.center.log.model;
import java.util.ArrayList;
import java.util.List;
/**
* Created with IntelliJ IDEA.
* User: wiki_yu
* Date: 7/12/14
* Time: 10:27 AM
* To change this template use File | Settings | File Templates.
*/
public class DownloadInfoModel {
private int totalRecords;
private List<DownloadDiaplayModel> downloadInfomodels = new ArrayList<DownloadDiaplayModel>();
public List<DownloadDiaplayModel> getDownloadInfomodels() {
return downloadInfomodels;
}
public void setDownloadInfomodels(List<DownloadDiaplayModel> downloadInfomodels) {
this.downloadInfomodels = downloadInfomodels;
}
public int getTotalRecords() {
return totalRecords;
}
public void setTotalRecords(int totalRecords) {
this.totalRecords = totalRecords;
}
}
| 841 | 0.718193 | 0.707491 | 32 | 25.28125 | 25.847189 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.34375 | false | false |
5
|
29e9890a4b2b511fb60f1515fe73fb4aeb0954a4
| 30,081,950,982,282 |
7f68e387bc386b1c62f07ba05ed7c3e9b8b46de7
|
/src/FileToXml.java
|
c0aa09836e9f4d834bafe14419efeb5a8110791e
|
[] |
no_license
|
cooksystemsinc/java-xml-file-transfer-assessment-patrickdoane
|
https://github.com/cooksystemsinc/java-xml-file-transfer-assessment-patrickdoane
|
2e591721fcd966bcb3f4ef4cd69a74e9350011eb
|
6c39dda7b674bce70a5f553e7b23068e329026a5
|
refs/heads/master
| 2018-07-04T23:00:20.423000 | 2018-05-31T20:31:01 | 2018-05-31T20:31:01 | 135,630,662 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class FileToXml {
private String filename;
private String username;
private String date;
private byte[] contents;
// No args constructor for reflection
public FileToXml() { }
public FileToXml(String filename, String username, String date, byte[] contents) {
this.setFilename(filename);
this.username = username;
this.date = date;
this.contents = contents;
}
public byte[] getContents() {
return contents;
}
public void setContents(byte[] contents) {
this.contents = contents;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getFilename() {
return filename;
}
public void setFilename(String filename) {
this.filename = filename;
}
}
|
UTF-8
|
Java
| 1,085 |
java
|
FileToXml.java
|
Java
|
[
{
"context": " {\n\t\tthis.setFilename(filename);\n\t\tthis.username = username;\n\t\tthis.date = date;\n\t\tthis.contents = contents;\n",
"end": 534,
"score": 0.9977242350578308,
"start": 526,
"tag": "USERNAME",
"value": "username"
},
{
"context": "d setUsername(String username) {\n\t\tthis.username = username;\n\t}\n\n\tpublic String getFilename() {\n\t\treturn file",
"end": 948,
"score": 0.9493189454078674,
"start": 940,
"tag": "USERNAME",
"value": "username"
}
] | null |
[] |
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class FileToXml {
private String filename;
private String username;
private String date;
private byte[] contents;
// No args constructor for reflection
public FileToXml() { }
public FileToXml(String filename, String username, String date, byte[] contents) {
this.setFilename(filename);
this.username = username;
this.date = date;
this.contents = contents;
}
public byte[] getContents() {
return contents;
}
public void setContents(byte[] contents) {
this.contents = contents;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getFilename() {
return filename;
}
public void setFilename(String filename) {
this.filename = filename;
}
}
| 1,085 | 0.733641 | 0.733641 | 54 | 19.092592 | 17.81621 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.333333 | false | false |
5
|
42318761ceaaaa2265ffd0c6ffd8dca4e7788920
| 824,633,782,880 |
719577b9fa0c0882557d377a8c8feec2ecb7652a
|
/src/java/com/hzih/sslvpn/monitor/info/monitor/ServerAddress.java
|
b9e71ebc256768d1a16b887ec333dd8a739fb0c3
|
[] |
no_license
|
huanghengmin/sslvpn_strategy_check
|
https://github.com/huanghengmin/sslvpn_strategy_check
|
6161035902477ac05a438162dd9b4b6cccd5d168
|
34c88ef76b32d57003896cdd6ab9d9b9bcb494e1
|
refs/heads/master
| 2021-01-01T05:43:31.260000 | 2016-04-16T03:16:29 | 2016-04-16T03:16:29 | 56,363,148 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.hzih.sslvpn.monitor.info.monitor;
/**
* Created by IntelliJ IDEA.
* User: Administrator
* Date: 14-1-16
* Time: 下午1:08
* To change this template use File | Settings | File Templates.
*/
public class ServerAddress {
/*返回数据
* {
"jsonrpc": "2.0",
"result": {
"res":"OK",//OK,成功;FAILED 失败;
"serveraddress":{
"tunelmode": "100”,// 100 隧道模式,101 代理模式
"monitorserverip": "192.168.1.10”//如果是隧道模式,需要填写 监测服务器IP,隧道模式不需要填写端口monitorserverporxyport
"monitorserverporxyport": "55566”//如果是代理模式,需要填写 VPN代理后的本地端口,代理模式不需要填写monitorserverip
}
},
"id": 1
}
*/
private String tunelmode;
private String monitorserverip;
private String monitorserverporxyport;
public String getTunelmode() {
return tunelmode;
}
public void setTunelmode(String tunelmode) {
this.tunelmode = tunelmode;
}
public String getMonitorserverip() {
return monitorserverip;
}
public void setMonitorserverip(String monitorserverip) {
this.monitorserverip = monitorserverip;
}
public String getMonitorserverporxyport() {
return monitorserverporxyport;
}
public void setMonitorserverporxyport(String monitorserverporxyport) {
this.monitorserverporxyport = monitorserverporxyport;
}
public ServerAddress(String tunelmode, String monitorserverip, String monitorserverporxyport) {
this.tunelmode = tunelmode;
this.monitorserverip = monitorserverip;
this.monitorserverporxyport = monitorserverporxyport;
}
public ServerAddress() {
}
}
|
UTF-8
|
Java
| 1,812 |
java
|
ServerAddress.java
|
Java
|
[
{
"context": "onitor;\n\n/**\n * Created by IntelliJ IDEA.\n * User: Administrator\n * Date: 14-1-16\n * Time: 下午1:08\n * To change thi",
"end": 102,
"score": 0.9858874678611755,
"start": 89,
"tag": "NAME",
"value": "Administrator"
},
{
"context": "// 100 隧道模式,101 代理模式\n \"monitorserverip\": \"192.168.1.10”//如果是隧道模式,需要填写\t\t监测服务器IP,隧道模式不需要填写端口monitorserverp",
"end": 453,
"score": 0.9996988773345947,
"start": 441,
"tag": "IP_ADDRESS",
"value": "192.168.1.10"
}
] | null |
[] |
package com.hzih.sslvpn.monitor.info.monitor;
/**
* Created by IntelliJ IDEA.
* User: Administrator
* Date: 14-1-16
* Time: 下午1:08
* To change this template use File | Settings | File Templates.
*/
public class ServerAddress {
/*返回数据
* {
"jsonrpc": "2.0",
"result": {
"res":"OK",//OK,成功;FAILED 失败;
"serveraddress":{
"tunelmode": "100”,// 100 隧道模式,101 代理模式
"monitorserverip": "192.168.1.10”//如果是隧道模式,需要填写 监测服务器IP,隧道模式不需要填写端口monitorserverporxyport
"monitorserverporxyport": "55566”//如果是代理模式,需要填写 VPN代理后的本地端口,代理模式不需要填写monitorserverip
}
},
"id": 1
}
*/
private String tunelmode;
private String monitorserverip;
private String monitorserverporxyport;
public String getTunelmode() {
return tunelmode;
}
public void setTunelmode(String tunelmode) {
this.tunelmode = tunelmode;
}
public String getMonitorserverip() {
return monitorserverip;
}
public void setMonitorserverip(String monitorserverip) {
this.monitorserverip = monitorserverip;
}
public String getMonitorserverporxyport() {
return monitorserverporxyport;
}
public void setMonitorserverporxyport(String monitorserverporxyport) {
this.monitorserverporxyport = monitorserverporxyport;
}
public ServerAddress(String tunelmode, String monitorserverip, String monitorserverporxyport) {
this.tunelmode = tunelmode;
this.monitorserverip = monitorserverip;
this.monitorserverporxyport = monitorserverporxyport;
}
public ServerAddress() {
}
}
| 1,812 | 0.663625 | 0.642944 | 63 | 25.095238 | 25.644526 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.396825 | false | false |
5
|
8248a62c563ecb2edf108fe66d6379fc488cf501
| 33,474,975,161,636 |
be73e7fc4c5ef6367952dfe83ee44ae629c8205b
|
/design_patterns/12 TemplateMethodPattern/src/br/edu/ifpr/modelo/VendaSC.java
|
9a4e6b9c18d801d5c472b15f350fef6d752cd6f6
|
[] |
no_license
|
MatMercer/java-design-patterns
|
https://github.com/MatMercer/java-design-patterns
|
e5098eeec23b90f1ad8c8e345bf8edb78a62fb56
|
f7cefa2545eefc2aa3a3e254a576f0534bf1f12f
|
refs/heads/master
| 2021-04-12T11:00:26.722000 | 2019-01-17T21:36:06 | 2019-01-17T21:36:06 | 126,892,697 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package br.edu.ifpr.modelo;
import br.edu.ifpr.patterns.template.Venda;
/**
*
* @author Romualdo Rubens de Freitas
*/
public class VendaSC extends Venda {
@Override
public void calcularICMS() { icms = 0.15; }
} // public class VendaSC extends Venda
|
UTF-8
|
Java
| 260 |
java
|
VendaSC.java
|
Java
|
[
{
"context": "u.ifpr.patterns.template.Venda;\n\n/**\n *\n * @author Romualdo Rubens de Freitas\n */\npublic class VendaSC extends Venda {\n @Over",
"end": 118,
"score": 0.9998923540115356,
"start": 92,
"tag": "NAME",
"value": "Romualdo Rubens de Freitas"
}
] | null |
[] |
package br.edu.ifpr.modelo;
import br.edu.ifpr.patterns.template.Venda;
/**
*
* @author <NAME>
*/
public class VendaSC extends Venda {
@Override
public void calcularICMS() { icms = 0.15; }
} // public class VendaSC extends Venda
| 240 | 0.707692 | 0.696154 | 12 | 20.666666 | 18.075459 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false |
5
|
f46cc724dfbb1d5c420caf5ea6b96b0dae1cc5fe
| 6,158,983,121,376 |
3b8177f9fe9710f45570d99a4e93fe314c6c1a30
|
/src/Servidor/Servidor.java
|
5243349ad82bde222679f0a410e22cbb2df60605
|
[] |
no_license
|
daae02/Tecnolopy
|
https://github.com/daae02/Tecnolopy
|
dda86fc3164ba1c5e13e2bc831b68f70fdfd252f
|
6f7e4a09a98800b31cb06c24253c8354bc45f7c3
|
refs/heads/master
| 2023-02-20T08:47:55.816000 | 2021-01-22T19:28:01 | 2021-01-22T19:28:01 | 321,506,039 | 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 Servidor;
import Cliente.Cliente;
import java.util.Collections;
import java.util.Comparator;
import com.sun.webkit.ThemeClient;
import java.io.DataOutput;
import java.io.IOException;
import static java.lang.Thread.sleep;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
import tecnopoly.Juego;
/**
*
* @author diemo
*/
public class Servidor{
PantallaServer refPantalla;
public Juego juego;
public ArrayList<ThreadServidor> conexiones;
public ArrayList<Cliente> clientes;
public ArrayList<String> nombres;
public ArrayList<String> urlBotones;
private boolean running = true;
private ServerSocket srv;
public int turno = 0;
private boolean partidaIniciada = false;
private boolean pause = false;
public int indexJugadorActual = 1;
public Servidor(PantallaServer refPantalla) {
this.refPantalla = refPantalla;
conexiones = new ArrayList<ThreadServidor>();
clientes = new ArrayList<Cliente>();
nombres = new ArrayList();
urlBotones = new ArrayList();
this.refPantalla.setSrv(this);
}
public void iniciarPartida() {
this.partidaIniciada = true;
}
public void escogerGanador() throws IOException{
int ganador = 0;
ThreadServidor idxGanador = conexiones.get(0);
for (int i = 0; i < conexiones.size(); i++) {
ThreadServidor tmp = conexiones.get(i);
if (!tmp.rendido){
int tmpValor = juego.currentPlayers.get(i).getValorTotal();
if (tmpValor > ganador){
ganador = tmpValor;
idxGanador = tmp;
}
}
}
idxGanador.writer.writeInt(37);
}
public void stopserver(){
running = false;
}
public String getNextTurno(){
if ( ++turno >= conexiones.size())
turno = 0;
return conexiones.get(turno).nickname;
}
public void cayoCarcel(int posicionThread){
}
public void funcionesCarcel (int posicion,int caso) throws IOException{
switch (caso){
case 1://cayo carcel primera vez
conexiones.get(posicion).writer.writeInt(17);
break;
case 2://sale de la carcel
conexiones.get(posicion).writer.writeInt(18);
break;
case 3:
conexiones.get(posicion).writer.writeInt(19);
break;
}
}
public void writeInThreadAP(int position, String url) throws IOException{
conexiones.get(position).writer.writeInt(12);
conexiones.get(position).writer.writeUTF(url);
}
public void writeInThreadNAP(int position,String url, int posDueño,boolean isUtility) throws IOException{
String dueño = conexiones.get(posDueño).nickname;
conexiones.get(position).writer.writeInt(13);
conexiones.get(position).writer.writeUTF(url);
conexiones.get(position).writer.writeUTF(dueño);
conexiones.get(position).writer.writeBoolean(isUtility);
}
public void writeInThreadOwner(int position,String mensaje) throws IOException{
String name = conexiones.get(position).nickname;
for (int i = 0; i < conexiones.size(); i++) {
ThreadServidor current = conexiones.get(i);
current.writer.writeInt(6);
current.writer.writeUTF(name);
current.writer.writeUTF(mensaje);
}
}
public String getTurno(){
return conexiones.get(turno).nickname;
}
public String[] buscarDados(int [] dados){
String [] arreglo = new String[2];
String path = "";
for (int i = 0; i < 2; i++) {
int dado = dados[i];
switch(dado){
case 1:
path = "/Resources/Dados/uno.png"; // NOI18N
break;
case 2:
path = "/Resources/Dados/dos.png";
break;
case 3:
path = "/Resources/Dados/tres.png";
break;
case 4:
path = "/Resources/Dados/cuatro.png";
break;
case 5:
path = "/Resources/Dados/cinco.png";
break;
case 6:
path = "/Resources/Dados/seis.png";
break;
}
arreglo[i] = path;
}
return arreglo;
}
public void cartaChance(int carta,int posicionThread) throws IOException{
conexiones.get(posicionThread).writer.writeInt(26);
conexiones.get(posicionThread).writer.writeInt(carta);
}
public void arcaComunal(int arca,int posicionThread) throws IOException{
conexiones.get(posicionThread).writer.writeInt(28);
conexiones.get(posicionThread).writer.writeInt(arca);
}
public int[] lanzarDados(){
int [] arreglo = new int[2];
int dado1 = (new Random()).nextInt(6)+1;
int dado2 = (new Random()).nextInt(6)+1;
arreglo[0] = dado1;
arreglo[1] = dado2;
return arreglo;
}
public void ordenarAL(){
Collections.sort(conexiones, new Comparator<ThreadServidor>(){
@Override
public int compare(ThreadServidor c1, ThreadServidor c2) {
// Aqui esta el truco, ahora comparamos p2 con p1 y no al reves como antes
return new Integer(c2.turno).compareTo(new Integer(c1.turno));
}
});
}
public String getNickname(int nombreIndice){
return conexiones.get(nombreIndice).nickname;
}
public void runServer(){
int contadorDeConexiones = 0;
try{
srv = new ServerSocket(35577);
while (running){
if (!pause){
if (contadorDeConexiones < 6){
refPantalla.addMessage("::Esperando conexión ...");
Socket nuevaConexion = srv.accept();
if (!partidaIniciada){
contadorDeConexiones++;
if (contadorDeConexiones > 1)
refPantalla.btnIniciar.setEnabled(true);
refPantalla.addMessage(":Conexión " + contadorDeConexiones + "aceptada");
// nuevo thread
ThreadServidor newThread = new ThreadServidor(nuevaConexion, this);
conexiones.add(newThread);
newThread.start();
}
}
else{
// OutputStream socket para poder hacer un writer
refPantalla.addMessage(":Conexión denegada, ha alcanzado el máximo de jugadores");
pause = true;
}
}
}
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
}
|
UTF-8
|
Java
| 7,301 |
java
|
Servidor.java
|
Java
|
[
{
"context": "Random;\nimport tecnopoly.Juego;\n\n/**\n *\n * @author diemo\n */\npublic class Servidor{\n \n PantallaServe",
"end": 595,
"score": 0.999602735042572,
"start": 590,
"tag": "USERNAME",
"value": "diemo"
}
] | 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 Servidor;
import Cliente.Cliente;
import java.util.Collections;
import java.util.Comparator;
import com.sun.webkit.ThemeClient;
import java.io.DataOutput;
import java.io.IOException;
import static java.lang.Thread.sleep;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
import tecnopoly.Juego;
/**
*
* @author diemo
*/
public class Servidor{
PantallaServer refPantalla;
public Juego juego;
public ArrayList<ThreadServidor> conexiones;
public ArrayList<Cliente> clientes;
public ArrayList<String> nombres;
public ArrayList<String> urlBotones;
private boolean running = true;
private ServerSocket srv;
public int turno = 0;
private boolean partidaIniciada = false;
private boolean pause = false;
public int indexJugadorActual = 1;
public Servidor(PantallaServer refPantalla) {
this.refPantalla = refPantalla;
conexiones = new ArrayList<ThreadServidor>();
clientes = new ArrayList<Cliente>();
nombres = new ArrayList();
urlBotones = new ArrayList();
this.refPantalla.setSrv(this);
}
public void iniciarPartida() {
this.partidaIniciada = true;
}
public void escogerGanador() throws IOException{
int ganador = 0;
ThreadServidor idxGanador = conexiones.get(0);
for (int i = 0; i < conexiones.size(); i++) {
ThreadServidor tmp = conexiones.get(i);
if (!tmp.rendido){
int tmpValor = juego.currentPlayers.get(i).getValorTotal();
if (tmpValor > ganador){
ganador = tmpValor;
idxGanador = tmp;
}
}
}
idxGanador.writer.writeInt(37);
}
public void stopserver(){
running = false;
}
public String getNextTurno(){
if ( ++turno >= conexiones.size())
turno = 0;
return conexiones.get(turno).nickname;
}
public void cayoCarcel(int posicionThread){
}
public void funcionesCarcel (int posicion,int caso) throws IOException{
switch (caso){
case 1://cayo carcel primera vez
conexiones.get(posicion).writer.writeInt(17);
break;
case 2://sale de la carcel
conexiones.get(posicion).writer.writeInt(18);
break;
case 3:
conexiones.get(posicion).writer.writeInt(19);
break;
}
}
public void writeInThreadAP(int position, String url) throws IOException{
conexiones.get(position).writer.writeInt(12);
conexiones.get(position).writer.writeUTF(url);
}
public void writeInThreadNAP(int position,String url, int posDueño,boolean isUtility) throws IOException{
String dueño = conexiones.get(posDueño).nickname;
conexiones.get(position).writer.writeInt(13);
conexiones.get(position).writer.writeUTF(url);
conexiones.get(position).writer.writeUTF(dueño);
conexiones.get(position).writer.writeBoolean(isUtility);
}
public void writeInThreadOwner(int position,String mensaje) throws IOException{
String name = conexiones.get(position).nickname;
for (int i = 0; i < conexiones.size(); i++) {
ThreadServidor current = conexiones.get(i);
current.writer.writeInt(6);
current.writer.writeUTF(name);
current.writer.writeUTF(mensaje);
}
}
public String getTurno(){
return conexiones.get(turno).nickname;
}
public String[] buscarDados(int [] dados){
String [] arreglo = new String[2];
String path = "";
for (int i = 0; i < 2; i++) {
int dado = dados[i];
switch(dado){
case 1:
path = "/Resources/Dados/uno.png"; // NOI18N
break;
case 2:
path = "/Resources/Dados/dos.png";
break;
case 3:
path = "/Resources/Dados/tres.png";
break;
case 4:
path = "/Resources/Dados/cuatro.png";
break;
case 5:
path = "/Resources/Dados/cinco.png";
break;
case 6:
path = "/Resources/Dados/seis.png";
break;
}
arreglo[i] = path;
}
return arreglo;
}
public void cartaChance(int carta,int posicionThread) throws IOException{
conexiones.get(posicionThread).writer.writeInt(26);
conexiones.get(posicionThread).writer.writeInt(carta);
}
public void arcaComunal(int arca,int posicionThread) throws IOException{
conexiones.get(posicionThread).writer.writeInt(28);
conexiones.get(posicionThread).writer.writeInt(arca);
}
public int[] lanzarDados(){
int [] arreglo = new int[2];
int dado1 = (new Random()).nextInt(6)+1;
int dado2 = (new Random()).nextInt(6)+1;
arreglo[0] = dado1;
arreglo[1] = dado2;
return arreglo;
}
public void ordenarAL(){
Collections.sort(conexiones, new Comparator<ThreadServidor>(){
@Override
public int compare(ThreadServidor c1, ThreadServidor c2) {
// Aqui esta el truco, ahora comparamos p2 con p1 y no al reves como antes
return new Integer(c2.turno).compareTo(new Integer(c1.turno));
}
});
}
public String getNickname(int nombreIndice){
return conexiones.get(nombreIndice).nickname;
}
public void runServer(){
int contadorDeConexiones = 0;
try{
srv = new ServerSocket(35577);
while (running){
if (!pause){
if (contadorDeConexiones < 6){
refPantalla.addMessage("::Esperando conexión ...");
Socket nuevaConexion = srv.accept();
if (!partidaIniciada){
contadorDeConexiones++;
if (contadorDeConexiones > 1)
refPantalla.btnIniciar.setEnabled(true);
refPantalla.addMessage(":Conexión " + contadorDeConexiones + "aceptada");
// nuevo thread
ThreadServidor newThread = new ThreadServidor(nuevaConexion, this);
conexiones.add(newThread);
newThread.start();
}
}
else{
// OutputStream socket para poder hacer un writer
refPantalla.addMessage(":Conexión denegada, ha alcanzado el máximo de jugadores");
pause = true;
}
}
}
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
}
| 7,301 | 0.563691 | 0.555053 | 216 | 32.763889 | 22.230167 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.62037 | false | false |
5
|
1652c20abe8db477f2f29c1d325b3663d8b83470
| 6,158,983,117,262 |
3d1566f713cb0aeec8994c53a29e49c0b0e870fc
|
/Chapter 06/Projects/FactorGenerator.java
|
968f0990699ea9b508dc0ef68f3683c48d397f28
|
[] |
no_license
|
haydartuna/Big-Java-Early-Objects-Practice
|
https://github.com/haydartuna/Big-Java-Early-Objects-Practice
|
0b3294870ed5ff8dbadb96581fad01d16b9a6fa7
|
ec9cb5d00187fe03a6d1d5553664055414369d97
|
refs/heads/master
| 2020-12-29T08:58:37.012000 | 2020-02-08T14:26:20 | 2020-02-08T14:26:20 | 238,546,138 | 0 | 0 | null | true | 2020-02-05T20:51:54 | 2020-02-05T20:51:53 | 2020-01-18T22:12:56 | 2019-09-25T17:55:05 | 2,727 | 0 | 0 | 0 | null | false | false |
public class FactorGenerator
{
// Instance Variables
private int factor;
private int number;
private boolean done;
// Constructors
/**
* Constructs a Factor Generator with a given number to factor
* @param numberToFactor number to factor
*/
public FactorGenerator(int numberToFactor)
{
this.number = numberToFactor;
this.factor = 1;
}
// Methods
/**
* Returns the next factor
* @return factor
*/
public int nextFactor()
{
return factor++;
}
/**
* Check to see if there are more factors
* @return hasMoreFactors
*/
public boolean hasMoreFactors()
{
boolean hasMoreFactors = false;
done = false;
if(factor < number)
{
while(!done)
{
if(number % factor != 0)
{
factor++;
}
else
{
done = true;
hasMoreFactors = true;
}
}
}
return hasMoreFactors;
}
}
|
UTF-8
|
Java
| 859 |
java
|
FactorGenerator.java
|
Java
|
[] | null |
[] |
public class FactorGenerator
{
// Instance Variables
private int factor;
private int number;
private boolean done;
// Constructors
/**
* Constructs a Factor Generator with a given number to factor
* @param numberToFactor number to factor
*/
public FactorGenerator(int numberToFactor)
{
this.number = numberToFactor;
this.factor = 1;
}
// Methods
/**
* Returns the next factor
* @return factor
*/
public int nextFactor()
{
return factor++;
}
/**
* Check to see if there are more factors
* @return hasMoreFactors
*/
public boolean hasMoreFactors()
{
boolean hasMoreFactors = false;
done = false;
if(factor < number)
{
while(!done)
{
if(number % factor != 0)
{
factor++;
}
else
{
done = true;
hasMoreFactors = true;
}
}
}
return hasMoreFactors;
}
}
| 859 | 0.62631 | 0.623981 | 55 | 14.6 | 13.743891 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.018182 | false | false |
5
|
5d72afe0ffc3b538cd477dfd9237ca0a9d8edc02
| 6,158,983,118,548 |
da0f5e4fede4b518418ddbda90ae6582413d893d
|
/cortana-pixeltracker-core/src/main/java/com/microsoft/azure/server/pixeltracker/api/handlers/impl/package-info.java
|
940678d0f103f6342a2e9170509f86b061feeff5
|
[
"MIT",
"LicenseRef-scancode-generic-cla"
] |
permissive
|
Azure/azure-pixel-tracker-java
|
https://github.com/Azure/azure-pixel-tracker-java
|
789524a35c8ccfecc80d1a491d7e5a0931d7c5f9
|
cad16dc64e4427dc8b720f36402916654e722ce8
|
refs/heads/master
| 2023-04-05T18:21:09.149000 | 2023-03-28T16:46:16 | 2023-03-28T16:46:16 | 102,017,267 | 1 | 1 |
MIT
| false | 2023-03-28T16:46:18 | 2017-08-31T15:41:22 | 2020-06-01T13:32:00 | 2023-03-28T16:46:16 | 429 | 1 | 1 | 2 |
Java
| false | false |
/**
* Pixel Tracker API Handlers Impl Package Info
* Created by dcibo on 5/25/2017.
*/
package com.microsoft.azure.server.pixeltracker.api.handlers.impl;
|
UTF-8
|
Java
| 160 |
java
|
package-info.java
|
Java
|
[
{
"context": "cker API Handlers Impl Package Info\r\n * Created by dcibo on 5/25/2017.\r\n */\r\npackage com.microsoft.azure.s",
"end": 73,
"score": 0.9995636940002441,
"start": 68,
"tag": "USERNAME",
"value": "dcibo"
}
] | null |
[] |
/**
* Pixel Tracker API Handlers Impl Package Info
* Created by dcibo on 5/25/2017.
*/
package com.microsoft.azure.server.pixeltracker.api.handlers.impl;
| 160 | 0.7375 | 0.69375 | 5 | 30.4 | 24.703035 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false |
5
|
317dbfc22f64a5d55ce3deeb4b9d8ea0e56aade7
| 12,721,693,145,922 |
e820f201486082f13a2bfdb1983af6b76697c14f
|
/SeleniumBasics/src/com/class03/Xpathdemo.java
|
b882c1e55fc1aa2c4a829a16ab48408e303889f1
|
[] |
no_license
|
zoya-ua/Java-Selenium-
|
https://github.com/zoya-ua/Java-Selenium-
|
ea40d37935c8e28c3928aa9a641f9a605c7f7333
|
bf0a095bcdbd2c4d010bc0dbcc73b64e6348b184
|
refs/heads/master
| 2020-05-30T14:51:49.762000 | 2019-06-18T15:00:11 | 2019-06-18T15:00:11 | 189,801,933 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.class03;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Xpathdemo {
public static void main(String[] args) throws InterruptedException {
System.setProperty("webdriver.gecko.driver", "/Users/zoiapekun/Selenium/geckodriver");
WebDriver driver=new FirefoxDriver();
driver.get("https://www.saucedemo.com/");
Thread.sleep(2000);
driver.findElement(By.xpath("//input[@id='user-name']")).sendKeys("standard_user");
Thread.sleep(2000);
driver.findElement(By.xpath("//input[@type='password']")).sendKeys("secret_sauce");
driver.findElement(By.xpath("//input[@class='btn_action']")).click();
Thread.sleep(2000);
driver.close();
}
}
|
UTF-8
|
Java
| 737 |
java
|
Xpathdemo.java
|
Java
|
[
{
"context": "m.setProperty(\"webdriver.gecko.driver\", \"/Users/zoiapekun/Selenium/geckodriver\");\n\tWebDriver driver=new ",
"end": 298,
"score": 0.7654002904891968,
"start": 294,
"tag": "USERNAME",
"value": "iape"
},
{
"context": "Property(\"webdriver.gecko.driver\", \"/Users/zoiapekun/Selenium/geckodriver\");\n\tWebDriver driver=new Fir",
"end": 301,
"score": 0.5304802060127258,
"start": 299,
"tag": "USERNAME",
"value": "un"
},
{
"context": "t(By.xpath(\"//input[@id='user-name']\")).sendKeys(\"standard_user\");\n\t\n\tThread.sleep(2000);\n\tdriver.findElement(By.",
"end": 510,
"score": 0.9365893006324768,
"start": 497,
"tag": "USERNAME",
"value": "standard_user"
},
{
"context": "(By.xpath(\"//input[@type='password']\")).sendKeys(\"secret_sauce\");\n\tdriver.findElement(By.xpath(\"//input[@class='",
"end": 618,
"score": 0.9989433288574219,
"start": 606,
"tag": "PASSWORD",
"value": "secret_sauce"
}
] | null |
[] |
package com.class03;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Xpathdemo {
public static void main(String[] args) throws InterruptedException {
System.setProperty("webdriver.gecko.driver", "/Users/zoiapekun/Selenium/geckodriver");
WebDriver driver=new FirefoxDriver();
driver.get("https://www.saucedemo.com/");
Thread.sleep(2000);
driver.findElement(By.xpath("//input[@id='user-name']")).sendKeys("standard_user");
Thread.sleep(2000);
driver.findElement(By.xpath("//input[@type='password']")).sendKeys("<PASSWORD>");
driver.findElement(By.xpath("//input[@class='btn_action']")).click();
Thread.sleep(2000);
driver.close();
}
}
| 735 | 0.740841 | 0.721845 | 22 | 32.5 | 29.073183 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.318182 | false | false |
5
|
4a8f9307a84bcd1f14abda58a043b71d1db21292
| 30,193,620,106,453 |
1cff0bb8581265082257363c2904024bc7db3bd3
|
/retrieval/src/frame/retrieval/engine/index/RetrievalIndexLock.java
|
33690fddce130bfd119914eec56f42b404fe6474
|
[] |
no_license
|
FashtimeDotCom/retrieval2014
|
https://github.com/FashtimeDotCom/retrieval2014
|
f1d3bc22d8f72af12883e54a84e6e60b3036a2a5
|
f63d70bd1946e7a375671096e53c0f83b6b459a3
|
refs/heads/master
| 2021-01-17T19:17:00.957000 | 2015-03-20T06:07:31 | 2015-03-20T06:07:31 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package frame.retrieval.engine.index;
import java.util.Hashtable;
import java.util.Map;
import java.util.concurrent.locks.ReentrantLock;
/**
* 索引同步锁管理
*
* @author
*
*/
public class RetrievalIndexLock {
private static RetrievalIndexLock retrievalIndexLock = new RetrievalIndexLock();
private Object synchronizedObject = new Object();
private Map<String, ReentrantLock> lockMap = new Hashtable<String, ReentrantLock>();
private RetrievalIndexLock() {
}
/**
* 获取锁管理实例
*
* @return
*/
public static RetrievalIndexLock getInstance() {
return retrievalIndexLock;
}
/**
* 获取锁
*
* @param indexPathType
*/
public void lock(String indexPathType) {
ReentrantLock lock = lockMap.get(indexPathType.toUpperCase());
if (lock == null) {
synchronized (synchronizedObject) {
lock = lockMap.get(indexPathType.toUpperCase());
if (lock == null) {
lock = new ReentrantLock();
lockMap.put(indexPathType, lock);
}
}
}
lock.lock();
}
/**
* 释放锁
*
* @param indexPathType
*/
public void unlock(String indexPathType) {
ReentrantLock lock = lockMap.get(indexPathType.toUpperCase());
lock.unlock();
}
}
|
UTF-8
|
Java
| 1,269 |
java
|
RetrievalIndexLock.java
|
Java
|
[] | null |
[] |
package frame.retrieval.engine.index;
import java.util.Hashtable;
import java.util.Map;
import java.util.concurrent.locks.ReentrantLock;
/**
* 索引同步锁管理
*
* @author
*
*/
public class RetrievalIndexLock {
private static RetrievalIndexLock retrievalIndexLock = new RetrievalIndexLock();
private Object synchronizedObject = new Object();
private Map<String, ReentrantLock> lockMap = new Hashtable<String, ReentrantLock>();
private RetrievalIndexLock() {
}
/**
* 获取锁管理实例
*
* @return
*/
public static RetrievalIndexLock getInstance() {
return retrievalIndexLock;
}
/**
* 获取锁
*
* @param indexPathType
*/
public void lock(String indexPathType) {
ReentrantLock lock = lockMap.get(indexPathType.toUpperCase());
if (lock == null) {
synchronized (synchronizedObject) {
lock = lockMap.get(indexPathType.toUpperCase());
if (lock == null) {
lock = new ReentrantLock();
lockMap.put(indexPathType, lock);
}
}
}
lock.lock();
}
/**
* 释放锁
*
* @param indexPathType
*/
public void unlock(String indexPathType) {
ReentrantLock lock = lockMap.get(indexPathType.toUpperCase());
lock.unlock();
}
}
| 1,269 | 0.651749 | 0.651749 | 60 | 18.483334 | 21.44022 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.433333 | false | false |
5
|
ff7135bd87ceb647034221759cb82b8dde08a881
| 29,850,022,711,895 |
3c3ee30d5fceff21b03c24022bdd96f777e85b63
|
/src/main/java/com/weibo/web/servlet/AddComment.java
|
8cbb2eacb92d008473e99952cc97f7246aac2a7f
|
[
"MIT"
] |
permissive
|
liuxiaolsdx/SimpleWeibo
|
https://github.com/liuxiaolsdx/SimpleWeibo
|
761b80b97e2699f1c96fce095b0e2723498a129a
|
500bfdda3c54f242ce814e39929ee16d6e6247df
|
refs/heads/master
| 2021-01-10T08:12:44.565000 | 2016-03-15T16:23:27 | 2016-03-15T16:23:27 | 45,926,270 | 4 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.weibo.web.servlet;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import com.weibo.model.dao.CommentDao;
import com.weibo.model.entity.Comment;
import com.weibo.model.entity.UserInfo;
public class AddComment extends HttpServlet{
private static final long serialVersionUID = -9177281840218145911L;
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
response.setContentType("text/html;charset=UTF-8");
request.setCharacterEncoding("UTF-8");
HttpSession s = request.getSession();
UserInfo currUser = (UserInfo) s.getAttribute("userinfo");//get current user from session
int uid = currUser.getU_id();
String content = request.getParameter("comment");
int bid = Integer.parseInt(request.getParameter("bid"));
Comment comm = new Comment();
comm.setUid(uid);
comm.setContent(content);
comm.setBid(bid);
CommentDao cDao = new CommentDao();
PrintWriter out = response.getWriter();
if(cDao.CommentPublish(comm)){
response.sendRedirect("home");
}else{
out.println("评论失败,请重试");
}
}
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
doPost(request,response);
}
}
|
UTF-8
|
Java
| 1,296 |
java
|
AddComment.java
|
Java
|
[] | null |
[] |
package com.weibo.web.servlet;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import com.weibo.model.dao.CommentDao;
import com.weibo.model.entity.Comment;
import com.weibo.model.entity.UserInfo;
public class AddComment extends HttpServlet{
private static final long serialVersionUID = -9177281840218145911L;
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
response.setContentType("text/html;charset=UTF-8");
request.setCharacterEncoding("UTF-8");
HttpSession s = request.getSession();
UserInfo currUser = (UserInfo) s.getAttribute("userinfo");//get current user from session
int uid = currUser.getU_id();
String content = request.getParameter("comment");
int bid = Integer.parseInt(request.getParameter("bid"));
Comment comm = new Comment();
comm.setUid(uid);
comm.setContent(content);
comm.setBid(bid);
CommentDao cDao = new CommentDao();
PrintWriter out = response.getWriter();
if(cDao.CommentPublish(comm)){
response.sendRedirect("home");
}else{
out.println("评论失败,请重试");
}
}
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
doPost(request,response);
}
}
| 1,296 | 0.750781 | 0.734375 | 47 | 26.234043 | 28.459164 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.702128 | false | false |
5
|
c5cb470841439fce50a56baa36e6d4416fb4c431
| 3,659,312,158,489 |
9ceeb73113b7a4431b33d75df40b61cdaaf9beaf
|
/plugin-xml/src/main/java/nl/xillio/xill/plugins/xml/constructs/XPathConstruct.java
|
040db8ca95a21e7c9d645eebccaea20e6804204d
|
[
"Apache-2.0"
] |
permissive
|
XillioQA/xill-platform-3.4
|
https://github.com/XillioQA/xill-platform-3.4
|
0ead1549bdf69faa90a8166606f20e92d3c64540
|
536ff3e13c9a6ba5afd2d80d390e2a29be8c747b
|
refs/heads/master
| 2019-04-28T11:30:34.648000 | 2017-02-22T17:39:58 | 2017-02-22T17:39:58 | 82,579,582 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* Copyright (C) 2014 Xillio (support@xillio.com)
*
* 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 nl.xillio.xill.plugins.xml.constructs;
import com.google.inject.Inject;
import nl.xillio.xill.api.components.ExpressionDataType;
import nl.xillio.xill.api.components.MetaExpression;
import nl.xillio.xill.api.construct.Argument;
import nl.xillio.xill.api.construct.Construct;
import nl.xillio.xill.api.construct.ConstructContext;
import nl.xillio.xill.api.construct.ConstructProcessor;
import nl.xillio.xill.api.data.XmlNode;
import nl.xillio.xill.api.errors.InvalidUserInputException;
import nl.xillio.xill.api.errors.OperationFailedException;
import nl.xillio.xill.plugins.xml.data.XmlNodeVar;
import nl.xillio.xill.plugins.xml.services.XpathService;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;
/**
* Returns selected XML node(s) from XML document using XPath locator.
* Converts the output to facilitate interaction with Xill: single valued lists are converted to ATOMIC,
* attributes are converted to OBJECT, text nodes of all kinds are converted to strings.
*
* @author Zbynek Hochmann
* @author andrea.parrilli
*/
public class XPathConstruct extends Construct {
@Inject
private XpathService xpathService;
@Override
public ConstructProcessor prepareProcess(ConstructContext context) {
return new ConstructProcessor(
(element, xPath, namespaces) -> process(element, xPath, namespaces, xpathService),
new Argument("element", ATOMIC),
new Argument("xPath", ATOMIC),
new Argument("namespaces", NULL, OBJECT)
);
}
@SuppressWarnings("unchecked")
static MetaExpression process(MetaExpression elementVar, MetaExpression xpathVar, MetaExpression namespacesVar, XpathService service) {
// Validate
XmlNode node = assertMeta(elementVar, "node", XmlNode.class, "XML node");
Map<String, String> namespaces = new LinkedHashMap<>();
if (!namespacesVar.isNull()) {
if (namespacesVar.getType() != ExpressionDataType.OBJECT) {
throw new InvalidUserInputException("invalid namespace info: should be an OBJECT, got " + namespacesVar.getType().toString(),
namespacesVar.getStringValue(),
"an OBJECT containing the as keys the namespaces prefixes and as values the namespaces URIs");
}
for (Entry<String, MetaExpression> pair : ((Map<String, MetaExpression>) namespacesVar.getValue()).entrySet()) {
namespaces.put(pair.getKey(), pair.getValue().getStringValue());
}
}
Object result = service.xpath(node, xpathVar.getStringValue(), namespaces);
return xpathResultToMetaExpression(result, service);
}
protected static MetaExpression xpathResultToMetaExpression(Object result, XpathService service) {
if(result instanceof String) {
return fromValue((String) result);
}
else if(result instanceof NodeList) {
return xpathResultToMetaExpression((NodeList) result, service);
}
else if(result instanceof Node) {
return xpathResultToMetaExpression((Node) result);
}
else {
throw new OperationFailedException("extract information from XML node list", "unexpected result type: " + result.getClass().getSimpleName());
}
}
protected static MetaExpression xpathResultToMetaExpression(final NodeList result, XpathService service) {
int resultCardinality = result.getLength();
if(resultCardinality == 0) {
return NULL;
}
else if(resultCardinality == 1) {
return xpathResultToMetaExpression(result.item(0));
}
else {
return fromValue(service.asStream(result).map(XPathConstruct::xpathResultToMetaExpression).collect(Collectors.toList()));
}
}
protected static MetaExpression xpathResultToMetaExpression(final Node node) {
short nodeType = node.getNodeType();
if (nodeType == Node.CDATA_SECTION_NODE ||
nodeType == Node.ENTITY_NODE ||
nodeType == Node.TEXT_NODE) {
return fromValue(node.getTextContent());
}
else if (nodeType == Node.ATTRIBUTE_NODE) {
LinkedHashMap<String, MetaExpression> attributeMap = new LinkedHashMap<>();
attributeMap.put(node.getNodeName(), fromValue(node.getNodeValue()));
return fromValue(attributeMap);
}
else {
// XML nodes that cannot be converted to something xill: attach metadata expression
return makeXmlNodeMetaExpression(node);
}
}
protected static MetaExpression makeXmlNodeMetaExpression(final Node node) {
MetaExpression output = fromValue(node.toString());
output.storeMeta(new XmlNodeVar(node));
return output;
}
}
|
UTF-8
|
Java
| 5,751 |
java
|
XPathConstruct.java
|
Java
|
[
{
"context": "/**\r\n * Copyright (C) 2014 Xillio (support@xillio.com)\r\n *\r\n * Licensed under the A",
"end": 33,
"score": 0.998990535736084,
"start": 27,
"tag": "NAME",
"value": "Xillio"
},
{
"context": "/**\r\n * Copyright (C) 2014 Xillio (support@xillio.com)\r\n *\r\n * Licensed under the Apache License, Versi",
"end": 53,
"score": 0.9999247789382935,
"start": 35,
"tag": "EMAIL",
"value": "support@xillio.com"
},
{
"context": "ll kinds are converted to strings.\r\n *\r\n * @author Zbynek Hochmann\r\n * @author andrea.parrilli\r\n */\r\npublic class XP",
"end": 1795,
"score": 0.9998365044593811,
"start": 1780,
"tag": "NAME",
"value": "Zbynek Hochmann"
},
{
"context": "rings.\r\n *\r\n * @author Zbynek Hochmann\r\n * @author andrea.parrilli\r\n */\r\npublic class XPathConstruct extend",
"end": 1814,
"score": 0.9166804552078247,
"start": 1808,
"tag": "NAME",
"value": "andrea"
},
{
"context": "\n *\r\n * @author Zbynek Hochmann\r\n * @author andrea.parrilli\r\n */\r\npublic class XPathConstruct extends",
"end": 1814,
"score": 0.5453479886054993,
"start": 1814,
"tag": "USERNAME",
"value": ""
},
{
"context": " *\r\n * @author Zbynek Hochmann\r\n * @author andrea.parrilli\r\n */\r\npublic class XPathConstruct extends Constru",
"end": 1823,
"score": 0.991762101650238,
"start": 1815,
"tag": "NAME",
"value": "parrilli"
}
] | null |
[] |
/**
* Copyright (C) 2014 Xillio (<EMAIL>)
*
* 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 nl.xillio.xill.plugins.xml.constructs;
import com.google.inject.Inject;
import nl.xillio.xill.api.components.ExpressionDataType;
import nl.xillio.xill.api.components.MetaExpression;
import nl.xillio.xill.api.construct.Argument;
import nl.xillio.xill.api.construct.Construct;
import nl.xillio.xill.api.construct.ConstructContext;
import nl.xillio.xill.api.construct.ConstructProcessor;
import nl.xillio.xill.api.data.XmlNode;
import nl.xillio.xill.api.errors.InvalidUserInputException;
import nl.xillio.xill.api.errors.OperationFailedException;
import nl.xillio.xill.plugins.xml.data.XmlNodeVar;
import nl.xillio.xill.plugins.xml.services.XpathService;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;
/**
* Returns selected XML node(s) from XML document using XPath locator.
* Converts the output to facilitate interaction with Xill: single valued lists are converted to ATOMIC,
* attributes are converted to OBJECT, text nodes of all kinds are converted to strings.
*
* @author <NAME>
* @author andrea.parrilli
*/
public class XPathConstruct extends Construct {
@Inject
private XpathService xpathService;
@Override
public ConstructProcessor prepareProcess(ConstructContext context) {
return new ConstructProcessor(
(element, xPath, namespaces) -> process(element, xPath, namespaces, xpathService),
new Argument("element", ATOMIC),
new Argument("xPath", ATOMIC),
new Argument("namespaces", NULL, OBJECT)
);
}
@SuppressWarnings("unchecked")
static MetaExpression process(MetaExpression elementVar, MetaExpression xpathVar, MetaExpression namespacesVar, XpathService service) {
// Validate
XmlNode node = assertMeta(elementVar, "node", XmlNode.class, "XML node");
Map<String, String> namespaces = new LinkedHashMap<>();
if (!namespacesVar.isNull()) {
if (namespacesVar.getType() != ExpressionDataType.OBJECT) {
throw new InvalidUserInputException("invalid namespace info: should be an OBJECT, got " + namespacesVar.getType().toString(),
namespacesVar.getStringValue(),
"an OBJECT containing the as keys the namespaces prefixes and as values the namespaces URIs");
}
for (Entry<String, MetaExpression> pair : ((Map<String, MetaExpression>) namespacesVar.getValue()).entrySet()) {
namespaces.put(pair.getKey(), pair.getValue().getStringValue());
}
}
Object result = service.xpath(node, xpathVar.getStringValue(), namespaces);
return xpathResultToMetaExpression(result, service);
}
protected static MetaExpression xpathResultToMetaExpression(Object result, XpathService service) {
if(result instanceof String) {
return fromValue((String) result);
}
else if(result instanceof NodeList) {
return xpathResultToMetaExpression((NodeList) result, service);
}
else if(result instanceof Node) {
return xpathResultToMetaExpression((Node) result);
}
else {
throw new OperationFailedException("extract information from XML node list", "unexpected result type: " + result.getClass().getSimpleName());
}
}
protected static MetaExpression xpathResultToMetaExpression(final NodeList result, XpathService service) {
int resultCardinality = result.getLength();
if(resultCardinality == 0) {
return NULL;
}
else if(resultCardinality == 1) {
return xpathResultToMetaExpression(result.item(0));
}
else {
return fromValue(service.asStream(result).map(XPathConstruct::xpathResultToMetaExpression).collect(Collectors.toList()));
}
}
protected static MetaExpression xpathResultToMetaExpression(final Node node) {
short nodeType = node.getNodeType();
if (nodeType == Node.CDATA_SECTION_NODE ||
nodeType == Node.ENTITY_NODE ||
nodeType == Node.TEXT_NODE) {
return fromValue(node.getTextContent());
}
else if (nodeType == Node.ATTRIBUTE_NODE) {
LinkedHashMap<String, MetaExpression> attributeMap = new LinkedHashMap<>();
attributeMap.put(node.getNodeName(), fromValue(node.getNodeValue()));
return fromValue(attributeMap);
}
else {
// XML nodes that cannot be converted to something xill: attach metadata expression
return makeXmlNodeMetaExpression(node);
}
}
protected static MetaExpression makeXmlNodeMetaExpression(final Node node) {
MetaExpression output = fromValue(node.toString());
output.storeMeta(new XmlNodeVar(node));
return output;
}
}
| 5,731 | 0.668058 | 0.665797 | 137 | 39.978104 | 35.082691 | 153 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.649635 | false | false |
5
|
9de1990f521537406ed7b5ae6eb9e38a4cab826b
| 3,659,312,157,794 |
70cae3320b2bf162639dd989f8e16d49b6f2adb9
|
/app/src/main/java/com/example/bkbiswas/shohojbibaho/CarRegister.java
|
fd37abfec99c067e152bfdda384a2fc3f751fe12
|
[] |
no_license
|
swapbiswas1234567/ShohojBibaho
|
https://github.com/swapbiswas1234567/ShohojBibaho
|
d027cb4f18dc3b9842ee6ea49055617edfe61ef5
|
3249dd268b7c0498ba5fa44dcfba3f2233b8b209
|
refs/heads/master
| 2020-03-28T01:01:02.297000 | 2019-11-04T11:26:22 | 2019-11-04T11:26:22 | 147,469,304 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.bkbiswas.shohojbibaho;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.preference.PreferenceManager;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.Toast;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.UploadTask;
public class CarRegister extends AppCompatActivity {
private EditText regNo,noOfSeats,driverName, driverLicense,driverPhone,expectedAmount;
private Spinner carType;
private Button register,chooseCar;
private ImageView img;
int x = 0;
private ProgressDialog progressDialog;
private String userName, contactNo, owner,carRegistrationNo;
private Uri uri;
private StorageReference mStorageRef;
private void takeInput(){
final String cType,seats,driversName,driversLicenseNo,driversPhoneNo,expectedAmountperHour,email;
Intent intent = getIntent();
carRegistrationNo = regNo.getText().toString().trim();
cType = carType.getSelectedItem().toString().trim();
seats = noOfSeats.getText().toString().trim();
driversName = driverName.getText().toString().trim();
driversLicenseNo = driverLicense.getText().toString().trim();
driversPhoneNo = driverPhone.getText().toString().trim();
expectedAmountperHour = expectedAmount.getText().toString().trim();
userName = intent.getStringExtra("userName");
contactNo = intent.getStringExtra("contactNo");
owner = intent.getStringExtra("firstName") + " " + intent.getStringExtra("lastName");
if(carRegistrationNo.isEmpty()){
regNo.setError("You can't keep this field empty!");
return;
}
if(expectedAmountperHour.isEmpty()){
expectedAmount.setError("You can't keep this field empty!");
return;
}
final DatabaseReference d = FirebaseDatabase.getInstance().getReference("Car Info");
email = intent.getStringExtra("email");
final CarInfo carInfo = new CarInfo(carRegistrationNo, cType,seats,driversName,driversLicenseNo,driversPhoneNo,expectedAmountperHour,contactNo,userName,owner,email);
AlertDialog.Builder builder1 = new AlertDialog.Builder(CarRegister.this);
builder1.setMessage("Do you want to proceed?");
builder1.setCancelable(true);
builder1.setPositiveButton(
"Yes",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
if(x==0){
progressDialog = ProgressDialog.show(CarRegister.this,"Registering your car!","Please wait...",false,false);
d.child(carRegistrationNo).setValue(carInfo);
Intent intent = new Intent(CarRegister.this, Homepage.class);
startActivity(intent);
progressDialog.dismiss();
Toast.makeText(getApplicationContext(),"Registration successfull",Toast.LENGTH_SHORT).show();
}
else{
progressDialog = ProgressDialog.show(CarRegister.this,"Registering your car!","Please wait...",false,false);
mStorageRef = FirebaseStorage.getInstance().getReference("Car Info");
StorageReference imgRef = mStorageRef.child("/"+carRegistrationNo);
Log.e("onClick: ", imgRef.getName());
imgRef.putFile(uri).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
Uri downloadUrl = taskSnapshot.getDownloadUrl();
String location = downloadUrl.toString();
carInfo.setUri(location);
d.child(carRegistrationNo).setValue(carInfo);
Intent intent = new Intent(CarRegister.this, Homepage.class);
startActivity(intent);
progressDialog.dismiss();
Toast.makeText(getApplicationContext(),"Registration successfull",Toast.LENGTH_SHORT).show();
}
});
}
}
});
builder1.setNegativeButton(
"No",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert11 = builder1.create();
alert11.show();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.car_register);
regNo = findViewById(R.id.cr);
noOfSeats = findViewById(R.id.n);
driverName = findViewById(R.id.dn);
driverLicense = findViewById(R.id.dl);
driverPhone = findViewById(R.id.dp);
expectedAmount = findViewById(R.id.ea);
carType = findViewById(R.id.ct);
register = findViewById(R.id.rc);
img = findViewById(R.id.imgCar);
chooseCar = findViewById(R.id.chooseCar);
chooseCar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
x=1;
openGallery();
}
});
register.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
takeInput();
}
});
}
private void openGallery(){
Intent pickImage = new Intent(Intent.ACTION_OPEN_DOCUMENT);
pickImage.addCategory(Intent.CATEGORY_OPENABLE);
pickImage.setType("image/*");
startActivityForResult(pickImage,10);
}
private void upload(){
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent resultdata) {
if(requestCode==10 && resultCode== Activity.RESULT_OK){
if(resultdata != null){
uri = resultdata.getData();
img.setImageURI(null);
img.setImageURI(uri);
}
}
}
}
|
UTF-8
|
Java
| 7,249 |
java
|
CarRegister.java
|
Java
|
[
{
"context": "trim();\n userName = intent.getStringExtra(\"userName\");\n contactNo = intent.getStringExtra(\"con",
"end": 2038,
"score": 0.9960947632789612,
"start": 2030,
"tag": "USERNAME",
"value": "userName"
}
] | null |
[] |
package com.example.bkbiswas.shohojbibaho;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.preference.PreferenceManager;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.Toast;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.UploadTask;
public class CarRegister extends AppCompatActivity {
private EditText regNo,noOfSeats,driverName, driverLicense,driverPhone,expectedAmount;
private Spinner carType;
private Button register,chooseCar;
private ImageView img;
int x = 0;
private ProgressDialog progressDialog;
private String userName, contactNo, owner,carRegistrationNo;
private Uri uri;
private StorageReference mStorageRef;
private void takeInput(){
final String cType,seats,driversName,driversLicenseNo,driversPhoneNo,expectedAmountperHour,email;
Intent intent = getIntent();
carRegistrationNo = regNo.getText().toString().trim();
cType = carType.getSelectedItem().toString().trim();
seats = noOfSeats.getText().toString().trim();
driversName = driverName.getText().toString().trim();
driversLicenseNo = driverLicense.getText().toString().trim();
driversPhoneNo = driverPhone.getText().toString().trim();
expectedAmountperHour = expectedAmount.getText().toString().trim();
userName = intent.getStringExtra("userName");
contactNo = intent.getStringExtra("contactNo");
owner = intent.getStringExtra("firstName") + " " + intent.getStringExtra("lastName");
if(carRegistrationNo.isEmpty()){
regNo.setError("You can't keep this field empty!");
return;
}
if(expectedAmountperHour.isEmpty()){
expectedAmount.setError("You can't keep this field empty!");
return;
}
final DatabaseReference d = FirebaseDatabase.getInstance().getReference("Car Info");
email = intent.getStringExtra("email");
final CarInfo carInfo = new CarInfo(carRegistrationNo, cType,seats,driversName,driversLicenseNo,driversPhoneNo,expectedAmountperHour,contactNo,userName,owner,email);
AlertDialog.Builder builder1 = new AlertDialog.Builder(CarRegister.this);
builder1.setMessage("Do you want to proceed?");
builder1.setCancelable(true);
builder1.setPositiveButton(
"Yes",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
if(x==0){
progressDialog = ProgressDialog.show(CarRegister.this,"Registering your car!","Please wait...",false,false);
d.child(carRegistrationNo).setValue(carInfo);
Intent intent = new Intent(CarRegister.this, Homepage.class);
startActivity(intent);
progressDialog.dismiss();
Toast.makeText(getApplicationContext(),"Registration successfull",Toast.LENGTH_SHORT).show();
}
else{
progressDialog = ProgressDialog.show(CarRegister.this,"Registering your car!","Please wait...",false,false);
mStorageRef = FirebaseStorage.getInstance().getReference("Car Info");
StorageReference imgRef = mStorageRef.child("/"+carRegistrationNo);
Log.e("onClick: ", imgRef.getName());
imgRef.putFile(uri).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
Uri downloadUrl = taskSnapshot.getDownloadUrl();
String location = downloadUrl.toString();
carInfo.setUri(location);
d.child(carRegistrationNo).setValue(carInfo);
Intent intent = new Intent(CarRegister.this, Homepage.class);
startActivity(intent);
progressDialog.dismiss();
Toast.makeText(getApplicationContext(),"Registration successfull",Toast.LENGTH_SHORT).show();
}
});
}
}
});
builder1.setNegativeButton(
"No",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert11 = builder1.create();
alert11.show();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.car_register);
regNo = findViewById(R.id.cr);
noOfSeats = findViewById(R.id.n);
driverName = findViewById(R.id.dn);
driverLicense = findViewById(R.id.dl);
driverPhone = findViewById(R.id.dp);
expectedAmount = findViewById(R.id.ea);
carType = findViewById(R.id.ct);
register = findViewById(R.id.rc);
img = findViewById(R.id.imgCar);
chooseCar = findViewById(R.id.chooseCar);
chooseCar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
x=1;
openGallery();
}
});
register.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
takeInput();
}
});
}
private void openGallery(){
Intent pickImage = new Intent(Intent.ACTION_OPEN_DOCUMENT);
pickImage.addCategory(Intent.CATEGORY_OPENABLE);
pickImage.setType("image/*");
startActivityForResult(pickImage,10);
}
private void upload(){
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent resultdata) {
if(requestCode==10 && resultCode== Activity.RESULT_OK){
if(resultdata != null){
uri = resultdata.getData();
img.setImageURI(null);
img.setImageURI(uri);
}
}
}
}
| 7,249 | 0.602566 | 0.599945 | 200 | 35.244999 | 32.342308 | 173 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | false | false |
5
|
067d732ba7d9b3205ffa88d92b5022fb18089837
| 31,894,427,159,293 |
3f5b7a89cecfdfa7e811f78e8993db2a3ae45c21
|
/main/java/mod/nethertweaks/registry/registries/base/types/Heat.java
|
6cd642e7209de64d01dcd276aff46b3afa5e500d
|
[] |
no_license
|
BarelyAlive/Nether-Tweaks
|
https://github.com/BarelyAlive/Nether-Tweaks
|
fbc10dd6102a07b030e5d80eb5af4cc4869fe228
|
cce046e4cc5313b8e834b28368a44ca11f408812
|
refs/heads/master
| 2020-12-24T08:09:46.561000 | 2020-01-03T12:23:13 | 2020-01-03T12:23:13 | 57,054,703 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package mod.nethertweaks.registry.registries.base.types;
import mod.sfhcore.util.BlockInfo;
import net.minecraft.item.ItemStack;
public class Heat
{
//Heat Helper
@Override
public String toString() {
return "Heat [item=" + item + ", value=" + value + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (item == null ? 0 : item.hashCode());
result = prime * result + value;
return result;
}
@Override
public boolean equals(final Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final Heat other = (Heat) obj;
if (item == null) {
if (other.item != null)
return false;
} else if (!item.equals(other.item))
return false;
return value == other.value;
}
private final BlockInfo item;
private final int value;
public static Heat getEMPTY() {
return EMPTY;
}
public static void setEMPTY(final Heat eMPTY) {
EMPTY = eMPTY;
}
static Heat EMPTY = new Heat(new BlockInfo(ItemStack.EMPTY), 0);
public Heat(final BlockInfo stack, final int value)
{
item = stack;
this.value = value;
}
public BlockInfo getItem()
{
return item;
}
public int getValue()
{
return value;
}
}
|
UTF-8
|
Java
| 1,289 |
java
|
Heat.java
|
Java
|
[] | null |
[] |
package mod.nethertweaks.registry.registries.base.types;
import mod.sfhcore.util.BlockInfo;
import net.minecraft.item.ItemStack;
public class Heat
{
//Heat Helper
@Override
public String toString() {
return "Heat [item=" + item + ", value=" + value + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (item == null ? 0 : item.hashCode());
result = prime * result + value;
return result;
}
@Override
public boolean equals(final Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final Heat other = (Heat) obj;
if (item == null) {
if (other.item != null)
return false;
} else if (!item.equals(other.item))
return false;
return value == other.value;
}
private final BlockInfo item;
private final int value;
public static Heat getEMPTY() {
return EMPTY;
}
public static void setEMPTY(final Heat eMPTY) {
EMPTY = eMPTY;
}
static Heat EMPTY = new Heat(new BlockInfo(ItemStack.EMPTY), 0);
public Heat(final BlockInfo stack, final int value)
{
item = stack;
this.value = value;
}
public BlockInfo getItem()
{
return item;
}
public int getValue()
{
return value;
}
}
| 1,289 | 0.651668 | 0.647789 | 69 | 17.68116 | 17.127394 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.565217 | false | false |
5
|
1b8ad3d7aea46fae155c09684988abde7d6131cf
| 21,998,822,512,571 |
4ef27f621fcbc0dd4142b4305a36bb1e0c548243
|
/app/src/main/java/de/shm/fangbuch/AddFish.java
|
424dce987ea245adca4fa953422f40915ea068db
|
[] |
no_license
|
smundner/FangBuch
|
https://github.com/smundner/FangBuch
|
fc0f46dee3d23142979fa184bfc6b60e41ab506e
|
e42031e6dda0944b8507933da82aa4c2387b1e79
|
refs/heads/master
| 2021-01-17T18:42:15.339000 | 2017-06-27T10:55:37 | 2017-06-27T10:55:37 | 95,548,780 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package de.shm.fangbuch;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.content.FileProvider;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.Spinner;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link AddFish.OnFragmentInteractionListener} interface
* to handle interaction events.
* Use the {@link AddFish#newInstance} factory method to
* create an instance of this fragment.
*/
public class AddFish extends Fragment {
static final int REQUEST_IMAGE_CAPTURE = 1;
static final int REQUEST_TAKE_PHOTO = 2;
public final static String ADD_FISH = "AddFish";
public final static String LON = "LON";
public final static String LAT = "LAT";
public final static String ART = "ART";
public final static String GROESSE = "groesse";
public final static String GEWICHT = "gewicht";
public final static String LOCATION = "ort";
public final static String KOEDER = "Koeder";
public final static String TEMPERATUR = "Temperatur";
public final static String LUFTDRUCK = "Luftdruck";
public final static String WETTER = "Wetter";
private double latitude;
private double longtitude;
private Weather mWeather;
Spinner spinnerChooseFish;
EditText editTextSize;
EditText editTextGewicht;
EditText editTextLocation;
AutoCompleteTextView autoCompleteTextViewBait;
private String mCurrentPhotoPath;
public AddFish() {
// Required empty public constructor
}
public static AddFish newInstance(double lon, double lat) {
AddFish fragment = new AddFish();
Bundle args = new Bundle();
args.putDouble(LON,lon);
args.putDouble(LAT,lat);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(getArguments()!=null){
longtitude = getArguments().getDouble(LON);
latitude = getArguments().getDouble(LAT);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
FloatingActionButton floatingActionButton = (FloatingActionButton) getActivity().findViewById(R.id.fab);
floatingActionButton.hide();
View view = inflater.inflate(R.layout.fragment_addfish, container, false);
ImageButton imageButtonAddPicture = (ImageButton) view.findViewById(R.id.imageButtonNewFishAddPicture);
imageButtonAddPicture.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dispatchTakePictureIntent();
}
});
spinnerChooseFish = (Spinner) view.findViewById(R.id.spinnerChooseFish);
String[] fishes = getActivity().getResources().getStringArray(R.array.fishes);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(view.getContext(),android.R.layout.simple_spinner_dropdown_item,fishes);
spinnerChooseFish.setAdapter(adapter);
FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
FragmentTransaction transaction = fragmentManager.beginTransaction();
mWeather = Weather.newInstance(longtitude,latitude);
transaction.replace(R.id.addFishFragment,mWeather,Weather.WEATHER_FRAGMENT);
transaction.commit();
final Button buttonFishDeclair = (Button) view.findViewById(R.id.buttonNewFishDeclair);
buttonFishDeclair.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FragmentManager fm = getActivity().getSupportFragmentManager();
FishDeclair fd = FishDeclair.newInstance(spinnerChooseFish.getSelectedItem().toString());
fd.show(fm,FishDeclair.FISH_DECLAIR);
}
});
final Button buttonSaveFish = (Button) view.findViewById(R.id.buttonNewFishSave);
buttonSaveFish.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
saveFisch();
}
});
editTextSize = (EditText) view.findViewById(R.id.editTextNewFishSize) ;
editTextGewicht = (EditText) view.findViewById(R.id.editTextNewFishWeight);
editTextLocation = (EditText) view.findViewById(R.id.editTextNewFishLocation);
autoCompleteTextViewBait = (AutoCompleteTextView) view.findViewById(R.id.autoComTextViewNewFishBait);
return view;
}
public void onButtonPressed(Uri uri) {
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
}
@Override
public void onDetach() {
super.onDetach();
FloatingActionButton floatingActionButton = (FloatingActionButton) getActivity().findViewById(R.id.fab);
floatingActionButton.show();
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == getActivity().RESULT_OK){
Bundle extras = data.getExtras();
Bitmap imageBitmap = (Bitmap) extras.get("data");
final ImageView imageViewPicture = (ImageView) getView().findViewById(R.id.imageViewNewFishPicture);
imageViewPicture.setImageBitmap(imageBitmap);
}
if(requestCode == REQUEST_TAKE_PHOTO && resultCode == getActivity().RESULT_OK){
setPic();
}
}
public interface OnFragmentInteractionListener {
void onFragmentInteraction(Uri uri);
}
private void dispatchTakePictureIntent(){
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if(takePictureIntent.resolveActivity(getActivity().getPackageManager())!=null){
File photoFile = null;
try {
photoFile = creatImageFile();
}catch (IOException e){
e.printStackTrace();
}
if(photoFile!=null) {
Uri photoURI = FileProvider.getUriForFile(getActivity(),"de.shm.fangbuch",photoFile);
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT,photoURI);
startActivityForResult(takePictureIntent, REQUEST_TAKE_PHOTO);
}
}
}
private File creatImageFile() throws IOException {
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
String imageFileName = "JPEG_" + timeStamp + "_";
File storageDir = getActivity().getExternalFilesDir(Environment.DIRECTORY_PICTURES);
File image = File.createTempFile(imageFileName,".jpg",storageDir);
mCurrentPhotoPath="file:"+image.getAbsolutePath();
return image;
}
private void setPic(){
ImageView imageViewNewFishPic = (ImageView) getView().findViewById(R.id.imageViewNewFishPicture);
int targetW = imageViewNewFishPic.getWidth();
int targetH = imageViewNewFishPic.getHeight();
BitmapFactory.Options bmOptions = new BitmapFactory.Options();
bmOptions.inJustDecodeBounds = true;
BitmapFactory.decodeFile(mCurrentPhotoPath.replaceFirst("file:",""),bmOptions);
int photoW = bmOptions.outWidth;
int photoH = bmOptions.outHeight;
int scaleFactor = Math.min(photoW/targetW,photoH/targetH);
bmOptions.inJustDecodeBounds=false;
bmOptions.inSampleSize=scaleFactor;
bmOptions.inPurgeable=true;
Bitmap bitmap = BitmapFactory.decodeFile(mCurrentPhotoPath.replaceFirst("file:",""),bmOptions);
imageViewNewFishPic.setImageBitmap(bitmap);
}
private void saveFisch(){
JSONObject store = new JSONObject();
try {
store.put(LAT,latitude);
store.put(LON,longtitude);
String fischArt = spinnerChooseFish.getSelectedItem().toString();
store.put(ART,fischArt);
store.put(GROESSE,Long.parseLong(editTextSize.getText().toString()));
store.put(GEWICHT,Long.parseLong(editTextGewicht.getText().toString()));
store.put(LOCATION,editTextLocation.getText().toString());
store.put(KOEDER,autoCompleteTextViewBait.getText().toString());
store.put(TEMPERATUR,mWeather.getTemperatur());
store.put(LUFTDRUCK,mWeather.getPressure());
Log.d(ADD_FISH,store.toString());
} catch (JSONException e) {
e.printStackTrace();
}catch (NumberFormatException e){
e.printStackTrace();
}
}
}
|
UTF-8
|
Java
| 9,755 |
java
|
AddFish.java
|
Java
|
[] | null |
[] |
package de.shm.fangbuch;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.content.FileProvider;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.Spinner;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link AddFish.OnFragmentInteractionListener} interface
* to handle interaction events.
* Use the {@link AddFish#newInstance} factory method to
* create an instance of this fragment.
*/
public class AddFish extends Fragment {
static final int REQUEST_IMAGE_CAPTURE = 1;
static final int REQUEST_TAKE_PHOTO = 2;
public final static String ADD_FISH = "AddFish";
public final static String LON = "LON";
public final static String LAT = "LAT";
public final static String ART = "ART";
public final static String GROESSE = "groesse";
public final static String GEWICHT = "gewicht";
public final static String LOCATION = "ort";
public final static String KOEDER = "Koeder";
public final static String TEMPERATUR = "Temperatur";
public final static String LUFTDRUCK = "Luftdruck";
public final static String WETTER = "Wetter";
private double latitude;
private double longtitude;
private Weather mWeather;
Spinner spinnerChooseFish;
EditText editTextSize;
EditText editTextGewicht;
EditText editTextLocation;
AutoCompleteTextView autoCompleteTextViewBait;
private String mCurrentPhotoPath;
public AddFish() {
// Required empty public constructor
}
public static AddFish newInstance(double lon, double lat) {
AddFish fragment = new AddFish();
Bundle args = new Bundle();
args.putDouble(LON,lon);
args.putDouble(LAT,lat);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(getArguments()!=null){
longtitude = getArguments().getDouble(LON);
latitude = getArguments().getDouble(LAT);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
FloatingActionButton floatingActionButton = (FloatingActionButton) getActivity().findViewById(R.id.fab);
floatingActionButton.hide();
View view = inflater.inflate(R.layout.fragment_addfish, container, false);
ImageButton imageButtonAddPicture = (ImageButton) view.findViewById(R.id.imageButtonNewFishAddPicture);
imageButtonAddPicture.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dispatchTakePictureIntent();
}
});
spinnerChooseFish = (Spinner) view.findViewById(R.id.spinnerChooseFish);
String[] fishes = getActivity().getResources().getStringArray(R.array.fishes);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(view.getContext(),android.R.layout.simple_spinner_dropdown_item,fishes);
spinnerChooseFish.setAdapter(adapter);
FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
FragmentTransaction transaction = fragmentManager.beginTransaction();
mWeather = Weather.newInstance(longtitude,latitude);
transaction.replace(R.id.addFishFragment,mWeather,Weather.WEATHER_FRAGMENT);
transaction.commit();
final Button buttonFishDeclair = (Button) view.findViewById(R.id.buttonNewFishDeclair);
buttonFishDeclair.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FragmentManager fm = getActivity().getSupportFragmentManager();
FishDeclair fd = FishDeclair.newInstance(spinnerChooseFish.getSelectedItem().toString());
fd.show(fm,FishDeclair.FISH_DECLAIR);
}
});
final Button buttonSaveFish = (Button) view.findViewById(R.id.buttonNewFishSave);
buttonSaveFish.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
saveFisch();
}
});
editTextSize = (EditText) view.findViewById(R.id.editTextNewFishSize) ;
editTextGewicht = (EditText) view.findViewById(R.id.editTextNewFishWeight);
editTextLocation = (EditText) view.findViewById(R.id.editTextNewFishLocation);
autoCompleteTextViewBait = (AutoCompleteTextView) view.findViewById(R.id.autoComTextViewNewFishBait);
return view;
}
public void onButtonPressed(Uri uri) {
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
}
@Override
public void onDetach() {
super.onDetach();
FloatingActionButton floatingActionButton = (FloatingActionButton) getActivity().findViewById(R.id.fab);
floatingActionButton.show();
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == getActivity().RESULT_OK){
Bundle extras = data.getExtras();
Bitmap imageBitmap = (Bitmap) extras.get("data");
final ImageView imageViewPicture = (ImageView) getView().findViewById(R.id.imageViewNewFishPicture);
imageViewPicture.setImageBitmap(imageBitmap);
}
if(requestCode == REQUEST_TAKE_PHOTO && resultCode == getActivity().RESULT_OK){
setPic();
}
}
public interface OnFragmentInteractionListener {
void onFragmentInteraction(Uri uri);
}
private void dispatchTakePictureIntent(){
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if(takePictureIntent.resolveActivity(getActivity().getPackageManager())!=null){
File photoFile = null;
try {
photoFile = creatImageFile();
}catch (IOException e){
e.printStackTrace();
}
if(photoFile!=null) {
Uri photoURI = FileProvider.getUriForFile(getActivity(),"de.shm.fangbuch",photoFile);
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT,photoURI);
startActivityForResult(takePictureIntent, REQUEST_TAKE_PHOTO);
}
}
}
private File creatImageFile() throws IOException {
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
String imageFileName = "JPEG_" + timeStamp + "_";
File storageDir = getActivity().getExternalFilesDir(Environment.DIRECTORY_PICTURES);
File image = File.createTempFile(imageFileName,".jpg",storageDir);
mCurrentPhotoPath="file:"+image.getAbsolutePath();
return image;
}
private void setPic(){
ImageView imageViewNewFishPic = (ImageView) getView().findViewById(R.id.imageViewNewFishPicture);
int targetW = imageViewNewFishPic.getWidth();
int targetH = imageViewNewFishPic.getHeight();
BitmapFactory.Options bmOptions = new BitmapFactory.Options();
bmOptions.inJustDecodeBounds = true;
BitmapFactory.decodeFile(mCurrentPhotoPath.replaceFirst("file:",""),bmOptions);
int photoW = bmOptions.outWidth;
int photoH = bmOptions.outHeight;
int scaleFactor = Math.min(photoW/targetW,photoH/targetH);
bmOptions.inJustDecodeBounds=false;
bmOptions.inSampleSize=scaleFactor;
bmOptions.inPurgeable=true;
Bitmap bitmap = BitmapFactory.decodeFile(mCurrentPhotoPath.replaceFirst("file:",""),bmOptions);
imageViewNewFishPic.setImageBitmap(bitmap);
}
private void saveFisch(){
JSONObject store = new JSONObject();
try {
store.put(LAT,latitude);
store.put(LON,longtitude);
String fischArt = spinnerChooseFish.getSelectedItem().toString();
store.put(ART,fischArt);
store.put(GROESSE,Long.parseLong(editTextSize.getText().toString()));
store.put(GEWICHT,Long.parseLong(editTextGewicht.getText().toString()));
store.put(LOCATION,editTextLocation.getText().toString());
store.put(KOEDER,autoCompleteTextViewBait.getText().toString());
store.put(TEMPERATUR,mWeather.getTemperatur());
store.put(LUFTDRUCK,mWeather.getPressure());
Log.d(ADD_FISH,store.toString());
} catch (JSONException e) {
e.printStackTrace();
}catch (NumberFormatException e){
e.printStackTrace();
}
}
}
| 9,755 | 0.684264 | 0.683649 | 258 | 36.810078 | 29.591515 | 136 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.70155 | false | false |
5
|
6d853675aa7a809f74f7bc2ef58f500d13adb7e8
| 34,548,716,948,922 |
2c61fbb41115d1e9fadf50ee76b9bdde854f7da6
|
/server/src/main/java/com/area/server/components/services/model/Reddit.java
|
0d2a4d86c8df1cb584d519a50833ca8ecc7d8704
|
[] |
no_license
|
azizchigri/My-IFTTT
|
https://github.com/azizchigri/My-IFTTT
|
2107c69e07c02459156cd9503d18dcc0e6087524
|
03d51bac29ef01d277f317a8bd027dff9b38ddb5
|
refs/heads/main
| 2023-01-02T08:10:19.943000 | 2018-10-18T15:40:00 | 2020-10-27T09:48:55 | 307,428,126 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.area.server.components.services.model;
import javax.persistence.Entity;
/**
* The type Reddit.
*/
@Entity
public class Reddit extends Services {
/**
* Instantiates a new Reddit.
*/
public Reddit() {
super();
this.setName("Reddit");
createReaction("Rd_add_friend", "Add a friend");
createReaction("Rd_rm_friend", "Remove a friend");
}
}
|
UTF-8
|
Java
| 379 |
java
|
Reddit.java
|
Java
|
[] | null |
[] |
package com.area.server.components.services.model;
import javax.persistence.Entity;
/**
* The type Reddit.
*/
@Entity
public class Reddit extends Services {
/**
* Instantiates a new Reddit.
*/
public Reddit() {
super();
this.setName("Reddit");
createReaction("Rd_add_friend", "Add a friend");
createReaction("Rd_rm_friend", "Remove a friend");
}
}
| 379 | 0.659631 | 0.659631 | 20 | 18 | 17.997223 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.85 | false | false |
5
|
c981cfa8c8bfba627645f1909a5bbe2cb126a7ef
| 24,275,155,207,364 |
38649ac998891e8cb85b4b128874b87093428e2b
|
/src/e1/tools/asbuilder/MD5Check.java
|
5203f1af0aa5b02ee2c3cea04d9fbe9011085d77
|
[] |
no_license
|
eonelv/java_mims
|
https://github.com/eonelv/java_mims
|
a355a342ac9eb5ed4e4502c574f58afd35dd9b0b
|
1cd63debd8268648d1b230b1ef20bc15bdf59572
|
refs/heads/master
| 2022-10-03T10:27:48.934000 | 2022-08-18T03:52:37 | 2022-08-18T03:52:37 | 23,962,304 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package e1.tools.asbuilder;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.util.Iterator;
import net.sf.json.JSONObject;
import e1.tools.asbuilder.utils.EJSON;
import e1.tools.utils.FileCopyer;
import e1.tools.utils.MD5Utils;
public class MD5Check
{
private String basePath = null;
public static void main(String[] args)
{
String path = args[0];
String targetPath = args[1];
boolean isUpdateReslist = args[2].equalsIgnoreCase("1");
String reslistPath = args[3];
MD5Check MD5Check = new MD5Check();
try
{
MD5Check.process(path, targetPath, isUpdateReslist, reslistPath, -1);
}
catch (IOException e)
{
System.out.println("error::" + e.getMessage());
System.out.println(e);
}
System.out.println("ASBuilder::End");
}
public void process(String path, String targetPath, boolean isUpdate, String reslistPath, int buildversion) throws IOException
{
this.basePath = path;
File parent = new File(this.basePath);
JSONObject newFileMD5s = new JSONObject();
JSONObject oldFileMD5s = null;
System.out.println("SysBuildMsg=4. begin calc MD5");
calMD5(parent, newFileMD5s, buildversion);
System.out.println("SysBuildMsg=4. read old MD5");
oldFileMD5s = readOldMD5(reslistPath + "/reslist_srv.json");
boolean isSuccess = oldFileMD5s != null;
System.out.println("SysBuildMsg=4. comparing file's MD5");
JSONObject result = new JSONObject();
if (isSuccess)
{
Iterator<String> it = newFileMD5s.keySet().iterator();
JSONObject oldValue;
JSONObject newValue;
String key;
String oldKey;
/*
* 对比所有文件的MD5,有差异的存放在result中
*/
while (it.hasNext())
{
key = (String) it.next();
newValue = (JSONObject)newFileMD5s.get(key);
//由于服务端保存的版本文件的key是eamf,所以这里需要替换json为eamf
// if (key.endsWith("json"))
// {
// oldKey = key.replace("json", "eamf");
// System.out.println(key + "为json文件,不做处理");
// continue;
// }
// else
// {
// oldKey = key;
// }
oldValue = (JSONObject)oldFileMD5s.get(key);
if (oldValue == null)
{
result.put(key, newValue);
}
else
{
if (newValue.getString(EJSON.MD5).equalsIgnoreCase(oldValue.getString(EJSON.MD5)))
{
continue;
}
newValue.put(EJSON.VERSION, buildversion);
result.put(key, newValue);
}
}
}
else
{
result = newFileMD5s;
}
//如果是内网版本,需要将MD5对比的结果跟原来保存的更新列表合并(每次发布外网,内网的更新列表会清空)
if (!isUpdate)
{
JSONObject innerJson = readOldMD5(reslistPath + "/reslist_srv_inner.json");
merge(innerJson, result);
result = innerJson;
String innerMD5 = result.toString();
reWriteSrvResList(innerMD5, reslistPath + "/reslist_srv_inner.json");
}
merge(oldFileMD5s, result);
moveFiles(result, targetPath, isUpdate, buildversion);
// result = changeName2Amaf(oldFileMD5s);
System.out.println("SysBuildMsg=5. update version file");
/*
* 如果是发布版本,需要生成reslist到编译环境及发布包中
*/
String reslistMD5 = oldFileMD5s.toString();
if (isUpdate)
{
reWriteSrvResList(reslistMD5, reslistPath + "/reslist_srv.json");
reWriteSrvResList("{}", reslistPath + "/reslist_srv_inner.json");
reWriteSrvResListToClient(reslistMD5, targetPath, buildversion);
}
// else
// {
// reWriteSrvResList(reslistMD5, reslistPath + "/reslist_srv_inner.json");
// }
reWriteClientResList(oldFileMD5s, targetPath, isUpdate, buildversion);
writeUpdateResList(result, targetPath, isUpdate, buildversion);
System.out.println("SysBuildMsg=final. generatting main application");
}
/*
* 合并之后,返回的是所有文件的完整的MD5集合,用于生产版本文件.
*
* @param oldFileMD5s
* @param result
*/
private void merge(JSONObject oldFileMD5s, JSONObject result)
{
@SuppressWarnings("unchecked")
Iterator<String> it = (Iterator<String>)result.keys();
String key;
JSONObject temp;
while (it.hasNext())
{
key = it.next();
temp = (JSONObject)result.get(key);
oldFileMD5s.put(key, temp);
}
}
private void calcFileCount(JSONObject newFileMD5s, String msg)
{
Iterator<String> it = newFileMD5s.keySet().iterator();
int count = 0;
String key;
while (it.hasNext())
{
key = (String) it.next();
count++;
}
System.out.println(msg + " " + count);
}
/*
* 由于此时生成的版本文件,还没有eamf文件,需要提前将版本文件中的键值改为eamf.
* @param newFileMD5s
* @return
*/
// private JSONObject changeName2Amaf(JSONObject newFileMD5s)
// {
// @SuppressWarnings("unchecked")
// Iterator<String> it = newFileMD5s.keySet().iterator();
// JSONObject tempValue;
// String id;
// String key;
// JSONObject tempJsons= new JSONObject();
// while (it.hasNext())
// {
// key = (String) it.next();
// tempValue = (JSONObject)newFileMD5s.getJSONObject(key);
// id = tempValue.getString(EJSON.ID);
//// if (id.endsWith("json"))
//// {
//// id = id.replace("json", "eamf");
//// }
// tempValue.put(EJSON.ID, id);
// tempJsons.put(id, tempValue);
// }
// return tempJsons;
// }
private void writeUpdateResList(JSONObject result, String resourcelistPath, boolean isUpdate, int buildversion) throws IOException
{
String fileNameXml = resourcelistPath + "/";
if (isUpdate)
{
fileNameXml += ("updatereslist_v" + buildversion + ".xml");
}
else
{
fileNameXml += "updatereslist.xml";
}
File fileXml = new File(fileNameXml);
if (!fileXml.getParentFile().exists())
{
fileXml.getParentFile().mkdir();
}
if (!fileXml.exists())
{
fileXml.createNewFile();
}
BufferedWriter writerXml = null;
StringBuilder reslstXml = new StringBuilder();
String key = null;
JSONObject item = null;
Iterator<String> itXml = result.keySet().iterator();
reslstXml.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
reslstXml.append("\n");
reslstXml.append("<resources>\n");
while (itXml.hasNext())
{
key = itXml.next();
item = (JSONObject)result.get(key);
reslstXml.append("<resource id=\"");
reslstXml.append(item.getString(EJSON.ID));
reslstXml.append("\" version=\"");
reslstXml.append(item.getInt(EJSON.VERSION));
reslstXml.append("\" size=\"");
reslstXml.append(item.getInt(EJSON.SIZE));
reslstXml.append("\" />\n");
}
reslstXml.append("</resources>");
try
{
writerXml = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(fileXml), "utf-8"));
writerXml.write(reslstXml.toString());
writerXml.flush();
}
catch (UnsupportedEncodingException e)
{
e.printStackTrace();
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
}
private void reWriteClientResList(JSONObject result, String resourcelistPath, boolean isUpdate, int buildversion) throws IOException
{
String fileName = resourcelistPath + "/";
String fileNameXml = resourcelistPath + "/";
String amfName = resourcelistPath + "/";
if (isUpdate)
{
fileName += ("reslist_v" + buildversion + ".json");
fileNameXml += ("reslist_v" + buildversion + ".xml");
amfName += ("reslist_v" + buildversion + ".eamf");
}
else
{
fileName += "reslist.json";
fileNameXml += "reslist.xml";
amfName += "reslist.eamf";
}
File file = new File(fileName);
if (!file.getParentFile().exists())
{
file.getParentFile().mkdir();
}
if (!file.exists())
{
file.createNewFile();
}
BufferedWriter writer = null;
StringBuilder reslst = new StringBuilder();
Iterator<String> it = result.keySet().iterator();
String key;
JSONObject item;
while (it.hasNext())
{
key = it.next();
item = (JSONObject)result.get(key);
item.remove(EJSON.MD5);
}
reslst.append(result.toString());
try {
writer = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(file), "utf-8"));
writer.write(reslst.toString());
writer.flush();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
CreateAMF createAMF = new CreateAMF();
try
{
createAMF.create(file, amfName);
}
catch (Exception e)
{
e.printStackTrace();
}
// //XML
// File fileXml = new File(fileNameXml);
// if (!file.getParentFile().exists())
// {
// file.getParentFile().mkdir();
// }
// if (!file.exists())
// {
// file.createNewFile();
// }
// BufferedWriter writerXml = null;
// StringBuilder reslstXml = new StringBuilder();
//
// Iterator<String> itXml = result.keySet().iterator();
//
// reslstXml.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
// reslstXml.append("\n");
// reslstXml.append("<resources>\n");
// while (itXml.hasNext())
// {
// key = itXml.next();
// item = (JSONObject)result.get(key);
// reslstXml.append("<resource id=\"");
// reslstXml.append(item.getString(EJSON.ID));
// reslstXml.append("\" version=\"");
// reslstXml.append(item.getInt(EJSON.VERSION));
// reslstXml.append("\" size=\"");
// reslstXml.append(item.getInt(EJSON.SIZE));
// reslstXml.append("\" />\n");
// }
// reslstXml.append("</resources>");
// try
// {
// writerXml = new BufferedWriter(new OutputStreamWriter(
// new FileOutputStream(fileXml), "utf-8"));
// writerXml.write(reslstXml.toString());
// writerXml.flush();
// }
// catch (UnsupportedEncodingException e)
// {
// e.printStackTrace();
// }
// catch (FileNotFoundException e)
// {
// e.printStackTrace();
// }
// catch (IOException e)
// {
// e.printStackTrace();
// }
}
private void reWriteSrvResList(String result, String reslistName)
{
File file = new File(reslistName);
BufferedWriter writer = null;
try
{
writer = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(file), "utf-8"));
writer.write(result);
writer.flush();
}
catch (UnsupportedEncodingException e)
{
e.printStackTrace();
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
}
private void reWriteSrvResListToClient(String result, String targetPath, int version) throws IOException
{
String fileName = targetPath + "/";
fileName += ("reslist_srv_v" + version + ".json");
File file = new File(fileName);
if (!file.getParentFile().exists())
{
file.getParentFile().mkdir();
}
if (!file.exists())
{
file.createNewFile();
}
System.out.println("DEBUG::" + fileName);
BufferedWriter writer = null;
writer = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(file), "utf-8"));
writer.write(result);
writer.flush();
}
/*
* 移动文件到指定目录,为后面打包版本做准备.
*
* @param result 需要移动的文件
* @param targetPath 目标输出路径
* @param isUpdate 是否更新版本文件,内网版本不更新
*/
@SuppressWarnings("unchecked")
private void moveFiles(JSONObject result, String targetPath, boolean isUpdate, int buildversion) throws IOException
{
Iterator<String> it = result.keySet().iterator();
File targetFile;
String targetFileFullName;
String simpleName;
String extName;
int index;
JSONObject tempValue;
File parent;
String version;
System.out.println("SysBuildMsg=4. begin copy file total " + result.size());
while (it.hasNext())
{
String key = (String) it.next();
tempValue = (JSONObject)result.getJSONObject(key);
File file = new File(this.basePath + "/" + key);
if (!file.exists())
{
System.out.println("Move file::not exist " + file.getName());
continue;
}
index = key.lastIndexOf(".");
simpleName = key.substring(0, index);
extName = key.substring(index, key.length());
if (isUpdate && buildversion != -1)
{
version = "_v" + tempValue.getInt(EJSON.VERSION);
targetFileFullName = targetPath + "/" + simpleName + version + extName;
}
else
{
version = "";
targetFileFullName = targetPath + "/" + simpleName + extName;
}
targetFile = new File(targetFileFullName);
parent = targetFile.getParentFile();
if (!parent.exists())
{
parent.mkdirs();
}
FileCopyer.copyFile(file, targetFile, version, extName, false);
}
}
private JSONObject readOldMD5(String fileName)
{
File file = new File(fileName);
if (!file.exists())
{
return new JSONObject();
}
BufferedReader reader = null;
JSONObject json;
StringBuilder sb = new StringBuilder();
String line = null;
try
{
reader = new BufferedReader(new InputStreamReader(
new FileInputStream(file), "utf-8"));
while ((line = reader.readLine()) != null)
{
sb.append(line);
}
}
catch (UnsupportedEncodingException e)
{
e.printStackTrace();
try
{
reader.close();
}
catch (IOException e1)
{
e1.printStackTrace();
}
}
catch (FileNotFoundException e)
{
e.printStackTrace();
try
{
reader.close();
}
catch (IOException e1)
{
e1.printStackTrace();
}
}
catch (IOException e)
{
e.printStackTrace();
try
{
reader.close();
}
catch (IOException e1)
{
e1.printStackTrace();
}
}
finally
{
try
{
reader.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
json = JSONObject.fromObject(sb.toString());
return json;
}
private void calMD5(File file, JSONObject fileMD5s, int buildversion)
{
if (file.isDirectory())
{
if (file.getName().equalsIgnoreCase(".svn"))
{
return;
}
if (file.getName().equalsIgnoreCase("src"))
{
return;
}
File[] files = file.listFiles();
for (int i = 0; i < files.length; i++)
{
calMD5(files[i], fileMD5s, buildversion);
}
}
else
{
if (file.getName().startsWith("reslist"))
{
return;
}
if (file.getName().endsWith(".name"))
{
return;
}
if (file.getName().endsWith(".fla"))
{
return;
}
String MD5 = MD5Utils.getFileMD5(file);
String filePath = file.getAbsolutePath();
String relPath = filePath.substring(this.basePath.length()+1);
relPath = relPath.replaceAll("\\\\", "/");
JSONObject json = new JSONObject();
json.put(EJSON.ID, relPath);
json.put(EJSON.MD5, MD5);
json.put(EJSON.SIZE, file.length());
json.put(EJSON.VERSION, buildversion);
fileMD5s.put(relPath, json);
}
}
}
|
UTF-8
|
Java
| 14,992 |
java
|
MD5Check.java
|
Java
|
[
{
"context": "newFileMD5s.get(key);\n\t\t\t\t\n\t\t\t\t//由于服务端保存的版本文件的key是eamf,所以这里需要替换json为eamf\n//\t\t\t\tif (key.endsWith(\"json\"))",
"end": 2046,
"score": 0.8927469253540039,
"start": 2042,
"tag": "KEY",
"value": "eamf"
},
{
"context": "\"))\n//\t\t\t\t{\n//\t\t\t\t\toldKey = key.replace(\"json\", \"eamf\");\n//\t\t\t\t\tSystem.out.println(key + \"为json文件,不做处理\"",
"end": 2146,
"score": 0.7916479706764221,
"start": 2143,
"tag": "KEY",
"value": "amf"
}
] | null |
[] |
package e1.tools.asbuilder;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.util.Iterator;
import net.sf.json.JSONObject;
import e1.tools.asbuilder.utils.EJSON;
import e1.tools.utils.FileCopyer;
import e1.tools.utils.MD5Utils;
public class MD5Check
{
private String basePath = null;
public static void main(String[] args)
{
String path = args[0];
String targetPath = args[1];
boolean isUpdateReslist = args[2].equalsIgnoreCase("1");
String reslistPath = args[3];
MD5Check MD5Check = new MD5Check();
try
{
MD5Check.process(path, targetPath, isUpdateReslist, reslistPath, -1);
}
catch (IOException e)
{
System.out.println("error::" + e.getMessage());
System.out.println(e);
}
System.out.println("ASBuilder::End");
}
public void process(String path, String targetPath, boolean isUpdate, String reslistPath, int buildversion) throws IOException
{
this.basePath = path;
File parent = new File(this.basePath);
JSONObject newFileMD5s = new JSONObject();
JSONObject oldFileMD5s = null;
System.out.println("SysBuildMsg=4. begin calc MD5");
calMD5(parent, newFileMD5s, buildversion);
System.out.println("SysBuildMsg=4. read old MD5");
oldFileMD5s = readOldMD5(reslistPath + "/reslist_srv.json");
boolean isSuccess = oldFileMD5s != null;
System.out.println("SysBuildMsg=4. comparing file's MD5");
JSONObject result = new JSONObject();
if (isSuccess)
{
Iterator<String> it = newFileMD5s.keySet().iterator();
JSONObject oldValue;
JSONObject newValue;
String key;
String oldKey;
/*
* 对比所有文件的MD5,有差异的存放在result中
*/
while (it.hasNext())
{
key = (String) it.next();
newValue = (JSONObject)newFileMD5s.get(key);
//由于服务端保存的版本文件的key是eamf,所以这里需要替换json为eamf
// if (key.endsWith("json"))
// {
// oldKey = key.replace("json", "eamf");
// System.out.println(key + "为json文件,不做处理");
// continue;
// }
// else
// {
// oldKey = key;
// }
oldValue = (JSONObject)oldFileMD5s.get(key);
if (oldValue == null)
{
result.put(key, newValue);
}
else
{
if (newValue.getString(EJSON.MD5).equalsIgnoreCase(oldValue.getString(EJSON.MD5)))
{
continue;
}
newValue.put(EJSON.VERSION, buildversion);
result.put(key, newValue);
}
}
}
else
{
result = newFileMD5s;
}
//如果是内网版本,需要将MD5对比的结果跟原来保存的更新列表合并(每次发布外网,内网的更新列表会清空)
if (!isUpdate)
{
JSONObject innerJson = readOldMD5(reslistPath + "/reslist_srv_inner.json");
merge(innerJson, result);
result = innerJson;
String innerMD5 = result.toString();
reWriteSrvResList(innerMD5, reslistPath + "/reslist_srv_inner.json");
}
merge(oldFileMD5s, result);
moveFiles(result, targetPath, isUpdate, buildversion);
// result = changeName2Amaf(oldFileMD5s);
System.out.println("SysBuildMsg=5. update version file");
/*
* 如果是发布版本,需要生成reslist到编译环境及发布包中
*/
String reslistMD5 = oldFileMD5s.toString();
if (isUpdate)
{
reWriteSrvResList(reslistMD5, reslistPath + "/reslist_srv.json");
reWriteSrvResList("{}", reslistPath + "/reslist_srv_inner.json");
reWriteSrvResListToClient(reslistMD5, targetPath, buildversion);
}
// else
// {
// reWriteSrvResList(reslistMD5, reslistPath + "/reslist_srv_inner.json");
// }
reWriteClientResList(oldFileMD5s, targetPath, isUpdate, buildversion);
writeUpdateResList(result, targetPath, isUpdate, buildversion);
System.out.println("SysBuildMsg=final. generatting main application");
}
/*
* 合并之后,返回的是所有文件的完整的MD5集合,用于生产版本文件.
*
* @param oldFileMD5s
* @param result
*/
private void merge(JSONObject oldFileMD5s, JSONObject result)
{
@SuppressWarnings("unchecked")
Iterator<String> it = (Iterator<String>)result.keys();
String key;
JSONObject temp;
while (it.hasNext())
{
key = it.next();
temp = (JSONObject)result.get(key);
oldFileMD5s.put(key, temp);
}
}
private void calcFileCount(JSONObject newFileMD5s, String msg)
{
Iterator<String> it = newFileMD5s.keySet().iterator();
int count = 0;
String key;
while (it.hasNext())
{
key = (String) it.next();
count++;
}
System.out.println(msg + " " + count);
}
/*
* 由于此时生成的版本文件,还没有eamf文件,需要提前将版本文件中的键值改为eamf.
* @param newFileMD5s
* @return
*/
// private JSONObject changeName2Amaf(JSONObject newFileMD5s)
// {
// @SuppressWarnings("unchecked")
// Iterator<String> it = newFileMD5s.keySet().iterator();
// JSONObject tempValue;
// String id;
// String key;
// JSONObject tempJsons= new JSONObject();
// while (it.hasNext())
// {
// key = (String) it.next();
// tempValue = (JSONObject)newFileMD5s.getJSONObject(key);
// id = tempValue.getString(EJSON.ID);
//// if (id.endsWith("json"))
//// {
//// id = id.replace("json", "eamf");
//// }
// tempValue.put(EJSON.ID, id);
// tempJsons.put(id, tempValue);
// }
// return tempJsons;
// }
private void writeUpdateResList(JSONObject result, String resourcelistPath, boolean isUpdate, int buildversion) throws IOException
{
String fileNameXml = resourcelistPath + "/";
if (isUpdate)
{
fileNameXml += ("updatereslist_v" + buildversion + ".xml");
}
else
{
fileNameXml += "updatereslist.xml";
}
File fileXml = new File(fileNameXml);
if (!fileXml.getParentFile().exists())
{
fileXml.getParentFile().mkdir();
}
if (!fileXml.exists())
{
fileXml.createNewFile();
}
BufferedWriter writerXml = null;
StringBuilder reslstXml = new StringBuilder();
String key = null;
JSONObject item = null;
Iterator<String> itXml = result.keySet().iterator();
reslstXml.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
reslstXml.append("\n");
reslstXml.append("<resources>\n");
while (itXml.hasNext())
{
key = itXml.next();
item = (JSONObject)result.get(key);
reslstXml.append("<resource id=\"");
reslstXml.append(item.getString(EJSON.ID));
reslstXml.append("\" version=\"");
reslstXml.append(item.getInt(EJSON.VERSION));
reslstXml.append("\" size=\"");
reslstXml.append(item.getInt(EJSON.SIZE));
reslstXml.append("\" />\n");
}
reslstXml.append("</resources>");
try
{
writerXml = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(fileXml), "utf-8"));
writerXml.write(reslstXml.toString());
writerXml.flush();
}
catch (UnsupportedEncodingException e)
{
e.printStackTrace();
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
}
private void reWriteClientResList(JSONObject result, String resourcelistPath, boolean isUpdate, int buildversion) throws IOException
{
String fileName = resourcelistPath + "/";
String fileNameXml = resourcelistPath + "/";
String amfName = resourcelistPath + "/";
if (isUpdate)
{
fileName += ("reslist_v" + buildversion + ".json");
fileNameXml += ("reslist_v" + buildversion + ".xml");
amfName += ("reslist_v" + buildversion + ".eamf");
}
else
{
fileName += "reslist.json";
fileNameXml += "reslist.xml";
amfName += "reslist.eamf";
}
File file = new File(fileName);
if (!file.getParentFile().exists())
{
file.getParentFile().mkdir();
}
if (!file.exists())
{
file.createNewFile();
}
BufferedWriter writer = null;
StringBuilder reslst = new StringBuilder();
Iterator<String> it = result.keySet().iterator();
String key;
JSONObject item;
while (it.hasNext())
{
key = it.next();
item = (JSONObject)result.get(key);
item.remove(EJSON.MD5);
}
reslst.append(result.toString());
try {
writer = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(file), "utf-8"));
writer.write(reslst.toString());
writer.flush();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
CreateAMF createAMF = new CreateAMF();
try
{
createAMF.create(file, amfName);
}
catch (Exception e)
{
e.printStackTrace();
}
// //XML
// File fileXml = new File(fileNameXml);
// if (!file.getParentFile().exists())
// {
// file.getParentFile().mkdir();
// }
// if (!file.exists())
// {
// file.createNewFile();
// }
// BufferedWriter writerXml = null;
// StringBuilder reslstXml = new StringBuilder();
//
// Iterator<String> itXml = result.keySet().iterator();
//
// reslstXml.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
// reslstXml.append("\n");
// reslstXml.append("<resources>\n");
// while (itXml.hasNext())
// {
// key = itXml.next();
// item = (JSONObject)result.get(key);
// reslstXml.append("<resource id=\"");
// reslstXml.append(item.getString(EJSON.ID));
// reslstXml.append("\" version=\"");
// reslstXml.append(item.getInt(EJSON.VERSION));
// reslstXml.append("\" size=\"");
// reslstXml.append(item.getInt(EJSON.SIZE));
// reslstXml.append("\" />\n");
// }
// reslstXml.append("</resources>");
// try
// {
// writerXml = new BufferedWriter(new OutputStreamWriter(
// new FileOutputStream(fileXml), "utf-8"));
// writerXml.write(reslstXml.toString());
// writerXml.flush();
// }
// catch (UnsupportedEncodingException e)
// {
// e.printStackTrace();
// }
// catch (FileNotFoundException e)
// {
// e.printStackTrace();
// }
// catch (IOException e)
// {
// e.printStackTrace();
// }
}
private void reWriteSrvResList(String result, String reslistName)
{
File file = new File(reslistName);
BufferedWriter writer = null;
try
{
writer = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(file), "utf-8"));
writer.write(result);
writer.flush();
}
catch (UnsupportedEncodingException e)
{
e.printStackTrace();
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
}
private void reWriteSrvResListToClient(String result, String targetPath, int version) throws IOException
{
String fileName = targetPath + "/";
fileName += ("reslist_srv_v" + version + ".json");
File file = new File(fileName);
if (!file.getParentFile().exists())
{
file.getParentFile().mkdir();
}
if (!file.exists())
{
file.createNewFile();
}
System.out.println("DEBUG::" + fileName);
BufferedWriter writer = null;
writer = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(file), "utf-8"));
writer.write(result);
writer.flush();
}
/*
* 移动文件到指定目录,为后面打包版本做准备.
*
* @param result 需要移动的文件
* @param targetPath 目标输出路径
* @param isUpdate 是否更新版本文件,内网版本不更新
*/
@SuppressWarnings("unchecked")
private void moveFiles(JSONObject result, String targetPath, boolean isUpdate, int buildversion) throws IOException
{
Iterator<String> it = result.keySet().iterator();
File targetFile;
String targetFileFullName;
String simpleName;
String extName;
int index;
JSONObject tempValue;
File parent;
String version;
System.out.println("SysBuildMsg=4. begin copy file total " + result.size());
while (it.hasNext())
{
String key = (String) it.next();
tempValue = (JSONObject)result.getJSONObject(key);
File file = new File(this.basePath + "/" + key);
if (!file.exists())
{
System.out.println("Move file::not exist " + file.getName());
continue;
}
index = key.lastIndexOf(".");
simpleName = key.substring(0, index);
extName = key.substring(index, key.length());
if (isUpdate && buildversion != -1)
{
version = "_v" + tempValue.getInt(EJSON.VERSION);
targetFileFullName = targetPath + "/" + simpleName + version + extName;
}
else
{
version = "";
targetFileFullName = targetPath + "/" + simpleName + extName;
}
targetFile = new File(targetFileFullName);
parent = targetFile.getParentFile();
if (!parent.exists())
{
parent.mkdirs();
}
FileCopyer.copyFile(file, targetFile, version, extName, false);
}
}
private JSONObject readOldMD5(String fileName)
{
File file = new File(fileName);
if (!file.exists())
{
return new JSONObject();
}
BufferedReader reader = null;
JSONObject json;
StringBuilder sb = new StringBuilder();
String line = null;
try
{
reader = new BufferedReader(new InputStreamReader(
new FileInputStream(file), "utf-8"));
while ((line = reader.readLine()) != null)
{
sb.append(line);
}
}
catch (UnsupportedEncodingException e)
{
e.printStackTrace();
try
{
reader.close();
}
catch (IOException e1)
{
e1.printStackTrace();
}
}
catch (FileNotFoundException e)
{
e.printStackTrace();
try
{
reader.close();
}
catch (IOException e1)
{
e1.printStackTrace();
}
}
catch (IOException e)
{
e.printStackTrace();
try
{
reader.close();
}
catch (IOException e1)
{
e1.printStackTrace();
}
}
finally
{
try
{
reader.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
json = JSONObject.fromObject(sb.toString());
return json;
}
private void calMD5(File file, JSONObject fileMD5s, int buildversion)
{
if (file.isDirectory())
{
if (file.getName().equalsIgnoreCase(".svn"))
{
return;
}
if (file.getName().equalsIgnoreCase("src"))
{
return;
}
File[] files = file.listFiles();
for (int i = 0; i < files.length; i++)
{
calMD5(files[i], fileMD5s, buildversion);
}
}
else
{
if (file.getName().startsWith("reslist"))
{
return;
}
if (file.getName().endsWith(".name"))
{
return;
}
if (file.getName().endsWith(".fla"))
{
return;
}
String MD5 = MD5Utils.getFileMD5(file);
String filePath = file.getAbsolutePath();
String relPath = filePath.substring(this.basePath.length()+1);
relPath = relPath.replaceAll("\\\\", "/");
JSONObject json = new JSONObject();
json.put(EJSON.ID, relPath);
json.put(EJSON.MD5, MD5);
json.put(EJSON.SIZE, file.length());
json.put(EJSON.VERSION, buildversion);
fileMD5s.put(relPath, json);
}
}
}
| 14,992 | 0.647613 | 0.640941 | 607 | 22.950577 | 21.446554 | 134 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.840198 | false | false |
5
|
41e8ad2fcddbf6aa735a08208b7bbdf1cbb2570c
| 34,780,645,175,080 |
0dc8ee4d93dee5ed0512319988d3263032229ce5
|
/json-server/src/main/java/com/capgemini/perf/json/server/api/CustomerMapper.java
|
3309076f937d814fc7cbc3647e9290180149da00
|
[] |
no_license
|
markwigmans/grpc
|
https://github.com/markwigmans/grpc
|
3c73b8b9e0bf86b8932c658345c6f8899d7c8616
|
2912c4bd79c1a4294becc31258472a5b95214204
|
refs/heads/master
| 2023-01-07T02:22:03.376000 | 2020-11-13T15:59:27 | 2020-11-13T15:59:27 | 290,520,107 | 1 | 0 | null | false | 2020-11-13T15:59:29 | 2020-08-26T14:32:05 | 2020-11-13T15:43:32 | 2020-11-13T15:59:28 | 625 | 1 | 0 | 0 |
Java
| false | false |
package com.capgemini.perf.json.server.api;
import com.capgemini.perf.json.server.data.Customer;
import com.capgemini.perf.shared.data.CentralConfig;
import com.capgemini.perf.shared.data.CustomerDTO;
import com.capgemini.perf.shared.data.UUIDMapper;
import org.mapstruct.Mapper;
@Mapper(config = CentralConfig.class)
public interface CustomerMapper {
CustomerDTO toDTO(Customer entity);
Customer fromDTO(CustomerDTO dto);
}
|
UTF-8
|
Java
| 437 |
java
|
CustomerMapper.java
|
Java
|
[] | null |
[] |
package com.capgemini.perf.json.server.api;
import com.capgemini.perf.json.server.data.Customer;
import com.capgemini.perf.shared.data.CentralConfig;
import com.capgemini.perf.shared.data.CustomerDTO;
import com.capgemini.perf.shared.data.UUIDMapper;
import org.mapstruct.Mapper;
@Mapper(config = CentralConfig.class)
public interface CustomerMapper {
CustomerDTO toDTO(Customer entity);
Customer fromDTO(CustomerDTO dto);
}
| 437 | 0.805492 | 0.805492 | 15 | 28.133333 | 20.806623 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.533333 | false | false |
5
|
96d343d73da9ee41e807da3e09a2b5bbed39e9bd
| 36,747,740,191,817 |
b616512eba55c696bb24fd097c9e48482dd06d51
|
/management-server/core-service/src/main/java/com/javacase/sagar/exceptions/ErrorResponse.java
|
e50677aef79d15280e3fc7942cfa2aa2d833e6d4
|
[] |
no_license
|
scamrutkar/Microservices
|
https://github.com/scamrutkar/Microservices
|
ae91c84f05ad80ffde3bd476f8d11eb8e8ed0c25
|
b953ca845ae3b6595149da76f403c83e92adf8b8
|
refs/heads/master
| 2020-08-12T20:12:36.131000 | 2020-04-12T06:42:34 | 2020-04-12T06:42:34 | 214,836,017 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.javacase.sagar.exceptions;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.*;
import java.sql.Timestamp;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@ToString
@Builder
@JsonIgnoreProperties(ignoreUnknown = true)
public class ErrorResponse {
private Timestamp timestamp;
private int status;
private String details;
}
|
UTF-8
|
Java
| 384 |
java
|
ErrorResponse.java
|
Java
|
[] | null |
[] |
package com.javacase.sagar.exceptions;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.*;
import java.sql.Timestamp;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@ToString
@Builder
@JsonIgnoreProperties(ignoreUnknown = true)
public class ErrorResponse {
private Timestamp timestamp;
private int status;
private String details;
}
| 384 | 0.796875 | 0.796875 | 21 | 17.285715 | 16.426294 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false |
5
|
1f26fe3d934eb3a67524939f1ab30b8cde7c3135
| 14,714,558,008,845 |
7e13d4d315265bc55fabaf424745cf954417d118
|
/SLCO1.0-files/SLCO1.0/metamodels-and-grammars/promela.emf/src/promela/chanpoll.java
|
aacc09dfcb4bacc48b0b0f2b6c7419c4fa71c5ff
|
[] |
no_license
|
melroy999/2IMP00-SLCO
|
https://github.com/melroy999/2IMP00-SLCO
|
6c4b69d0da58d4f06c662cd046193694979bbae4
|
bb5178ffc322c4bb0d7b070760950f29aeb0eb52
|
refs/heads/master
| 2023-04-05T06:48:10.474000 | 2021-04-07T23:19:46 | 2021-04-07T23:19:46 | 314,880,276 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* <copyright>
* </copyright>
*
* $Id$
*/
package promela;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.eclipse.emf.common.util.Enumerator;
/**
* <!-- begin-user-doc -->
* A representation of the literals of the enumeration '<em><b>chanpoll</b></em>',
* and utility methods for working with them.
* <!-- end-user-doc -->
* @see promela.PromelaPackage#getchanpoll()
* @model
* @generated
*/
public enum chanpoll implements Enumerator {
/**
* The '<em><b>FULL</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #FULL_VALUE
* @generated
* @ordered
*/
FULL(0, "FULL", ""),
/**
* The '<em><b>EMPTY</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #EMPTY_VALUE
* @generated
* @ordered
*/
EMPTY(1, "EMPTY", "EMPTY"),
/**
* The '<em><b>NFULL</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #NFULL_VALUE
* @generated
* @ordered
*/
NFULL(2, "NFULL", "NFULL"),
/**
* The '<em><b>NEMTPY</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #NEMTPY_VALUE
* @generated
* @ordered
*/
NEMTPY(3, "NEMTPY", "NEMTPY");
/**
* The '<em><b>FULL</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>FULL</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #FULL
* @model literal=""
* @generated
* @ordered
*/
public static final int FULL_VALUE = 0;
/**
* The '<em><b>EMPTY</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>EMPTY</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #EMPTY
* @model
* @generated
* @ordered
*/
public static final int EMPTY_VALUE = 1;
/**
* The '<em><b>NFULL</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>NFULL</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #NFULL
* @model
* @generated
* @ordered
*/
public static final int NFULL_VALUE = 2;
/**
* The '<em><b>NEMTPY</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>NEMTPY</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #NEMTPY
* @model
* @generated
* @ordered
*/
public static final int NEMTPY_VALUE = 3;
/**
* An array of all the '<em><b>chanpoll</b></em>' enumerators.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private static final chanpoll[] VALUES_ARRAY =
new chanpoll[] {
FULL,
EMPTY,
NFULL,
NEMTPY,
};
/**
* A public read-only list of all the '<em><b>chanpoll</b></em>' enumerators.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static final List<chanpoll> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
/**
* Returns the '<em><b>chanpoll</b></em>' literal with the specified literal value.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static chanpoll get(String literal) {
for (int i = 0; i < VALUES_ARRAY.length; ++i) {
chanpoll result = VALUES_ARRAY[i];
if (result.toString().equals(literal)) {
return result;
}
}
return null;
}
/**
* Returns the '<em><b>chanpoll</b></em>' literal with the specified name.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static chanpoll getByName(String name) {
for (int i = 0; i < VALUES_ARRAY.length; ++i) {
chanpoll result = VALUES_ARRAY[i];
if (result.getName().equals(name)) {
return result;
}
}
return null;
}
/**
* Returns the '<em><b>chanpoll</b></em>' literal with the specified integer value.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static chanpoll get(int value) {
switch (value) {
case FULL_VALUE: return FULL;
case EMPTY_VALUE: return EMPTY;
case NFULL_VALUE: return NFULL;
case NEMTPY_VALUE: return NEMTPY;
}
return null;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private final int value;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private final String name;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private final String literal;
/**
* Only this class can construct instances.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private chanpoll(int value, String name, String literal) {
this.value = value;
this.name = name;
this.literal = literal;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getValue() {
return value;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getName() {
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getLiteral() {
return literal;
}
/**
* Returns the literal value of the enumerator, which is its string representation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
return literal;
}
} //chanpoll
|
UTF-8
|
Java
| 5,578 |
java
|
chanpoll.java
|
Java
|
[] | null |
[] |
/**
* <copyright>
* </copyright>
*
* $Id$
*/
package promela;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.eclipse.emf.common.util.Enumerator;
/**
* <!-- begin-user-doc -->
* A representation of the literals of the enumeration '<em><b>chanpoll</b></em>',
* and utility methods for working with them.
* <!-- end-user-doc -->
* @see promela.PromelaPackage#getchanpoll()
* @model
* @generated
*/
public enum chanpoll implements Enumerator {
/**
* The '<em><b>FULL</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #FULL_VALUE
* @generated
* @ordered
*/
FULL(0, "FULL", ""),
/**
* The '<em><b>EMPTY</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #EMPTY_VALUE
* @generated
* @ordered
*/
EMPTY(1, "EMPTY", "EMPTY"),
/**
* The '<em><b>NFULL</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #NFULL_VALUE
* @generated
* @ordered
*/
NFULL(2, "NFULL", "NFULL"),
/**
* The '<em><b>NEMTPY</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #NEMTPY_VALUE
* @generated
* @ordered
*/
NEMTPY(3, "NEMTPY", "NEMTPY");
/**
* The '<em><b>FULL</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>FULL</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #FULL
* @model literal=""
* @generated
* @ordered
*/
public static final int FULL_VALUE = 0;
/**
* The '<em><b>EMPTY</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>EMPTY</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #EMPTY
* @model
* @generated
* @ordered
*/
public static final int EMPTY_VALUE = 1;
/**
* The '<em><b>NFULL</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>NFULL</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #NFULL
* @model
* @generated
* @ordered
*/
public static final int NFULL_VALUE = 2;
/**
* The '<em><b>NEMTPY</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>NEMTPY</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #NEMTPY
* @model
* @generated
* @ordered
*/
public static final int NEMTPY_VALUE = 3;
/**
* An array of all the '<em><b>chanpoll</b></em>' enumerators.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private static final chanpoll[] VALUES_ARRAY =
new chanpoll[] {
FULL,
EMPTY,
NFULL,
NEMTPY,
};
/**
* A public read-only list of all the '<em><b>chanpoll</b></em>' enumerators.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static final List<chanpoll> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
/**
* Returns the '<em><b>chanpoll</b></em>' literal with the specified literal value.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static chanpoll get(String literal) {
for (int i = 0; i < VALUES_ARRAY.length; ++i) {
chanpoll result = VALUES_ARRAY[i];
if (result.toString().equals(literal)) {
return result;
}
}
return null;
}
/**
* Returns the '<em><b>chanpoll</b></em>' literal with the specified name.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static chanpoll getByName(String name) {
for (int i = 0; i < VALUES_ARRAY.length; ++i) {
chanpoll result = VALUES_ARRAY[i];
if (result.getName().equals(name)) {
return result;
}
}
return null;
}
/**
* Returns the '<em><b>chanpoll</b></em>' literal with the specified integer value.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static chanpoll get(int value) {
switch (value) {
case FULL_VALUE: return FULL;
case EMPTY_VALUE: return EMPTY;
case NFULL_VALUE: return NFULL;
case NEMTPY_VALUE: return NEMTPY;
}
return null;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private final int value;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private final String name;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private final String literal;
/**
* Only this class can construct instances.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private chanpoll(int value, String name, String literal) {
this.value = value;
this.name = name;
this.literal = literal;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getValue() {
return value;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getName() {
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getLiteral() {
return literal;
}
/**
* Returns the literal value of the enumerator, which is its string representation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
return literal;
}
} //chanpoll
| 5,578 | 0.565794 | 0.564001 | 266 | 19.969925 | 19.256262 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.240602 | false | false |
5
|
cf1d0c556f4aff2bdef009fa12351a51977ac599
| 8,461,085,619,251 |
8c6078873a0db6e444269221ec30ea63fa2a9a29
|
/src/main/java/net/openhft/chronicle/threads/MonitorEventLoop.java
|
0e1a9d771f8ef5d25aa73a52232d0137e5c7c469
|
[
"Apache-2.0"
] |
permissive
|
OpenHFT/Chronicle-Threads
|
https://github.com/OpenHFT/Chronicle-Threads
|
7f0260e22b456a5bd5cd38079666821842b9eb89
|
adbaf9e5381bf3b3541ca76023bd2d5762c900c0
|
refs/heads/ea
| 2023-08-04T12:20:27.904000 | 2023-08-02T09:37:55 | 2023-08-02T09:37:55 | 31,261,853 | 164 | 61 |
NOASSERTION
| false | 2023-09-12T04:48:25 | 2015-02-24T13:43:50 | 2023-09-01T02:50:51 | 2023-09-12T04:48:24 | 1,781 | 154 | 59 | 5 |
Java
| false | false |
/*
* Copyright 2016-2020 chronicle.software
*
* https://chronicle.software
*
* 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 net.openhft.chronicle.threads;
import net.openhft.chronicle.core.Jvm;
import net.openhft.chronicle.core.annotation.HotMethod;
import net.openhft.chronicle.core.io.AbstractCloseable;
import net.openhft.chronicle.core.io.Closeable;
import net.openhft.chronicle.core.threads.EventHandler;
import net.openhft.chronicle.core.threads.EventLoop;
import net.openhft.chronicle.core.threads.HandlerPriority;
import net.openhft.chronicle.core.threads.InvalidEventHandlerException;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class MonitorEventLoop extends AbstractLifecycleEventLoop implements Runnable, EventLoop {
public static final String MONITOR_INITIAL_DELAY = "MonitorInitialDelay";
static int MONITOR_INITIAL_DELAY_MS = Jvm.getInteger(MONITOR_INITIAL_DELAY, 10_000);
private transient final ExecutorService service;
private transient final EventLoop parent;
private final List<EventHandler> handlers = new CopyOnWriteArrayList<>();
private final Pauser pauser;
public MonitorEventLoop(final EventLoop parent, final Pauser pauser) {
this(parent, "", pauser);
}
public MonitorEventLoop(final EventLoop parent, final String name, final Pauser pauser) {
super(name + (withSlash(parent == null ? "" : parent.name())) + "event~loop~monitor");
this.parent = parent;
this.pauser = pauser;
service = Executors.newSingleThreadExecutor(
new NamedThreadFactory(name, true, null, true));
}
@Override
protected void performStart() {
service.submit(this);
}
@Override
public void unpause() {
pauser.unpause();
}
@Override
protected void performStopFromNew() {
performStop();
}
@Override
protected void performStopFromStarted() {
performStop();
}
private void performStop() {
unpause();
Threads.shutdownDaemon(service);
}
@Override
public boolean isAlive() {
return isStarted();
}
@Override
public synchronized void addHandler(@NotNull final EventHandler handler) {
throwExceptionIfClosed();
if (DEBUG_ADDING_HANDLERS)
Jvm.startup().on(getClass(), "Adding " + handler.priority() + " " + handler + " to " + this.name);
if (isClosed())
throw new IllegalStateException("Event Group has been closed");
handler.eventLoop(parent);
if (!handlers.contains(handler))
handlers.add(new IdempotentLoopStartedEventHandler(handler));
}
@Override
@HotMethod
public void run() {
throwExceptionIfClosed();
try {
// don't do any monitoring for the first MONITOR_INITIAL_DELAY_MS ms
final long waitUntilMs = System.currentTimeMillis() + MONITOR_INITIAL_DELAY_MS;
while (System.currentTimeMillis() < waitUntilMs && isStarted())
pauser.pause();
pauser.reset();
while (isStarted() && !Thread.currentThread().isInterrupted()) {
boolean busy;
busy = runHandlers();
pauser.pause();
if (busy)
pauser.reset();
}
} catch (Throwable e) {
Jvm.warn().on(getClass(), e);
} finally {
synchronized (this) {
handlers.forEach(Threads::loopFinishedQuietly);
}
}
}
@HotMethod
private boolean runHandlers() {
boolean busy = false;
for (int i = 0; i < handlers.size(); i++) {
final EventHandler handler = handlers.get(i);
handler.loopStarted();
try {
busy |= handler.action();
} catch (InvalidEventHandlerException e) {
removeHandler(i--);
} catch (Exception e) {
Jvm.warn().on(getClass(), "Loop terminated due to exception", e);
removeHandler(i--);
}
}
return busy;
}
private synchronized void removeHandler(int handlerIndex) {
try {
EventHandler removedHandler = handlers.remove(handlerIndex);
removedHandler.loopFinished();
Closeable.closeQuietly(removedHandler);
} catch (ArrayIndexOutOfBoundsException e) {
if (!handlers.isEmpty()) {
Jvm.warn().on(MonitorEventLoop.class, "Error removing handler!");
}
}
}
@Override
protected void performClose() {
super.performClose();
net.openhft.chronicle.core.io.Closeable.closeQuietly(handlers);
}
/**
* {@link EventHandler#loopStarted()} needs to be called once before the first call to
* {@link EventHandler#action()} and it must be called on the event loop thread. An
* easy way to achieve that is to wrap the handler in this idempotent decorator and
* call it at the start of every iteration.
*/
private static final class IdempotentLoopStartedEventHandler extends AbstractCloseable implements EventHandler {
private transient final EventHandler eventHandler;
private final String handler;
private boolean loopStarted = false;
public IdempotentLoopStartedEventHandler(@NotNull EventHandler eventHandler) {
this.eventHandler = eventHandler;
handler = eventHandler.toString();
}
@Override
public boolean action() throws InvalidEventHandlerException {
return eventHandler.action();
}
@Override
public void eventLoop(EventLoop eventLoop) {
eventHandler.eventLoop(eventLoop);
}
@Override
public void loopStarted() {
if (!loopStarted) {
loopStarted = true;
eventHandler.loopStarted();
}
}
@Override
public void loopFinished() {
eventHandler.loopFinished();
}
@Override
public @NotNull HandlerPriority priority() {
return eventHandler.priority();
}
@Override
public boolean equals(Object o) {
return eventHandler.equals(o);
}
@Override
public int hashCode() {
return eventHandler.hashCode();
}
@Override
protected void performClose() throws IllegalStateException {
Closeable.closeQuietly(eventHandler);
}
@Override
public String toString() {
return "IdempotentLoopStartedEventHandler{" +
"handler=" + handler +
'}';
}
}
@Override
public String toString() {
return "MonitorEventLoop{" +
"service=" + service +
", parent=" + parent +
", handlers=" + handlers +
", pauser=" + pauser +
", name='" + name + '\'' +
'}';
}
}
|
UTF-8
|
Java
| 7,779 |
java
|
MonitorEventLoop.java
|
Java
|
[] | null |
[] |
/*
* Copyright 2016-2020 chronicle.software
*
* https://chronicle.software
*
* 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 net.openhft.chronicle.threads;
import net.openhft.chronicle.core.Jvm;
import net.openhft.chronicle.core.annotation.HotMethod;
import net.openhft.chronicle.core.io.AbstractCloseable;
import net.openhft.chronicle.core.io.Closeable;
import net.openhft.chronicle.core.threads.EventHandler;
import net.openhft.chronicle.core.threads.EventLoop;
import net.openhft.chronicle.core.threads.HandlerPriority;
import net.openhft.chronicle.core.threads.InvalidEventHandlerException;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class MonitorEventLoop extends AbstractLifecycleEventLoop implements Runnable, EventLoop {
public static final String MONITOR_INITIAL_DELAY = "MonitorInitialDelay";
static int MONITOR_INITIAL_DELAY_MS = Jvm.getInteger(MONITOR_INITIAL_DELAY, 10_000);
private transient final ExecutorService service;
private transient final EventLoop parent;
private final List<EventHandler> handlers = new CopyOnWriteArrayList<>();
private final Pauser pauser;
public MonitorEventLoop(final EventLoop parent, final Pauser pauser) {
this(parent, "", pauser);
}
public MonitorEventLoop(final EventLoop parent, final String name, final Pauser pauser) {
super(name + (withSlash(parent == null ? "" : parent.name())) + "event~loop~monitor");
this.parent = parent;
this.pauser = pauser;
service = Executors.newSingleThreadExecutor(
new NamedThreadFactory(name, true, null, true));
}
@Override
protected void performStart() {
service.submit(this);
}
@Override
public void unpause() {
pauser.unpause();
}
@Override
protected void performStopFromNew() {
performStop();
}
@Override
protected void performStopFromStarted() {
performStop();
}
private void performStop() {
unpause();
Threads.shutdownDaemon(service);
}
@Override
public boolean isAlive() {
return isStarted();
}
@Override
public synchronized void addHandler(@NotNull final EventHandler handler) {
throwExceptionIfClosed();
if (DEBUG_ADDING_HANDLERS)
Jvm.startup().on(getClass(), "Adding " + handler.priority() + " " + handler + " to " + this.name);
if (isClosed())
throw new IllegalStateException("Event Group has been closed");
handler.eventLoop(parent);
if (!handlers.contains(handler))
handlers.add(new IdempotentLoopStartedEventHandler(handler));
}
@Override
@HotMethod
public void run() {
throwExceptionIfClosed();
try {
// don't do any monitoring for the first MONITOR_INITIAL_DELAY_MS ms
final long waitUntilMs = System.currentTimeMillis() + MONITOR_INITIAL_DELAY_MS;
while (System.currentTimeMillis() < waitUntilMs && isStarted())
pauser.pause();
pauser.reset();
while (isStarted() && !Thread.currentThread().isInterrupted()) {
boolean busy;
busy = runHandlers();
pauser.pause();
if (busy)
pauser.reset();
}
} catch (Throwable e) {
Jvm.warn().on(getClass(), e);
} finally {
synchronized (this) {
handlers.forEach(Threads::loopFinishedQuietly);
}
}
}
@HotMethod
private boolean runHandlers() {
boolean busy = false;
for (int i = 0; i < handlers.size(); i++) {
final EventHandler handler = handlers.get(i);
handler.loopStarted();
try {
busy |= handler.action();
} catch (InvalidEventHandlerException e) {
removeHandler(i--);
} catch (Exception e) {
Jvm.warn().on(getClass(), "Loop terminated due to exception", e);
removeHandler(i--);
}
}
return busy;
}
private synchronized void removeHandler(int handlerIndex) {
try {
EventHandler removedHandler = handlers.remove(handlerIndex);
removedHandler.loopFinished();
Closeable.closeQuietly(removedHandler);
} catch (ArrayIndexOutOfBoundsException e) {
if (!handlers.isEmpty()) {
Jvm.warn().on(MonitorEventLoop.class, "Error removing handler!");
}
}
}
@Override
protected void performClose() {
super.performClose();
net.openhft.chronicle.core.io.Closeable.closeQuietly(handlers);
}
/**
* {@link EventHandler#loopStarted()} needs to be called once before the first call to
* {@link EventHandler#action()} and it must be called on the event loop thread. An
* easy way to achieve that is to wrap the handler in this idempotent decorator and
* call it at the start of every iteration.
*/
private static final class IdempotentLoopStartedEventHandler extends AbstractCloseable implements EventHandler {
private transient final EventHandler eventHandler;
private final String handler;
private boolean loopStarted = false;
public IdempotentLoopStartedEventHandler(@NotNull EventHandler eventHandler) {
this.eventHandler = eventHandler;
handler = eventHandler.toString();
}
@Override
public boolean action() throws InvalidEventHandlerException {
return eventHandler.action();
}
@Override
public void eventLoop(EventLoop eventLoop) {
eventHandler.eventLoop(eventLoop);
}
@Override
public void loopStarted() {
if (!loopStarted) {
loopStarted = true;
eventHandler.loopStarted();
}
}
@Override
public void loopFinished() {
eventHandler.loopFinished();
}
@Override
public @NotNull HandlerPriority priority() {
return eventHandler.priority();
}
@Override
public boolean equals(Object o) {
return eventHandler.equals(o);
}
@Override
public int hashCode() {
return eventHandler.hashCode();
}
@Override
protected void performClose() throws IllegalStateException {
Closeable.closeQuietly(eventHandler);
}
@Override
public String toString() {
return "IdempotentLoopStartedEventHandler{" +
"handler=" + handler +
'}';
}
}
@Override
public String toString() {
return "MonitorEventLoop{" +
"service=" + service +
", parent=" + parent +
", handlers=" + handlers +
", pauser=" + pauser +
", name='" + name + '\'' +
'}';
}
}
| 7,779 | 0.613189 | 0.610875 | 242 | 31.14876 | 26.311127 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.429752 | false | false |
5
|
e4c99f8b356080bb77b7fc74625ade4f17273b70
| 14,388,140,488,617 |
a481084260a5b3e86785570e91c7b8925f5a8241
|
/src/com/ssthouse/officeautomation/service/impl/DispatchServiceImpl.java
|
25c3cdc6ed1db52607ada8d5ec532bd80aa3e1a9
|
[] |
no_license
|
ssthouse/office_automation_backend_eclipse
|
https://github.com/ssthouse/office_automation_backend_eclipse
|
142b326e10005e2a2f15249b7038b1b24a68b148
|
8cc1ad712c0ac56b1cd5107fa1cecd4aef577afa
|
refs/heads/master
| 2021-01-17T12:40:20.543000 | 2017-06-09T03:17:32 | 2017-06-09T03:17:32 | 84,070,327 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ssthouse.officeautomation.service.impl;
import java.util.ArrayList;
import java.util.List;
import com.ssthouse.officeautomation.base.BaseService;
import com.ssthouse.officeautomation.dao.IDispatchDao;
import com.ssthouse.officeautomation.domain.DispatchEntity;
import com.ssthouse.officeautomation.service.IDispatchService;
import com.ssthouse.officeautomation.util.StringUtil;
public class DispatchServiceImpl extends BaseService<IDispatchDao> implements IDispatchService {
@Override
public void saveDispatch(DispatchEntity entity) {
if (entity == null || entity.getId() > 0) {
return;
}
getDao().saveDispatch(entity);
}
@Override
public void updateDispatch(DispatchEntity entity) {
if (entity == null || entity.getId() <= 0) {
return;
}
getDao().updateDispatch(entity);
}
@Override
public List<DispatchEntity> getUserDispatchList(String username) {
if (StringUtil.isEmpty(username)) {
return new ArrayList<>();
}
return getDao().getUserDispatchList(username);
}
@Override
public List<DispatchEntity> getOwnedDispatchList(String ownerUsername) {
if (StringUtil.isEmpty(ownerUsername)) {
return new ArrayList<>();
}
return getDao().getOwnedDispatchList(ownerUsername);
}
@Override
public void deleteDispatch(int id) {
getDao().deleteDispatch(id);
}
}
|
UTF-8
|
Java
| 1,325 |
java
|
DispatchServiceImpl.java
|
Java
|
[] | null |
[] |
package com.ssthouse.officeautomation.service.impl;
import java.util.ArrayList;
import java.util.List;
import com.ssthouse.officeautomation.base.BaseService;
import com.ssthouse.officeautomation.dao.IDispatchDao;
import com.ssthouse.officeautomation.domain.DispatchEntity;
import com.ssthouse.officeautomation.service.IDispatchService;
import com.ssthouse.officeautomation.util.StringUtil;
public class DispatchServiceImpl extends BaseService<IDispatchDao> implements IDispatchService {
@Override
public void saveDispatch(DispatchEntity entity) {
if (entity == null || entity.getId() > 0) {
return;
}
getDao().saveDispatch(entity);
}
@Override
public void updateDispatch(DispatchEntity entity) {
if (entity == null || entity.getId() <= 0) {
return;
}
getDao().updateDispatch(entity);
}
@Override
public List<DispatchEntity> getUserDispatchList(String username) {
if (StringUtil.isEmpty(username)) {
return new ArrayList<>();
}
return getDao().getUserDispatchList(username);
}
@Override
public List<DispatchEntity> getOwnedDispatchList(String ownerUsername) {
if (StringUtil.isEmpty(ownerUsername)) {
return new ArrayList<>();
}
return getDao().getOwnedDispatchList(ownerUsername);
}
@Override
public void deleteDispatch(int id) {
getDao().deleteDispatch(id);
}
}
| 1,325 | 0.762264 | 0.760755 | 51 | 24.980392 | 24.837109 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.45098 | false | false |
5
|
851ebcc570a8eea7756e5758e9af0f9b411e5a69
| 17,660,905,523,149 |
5ad94b4f27bb9e433ad83aeff04c13e99320bd6f
|
/src/test/java/ru/gk_mic/callbackform/CallFeedBackForm.java
|
ee4b9e63813b28f7ef2affbbc093eaca49af5cfb
|
[] |
no_license
|
SergoFrost/gk-mic5
|
https://github.com/SergoFrost/gk-mic5
|
6cf270b94ec6e4c7ae1069004a6979365c929ebb
|
e7a560188a6e92f030a07a99e87689249196a62b
|
refs/heads/master
| 2021-07-09T04:17:40.219000 | 2019-08-12T13:54:45 | 2019-08-12T13:54:45 | 199,307,051 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ru.gk_mic.callbackform;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import ru.gk_mic.callbackform.AdmCallBackForm;
import java.io.FileWriter;
import java.io.IOException;
public class CallFeedBackForm {
static class pol {
static String name = "Test";
static String phone = "+7(000)000-00-00";
}
@Test
public void CallFeedBack(){
//Подключаем хром драйвер и переходим на сайт
System.setProperty("webdriver.chrome.driver", "src/main/resources/drivers/chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("http://new.gk-mic.ru/?utm_source=google&utm_campaign=999%7Cya_mg_mic_tsvetochnye-polyany_s_msk_brand_zastroishik&utm_term=%D0%B3%D0%BA%20%D0%BC%D0%B8%D1%86");
//Находим кнопку главного меню,кнопку обратного звонка и кликаем
driver.findElement(By.cssSelector("button.header__burger.js_navigation_show")).click();
if(!driver.findElements(By.cssSelector("div.navigation__container.js_navigation_present.navigation__container--show")).isEmpty()){
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
driver.findElement(By.cssSelector("button.btn.btn--red.js_popup_callback_show")).click();
}else {
try (FileWriter writer = new FileWriter("Отчет_с_сайта.txt", false)) {
String report = "Отчет о тестировании обратной формы 'Зазазать звонок' :" + "\n" + "Не отобразилось главное меню";
writer.write(report);
writer.flush();
} catch (IOException ex) {
System.out.println(ex.getMessage());
}
driver.quit();
}
//Ждем пока появится форма,вводим данные и отправляем
if(!driver.findElements(By.cssSelector("form.form_popup.form_call_back")).isEmpty() && !driver.findElements(By.id("call_back-name")).isEmpty() && !driver.findElements(By.id("call_back-number")).isEmpty()){
driver.findElement(By.id("call_back-name")).sendKeys(pol.name);
driver.findElement(By.id("call_back-number")).sendKeys(pol.phone);
}else{
try (FileWriter writer = new FileWriter("Отчет_с_сайта.txt", false)) {
String report = "Отчет о тестировании обратной формы 'Зазазать звонок' :" + "\n" + "Не отобразилась форма или поля для ввода данных";
writer.write(report);
writer.flush();
} catch (IOException ex) {
System.out.println(ex.getMessage());
}
driver.quit();
}
WebElement checkbox = driver.findElement(By.cssSelector("svg.icon__icon-checkbox"));
if(!checkbox.isSelected()){
driver.findElement(By.cssSelector("button.btn.btn--red.btn--big")).click();
}else if(checkbox.isSelected()){
checkbox.click();
driver.findElement(By.cssSelector("button.btn.btn--red.btn--big")).click();
}
if(!driver.findElements(By.className("js_popup_success")).isEmpty()) {
try (FileWriter writer = new FileWriter("Отчет_с_сайта.txt", false)) {
String report = "Отчет о тестировании обратной формы 'Зазазать звонок' :" + "\n" + "Заявка была успешно отправлена";
writer.write(report);
writer.flush();
} catch (IOException ex) {
System.out.println(ex.getMessage());
}
AdmCallBackForm.CallBack();
driver.quit();
} else{
try (FileWriter writer = new FileWriter("Отчет_с_сайта.txt", false)) {
String report = "Отчет о тестировании обратной формы 'Зазазать звонок' :" + "\n" + "Тестирование было провалено на последнем шаге,не появилась надпись об успешной отправке";
writer.write(report);
writer.flush();
} catch (IOException ex) {
System.out.println(ex.getMessage());
}
driver.quit();
}
}
}
|
UTF-8
|
Java
| 4,801 |
java
|
CallFeedBackForm.java
|
Java
|
[
{
"context": " static class pol {\n static String name = \"Test\";\n static String phone = \"+7(000)000-00-00",
"end": 405,
"score": 0.7870166301727295,
"start": 401,
"tag": "NAME",
"value": "Test"
}
] | null |
[] |
package ru.gk_mic.callbackform;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import ru.gk_mic.callbackform.AdmCallBackForm;
import java.io.FileWriter;
import java.io.IOException;
public class CallFeedBackForm {
static class pol {
static String name = "Test";
static String phone = "+7(000)000-00-00";
}
@Test
public void CallFeedBack(){
//Подключаем хром драйвер и переходим на сайт
System.setProperty("webdriver.chrome.driver", "src/main/resources/drivers/chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("http://new.gk-mic.ru/?utm_source=google&utm_campaign=999%7Cya_mg_mic_tsvetochnye-polyany_s_msk_brand_zastroishik&utm_term=%D0%B3%D0%BA%20%D0%BC%D0%B8%D1%86");
//Находим кнопку главного меню,кнопку обратного звонка и кликаем
driver.findElement(By.cssSelector("button.header__burger.js_navigation_show")).click();
if(!driver.findElements(By.cssSelector("div.navigation__container.js_navigation_present.navigation__container--show")).isEmpty()){
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
driver.findElement(By.cssSelector("button.btn.btn--red.js_popup_callback_show")).click();
}else {
try (FileWriter writer = new FileWriter("Отчет_с_сайта.txt", false)) {
String report = "Отчет о тестировании обратной формы 'Зазазать звонок' :" + "\n" + "Не отобразилось главное меню";
writer.write(report);
writer.flush();
} catch (IOException ex) {
System.out.println(ex.getMessage());
}
driver.quit();
}
//Ждем пока появится форма,вводим данные и отправляем
if(!driver.findElements(By.cssSelector("form.form_popup.form_call_back")).isEmpty() && !driver.findElements(By.id("call_back-name")).isEmpty() && !driver.findElements(By.id("call_back-number")).isEmpty()){
driver.findElement(By.id("call_back-name")).sendKeys(pol.name);
driver.findElement(By.id("call_back-number")).sendKeys(pol.phone);
}else{
try (FileWriter writer = new FileWriter("Отчет_с_сайта.txt", false)) {
String report = "Отчет о тестировании обратной формы 'Зазазать звонок' :" + "\n" + "Не отобразилась форма или поля для ввода данных";
writer.write(report);
writer.flush();
} catch (IOException ex) {
System.out.println(ex.getMessage());
}
driver.quit();
}
WebElement checkbox = driver.findElement(By.cssSelector("svg.icon__icon-checkbox"));
if(!checkbox.isSelected()){
driver.findElement(By.cssSelector("button.btn.btn--red.btn--big")).click();
}else if(checkbox.isSelected()){
checkbox.click();
driver.findElement(By.cssSelector("button.btn.btn--red.btn--big")).click();
}
if(!driver.findElements(By.className("js_popup_success")).isEmpty()) {
try (FileWriter writer = new FileWriter("Отчет_с_сайта.txt", false)) {
String report = "Отчет о тестировании обратной формы 'Зазазать звонок' :" + "\n" + "Заявка была успешно отправлена";
writer.write(report);
writer.flush();
} catch (IOException ex) {
System.out.println(ex.getMessage());
}
AdmCallBackForm.CallBack();
driver.quit();
} else{
try (FileWriter writer = new FileWriter("Отчет_с_сайта.txt", false)) {
String report = "Отчет о тестировании обратной формы 'Зазазать звонок' :" + "\n" + "Тестирование было провалено на последнем шаге,не появилась надпись об успешной отправке";
writer.write(report);
writer.flush();
} catch (IOException ex) {
System.out.println(ex.getMessage());
}
driver.quit();
}
}
}
| 4,801 | 0.604352 | 0.597333 | 93 | 44.935482 | 43.008327 | 213 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.580645 | false | false |
5
|
72e2daf7977649ccddfca68b3806a1ec070d40a1
| 8,143,258,039,493 |
1f757c5066a4aa80469fba868a579dd8ba62d1ce
|
/src/main/java/com/tterrag/k9/mappings/Parser.java
|
c978bc9855976a43bf75a9ce8f4b0452ae5f2d92
|
[
"MIT"
] |
permissive
|
tterrag1098/K9
|
https://github.com/tterrag1098/K9
|
d9df87ed134a114e87de0a6d67c46b73f421609b
|
633cb0a2b0ca191bf01e5d8f413348d715dda2cc
|
refs/heads/master
| 2022-03-04T14:49:05.724000 | 2022-02-20T03:34:46 | 2022-02-20T03:53:25 | 83,999,013 | 50 | 56 |
MIT
| false | 2021-10-06T03:32:55 | 2017-03-05T20:13:30 | 2021-10-06T03:31:24 | 2021-10-06T03:32:54 | 9,255 | 38 | 36 | 21 |
Java
| false | false |
package com.tterrag.k9.mappings;
import java.io.IOException;
import java.util.Collection;
@FunctionalInterface
public interface Parser<T, R> {
Collection<R> parse(T input) throws IOException;
}
|
UTF-8
|
Java
| 206 |
java
|
Parser.java
|
Java
|
[] | null |
[] |
package com.tterrag.k9.mappings;
import java.io.IOException;
import java.util.Collection;
@FunctionalInterface
public interface Parser<T, R> {
Collection<R> parse(T input) throws IOException;
}
| 206 | 0.752427 | 0.747573 | 11 | 17.727272 | 16.954971 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.454545 | false | false |
5
|
22d6abba3fe9c423605869435b6c8e5231c26f26
| 1,657,857,376,386 |
9b86f1fb4e1d6e4c6e67c83355b8c218dfdfd1fe
|
/core/src/sigseg/game/snm/entity/EntityManager.java
|
485050c95f597d273c9ce3e4fe5b8326c619bb26
|
[
"Apache-2.0"
] |
permissive
|
johnnylambada/gdx-snm
|
https://github.com/johnnylambada/gdx-snm
|
c3b128885c7cc285ae2ff72ffb6ebd16c83c0c75
|
3c273c8da8e34921b4a618fbf5926dad8606d4d8
|
refs/heads/master
| 2020-05-18T05:18:18.316000 | 2014-05-03T16:45:58 | 2014-05-03T16:45:58 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package sigseg.game.snm.entity;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Array;
import sigseg.game.snm.SNMGame;
import sigseg.game.snm.SpriteManager;
import sigseg.game.snm.camera.OrthoCamera;
import sigseg.game.snm.screen.GameOverScreen;
import sigseg.game.snm.screen.ScreenManager;
public class EntityManager {
private final Array<Entity> entities = new Array<Entity>();
private final Player player;
public EntityManager(int amount, OrthoCamera camera) {
player = new Player(new Vector2(230, 15), new Vector2(0, 0), this, camera);
for (int i = 0; i < amount; i++) {
float x = MathUtils.random(0, SNMGame.WIDTH - SpriteManager.ENEMY.getWidth());
float y = MathUtils.random(SNMGame.HEIGHT, SNMGame.HEIGHT * 3);
float speed = MathUtils.random(2, 5);
addEntity(new Enemy(new Vector2(x, y), new Vector2(0, -speed)));
}
}
public void update() {
for (Entity e : entities)
e.update();
for (Missile m : getMissiles())
if (m.checkEnd())
entities.removeValue(m, false);
player.update();
checkCollisions();
}
public void render(SpriteBatch sb) {
for (Entity e : entities)
e.render(sb);
player.render(sb);
}
private void checkCollisions() {
for (Enemy e : getEnemies()) {
for (Missile m : getMissiles()) {
if (e.getBounds().overlaps(m.getBounds())) {
entities.removeValue(e, false);
entities.removeValue(m, false);
if (gameOver())
ScreenManager.set(new GameOverScreen(true));
}
}
if (e.getBounds().overlaps(player.getBounds())) {
ScreenManager.set(new GameOverScreen(false));
}
}
}
public void addEntity(Entity entity) {
entities.add(entity);
}
private Array<Enemy> getEnemies() {
Array<Enemy> ret = new Array<Enemy>();
for (Entity e : entities)
if (e instanceof Enemy)
ret.add((Enemy)e);
return ret;
}
private Array<Missile> getMissiles() {
Array<Missile> ret = new Array<Missile>();
for (Entity e : entities)
if (e instanceof Missile)
ret.add((Missile)e);
return ret;
}
public boolean gameOver() {
return getEnemies().size <= 0;
}
}
|
UTF-8
|
Java
| 2,202 |
java
|
EntityManager.java
|
Java
|
[] | null |
[] |
package sigseg.game.snm.entity;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Array;
import sigseg.game.snm.SNMGame;
import sigseg.game.snm.SpriteManager;
import sigseg.game.snm.camera.OrthoCamera;
import sigseg.game.snm.screen.GameOverScreen;
import sigseg.game.snm.screen.ScreenManager;
public class EntityManager {
private final Array<Entity> entities = new Array<Entity>();
private final Player player;
public EntityManager(int amount, OrthoCamera camera) {
player = new Player(new Vector2(230, 15), new Vector2(0, 0), this, camera);
for (int i = 0; i < amount; i++) {
float x = MathUtils.random(0, SNMGame.WIDTH - SpriteManager.ENEMY.getWidth());
float y = MathUtils.random(SNMGame.HEIGHT, SNMGame.HEIGHT * 3);
float speed = MathUtils.random(2, 5);
addEntity(new Enemy(new Vector2(x, y), new Vector2(0, -speed)));
}
}
public void update() {
for (Entity e : entities)
e.update();
for (Missile m : getMissiles())
if (m.checkEnd())
entities.removeValue(m, false);
player.update();
checkCollisions();
}
public void render(SpriteBatch sb) {
for (Entity e : entities)
e.render(sb);
player.render(sb);
}
private void checkCollisions() {
for (Enemy e : getEnemies()) {
for (Missile m : getMissiles()) {
if (e.getBounds().overlaps(m.getBounds())) {
entities.removeValue(e, false);
entities.removeValue(m, false);
if (gameOver())
ScreenManager.set(new GameOverScreen(true));
}
}
if (e.getBounds().overlaps(player.getBounds())) {
ScreenManager.set(new GameOverScreen(false));
}
}
}
public void addEntity(Entity entity) {
entities.add(entity);
}
private Array<Enemy> getEnemies() {
Array<Enemy> ret = new Array<Enemy>();
for (Entity e : entities)
if (e instanceof Enemy)
ret.add((Enemy)e);
return ret;
}
private Array<Missile> getMissiles() {
Array<Missile> ret = new Array<Missile>();
for (Entity e : entities)
if (e instanceof Missile)
ret.add((Missile)e);
return ret;
}
public boolean gameOver() {
return getEnemies().size <= 0;
}
}
| 2,202 | 0.682561 | 0.673479 | 84 | 25.214285 | 19.904577 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.392857 | false | false |
5
|
c1b179f43c115b66cd621c70a5ebcbb81e7510ca
| 30,305,289,277,401 |
2f661ddfd0879ead6e1dc4d4e31a9e93f127765c
|
/app/src/main/java/com/examhelper/app/service/imp/QuesionServiceImp.java
|
8044c5a4e594872846af7c3d17f631e66a6dd307
|
[] |
no_license
|
1194570458/examhelper_android
|
https://github.com/1194570458/examhelper_android
|
c0e55ba490883ba68aafa2299d14df0048e2b13f
|
7ab9ddee5f7d156bde04dd371e3c889e4502af56
|
refs/heads/master
| 2020-03-23T03:06:08.083000 | 2018-08-05T15:46:13 | 2018-08-05T15:46:13 | 141,009,746 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.examhelper.app.service.imp;
import android.content.Context;
import com.examhelper.app.dao.IQuestionDao;
import com.examhelper.app.dao.imp.QuestionDaoImp;
import com.examhelper.app.entity.Question;
import com.examhelper.app.service.IQuestionService;
import java.util.Collections;
import java.util.List;
/**
* Created by Administrator on 2018/7/24.
*/
public class QuesionServiceImp implements IQuestionService {
IQuestionDao questionDaoImp;
public QuesionServiceImp(Context context) {
questionDaoImp = new QuestionDaoImp(context);
}
@Override
public void addQuestion(Question question) {
questionDaoImp.insert(question);
}
@Override
public void addQuestions(List<Question> questionList) {
for (Question question : questionList) {
addQuestion(question);
}
}
@Override
public void removeAllQuestion() {
questionDaoImp.deleteAll();
}
@Override
public void updateQuestion(Question question) {
questionDaoImp.update(question);
}
@Override
public Question queryQuestion(int questionId) {
Question question = questionDaoImp.selectQuestion(questionId);
return question;
}
@Override
public List<Question> queryAllQuestions() {
List<Question> questions = questionDaoImp.selectAllQuestions();
return questions;
}
@Override
public List<Question> queryRandomQuestions() {
List<Question> questions = questionDaoImp.selectAllQuestions();
Collections.shuffle(questions);
return questions;
}
@Override
public List<Question> queryCollectedQuestion() {
List<Question> questions = questionDaoImp.selectCollectedQuestion();
return questions;
}
@Override
public List<Question> queryErrorQuestion() {
return questionDaoImp.selectErrorQuesttions();
}
}
|
UTF-8
|
Java
| 1,918 |
java
|
QuesionServiceImp.java
|
Java
|
[
{
"context": "ections;\nimport java.util.List;\n\n/**\n * Created by Administrator on 2018/7/24.\n */\n\npublic class QuesionServiceImp",
"end": 349,
"score": 0.820128858089447,
"start": 336,
"tag": "USERNAME",
"value": "Administrator"
}
] | null |
[] |
package com.examhelper.app.service.imp;
import android.content.Context;
import com.examhelper.app.dao.IQuestionDao;
import com.examhelper.app.dao.imp.QuestionDaoImp;
import com.examhelper.app.entity.Question;
import com.examhelper.app.service.IQuestionService;
import java.util.Collections;
import java.util.List;
/**
* Created by Administrator on 2018/7/24.
*/
public class QuesionServiceImp implements IQuestionService {
IQuestionDao questionDaoImp;
public QuesionServiceImp(Context context) {
questionDaoImp = new QuestionDaoImp(context);
}
@Override
public void addQuestion(Question question) {
questionDaoImp.insert(question);
}
@Override
public void addQuestions(List<Question> questionList) {
for (Question question : questionList) {
addQuestion(question);
}
}
@Override
public void removeAllQuestion() {
questionDaoImp.deleteAll();
}
@Override
public void updateQuestion(Question question) {
questionDaoImp.update(question);
}
@Override
public Question queryQuestion(int questionId) {
Question question = questionDaoImp.selectQuestion(questionId);
return question;
}
@Override
public List<Question> queryAllQuestions() {
List<Question> questions = questionDaoImp.selectAllQuestions();
return questions;
}
@Override
public List<Question> queryRandomQuestions() {
List<Question> questions = questionDaoImp.selectAllQuestions();
Collections.shuffle(questions);
return questions;
}
@Override
public List<Question> queryCollectedQuestion() {
List<Question> questions = questionDaoImp.selectCollectedQuestion();
return questions;
}
@Override
public List<Question> queryErrorQuestion() {
return questionDaoImp.selectErrorQuesttions();
}
}
| 1,918 | 0.695516 | 0.691867 | 75 | 24.573334 | 22.517651 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.32 | false | false |
5
|
2731e31842783a5468b61e1fa5677c7eb64ef020
| 10,428,180,617,476 |
008ed5d402e5ee4fdae2c1cd859917b2ad273fb6
|
/CountVowelsAndConsonants.java
|
6ef4c93fd2901e2b4fdfd8386c4da37bbd9821b5
|
[] |
no_license
|
zeus1503/string-problems
|
https://github.com/zeus1503/string-problems
|
f09faf0324f1d9965c91f668076b844c7dfc6fab
|
362b3a56fe6590bd91055be6eae88d61cf81204f
|
refs/heads/master
| 2021-12-27T20:50:08.250000 | 2018-01-16T14:26:02 | 2018-01-16T14:26:02 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.javamultiplex.string;
import java.util.Scanner;
/**
*
* @author Rohit Agarwal
* @category String Interview Questions
* @problem How many vowels and consonants present in String?
*
*/
public class CountVowelsAndConsonants {
public static void main(String[] args) {
Scanner input = null;
try {
input = new Scanner(System.in);
System.out.println("Enter String : ");
String string = input.next();
// Converting String to lower case
string = string.toLowerCase();
int length = string.length();
// Regular expression that matches a string containing a,e,i,o or u.
String vowelsPattern = "[aeiou]";
/**
* Regular expression that matches a string containing other than
* a,e,i,o or u.
*/
String consonantsPattern = "[b-d]|[f-h]|[j-n]|[p-t]|[v-z]";
String temp = null;
int vowels = 0, consonants = 0;
for (int i = 0; i < length; i++) {
temp = String.valueOf(string.charAt(i));
if (temp.matches(vowelsPattern)) {
vowels++;
} else if (temp.matches(consonantsPattern)) {
consonants++;
}
}
System.out.println("Vowels : " + vowels);
System.out.println("Consonants : " + consonants);
} finally {
if (input != null) {
input.close();
}
}
}
}
|
UTF-8
|
Java
| 1,309 |
java
|
CountVowelsAndConsonants.java
|
Java
|
[
{
"context": "\nimport java.util.Scanner;\r\n\r\n/**\r\n * \r\n * @author Rohit Agarwal\r\n * @category String Interview Questions\r\n * @pro",
"end": 100,
"score": 0.9998205304145813,
"start": 87,
"tag": "NAME",
"value": "Rohit Agarwal"
}
] | null |
[] |
package com.javamultiplex.string;
import java.util.Scanner;
/**
*
* @author <NAME>
* @category String Interview Questions
* @problem How many vowels and consonants present in String?
*
*/
public class CountVowelsAndConsonants {
public static void main(String[] args) {
Scanner input = null;
try {
input = new Scanner(System.in);
System.out.println("Enter String : ");
String string = input.next();
// Converting String to lower case
string = string.toLowerCase();
int length = string.length();
// Regular expression that matches a string containing a,e,i,o or u.
String vowelsPattern = "[aeiou]";
/**
* Regular expression that matches a string containing other than
* a,e,i,o or u.
*/
String consonantsPattern = "[b-d]|[f-h]|[j-n]|[p-t]|[v-z]";
String temp = null;
int vowels = 0, consonants = 0;
for (int i = 0; i < length; i++) {
temp = String.valueOf(string.charAt(i));
if (temp.matches(vowelsPattern)) {
vowels++;
} else if (temp.matches(consonantsPattern)) {
consonants++;
}
}
System.out.println("Vowels : " + vowels);
System.out.println("Consonants : " + consonants);
} finally {
if (input != null) {
input.close();
}
}
}
}
| 1,302 | 0.605806 | 0.603514 | 51 | 23.627451 | 20.046965 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.607843 | false | false |
5
|
0a9ada8bccbc4a261b1fe98e32baabfd7b906c59
| 25,237,227,883,758 |
10205601a9a78ddeb9ff39a21636ebbc33dbb0d4
|
/Backend-agent/src/main/java/com/ftn/agent/model/TComment.java
|
c7bb1710a544fcbcad6bdd5dea4bb467f0a04f92
|
[] |
no_license
|
teodora12/BSEP-master
|
https://github.com/teodora12/BSEP-master
|
204e658a4b94a2de904101c4c91323a82d90c086
|
b92ed2614e6fb00d55fed56a1270868055c4e48c
|
refs/heads/master
| 2021-07-08T16:18:07.540000 | 2021-01-26T12:35:43 | 2021-01-26T12:35:43 | 243,832,166 | 0 | 0 | null | false | 2021-05-26T03:10:50 | 2020-02-28T18:47:56 | 2021-01-26T12:35:47 | 2021-05-26T03:10:49 | 15,636 | 0 | 0 | 39 |
Java
| false | false |
package com.ftn.agent.model;
import javax.persistence.*;
import javax.xml.bind.annotation.*;
import java.util.Date;
/**
* <p>Java class for TComment complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="TComment">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Id" type="{http://www.w3.org/2001/XMLSchema}long"/>
* <element ref="{http://www.ftn.uns.ac.rs/user}User"/>
* <element name="Status" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="Date" type="{http://www.w3.org/2001/XMLSchema}dateTime"/>
* <element name="Content" type="{http://www.w3.org/2001/XMLSchema}string"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "TComment", namespace = "http://www.ftn.uns.ac.rs/accommodation", propOrder = {
"id",
"user",
"status",
"date",
"content"
})
@Entity
@Table
public class TComment {
@XmlElement(name = "Id", namespace = "http://www.ftn.uns.ac.rs/accommodation")
@Id
@Column(name="id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
protected long id;
@XmlElement(name = "User", namespace = "http://www.ftn.uns.ac.rs/user", required = true)
@ManyToOne
protected User user;
@XmlElement(name = "Status", namespace = "http://www.ftn.uns.ac.rs/accommodation", required = true)
protected String status;
@XmlElement(name = "Date", namespace = "http://www.ftn.uns.ac.rs/accommodation", required = true)
@XmlSchemaType(name = "dateTime")
protected Date date;
@XmlElement(name = "Content", namespace = "http://www.ftn.uns.ac.rs/accommodation", required = true)
protected String content;
public TComment () {
}
public TComment(TComment comment){
this.date = comment.getDate();
this.status = comment.getStatus();
this.content = comment.getContent();
this.setContent(comment.getContent());
System.out.println(this.content);
System.out.println(comment.getContent());
}
/**
* Gets the value of the id property.
*
*/
public long getId() {
return id;
}
/**
* Sets the value of the id property.
*
*/
public void setId(long value) {
this.id = value;
}
/**
* Gets the value of the user property.
*
* @return
* possible object is
* {@link User }
*
*/
public User getUser() {
return user;
}
/**
* Sets the value of the user property.
*
* @param value
* allowed object is
* {@link User }
*
*/
public void setUser(User value) {
this.user = value;
}
/**
* Gets the value of the status property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getStatus() {
return status;
}
/**
* Sets the value of the status property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setStatus(String value) {
this.status = value;
}
/**
* Gets the value of the date property.
*
* @return
* possible object is
* {@link Date }
*
*/
public Date getDate() {
return date;
}
/**
* Sets the value of the date property.
*
* @param value
* allowed object is
* {@link Date }
*
*/
public void setDate(Date value) {
this.date = value;
}
/**
* Gets the value of the content property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getContent() {
return content;
}
/**
* Sets the value of the content property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setContent(String value) {
this.content = value;
}
}
|
UTF-8
|
Java
| 4,327 |
java
|
TComment.java
|
Java
|
[] | null |
[] |
package com.ftn.agent.model;
import javax.persistence.*;
import javax.xml.bind.annotation.*;
import java.util.Date;
/**
* <p>Java class for TComment complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="TComment">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Id" type="{http://www.w3.org/2001/XMLSchema}long"/>
* <element ref="{http://www.ftn.uns.ac.rs/user}User"/>
* <element name="Status" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="Date" type="{http://www.w3.org/2001/XMLSchema}dateTime"/>
* <element name="Content" type="{http://www.w3.org/2001/XMLSchema}string"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "TComment", namespace = "http://www.ftn.uns.ac.rs/accommodation", propOrder = {
"id",
"user",
"status",
"date",
"content"
})
@Entity
@Table
public class TComment {
@XmlElement(name = "Id", namespace = "http://www.ftn.uns.ac.rs/accommodation")
@Id
@Column(name="id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
protected long id;
@XmlElement(name = "User", namespace = "http://www.ftn.uns.ac.rs/user", required = true)
@ManyToOne
protected User user;
@XmlElement(name = "Status", namespace = "http://www.ftn.uns.ac.rs/accommodation", required = true)
protected String status;
@XmlElement(name = "Date", namespace = "http://www.ftn.uns.ac.rs/accommodation", required = true)
@XmlSchemaType(name = "dateTime")
protected Date date;
@XmlElement(name = "Content", namespace = "http://www.ftn.uns.ac.rs/accommodation", required = true)
protected String content;
public TComment () {
}
public TComment(TComment comment){
this.date = comment.getDate();
this.status = comment.getStatus();
this.content = comment.getContent();
this.setContent(comment.getContent());
System.out.println(this.content);
System.out.println(comment.getContent());
}
/**
* Gets the value of the id property.
*
*/
public long getId() {
return id;
}
/**
* Sets the value of the id property.
*
*/
public void setId(long value) {
this.id = value;
}
/**
* Gets the value of the user property.
*
* @return
* possible object is
* {@link User }
*
*/
public User getUser() {
return user;
}
/**
* Sets the value of the user property.
*
* @param value
* allowed object is
* {@link User }
*
*/
public void setUser(User value) {
this.user = value;
}
/**
* Gets the value of the status property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getStatus() {
return status;
}
/**
* Sets the value of the status property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setStatus(String value) {
this.status = value;
}
/**
* Gets the value of the date property.
*
* @return
* possible object is
* {@link Date }
*
*/
public Date getDate() {
return date;
}
/**
* Sets the value of the date property.
*
* @param value
* allowed object is
* {@link Date }
*
*/
public void setDate(Date value) {
this.date = value;
}
/**
* Gets the value of the content property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getContent() {
return content;
}
/**
* Sets the value of the content property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setContent(String value) {
this.content = value;
}
}
| 4,327 | 0.551652 | 0.545875 | 189 | 21.888889 | 22.904757 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.280423 | false | false |
5
|
6c6acfa156fe1d8c53c59d6fa0e7f9e61e3095a1
| 26,345,329,405,248 |
948239c1504b2b13343287394e1fa68b8f874d60
|
/sdl/src/main/java/org/elsquatrecaps/jig/sdl/searcher/GetRemoteProcessWithUniqueKeys.java
|
c46350fa5da4e9cfe70adeb1a155ccb152e6b503
|
[
"Apache-2.0"
] |
permissive
|
jcanell4/sdl
|
https://github.com/jcanell4/sdl
|
1b1f840a933c5cb0729de151f39cc4a219bda167
|
9ecb3662935ef64fcefaeefb6791faa80830b564
|
refs/heads/master
| 2023-07-20T04:25:02.325000 | 2023-01-18T10:46:09 | 2023-01-18T10:46:09 | 133,438,288 | 0 | 0 | null | false | 2023-07-07T21:46:02 | 2018-05-15T00:45:28 | 2022-12-02T20:19:48 | 2023-07-07T21:46:01 | 2,440 | 0 | 0 | 1 |
Java
| false | false |
/*
* 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 org.elsquatrecaps.jig.sdl.searcher;
import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import org.jsoup.Connection;
import org.jsoup.Jsoup;
/**
*
* @author josep
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class GetRemoteProcessWithUniqueKeys extends AbstractGetRemoteProcess {
@XmlTransient
private Map<String, String> params=null;
public GetRemoteProcessWithUniqueKeys(){
}
public GetRemoteProcessWithUniqueKeys(String url){
super(url);
}
public GetRemoteProcessWithUniqueKeys(String url, Map<String, String> params){
super(url);
this.params = params;
}
public GetRemoteProcessWithUniqueKeys(String url, Map<String, String> params, Map<String, String> cookies){
super(url, cookies);
this.params = params;
}
public void setParams(Map<String, String> params){
this.params = params;
}
public String getParam(String key){
return this.params.get(key);
}
public void setParam(String key, String value){
if(params==null){
params = new HashMap<>();
}
params.put(key, value);
}
protected Connection getConnection(){
Connection con;
if(getParams()!=null){
con = Jsoup.connect(getUrl().concat(getQueryPath())).data(getParams());
}else{
con = Jsoup.connect(getUrl().concat(getQueryPath()));
}
this.configConnection(con);
return con;
}
public Map<String, String> getParams(){
return params;
}
}
|
UTF-8
|
Java
| 2,001 |
java
|
GetRemoteProcessWithUniqueKeys.java
|
Java
|
[
{
"context": "ection;\nimport org.jsoup.Jsoup;\n\n/**\n *\n * @author josep\n */\n@XmlRootElement\n@XmlAccessorType(XmlAccessTyp",
"end": 549,
"score": 0.9995865821838379,
"start": 544,
"tag": "USERNAME",
"value": "josep"
}
] | 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 org.elsquatrecaps.jig.sdl.searcher;
import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import org.jsoup.Connection;
import org.jsoup.Jsoup;
/**
*
* @author josep
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class GetRemoteProcessWithUniqueKeys extends AbstractGetRemoteProcess {
@XmlTransient
private Map<String, String> params=null;
public GetRemoteProcessWithUniqueKeys(){
}
public GetRemoteProcessWithUniqueKeys(String url){
super(url);
}
public GetRemoteProcessWithUniqueKeys(String url, Map<String, String> params){
super(url);
this.params = params;
}
public GetRemoteProcessWithUniqueKeys(String url, Map<String, String> params, Map<String, String> cookies){
super(url, cookies);
this.params = params;
}
public void setParams(Map<String, String> params){
this.params = params;
}
public String getParam(String key){
return this.params.get(key);
}
public void setParam(String key, String value){
if(params==null){
params = new HashMap<>();
}
params.put(key, value);
}
protected Connection getConnection(){
Connection con;
if(getParams()!=null){
con = Jsoup.connect(getUrl().concat(getQueryPath())).data(getParams());
}else{
con = Jsoup.connect(getUrl().concat(getQueryPath()));
}
this.configConnection(con);
return con;
}
public Map<String, String> getParams(){
return params;
}
}
| 2,001 | 0.655672 | 0.655672 | 74 | 26.040541 | 24.051992 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.540541 | false | false |
0
|
da3f78bd6731f92c66d0412792121c4d7f2f0668
| 32,289,564,144,828 |
c61e033e9e568f8b71debe27f66a5d6182a0e64d
|
/src/gui/MainWindow.java
|
91dd73757929e72b4291c816818f7f605e100e01
|
[
"Apache-2.0"
] |
permissive
|
giuliojiang/TurtleInteractiveInterpreter
|
https://github.com/giuliojiang/TurtleInteractiveInterpreter
|
9d6b677799432665b7b934920966424da63369df
|
4c57ab67ab8247a89d86a68790919df650db4b10
|
refs/heads/master
| 2021-01-25T08:29:54.399000 | 2015-02-08T16:19:14 | 2015-02-08T16:19:14 | 30,071,685 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package gui;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.io.PrintStream;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;
public class MainWindow extends JFrame
{
private JPanel contentPane;
private JTextField txtCommands;
ImagePanel lblGraphic;
private JTextArea txtrDisplay;
/**
* Launch the application.
*/
public static MainWindow main()
{
try
{
MainWindow frame = new MainWindow();
frame.setVisible(true);
return frame;
}
catch (Exception e)
{
e.printStackTrace();
return null;
}
}
/**
* Create the frame.
*/
public MainWindow()
{
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 999, 604);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(new GridLayout(0, 1, 0, 0));
JSplitPane splitPane = new JSplitPane();
splitPane.setResizeWeight(0.5);
splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
splitPane.setBounds(12, 12, 950, 550);
contentPane.add(splitPane);
JSplitPane splitPane2 = new JSplitPane();
splitPane2.setResizeWeight(0.9);
;
splitPane2.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
splitPane2.setBounds(500, 12, 500, 494);
splitPane.setLeftComponent(splitPane2);
this.txtrDisplay = new JTextArea();
txtrDisplay.setToolTipText("Output display");
txtrDisplay.setText("");
splitPane2.setLeftComponent(txtrDisplay);
PrintStream printStream = new PrintStream(new CustomOutputStream(
txtrDisplay));
System.setOut(printStream);
System.setErr(printStream);
JScrollPane scroll = new JScrollPane(txtrDisplay,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
splitPane2.add(scroll);
splitPane2.setVisible(true);
txtrDisplay.setFont(new Font("Courier New", Font.PLAIN, 12));
txtrDisplay.setForeground(Color.BLACK);
lblGraphic = new ImagePanel();
splitPane2.setRightComponent(lblGraphic);
// JScrollPane graphicScroll = new JScrollPane(lblGraphic,
// JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
// JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
// splitPane2.add(graphicScroll);
txtCommands = new JTextField();
txtCommands.setToolTipText("Command prompt field");
txtCommands.setText("");
splitPane.setRightComponent(txtCommands);
txtCommands.setColumns(10);
TexfFieldStreamer ts = new TexfFieldStreamer(txtCommands);
txtCommands.addActionListener(ts);
System.setIn(ts);
}
public void drawPaper(BufferedImage m)
{
lblGraphic.setImg(m);
lblGraphic.paintPaper();
// Graphics g = new Graphics();
// g.drawImage(m, 0, 0, null); // see javadoc for more info on the
// parameters
// lblGraphic.paint(g);
// lblGraphic = new JLabel(new ImageIcon(m));
// lblGraphic.paint(null);
// ImageIcon icon = new ImageIcon(m);
// lblGraphic.setIcon(icon);
}
public void setTxtCommandsText(String s)
{
txtCommands.setText(s);
setTxtCommandsCursorToEnd();
}
public void setTxtCommandsCursorToEnd()
{
txtCommands.setCaretPosition(txtCommands.getDocument().getLength());
}
public void printDone()
{
System.out.println("OK!");
}
public void closeAndExit()
{
this.dispatchEvent(new WindowEvent(this, WindowEvent.WINDOW_CLOSING));
}
public void setWindowTitle(String s)
{
this.setTitle(s);
}
public void catchPrintStream()
{
PrintStream printStream = new PrintStream(new CustomOutputStream(
txtrDisplay));
System.setOut(printStream);
System.setErr(printStream);
}
}
|
UTF-8
|
Java
| 4,387 |
java
|
MainWindow.java
|
Java
|
[] | null |
[] |
package gui;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.io.PrintStream;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;
public class MainWindow extends JFrame
{
private JPanel contentPane;
private JTextField txtCommands;
ImagePanel lblGraphic;
private JTextArea txtrDisplay;
/**
* Launch the application.
*/
public static MainWindow main()
{
try
{
MainWindow frame = new MainWindow();
frame.setVisible(true);
return frame;
}
catch (Exception e)
{
e.printStackTrace();
return null;
}
}
/**
* Create the frame.
*/
public MainWindow()
{
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 999, 604);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(new GridLayout(0, 1, 0, 0));
JSplitPane splitPane = new JSplitPane();
splitPane.setResizeWeight(0.5);
splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
splitPane.setBounds(12, 12, 950, 550);
contentPane.add(splitPane);
JSplitPane splitPane2 = new JSplitPane();
splitPane2.setResizeWeight(0.9);
;
splitPane2.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
splitPane2.setBounds(500, 12, 500, 494);
splitPane.setLeftComponent(splitPane2);
this.txtrDisplay = new JTextArea();
txtrDisplay.setToolTipText("Output display");
txtrDisplay.setText("");
splitPane2.setLeftComponent(txtrDisplay);
PrintStream printStream = new PrintStream(new CustomOutputStream(
txtrDisplay));
System.setOut(printStream);
System.setErr(printStream);
JScrollPane scroll = new JScrollPane(txtrDisplay,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
splitPane2.add(scroll);
splitPane2.setVisible(true);
txtrDisplay.setFont(new Font("Courier New", Font.PLAIN, 12));
txtrDisplay.setForeground(Color.BLACK);
lblGraphic = new ImagePanel();
splitPane2.setRightComponent(lblGraphic);
// JScrollPane graphicScroll = new JScrollPane(lblGraphic,
// JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
// JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
// splitPane2.add(graphicScroll);
txtCommands = new JTextField();
txtCommands.setToolTipText("Command prompt field");
txtCommands.setText("");
splitPane.setRightComponent(txtCommands);
txtCommands.setColumns(10);
TexfFieldStreamer ts = new TexfFieldStreamer(txtCommands);
txtCommands.addActionListener(ts);
System.setIn(ts);
}
public void drawPaper(BufferedImage m)
{
lblGraphic.setImg(m);
lblGraphic.paintPaper();
// Graphics g = new Graphics();
// g.drawImage(m, 0, 0, null); // see javadoc for more info on the
// parameters
// lblGraphic.paint(g);
// lblGraphic = new JLabel(new ImageIcon(m));
// lblGraphic.paint(null);
// ImageIcon icon = new ImageIcon(m);
// lblGraphic.setIcon(icon);
}
public void setTxtCommandsText(String s)
{
txtCommands.setText(s);
setTxtCommandsCursorToEnd();
}
public void setTxtCommandsCursorToEnd()
{
txtCommands.setCaretPosition(txtCommands.getDocument().getLength());
}
public void printDone()
{
System.out.println("OK!");
}
public void closeAndExit()
{
this.dispatchEvent(new WindowEvent(this, WindowEvent.WINDOW_CLOSING));
}
public void setWindowTitle(String s)
{
this.setTitle(s);
}
public void catchPrintStream()
{
PrintStream printStream = new PrintStream(new CustomOutputStream(
txtrDisplay));
System.setOut(printStream);
System.setErr(printStream);
}
}
| 4,387 | 0.637338 | 0.623433 | 153 | 27.673203 | 20.716206 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.699346 | false | false |
0
|
f3015cf0ae0159ee872285ed3273e8610c917780
| 11,862,699,690,394 |
24314c8b55577e37bc9a095b6c113b980104be47
|
/Lab SOOL/LAB3-Doubly Dummy Headed Circular Linked List/DoublyListTester.java
|
9760c9d1f2627657c2e9e5308a630141bca1f715
|
[] |
no_license
|
Raihan097/My-220-Labs
|
https://github.com/Raihan097/My-220-Labs
|
5259644f894fb45ba9aff0190a5572640e469043
|
a388d123aed518b24bde4696e6d89ddf3ea00110
|
refs/heads/main
| 2023-07-28T03:07:22.732000 | 2021-09-08T20:57:26 | 2021-09-08T20:57:26 | 404,493,082 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class DoublyListTester {
public static void main(String[] args) {
int[] a1 = { 10, 20, 30, 40 };
DoublyList h1 = new DoublyList(a1);
System.out.println("\n///// Test 01 & Test 02 /////");
h1.showList(); // This should print: 10,20,30,40.
System.out.println("\n///// Test 03 /////");
h1.insert(new Node(55, null, null));
h1.showList(); // This should print: 10,20,30,40,55;
h1.insert(new Node(30, null, null)); // This should print: "This element already exists in the List!"
System.out.println("\n///// Test 04 /////");
int[] a2 = { 10, 20, 30, 40 };
DoublyList h2 = new DoublyList(a2);
System.out.println("Current condition of the new list: ");
h2.showList();
System.out.println();
h2.insert(85, 0);
System.out.println("Inserting element at index: 0");
h2.showList(); // This should print: 85,10,20,30,40.
System.out.println();
System.out.println("Inserting element at index: 3");
h2.insert(95, 3);
h2.showList(); // This should print: 85,10,20,95,30,40.
System.out.println();
System.out.println("Inserting element at index: 6");
h2.insert(75, 6);
h2.showList(); // This should print: 85,10,20,95,30,40,75.
System.out.println();
System.out.println("\n///// Test 05 /////");
int[] a3 = { 10, 20, 30, 40, 50, 60, 70 };
DoublyList h3 = new DoublyList(a3);
h3.showList(); // This should print: 10,20,30,40,50,60,70.
System.out.println();
System.out.println("Removed element at index: 0");
h3.remove(0); // This should print: Removed element: 10
h3.showList(); // This should print: 20,30,40,50,60,70.
System.out.println();
System.out.println("Removed element at index: 3");
h3.remove(3); // This should print: Removed element: 50
h3.showList(); // This should print: 20,30,40,60,70.
System.out.println();
System.out.println("\n///// Test 06 /////");
System.out.println("Removed element: 40");
h3.removeKey(40);
h3.showList(); // This should print: 20, 30, 60, 70
System.out.println();
}
}
|
UTF-8
|
Java
| 2,096 |
java
|
DoublyListTester.java
|
Java
|
[] | null |
[] |
public class DoublyListTester {
public static void main(String[] args) {
int[] a1 = { 10, 20, 30, 40 };
DoublyList h1 = new DoublyList(a1);
System.out.println("\n///// Test 01 & Test 02 /////");
h1.showList(); // This should print: 10,20,30,40.
System.out.println("\n///// Test 03 /////");
h1.insert(new Node(55, null, null));
h1.showList(); // This should print: 10,20,30,40,55;
h1.insert(new Node(30, null, null)); // This should print: "This element already exists in the List!"
System.out.println("\n///// Test 04 /////");
int[] a2 = { 10, 20, 30, 40 };
DoublyList h2 = new DoublyList(a2);
System.out.println("Current condition of the new list: ");
h2.showList();
System.out.println();
h2.insert(85, 0);
System.out.println("Inserting element at index: 0");
h2.showList(); // This should print: 85,10,20,30,40.
System.out.println();
System.out.println("Inserting element at index: 3");
h2.insert(95, 3);
h2.showList(); // This should print: 85,10,20,95,30,40.
System.out.println();
System.out.println("Inserting element at index: 6");
h2.insert(75, 6);
h2.showList(); // This should print: 85,10,20,95,30,40,75.
System.out.println();
System.out.println("\n///// Test 05 /////");
int[] a3 = { 10, 20, 30, 40, 50, 60, 70 };
DoublyList h3 = new DoublyList(a3);
h3.showList(); // This should print: 10,20,30,40,50,60,70.
System.out.println();
System.out.println("Removed element at index: 0");
h3.remove(0); // This should print: Removed element: 10
h3.showList(); // This should print: 20,30,40,50,60,70.
System.out.println();
System.out.println("Removed element at index: 3");
h3.remove(3); // This should print: Removed element: 50
h3.showList(); // This should print: 20,30,40,60,70.
System.out.println();
System.out.println("\n///// Test 06 /////");
System.out.println("Removed element: 40");
h3.removeKey(40);
h3.showList(); // This should print: 20, 30, 60, 70
System.out.println();
}
}
| 2,096 | 0.601622 | 0.508588 | 62 | 32.822582 | 24.196457 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.677419 | false | false |
0
|
65c539a331d7dc5ca5265bfa2ab2169f897cbcc6
| 25,838,523,268,819 |
b3a26a300078e98ad79d7cb600052e5e72d4d1e4
|
/tjf-security-samples/tjf-security-web-request-validation-sample/src/main/java/com/tjf/sample/github/securityweb/requestvalidation/dto/ValidationDto.java
|
164ccde0663b50a9dfba9c39b727e47fbc4eef86
|
[] |
no_license
|
totvs/tjf-samples
|
https://github.com/totvs/tjf-samples
|
14ecbe6d5b64bc2a9ef8314bd0e87ec92775e324
|
b1e8aa86312260cc43b1ae1f392b0f00a5fc41ca
|
refs/heads/master
| 2023-08-30T23:22:57.946000 | 2023-08-30T18:11:30 | 2023-08-30T18:11:30 | 186,483,819 | 46 | 24 | null | false | 2023-09-13T17:18:45 | 2019-05-13T19:37:30 | 2023-09-07T11:25:02 | 2023-09-13T17:18:43 | 30,027 | 44 | 18 | 0 |
Java
| false | false |
package com.tjf.sample.github.securityweb.requestvalidation.dto;
public class ValidationDto {
private String organization;
public String getOrganization() {
return organization;
}
}
|
UTF-8
|
Java
| 190 |
java
|
ValidationDto.java
|
Java
|
[] | null |
[] |
package com.tjf.sample.github.securityweb.requestvalidation.dto;
public class ValidationDto {
private String organization;
public String getOrganization() {
return organization;
}
}
| 190 | 0.789474 | 0.789474 | 10 | 18 | 20.312557 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.8 | false | false |
0
|
4af7068d649664129c4c81bb57771cfb6e05bb3e
| 12,283,606,486,534 |
50758a9406df6852a00a346490d7441f84cc07fb
|
/320/lab10/GraphUtils.java
|
6d4653432f392b1c9b47f2819acb2c977aec32b3
|
[] |
no_license
|
samgomena/CSFIFTY
|
https://github.com/samgomena/CSFIFTY
|
acba17dcdf9285dbbad454faf0dc18414ee3b33e
|
34e129d3caa355297ab6d5e84af15d183c0b01f6
|
refs/heads/master
| 2021-01-19T11:29:37.919000 | 2019-10-02T01:01:03 | 2019-10-02T01:01:03 | 87,970,072 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.io.*;
import java.util.*;
public abstract class GraphUtils {
static <V> Graph<V> emptyGraph() {
// return new AdjSetGraph<V>();
return new AdjSetDirectedGraph<V>();
}
static <V> Graph<V> emptyDirectedGraph() {
// TODO: replace the following line with a call to the
// constructor for the AdjSetDirectedGraphClass.
// We are only using AdjSetGraph here to ensure that the initial
// version of the code will compile.
// return new AdjSetGraph<V>();
return new AdjSetDirectedGraph<V>();
}
static <V> String dumpGraph(Graph<V> g) {
String s = "Vertex count = " + g.vertexCount() + "\n";
for (V v : g.vertices()) {
s += v + ":";
for (V w : g.neighbors(v)) {
s += " " + w;
}
s += "\n";
}
return s;
}
public static <V> void toDot(Graph <V> g, String gname) throws Exception {
toDot(g, gname, "graph", "--");
}
public static <V> void directedToDot(Graph <V> g, String gname) throws Exception {
toDot(g, gname, "digraph", "->");
}
public static <V> void toDot(Graph <V> g, String gname, String type, String arrow) throws Exception {
java.io.PrintStream out = new java.io.PrintStream(gname + ".dot");
out.println(type + " {");
for (V v : g.vertices()) {
for (V w : g.neighbors(v)) {
out.println("\"" + v + "\" " + arrow + " \"" + w + "\";");
}
}
out.println("}");
out.close();
}
public static <V> Graph<V> flip(Graph<V> g) {
// Construct a flipped version of g as a directed graph, using
// a Java translation of the algorithm from Week 5, Slide 70.
Graph<V> flipped = emptyDirectedGraph();
for (V key : g.vertices()) {
flipped.addVertex(key);
}
for (V v : g.vertices()) {
for (V w : g.neighbors(v)) {
// Cast to hashset instead of iterable
HashSet<V> neighbors = (HashSet<V>) flipped.neighbors(w);
neighbors.add(v);
}
}
return flipped;
}
private static <V> List<V> visitDfs(Graph<V> g, Set<V> visited, List<V> finished, V v) {
if(!visited.contains(v)) {
visited.add(v);
for (V w : g.vertices()) {
visitDfs(g, visited, finished, w);
}
finished.add(v);
}
return finished;
}
private static <V> List<V> dfs(Graph<V> g) {
Set<V> visited = new HashSet<V>();
List<V> finished = new ArrayList<V>();
for (V v : g.vertices()) {
finished = visitDfs(g, visited, finished, v);
}
return finished;
}
private static <V> List<V> visitScc(Graph<V> g, Graph<V> flippedG, Set<V> visited, List<V> cc, V v) {
visited.add(v);
cc.add(v);
for (V w : flippedG.neighbors(v)) {
if(!visited.contains(w)) {
visitScc(g, flippedG, visited, cc, w);
}
}
return cc;
}
public static <V> List<List<V>> scc(Graph<V> g) {
// Calculate the list of strongly connected components in the given
// graph, returning the result as a list of lists. You should
// Follow the algorithm that was presented using Python code on the
// slides for Week 5, Slides 66-79, which was also presented at the
// start of each of the Week 5 lab sessions. It is not necessary
// that you understand exactly how the algorithm works, just that
// are able to determine how each part of the Python code can be
// mapped into corresponding Java code that takes advantage of the
// abstract datatypes for lists and sets in the Java Collections
// Framework, as well as the abstract datatype for graphs that we
// have been working with in the Week 8 labs and in the rest of
// this assignment.
// NOTE: It is expected that you will need to define multiple
// auxiliary "private static" methods in this class to complete
// your implementation. (For example, you will need to implement
// at least one "visit" method for each of the two depth first
// searches that are required.)
List<V> finished = dfs(g);
Collections.reverse(finished);
Graph<V> flipped = flip(g);
Set<V> visited = new HashSet<V>();
List<List<V>> sccs = new ArrayList<List<V>>();
for(V v : finished) {
if(!visited.contains(v)) {
List<V> scc = new ArrayList<V>();
scc = visitScc(g, flipped, visited, scc, v);
sccs.add(scc);
}
}
System.out.println(sccs);
return sccs;
}
}
|
UTF-8
|
Java
| 4,409 |
java
|
GraphUtils.java
|
Java
|
[] | null |
[] |
import java.io.*;
import java.util.*;
public abstract class GraphUtils {
static <V> Graph<V> emptyGraph() {
// return new AdjSetGraph<V>();
return new AdjSetDirectedGraph<V>();
}
static <V> Graph<V> emptyDirectedGraph() {
// TODO: replace the following line with a call to the
// constructor for the AdjSetDirectedGraphClass.
// We are only using AdjSetGraph here to ensure that the initial
// version of the code will compile.
// return new AdjSetGraph<V>();
return new AdjSetDirectedGraph<V>();
}
static <V> String dumpGraph(Graph<V> g) {
String s = "Vertex count = " + g.vertexCount() + "\n";
for (V v : g.vertices()) {
s += v + ":";
for (V w : g.neighbors(v)) {
s += " " + w;
}
s += "\n";
}
return s;
}
public static <V> void toDot(Graph <V> g, String gname) throws Exception {
toDot(g, gname, "graph", "--");
}
public static <V> void directedToDot(Graph <V> g, String gname) throws Exception {
toDot(g, gname, "digraph", "->");
}
public static <V> void toDot(Graph <V> g, String gname, String type, String arrow) throws Exception {
java.io.PrintStream out = new java.io.PrintStream(gname + ".dot");
out.println(type + " {");
for (V v : g.vertices()) {
for (V w : g.neighbors(v)) {
out.println("\"" + v + "\" " + arrow + " \"" + w + "\";");
}
}
out.println("}");
out.close();
}
public static <V> Graph<V> flip(Graph<V> g) {
// Construct a flipped version of g as a directed graph, using
// a Java translation of the algorithm from Week 5, Slide 70.
Graph<V> flipped = emptyDirectedGraph();
for (V key : g.vertices()) {
flipped.addVertex(key);
}
for (V v : g.vertices()) {
for (V w : g.neighbors(v)) {
// Cast to hashset instead of iterable
HashSet<V> neighbors = (HashSet<V>) flipped.neighbors(w);
neighbors.add(v);
}
}
return flipped;
}
private static <V> List<V> visitDfs(Graph<V> g, Set<V> visited, List<V> finished, V v) {
if(!visited.contains(v)) {
visited.add(v);
for (V w : g.vertices()) {
visitDfs(g, visited, finished, w);
}
finished.add(v);
}
return finished;
}
private static <V> List<V> dfs(Graph<V> g) {
Set<V> visited = new HashSet<V>();
List<V> finished = new ArrayList<V>();
for (V v : g.vertices()) {
finished = visitDfs(g, visited, finished, v);
}
return finished;
}
private static <V> List<V> visitScc(Graph<V> g, Graph<V> flippedG, Set<V> visited, List<V> cc, V v) {
visited.add(v);
cc.add(v);
for (V w : flippedG.neighbors(v)) {
if(!visited.contains(w)) {
visitScc(g, flippedG, visited, cc, w);
}
}
return cc;
}
public static <V> List<List<V>> scc(Graph<V> g) {
// Calculate the list of strongly connected components in the given
// graph, returning the result as a list of lists. You should
// Follow the algorithm that was presented using Python code on the
// slides for Week 5, Slides 66-79, which was also presented at the
// start of each of the Week 5 lab sessions. It is not necessary
// that you understand exactly how the algorithm works, just that
// are able to determine how each part of the Python code can be
// mapped into corresponding Java code that takes advantage of the
// abstract datatypes for lists and sets in the Java Collections
// Framework, as well as the abstract datatype for graphs that we
// have been working with in the Week 8 labs and in the rest of
// this assignment.
// NOTE: It is expected that you will need to define multiple
// auxiliary "private static" methods in this class to complete
// your implementation. (For example, you will need to implement
// at least one "visit" method for each of the two depth first
// searches that are required.)
List<V> finished = dfs(g);
Collections.reverse(finished);
Graph<V> flipped = flip(g);
Set<V> visited = new HashSet<V>();
List<List<V>> sccs = new ArrayList<List<V>>();
for(V v : finished) {
if(!visited.contains(v)) {
List<V> scc = new ArrayList<V>();
scc = visitScc(g, flipped, visited, scc, v);
sccs.add(scc);
}
}
System.out.println(sccs);
return sccs;
}
}
| 4,409 | 0.601724 | 0.599456 | 142 | 30.049295 | 25.826979 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.605634 | false | false |
0
|
81c0c5ffbb3064f0fbd20af86847c6ffc513f79a
| 5,265,629,926,308 |
0690ba6469cd3b762f2c45c7baf431a86130e301
|
/src/main/java/net/shopxx/service/PaymentMethodService.java
|
873248c6c9552db87ef529d739374b960b074ad7
|
[] |
no_license
|
heyewei/mall
|
https://github.com/heyewei/mall
|
9d3d7c3551999672436fdf3f09a929e9e9ec1989
|
93919fb7936928dd5372f1cecfdd3b68c4c401c4
|
refs/heads/develop
| 2021-07-16T20:23:02.110000 | 2017-10-09T05:17:01 | 2017-10-13T01:27:44 | 107,208,475 | 0 | 2 | null | true | 2017-10-17T02:37:01 | 2017-10-17T02:37:01 | 2017-10-13T01:41:54 | 2017-10-13T01:41:10 | 20,646 | 0 | 0 | 0 | null | null | null |
/*
* Copyright 2005-2017 shopxx.net. All rights reserved.
* Support: http://www.shopxx.net
* License: http://www.shopxx.net/license
*/
package net.shopxx.service;
import java.util.List;
import net.shopxx.entity.Country;
import net.shopxx.entity.PaymentMethod;
/**
* Service - 支付方式
*
* @author SHOP++ Team
* @version 5.0.3
*/
public interface PaymentMethodService extends BaseService<PaymentMethod, Long> {
/**
* 根据国家获取支付方式
* @param country
* @return
*/
List<PaymentMethod> findAll(Country country);
}
|
UTF-8
|
Java
| 551 |
java
|
PaymentMethodService.java
|
Java
|
[
{
"context": "ntMethod;\n\n/**\n * Service - 支付方式\n * \n * @author SHOP++ Team\n * @version 5.0.3\n */\npublic interface PaymentMet",
"end": 315,
"score": 0.6088588833808899,
"start": 306,
"tag": "USERNAME",
"value": "OP++ Team"
}
] | null |
[] |
/*
* Copyright 2005-2017 shopxx.net. All rights reserved.
* Support: http://www.shopxx.net
* License: http://www.shopxx.net/license
*/
package net.shopxx.service;
import java.util.List;
import net.shopxx.entity.Country;
import net.shopxx.entity.PaymentMethod;
/**
* Service - 支付方式
*
* @author SHOP++ Team
* @version 5.0.3
*/
public interface PaymentMethodService extends BaseService<PaymentMethod, Long> {
/**
* 根据国家获取支付方式
* @param country
* @return
*/
List<PaymentMethod> findAll(Country country);
}
| 551 | 0.707457 | 0.686424 | 26 | 19.153847 | 19.972466 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.461538 | false | false |
0
|
215be1e8e9ddb29fbe8c0cc621023e2d7d280890
| 6,743,098,674,109 |
2dd79a9b0ab89aabed1a7fb5dd9673ecddf19b98
|
/src/main/java/com/rkodev/bot/appstate/AppState.java
|
22c91b1a522c135d2b9b80e256fc346b48f2c73d
|
[] |
no_license
|
rkodev/ms-appointment-bot
|
https://github.com/rkodev/ms-appointment-bot
|
098ed1ca1555f748d2b5bbc42dde75895a4547ec
|
6c5c43d26e0a5f1c3ad58111eb47aa65abdcd8fa
|
refs/heads/master
| 2022-04-07T15:50:04.513000 | 2020-03-13T14:33:19 | 2020-03-13T14:33:19 | 246,502,386 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.rkodev.bot.appstate;
import com.microsoft.bot.schema.Activity;
import com.rkodev.bot.domain.AppointmentService;
import com.rkodev.bot.model.Appointment;
/**
* The app can handle only one state at a time
*/
public interface AppState {
Activity handleRequest(AppointmentService appointmentService, Appointment appointment, String response);
}
|
UTF-8
|
Java
| 361 |
java
|
AppState.java
|
Java
|
[] | null |
[] |
package com.rkodev.bot.appstate;
import com.microsoft.bot.schema.Activity;
import com.rkodev.bot.domain.AppointmentService;
import com.rkodev.bot.model.Appointment;
/**
* The app can handle only one state at a time
*/
public interface AppState {
Activity handleRequest(AppointmentService appointmentService, Appointment appointment, String response);
}
| 361 | 0.797784 | 0.797784 | 12 | 29.083334 | 30.258493 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.583333 | false | false |
0
|
fafc4f56708386bc9b479d6aa296b67a54d5ce9b
| 6,906,307,435,285 |
a66c71a821364da7be2c2024e0f22d782146dddc
|
/src/main/java/com/hd/service/VacationService.java
|
930b4b7818282d386cf759d607960928f7fb7ee6
|
[] |
no_license
|
hzhh123/beetn
|
https://github.com/hzhh123/beetn
|
ac90fef2c08d7e0c6a4ee5865f787778d5065461
|
3fa13eb3d860fdcd405e0891ef66537ef7c16eb0
|
refs/heads/master
| 2021-01-25T14:11:06.889000 | 2018-03-03T06:22:00 | 2018-03-03T06:22:00 | 123,665,359 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.hd.service;
import com.hd.entity.Vacation;
import com.hd.util.PageInfo;
import java.io.Serializable;
import java.util.List;
public interface VacationService {
public Serializable doAdd(Vacation vacation) throws Exception;
public void doUpdate(Vacation vacation) throws Exception;
public void doDelete(Vacation vacation) throws Exception;
public List<Vacation> toList(Long userId,PageInfo info) throws Exception;
public Vacation findById(Long id) throws Exception;
public List<Vacation> findByStatus(Long userId, String status, PageInfo info) throws Exception;
void findDataGrid(PageInfo info);
}
|
UTF-8
|
Java
| 630 |
java
|
VacationService.java
|
Java
|
[] | null |
[] |
package com.hd.service;
import com.hd.entity.Vacation;
import com.hd.util.PageInfo;
import java.io.Serializable;
import java.util.List;
public interface VacationService {
public Serializable doAdd(Vacation vacation) throws Exception;
public void doUpdate(Vacation vacation) throws Exception;
public void doDelete(Vacation vacation) throws Exception;
public List<Vacation> toList(Long userId,PageInfo info) throws Exception;
public Vacation findById(Long id) throws Exception;
public List<Vacation> findByStatus(Long userId, String status, PageInfo info) throws Exception;
void findDataGrid(PageInfo info);
}
| 630 | 0.796825 | 0.796825 | 24 | 25.25 | 27.831711 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.125 | false | false |
0
|
4faee207080990d31f99be1587393aa31d681e26
| 39,694,087,754,765 |
f49b1fa5f2ff279df3f947d8e361e61334a9b59c
|
/cs544.exercise13_1/src/main/java/cs544/exercise13_1/TraceAdvice.java
|
6c905b3dbdbf58bff317a487976fe447e014273b
|
[] |
no_license
|
masudjbd/spring
|
https://github.com/masudjbd/spring
|
e96779159d5bbaaab1a3eb8d5c23714d8d8fe422
|
7a37d5c0012c3ebc0a874e168ae58eb9dff5d1ac
|
refs/heads/master
| 2021-01-10T20:11:46.447000 | 2015-04-15T16:37:02 | 2015-04-15T16:37:02 | 34,005,478 | 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 cs544.exercise13_1;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.util.StopWatch;
/**
*
* @author HabibRahman
*/
@Aspect
public class TraceAdvice {
@After("execution (* cs544.exercise13_1.EmailSender.sendEmail(. .))")
public void tracemethod(JoinPoint joinpoint) {
System.out.println("Fri Jun 05 14:09:47 GMT 2009 method= " + joinpoint.getSignature().getName());
}
@After("execution (* cs544.exercise13_1.EmailSender.sendEmail(. .)) && args(emailAddress, message)")
public void tracemethod1(JoinPoint joinpoint, String emailAddress, String message) {
System.out.println("address= "+emailAddress+" message= "+ message);
}
@After("execution (* cs544.exercise13_1.EmailSender.sendEmail(. .))")
public void tracemethod2(JoinPoint joinpoint) {
EmailSender emailsender = (EmailSender) joinpoint.getTarget();
System.out.println("outgoing mail server= "+ emailsender.getOutgoingMailServer());
}
@Around("execution (* cs544.exercise13_1.CustomerDAO.save(. .))")
public Object tracemethod3(ProceedingJoinPoint call) throws Throwable{
StopWatch clock = new StopWatch("");
clock.start(call.toShortString());
Object object = call.proceed();
clock.stop();
System.out.println("Time to execute save = " + clock.getTotalTimeMillis() + " ms");
return object;
}
}
|
UTF-8
|
Java
| 1,795 |
java
|
TraceAdvice.java
|
Java
|
[
{
"context": "springframework.util.StopWatch;\n\n/**\n *\n * @author HabibRahman\n */\n@Aspect\npublic class TraceAdvice { \n @A",
"end": 495,
"score": 0.9997427463531494,
"start": 484,
"tag": "NAME",
"value": "HabibRahman"
}
] | 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 cs544.exercise13_1;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.util.StopWatch;
/**
*
* @author HabibRahman
*/
@Aspect
public class TraceAdvice {
@After("execution (* cs544.exercise13_1.EmailSender.sendEmail(. .))")
public void tracemethod(JoinPoint joinpoint) {
System.out.println("Fri Jun 05 14:09:47 GMT 2009 method= " + joinpoint.getSignature().getName());
}
@After("execution (* cs544.exercise13_1.EmailSender.sendEmail(. .)) && args(emailAddress, message)")
public void tracemethod1(JoinPoint joinpoint, String emailAddress, String message) {
System.out.println("address= "+emailAddress+" message= "+ message);
}
@After("execution (* cs544.exercise13_1.EmailSender.sendEmail(. .))")
public void tracemethod2(JoinPoint joinpoint) {
EmailSender emailsender = (EmailSender) joinpoint.getTarget();
System.out.println("outgoing mail server= "+ emailsender.getOutgoingMailServer());
}
@Around("execution (* cs544.exercise13_1.CustomerDAO.save(. .))")
public Object tracemethod3(ProceedingJoinPoint call) throws Throwable{
StopWatch clock = new StopWatch("");
clock.start(call.toShortString());
Object object = call.proceed();
clock.stop();
System.out.println("Time to execute save = " + clock.getTotalTimeMillis() + " ms");
return object;
}
}
| 1,795 | 0.690808 | 0.665738 | 47 | 37.19149 | 32.003082 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.489362 | false | false |
0
|
93c011e8675dcf5095f44f8773b750e6f23cbe2c
| 3,556,232,942,705 |
81b3dd537b5c436e98d973d54613355a73b4a86c
|
/src/hcmmlj/hcm/ChunkItem.java
|
a696cc3a26f0cc21991c1c1c3d3f92030e3375a4
|
[
"MIT"
] |
permissive
|
molecularge/HummingCat
|
https://github.com/molecularge/HummingCat
|
869f20ff7881a7883ba91530201123273d2f0419
|
8351ff43fb7b3a7f3ab27473999dd9acf03ae918
|
refs/heads/master
| 2022-03-09T09:26:17.402000 | 2019-11-29T06:46:57 | 2019-11-29T06:46:57 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/* Sound Driver 'Humming Cat' for WonderWitch */
/* Copyright (c) 2002-2003,2009,2019 molety */
/* hcmmlj - chunk item */
package hcm;
import java.io.*;
interface ChunkItem
{
int getSize();
int getNumber();
void writeTo(OutputStream out) throws IOException;
}
|
UTF-8
|
Java
| 375 |
java
|
ChunkItem.java
|
Java
|
[
{
"context": " Copyright (c) 2002-2003,2009,2019 molety */\r\n/* hcmmlj - chunk item ",
"end": 133,
"score": 0.9112138748168945,
"start": 127,
"tag": "USERNAME",
"value": "molety"
}
] | null |
[] |
/* Sound Driver 'Humming Cat' for WonderWitch */
/* Copyright (c) 2002-2003,2009,2019 molety */
/* hcmmlj - chunk item */
package hcm;
import java.io.*;
interface ChunkItem
{
int getSize();
int getNumber();
void writeTo(OutputStream out) throws IOException;
}
| 375 | 0.498667 | 0.456 | 13 | 26.846153 | 27.864635 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.769231 | false | false |
0
|
bcdaab8a6742433a3748e025c43bc65b78bccdaf
| 31,920,196,972,252 |
0d94552e09c4ce7dc646abde277a6c9945fce48e
|
/src/main/java/com/qp/lms/compManager/model/CompCostApprovalVO.java
|
836c0af1e2e125f2d738dfa7cc48aa9cb967c402
|
[] |
no_license
|
limsm9449/lms
|
https://github.com/limsm9449/lms
|
312a809eac08240ea5e02ba39a4885ea91dd16a7
|
031af219ce5dada3308774ad07bd028b38e6caca
|
refs/heads/master
| 2022-12-21T13:36:12.265000 | 2020-12-25T13:20:01 | 2020-12-25T13:20:01 | 83,121,360 | 1 | 0 | null | false | 2022-12-16T02:15:55 | 2017-02-25T09:31:08 | 2020-12-25T12:21:50 | 2022-12-16T02:15:52 | 59,956 | 0 | 0 | 10 |
Java
| false | false |
package com.qp.lms.compManager.model;
import com.qp.lms.common.CommonVO;
public class CompCostApprovalVO extends CommonVO {
private static final long serialVersionUID = -1l;
private String approvalId;
private String totalCost;
private String paymentPoint;
private String paymentCost;
private String paymentBank;
private String paymentDate;
private String paymentKind;
private String courseName;
public String getApprovalId() {
return approvalId;
}
public void setApprovalId(String approvalId) {
this.approvalId = approvalId;
}
public String getTotalCost() {
return totalCost;
}
public void setTotalCost(String totalCost) {
this.totalCost = totalCost;
}
public String getPaymentPoint() {
return paymentPoint;
}
public void setPaymentPoint(String paymentPoint) {
this.paymentPoint = paymentPoint;
}
public String getPaymentCost() {
return paymentCost;
}
public void setPaymentCost(String paymentCost) {
this.paymentCost = paymentCost;
}
public String getPaymentBank() {
return paymentBank;
}
public void setPaymentBank(String paymentBank) {
this.paymentBank = paymentBank;
}
public String getPaymentDate() {
return paymentDate;
}
public void setPaymentDate(String paymentDate) {
this.paymentDate = paymentDate;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
public String getPaymentKind() {
return paymentKind;
}
public void setPaymentKind(String paymentKind) {
this.paymentKind = paymentKind;
}
public String getCourseName() {
return courseName;
}
public void setCourseName(String courseName) {
this.courseName = courseName;
}
}
|
UTF-8
|
Java
| 1,643 |
java
|
CompCostApprovalVO.java
|
Java
|
[] | null |
[] |
package com.qp.lms.compManager.model;
import com.qp.lms.common.CommonVO;
public class CompCostApprovalVO extends CommonVO {
private static final long serialVersionUID = -1l;
private String approvalId;
private String totalCost;
private String paymentPoint;
private String paymentCost;
private String paymentBank;
private String paymentDate;
private String paymentKind;
private String courseName;
public String getApprovalId() {
return approvalId;
}
public void setApprovalId(String approvalId) {
this.approvalId = approvalId;
}
public String getTotalCost() {
return totalCost;
}
public void setTotalCost(String totalCost) {
this.totalCost = totalCost;
}
public String getPaymentPoint() {
return paymentPoint;
}
public void setPaymentPoint(String paymentPoint) {
this.paymentPoint = paymentPoint;
}
public String getPaymentCost() {
return paymentCost;
}
public void setPaymentCost(String paymentCost) {
this.paymentCost = paymentCost;
}
public String getPaymentBank() {
return paymentBank;
}
public void setPaymentBank(String paymentBank) {
this.paymentBank = paymentBank;
}
public String getPaymentDate() {
return paymentDate;
}
public void setPaymentDate(String paymentDate) {
this.paymentDate = paymentDate;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
public String getPaymentKind() {
return paymentKind;
}
public void setPaymentKind(String paymentKind) {
this.paymentKind = paymentKind;
}
public String getCourseName() {
return courseName;
}
public void setCourseName(String courseName) {
this.courseName = courseName;
}
}
| 1,643 | 0.761412 | 0.760803 | 71 | 22.140844 | 16.973297 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.549296 | false | false |
0
|
466cef9146300657ff8c7e91ec599cf54d684bba
| 23,218,593,255,519 |
ffe736f8a61e8bc64b21715099751f09f433eb75
|
/Java8Lec/src/ru/knbase/java1/lec91/MethodRefs.java
|
4d60e3d00d261840d1c53af337ff57f657c691fa
|
[
"MIT"
] |
permissive
|
nleva/Java8Lections
|
https://github.com/nleva/Java8Lections
|
0bb62fb17c86fcfc0d1945612a34065d20fe8f28
|
dd50767e1487c7433c49dd29e65fa0185e38979f
|
refs/heads/master
| 2021-04-30T17:52:27.512000 | 2017-03-01T19:35:29 | 2017-03-01T19:35:29 | 80,267,765 | 0 | 1 | null | false | 2017-01-31T22:56:11 | 2017-01-28T05:09:10 | 2017-01-28T10:39:17 | 2017-01-31T22:56:11 | 4 | 0 | 1 | 0 |
Java
| null | null |
package ru.knbase.java1.lec91;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.List;
interface Operator<X>{
X f(X op1, X op2);
}
public class MethodRefs {
public static void main(String[] args) {
BigInteger a = BigInteger.ONE;
BigInteger b = a.add(a);
// new BigInteger
System.out.println(process(a, b, (op1,op2) -> op1.add(op2)));
System.out.println(process(a, b, BigInteger::subtract));
List<String> list = Arrays.asList("1","100","10000000000000","999999999999999999999999999999999999999999999999999999999999999999999999999999");
List<Integer> list2 = Arrays.asList(1,2,3,4);
BigInteger result = list2.stream()
.map(i->i.toString())
.map(BigInteger::new)
//
// .map(i -> new BigInteger(""+i))
.reduce(BigInteger::add).orElse(BigInteger.ZERO);
System.out.println(result);
// list.forEach(action);
}
static <T> T process(T operand1, T operand2, Operator<T> operator){
return operator.f(operand1, operand2);
}
}
|
UTF-8
|
Java
| 1,020 |
java
|
MethodRefs.java
|
Java
|
[] | null |
[] |
package ru.knbase.java1.lec91;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.List;
interface Operator<X>{
X f(X op1, X op2);
}
public class MethodRefs {
public static void main(String[] args) {
BigInteger a = BigInteger.ONE;
BigInteger b = a.add(a);
// new BigInteger
System.out.println(process(a, b, (op1,op2) -> op1.add(op2)));
System.out.println(process(a, b, BigInteger::subtract));
List<String> list = Arrays.asList("1","100","10000000000000","999999999999999999999999999999999999999999999999999999999999999999999999999999");
List<Integer> list2 = Arrays.asList(1,2,3,4);
BigInteger result = list2.stream()
.map(i->i.toString())
.map(BigInteger::new)
//
// .map(i -> new BigInteger(""+i))
.reduce(BigInteger::add).orElse(BigInteger.ZERO);
System.out.println(result);
// list.forEach(action);
}
static <T> T process(T operand1, T operand2, Operator<T> operator){
return operator.f(operand1, operand2);
}
}
| 1,020 | 0.67549 | 0.562745 | 50 | 19.379999 | 26.047564 | 145 | false | false | 0 | 0 | 0 | 0 | 78 | 0.076471 | 1.92 | false | false |
0
|
76fc01986acff2f378567bba8ad5a818548bab78
| 23,218,593,256,393 |
1ebe65181254c91d6b9c3d736e0e50e361c2e55c
|
/BFS&DFS(19)/105_M_ConstructBinaryTreeFromPreorderAndInorderTraversal.java
|
78ff79b8de2cb328d2e4fefc4b8023d4a0559ab7
|
[] |
no_license
|
wychootf4/Leetcode
|
https://github.com/wychootf4/Leetcode
|
921b46dd142c8535d393a7e6ce3c058cdff324b6
|
ce535ee8f4d29b64c857edf81e613918d8fdd849
|
refs/heads/master
| 2021-01-17T09:50:57.616000 | 2017-06-15T00:09:25 | 2017-06-15T00:09:25 | 23,800,303 | 1 | 1 | null | false | 2014-11-01T20:53:06 | 2014-09-08T17:16:38 | 2014-10-13T21:28:08 | 2014-11-01T20:53:06 | 702 | 1 | 1 | 0 |
Java
| null | null |
/*
Given preorder and inorder traversal of a tree, construct the binary tree.
Note:
You may assume that duplicates do not exist in the tree.
*/
// Tag: Tree, Array, DFS
/*
分析:
先根据先序遍历找到树的根,然后找到根在中序遍历中的位置,再递归求根的左子树和右子树。
例子:
Pre: 4 2 1 3 6 5 7
Inorder: 1 2 3 4 5 6 7
*/
/**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/
public class Solution {
public TreeNode buildTree(int[] preorder, int[] inorder) {
if (preorder == null || inorder == null || preorder.length == 0 || inorder.length == 0 || preorder.length != inorder .length){
return null;
}
return helper(preorder, inorder, 0, preorder.length - 1, 0, inorder.length - 1);
}
private TreeNode helper(int[] preorder, int[] inorder, int preStart, int preEnd, int inStart, int inEnd){
// base case
if (preStart > preEnd){
return null;
}
// 根为preorder的第一个元素
TreeNode root = new TreeNode(preorder[preStart]);
// 根据根找到其在inorder中的位置
int position = findPosition(inorder, inStart, inEnd, preorder[preStart]);
// 递归求出根的左右子树
int leftNum = position - inStart;
root.left = helper(preorder, inorder, preStart + 1, preStart + leftNum, inStart, position - 1);
root.right = helper(preorder, inorder, preStart + leftNum + 1, preEnd, position + 1, inEnd);
return root;
}
private int findPosition(int[] inorder, int start, int end, int key){
for (int i = start; i <= end; i++){
if (inorder[i] == key){
return i;
}
}
return -1;
}
}
|
UTF-8
|
Java
| 1,899 |
java
|
105_M_ConstructBinaryTreeFromPreorderAndInorderTraversal.java
|
Java
|
[] | null |
[] |
/*
Given preorder and inorder traversal of a tree, construct the binary tree.
Note:
You may assume that duplicates do not exist in the tree.
*/
// Tag: Tree, Array, DFS
/*
分析:
先根据先序遍历找到树的根,然后找到根在中序遍历中的位置,再递归求根的左子树和右子树。
例子:
Pre: 4 2 1 3 6 5 7
Inorder: 1 2 3 4 5 6 7
*/
/**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/
public class Solution {
public TreeNode buildTree(int[] preorder, int[] inorder) {
if (preorder == null || inorder == null || preorder.length == 0 || inorder.length == 0 || preorder.length != inorder .length){
return null;
}
return helper(preorder, inorder, 0, preorder.length - 1, 0, inorder.length - 1);
}
private TreeNode helper(int[] preorder, int[] inorder, int preStart, int preEnd, int inStart, int inEnd){
// base case
if (preStart > preEnd){
return null;
}
// 根为preorder的第一个元素
TreeNode root = new TreeNode(preorder[preStart]);
// 根据根找到其在inorder中的位置
int position = findPosition(inorder, inStart, inEnd, preorder[preStart]);
// 递归求出根的左右子树
int leftNum = position - inStart;
root.left = helper(preorder, inorder, preStart + 1, preStart + leftNum, inStart, position - 1);
root.right = helper(preorder, inorder, preStart + leftNum + 1, preEnd, position + 1, inEnd);
return root;
}
private int findPosition(int[] inorder, int start, int end, int key){
for (int i = start; i <= end; i++){
if (inorder[i] == key){
return i;
}
}
return -1;
}
}
| 1,899 | 0.583286 | 0.568975 | 63 | 26.730158 | 31.992661 | 149 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.873016 | false | false |
0
|
4af787ef179e3e19be8639ff4faac152f191dca3
| 32,993,938,816,954 |
846e262c398f485a7d06e157fe11e7ad71e7a3ca
|
/spring04/src/main/java/com/abc/di01/MyTest.java
|
0c30636d24ce9516c4900dbacee692d5662bd5e7
|
[] |
no_license
|
hmyll/MySpring
|
https://github.com/hmyll/MySpring
|
43364a5ece908a224178a7cc7f161f139a82f865
|
1912896d08cd84e162820e11c3704ddb3d080254
|
refs/heads/master
| 2023-01-21T00:40:12.504000 | 2020-11-29T10:15:00 | 2020-11-29T10:15:00 | 309,567,834 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.abc.di01;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class MyTest {
// 1.使用可变参数构造方法,加载多个配置文件
@Test
public void test01(){
String config1 = "com/abc/di01/spring-bean01.xml";
String config2 = "com/abc/di01/spring-bean02.xml";
ApplicationContext ac = new ClassPathXmlApplicationContext(config1,config2);
Person person = (Person) ac.getBean("person");
System.out.println(person);
Student student = (Student) ac.getBean("student");
System.out.println(student);
}
//2.使用数组的构造方法,加载多个配置文件
@Test
public void test02(){
String config1 = "com/abc/di01/spring-bean01.xml";
String config2 = "com/abc/di01/spring-bean02.xml";
String[] configs = {config1,config2};
ApplicationContext ac = new ClassPathXmlApplicationContext(configs);
Person person = (Person) ac.getBean("person");
System.out.println(person);
Student student = (Student) ac.getBean("student");
System.out.println(student);
}
//3.使用通配符
@Test
public void test03(){
String config = "com/abc/di01/spring-*.xml";
ApplicationContext ac = new ClassPathXmlApplicationContext(config);
Person person = (Person) ac.getBean("person");
System.out.println(person);
Student student = (Student) ac.getBean("student");
System.out.println(student);
}
//加载主配置文件
@Test
public void test04(){
String config = "com/abc/di01/applicationContest.xml";
ApplicationContext ac = new ClassPathXmlApplicationContext(config);
Person person = (Person) ac.getBean("person");
System.out.println(person);
Student student = (Student) ac.getBean("student");
System.out.println(student);
}
}
|
UTF-8
|
Java
| 2,023 |
java
|
MyTest.java
|
Java
|
[] | null |
[] |
package com.abc.di01;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class MyTest {
// 1.使用可变参数构造方法,加载多个配置文件
@Test
public void test01(){
String config1 = "com/abc/di01/spring-bean01.xml";
String config2 = "com/abc/di01/spring-bean02.xml";
ApplicationContext ac = new ClassPathXmlApplicationContext(config1,config2);
Person person = (Person) ac.getBean("person");
System.out.println(person);
Student student = (Student) ac.getBean("student");
System.out.println(student);
}
//2.使用数组的构造方法,加载多个配置文件
@Test
public void test02(){
String config1 = "com/abc/di01/spring-bean01.xml";
String config2 = "com/abc/di01/spring-bean02.xml";
String[] configs = {config1,config2};
ApplicationContext ac = new ClassPathXmlApplicationContext(configs);
Person person = (Person) ac.getBean("person");
System.out.println(person);
Student student = (Student) ac.getBean("student");
System.out.println(student);
}
//3.使用通配符
@Test
public void test03(){
String config = "com/abc/di01/spring-*.xml";
ApplicationContext ac = new ClassPathXmlApplicationContext(config);
Person person = (Person) ac.getBean("person");
System.out.println(person);
Student student = (Student) ac.getBean("student");
System.out.println(student);
}
//加载主配置文件
@Test
public void test04(){
String config = "com/abc/di01/applicationContest.xml";
ApplicationContext ac = new ClassPathXmlApplicationContext(config);
Person person = (Person) ac.getBean("person");
System.out.println(person);
Student student = (Student) ac.getBean("student");
System.out.println(student);
}
}
| 2,023 | 0.652987 | 0.631688 | 58 | 32.189655 | 24.956829 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.568965 | false | false |
0
|
24c9674a65458f982c22a5af4b48aeee9c1df407
| 26,946,624,820,129 |
bddb46efb9fe79a49fceffef4742f66cc5dc915d
|
/app/src/main/java/com/everestinstruments/cd1/servicesupport/Fragments/Youtube.java
|
d94f3a2e6a817005bc49b61127c8fc8197c7c8fb
|
[] |
no_license
|
everest14/ServiceSupport
|
https://github.com/everest14/ServiceSupport
|
9a9da4fa7dcdde00d1807baf0198969417da5b9e
|
d4803980b865fee3c3aceea1b014bac8ef243dab
|
refs/heads/master
| 2019-02-03T12:20:05.821000 | 2018-01-31T08:50:42 | 2018-01-31T08:50:42 | 99,780,083 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.everestinstruments.cd1.servicesupport.Fragments;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.Toast;
import com.everestinstruments.cd1.servicesupport.MainActivity;
import com.everestinstruments.cd1.servicesupport.R;
import com.google.android.youtube.player.YouTubeBaseActivity;
import com.google.android.youtube.player.YouTubeInitializationResult;
import com.google.android.youtube.player.YouTubePlayer;
import com.google.android.youtube.player.YouTubePlayerView;
/**
* Created by admin on 08/31/2017.
*/
public class Youtube extends YouTubeBaseActivity implements View.OnClickListener {
public static final String API_KEY = Config.YOUTUBE_API_KEY;
boolean doubleBackToExitPressedOnce = false;
//http://youtu.be/<VIDEO_ID>
public static final String VIDEO_ID = "ZWub9VTECxQ";
LinearLayout llVideo1, llvideo2, llVideo3,llVideo4;
ImageView ivBack;
private static final int RECOVERY_REQUEST = 1;
private YouTubePlayerView youTubeView;
RelativeLayout rvMainl;
YouTubePlayer youTubePlayerMain;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_youtube_player);
rvMainl = (RelativeLayout) findViewById(R.id.rvMain);
ivBack = (ImageView) findViewById(R.id.youtube_iv_back);
youTubeView = (YouTubePlayerView) findViewById(R.id.youtube_view);
youTubeView.setVisibility(View.GONE);
llVideo1 = (LinearLayout) findViewById(R.id.frag_youtube_btn_one);
llvideo2 = (LinearLayout) findViewById(R.id.frag_youtube_btn_two);
llVideo3 = (LinearLayout) findViewById(R.id.frag_youtube_btn_three);
llVideo4 = (LinearLayout)findViewById(R.id.frag_youtube_btn_four);
llVideo4.setOnClickListener(this);
llVideo1.setOnClickListener(this);
llvideo2.setOnClickListener(this);
llVideo3.setOnClickListener(this);
ivBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
backButton();
}
});
}
@Override
protected void onResume() {
super.onResume();
}
@Override
public void onBackPressed() {
if (youTubeView.getVisibility() == View.VISIBLE)
{
rvMainl.setVisibility(View.VISIBLE);
youTubeView = (YouTubePlayerView) findViewById(R.id.youtube_view);
youTubeView.setVisibility(View.GONE);
}
else
{
backButton();
}
}
private void backButton() {
Intent i = new Intent(Youtube.this, MainActivity.class);
startActivity(i);
finish();
overridePendingTransition(R.anim.left_to_right_back, R.anim.right_to_left_back);
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.frag_youtube_btn_one:
youTubeView.destroyDrawingCache();
youTubeView.destroyDrawingCache();
init("DHFfXNES8gw");
break;
case R.id.frag_youtube_btn_two:
init("RLcsVqx4IsU");
break;
case R.id.frag_youtube_btn_three:
init("8Fx97V_Z3YY");
break;
case R.id.frag_youtube_btn_four:
init("940qp3BdR6o");
break;
}
}
private void init(final String VIdeoId) {
rvMainl.setVisibility(View.GONE);
youTubeView.setVisibility(View.VISIBLE);
if (youTubePlayerMain != null)
{
try{
youTubePlayerMain.pause();
youTubePlayerMain.cueVideo(VIdeoId);
}
catch(Exception e){
e.printStackTrace();
}
}else {
youTubeView.initialize(Config.YOUTUBE_API_KEY, new YouTubePlayer.OnInitializedListener() {
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, final YouTubePlayer youTubePlayer, boolean b) {
youTubePlayerMain = youTubePlayer;
if (!b) {
try
{ youTubePlayer.cueVideo(VIdeoId); // Plays https://www.youtube.com/watch?v=fhWaJi1Hsfo
}catch (Exception e)
{
Toast.makeText(getApplicationContext(),"Somrthing Went Wrong with this video ",Toast.LENGTH_SHORT).show();
}
}
}
@Override
public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {
if (youTubeInitializationResult.isUserRecoverableError()) {
youTubeInitializationResult.getErrorDialog(Youtube.this, RECOVERY_REQUEST).show();
} else {
Toast.makeText(Youtube.this, youTubeInitializationResult.toString(), Toast.LENGTH_LONG).show();
}
}
});
}
}
}
|
UTF-8
|
Java
| 5,399 |
java
|
Youtube.java
|
Java
|
[
{
"context": "utube.player.YouTubePlayerView;\n\n/**\n * Created by admin on 08/31/2017.\n */\n\npublic class Youtube extends ",
"end": 669,
"score": 0.9900153279304504,
"start": 664,
"tag": "USERNAME",
"value": "admin"
}
] | null |
[] |
package com.everestinstruments.cd1.servicesupport.Fragments;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.Toast;
import com.everestinstruments.cd1.servicesupport.MainActivity;
import com.everestinstruments.cd1.servicesupport.R;
import com.google.android.youtube.player.YouTubeBaseActivity;
import com.google.android.youtube.player.YouTubeInitializationResult;
import com.google.android.youtube.player.YouTubePlayer;
import com.google.android.youtube.player.YouTubePlayerView;
/**
* Created by admin on 08/31/2017.
*/
public class Youtube extends YouTubeBaseActivity implements View.OnClickListener {
public static final String API_KEY = Config.YOUTUBE_API_KEY;
boolean doubleBackToExitPressedOnce = false;
//http://youtu.be/<VIDEO_ID>
public static final String VIDEO_ID = "ZWub9VTECxQ";
LinearLayout llVideo1, llvideo2, llVideo3,llVideo4;
ImageView ivBack;
private static final int RECOVERY_REQUEST = 1;
private YouTubePlayerView youTubeView;
RelativeLayout rvMainl;
YouTubePlayer youTubePlayerMain;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_youtube_player);
rvMainl = (RelativeLayout) findViewById(R.id.rvMain);
ivBack = (ImageView) findViewById(R.id.youtube_iv_back);
youTubeView = (YouTubePlayerView) findViewById(R.id.youtube_view);
youTubeView.setVisibility(View.GONE);
llVideo1 = (LinearLayout) findViewById(R.id.frag_youtube_btn_one);
llvideo2 = (LinearLayout) findViewById(R.id.frag_youtube_btn_two);
llVideo3 = (LinearLayout) findViewById(R.id.frag_youtube_btn_three);
llVideo4 = (LinearLayout)findViewById(R.id.frag_youtube_btn_four);
llVideo4.setOnClickListener(this);
llVideo1.setOnClickListener(this);
llvideo2.setOnClickListener(this);
llVideo3.setOnClickListener(this);
ivBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
backButton();
}
});
}
@Override
protected void onResume() {
super.onResume();
}
@Override
public void onBackPressed() {
if (youTubeView.getVisibility() == View.VISIBLE)
{
rvMainl.setVisibility(View.VISIBLE);
youTubeView = (YouTubePlayerView) findViewById(R.id.youtube_view);
youTubeView.setVisibility(View.GONE);
}
else
{
backButton();
}
}
private void backButton() {
Intent i = new Intent(Youtube.this, MainActivity.class);
startActivity(i);
finish();
overridePendingTransition(R.anim.left_to_right_back, R.anim.right_to_left_back);
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.frag_youtube_btn_one:
youTubeView.destroyDrawingCache();
youTubeView.destroyDrawingCache();
init("DHFfXNES8gw");
break;
case R.id.frag_youtube_btn_two:
init("RLcsVqx4IsU");
break;
case R.id.frag_youtube_btn_three:
init("8Fx97V_Z3YY");
break;
case R.id.frag_youtube_btn_four:
init("940qp3BdR6o");
break;
}
}
private void init(final String VIdeoId) {
rvMainl.setVisibility(View.GONE);
youTubeView.setVisibility(View.VISIBLE);
if (youTubePlayerMain != null)
{
try{
youTubePlayerMain.pause();
youTubePlayerMain.cueVideo(VIdeoId);
}
catch(Exception e){
e.printStackTrace();
}
}else {
youTubeView.initialize(Config.YOUTUBE_API_KEY, new YouTubePlayer.OnInitializedListener() {
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, final YouTubePlayer youTubePlayer, boolean b) {
youTubePlayerMain = youTubePlayer;
if (!b) {
try
{ youTubePlayer.cueVideo(VIdeoId); // Plays https://www.youtube.com/watch?v=fhWaJi1Hsfo
}catch (Exception e)
{
Toast.makeText(getApplicationContext(),"Somrthing Went Wrong with this video ",Toast.LENGTH_SHORT).show();
}
}
}
@Override
public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {
if (youTubeInitializationResult.isUserRecoverableError()) {
youTubeInitializationResult.getErrorDialog(Youtube.this, RECOVERY_REQUEST).show();
} else {
Toast.makeText(Youtube.this, youTubeInitializationResult.toString(), Toast.LENGTH_LONG).show();
}
}
});
}
}
}
| 5,399 | 0.61178 | 0.604927 | 168 | 31.142857 | 30.193283 | 143 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.494048 | false | false |
0
|
8405308d21bb345e50b45509bbc67a98f057b78c
| 29,618,094,539,836 |
986d7f91287471124133db3adf72d8f77d3c842c
|
/GoFounders/src/main/java/com/onpassive/dao/FAQsDao.java
|
d779e34f9ac0d1fa400f40d082c0f1368bfc6a7d
|
[] |
no_license
|
chandresh02/onpassiveProject
|
https://github.com/chandresh02/onpassiveProject
|
479587e319d767ff3b631b5381333138b8d4b4fe
|
11b925abc34292c547626bef0113c0035d06c19f
|
refs/heads/master
| 2022-12-23T05:33:58.156000 | 2019-09-20T12:56:12 | 2019-09-20T12:56:12 | 209,790,516 | 0 | 0 | null | false | 2022-12-16T13:43:12 | 2019-09-20T12:54:40 | 2019-09-20T12:56:53 | 2022-12-16T13:43:12 | 529 | 0 | 0 | 5 |
Java
| false | false |
package com.onpassive.dao;
import java.util.List;
import com.onpassive.model.FAQsDto;
public interface FAQsDao {
List<FAQsDto> fetchDaoFAQsRecords();
}
|
UTF-8
|
Java
| 183 |
java
|
FAQsDao.java
|
Java
|
[] | null |
[] |
package com.onpassive.dao;
import java.util.List;
import com.onpassive.model.FAQsDto;
public interface FAQsDao {
List<FAQsDto> fetchDaoFAQsRecords();
}
| 183 | 0.666667 | 0.666667 | 17 | 8.764706 | 13.562619 | 37 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.411765 | false | false |
0
|
15cbf41837821fc432702fc42d29a5f7e8f7ba45
| 4,140,348,525,130 |
ea895de41385436584c76ac48ad5c852b3009201
|
/ShowMicroservice/src/test/java/com/cg/omts/show/test/TestShowTime.java
|
0fe87e193d70c3f597ea3c344524fe3215df00a1
|
[] |
no_license
|
ybhatia/OMTS
|
https://github.com/ybhatia/OMTS
|
8d52705adf7a6917a4ae28fa7c6fad7b2ed972ea
|
b6e3c3f4f64007f7cd1202a15531ce74efc00cfa
|
refs/heads/master
| 2022-12-24T09:34:33.248000 | 2020-10-07T19:39:44 | 2020-10-07T19:39:44 | 299,086,903 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.cg.omts.show.test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.jupiter.api.Test;
import com.cg.omts.show.validation.Validation;
public class TestShowTime {
Validation validation = new Validation();
@Test
public void testTimeBlank() {
boolean isTimeValid = validation.isValidShowTime("");
assertFalse(isTimeValid);
}
@Test
public void testTimeValid() {
boolean isTimeValid = validation.isValidShowTime("10:30");
assertTrue(isTimeValid);
}
@Test
public void testTimeInvalidWithHour() {
boolean isTimeValid = validation.isValidShowTime("10");
assertFalse(isTimeValid);
}
@Test
public void testTimeInvalidWithMinute() {
boolean isTimeValid = validation.isValidShowTime("30");
assertFalse(isTimeValid);
}
}
|
UTF-8
|
Java
| 849 |
java
|
TestShowTime.java
|
Java
|
[] | null |
[] |
package com.cg.omts.show.test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.jupiter.api.Test;
import com.cg.omts.show.validation.Validation;
public class TestShowTime {
Validation validation = new Validation();
@Test
public void testTimeBlank() {
boolean isTimeValid = validation.isValidShowTime("");
assertFalse(isTimeValid);
}
@Test
public void testTimeValid() {
boolean isTimeValid = validation.isValidShowTime("10:30");
assertTrue(isTimeValid);
}
@Test
public void testTimeInvalidWithHour() {
boolean isTimeValid = validation.isValidShowTime("10");
assertFalse(isTimeValid);
}
@Test
public void testTimeInvalidWithMinute() {
boolean isTimeValid = validation.isValidShowTime("30");
assertFalse(isTimeValid);
}
}
| 849 | 0.726737 | 0.717314 | 37 | 20.945946 | 20.372141 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.162162 | false | false |
0
|
b28914e1abc2a448f84a421db34c636263190963
| 4,140,348,528,019 |
1c1443b0dc538d9ea835c9cbe366bc584ae8df26
|
/src/main/java/com/order/webservice/service/order/OrderService.java
|
fc7ce372e85a2bbb1c8cd37395113db50c275b53
|
[] |
no_license
|
Deep2018530/OrderManageService
|
https://github.com/Deep2018530/OrderManageService
|
dbe5775d1dbd0cf46f880897f33e445d2e2ff329
|
ca579e5a4ca4182e3369c21dbbf7259a25daa625
|
refs/heads/master
| 2022-07-10T09:00:36.541000 | 2019-11-08T18:53:04 | 2019-11-08T18:53:04 | 216,752,182 | 0 | 0 | null | false | 2022-06-21T02:05:23 | 2019-10-22T07:39:15 | 2019-11-08T18:53:19 | 2022-06-21T02:05:20 | 803 | 0 | 0 | 3 |
Java
| false | false |
package com.order.webservice.service.order;
import com.order.webservice.domain.dto.order.OrderDto;
import com.order.webservice.domain.enums.OrderStatus;
import com.order.webservice.domain.vo.PageResponseVo;
import com.order.webservice.domain.vo.order.OrderNewVo;
import com.order.webservice.domain.vo.order.OrderRefundVo;
import com.order.webservice.domain.vo.order.OrderStatisticsVo;
import java.math.BigInteger;
import java.util.List;
public interface OrderService {
PageResponseVo<Object> query(Integer page, Integer size, OrderDto orderDto);
PageResponseVo<Object> productQueryOrder(Integer page, Integer size, String productName);
List<String> state();
List<OrderRefundVo> refundQueryOrder(BigInteger orderId);
/**
* 购买商品→生成订单
*
* @param userId
* @param productId
* @return
*/
OrderNewVo buyProduct(Object userId, Long productId);
/**
* 修改订单状态
*
* @param orderId
* @param applyForRefund
* @return
*/
Boolean updateOrderStatus(BigInteger orderId, OrderStatus applyForRefund);
/**
* 审核通过
*
* @param orderId
* @param userId
* @return
*/
Boolean passVerify(BigInteger orderId, BigInteger userId);
/**
* 审核拒绝
*
* @param orderId
* @param rejectReason
* @return
*/
Boolean rejectVerify(BigInteger orderId, String rejectReason);
/**
* 订单顶部统计(审核、未审核)
*
* @return
*/
OrderStatisticsVo getOrderStatistics();
}
|
UTF-8
|
Java
| 1,585 |
java
|
OrderService.java
|
Java
|
[] | null |
[] |
package com.order.webservice.service.order;
import com.order.webservice.domain.dto.order.OrderDto;
import com.order.webservice.domain.enums.OrderStatus;
import com.order.webservice.domain.vo.PageResponseVo;
import com.order.webservice.domain.vo.order.OrderNewVo;
import com.order.webservice.domain.vo.order.OrderRefundVo;
import com.order.webservice.domain.vo.order.OrderStatisticsVo;
import java.math.BigInteger;
import java.util.List;
public interface OrderService {
PageResponseVo<Object> query(Integer page, Integer size, OrderDto orderDto);
PageResponseVo<Object> productQueryOrder(Integer page, Integer size, String productName);
List<String> state();
List<OrderRefundVo> refundQueryOrder(BigInteger orderId);
/**
* 购买商品→生成订单
*
* @param userId
* @param productId
* @return
*/
OrderNewVo buyProduct(Object userId, Long productId);
/**
* 修改订单状态
*
* @param orderId
* @param applyForRefund
* @return
*/
Boolean updateOrderStatus(BigInteger orderId, OrderStatus applyForRefund);
/**
* 审核通过
*
* @param orderId
* @param userId
* @return
*/
Boolean passVerify(BigInteger orderId, BigInteger userId);
/**
* 审核拒绝
*
* @param orderId
* @param rejectReason
* @return
*/
Boolean rejectVerify(BigInteger orderId, String rejectReason);
/**
* 订单顶部统计(审核、未审核)
*
* @return
*/
OrderStatisticsVo getOrderStatistics();
}
| 1,585 | 0.674157 | 0.674157 | 66 | 21.924242 | 23.602972 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.393939 | false | false |
0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.