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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
79933b832fce2418814a21f6debd7c988f4625ee | 14,070,312,930,099 | e64ab3bdb4a82882b78fa67745ea876bce62d882 | /SuperGame/src/dev/master/firstgame/utils/Utils.java | 3b78e64fa6d5431a431cc3627498d8526ba3046e | []
| no_license | Math22232/Eclipse-Game | https://github.com/Math22232/Eclipse-Game | 660c7e4dfc1fbe973f5c183a84cdc46a9dd51056 | bc3c00fb38458998fee4d7105c5cbcc9d339c9d6 | refs/heads/master | 2017-12-06T03:29:32.202000 | 2017-02-09T18:15:52 | 2017-02-09T18:15:52 | 79,964,069 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package dev.master.firstgame.utils;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.DirectoryNotEmptyException;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
public class Utils {
public static String loadFileasString(String path){
StringBuilder builder = new StringBuilder();
try{
BufferedReader br = new BufferedReader(new FileReader(path));
String line;
while((line= br.readLine()) != null)
builder.append(line+ "\n");
br.close();
}catch(IOException e){
e.printStackTrace();
}
return builder.toString();
}
public static int parseInt(String number){
try{
return Integer.parseInt(number);
}catch(NumberFormatException e){
e.printStackTrace();
return 0;
}
}
public static void createFile(String name){
File file = new File("res/world/"+name+".txt");
try {
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
public static void writeIntoFile(String name, String text) throws IOException{
//BufferedReader br = new BufferedReader(new FileReader(new File("res/world/"+name+".txt")));
BufferedWriter bw = new BufferedWriter(new FileWriter(new File("res/world/"+name+".txt")));
bw.write(text);
if ( bw != null)
bw.close( );
}
}
| UTF-8 | Java | 1,522 | java | Utils.java | Java | []
| null | []
| package dev.master.firstgame.utils;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.DirectoryNotEmptyException;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
public class Utils {
public static String loadFileasString(String path){
StringBuilder builder = new StringBuilder();
try{
BufferedReader br = new BufferedReader(new FileReader(path));
String line;
while((line= br.readLine()) != null)
builder.append(line+ "\n");
br.close();
}catch(IOException e){
e.printStackTrace();
}
return builder.toString();
}
public static int parseInt(String number){
try{
return Integer.parseInt(number);
}catch(NumberFormatException e){
e.printStackTrace();
return 0;
}
}
public static void createFile(String name){
File file = new File("res/world/"+name+".txt");
try {
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
public static void writeIntoFile(String name, String text) throws IOException{
//BufferedReader br = new BufferedReader(new FileReader(new File("res/world/"+name+".txt")));
BufferedWriter bw = new BufferedWriter(new FileWriter(new File("res/world/"+name+".txt")));
bw.write(text);
if ( bw != null)
bw.close( );
}
}
| 1,522 | 0.663601 | 0.662943 | 62 | 22.548388 | 22.051023 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.822581 | false | false | 10 |
f16d35c4f3cf28bf085bd59eae2d5fc0267da0db | 9,577,777,078,633 | 4e045b71da2ee63d1b05c4f2f7f724667f942121 | /dmd-framework/framework-user-core/src/main/java/com/dmtz/framework/user/model/UserReserve.java | 637c3dcead441eaaed0ac60068d6f88a0646eb64 | []
| no_license | hecj/duomeidai | https://github.com/hecj/duomeidai | 2d9b47f4f3cb8b0b04c89173f8693602fa8449b8 | e4f9e58021cc1a5bb0293b9cce34a3c8cffe08c8 | refs/heads/master | 2016-09-22T20:02:06.673000 | 2016-07-26T05:44:57 | 2016-07-26T05:44:57 | 64,193,347 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.dmtz.framework.user.model;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@Entity
@Table(name = "user_reserve")
public class UserReserve implements Serializable{
/**
*
*/
private static final long serialVersionUID = 6423296365483439104L;
private Long id;
private String name;
private String mobile;
private int status;
private Long reserveAt;
private Long deadline;
private Long reserveBy;
private Long investBy;
private Long invester;
private String investerName;
private Long invitee;
private String inviteeName;
private Date investTime;
private Long updateAt;
private Long createAt;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Column(name = "name")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Column(name = "mobile")
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
@Column(name = "status")
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
@Column(name = "reserve_at")
public Long getReserveAt() {
return reserveAt;
}
public void setReserveAt(Long reserveAt) {
this.reserveAt = reserveAt;
}
@Column(name = "deadline")
public Long getDeadline() {
return deadline;
}
public void setDeadline(Long deadline) {
this.deadline = deadline;
}
@Column(name = "reserve_by")
public Long getReserveBy() {
return reserveBy;
}
public void setReserveBy(Long reserveBy) {
this.reserveBy = reserveBy;
}
@Column(name = "invest_by")
public Long getInvestBy() {
return investBy;
}
public void setInvestBy(Long investBy) {
this.investBy = investBy;
}
@Column(name = "invester")
public Long getInvester() {
return invester;
}
public void setInvester(Long invester) {
this.invester = invester;
}
@Column(name = "investerName")
public String getInvesterName() {
return investerName;
}
public void setInvesterName(String investerName) {
this.investerName = investerName;
}
@Column(name = "invitee")
public Long getInvitee() {
return invitee;
}
public void setInvitee(Long invitee) {
this.invitee = invitee;
}
@Column(name = "inviteeName")
public String getInviteeName() {
return inviteeName;
}
public void setInviteeName(String inviteeName) {
this.inviteeName = inviteeName;
}
@Column(name = "investTime")
public Date getInvestTime() {
return investTime;
}
public void setInvestTime(Date investTime) {
this.investTime = investTime;
}
@Column(name = "update_at")
public Long getUpdateAt() {
return updateAt;
}
public void setUpdateAt(Long updateAt) {
this.updateAt = updateAt;
}
@Column(name = "create_at")
public Long getCreateAt() {
return createAt;
}
public void setCreateAt(Long createAt) {
this.createAt = createAt;
}
public String toString() {
return ToStringBuilder.reflectionToString(this,
ToStringStyle.MULTI_LINE_STYLE);
}
}
| UTF-8 | Java | 4,099 | java | UserReserve.java | Java | []
| null | []
| package com.dmtz.framework.user.model;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@Entity
@Table(name = "user_reserve")
public class UserReserve implements Serializable{
/**
*
*/
private static final long serialVersionUID = 6423296365483439104L;
private Long id;
private String name;
private String mobile;
private int status;
private Long reserveAt;
private Long deadline;
private Long reserveBy;
private Long investBy;
private Long invester;
private String investerName;
private Long invitee;
private String inviteeName;
private Date investTime;
private Long updateAt;
private Long createAt;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Column(name = "name")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Column(name = "mobile")
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
@Column(name = "status")
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
@Column(name = "reserve_at")
public Long getReserveAt() {
return reserveAt;
}
public void setReserveAt(Long reserveAt) {
this.reserveAt = reserveAt;
}
@Column(name = "deadline")
public Long getDeadline() {
return deadline;
}
public void setDeadline(Long deadline) {
this.deadline = deadline;
}
@Column(name = "reserve_by")
public Long getReserveBy() {
return reserveBy;
}
public void setReserveBy(Long reserveBy) {
this.reserveBy = reserveBy;
}
@Column(name = "invest_by")
public Long getInvestBy() {
return investBy;
}
public void setInvestBy(Long investBy) {
this.investBy = investBy;
}
@Column(name = "invester")
public Long getInvester() {
return invester;
}
public void setInvester(Long invester) {
this.invester = invester;
}
@Column(name = "investerName")
public String getInvesterName() {
return investerName;
}
public void setInvesterName(String investerName) {
this.investerName = investerName;
}
@Column(name = "invitee")
public Long getInvitee() {
return invitee;
}
public void setInvitee(Long invitee) {
this.invitee = invitee;
}
@Column(name = "inviteeName")
public String getInviteeName() {
return inviteeName;
}
public void setInviteeName(String inviteeName) {
this.inviteeName = inviteeName;
}
@Column(name = "investTime")
public Date getInvestTime() {
return investTime;
}
public void setInvestTime(Date investTime) {
this.investTime = investTime;
}
@Column(name = "update_at")
public Long getUpdateAt() {
return updateAt;
}
public void setUpdateAt(Long updateAt) {
this.updateAt = updateAt;
}
@Column(name = "create_at")
public Long getCreateAt() {
return createAt;
}
public void setCreateAt(Long createAt) {
this.createAt = createAt;
}
public String toString() {
return ToStringBuilder.reflectionToString(this,
ToStringStyle.MULTI_LINE_STYLE);
}
}
| 4,099 | 0.635521 | 0.630398 | 222 | 16.454954 | 15.99339 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.400901 | false | false | 10 |
8ffefc65aa52c84a7ba7142904a23337cb60b899 | 206,158,464,223 | 4e81a5ab8cc77cfd4b87e53c342f9f6d06ad2866 | /boxes/shelf/src/main/java/cn/hitstone/shelf/rest/ShelvesUpRest.java | aeabb6d4c2b01093fcd687af7dbb2dd32b70eea6 | [
"Apache-2.0"
]
| permissive | fobecn/box | https://github.com/fobecn/box | dcc6a0e56581a66e427547c48e5a5ef4343c48c2 | 44bfc0d4993bb914f9969f0de6178f4df08f0376 | refs/heads/master | 2018-10-25T05:13:25.953000 | 2018-10-24T18:57:24 | 2018-10-24T18:57:24 | 143,760,142 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.hitstone.shelf.rest;
import cn.hitstone.shelf.entity.Shelf;
import cn.hitstone.shelf.entity.ShelfItem;
import cn.hitstone.shelf.request.ShelfUpRequest;
import cn.hitstone.shelf.service.ShelfUpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
public class ShelvesUpRest {
@Autowired
private ShelfUpService shelfUpService;
@PostMapping(value = "/shelves",produces = "application/json; charset=utf-8",params = "shelfUpRequest")
public List<ShelfItem> up(@RequestBody ShelfUpRequest shelfUpRequest) {
return shelfUpService.up(shelfUpRequest);
}
}
| UTF-8 | Java | 699 | java | ShelvesUpRest.java | Java | []
| null | []
| package cn.hitstone.shelf.rest;
import cn.hitstone.shelf.entity.Shelf;
import cn.hitstone.shelf.entity.ShelfItem;
import cn.hitstone.shelf.request.ShelfUpRequest;
import cn.hitstone.shelf.service.ShelfUpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
public class ShelvesUpRest {
@Autowired
private ShelfUpService shelfUpService;
@PostMapping(value = "/shelves",produces = "application/json; charset=utf-8",params = "shelfUpRequest")
public List<ShelfItem> up(@RequestBody ShelfUpRequest shelfUpRequest) {
return shelfUpService.up(shelfUpRequest);
}
}
| 699 | 0.782547 | 0.781116 | 23 | 29.391304 | 28.05854 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.565217 | false | false | 10 |
ceda2083900a11f8ea4070cb13b00b3e1a3464ea | 206,158,465,386 | 57d386e6a1b7631d854a394266d31955ed0052c4 | /authentication-service/src/main/java/com/autentication/models/payload/LoginRequest.java | 5b4167bf31fb157eee15d5af392eae5ed772a33b | []
| no_license | Flaviord/backend-test | https://github.com/Flaviord/backend-test | d6caeef18bad6e4e2ccd85f5fe1f6d73b25da6ea | 34a2493016b5f9bb3241cb7ee54c0489bd282537 | refs/heads/master | 2023-06-26T12:34:56.294000 | 2021-07-09T12:42:45 | 2021-07-09T12:42:45 | 384,240,561 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.autentication.models.payload;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import java.io.Serializable;
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Data
public class LoginRequest implements Serializable {
@NonNull
private String username;
@NonNull
private String password;
}
| UTF-8 | Java | 399 | java | LoginRequest.java | Java | []
| null | []
| package com.autentication.models.payload;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import java.io.Serializable;
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Data
public class LoginRequest implements Serializable {
@NonNull
private String username;
@NonNull
private String password;
}
| 399 | 0.802005 | 0.802005 | 20 | 18.950001 | 14.065827 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.45 | false | false | 10 |
a11a479dbbcbc1ed5cda848662e68adfeb4aca99 | 6,408,091,213,203 | bd9d1cca13c9bcba9e24ff978d2376167a5dfa4a | /src/main/java/domainmodel/BookAboutCar.java | b66fb0e73e8b166f4295ef4f2d72f3edff5ed996 | []
| no_license | mustafaevaainur/Module-tesing | https://github.com/mustafaevaainur/Module-tesing | f868c360614d4c5af1824b63a0e1d1aa230b7ccc | c74af56b2ad1c6c650e9cce0b1fee10503e7f6b5 | refs/heads/master | 2021-04-15T18:51:12.508000 | 2018-04-09T16:44:49 | 2018-04-09T16:44:49 | 126,370,540 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package domainmodel;
public class BookAboutCar implements Book {
private String carName = null;
public BookAboutCar(String name) {
this.carName = name;
}
@Override
public String getBookName() {
return null;
}
}
| UTF-8 | Java | 255 | java | BookAboutCar.java | Java | []
| null | []
| package domainmodel;
public class BookAboutCar implements Book {
private String carName = null;
public BookAboutCar(String name) {
this.carName = name;
}
@Override
public String getBookName() {
return null;
}
}
| 255 | 0.639216 | 0.639216 | 15 | 16 | 15.279616 | 43 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.266667 | false | false | 10 |
5ebc91ea5f660c46fc5bc56e5be91431bf0b1d2e | 15,685,220,577,253 | f905c9d3d326dbbe79b926b21b17c656d43d43ec | /src/modelo/Twitter.java | 70057945b0ca86f02bef62eb1523a926fa524b16 | []
| no_license | juliocba/twitterpiniquim | https://github.com/juliocba/twitterpiniquim | af8948fc62c55bf309993a7d25549664cf37943e | 6f458d9a37b31dd9ac09361afbfd6bdfad220952 | refs/heads/master | 2021-01-06T20:38:10.658000 | 2015-05-13T20:08:28 | 2015-05-13T20:08:28 | 35,570,881 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package modelo;
import java.util.Date;
public class Twitter {
private Integer id;
private boolean checado;
private String nome;
private String comentario;
private Date data;
public Twitter() {
super();
}
public Twitter(Integer id, boolean checado, String nome,
String comentario, Date data) {
super();
this.id = id;
this.checado = checado;
this.nome = nome;
this.comentario = comentario;
this.data = data;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public boolean getChecado() {
return checado;
}
public void setChecado(boolean checado) {
this.checado = checado;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getComentario() {
return comentario;
}
public void setComentario(String comentario) {
this.comentario = comentario;
}
public Date getData() {
return data;
}
public void setData(Date data) {
this.data = data;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (checado ? 1231 : 1237);
result = prime * result
+ ((comentario == null) ? 0 : comentario.hashCode());
result = prime * result + ((data == null) ? 0 : data.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((nome == null) ? 0 : nome.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Twitter other = (Twitter) obj;
if (checado != other.checado)
return false;
if (comentario == null) {
if (other.comentario != null)
return false;
} else if (!comentario.equals(other.comentario))
return false;
if (data == null) {
if (other.data != null)
return false;
} else if (!data.equals(other.data))
return false;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (nome == null) {
if (other.nome != null)
return false;
} else if (!nome.equals(other.nome))
return false;
return true;
}
@Override
public String toString() {
return "Twitter [id=" + id + ", checado=" + checado + ", nome=" + nome
+ ", comentario=" + comentario + ", data=" + data + "]";
}
}
| UTF-8 | Java | 2,536 | java | Twitter.java | Java | []
| null | []
| package modelo;
import java.util.Date;
public class Twitter {
private Integer id;
private boolean checado;
private String nome;
private String comentario;
private Date data;
public Twitter() {
super();
}
public Twitter(Integer id, boolean checado, String nome,
String comentario, Date data) {
super();
this.id = id;
this.checado = checado;
this.nome = nome;
this.comentario = comentario;
this.data = data;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public boolean getChecado() {
return checado;
}
public void setChecado(boolean checado) {
this.checado = checado;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getComentario() {
return comentario;
}
public void setComentario(String comentario) {
this.comentario = comentario;
}
public Date getData() {
return data;
}
public void setData(Date data) {
this.data = data;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (checado ? 1231 : 1237);
result = prime * result
+ ((comentario == null) ? 0 : comentario.hashCode());
result = prime * result + ((data == null) ? 0 : data.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((nome == null) ? 0 : nome.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Twitter other = (Twitter) obj;
if (checado != other.checado)
return false;
if (comentario == null) {
if (other.comentario != null)
return false;
} else if (!comentario.equals(other.comentario))
return false;
if (data == null) {
if (other.data != null)
return false;
} else if (!data.equals(other.data))
return false;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (nome == null) {
if (other.nome != null)
return false;
} else if (!nome.equals(other.nome))
return false;
return true;
}
@Override
public String toString() {
return "Twitter [id=" + id + ", checado=" + checado + ", nome=" + nome
+ ", comentario=" + comentario + ", data=" + data + "]";
}
}
| 2,536 | 0.597003 | 0.591088 | 124 | 18.451612 | 16.786301 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.903226 | false | false | 10 |
4d70313bed99b466b0f7ca1e7d31f10380684710 | 36,086,315,255,721 | 554ce32aebf85523684be2982e0552a7adfbfbc2 | /Tmall-learning/src/main/java/com/xust/mall/common/ResultCode.java | 0678085bcb37e5e7e47b51cc18438e1e3670695e | []
| no_license | z-sing/learning-spring-boot | https://github.com/z-sing/learning-spring-boot | b2e376186402fad2c4aa9a201dca0fb14802aa77 | 4fed1d016f34a047e269bbc9e8b0770cb52d4de2 | refs/heads/master | 2020-08-29T21:23:13.721000 | 2020-07-02T01:37:52 | 2020-07-02T01:37:52 | 218,177,317 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.xust.mall.common;
import org.springframework.util.StringUtils;
public class ResultCode {
private static final String DEFAULT_SUCCESS_MESSAGE = "SUCCESS";
private static final String DEFAULT_FAIL_MESSAGE = "FAIL";
private static final int RESULT_CODE_SUCCESS = 200;
private static final int RESULT_CODE_SERVER_ERROR = 500;
public static CommonResult SuccessResult() {
CommonResult result = new CommonResult();
result.setResultCode(RESULT_CODE_SUCCESS);
result.setMessage(DEFAULT_SUCCESS_MESSAGE);
return result;
}
public static CommonResult SuccessResult(String message) {
CommonResult result = new CommonResult();
result.setResultCode(RESULT_CODE_SUCCESS);
result.setMessage(message);
return result;
}
public static CommonResult SuccessResult(Object data) {
CommonResult result = new CommonResult();
result.setResultCode(RESULT_CODE_SUCCESS);
result.setMessage(DEFAULT_SUCCESS_MESSAGE);
result.setData(data);
return result;
}
public static CommonResult FailResult(String message) {
CommonResult result = new CommonResult();
result.setResultCode(RESULT_CODE_SERVER_ERROR);
if (StringUtils.isEmpty(message)) {
result.setMessage(DEFAULT_FAIL_MESSAGE);
} else {
result.setMessage(message);
}
return result;
}
public static CommonResult ErrorResult(int code, String message) {
CommonResult result = new CommonResult();
result.setResultCode(code);
result.setMessage(message);
return result;
}
}
| UTF-8 | Java | 1,675 | java | ResultCode.java | Java | []
| null | []
| package com.xust.mall.common;
import org.springframework.util.StringUtils;
public class ResultCode {
private static final String DEFAULT_SUCCESS_MESSAGE = "SUCCESS";
private static final String DEFAULT_FAIL_MESSAGE = "FAIL";
private static final int RESULT_CODE_SUCCESS = 200;
private static final int RESULT_CODE_SERVER_ERROR = 500;
public static CommonResult SuccessResult() {
CommonResult result = new CommonResult();
result.setResultCode(RESULT_CODE_SUCCESS);
result.setMessage(DEFAULT_SUCCESS_MESSAGE);
return result;
}
public static CommonResult SuccessResult(String message) {
CommonResult result = new CommonResult();
result.setResultCode(RESULT_CODE_SUCCESS);
result.setMessage(message);
return result;
}
public static CommonResult SuccessResult(Object data) {
CommonResult result = new CommonResult();
result.setResultCode(RESULT_CODE_SUCCESS);
result.setMessage(DEFAULT_SUCCESS_MESSAGE);
result.setData(data);
return result;
}
public static CommonResult FailResult(String message) {
CommonResult result = new CommonResult();
result.setResultCode(RESULT_CODE_SERVER_ERROR);
if (StringUtils.isEmpty(message)) {
result.setMessage(DEFAULT_FAIL_MESSAGE);
} else {
result.setMessage(message);
}
return result;
}
public static CommonResult ErrorResult(int code, String message) {
CommonResult result = new CommonResult();
result.setResultCode(code);
result.setMessage(message);
return result;
}
}
| 1,675 | 0.671642 | 0.66806 | 53 | 30.603773 | 23.013809 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.54717 | false | false | 10 |
5e0a286978ab9e0d9c3a1ecf15d8e8e5e4a347fb | 36,086,315,256,011 | ad1c9bd719654796a24c2ed0b34bb1ea9b0e3654 | /vs-workspace/Definitive Code/2020 Official Vega Code (New)/src/main/java/frc/robot/Robot.java | 6977bd59d8aff1c97564b5b62f5948dfb2c323c1 | []
| no_license | ellman12/FRC-2020 | https://github.com/ellman12/FRC-2020 | 74fa62a9e00bb9e0403a16edd3a449af2d4fdcd0 | 1352a0afe1af4c77236ca861eb09fd67528369f1 | refs/heads/master | 2023-04-22T00:20:12.019000 | 2021-05-06T23:03:24 | 2021-05-06T23:03:24 | 231,825,299 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /////////////////////////////////////////////////////////////////////
// File: Robot.java
/////////////////////////////////////////////////////////////////////
//
// Purpose: The main file that links every other class and thread
// together, plus some other stuff like.
//
// Authors: Elliott DuCharme and Larry Basegio.
//
// Environment: Microsoft VSCode Java.
//
// Remarks: Created on 2/25/2020.
//
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
package frc.robot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.TimedRobot;
public class Robot extends TimedRobot {
// Used for running auto code once.
boolean autoOnce = true;
// Creating the PS4 controller, with an ID of 0.
Joystick PS4 = new Joystick(0);
// Creating instances of these classes, so everything is all linked together.
// When Robot is extended in other classes, all of this stuff can be accessed
// in those files, too. Inheritance is amazing and works infinitely better than
// doing something like Robot robot = new Robot(); That is terrible and nasty.
BallIntake ballIntake = new BallIntake();
BallIntakeThread ballIntakeThread = new BallIntakeThread("ballIntakeThread");
BallShooter ballShooter = new BallShooter();
BallShootThread ballShootThread = new BallShootThread("ballShootThread");
Constants constants = new Constants();
DriveThread driveThread = new DriveThread("driveThread");
ProximitySensor proximitySensorClass = new ProximitySensor();
RobotDrive robotDrive = new RobotDrive();
WormDrive wormDrive = new WormDrive();
WormDriveThread wormDriveThread = new WormDriveThread("wormDriveThread");
@Override
public void robotInit() {
}
@Override
public void robotPeriodic() {
try {
ballIntakeThread.ballIntakeThread.join();
ballShootThread.ballShootThread.join();
driveThread.driveThread.join();
wormDriveThread.wormDriveThread.join();
} catch (InterruptedException e) {
System.out.println("hi");
}
}
@Override
public void autonomousInit() {
// Put SmartDashboard stuff here, so the SD can get that stuff and the program
// can use that in autoPeriodic()...
}
@Override
public void autonomousPeriodic() {
}
@Override
public void teleopPeriodic() {
}
@Override
public void testPeriodic() {
}
} | UTF-8 | Java | 2,427 | java | Robot.java | Java | [
{
"context": "gether, plus some other stuff like.\n//\n// Authors: Elliott DuCharme and Larry Basegio.\n//\n// Environment: Microsoft V",
"end": 301,
"score": 0.999884843826294,
"start": 285,
"tag": "NAME",
"value": "Elliott DuCharme"
},
{
"context": "er stuff like.\n//\n// Authors: Elliott DuCharme and Larry Basegio.\n//\n// Environment: Microsoft VSCode Java.\n//\n// ",
"end": 319,
"score": 0.9998810291290283,
"start": 306,
"tag": "NAME",
"value": "Larry Basegio"
}
]
| null | []
| /////////////////////////////////////////////////////////////////////
// File: Robot.java
/////////////////////////////////////////////////////////////////////
//
// Purpose: The main file that links every other class and thread
// together, plus some other stuff like.
//
// Authors: <NAME> and <NAME>.
//
// Environment: Microsoft VSCode Java.
//
// Remarks: Created on 2/25/2020.
//
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
package frc.robot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.TimedRobot;
public class Robot extends TimedRobot {
// Used for running auto code once.
boolean autoOnce = true;
// Creating the PS4 controller, with an ID of 0.
Joystick PS4 = new Joystick(0);
// Creating instances of these classes, so everything is all linked together.
// When Robot is extended in other classes, all of this stuff can be accessed
// in those files, too. Inheritance is amazing and works infinitely better than
// doing something like Robot robot = new Robot(); That is terrible and nasty.
BallIntake ballIntake = new BallIntake();
BallIntakeThread ballIntakeThread = new BallIntakeThread("ballIntakeThread");
BallShooter ballShooter = new BallShooter();
BallShootThread ballShootThread = new BallShootThread("ballShootThread");
Constants constants = new Constants();
DriveThread driveThread = new DriveThread("driveThread");
ProximitySensor proximitySensorClass = new ProximitySensor();
RobotDrive robotDrive = new RobotDrive();
WormDrive wormDrive = new WormDrive();
WormDriveThread wormDriveThread = new WormDriveThread("wormDriveThread");
@Override
public void robotInit() {
}
@Override
public void robotPeriodic() {
try {
ballIntakeThread.ballIntakeThread.join();
ballShootThread.ballShootThread.join();
driveThread.driveThread.join();
wormDriveThread.wormDriveThread.join();
} catch (InterruptedException e) {
System.out.println("hi");
}
}
@Override
public void autonomousInit() {
// Put SmartDashboard stuff here, so the SD can get that stuff and the program
// can use that in autoPeriodic()...
}
@Override
public void autonomousPeriodic() {
}
@Override
public void teleopPeriodic() {
}
@Override
public void testPeriodic() {
}
} | 2,410 | 0.638237 | 0.633704 | 85 | 27.564707 | 26.680439 | 82 | false | false | 0 | 0 | 0 | 0 | 151 | 0.124845 | 0.317647 | false | false | 10 |
7c3461aabd60fe2a01aa984f32d421ea35193fa9 | 36,086,315,256,564 | 8d6fff1ad14d09bb588b905d164d86a0f7b16790 | /src/main/java/ua/prom/models/Group.java | ceb476afbafa1d4ad2b9892891f59f2eecf9c339 | []
| no_license | stopfaner/PromUa | https://github.com/stopfaner/PromUa | c12c897c7a16dc34e39e803a7ff28afe558237e5 | 66fa316d392ea4c4249c712b9c11e073bcf08f69 | refs/heads/master | 2021-01-10T03:05:19.408000 | 2016-02-28T09:16:45 | 2016-02-28T09:16:45 | 52,670,358 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ua.prom.models;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
/**
* Created by denys on 27.02.16.
*/
@Entity
@Table(name = "group_filtered")
@XmlRootElement
//@NamedQuery(name = "Groups.getAll", query = "SELECT c FROM product_group c")
public class Group {
@Id
@GeneratedValue(strategy= GenerationType.AUTO)
private long id;
@Column (name = "name")
private String name;
@Column (name = "company_id")
private Long companyId;
public Group() {
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getCompanyId() {
return companyId;
}
public void setCompanyId(Long companyId) {
this.companyId = companyId;
}
}
| UTF-8 | Java | 929 | java | Group.java | Java | [
{
"context": "bind.annotation.XmlRootElement;\n\n/**\n * Created by denys on 27.02.16.\n */\n@Entity\n@Table(name = \"group_fil",
"end": 126,
"score": 0.9996303915977478,
"start": 121,
"tag": "USERNAME",
"value": "denys"
}
]
| null | []
| package ua.prom.models;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
/**
* Created by denys on 27.02.16.
*/
@Entity
@Table(name = "group_filtered")
@XmlRootElement
//@NamedQuery(name = "Groups.getAll", query = "SELECT c FROM product_group c")
public class Group {
@Id
@GeneratedValue(strategy= GenerationType.AUTO)
private long id;
@Column (name = "name")
private String name;
@Column (name = "company_id")
private Long companyId;
public Group() {
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getCompanyId() {
return companyId;
}
public void setCompanyId(Long companyId) {
this.companyId = companyId;
}
}
| 929 | 0.61141 | 0.604952 | 52 | 16.865385 | 16.92407 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 10 |
69d55e89e7414435c22a3b635f221dea7b499eb3 | 24,953,760,055,595 | 58ca167a5b70f3f44c36cfc6e93e109499206dc6 | /src/action/EmpAction.java | 69cfbf4b8dab403cf8f7faf9977c0906b20a9024 | []
| no_license | huadai/ssh | https://github.com/huadai/ssh | ac91ee4a7a19563a605be664f864b504ed8bd23c | ead491be584406c3b2740174ec1de7717eb4b8f3 | refs/heads/master | 2021-08-23T01:37:13.831000 | 2017-12-02T06:24:45 | 2017-12-02T06:24:45 | 112,817,074 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package action;
import java.util.List;
import java.util.Map;
import com.opensymphony.xwork2.ActionContext;
import model.Emp;
import bo.IEmpBo;
public class EmpAction {
//参数
private Integer empno;
//域模型
private Emp emp;
public Integer getEmpno() {
return empno;
}
public void setEmpno(Integer empno) {
this.empno = empno;
}
public Emp getEmp() {
return emp;
}
public void setEmp(Emp emp) {
this.emp = emp;
}
//依赖EmpBo
private IEmpBo empBo;
public IEmpBo getEmpBo() {
return empBo;
}
public void setEmpBo(IEmpBo empBo) {
this.empBo = empBo;
}
//Action的业务方法不要以get开头.
//获取所有员工
public String findEmps() {
System.out.println("bo obj : " + empBo);
System.out.println(this+" action getEmps .... ");
List<Emp> emps = empBo.getEmps();
Map request = (Map) ActionContext.getContext().get("request");
request.put("emps", emps);
return "success";
}
//删除指定员工
public String deleteEmp() {
System.out.println(this+" action deleteEmp .... ");
System.out.println("bo obj : " + empBo);
int rowCount = empBo.deleteEmp(empno);
Map request = (Map) ActionContext.getContext().get("request");
request.put("mess", "删除成功");
return "input";
}
}
| GB18030 | Java | 1,266 | java | EmpAction.java | Java | []
| null | []
| package action;
import java.util.List;
import java.util.Map;
import com.opensymphony.xwork2.ActionContext;
import model.Emp;
import bo.IEmpBo;
public class EmpAction {
//参数
private Integer empno;
//域模型
private Emp emp;
public Integer getEmpno() {
return empno;
}
public void setEmpno(Integer empno) {
this.empno = empno;
}
public Emp getEmp() {
return emp;
}
public void setEmp(Emp emp) {
this.emp = emp;
}
//依赖EmpBo
private IEmpBo empBo;
public IEmpBo getEmpBo() {
return empBo;
}
public void setEmpBo(IEmpBo empBo) {
this.empBo = empBo;
}
//Action的业务方法不要以get开头.
//获取所有员工
public String findEmps() {
System.out.println("bo obj : " + empBo);
System.out.println(this+" action getEmps .... ");
List<Emp> emps = empBo.getEmps();
Map request = (Map) ActionContext.getContext().get("request");
request.put("emps", emps);
return "success";
}
//删除指定员工
public String deleteEmp() {
System.out.println(this+" action deleteEmp .... ");
System.out.println("bo obj : " + empBo);
int rowCount = empBo.deleteEmp(empno);
Map request = (Map) ActionContext.getContext().get("request");
request.put("mess", "删除成功");
return "input";
}
}
| 1,266 | 0.6675 | 0.666667 | 65 | 17.461538 | 16.699219 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.523077 | false | false | 10 |
a40b71a40454a4e7c870eee9cec09a4528ebdf2c | 37,391,985,311,985 | e91f75d9002d294fd3e001434b255b9c0efe19e0 | /gumshoe-probes/src/test/java/com/dell/gumshoe/stack/TestStackFilter.java | da55ea1b0aeb7e28b72aa7b41001ebdb3d3b9de1 | [
"Apache-2.0"
]
| permissive | DukeDai/gumshoe | https://github.com/DukeDai/gumshoe | cfc6e4c12ca419af10ed8de76387b9c84e2f3dc5 | 0f480e1ca1d6f9eff06aaae2d7cd8c1c174469c6 | refs/heads/master | 2021-01-14T08:17:56.325000 | 2016-06-13T19:05:38 | 2016-06-13T19:05:38 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.dell.gumshoe.stack;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import junit.framework.TestCase;
public class TestStackFilter extends TestCase {
private StackFilter EXCLUDE_BUILTIN = StandardFilter.builder().withExcludePlatform().build();
public String testCase1 = "com.dell.gumshoe.socket.Stack.<init>(Stack.java:11)\n" +
"com.dell.gumshoe.socket.SocketIOMonitor$Event.<init>(SocketIOMonitor.java:91)\n" +
"com.dell.gumshoe.socket.SocketIOMonitor.socketWriteBegin(SocketIOMonitor.java:64)\n" +
"sun.misc.IoTrace.socketWriteBegin(IoTrace.java:56)\n" +
"java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)\n" +
"java.net.SocketOutputStream.write(SocketOutputStream.java:159)\n" +
"java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)\n" +
"java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)\n" +
"com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3832)\n" +
"com.mysql.jdbc.MysqlIO.quit(MysqlIO.java:2196)\n" +
"com.mysql.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:4446)\n" +
"com.mysql.jdbc.ConnectionImpl.close(ConnectionImpl.java:1594)\n" +
"org.apache.tomcat.jdbc.pool.PooledConnection.disconnect(PooledConnection.java:331)\n" +
"org.apache.tomcat.jdbc.pool.PooledConnection.release(PooledConnection.java:490)\n" +
"org.apache.tomcat.jdbc.pool.ConnectionPool.release(ConnectionPool.java:581)\n" +
"org.apache.tomcat.jdbc.pool.ConnectionPool.checkIdle(ConnectionPool.java:1002)\n" +
"org.apache.tomcat.jdbc.pool.ConnectionPool.checkIdle(ConnectionPool.java:983)\n" +
"org.apache.tomcat.jdbc.pool.ConnectionPool$PoolCleaner.run(ConnectionPool.java:1350)\n" +
"java.util.TimerThread.mainLoop(Timer.java:555)\n" +
"java.util.TimerThread.run(Timer.java:505)";
public String testCase2 = "com.dell.gumshoe.stack.Stack.<init>(Stack.java:9)\n" +
"com.dell.gumshoe.socket.SocketIOMonitor$Event.<init>(SocketIOMonitor.java:92)\n" +
"com.dell.gumshoe.socket.SocketIOMonitor.socketReadBegin(SocketIOMonitor.java:60)\n" +
"sun.misc.IoTrace.socketReadBegin(IoTrace.java:27)\n" +
"java.net.SocketInputStream.read(SocketInputStream.java:148)\n" +
"java.net.SocketInputStream.read(SocketInputStream.java:122)\n" +
"com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:114)\n" +
"com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:161)\n" +
"com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:189)\n" +
"com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:3036)\n" +
"com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:592)\n" +
"com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1078)\n" +
"com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2412)\n" +
"com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2253)\n" +
"com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2235)\n" +
"com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:813)\n" +
"com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)\n" +
"sun.reflect.GeneratedConstructorAccessor7.newInstance(Unknown Source)\n" +
"sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)\n" +
"java.lang.reflect.Constructor.newInstance(Constructor.java:526)\n" +
"com.mysql.jdbc.Util.handleNewInstance(Util.java:411)\n" +
"com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:399)\n" +
"com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:334)\n" +
"org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:278)\n" +
"org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:182)\n" +
"org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:702)\n" +
"org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:634)\n" +
"org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:188)\n" +
"org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:128)\n" +
"org.dell.persist.Transaction.open(Transaction.java:573)\n" +
"org.dell.persist.Transaction.execute(Transaction.java:423)\n" +
"org.dell.persist.RelationalCache.load(RelationalCache.java:494)\n" +
"org.dell.persist.RelationalCache.find(RelationalCache.java:306)\n" +
"com.dell.provisioning.cloud.CloudFactory.getServers(CloudFactory.java:2266)\n" +
"com.dell.cloud.analytics2.ServerAnalyticsWorker.checkCloud(ServerAnalyticsWorker.java:75)\n" +
"com.dell.monitor.AccountResourceMonitor._run(AccountResourceMonitor.java:294)\n" +
"com.dell.monitor.AccountResourceMonitor.run(AccountResourceMonitor.java:220)\n" +
"java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)\n" +
"java.util.concurrent.FutureTask.run(FutureTask.java:262)\n" +
"java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)\n" +
"java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)\n" +
"java.lang.Thread.run(Thread.java:745)";
public String testCase3 =
"A.SocketIOMonitor$Event.<init>(SocketIOMonitor.java:91)\n" +
"B.SocketIOMonitor.socketWriteBegin(SocketIOMonitor.java:64)\n" +
"C.IoTrace.socketWriteBegin(IoTrace.java:56)\n" +
"C.IoTrace.socketWriteBegin(IoTrace.java:56)\n" +
"C.IoTrace.socketWriteBegin(IoTrace.java:56)\n" +
"C.IoTrace.socketWriteBegin(IoTrace.java:56)\n" +
"D.SocketOutputStream.socketWrite(SocketOutputStream.java:109)\n" +
"E.SocketOutputStream.write(SocketOutputStream.java:159)\n" +
"F.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)\n" +
"G.BufferedOutputStream.flush(BufferedOutputStream.java:140)\n" +
"H.MysqlIO.send(MysqlIO.java:3832)\n" +
"G.BufferedOutputStream.flush(BufferedOutputStream.java:140)\n" +
"H.MysqlIO.send(MysqlIO.java:3832)\n" +
"I.MysqlIO.quit(MysqlIO.java:2196)\n" +
"E.SocketOutputStream.write(SocketOutputStream.java:159)\n" +
"G.BufferedOutputStream.flush(BufferedOutputStream.java:140)\n" +
"H.MysqlIO.send(MysqlIO.java:3832)\n" +
"J.ConnectionImpl.realClose(ConnectionImpl.java:4446)\n" +
"K.TimerThread.run(Timer.java:505)";
private Stack parse(String value) {
String[] lines = value.split("\n");
StackTraceElement[] frames = new StackTraceElement[lines.length];
for(int i=0;i<lines.length;i++) {
try {
String[] fields = lines[i].split("[(:)]");
String classAndMethod = fields[0];
int position = classAndMethod.lastIndexOf('.');
String className = classAndMethod.substring(0, position);
String methodName = classAndMethod.substring(position+1);
String file = fields[1];
String line = fields.length==2 ? "0" : fields[2];
frames[i] = new StackTraceElement(className, methodName, file, Integer.parseInt(line));
} catch(RuntimeException e) {
System.out.println("could not parse: " + lines[i]);
throw e;
}
}
return new Stack(frames);
}
public void testLogfileExample() {
Stack stack = parse(testCase1);
final String unfiltered = stack.toString();
System.out.println("unfiltered:\n" + unfiltered);
assertTrue(unfiltered.contains("at java."));
assertTrue(unfiltered.contains("at com.dell.gumshoe."));
final String filtered = stack.applyFilter(EXCLUDE_BUILTIN).toString();
System.out.println("\nfiltered:\n" + filtered);
assertFalse(filtered.contains("at java."));
assertFalse(filtered.contains("at com.dell.gumshoe."));
}
public void testLogfileExample2() {
Stack stack = parse(testCase2);
final String unfiltered = stack.toString();
System.out.println("unfiltered:\n" + unfiltered);
assertTrue(unfiltered.contains("at java."));
assertTrue(unfiltered.contains("at com.dell.gumshoe."));
final String filtered = stack.applyFilter(EXCLUDE_BUILTIN).toString();
System.out.println("\nfiltered:\n" + filtered);
assertFalse(filtered.contains("at java."));
assertFalse(filtered.contains("at com.dell.gumshoe."));
}
public void testTopBottom() {
Stack stack = parse(testCase1);
StackFilter platform = StandardFilter.builder().withExcludePlatform().build();
StackFilter filter00 = StandardFilter.builder().withExcludePlatform().withEndsOnly(0, 0).build();
StackFilter filter02 = StandardFilter.builder().withExcludePlatform().withEndsOnly(0, 2).build();
StackFilter filter40 = StandardFilter.builder().withExcludePlatform().withEndsOnly(4, 0).build();
StackFilter filter21 = StandardFilter.builder().withExcludePlatform().withEndsOnly(2, 1).build();
assertEquals(stack.applyFilter(platform).getFrames().length, stack.applyFilter(filter00).getFrames().length);
assertEquals(2, stack.applyFilter(filter02).getFrames().length);
assertEquals(3, stack.applyFilter(filter21).getFrames().length);
assertEquals(4, stack.applyFilter(filter40).getFrames().length);
}
public void testRecursion() {
Stack stack = parse(testCase3);
RecursionFilter filter = new RecursionFilter(5, 1);
StackTraceElement[] frames = stack.applyFilter(filter).getFrames();
assertEquals(14, frames.length);
Set<StackTraceElement> unique = new HashSet<>(Arrays.asList(frames));
assertEquals(11, unique.size());
}
}
| UTF-8 | Java | 10,423 | java | TestStackFilter.java | Java | []
| null | []
| package com.dell.gumshoe.stack;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import junit.framework.TestCase;
public class TestStackFilter extends TestCase {
private StackFilter EXCLUDE_BUILTIN = StandardFilter.builder().withExcludePlatform().build();
public String testCase1 = "com.dell.gumshoe.socket.Stack.<init>(Stack.java:11)\n" +
"com.dell.gumshoe.socket.SocketIOMonitor$Event.<init>(SocketIOMonitor.java:91)\n" +
"com.dell.gumshoe.socket.SocketIOMonitor.socketWriteBegin(SocketIOMonitor.java:64)\n" +
"sun.misc.IoTrace.socketWriteBegin(IoTrace.java:56)\n" +
"java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)\n" +
"java.net.SocketOutputStream.write(SocketOutputStream.java:159)\n" +
"java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)\n" +
"java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)\n" +
"com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3832)\n" +
"com.mysql.jdbc.MysqlIO.quit(MysqlIO.java:2196)\n" +
"com.mysql.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:4446)\n" +
"com.mysql.jdbc.ConnectionImpl.close(ConnectionImpl.java:1594)\n" +
"org.apache.tomcat.jdbc.pool.PooledConnection.disconnect(PooledConnection.java:331)\n" +
"org.apache.tomcat.jdbc.pool.PooledConnection.release(PooledConnection.java:490)\n" +
"org.apache.tomcat.jdbc.pool.ConnectionPool.release(ConnectionPool.java:581)\n" +
"org.apache.tomcat.jdbc.pool.ConnectionPool.checkIdle(ConnectionPool.java:1002)\n" +
"org.apache.tomcat.jdbc.pool.ConnectionPool.checkIdle(ConnectionPool.java:983)\n" +
"org.apache.tomcat.jdbc.pool.ConnectionPool$PoolCleaner.run(ConnectionPool.java:1350)\n" +
"java.util.TimerThread.mainLoop(Timer.java:555)\n" +
"java.util.TimerThread.run(Timer.java:505)";
public String testCase2 = "com.dell.gumshoe.stack.Stack.<init>(Stack.java:9)\n" +
"com.dell.gumshoe.socket.SocketIOMonitor$Event.<init>(SocketIOMonitor.java:92)\n" +
"com.dell.gumshoe.socket.SocketIOMonitor.socketReadBegin(SocketIOMonitor.java:60)\n" +
"sun.misc.IoTrace.socketReadBegin(IoTrace.java:27)\n" +
"java.net.SocketInputStream.read(SocketInputStream.java:148)\n" +
"java.net.SocketInputStream.read(SocketInputStream.java:122)\n" +
"com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:114)\n" +
"com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:161)\n" +
"com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:189)\n" +
"com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:3036)\n" +
"com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:592)\n" +
"com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1078)\n" +
"com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2412)\n" +
"com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2253)\n" +
"com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2235)\n" +
"com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:813)\n" +
"com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)\n" +
"sun.reflect.GeneratedConstructorAccessor7.newInstance(Unknown Source)\n" +
"sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)\n" +
"java.lang.reflect.Constructor.newInstance(Constructor.java:526)\n" +
"com.mysql.jdbc.Util.handleNewInstance(Util.java:411)\n" +
"com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:399)\n" +
"com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:334)\n" +
"org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:278)\n" +
"org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:182)\n" +
"org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:702)\n" +
"org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:634)\n" +
"org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:188)\n" +
"org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:128)\n" +
"org.dell.persist.Transaction.open(Transaction.java:573)\n" +
"org.dell.persist.Transaction.execute(Transaction.java:423)\n" +
"org.dell.persist.RelationalCache.load(RelationalCache.java:494)\n" +
"org.dell.persist.RelationalCache.find(RelationalCache.java:306)\n" +
"com.dell.provisioning.cloud.CloudFactory.getServers(CloudFactory.java:2266)\n" +
"com.dell.cloud.analytics2.ServerAnalyticsWorker.checkCloud(ServerAnalyticsWorker.java:75)\n" +
"com.dell.monitor.AccountResourceMonitor._run(AccountResourceMonitor.java:294)\n" +
"com.dell.monitor.AccountResourceMonitor.run(AccountResourceMonitor.java:220)\n" +
"java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)\n" +
"java.util.concurrent.FutureTask.run(FutureTask.java:262)\n" +
"java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)\n" +
"java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)\n" +
"java.lang.Thread.run(Thread.java:745)";
public String testCase3 =
"A.SocketIOMonitor$Event.<init>(SocketIOMonitor.java:91)\n" +
"B.SocketIOMonitor.socketWriteBegin(SocketIOMonitor.java:64)\n" +
"C.IoTrace.socketWriteBegin(IoTrace.java:56)\n" +
"C.IoTrace.socketWriteBegin(IoTrace.java:56)\n" +
"C.IoTrace.socketWriteBegin(IoTrace.java:56)\n" +
"C.IoTrace.socketWriteBegin(IoTrace.java:56)\n" +
"D.SocketOutputStream.socketWrite(SocketOutputStream.java:109)\n" +
"E.SocketOutputStream.write(SocketOutputStream.java:159)\n" +
"F.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)\n" +
"G.BufferedOutputStream.flush(BufferedOutputStream.java:140)\n" +
"H.MysqlIO.send(MysqlIO.java:3832)\n" +
"G.BufferedOutputStream.flush(BufferedOutputStream.java:140)\n" +
"H.MysqlIO.send(MysqlIO.java:3832)\n" +
"I.MysqlIO.quit(MysqlIO.java:2196)\n" +
"E.SocketOutputStream.write(SocketOutputStream.java:159)\n" +
"G.BufferedOutputStream.flush(BufferedOutputStream.java:140)\n" +
"H.MysqlIO.send(MysqlIO.java:3832)\n" +
"J.ConnectionImpl.realClose(ConnectionImpl.java:4446)\n" +
"K.TimerThread.run(Timer.java:505)";
private Stack parse(String value) {
String[] lines = value.split("\n");
StackTraceElement[] frames = new StackTraceElement[lines.length];
for(int i=0;i<lines.length;i++) {
try {
String[] fields = lines[i].split("[(:)]");
String classAndMethod = fields[0];
int position = classAndMethod.lastIndexOf('.');
String className = classAndMethod.substring(0, position);
String methodName = classAndMethod.substring(position+1);
String file = fields[1];
String line = fields.length==2 ? "0" : fields[2];
frames[i] = new StackTraceElement(className, methodName, file, Integer.parseInt(line));
} catch(RuntimeException e) {
System.out.println("could not parse: " + lines[i]);
throw e;
}
}
return new Stack(frames);
}
public void testLogfileExample() {
Stack stack = parse(testCase1);
final String unfiltered = stack.toString();
System.out.println("unfiltered:\n" + unfiltered);
assertTrue(unfiltered.contains("at java."));
assertTrue(unfiltered.contains("at com.dell.gumshoe."));
final String filtered = stack.applyFilter(EXCLUDE_BUILTIN).toString();
System.out.println("\nfiltered:\n" + filtered);
assertFalse(filtered.contains("at java."));
assertFalse(filtered.contains("at com.dell.gumshoe."));
}
public void testLogfileExample2() {
Stack stack = parse(testCase2);
final String unfiltered = stack.toString();
System.out.println("unfiltered:\n" + unfiltered);
assertTrue(unfiltered.contains("at java."));
assertTrue(unfiltered.contains("at com.dell.gumshoe."));
final String filtered = stack.applyFilter(EXCLUDE_BUILTIN).toString();
System.out.println("\nfiltered:\n" + filtered);
assertFalse(filtered.contains("at java."));
assertFalse(filtered.contains("at com.dell.gumshoe."));
}
public void testTopBottom() {
Stack stack = parse(testCase1);
StackFilter platform = StandardFilter.builder().withExcludePlatform().build();
StackFilter filter00 = StandardFilter.builder().withExcludePlatform().withEndsOnly(0, 0).build();
StackFilter filter02 = StandardFilter.builder().withExcludePlatform().withEndsOnly(0, 2).build();
StackFilter filter40 = StandardFilter.builder().withExcludePlatform().withEndsOnly(4, 0).build();
StackFilter filter21 = StandardFilter.builder().withExcludePlatform().withEndsOnly(2, 1).build();
assertEquals(stack.applyFilter(platform).getFrames().length, stack.applyFilter(filter00).getFrames().length);
assertEquals(2, stack.applyFilter(filter02).getFrames().length);
assertEquals(3, stack.applyFilter(filter21).getFrames().length);
assertEquals(4, stack.applyFilter(filter40).getFrames().length);
}
public void testRecursion() {
Stack stack = parse(testCase3);
RecursionFilter filter = new RecursionFilter(5, 1);
StackTraceElement[] frames = stack.applyFilter(filter).getFrames();
assertEquals(14, frames.length);
Set<StackTraceElement> unique = new HashSet<>(Arrays.asList(frames));
assertEquals(11, unique.size());
}
}
| 10,423 | 0.67351 | 0.645591 | 170 | 60.311764 | 32.837791 | 125 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.429412 | false | false | 10 |
d7d1ed91d010e8533d8a1d095d80f4b75e941283 | 34,437,047,836,983 | 491d1fc37933927f48760de1318c6194931bc277 | /02-SpringBootWeb-Rest/src/main/java/ml/xiaoweiba/service/impl/UserServiceImpl.java | 69360e8a8d84af80743a8c79e4bdd46c06a52d6d | []
| no_license | xweiba/SpringBoot | https://github.com/xweiba/SpringBoot | ed29263e0fd2e4a88659bc570107f8ae02b62282 | f33bb28deb92aafb19f117fad3de5edcd46a6bdf | refs/heads/master | 2020-03-21T03:27:51.799000 | 2018-07-09T08:06:06 | 2018-07-09T08:06:06 | 138,054,658 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ml.xiaoweiba.service.impl;
import ml.xiaoweiba.entity.User;
import ml.xiaoweiba.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
/**
* @program: demo
* @description: UserService 实现类
* @author: Mr.xweiba
* @create: 2018-06-28 17:04
**/
@Service
public class UserServiceImpl implements UserService{
@Autowired
// Spring的JdbcTemplate是自动配置的,你可以直接使用@Autowired来注入到你自己的bean中来使用。
private JdbcTemplate jdbcTemplate;
@Override
public void create(String name, String age) {
jdbcTemplate.update("INSERT INTO USER(NAME, AGE) VALUE (?, ?)", name, age);
}
@Override
public void deleteByName(Long id) {
jdbcTemplate.update("DELETE FROM USER WHERE id = ?", id);
}
@Override
public User findByName(String name) {
return jdbcTemplate.queryForObject("SELECT * FROM USER WHERE name = ?", User.class, name);
}
@Override
public void updateByName(Long id, User user) {
jdbcTemplate.update("UPDATE USER SET name = ?, age = ? WHERE id = ?", user.getName(), user.getAge(), id);
}
@Override
public Integer getAllUser() {
return jdbcTemplate.queryForObject("SELECT COUNT(*) FROM USER", Integer.class);
}
@Override
public void deleteAllUser() {
jdbcTemplate.update("DELETE FROM USER ");
}
}
| UTF-8 | Java | 1,511 | java | UserServiceImpl.java | Java | [
{
"context": " demo\n * @description: UserService 实现类\n * @author: Mr.xweiba\n * @create: 2018-06-28 17:04\n **/\n\n@Service\npubli",
"end": 348,
"score": 0.999560534954071,
"start": 339,
"tag": "USERNAME",
"value": "Mr.xweiba"
}
]
| null | []
| package ml.xiaoweiba.service.impl;
import ml.xiaoweiba.entity.User;
import ml.xiaoweiba.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
/**
* @program: demo
* @description: UserService 实现类
* @author: Mr.xweiba
* @create: 2018-06-28 17:04
**/
@Service
public class UserServiceImpl implements UserService{
@Autowired
// Spring的JdbcTemplate是自动配置的,你可以直接使用@Autowired来注入到你自己的bean中来使用。
private JdbcTemplate jdbcTemplate;
@Override
public void create(String name, String age) {
jdbcTemplate.update("INSERT INTO USER(NAME, AGE) VALUE (?, ?)", name, age);
}
@Override
public void deleteByName(Long id) {
jdbcTemplate.update("DELETE FROM USER WHERE id = ?", id);
}
@Override
public User findByName(String name) {
return jdbcTemplate.queryForObject("SELECT * FROM USER WHERE name = ?", User.class, name);
}
@Override
public void updateByName(Long id, User user) {
jdbcTemplate.update("UPDATE USER SET name = ?, age = ? WHERE id = ?", user.getName(), user.getAge(), id);
}
@Override
public Integer getAllUser() {
return jdbcTemplate.queryForObject("SELECT COUNT(*) FROM USER", Integer.class);
}
@Override
public void deleteAllUser() {
jdbcTemplate.update("DELETE FROM USER ");
}
}
| 1,511 | 0.687371 | 0.679089 | 52 | 26.865385 | 28.104221 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.519231 | false | false | 10 |
0aa7fcee23fc63c5c96ace7ec6b09ee813aadd2e | 28,810,640,640,799 | bcd4378fe83af7b24fb0b00b4b413c1669f4db9e | /src/main/java/com/qixin/example/utils/bind/annotation/CurrentUser.java | f5ec64297f70851c651feefb8a766fb3c53fb308 | []
| no_license | qi330553352/Shiro | https://github.com/qi330553352/Shiro | cdf82fe68f691972fd75df4530ba23d6dcee2665 | 6bbf3bcc0dbc49c086759c3762f0b84c4d13aa54 | refs/heads/master | 2021-05-11T03:30:19.135000 | 2018-01-30T17:48:49 | 2018-01-30T17:48:49 | 117,867,918 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.qixin.example.utils.bind.annotation;
import com.qixin.example.utils.Constants;
import java.lang.annotation.*;
/** 绑定当前登录的用户
* 文 件 名: CurrentUser
* 包 名: com.qixin.example.utils.bind.annotation
* 创 建 时 间: 2018/1/18 14:47
* 版 本: V1.0
* 作 者: qixin
* 版 权 所 有: 版权所有(C)2016-2026
* 公 司: 广州专利保姆有限公司
*/
@Target({ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface CurrentUser {
String value() default Constants.CURRENT_USER;
}
| UTF-8 | Java | 628 | java | CurrentUser.java | Java | [
{
"context": "/18 14:47\n * 版 本: V1.0\n * 作 者: qixin\n * 版 权 所 有: 版权所有(C)2016-2026\n * 公 司",
"end": 304,
"score": 0.9969128370285034,
"start": 299,
"tag": "USERNAME",
"value": "qixin"
}
]
| null | []
| package com.qixin.example.utils.bind.annotation;
import com.qixin.example.utils.Constants;
import java.lang.annotation.*;
/** 绑定当前登录的用户
* 文 件 名: CurrentUser
* 包 名: com.qixin.example.utils.bind.annotation
* 创 建 时 间: 2018/1/18 14:47
* 版 本: V1.0
* 作 者: qixin
* 版 权 所 有: 版权所有(C)2016-2026
* 公 司: 广州专利保姆有限公司
*/
@Target({ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface CurrentUser {
String value() default Constants.CURRENT_USER;
}
| 628 | 0.643123 | 0.604089 | 22 | 23.454546 | 17.330286 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.181818 | false | false | 10 |
d49a77bddfd44f8c0497aba4e5b5962a0b756ea7 | 14,147,622,329,469 | 22b916fae274ff898c279dd19c3ee5ef69033a2a | /app/src/main/java/com/joymaker/kivytutorials/DetailKivyDesignLanguageAcitvity.java | 7ae233c2dc47e50a7bc05020c07894559c10082d | []
| no_license | Igor20099/kvpythontut | https://github.com/Igor20099/kvpythontut | b1d93b7ed282a7580bd282855f1e77fd68dc5ae2 | 5c67ddb563426d3f77271bd7e6288f18d6fbdaaa | refs/heads/master | 2020-12-08T03:38:53.061000 | 2020-07-27T18:00:11 | 2020-07-27T18:00:11 | 232,873,701 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.joymaker.kivytutorials;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import android.webkit.WebSettings;
import android.webkit.WebView;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
public class DetailKivyDesignLanguageAcitvity extends AppCompatActivity {
private WebView detailKvWebView;
private AdView mAdView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail_kivy_design_language_acitvity);
detailKvWebView = findViewById(R.id.detailKvWebView);
mAdView = findViewById(R.id.adView8);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
ActionBar actionBar = getSupportActionBar();
actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
WebSettings settings = detailKvWebView.getSettings();
settings.setDefaultTextEncodingName("utf-8");
Intent intent = getIntent();
int index = intent.getIntExtra("kv",-1);
switch (index) {
case 0:
detailKvWebView.loadUrl("file:///android_asset/kivydesign/introkvdesign.html");
setTitle("Введение");
break;
case 1:
detailKvWebView.loadUrl("file:///android_asset/kivydesign/firstappkv.html");
setTitle("Первое приложение с Kv Design Language");
break;
case 2:
detailKvWebView.loadUrl("file:///android_asset/kivydesign/classbuilder.html");
setTitle("Класс Builder");
break;
case 3:
detailKvWebView.loadUrl("file:///android_asset/kivydesign/id.html");
setTitle("Атрибут id");
break;
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
Intent intent = new Intent(DetailKivyDesignLanguageAcitvity.this,KivyDesignLanguageActivity.class);
startActivity(intent);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
}
| UTF-8 | Java | 2,500 | java | DetailKivyDesignLanguageAcitvity.java | Java | []
| null | []
| package com.joymaker.kivytutorials;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import android.webkit.WebSettings;
import android.webkit.WebView;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
public class DetailKivyDesignLanguageAcitvity extends AppCompatActivity {
private WebView detailKvWebView;
private AdView mAdView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail_kivy_design_language_acitvity);
detailKvWebView = findViewById(R.id.detailKvWebView);
mAdView = findViewById(R.id.adView8);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
ActionBar actionBar = getSupportActionBar();
actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
WebSettings settings = detailKvWebView.getSettings();
settings.setDefaultTextEncodingName("utf-8");
Intent intent = getIntent();
int index = intent.getIntExtra("kv",-1);
switch (index) {
case 0:
detailKvWebView.loadUrl("file:///android_asset/kivydesign/introkvdesign.html");
setTitle("Введение");
break;
case 1:
detailKvWebView.loadUrl("file:///android_asset/kivydesign/firstappkv.html");
setTitle("Первое приложение с Kv Design Language");
break;
case 2:
detailKvWebView.loadUrl("file:///android_asset/kivydesign/classbuilder.html");
setTitle("Класс Builder");
break;
case 3:
detailKvWebView.loadUrl("file:///android_asset/kivydesign/id.html");
setTitle("Атрибут id");
break;
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
Intent intent = new Intent(DetailKivyDesignLanguageAcitvity.this,KivyDesignLanguageActivity.class);
startActivity(intent);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
}
| 2,500 | 0.644742 | 0.6419 | 68 | 35.220589 | 26.382841 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.632353 | false | false | 10 |
7f321e0050610d8ed37d17d4a5cc48eccc97fe19 | 33,543,694,632,258 | 084a9ee46b96fb31057ac353ddc223e0d227335a | /app/src/main/java/id/co/okhome/okhomeapp/view/activity/cleaning/MakeCleaningReservationActivity.java | cf45850ea96366df9cdfbbc38f1e82b9c1a89ed2 | []
| no_license | josongmin/OkhomeAndroid | https://github.com/josongmin/OkhomeAndroid | f0977063de11eeb96ce0ef02f325d086e2aced03 | 4f73a5d974e7aff178d3043fa00756fd81710580 | refs/heads/master | 2018-03-26T03:41:43.795000 | 2017-11-23T23:47:49 | 2017-11-23T23:47:49 | 87,050,354 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package id.co.okhome.okhomeapp.view.activity.cleaning;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import org.joda.time.format.DateTimeFormat;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import id.co.okhome.okhomeapp.R;
import id.co.okhome.okhomeapp.config.CurrentUserInfo;
import id.co.okhome.okhomeapp.config.Variables;
import id.co.okhome.okhomeapp.lib.CommonWorkDoneListener;
import id.co.okhome.okhomeapp.lib.JoSharedPreference;
import id.co.okhome.okhomeapp.lib.OkHomeActivityParent;
import id.co.okhome.okhomeapp.lib.OkhomeAnalyticsManager;
import id.co.okhome.okhomeapp.lib.ProgressDialogController;
import id.co.okhome.okhomeapp.lib.TutoriorPreference;
import id.co.okhome.okhomeapp.lib.Util;
import id.co.okhome.okhomeapp.lib.dialog.DialogController;
import id.co.okhome.okhomeapp.lib.dialog.ViewDialog;
import id.co.okhome.okhomeapp.lib.okhomeactivity.BackButtonHandlerInterface;
import id.co.okhome.okhomeapp.lib.okhomeactivity.OnBackClickListener;
import id.co.okhome.okhomeapp.lib.retrofit.RetrofitCallback;
import id.co.okhome.okhomeapp.lib.retrofit.restmodel.ErrorModel;
import id.co.okhome.okhomeapp.model.CreditPromotionModel;
import id.co.okhome.okhomeapp.restclient.RestClient;
import id.co.okhome.okhomeapp.view.activity.chat.ChatClientActivity;
import id.co.okhome.okhomeapp.view.activity.payment.PaymentActivity;
import id.co.okhome.okhomeapp.view.customview.OkHomeViewPager;
import id.co.okhome.okhomeapp.view.customview.ProgressDotsView;
import id.co.okhome.okhomeapp.view.fragment.makereservation.RequestorInfoFragment;
import id.co.okhome.okhomeapp.view.fragment.makereservation.flow.MakeCleaningReservationFlow;
import id.co.okhome.okhomeapp.view.fragment.makereservation.flow.MakeCleaningReservationParam;
import id.co.okhome.okhomeapp.view.fragment.makereservation.oneday_new.ChooseDayFragment;
import id.co.okhome.okhomeapp.view.fragment.makereservation.oneday_new.DaySpecialCleaningChkFragment;
import id.co.okhome.okhomeapp.view.fragment.makereservation.pediodic_new.PeriodicSpecialCleaningChkFragment;
import id.co.okhome.okhomeapp.view.fragment.makereservation.pediodic_new.SettingCleaningPeriodFragment;
import id.co.okhome.okhomeapp.view.fullpopup.FullpopupBasicCleaningHint;
import id.co.okhome.okhomeapp.view.fullpopup.FullpopupMoveinCleaningHint;
import id.co.okhome.okhomeapp.view.fullpopup.FullpopupPeriodCleaningHint;
public class MakeCleaningReservationActivity extends OkHomeActivityParent implements BackButtonHandlerInterface {
public ArrayList<WeakReference<OnBackClickListener>> backClickListenersList = new ArrayList<>();
@BindView(R.id.actMakeOneDayReservation_vpContents) OkHomeViewPager vpContents;
@BindView(R.id.actMakeOneDayReservation_tvCount) TextView tvCount;
@BindView(R.id.actMakeOneDayReservation_pdv) ProgressDotsView pdv;
@BindView(R.id.actMakeOneDayReservation_tvTitle) TextView tvTitle;
@BindView(R.id.actMakeOneDayReservation_tvLeft) TextView tvLeft;
@BindView(R.id.actMakeOneDayReservation_tvRight) TextView tvRight;
@BindView(R.id.actMakeOneDayReservation_rlContents) ViewGroup vgMain;
@BindView(R.id.actMakeOneDayReservation_vbtnRight) View vbtnRight;
@BindView(R.id.actMakeReservation_vMessageDot) View vMessageDot;
public static MakeCleaningReservationActivity Instance;
private static final int REQ_COLLISION = 100;
Reservation1DayCleaningAdapter pagerAdapter;
MakeCleaningReservationParam makeReservationParam = new MakeCleaningReservationParam();
String defaultDate = null;
boolean hasOrder = false;
String orderNo = "";
String type = "";
@Override
protected void onCreate(Bundle savedInstanceState) {
Instance = this;
super.onCreate(savedInstanceState);
orderNo = MakeCleaningReservationParam.makeOrderNo();
setContentView(R.layout.activity_make_oneday_reservation);
defaultDate = getIntent().getStringExtra("DATE"); //yyyymmdd
ButterKnife.bind(this);
type = getIntent().getStringExtra("TYPE");
sendAnalysisData();
makeReservationParam.cleaningType = type;
//프로모션 체크
chkPromotion(new CommonWorkDoneListener() {
@Override
public void onWorkDone(Object obj) {
init();
}
});
}
//프루모션 체크
private void chkPromotion(final CommonWorkDoneListener workDoneListener){
final String promotionKey = type.equals("NORMAL") ? "DISC_1ST_G_SERV" : type.equals("PERIODIC") ? "DISC_PERIODIC_SERV" : "";
if(promotionKey.equals("")){
workDoneListener.onWorkDone(null);
return;
}
final int pId = ProgressDialogController.show(this);
RestClient.getCreditPromotionClient().getPromotionByType(promotionKey, CurrentUserInfo.getId(this)).enqueue(new RetrofitCallback<CreditPromotionModel>() {
@Override
public void onSuccess(CreditPromotionModel result) {
//날짜비교
if(result.isJoin.equals("N") && Util.getCurrentJarartaTimeMills() < DateTimeFormat.forPattern("yyyy-MM-dd").parseDateTime(result.expiryDate).getMillis()){
//프로모션 적용
makeReservationParam.currentPromotion = promotionKey;
}else{
//프로모션 미적용
}
workDoneListener.onWorkDone(null);
}
@Override
public void onJodevError(ErrorModel jodevErrorModel) {
super.onJodevError(jodevErrorModel);
workDoneListener.onWorkDone(null);
}
@Override
public void onFinish() {
super.onFinish();
ProgressDialogController.dismiss(pId);
}
});
}
public void chkHasNewMessage(){
//
String chatChk = JoSharedPreference.with().get(Variables.PREF_CHAT_CHK);
if(chatChk != null && !chatChk.equals("CHECKED")){
vMessageDot.setVisibility(View.VISIBLE);
}else{
vMessageDot.setVisibility(View.GONE);
}
}
@Override
protected void onDestroy() {
Instance = null;
super.onDestroy();
}
@Override
protected void onResume() {
super.onResume();
chkHasNewMessage();
}
@Override
public void onSaveInstanceState(Bundle outState) {
;
}
private void sendAnalysisData(){
if(type == null || type.equals("NORMAL")){
OkhomeAnalyticsManager.setScreen(this, "begin_cleaning_reservation_basic");
}else if(type.equals("MOVEIN")){
OkhomeAnalyticsManager.setScreen(this, "begin_cleaning_reservation_movein");
}else{
OkhomeAnalyticsManager.setScreen(this, "begin_cleaning_reservation_periodic");
}
}
//초기화
private void init(){
pagerAdapter = new Reservation1DayCleaningAdapter(getSupportFragmentManager(), makeTabItems(type));
pdv.setMaxCount(pagerAdapter.getCount());
vpContents.setPagingEnabled(false);
vpContents.addOnPageChangeListener(pagerAdapter);
vpContents.setOffscreenPageLimit(pagerAdapter.getCount());
vpContents.setAdapter(pagerAdapter);
vpContents.setCurrentItem(0);
new Handler(){
@Override
public void dispatchMessage(Message msg) {
super.dispatchMessage(msg);
pagerAdapter.onPageSelected(0);
}
}.sendEmptyMessageDelayed(0, 100);
}
//탭아이템 설정
private List<ModelPageItem> makeTabItems(String type){
List<ModelPageItem> list = new ArrayList<>();
Util.Log(MakeCleaningReservationActivity.class + " " + "type :: " + type);
if(type == null || type.equals("NORMAL")){
ChooseDayFragment chooseDayFragment = new ChooseDayFragment();
Bundle bundle = new Bundle();
bundle.putString("type", "NORMAL");
bundle.putString("defaultDate", defaultDate);
chooseDayFragment.setArguments(bundle);
RequestorInfoFragment requestorInfoFragment = new RequestorInfoFragment();
bundle = new Bundle();
bundle.putString("type", "NORMAL");
requestorInfoFragment.setArguments(bundle);
DaySpecialCleaningChkFragment daySpecialCleaningChkFragment = new DaySpecialCleaningChkFragment();
bundle = new Bundle();
bundle.putString("type", "NORMAL");
daySpecialCleaningChkFragment.setArguments(bundle);
list.add(new ModelPageItem(chooseDayFragment, getString(R.string.actMakeReservation_titleChooseDate)));
list.add(new ModelPageItem(requestorInfoFragment, getString(R.string.actMakeReservation_titleInputExtraInfo)));
list.add(new ModelPageItem(daySpecialCleaningChkFragment, getString(R.string.actMakeReservation_titleChooseSpc)));
chkBasicCleaningToolTip();
}else if(type.equals("MOVEIN")){
ChooseDayFragment chooseDayFragment = new ChooseDayFragment();
Bundle bundle = new Bundle();
bundle.putString("type", "MOVEIN");
bundle.putString("defaultDate", defaultDate);
chooseDayFragment.setArguments(bundle);
RequestorInfoFragment requestorInfoFragment = new RequestorInfoFragment();
bundle = new Bundle();
bundle.putString("type", "MOVEIN");
requestorInfoFragment.setArguments(bundle);
DaySpecialCleaningChkFragment daySpecialCleaningChkFragment = new DaySpecialCleaningChkFragment();
bundle = new Bundle();
bundle.putString("type", "MOVEIN");
daySpecialCleaningChkFragment.setArguments(bundle);
list.add(new ModelPageItem(chooseDayFragment, getString(R.string.actMakeReservation_titleChooseDate)));
list.add(new ModelPageItem(requestorInfoFragment, getString(R.string.actMakeReservation_titleInputExtraInfo)));
list.add(new ModelPageItem(daySpecialCleaningChkFragment, getString(R.string.actMakeReservation_titleChooseSpc)));
chkMoveinCleaningToolTip();
}
else{
//추기청소
list.add(new ModelPageItem(new SettingCleaningPeriodFragment(), getString(R.string.actMakeReservation_titleChoosePeriodType)));
list.add(new ModelPageItem(new id.co.okhome.okhomeapp.view.fragment.makereservation.pediodic_new.ChooseStartDayFragment(), getString(R.string.actMakeReservation_chooseDateOfPeriodicCleaning)));
RequestorInfoFragment requestorInfoFragment = new RequestorInfoFragment();
Bundle bundle = new Bundle();
bundle.putString("type", "NORMAL");
requestorInfoFragment.setArguments(bundle);
list.add(new ModelPageItem(requestorInfoFragment, getString(R.string.actMakeReservation_titleInputExtraInfo)));
list.add(new ModelPageItem(new id.co.okhome.okhomeapp.view.fragment.makereservation.pediodic_new.PeriodicCleaningPackageFragment(), getString(R.string.actMakeReservation_choosePeriodicCleaningType)));
PeriodicSpecialCleaningChkFragment periodicSpecialCleaningChkFragment = new PeriodicSpecialCleaningChkFragment();
bundle = new Bundle();
bundle.putString("type", "NORMAL");
periodicSpecialCleaningChkFragment.setArguments(bundle);
list.add(new ModelPageItem(periodicSpecialCleaningChkFragment, getString(R.string.actMakeReservation_titleChooseSpc)));
chkPeriodCleaningToolTip();
}
return list;
}
//장기권 애니ㅔㅁ이션 여부
private void chkPeriodCleaningToolTip(){
if(TutoriorPreference.isFirst(TutoriorPreference.TUTORIORKEY_PERIODCLEANING)){
//시작
new Handler(){
@Override
public void dispatchMessage(Message msg) {
//시작하는 동안 백클릭안되게
//시작
final FullpopupPeriodCleaningHint fullpopupPeriodCleaningHint = new FullpopupPeriodCleaningHint(MakeCleaningReservationActivity.this);
new Handler(){
@Override
public void dispatchMessage(Message msg) {
fullpopupPeriodCleaningHint.show();
}
}.sendEmptyMessageDelayed(0, 1000);
}
}.sendEmptyMessageDelayed(0, 500);
//애니메이션 봣다고 ㅍ시
TutoriorPreference.chkRead(TutoriorPreference.TUTORIORKEY_PERIODCLEANING);
}
}
//이사청소 애니ㅔㅁ이션 여부
private void chkMoveinCleaningToolTip(){
if(TutoriorPreference.isFirst(TutoriorPreference.TUTORIORKEY_MOVEINCLEANING)){
//시작
new Handler(){
@Override
public void dispatchMessage(Message msg) {
//시작하는 동안 백클릭안되게
//시작
final FullpopupMoveinCleaningHint fullpopupBasicCleaningHint = new FullpopupMoveinCleaningHint(MakeCleaningReservationActivity.this);
new Handler(){
@Override
public void dispatchMessage(Message msg) {
fullpopupBasicCleaningHint.show();
}
}.sendEmptyMessageDelayed(0, 1000);
}
}.sendEmptyMessageDelayed(0, 500);
//애니메이션 봣다고 ㅍ시
TutoriorPreference.chkRead(TutoriorPreference.TUTORIORKEY_MOVEINCLEANING);
}
}
//애니메이션 처리 여부
private void chkBasicCleaningToolTip(){
if(TutoriorPreference.isFirst(TutoriorPreference.TUTORIORKEY_BASICCLEANING)){
//시작
new Handler(){
@Override
public void dispatchMessage(Message msg) {
//시작하는 동안 백클릭안되게
//시작
final FullpopupBasicCleaningHint fullpopupBasicCleaningHint = new FullpopupBasicCleaningHint(MakeCleaningReservationActivity.this);
new Handler(){
@Override
public void dispatchMessage(Message msg) {
fullpopupBasicCleaningHint.show();
}
}.sendEmptyMessageDelayed(0, 1000);
}
}.sendEmptyMessageDelayed(0, 500);
//애니메이션 봣다고 ㅍ시
TutoriorPreference.chkRead(TutoriorPreference.TUTORIORKEY_BASICCLEANING);
}
}
//
// private void beforeSubmit(){
// //중복된 청소 있는지 체크
// final String userId = CurrentUserInfo.getId(this);
// final String homeId = CurrentUserInfo.getHomeId(this);
// final String periodType = makeReservationParam.periodType;
// final String periodValue = makeReservationParam.periodValue;
// final String cleaningCount = makeReservationParam.cleaningCount + "";
// final String beginDate = makeReservationParam.periodStartDate;
//
// final int pInt = ProgressDialogController.show(this);
// RestClient.getCleaningRequestClient().requestPeriodCleaningCheck(orderNo, userId, homeId, periodType, periodValue, cleaningCount, beginDate).enqueue(new RetrofitCallback<List<CleaningReservationModel>>() {
// @Override
// public void onSuccess(List<CleaningReservationModel> result) {
//
// if(result.size() <= 0){
// submit(); //바로제출
// }else{
// //결과가있음.
// //대기열에 넣어두자
// JoSharedPreference.with().push("READY_CLEANING_QUEUE", result);
// startActivityForResult(new Intent(MakeCleaningReservationActivity.this, CollisionCleaningManagerActivity.class), REQ_COLLISION);
//
// }
// }
//
// @Override
// public void onFinish() {
// super.onFinish();
// ProgressDialogController.dismiss(pInt);
// }
// });
// }
private void submitForOnedays(){
final String userId = CurrentUserInfo.getId(this);
final String homeId = CurrentUserInfo.getHomeId(this);
final String spcCleaningIdsSets = makeReservationParam.spcCleaningIdsSets;
final String cleaningDateTimes = makeReservationParam.cleaningDateTimes;
final String cleaningNumbers = makeReservationParam.cleaningNumbersForSpc;
final int cleaningCount = makeReservationParam.mapCleaningDateTime.size();
final String comment = makeReservationParam.comment;
final int totalBasicCleaningPrice = makeReservationParam.totalPrice;
final String spcCleaningCountsSets = makeReservationParam.spcCleaningCountsSets;
final String promotionType = makeReservationParam.currentPromotion;
final int pId = ProgressDialogController.show(this);
RestClient.getCleaningRequestClient().requestCleanings(
type
, orderNo
, userId, homeId, cleaningCount+""
, totalBasicCleaningPrice, cleaningDateTimes
, cleaningNumbers
, spcCleaningIdsSets
, spcCleaningCountsSets
, comment, promotionType)
.enqueue(new RetrofitCallback<String>() {
@Override
public void onFinish() {
super.onFinish();
ProgressDialogController.dismiss(pId);
}
@Override
public void onSuccess(String result) {
hasOrder = true;
startActivity(new Intent(MakeCleaningReservationActivity.this, PaymentActivity.class)
.putExtra("orderNo", orderNo)
.putExtra("orderName", makeReservationParam.orderName)
.putExtra("totalPrice", makeReservationParam.totalPrice));
}
});
}
//주기청소 제출
private void submitForPeriodic(){
final String userId = CurrentUserInfo.getId(this);
final String homeId = CurrentUserInfo.getHomeId(this);
final String periodType = makeReservationParam.periodType;
final String periodValue = makeReservationParam.periodValue;
final String cleaningCount = makeReservationParam.cleaningCount + "";
final String beginDate = makeReservationParam.periodStartDate;
final String cleaningNumbersForSpc = makeReservationParam.cleaningNumbersForSpc;
final String spcCleaningIdsSets = makeReservationParam.spcCleaningIdsSets;
final String spcCleaningCountsSets = makeReservationParam.spcCleaningCountsSets;
final String comment = makeReservationParam.comment;
final String promotionType = makeReservationParam.currentPromotion;
int totalBasicCleaningPrice = makeReservationParam.totalBasicCleaningPrice;
if(!hasOrder){
final int pId = ProgressDialogController.show(this);
orderNo = MakeCleaningReservationParam.makeOrderNo();
RestClient.getCleaningRequestClient().requestPeriodCleaning(
orderNo, userId, homeId, periodType, periodValue, cleaningCount, beginDate
, totalBasicCleaningPrice
, cleaningNumbersForSpc, spcCleaningIdsSets, spcCleaningCountsSets, comment, promotionType)
.enqueue(new RetrofitCallback<String>() {
@Override
public void onFinish() {
super.onFinish();
ProgressDialogController.dismiss(pId);
}
@Override
public void onSuccess(String result) {
hasOrder =true;
// paramOrderNo = getIntent().getStringExtra("orderNo");
// paramOrderName = getIntent().getStringExtra("orderName");
// paramTotalPrice = getIntent().getIntExtra("totalPrice", 0);
startActivityForResult(new Intent(MakeCleaningReservationActivity.this, PaymentActivity.class)
.putExtra("orderNo", orderNo)
.putExtra("orderName", makeReservationParam.orderName)
.putExtra("totalPrice", makeReservationParam.totalPrice), 1);
}
});
}else{
startActivityForResult(new Intent(MakeCleaningReservationActivity.this, PaymentActivity.class)
.putExtra("orderNo", orderNo)
.putExtra("orderName", makeReservationParam.orderName)
.putExtra("totalPrice", makeReservationParam.totalPrice), 1);
}
}
private void submit(){
//결제 진행함..
DialogController.makeAlertDialog(this)
.setOkText(getString(R.string.actMakeReservation_proceedPayment))
.setCancelText(getString(R.string.actMakeReservation_cancel))
.setTitle("OKHOME")
.setContent(getString(R.string.actMakeReservation_reqBeforePayment))
.setCallback(new ViewDialog.DialogCommonCallback() {
@Override
public void onCallback(Object dialog, Map<String, Object> params) {
String click = (String)params.get(DialogController.TAG_CLICK);
if(click.equals(DialogController.CLICK_OK)){
String type = getIntent().getStringExtra("TYPE");
if(type.equals("NORMAL")){
submitForOnedays();
}else if(type.equals("MOVEIN")){
submitForOnedays();
}else{
submitForPeriodic();
}
}
}
}).matchViews();
}
@OnClick(R.id.actMakeOneDayReservation_vbtnRight)
public void onBtnRightClick(View v){
Fragment fCurrent = pagerAdapter.getCurrentFragment(vpContents.getCurrentItem());
MakeCleaningReservationFlow flow = (MakeCleaningReservationFlow)fCurrent;
//다음
if(flow.next(makeReservationParam)){
int nextPos = vpContents.getCurrentItem() + 1;
if(nextPos >= pagerAdapter.getCount()){
submit();
// beforeSubmit();
}else{
vpContents.setCurrentItem(nextPos);
}
}else{
;
}
//현재 프래그먼트 갖고와서 상태보자
}
private void showDismissDialog(){
DialogController.showAlertDialog(MakeCleaningReservationActivity.this, "OKHOME", getString(R.string.actMakeReservation_askQuitReservation), false, new ViewDialog.DialogCommonCallback() {
@Override
public void onCallback(Object dialog, Map<String, Object> params) {
String click = (String)params.get(DialogController.TAG_CLICK);
if(click.equals("OK")){
finish();
}else{
;
}
}
});
}
public View getVbtnRight() {
return vbtnRight;
}
@OnClick(R.id.actMakeOneDayReservation_vbtnLeft)
public void onLeftClick(View v){
left();
}
public void left(){
int prevPos = vpContents.getCurrentItem() - 1;
if(prevPos < 0){
showDismissDialog();
}else{
vpContents.setCurrentItem(prevPos);
}
}
@OnClick(R.id.actMakeOneDayReservation_vbtnAlarm)
public void onMessageClick(View v){
startActivity(new Intent(this, ChatClientActivity.class));
}
@OnClick(R.id.actMain_llbtnX)
public void onClickBtnX(View v){
// DialogController.showCenterDialog(this,
// new CommonTextDialog("Really cancel reservation?", "All things being written is not saved", new ViewDialog.DialogCommonCallback() {
// @Override
// public void onCallback(Object dialog, Map<String, Object> params) {
// String onClick = (String)params.get("ONCLICK");
// if(onClick.equals("OK")){
// finish();
// }
// }
// }));
showDismissDialog();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
}
@Override
public void addBackClickListener(OnBackClickListener onBackClickListener) {
backClickListenersList.add(new WeakReference<>(onBackClickListener));
}
@Override
public void removeBackClickListener(OnBackClickListener onBackClickListener) {
for (Iterator<WeakReference<OnBackClickListener>> iterator = backClickListenersList.iterator();
iterator.hasNext();){
WeakReference<OnBackClickListener> weakRef = iterator.next();
if (weakRef.get() == onBackClickListener){
iterator.remove();
}
}
}
@Override
public void onBackPressed() {
if(!fragmentsBackKeyIntercept()){
onLeftClick(null);
}
}
private boolean fragmentsBackKeyIntercept() {
boolean isIntercept = false;
for (WeakReference<OnBackClickListener> weakRef : backClickListenersList) {
OnBackClickListener onBackClickListener = weakRef.get();
if (onBackClickListener != null) {
boolean isFragmIntercept = onBackClickListener.onBackClick();
if (!isIntercept) isIntercept = isFragmIntercept;
}
}
return isIntercept;
}
//
//프래그먼트 어댑터
class Reservation1DayCleaningAdapter extends FragmentStatePagerAdapter implements ViewPager.OnPageChangeListener{
final Map<Integer, Fragment> mapFragment = new HashMap<Integer, Fragment>();
List<ModelPageItem> listItem = new ArrayList<>();
public Reservation1DayCleaningAdapter(FragmentManager fm, List<ModelPageItem> list) {
super(fm);
this.listItem = list;
}
@Override
public Fragment getItem(int position) {
Fragment f = listItem.get(position).fragment;
mapFragment.put(position, f);
return f;
}
@Override
public int getCount() {
return listItem.size();
}
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
tvCount.setText("(" + (position+1) + "/" + this.getCount() + ")");
pdv.setCurrentPos(position);
//텍스트 변경
tvTitle.setText(listItem.get(position).title);
//버튼텍스트
if(position == 0){
tvLeft.setText(getString(R.string.actMakeReservation_naviCancel));
}else{
tvLeft.setText(getString(R.string.actMakeReservation_naviPrev));
}
if(position+1 == getCount()){
tvRight.setText(getString(R.string.actMakeReservation_naviPayment));
}else{
tvRight.setText(getString(R.string.actMakeReservation_naviNext));
}
if(getCurrentFragment(position) != null){
Util.Log("onPageSelected position : " + position);
MakeCleaningReservationFlow flow = (MakeCleaningReservationFlow)getCurrentFragment(position);
flow.onCurrentPage(position, makeReservationParam);
}
}
public Fragment getCurrentFragment(int pos){
Fragment f = mapFragment.get(pos);
return f;
}
@Override
public void onPageScrollStateChanged(int state) {
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
super.destroyItem(container, position, object);
mapFragment.remove(position);
}
}
class ModelPageItem{
public ModelPageItem(Fragment fragment, String title) {
this.fragment = fragment;
this.title = title;
}
Fragment fragment;
String title;
}
}
| UTF-8 | Java | 29,714 | java | MakeCleaningReservationActivity.java | Java | [
{
"context": "al String promotionKey = type.equals(\"NORMAL\") ? \"DISC_1ST_G_SERV\" : type.equals(\"PERIODIC\") ? \"DISC_PERIODIC_SERV\"",
"end": 5037,
"score": 0.993998646736145,
"start": 5022,
"tag": "KEY",
"value": "DISC_1ST_G_SERV"
},
{
"context": " ? \"DISC_1ST_G_SERV\" : type.equals(\"PERIODIC\") ? \"DISC_PERIODIC_SERV\" : \"\";\n if(promotionKey.equals(\"\")){\n ",
"end": 5086,
"score": 0.8161454796791077,
"start": 5068,
"tag": "KEY",
"value": "DISC_PERIODIC_SERV"
}
]
| null | []
| package id.co.okhome.okhomeapp.view.activity.cleaning;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import org.joda.time.format.DateTimeFormat;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import id.co.okhome.okhomeapp.R;
import id.co.okhome.okhomeapp.config.CurrentUserInfo;
import id.co.okhome.okhomeapp.config.Variables;
import id.co.okhome.okhomeapp.lib.CommonWorkDoneListener;
import id.co.okhome.okhomeapp.lib.JoSharedPreference;
import id.co.okhome.okhomeapp.lib.OkHomeActivityParent;
import id.co.okhome.okhomeapp.lib.OkhomeAnalyticsManager;
import id.co.okhome.okhomeapp.lib.ProgressDialogController;
import id.co.okhome.okhomeapp.lib.TutoriorPreference;
import id.co.okhome.okhomeapp.lib.Util;
import id.co.okhome.okhomeapp.lib.dialog.DialogController;
import id.co.okhome.okhomeapp.lib.dialog.ViewDialog;
import id.co.okhome.okhomeapp.lib.okhomeactivity.BackButtonHandlerInterface;
import id.co.okhome.okhomeapp.lib.okhomeactivity.OnBackClickListener;
import id.co.okhome.okhomeapp.lib.retrofit.RetrofitCallback;
import id.co.okhome.okhomeapp.lib.retrofit.restmodel.ErrorModel;
import id.co.okhome.okhomeapp.model.CreditPromotionModel;
import id.co.okhome.okhomeapp.restclient.RestClient;
import id.co.okhome.okhomeapp.view.activity.chat.ChatClientActivity;
import id.co.okhome.okhomeapp.view.activity.payment.PaymentActivity;
import id.co.okhome.okhomeapp.view.customview.OkHomeViewPager;
import id.co.okhome.okhomeapp.view.customview.ProgressDotsView;
import id.co.okhome.okhomeapp.view.fragment.makereservation.RequestorInfoFragment;
import id.co.okhome.okhomeapp.view.fragment.makereservation.flow.MakeCleaningReservationFlow;
import id.co.okhome.okhomeapp.view.fragment.makereservation.flow.MakeCleaningReservationParam;
import id.co.okhome.okhomeapp.view.fragment.makereservation.oneday_new.ChooseDayFragment;
import id.co.okhome.okhomeapp.view.fragment.makereservation.oneday_new.DaySpecialCleaningChkFragment;
import id.co.okhome.okhomeapp.view.fragment.makereservation.pediodic_new.PeriodicSpecialCleaningChkFragment;
import id.co.okhome.okhomeapp.view.fragment.makereservation.pediodic_new.SettingCleaningPeriodFragment;
import id.co.okhome.okhomeapp.view.fullpopup.FullpopupBasicCleaningHint;
import id.co.okhome.okhomeapp.view.fullpopup.FullpopupMoveinCleaningHint;
import id.co.okhome.okhomeapp.view.fullpopup.FullpopupPeriodCleaningHint;
public class MakeCleaningReservationActivity extends OkHomeActivityParent implements BackButtonHandlerInterface {
public ArrayList<WeakReference<OnBackClickListener>> backClickListenersList = new ArrayList<>();
@BindView(R.id.actMakeOneDayReservation_vpContents) OkHomeViewPager vpContents;
@BindView(R.id.actMakeOneDayReservation_tvCount) TextView tvCount;
@BindView(R.id.actMakeOneDayReservation_pdv) ProgressDotsView pdv;
@BindView(R.id.actMakeOneDayReservation_tvTitle) TextView tvTitle;
@BindView(R.id.actMakeOneDayReservation_tvLeft) TextView tvLeft;
@BindView(R.id.actMakeOneDayReservation_tvRight) TextView tvRight;
@BindView(R.id.actMakeOneDayReservation_rlContents) ViewGroup vgMain;
@BindView(R.id.actMakeOneDayReservation_vbtnRight) View vbtnRight;
@BindView(R.id.actMakeReservation_vMessageDot) View vMessageDot;
public static MakeCleaningReservationActivity Instance;
private static final int REQ_COLLISION = 100;
Reservation1DayCleaningAdapter pagerAdapter;
MakeCleaningReservationParam makeReservationParam = new MakeCleaningReservationParam();
String defaultDate = null;
boolean hasOrder = false;
String orderNo = "";
String type = "";
@Override
protected void onCreate(Bundle savedInstanceState) {
Instance = this;
super.onCreate(savedInstanceState);
orderNo = MakeCleaningReservationParam.makeOrderNo();
setContentView(R.layout.activity_make_oneday_reservation);
defaultDate = getIntent().getStringExtra("DATE"); //yyyymmdd
ButterKnife.bind(this);
type = getIntent().getStringExtra("TYPE");
sendAnalysisData();
makeReservationParam.cleaningType = type;
//프로모션 체크
chkPromotion(new CommonWorkDoneListener() {
@Override
public void onWorkDone(Object obj) {
init();
}
});
}
//프루모션 체크
private void chkPromotion(final CommonWorkDoneListener workDoneListener){
final String promotionKey = type.equals("NORMAL") ? "DISC_1ST_G_SERV" : type.equals("PERIODIC") ? "DISC_PERIODIC_SERV" : "";
if(promotionKey.equals("")){
workDoneListener.onWorkDone(null);
return;
}
final int pId = ProgressDialogController.show(this);
RestClient.getCreditPromotionClient().getPromotionByType(promotionKey, CurrentUserInfo.getId(this)).enqueue(new RetrofitCallback<CreditPromotionModel>() {
@Override
public void onSuccess(CreditPromotionModel result) {
//날짜비교
if(result.isJoin.equals("N") && Util.getCurrentJarartaTimeMills() < DateTimeFormat.forPattern("yyyy-MM-dd").parseDateTime(result.expiryDate).getMillis()){
//프로모션 적용
makeReservationParam.currentPromotion = promotionKey;
}else{
//프로모션 미적용
}
workDoneListener.onWorkDone(null);
}
@Override
public void onJodevError(ErrorModel jodevErrorModel) {
super.onJodevError(jodevErrorModel);
workDoneListener.onWorkDone(null);
}
@Override
public void onFinish() {
super.onFinish();
ProgressDialogController.dismiss(pId);
}
});
}
public void chkHasNewMessage(){
//
String chatChk = JoSharedPreference.with().get(Variables.PREF_CHAT_CHK);
if(chatChk != null && !chatChk.equals("CHECKED")){
vMessageDot.setVisibility(View.VISIBLE);
}else{
vMessageDot.setVisibility(View.GONE);
}
}
@Override
protected void onDestroy() {
Instance = null;
super.onDestroy();
}
@Override
protected void onResume() {
super.onResume();
chkHasNewMessage();
}
@Override
public void onSaveInstanceState(Bundle outState) {
;
}
private void sendAnalysisData(){
if(type == null || type.equals("NORMAL")){
OkhomeAnalyticsManager.setScreen(this, "begin_cleaning_reservation_basic");
}else if(type.equals("MOVEIN")){
OkhomeAnalyticsManager.setScreen(this, "begin_cleaning_reservation_movein");
}else{
OkhomeAnalyticsManager.setScreen(this, "begin_cleaning_reservation_periodic");
}
}
//초기화
private void init(){
pagerAdapter = new Reservation1DayCleaningAdapter(getSupportFragmentManager(), makeTabItems(type));
pdv.setMaxCount(pagerAdapter.getCount());
vpContents.setPagingEnabled(false);
vpContents.addOnPageChangeListener(pagerAdapter);
vpContents.setOffscreenPageLimit(pagerAdapter.getCount());
vpContents.setAdapter(pagerAdapter);
vpContents.setCurrentItem(0);
new Handler(){
@Override
public void dispatchMessage(Message msg) {
super.dispatchMessage(msg);
pagerAdapter.onPageSelected(0);
}
}.sendEmptyMessageDelayed(0, 100);
}
//탭아이템 설정
private List<ModelPageItem> makeTabItems(String type){
List<ModelPageItem> list = new ArrayList<>();
Util.Log(MakeCleaningReservationActivity.class + " " + "type :: " + type);
if(type == null || type.equals("NORMAL")){
ChooseDayFragment chooseDayFragment = new ChooseDayFragment();
Bundle bundle = new Bundle();
bundle.putString("type", "NORMAL");
bundle.putString("defaultDate", defaultDate);
chooseDayFragment.setArguments(bundle);
RequestorInfoFragment requestorInfoFragment = new RequestorInfoFragment();
bundle = new Bundle();
bundle.putString("type", "NORMAL");
requestorInfoFragment.setArguments(bundle);
DaySpecialCleaningChkFragment daySpecialCleaningChkFragment = new DaySpecialCleaningChkFragment();
bundle = new Bundle();
bundle.putString("type", "NORMAL");
daySpecialCleaningChkFragment.setArguments(bundle);
list.add(new ModelPageItem(chooseDayFragment, getString(R.string.actMakeReservation_titleChooseDate)));
list.add(new ModelPageItem(requestorInfoFragment, getString(R.string.actMakeReservation_titleInputExtraInfo)));
list.add(new ModelPageItem(daySpecialCleaningChkFragment, getString(R.string.actMakeReservation_titleChooseSpc)));
chkBasicCleaningToolTip();
}else if(type.equals("MOVEIN")){
ChooseDayFragment chooseDayFragment = new ChooseDayFragment();
Bundle bundle = new Bundle();
bundle.putString("type", "MOVEIN");
bundle.putString("defaultDate", defaultDate);
chooseDayFragment.setArguments(bundle);
RequestorInfoFragment requestorInfoFragment = new RequestorInfoFragment();
bundle = new Bundle();
bundle.putString("type", "MOVEIN");
requestorInfoFragment.setArguments(bundle);
DaySpecialCleaningChkFragment daySpecialCleaningChkFragment = new DaySpecialCleaningChkFragment();
bundle = new Bundle();
bundle.putString("type", "MOVEIN");
daySpecialCleaningChkFragment.setArguments(bundle);
list.add(new ModelPageItem(chooseDayFragment, getString(R.string.actMakeReservation_titleChooseDate)));
list.add(new ModelPageItem(requestorInfoFragment, getString(R.string.actMakeReservation_titleInputExtraInfo)));
list.add(new ModelPageItem(daySpecialCleaningChkFragment, getString(R.string.actMakeReservation_titleChooseSpc)));
chkMoveinCleaningToolTip();
}
else{
//추기청소
list.add(new ModelPageItem(new SettingCleaningPeriodFragment(), getString(R.string.actMakeReservation_titleChoosePeriodType)));
list.add(new ModelPageItem(new id.co.okhome.okhomeapp.view.fragment.makereservation.pediodic_new.ChooseStartDayFragment(), getString(R.string.actMakeReservation_chooseDateOfPeriodicCleaning)));
RequestorInfoFragment requestorInfoFragment = new RequestorInfoFragment();
Bundle bundle = new Bundle();
bundle.putString("type", "NORMAL");
requestorInfoFragment.setArguments(bundle);
list.add(new ModelPageItem(requestorInfoFragment, getString(R.string.actMakeReservation_titleInputExtraInfo)));
list.add(new ModelPageItem(new id.co.okhome.okhomeapp.view.fragment.makereservation.pediodic_new.PeriodicCleaningPackageFragment(), getString(R.string.actMakeReservation_choosePeriodicCleaningType)));
PeriodicSpecialCleaningChkFragment periodicSpecialCleaningChkFragment = new PeriodicSpecialCleaningChkFragment();
bundle = new Bundle();
bundle.putString("type", "NORMAL");
periodicSpecialCleaningChkFragment.setArguments(bundle);
list.add(new ModelPageItem(periodicSpecialCleaningChkFragment, getString(R.string.actMakeReservation_titleChooseSpc)));
chkPeriodCleaningToolTip();
}
return list;
}
//장기권 애니ㅔㅁ이션 여부
private void chkPeriodCleaningToolTip(){
if(TutoriorPreference.isFirst(TutoriorPreference.TUTORIORKEY_PERIODCLEANING)){
//시작
new Handler(){
@Override
public void dispatchMessage(Message msg) {
//시작하는 동안 백클릭안되게
//시작
final FullpopupPeriodCleaningHint fullpopupPeriodCleaningHint = new FullpopupPeriodCleaningHint(MakeCleaningReservationActivity.this);
new Handler(){
@Override
public void dispatchMessage(Message msg) {
fullpopupPeriodCleaningHint.show();
}
}.sendEmptyMessageDelayed(0, 1000);
}
}.sendEmptyMessageDelayed(0, 500);
//애니메이션 봣다고 ㅍ시
TutoriorPreference.chkRead(TutoriorPreference.TUTORIORKEY_PERIODCLEANING);
}
}
//이사청소 애니ㅔㅁ이션 여부
private void chkMoveinCleaningToolTip(){
if(TutoriorPreference.isFirst(TutoriorPreference.TUTORIORKEY_MOVEINCLEANING)){
//시작
new Handler(){
@Override
public void dispatchMessage(Message msg) {
//시작하는 동안 백클릭안되게
//시작
final FullpopupMoveinCleaningHint fullpopupBasicCleaningHint = new FullpopupMoveinCleaningHint(MakeCleaningReservationActivity.this);
new Handler(){
@Override
public void dispatchMessage(Message msg) {
fullpopupBasicCleaningHint.show();
}
}.sendEmptyMessageDelayed(0, 1000);
}
}.sendEmptyMessageDelayed(0, 500);
//애니메이션 봣다고 ㅍ시
TutoriorPreference.chkRead(TutoriorPreference.TUTORIORKEY_MOVEINCLEANING);
}
}
//애니메이션 처리 여부
private void chkBasicCleaningToolTip(){
if(TutoriorPreference.isFirst(TutoriorPreference.TUTORIORKEY_BASICCLEANING)){
//시작
new Handler(){
@Override
public void dispatchMessage(Message msg) {
//시작하는 동안 백클릭안되게
//시작
final FullpopupBasicCleaningHint fullpopupBasicCleaningHint = new FullpopupBasicCleaningHint(MakeCleaningReservationActivity.this);
new Handler(){
@Override
public void dispatchMessage(Message msg) {
fullpopupBasicCleaningHint.show();
}
}.sendEmptyMessageDelayed(0, 1000);
}
}.sendEmptyMessageDelayed(0, 500);
//애니메이션 봣다고 ㅍ시
TutoriorPreference.chkRead(TutoriorPreference.TUTORIORKEY_BASICCLEANING);
}
}
//
// private void beforeSubmit(){
// //중복된 청소 있는지 체크
// final String userId = CurrentUserInfo.getId(this);
// final String homeId = CurrentUserInfo.getHomeId(this);
// final String periodType = makeReservationParam.periodType;
// final String periodValue = makeReservationParam.periodValue;
// final String cleaningCount = makeReservationParam.cleaningCount + "";
// final String beginDate = makeReservationParam.periodStartDate;
//
// final int pInt = ProgressDialogController.show(this);
// RestClient.getCleaningRequestClient().requestPeriodCleaningCheck(orderNo, userId, homeId, periodType, periodValue, cleaningCount, beginDate).enqueue(new RetrofitCallback<List<CleaningReservationModel>>() {
// @Override
// public void onSuccess(List<CleaningReservationModel> result) {
//
// if(result.size() <= 0){
// submit(); //바로제출
// }else{
// //결과가있음.
// //대기열에 넣어두자
// JoSharedPreference.with().push("READY_CLEANING_QUEUE", result);
// startActivityForResult(new Intent(MakeCleaningReservationActivity.this, CollisionCleaningManagerActivity.class), REQ_COLLISION);
//
// }
// }
//
// @Override
// public void onFinish() {
// super.onFinish();
// ProgressDialogController.dismiss(pInt);
// }
// });
// }
private void submitForOnedays(){
final String userId = CurrentUserInfo.getId(this);
final String homeId = CurrentUserInfo.getHomeId(this);
final String spcCleaningIdsSets = makeReservationParam.spcCleaningIdsSets;
final String cleaningDateTimes = makeReservationParam.cleaningDateTimes;
final String cleaningNumbers = makeReservationParam.cleaningNumbersForSpc;
final int cleaningCount = makeReservationParam.mapCleaningDateTime.size();
final String comment = makeReservationParam.comment;
final int totalBasicCleaningPrice = makeReservationParam.totalPrice;
final String spcCleaningCountsSets = makeReservationParam.spcCleaningCountsSets;
final String promotionType = makeReservationParam.currentPromotion;
final int pId = ProgressDialogController.show(this);
RestClient.getCleaningRequestClient().requestCleanings(
type
, orderNo
, userId, homeId, cleaningCount+""
, totalBasicCleaningPrice, cleaningDateTimes
, cleaningNumbers
, spcCleaningIdsSets
, spcCleaningCountsSets
, comment, promotionType)
.enqueue(new RetrofitCallback<String>() {
@Override
public void onFinish() {
super.onFinish();
ProgressDialogController.dismiss(pId);
}
@Override
public void onSuccess(String result) {
hasOrder = true;
startActivity(new Intent(MakeCleaningReservationActivity.this, PaymentActivity.class)
.putExtra("orderNo", orderNo)
.putExtra("orderName", makeReservationParam.orderName)
.putExtra("totalPrice", makeReservationParam.totalPrice));
}
});
}
//주기청소 제출
private void submitForPeriodic(){
final String userId = CurrentUserInfo.getId(this);
final String homeId = CurrentUserInfo.getHomeId(this);
final String periodType = makeReservationParam.periodType;
final String periodValue = makeReservationParam.periodValue;
final String cleaningCount = makeReservationParam.cleaningCount + "";
final String beginDate = makeReservationParam.periodStartDate;
final String cleaningNumbersForSpc = makeReservationParam.cleaningNumbersForSpc;
final String spcCleaningIdsSets = makeReservationParam.spcCleaningIdsSets;
final String spcCleaningCountsSets = makeReservationParam.spcCleaningCountsSets;
final String comment = makeReservationParam.comment;
final String promotionType = makeReservationParam.currentPromotion;
int totalBasicCleaningPrice = makeReservationParam.totalBasicCleaningPrice;
if(!hasOrder){
final int pId = ProgressDialogController.show(this);
orderNo = MakeCleaningReservationParam.makeOrderNo();
RestClient.getCleaningRequestClient().requestPeriodCleaning(
orderNo, userId, homeId, periodType, periodValue, cleaningCount, beginDate
, totalBasicCleaningPrice
, cleaningNumbersForSpc, spcCleaningIdsSets, spcCleaningCountsSets, comment, promotionType)
.enqueue(new RetrofitCallback<String>() {
@Override
public void onFinish() {
super.onFinish();
ProgressDialogController.dismiss(pId);
}
@Override
public void onSuccess(String result) {
hasOrder =true;
// paramOrderNo = getIntent().getStringExtra("orderNo");
// paramOrderName = getIntent().getStringExtra("orderName");
// paramTotalPrice = getIntent().getIntExtra("totalPrice", 0);
startActivityForResult(new Intent(MakeCleaningReservationActivity.this, PaymentActivity.class)
.putExtra("orderNo", orderNo)
.putExtra("orderName", makeReservationParam.orderName)
.putExtra("totalPrice", makeReservationParam.totalPrice), 1);
}
});
}else{
startActivityForResult(new Intent(MakeCleaningReservationActivity.this, PaymentActivity.class)
.putExtra("orderNo", orderNo)
.putExtra("orderName", makeReservationParam.orderName)
.putExtra("totalPrice", makeReservationParam.totalPrice), 1);
}
}
private void submit(){
//결제 진행함..
DialogController.makeAlertDialog(this)
.setOkText(getString(R.string.actMakeReservation_proceedPayment))
.setCancelText(getString(R.string.actMakeReservation_cancel))
.setTitle("OKHOME")
.setContent(getString(R.string.actMakeReservation_reqBeforePayment))
.setCallback(new ViewDialog.DialogCommonCallback() {
@Override
public void onCallback(Object dialog, Map<String, Object> params) {
String click = (String)params.get(DialogController.TAG_CLICK);
if(click.equals(DialogController.CLICK_OK)){
String type = getIntent().getStringExtra("TYPE");
if(type.equals("NORMAL")){
submitForOnedays();
}else if(type.equals("MOVEIN")){
submitForOnedays();
}else{
submitForPeriodic();
}
}
}
}).matchViews();
}
@OnClick(R.id.actMakeOneDayReservation_vbtnRight)
public void onBtnRightClick(View v){
Fragment fCurrent = pagerAdapter.getCurrentFragment(vpContents.getCurrentItem());
MakeCleaningReservationFlow flow = (MakeCleaningReservationFlow)fCurrent;
//다음
if(flow.next(makeReservationParam)){
int nextPos = vpContents.getCurrentItem() + 1;
if(nextPos >= pagerAdapter.getCount()){
submit();
// beforeSubmit();
}else{
vpContents.setCurrentItem(nextPos);
}
}else{
;
}
//현재 프래그먼트 갖고와서 상태보자
}
private void showDismissDialog(){
DialogController.showAlertDialog(MakeCleaningReservationActivity.this, "OKHOME", getString(R.string.actMakeReservation_askQuitReservation), false, new ViewDialog.DialogCommonCallback() {
@Override
public void onCallback(Object dialog, Map<String, Object> params) {
String click = (String)params.get(DialogController.TAG_CLICK);
if(click.equals("OK")){
finish();
}else{
;
}
}
});
}
public View getVbtnRight() {
return vbtnRight;
}
@OnClick(R.id.actMakeOneDayReservation_vbtnLeft)
public void onLeftClick(View v){
left();
}
public void left(){
int prevPos = vpContents.getCurrentItem() - 1;
if(prevPos < 0){
showDismissDialog();
}else{
vpContents.setCurrentItem(prevPos);
}
}
@OnClick(R.id.actMakeOneDayReservation_vbtnAlarm)
public void onMessageClick(View v){
startActivity(new Intent(this, ChatClientActivity.class));
}
@OnClick(R.id.actMain_llbtnX)
public void onClickBtnX(View v){
// DialogController.showCenterDialog(this,
// new CommonTextDialog("Really cancel reservation?", "All things being written is not saved", new ViewDialog.DialogCommonCallback() {
// @Override
// public void onCallback(Object dialog, Map<String, Object> params) {
// String onClick = (String)params.get("ONCLICK");
// if(onClick.equals("OK")){
// finish();
// }
// }
// }));
showDismissDialog();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
}
@Override
public void addBackClickListener(OnBackClickListener onBackClickListener) {
backClickListenersList.add(new WeakReference<>(onBackClickListener));
}
@Override
public void removeBackClickListener(OnBackClickListener onBackClickListener) {
for (Iterator<WeakReference<OnBackClickListener>> iterator = backClickListenersList.iterator();
iterator.hasNext();){
WeakReference<OnBackClickListener> weakRef = iterator.next();
if (weakRef.get() == onBackClickListener){
iterator.remove();
}
}
}
@Override
public void onBackPressed() {
if(!fragmentsBackKeyIntercept()){
onLeftClick(null);
}
}
private boolean fragmentsBackKeyIntercept() {
boolean isIntercept = false;
for (WeakReference<OnBackClickListener> weakRef : backClickListenersList) {
OnBackClickListener onBackClickListener = weakRef.get();
if (onBackClickListener != null) {
boolean isFragmIntercept = onBackClickListener.onBackClick();
if (!isIntercept) isIntercept = isFragmIntercept;
}
}
return isIntercept;
}
//
//프래그먼트 어댑터
class Reservation1DayCleaningAdapter extends FragmentStatePagerAdapter implements ViewPager.OnPageChangeListener{
final Map<Integer, Fragment> mapFragment = new HashMap<Integer, Fragment>();
List<ModelPageItem> listItem = new ArrayList<>();
public Reservation1DayCleaningAdapter(FragmentManager fm, List<ModelPageItem> list) {
super(fm);
this.listItem = list;
}
@Override
public Fragment getItem(int position) {
Fragment f = listItem.get(position).fragment;
mapFragment.put(position, f);
return f;
}
@Override
public int getCount() {
return listItem.size();
}
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
tvCount.setText("(" + (position+1) + "/" + this.getCount() + ")");
pdv.setCurrentPos(position);
//텍스트 변경
tvTitle.setText(listItem.get(position).title);
//버튼텍스트
if(position == 0){
tvLeft.setText(getString(R.string.actMakeReservation_naviCancel));
}else{
tvLeft.setText(getString(R.string.actMakeReservation_naviPrev));
}
if(position+1 == getCount()){
tvRight.setText(getString(R.string.actMakeReservation_naviPayment));
}else{
tvRight.setText(getString(R.string.actMakeReservation_naviNext));
}
if(getCurrentFragment(position) != null){
Util.Log("onPageSelected position : " + position);
MakeCleaningReservationFlow flow = (MakeCleaningReservationFlow)getCurrentFragment(position);
flow.onCurrentPage(position, makeReservationParam);
}
}
public Fragment getCurrentFragment(int pos){
Fragment f = mapFragment.get(pos);
return f;
}
@Override
public void onPageScrollStateChanged(int state) {
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
super.destroyItem(container, position, object);
mapFragment.remove(position);
}
}
class ModelPageItem{
public ModelPageItem(Fragment fragment, String title) {
this.fragment = fragment;
this.title = title;
}
Fragment fragment;
String title;
}
}
| 29,714 | 0.63098 | 0.629101 | 726 | 39.30854 | 35.200466 | 215 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.567493 | false | false | 10 |
8eeb04b02ddc99ca8702c3d9737b35f5ae22ecb5 | 5,033,701,721,494 | 0a9ea6bf15b0899c6ff851f0c80e3646f09d2cac | /src/vrpApp/WriterContext.java | 6ba3657d6a88d79424037b29cafae8d4b09d515c | []
| no_license | ecobost/VRPTec | https://github.com/ecobost/VRPTec | 6f5a401d0ef8835fc9f6d56ddf581b8c96cf63c2 | dd45c26b751eb2f270c6d68cd437b0b2581c6fc6 | refs/heads/master | 2021-01-24T23:01:00.944000 | 2015-09-26T08:50:41 | 2015-09-26T08:50:41 | 27,244,879 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package vrpApp;
import java.io.File;
public class WriterContext {
private Writr writer;
public void setStrategy(Writr writer) {
this.writer = writer;
}
public void write(String problemName, Solution solution, ConfigurationParams configParams) {
try{
writer.write(problemName, solution, configParams);
}catch(NullPointerException e){
ErrorHandler.showError(18, "WriterContext.write(String,Solution,ConfigurationParams)", true);
}
}
public void setOutputFolder(File outputFolder){
try{
writer.setOutputFolder(outputFolder);
}catch(NullPointerException e){
ErrorHandler.showError(18, "WriterContext.setOutputFolder(File)", true);
}
}
}
| UTF-8 | Java | 673 | java | WriterContext.java | Java | []
| null | []
| package vrpApp;
import java.io.File;
public class WriterContext {
private Writr writer;
public void setStrategy(Writr writer) {
this.writer = writer;
}
public void write(String problemName, Solution solution, ConfigurationParams configParams) {
try{
writer.write(problemName, solution, configParams);
}catch(NullPointerException e){
ErrorHandler.showError(18, "WriterContext.write(String,Solution,ConfigurationParams)", true);
}
}
public void setOutputFolder(File outputFolder){
try{
writer.setOutputFolder(outputFolder);
}catch(NullPointerException e){
ErrorHandler.showError(18, "WriterContext.setOutputFolder(File)", true);
}
}
}
| 673 | 0.756315 | 0.750371 | 28 | 23.035715 | 27.806067 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.857143 | false | false | 10 |
2073ac706045d851cb6f95f1c647e3aaa2717937 | 3,985,729,703,299 | bfb14a3d7e48dc090b9fda7d039b75a13a91339a | /AOP/src/main/java/spring/core/aop/impl/xml/LoggingAspect.java | 8e5cacb5a4654f3481a894bf994c01bfe086addb | []
| no_license | shubozhang/spring-core | https://github.com/shubozhang/spring-core | a6ff3cc8104fb8858597fe46562de64b9351ccd8 | 273e84a9a7c29f0777f38d66329b63cce86963ad | refs/heads/master | 2021-01-10T03:16:32.705000 | 2017-06-06T10:57:07 | 2017-06-06T10:57:07 | 46,234,944 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package spring.core.aop.impl.xml;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.List;
/**
* 1. This aspect should be annotated as both component and aspect
*/
public class LoggingAspect {
public void beforeMethod(JoinPoint joinPoint) {
String methodName = joinPoint.getSignature().getName();
List<Object> args = Arrays.asList(joinPoint.getArgs());
System.out.println("The method " + methodName + " is starting with " + args);
}
public void afterMethod(JoinPoint joinPoint) {
String methodName = joinPoint.getSignature().getName();
List<Object> args = Arrays.asList(joinPoint.getArgs());
System.out.println("The method " + methodName + " is ending with " + args);
}
public void afterReturningMethod(JoinPoint joinPoint, Object result) {
String methodName = joinPoint.getSignature().getName();
System.out.println("The method " + methodName + " ends with " + result);
}
public void afterThrowingMethod(JoinPoint joinPoint, Exception ex) {
String methodName = joinPoint.getSignature().getName();
System.out.println("The method " + methodName + " occurs exception: " + ex);
}
public Object aroundMethod(ProceedingJoinPoint pjd) {
Object result = null;
String methodName = pjd.getSignature().getName();
try {
// Before
System.out.println("Before method: ");
result = pjd.proceed();
//AfterReturning
System.out.println("After method: ");
} catch (Throwable throwable) {
// Exception event
System.out.println("Exception occurs : ");
throwable.printStackTrace();
}
//After event
System.out.println("After method---");
return result;
}
}
| UTF-8 | Java | 2,043 | java | LoggingAspect.java | Java | []
| null | []
| package spring.core.aop.impl.xml;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.List;
/**
* 1. This aspect should be annotated as both component and aspect
*/
public class LoggingAspect {
public void beforeMethod(JoinPoint joinPoint) {
String methodName = joinPoint.getSignature().getName();
List<Object> args = Arrays.asList(joinPoint.getArgs());
System.out.println("The method " + methodName + " is starting with " + args);
}
public void afterMethod(JoinPoint joinPoint) {
String methodName = joinPoint.getSignature().getName();
List<Object> args = Arrays.asList(joinPoint.getArgs());
System.out.println("The method " + methodName + " is ending with " + args);
}
public void afterReturningMethod(JoinPoint joinPoint, Object result) {
String methodName = joinPoint.getSignature().getName();
System.out.println("The method " + methodName + " ends with " + result);
}
public void afterThrowingMethod(JoinPoint joinPoint, Exception ex) {
String methodName = joinPoint.getSignature().getName();
System.out.println("The method " + methodName + " occurs exception: " + ex);
}
public Object aroundMethod(ProceedingJoinPoint pjd) {
Object result = null;
String methodName = pjd.getSignature().getName();
try {
// Before
System.out.println("Before method: ");
result = pjd.proceed();
//AfterReturning
System.out.println("After method: ");
} catch (Throwable throwable) {
// Exception event
System.out.println("Exception occurs : ");
throwable.printStackTrace();
}
//After event
System.out.println("After method---");
return result;
}
}
| 2,043 | 0.647088 | 0.646598 | 65 | 30.430769 | 27.493759 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.446154 | false | false | 10 |
7e8d721ebf53bebc86501a9d276a837d4e1bc04c | 6,562,710,051,666 | 4bec3162bb489f8dc163486f8248e79345136890 | /intact-core/src/test/java/uk/ac/ebi/intact/core/lifecycle/correctionassigner/SelectionRandomizerTest.java | d771dc6470e180d4eb57b77fcde74bd1ac53aae4 | [
"Apache-2.0"
]
| permissive | EBI-IntAct/intact-cores | https://github.com/EBI-IntAct/intact-cores | 3e59e765ee4fbfe5e47d578216a468d7984d3d6f | 9fbd03c5a8cea870fafaff1062f7478344e8bba3 | refs/heads/master | 2023-08-24T05:55:14.051000 | 2022-12-14T10:59:45 | 2022-12-14T10:59:45 | 61,305,224 | 0 | 0 | null | false | 2023-04-05T08:33:00 | 2016-06-16T15:31:05 | 2022-09-29T16:28:38 | 2023-04-05T08:32:59 | 4,759 | 0 | 0 | 0 | Java | false | false | package uk.ac.ebi.intact.core.lifecycle.correctionassigner;
import org.junit.Assert;
import org.junit.Test;
/**
* @author Bruno Aranda (baranda@ebi.ac.uk)
* @version $Id$
*/
public class SelectionRandomizerTest {
@Test
public void testRandomSelection() throws Exception {
SelectionRandomizer<String> selectionRandomizer = new SelectionRandomizer<String>();
selectionRandomizer.addObject("lala", 80);
selectionRandomizer.addObject("lolo", 20);
String selected = selectionRandomizer.randomSelection();
Assert.assertTrue(selected.equals(selected) || "lolo".equals(selected));
}
@Test
public void testRandomSelection_allTheSame() throws Exception {
SelectionRandomizer<String> selectionRandomizer = new SelectionRandomizer<String>();
selectionRandomizer.addObject("lala", 80);
String selected = selectionRandomizer.randomSelection();
Assert.assertEquals("lala", selected);
}
@Test
public void testRandomSelectionWithObj() throws Exception {
SelectionRandomizer<String> selectionRandomizer = new SelectionRandomizer<String>();
selectionRandomizer.addObject("lala", 80);
selectionRandomizer.addObject("lolo", 20);
String selected = selectionRandomizer.randomSelection("lala");
Assert.assertTrue("lolo".equals(selected));
}
@Test
public void testRandomSelectionWithObj_allTheSame() throws Exception {
SelectionRandomizer<String> selectionRandomizer = new SelectionRandomizer<String>();
selectionRandomizer.addObject("lala", 80);
String selected = selectionRandomizer.randomSelection("lala");
Assert.assertNull(selected);
}
}
| UTF-8 | Java | 1,726 | java | SelectionRandomizerTest.java | Java | [
{
"context": "nit.Assert;\nimport org.junit.Test;\n\n/**\n * @author Bruno Aranda (baranda@ebi.ac.uk)\n * @version $Id$\n */\npublic c",
"end": 137,
"score": 0.9998958706855774,
"start": 125,
"tag": "NAME",
"value": "Bruno Aranda"
},
{
"context": "ort org.junit.Test;\n\n/**\n * @author Bruno Aranda (baranda@ebi.ac.uk)\n * @version $Id$\n */\npublic class SelectionRando",
"end": 156,
"score": 0.9999314546585083,
"start": 139,
"tag": "EMAIL",
"value": "baranda@ebi.ac.uk"
}
]
| null | []
| package uk.ac.ebi.intact.core.lifecycle.correctionassigner;
import org.junit.Assert;
import org.junit.Test;
/**
* @author <NAME> (<EMAIL>)
* @version $Id$
*/
public class SelectionRandomizerTest {
@Test
public void testRandomSelection() throws Exception {
SelectionRandomizer<String> selectionRandomizer = new SelectionRandomizer<String>();
selectionRandomizer.addObject("lala", 80);
selectionRandomizer.addObject("lolo", 20);
String selected = selectionRandomizer.randomSelection();
Assert.assertTrue(selected.equals(selected) || "lolo".equals(selected));
}
@Test
public void testRandomSelection_allTheSame() throws Exception {
SelectionRandomizer<String> selectionRandomizer = new SelectionRandomizer<String>();
selectionRandomizer.addObject("lala", 80);
String selected = selectionRandomizer.randomSelection();
Assert.assertEquals("lala", selected);
}
@Test
public void testRandomSelectionWithObj() throws Exception {
SelectionRandomizer<String> selectionRandomizer = new SelectionRandomizer<String>();
selectionRandomizer.addObject("lala", 80);
selectionRandomizer.addObject("lolo", 20);
String selected = selectionRandomizer.randomSelection("lala");
Assert.assertTrue("lolo".equals(selected));
}
@Test
public void testRandomSelectionWithObj_allTheSame() throws Exception {
SelectionRandomizer<String> selectionRandomizer = new SelectionRandomizer<String>();
selectionRandomizer.addObject("lala", 80);
String selected = selectionRandomizer.randomSelection("lala");
Assert.assertNull(selected);
}
}
| 1,710 | 0.709733 | 0.702781 | 52 | 32.192307 | 31.309275 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.576923 | false | false | 10 |
036e953ae4c1838954611f6c1c7af95147973241 | 21,784,074,192,199 | f947bbef38acd6bcde10aac36ad0820fe45a7014 | /5/src/test/java/com/twu/refactoring/ReceiptTest.java | 4170be5a5969b135a74912435dbdeee5740f8bcb | []
| no_license | Jerry-wenhao/refactor-practice | https://github.com/Jerry-wenhao/refactor-practice | a1d5a09415c0270e33f77f9377b4e619ef81d55a | 37546f51cf60ab5a727ef97413847eef0a8196ea | refs/heads/master | 2022-12-27T09:11:48.169000 | 2020-09-19T21:06:42 | 2020-09-19T21:06:42 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.twu.refactoring;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.closeTo;
public class ReceiptTest {
@Test
public void shouldCalculateChargesForACTaxiFor30Kms() {
double cost = new Receipt(new Taxi(true, 30, false)).getTotalCost();
assertThat(cost, closeTo(649D, 0.01D));
}
@Test
public void shouldCalculateChargesForNonACTaxiFor30Kms() {
double cost = new Receipt(new Taxi(false, 30, false)).getTotalCost();
assertThat(cost, closeTo(484D, 0.01D));
}
@Test
public void shouldCalculateForACChargesFor30KmsPeakTime() {
double cost = new Receipt(new Taxi(true, 30, true)).getTotalCost();
assertThat(cost, closeTo(767.8D, 0.01D));
}
@Test
public void shouldCalculateChargesForNonACTaxiFor30KmsPeakTime() {
double cost = new Receipt(new Taxi(false, 30, true)).getTotalCost();
assertThat(cost, closeTo(569.8D, 0.01D));
}
}
| UTF-8 | Java | 1,025 | java | ReceiptTest.java | Java | []
| null | []
| package com.twu.refactoring;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.closeTo;
public class ReceiptTest {
@Test
public void shouldCalculateChargesForACTaxiFor30Kms() {
double cost = new Receipt(new Taxi(true, 30, false)).getTotalCost();
assertThat(cost, closeTo(649D, 0.01D));
}
@Test
public void shouldCalculateChargesForNonACTaxiFor30Kms() {
double cost = new Receipt(new Taxi(false, 30, false)).getTotalCost();
assertThat(cost, closeTo(484D, 0.01D));
}
@Test
public void shouldCalculateForACChargesFor30KmsPeakTime() {
double cost = new Receipt(new Taxi(true, 30, true)).getTotalCost();
assertThat(cost, closeTo(767.8D, 0.01D));
}
@Test
public void shouldCalculateChargesForNonACTaxiFor30KmsPeakTime() {
double cost = new Receipt(new Taxi(false, 30, true)).getTotalCost();
assertThat(cost, closeTo(569.8D, 0.01D));
}
}
| 1,025 | 0.68878 | 0.647805 | 34 | 29.147058 | 28.344656 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.823529 | false | false | 10 |
72f7be524e99fd16dac883510e2a935085d6f8ee | 6,451,040,938,589 | 4dd0fac6501e45d9e266fa891c2e0f9076b80c0c | /demo06_hystrix_alarm/oreder_service/src/main/java/com/example/order_service/service/ProductOrderService.java | a293bde3b4f3791eba552b9d977561056ee241a3 | []
| no_license | mambamentality8/springcloud | https://github.com/mambamentality8/springcloud | 7f8b556a13d8374182f2ac6ee860f40d2d1a8b3b | abb76fcb51443bac5bd8cb0dc9883224e78312ed | refs/heads/master | 2020-05-03T19:25:57.133000 | 2019-09-04T02:24:40 | 2019-09-04T02:24:40 | 178,783,918 | 4 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.order_service.service;
import com.example.order_service.domain.ProductOrder;
/**
* 订单业务类
*/
public interface ProductOrderService {
/**
* 下单接口
* @param userId
* @param productId
* @return
*/
ProductOrder save(int userId, int productId);
}
| UTF-8 | Java | 319 | java | ProductOrderService.java | Java | []
| null | []
| package com.example.order_service.service;
import com.example.order_service.domain.ProductOrder;
/**
* 订单业务类
*/
public interface ProductOrderService {
/**
* 下单接口
* @param userId
* @param productId
* @return
*/
ProductOrder save(int userId, int productId);
}
| 319 | 0.641196 | 0.641196 | 21 | 13.333333 | 17.197268 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.190476 | false | false | 10 |
c0139557d4f6404bd32ab09cd6fc13cc11ce4df1 | 18,511,309,107,829 | 915fbc76377c1a2c6881e596ee56dba59d6fb02e | /src/test/java/org/powerassert/JavaCompilerHelper.java | a3d9775822922a05abc6b140d640880012877de3 | [
"Apache-2.0"
]
| permissive | jkschneider/java-power-assert | https://github.com/jkschneider/java-power-assert | 61285666b8b83b0f56a762174367aae3eb07ae2a | 6368562904d0bbfafa7ab3b56816836e7c9ab5ef | refs/heads/master | 2021-07-24T09:39:40.460000 | 2021-07-14T23:23:19 | 2021-07-14T23:23:19 | 59,227,937 | 95 | 4 | Apache-2.0 | false | 2019-03-01T05:18:05 | 2016-05-19T17:30:27 | 2018-11-28T21:22:55 | 2019-03-01T05:18:05 | 2,278 | 73 | 3 | 5 | Java | false | null | /*
* Copyright 2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.powerassert;
import java.io.*;
import java.net.URI;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.annotation.processing.Processor;
import javax.tools.*;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.util.Textifier;
import org.objectweb.asm.util.TraceClassVisitor;
import org.objectweb.asm.util.TraceMethodVisitor;
public class JavaCompilerHelper {
List<SimpleJavaFileObject> sources = new ArrayList<>();
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>();
InMemoryClassFileManager inMemoryClassFileManager = new InMemoryClassFileManager();
List<Processor> processors;
public JavaCompilerHelper(Processor... processors) {
this.processors = Arrays.asList(processors);
}
public byte[] compile(final String sourceStr) {
String className = fullyQualifiedName(sourceStr);
if(className != null) {
sources.add(new SimpleJavaFileObject(URI.create("string:///" + className.replaceAll("\\.", "/") + ".java"), JavaFileObject.Kind.SOURCE) {
@Override
public CharSequence getCharContent(boolean ignoreEncodingErrors) { return sourceStr.trim(); }
});
JavaCompiler.CompilationTask task = compiler.getTask(null, inMemoryClassFileManager, diagnostics,
Collections.singletonList("-g"), null, sources);
task.setProcessors(this.processors);
if(!task.call()) {
for(Diagnostic<? extends JavaFileObject> d : diagnostics.getDiagnostics()) {
System.out.println("line " + d.getLineNumber() + ": " + d.getMessage(Locale.getDefault()));
}
throw new RuntimeException("compilation failed");
}
return inMemoryClassFileManager.classBytes(className);
}
return null;
}
public static String fullyQualifiedName(String sourceStr) {
Matcher pkgMatcher = Pattern.compile("\\s*package\\s+([\\w\\.]+)").matcher(sourceStr);
String pkg = pkgMatcher.find() ? pkgMatcher.group(1) + "." : "";
Matcher classMatcher = Pattern.compile("\\s*(class|interface|enum)\\s+(\\w+)").matcher(sourceStr);
return classMatcher.find() ? pkg + classMatcher.group(2) : null;
}
public void traceClass(String className) {
PrintWriter pw = new PrintWriter(System.out);
new ClassReader(inMemoryClassFileManager.classBytes(className)).accept(
new TraceClassVisitor(pw), ClassReader.SKIP_FRAMES);
}
public void traceMethod(String className, final String method) {
new ClassReader(inMemoryClassFileManager.classBytes(className)).accept(
new ClassVisitor(Opcodes.ASM5) {
PrintWriter pw = new PrintWriter(System.out);
Textifier p = new Textifier();
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
if(name.equals(method)) {
p.visitMethod(access, name, desc, signature, exceptions);
return new TraceMethodVisitor(p);
}
return null;
}
@Override
public void visitEnd() {
p.visitClassEnd();
if (pw != null) {
p.print(pw);
pw.flush();
}
}
},
ClassReader.SKIP_FRAMES
);
}
public Object newInstance(String className) {
try {
return classLoader.loadClass(className).newInstance();
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
ClassLoader classLoader = new ClassLoader() {
@Override
protected Class<?> findClass(String name) throws ClassNotFoundException {
byte[] b = inMemoryClassFileManager.classBytes(name);
if(b != null) {
return defineClass(name, b, 0, b.length);
} else throw new ClassNotFoundException(name);
}
};
class InMemoryClassFileManager extends ForwardingJavaFileManager<StandardJavaFileManager> {
Map<String, JavaClassObject> classesByName = new HashMap<>();
protected InMemoryClassFileManager() {
super(compiler.getStandardFileManager(diagnostics, null, null));
}
byte[] classBytes(String className) {
JavaClassObject clazz = classesByName.get(className);
return clazz == null ? null : clazz.bos.toByteArray();
}
@Override
public JavaFileObject getJavaFileForOutput(JavaFileManager.Location location, String className, JavaFileObject.Kind kind, FileObject sibling) {
JavaClassObject clazz = new JavaClassObject(className, kind);
classesByName.put(className, clazz);
return clazz;
}
private class JavaClassObject extends SimpleJavaFileObject {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
JavaClassObject(String name, JavaFileObject.Kind kind) {
super(URI.create("string:///" + name + ".class"), kind);
}
@Override
public OutputStream openOutputStream() {
return bos;
}
}
}
} | UTF-8 | Java | 5,670 | java | JavaCompilerHelper.java | Java | []
| null | []
| /*
* Copyright 2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.powerassert;
import java.io.*;
import java.net.URI;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.annotation.processing.Processor;
import javax.tools.*;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.util.Textifier;
import org.objectweb.asm.util.TraceClassVisitor;
import org.objectweb.asm.util.TraceMethodVisitor;
public class JavaCompilerHelper {
List<SimpleJavaFileObject> sources = new ArrayList<>();
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>();
InMemoryClassFileManager inMemoryClassFileManager = new InMemoryClassFileManager();
List<Processor> processors;
public JavaCompilerHelper(Processor... processors) {
this.processors = Arrays.asList(processors);
}
public byte[] compile(final String sourceStr) {
String className = fullyQualifiedName(sourceStr);
if(className != null) {
sources.add(new SimpleJavaFileObject(URI.create("string:///" + className.replaceAll("\\.", "/") + ".java"), JavaFileObject.Kind.SOURCE) {
@Override
public CharSequence getCharContent(boolean ignoreEncodingErrors) { return sourceStr.trim(); }
});
JavaCompiler.CompilationTask task = compiler.getTask(null, inMemoryClassFileManager, diagnostics,
Collections.singletonList("-g"), null, sources);
task.setProcessors(this.processors);
if(!task.call()) {
for(Diagnostic<? extends JavaFileObject> d : diagnostics.getDiagnostics()) {
System.out.println("line " + d.getLineNumber() + ": " + d.getMessage(Locale.getDefault()));
}
throw new RuntimeException("compilation failed");
}
return inMemoryClassFileManager.classBytes(className);
}
return null;
}
public static String fullyQualifiedName(String sourceStr) {
Matcher pkgMatcher = Pattern.compile("\\s*package\\s+([\\w\\.]+)").matcher(sourceStr);
String pkg = pkgMatcher.find() ? pkgMatcher.group(1) + "." : "";
Matcher classMatcher = Pattern.compile("\\s*(class|interface|enum)\\s+(\\w+)").matcher(sourceStr);
return classMatcher.find() ? pkg + classMatcher.group(2) : null;
}
public void traceClass(String className) {
PrintWriter pw = new PrintWriter(System.out);
new ClassReader(inMemoryClassFileManager.classBytes(className)).accept(
new TraceClassVisitor(pw), ClassReader.SKIP_FRAMES);
}
public void traceMethod(String className, final String method) {
new ClassReader(inMemoryClassFileManager.classBytes(className)).accept(
new ClassVisitor(Opcodes.ASM5) {
PrintWriter pw = new PrintWriter(System.out);
Textifier p = new Textifier();
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
if(name.equals(method)) {
p.visitMethod(access, name, desc, signature, exceptions);
return new TraceMethodVisitor(p);
}
return null;
}
@Override
public void visitEnd() {
p.visitClassEnd();
if (pw != null) {
p.print(pw);
pw.flush();
}
}
},
ClassReader.SKIP_FRAMES
);
}
public Object newInstance(String className) {
try {
return classLoader.loadClass(className).newInstance();
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
ClassLoader classLoader = new ClassLoader() {
@Override
protected Class<?> findClass(String name) throws ClassNotFoundException {
byte[] b = inMemoryClassFileManager.classBytes(name);
if(b != null) {
return defineClass(name, b, 0, b.length);
} else throw new ClassNotFoundException(name);
}
};
class InMemoryClassFileManager extends ForwardingJavaFileManager<StandardJavaFileManager> {
Map<String, JavaClassObject> classesByName = new HashMap<>();
protected InMemoryClassFileManager() {
super(compiler.getStandardFileManager(diagnostics, null, null));
}
byte[] classBytes(String className) {
JavaClassObject clazz = classesByName.get(className);
return clazz == null ? null : clazz.bos.toByteArray();
}
@Override
public JavaFileObject getJavaFileForOutput(JavaFileManager.Location location, String className, JavaFileObject.Kind kind, FileObject sibling) {
JavaClassObject clazz = new JavaClassObject(className, kind);
classesByName.put(className, clazz);
return clazz;
}
private class JavaClassObject extends SimpleJavaFileObject {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
JavaClassObject(String name, JavaFileObject.Kind kind) {
super(URI.create("string:///" + name + ".class"), kind);
}
@Override
public OutputStream openOutputStream() {
return bos;
}
}
}
} | 5,670 | 0.708466 | 0.706349 | 165 | 33.369698 | 31.838079 | 149 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.181818 | false | false | 10 |
4910c5cb962b9a6ec5c56e76422b8d057449a83e | 2,327,872,280,976 | 3b321c0539f03554efb0f7193b4c1586e0dc8b98 | /GiveHash1.java | 26066467ff6ad87c12d263b07b8475b33e7dfc72 | []
| no_license | rekhitdroid/DATA_STRUCTURE | https://github.com/rekhitdroid/DATA_STRUCTURE | 056420cb99dc5805a3b97f0569dcdd72eddd774c | 0cfb8f93b18e926bd754bf237969804528202d92 | refs/heads/master | 2020-03-23T04:20:31.064000 | 2018-07-16T03:37:30 | 2018-07-16T03:37:30 | 141,077,272 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.lang.*;
import java.util.*;
public class GiveHash1{
public static void main(String [] args ){
int a=5;
int b=5;
Integer A = new Integer(5);
Integer B = new Integer(5);
System.out.println(a==b);
// System.out.println(a.equals(b)); primitives cannot be drefrenced
System.out.println(A==B);
System.out.println(A.equals(B));
}
} | UTF-8 | Java | 408 | java | GiveHash1.java | Java | []
| null | []
| import java.lang.*;
import java.util.*;
public class GiveHash1{
public static void main(String [] args ){
int a=5;
int b=5;
Integer A = new Integer(5);
Integer B = new Integer(5);
System.out.println(a==b);
// System.out.println(a.equals(b)); primitives cannot be drefrenced
System.out.println(A==B);
System.out.println(A.equals(B));
}
} | 408 | 0.583333 | 0.571078 | 18 | 20.777779 | 17.466017 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.444444 | false | false | 10 |
0296f049e1dbcb014e7fa59459b3157b10f6a9f9 | 11,845,519,844,150 | 78e4b1de25ef2cd69d2063fe95f401fc2489ac52 | /src/main/java/com/giovannicarmo/projetocurso/carmoeletro/resources/exception/ResourceExeptionHandler.java | feb922a6bc872b73c058a16c7fea4049cddb87a3 | []
| no_license | giovannicarmo/springproject-carmoeletro | https://github.com/giovannicarmo/springproject-carmoeletro | c53c9c3c49d5942d23bf95c2e455b210c10059a7 | 1376440f358e4dc6263c322116caa6f93e3e6160 | refs/heads/master | 2021-09-14T03:54:23.218000 | 2018-05-02T20:55:17 | 2018-05-02T20:55:17 | 108,201,900 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.giovannicarmo.projetocurso.carmoeletro.resources.exception;
import com.amazonaws.AmazonClientException;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.services.s3.model.AmazonS3Exception;
import com.giovannicarmo.projetocurso.carmoeletro.services.exception.AuthorizationExcepition;
import com.giovannicarmo.projetocurso.carmoeletro.services.exception.DataIntegrityException;
import com.giovannicarmo.projetocurso.carmoeletro.services.exception.FileException;
import com.giovannicarmo.projetocurso.carmoeletro.services.exception.ObjectNotFoundException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@ControllerAdvice
public class ResourceExeptionHandler {
@ExceptionHandler(ObjectNotFoundException.class)
public ResponseEntity<StandardError> objectNotFound(ObjectNotFoundException e, HttpServletRequest request) {
StandardError error = new StandardError(HttpStatus.NOT_FOUND.value(), e.getMessage(),
System.currentTimeMillis());
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(error);
}
@ExceptionHandler(DataIntegrityException.class)
public ResponseEntity<StandardError> dataIntegrity(DataIntegrityException e, HttpServletRequest request) {
StandardError error = new StandardError(HttpStatus.BAD_REQUEST.value(), e.getMessage(),
System.currentTimeMillis());
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(error);
}
@ExceptionHandler(MethodArgumentNotValidException.class)
public ResponseEntity<StandardError> dataIntegrity(MethodArgumentNotValidException e, HttpServletRequest request) {
ValidationError error = new ValidationError(HttpStatus.BAD_REQUEST.value(), "Erro de validaçao",
System.currentTimeMillis());
for (FieldError x : e.getBindingResult().getFieldErrors()) {
error.addError(x.getField(), x.getDefaultMessage());
}
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(error);
}
@ExceptionHandler(AuthorizationExcepition.class)
public ResponseEntity<StandardError> authorization(AuthorizationExcepition e, HttpServletRequest request) {
StandardError error = new StandardError(HttpStatus.FORBIDDEN.value(), e.getMessage(),
System.currentTimeMillis());
return ResponseEntity.status(HttpStatus.FORBIDDEN).body(error);
}
@ExceptionHandler(FileException.class)
public ResponseEntity<StandardError> file(AuthorizationExcepition e, HttpServletRequest request) {
StandardError error = new StandardError(HttpStatus.BAD_REQUEST.value(), e.getMessage(),
System.currentTimeMillis());
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(error);
}
@ExceptionHandler(AmazonServiceException.class)
public ResponseEntity<StandardError> amazonService(AmazonServiceException e, HttpServletRequest request) {
HttpStatus code = HttpStatus.valueOf(e.getErrorCode());
StandardError error = new StandardError(code.value(), e.getMessage(), System.currentTimeMillis());
return ResponseEntity.status(code).body(error);
}
@ExceptionHandler(AmazonClientException.class)
public ResponseEntity<StandardError> amazonClient(AmazonClientException e, HttpServletRequest request) {
StandardError error = new StandardError(HttpStatus.BAD_REQUEST.value(), e.getMessage(),
System.currentTimeMillis());
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(error);
}
@ExceptionHandler(AmazonS3Exception.class)
public ResponseEntity<StandardError> amazonS3(AmazonS3Exception e, HttpServletRequest request) {
StandardError error = new StandardError(HttpStatus.BAD_REQUEST.value(), e.getMessage(),
System.currentTimeMillis());
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(error);
}
}
| UTF-8 | Java | 4,290 | java | ResourceExeptionHandler.java | Java | []
| null | []
| package com.giovannicarmo.projetocurso.carmoeletro.resources.exception;
import com.amazonaws.AmazonClientException;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.services.s3.model.AmazonS3Exception;
import com.giovannicarmo.projetocurso.carmoeletro.services.exception.AuthorizationExcepition;
import com.giovannicarmo.projetocurso.carmoeletro.services.exception.DataIntegrityException;
import com.giovannicarmo.projetocurso.carmoeletro.services.exception.FileException;
import com.giovannicarmo.projetocurso.carmoeletro.services.exception.ObjectNotFoundException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@ControllerAdvice
public class ResourceExeptionHandler {
@ExceptionHandler(ObjectNotFoundException.class)
public ResponseEntity<StandardError> objectNotFound(ObjectNotFoundException e, HttpServletRequest request) {
StandardError error = new StandardError(HttpStatus.NOT_FOUND.value(), e.getMessage(),
System.currentTimeMillis());
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(error);
}
@ExceptionHandler(DataIntegrityException.class)
public ResponseEntity<StandardError> dataIntegrity(DataIntegrityException e, HttpServletRequest request) {
StandardError error = new StandardError(HttpStatus.BAD_REQUEST.value(), e.getMessage(),
System.currentTimeMillis());
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(error);
}
@ExceptionHandler(MethodArgumentNotValidException.class)
public ResponseEntity<StandardError> dataIntegrity(MethodArgumentNotValidException e, HttpServletRequest request) {
ValidationError error = new ValidationError(HttpStatus.BAD_REQUEST.value(), "Erro de validaçao",
System.currentTimeMillis());
for (FieldError x : e.getBindingResult().getFieldErrors()) {
error.addError(x.getField(), x.getDefaultMessage());
}
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(error);
}
@ExceptionHandler(AuthorizationExcepition.class)
public ResponseEntity<StandardError> authorization(AuthorizationExcepition e, HttpServletRequest request) {
StandardError error = new StandardError(HttpStatus.FORBIDDEN.value(), e.getMessage(),
System.currentTimeMillis());
return ResponseEntity.status(HttpStatus.FORBIDDEN).body(error);
}
@ExceptionHandler(FileException.class)
public ResponseEntity<StandardError> file(AuthorizationExcepition e, HttpServletRequest request) {
StandardError error = new StandardError(HttpStatus.BAD_REQUEST.value(), e.getMessage(),
System.currentTimeMillis());
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(error);
}
@ExceptionHandler(AmazonServiceException.class)
public ResponseEntity<StandardError> amazonService(AmazonServiceException e, HttpServletRequest request) {
HttpStatus code = HttpStatus.valueOf(e.getErrorCode());
StandardError error = new StandardError(code.value(), e.getMessage(), System.currentTimeMillis());
return ResponseEntity.status(code).body(error);
}
@ExceptionHandler(AmazonClientException.class)
public ResponseEntity<StandardError> amazonClient(AmazonClientException e, HttpServletRequest request) {
StandardError error = new StandardError(HttpStatus.BAD_REQUEST.value(), e.getMessage(),
System.currentTimeMillis());
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(error);
}
@ExceptionHandler(AmazonS3Exception.class)
public ResponseEntity<StandardError> amazonS3(AmazonS3Exception e, HttpServletRequest request) {
StandardError error = new StandardError(HttpStatus.BAD_REQUEST.value(), e.getMessage(),
System.currentTimeMillis());
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(error);
}
}
| 4,290 | 0.768711 | 0.767545 | 89 | 47.19101 | 37.871716 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.662921 | false | false | 10 |
0190d9bbfad17e34af6d2c961a3564d866175855 | 11,845,519,844,131 | 20aefb09a95beeecf74fa1996f8cc2c693784107 | /core/src/main/java/com/googlecode/fitchy/util/Preconditions.java | dd9121a499c98782c5a456711a55d784ee31f198 | [
"Apache-2.0"
]
| permissive | ankaubisch/fitchy | https://github.com/ankaubisch/fitchy | 1a641b63aee141b0df92aa90fd00b2d77ad3f2b0 | 4288158b83139949205455b1d5e0fa91f7ac3c6a | refs/heads/master | 2021-05-26T13:24:29.316000 | 2013-03-18T20:39:13 | 2013-03-18T20:39:13 | 5,093,728 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | 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 com.googlecode.fitchy.util;
/**
* Utility class that provide methods that checks several conditions.
*
* User: Andreas Kaubisch <andreas.kaubisch@gmail.com>
* Date: 7/17/12
* Time: 8:49 PM
*/
public final class Preconditions {
/**
* hide constructor to prevent instantiation
*/
private Preconditions() {
}
/**
* Checks whether passed object is null or not. If object is null this static method
* will throw an {@link IllegalArgumentException} with a given {@param message}
* @param obj object that needs to be checked
* @param message message of exception
* @throws IllegalArgumentException exception will be thrown if object is null
*/
public static void throwIllegalArgumentExceptionIfNull(Object obj, String message) {
throwIllegalArgumentExceptionIfFalse(obj != null, message);
}
/**
* Checks whether condition is false and throw an {@link IllegalArgumentException}.
*
* @param conditionPass indicates whether a condition is occurred
* @param message the message a thrown {@link IllegalArgumentException}
*/
public static void throwIllegalArgumentExceptionIfFalse(boolean conditionPass, String message) {
if(!conditionPass) {
throw new IllegalArgumentException(message);
}
}
}
| UTF-8 | Java | 2,157 | java | Preconditions.java | Java | [
{
"context": "ethods that checks several conditions.\n *\n * User: Andreas Kaubisch <andreas.kaubisch@gmail.com>\n * Date: 7/17/12\n * ",
"end": 958,
"score": 0.999652624130249,
"start": 942,
"tag": "NAME",
"value": "Andreas Kaubisch"
},
{
"context": "several conditions.\n *\n * User: Andreas Kaubisch <andreas.kaubisch@gmail.com>\n * Date: 7/17/12\n * Time: 8:49 PM\n */\npublic fin",
"end": 986,
"score": 0.9999330639839172,
"start": 960,
"tag": "EMAIL",
"value": "andreas.kaubisch@gmail.com"
}
]
| 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 com.googlecode.fitchy.util;
/**
* Utility class that provide methods that checks several conditions.
*
* User: <NAME> <<EMAIL>>
* Date: 7/17/12
* Time: 8:49 PM
*/
public final class Preconditions {
/**
* hide constructor to prevent instantiation
*/
private Preconditions() {
}
/**
* Checks whether passed object is null or not. If object is null this static method
* will throw an {@link IllegalArgumentException} with a given {@param message}
* @param obj object that needs to be checked
* @param message message of exception
* @throws IllegalArgumentException exception will be thrown if object is null
*/
public static void throwIllegalArgumentExceptionIfNull(Object obj, String message) {
throwIllegalArgumentExceptionIfFalse(obj != null, message);
}
/**
* Checks whether condition is false and throw an {@link IllegalArgumentException}.
*
* @param conditionPass indicates whether a condition is occurred
* @param message the message a thrown {@link IllegalArgumentException}
*/
public static void throwIllegalArgumentExceptionIfFalse(boolean conditionPass, String message) {
if(!conditionPass) {
throw new IllegalArgumentException(message);
}
}
}
| 2,128 | 0.7121 | 0.706537 | 60 | 34.950001 | 30.781178 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.216667 | false | false | 10 |
f37c168569e04b337c8aa6f912ea7924627df81c | 12,111,807,835,444 | 85d73933c5c31bf2c5f64fc22ff47de8db5559a8 | /src/main/java/io/vertx/starter/MainVerticle.java | 5067cf14f85a99730680146776e451bb4cc8e610 | []
| no_license | tim-bad/vertx | https://github.com/tim-bad/vertx | 54bbfa6c950e675e42a824a2b5a3506f093cf99f | 0b012caba79c2ee34a971b4267e3a51401a64998 | refs/heads/master | 2021-09-10T05:20:01.547000 | 2018-03-21T03:19:47 | 2018-03-21T03:19:47 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package io.vertx.starter;
import io.vertx.core.AbstractVerticle;
public class MainVerticle extends AbstractVerticle {
private JDBCCleint dbClient;
private static final Logger LOGGER = LoggerFactory.getLogger(MainVerticle.class);
private static final string SQl_CREATE_PAGES_TABlE = "create table if not exists pages (id integer identity primary key, name varchar(255) unique, content clob)";
private static final string SQL_GET_PAGE = "select id, content from pages where name = ?";
private static final string SQL_CREATE_PAGE = "insert into pages values (null, ?, ?)";
private static final string SQL_SAVE_PAGE = "update pages set content = ? where id = ?";
private static final string SQL_ALL_PAGES = "select name from pages";
private static final string SQL_DELETE_PAGE = "delete from pages where id = ?";
@Override
public void start(Future<Void> startFuture) throws Exception {
Future<Void> steps = prepareDatabase().compose(v -> startHttpServer());
steps.setHandler(ar -> {
if(ar.succeeded(){
startFuture.complete();
}else{
startFuture.fail(ar.cause());
}
});
}
private Future<Void> prepareDatabase(){
Future<Void> future = Future.future();
//(....)
dbClient = JDBCClient.createShared(vertx, new JsonObject()
.put("url","jdbc:hsqldb:file:db/wiki")
.put("driver_class", "org.hsqldb.jdbcDirver")
.put("max_pool_size",30);
dbClient.getConnection(ar -> {
if(ar.failed()){
LOGGER.error("Could not open a database connection", ar.cause());
futur.fail(ar.cause());
}else{
SQLConnection connection = ar.result();
connection.execute(SQl_CREATE_PAGES_TABlE, create -> {
connection.close();
if (create.failed()){
LOGGER.error("Database preparation error", create.cause());
future.fail(create.cause());
}else {
future.complete();
}
}
}
});
return future;
}
private Future<Void> startHttpServer(){
Future<Void> future = Future.future();
HttpServer server = vertx.createtHttpServer();
Router router = Router.router(vertx);
router.get("/").handler(this::indexHandler);
router.get"/wiki/:page").handler(this::pageRenderingHandler);
router.post().handler(BodyHandler.create());
router.post("/save").handler(this::pageUpdateHandler);
router.post("/create").handler(this::pageCreateHandler);
router.post("/delete").handler(this::pageDeletionHandler);
server
.requestHandler(router::accept)
.listen(8080, ar -> {
if(ar.succeeded()){
LOGGER.info("HTTP server running on port 8080");
future.complete();
}else{
LOGGER.error("Could not start a HTTP server", ar.cause());
future.fail(ar.cause());
}
}
// hello
return future;
}
}
| UTF-8 | Java | 2,759 | java | MainVerticle.java | Java | []
| null | []
| package io.vertx.starter;
import io.vertx.core.AbstractVerticle;
public class MainVerticle extends AbstractVerticle {
private JDBCCleint dbClient;
private static final Logger LOGGER = LoggerFactory.getLogger(MainVerticle.class);
private static final string SQl_CREATE_PAGES_TABlE = "create table if not exists pages (id integer identity primary key, name varchar(255) unique, content clob)";
private static final string SQL_GET_PAGE = "select id, content from pages where name = ?";
private static final string SQL_CREATE_PAGE = "insert into pages values (null, ?, ?)";
private static final string SQL_SAVE_PAGE = "update pages set content = ? where id = ?";
private static final string SQL_ALL_PAGES = "select name from pages";
private static final string SQL_DELETE_PAGE = "delete from pages where id = ?";
@Override
public void start(Future<Void> startFuture) throws Exception {
Future<Void> steps = prepareDatabase().compose(v -> startHttpServer());
steps.setHandler(ar -> {
if(ar.succeeded(){
startFuture.complete();
}else{
startFuture.fail(ar.cause());
}
});
}
private Future<Void> prepareDatabase(){
Future<Void> future = Future.future();
//(....)
dbClient = JDBCClient.createShared(vertx, new JsonObject()
.put("url","jdbc:hsqldb:file:db/wiki")
.put("driver_class", "org.hsqldb.jdbcDirver")
.put("max_pool_size",30);
dbClient.getConnection(ar -> {
if(ar.failed()){
LOGGER.error("Could not open a database connection", ar.cause());
futur.fail(ar.cause());
}else{
SQLConnection connection = ar.result();
connection.execute(SQl_CREATE_PAGES_TABlE, create -> {
connection.close();
if (create.failed()){
LOGGER.error("Database preparation error", create.cause());
future.fail(create.cause());
}else {
future.complete();
}
}
}
});
return future;
}
private Future<Void> startHttpServer(){
Future<Void> future = Future.future();
HttpServer server = vertx.createtHttpServer();
Router router = Router.router(vertx);
router.get("/").handler(this::indexHandler);
router.get"/wiki/:page").handler(this::pageRenderingHandler);
router.post().handler(BodyHandler.create());
router.post("/save").handler(this::pageUpdateHandler);
router.post("/create").handler(this::pageCreateHandler);
router.post("/delete").handler(this::pageDeletionHandler);
server
.requestHandler(router::accept)
.listen(8080, ar -> {
if(ar.succeeded()){
LOGGER.info("HTTP server running on port 8080");
future.complete();
}else{
LOGGER.error("Could not start a HTTP server", ar.cause());
future.fail(ar.cause());
}
}
// hello
return future;
}
}
| 2,759 | 0.673795 | 0.669083 | 88 | 30.352272 | 29.562353 | 164 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.193182 | false | false | 10 |
d800c7d4bb240521112a660e76c68187b9a95c6a | 20,057,497,321,081 | 29159bc4c137fe9104d831a5efe346935eeb2db5 | /mmj-cloud-active/src/main/java/com/mmj/active/cut/service/impl/CutAwardServiceImpl.java | 370e6867e7e2733ec80553679d113d9d28c91c44 | []
| no_license | xddpool/mmj-cloud | https://github.com/xddpool/mmj-cloud | bfb06d2ef08c9e7b967c63f223fc50b1a56aac1c | de4bcb35db509ce929d516d83de765fdc2afdac5 | refs/heads/master | 2023-06-27T11:16:38.059000 | 2020-07-24T03:23:48 | 2020-07-24T03:23:48 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.mmj.active.cut.service.impl;
import com.mmj.active.cut.model.CutAward;
import com.mmj.active.cut.mapper.CutAwardMapper;
import com.mmj.active.cut.service.CutAwardService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 砍价奖励表 服务实现类
* </p>
*
* @author KK
* @since 2019-06-10
*/
@Service
public class CutAwardServiceImpl extends ServiceImpl<CutAwardMapper, CutAward> implements CutAwardService {
}
| UTF-8 | Java | 526 | java | CutAwardServiceImpl.java | Java | [
{
"context": "*\r\n * <p>\r\n * 砍价奖励表 服务实现类\r\n * </p>\r\n *\r\n * @author KK\r\n * @since 2019-06-10\r\n */\r\n@Service\r\npublic clas",
"end": 353,
"score": 0.9996395707130432,
"start": 351,
"tag": "USERNAME",
"value": "KK"
}
]
| null | []
| package com.mmj.active.cut.service.impl;
import com.mmj.active.cut.model.CutAward;
import com.mmj.active.cut.mapper.CutAwardMapper;
import com.mmj.active.cut.service.CutAwardService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 砍价奖励表 服务实现类
* </p>
*
* @author KK
* @since 2019-06-10
*/
@Service
public class CutAwardServiceImpl extends ServiceImpl<CutAwardMapper, CutAward> implements CutAwardService {
}
| 526 | 0.745059 | 0.729249 | 20 | 23.299999 | 27.36622 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.35 | false | false | 10 |
f2aa689f6c9ee8c42ac994a35071cc53d38825bd | 22,342,419,940,821 | 87a8c54452ec411f0ca73d09c351b07c2524fc37 | /src/main/java/net/opecko/logback/appenders/flume/FlumeAvroManager.java | 7477429aa302fbec7f3387da6168eaf5b76e3399 | [
"Apache-2.0"
]
| permissive | jopecko/logback-flume-ng | https://github.com/jopecko/logback-flume-ng | 097c79d40fcb6f61d96a8bf4c149ecdd7b10908a | e908ac05ab6202c7ff78cf7d385eeb1387f2362e | refs/heads/master | 2020-06-04T21:43:55.192000 | 2013-08-12T21:47:46 | 2013-08-12T21:47:46 | 11,936,861 | 1 | 4 | null | null | null | null | null | null | null | null | null | null | null | null | 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 net.opecko.logback.appenders.flume;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.avro.AvroRemoteException;
import org.apache.avro.ipc.NettyTransceiver;
import org.apache.avro.ipc.Transceiver;
import org.apache.avro.ipc.specific.SpecificRequestor;
import org.apache.flume.Event;
import org.apache.flume.source.avro.AvroFlumeEvent;
import org.apache.flume.source.avro.AvroSourceProtocol;
import org.apache.flume.source.avro.Status;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Manager for FlumeAvroAppenders.
*/
public class FlumeAvroManager extends FlumeManager {
private static final Logger LOGGER = LoggerFactory.getLogger(FlumeAvroManager.class);
/**
* The default reconnection delay (500 milliseconds or .5 seconds).
*/
public static final int DEFAULT_RECONNECTION_DELAY = 500;
private static final int DEFAULT_RECONNECTS = 3;
private static AvroManagerFactory factory = new AvroManagerFactory();
private AvroSourceProtocol client;
private final List<Agent> agents;
private final int batchSize;
private final EventList events = new EventList();
private int current = 0;
private Transceiver transceiver;
/**
* @param name The unique name of this manager.
* @param agents An array of Agents.
* @param batchSize The number of events to include in a batch.
*/
protected FlumeAvroManager(
final String name,
final String shortName,
final List<Agent> agents,
final int batchSize
) {
super(name);
this.agents = agents;
this.batchSize = batchSize;
this.client = connect(agents);
}
/**
* Returns a FlumeAvroManager
*
* @param name The name of the manager.
* @param agents The agents to use.
* @param batchSize The number of events to include in a batch.
* @return A FlumeAvroManager.
*/
public static FlumeAvroManager getManager(final String name, final List<Agent> agents, int batchSize) {
if (agents == null || agents.size() == 0) {
throw new IllegalArgumentException("At least one agent is required");
}
if (batchSize <= 0) {
batchSize = 1;
}
final StringBuilder sb = new StringBuilder("FlumeAvro[");
boolean first = true;
for (final Agent agent : agents) {
if (!first) {
sb.append(",");
}
sb.append(agent.getHost()).append(":").append(agent.getPort());
first = false;
}
sb.append("]");
return getManager(sb.toString(), factory, new FactoryData(name, agents, batchSize));
}
/**
* Returns the index of the current agent
*
* @return The index for the current agent.
*/
public int getCurrent() {
return current;
}
@Override
public synchronized void send(final Event event, int delay, int retries) {
if (delay == 0) {
delay = DEFAULT_RECONNECTION_DELAY;
}
if (retries == 0) {
retries = DEFAULT_RECONNECTS;
}
if (client == null) {
client = connect(agents);
}
String msg = "No Flume agents are available";
if (client != null) {
final AvroFlumeEvent avroEvent = new AvroFlumeEvent();
avroEvent.setBody(ByteBuffer.wrap(event.getBody()));
avroEvent.setHeaders(new HashMap<CharSequence, CharSequence>());
for (final Map.Entry<String, String> entry : event.getHeaders().entrySet()) {
avroEvent.getHeaders().put(entry.getKey(), entry.getValue());
}
final List<AvroFlumeEvent> batch = batchSize > 1 ? events.addAndGet(avroEvent, batchSize) : null;
if (batch == null && batchSize > 1) {
return;
}
int i = 0;
msg = "Error writing to " + getName();
do {
try {
final Status status = (batch == null) ? client.append(avroEvent) : client.appendBatch(batch);
if (!status.equals(Status.OK)) {
throw new AvroRemoteException("RPC communication failed to " + agents.get(current).getHost() +
":" + agents.get(current).getPort());
}
return;
} catch (final Exception ex) {
if (i == retries - 1) {
msg = "Error writing to " + getName() + " at " + agents.get(current).getHost() + ":" +
agents.get(current).getPort();
LOGGER.warn(msg, ex);
break;
}
sleep(delay);
}
} while (++i < retries);
for (int index = 0; index < agents.size(); ++index) {
if (index == current) {
continue;
}
final Agent agent = agents.get(index);
i = 0;
do {
try {
transceiver = null;
final AvroSourceProtocol c = connect(agent.getHost(), agent.getPort());
final Status status = (batch == null) ? c.append(avroEvent) : c.appendBatch(batch);
if (!status.equals(Status.OK)) {
if (i == retries - 1) {
final String warnMsg = "RPC communication failed to " + getName() + " at " +
agent.getHost() + ":" + agent.getPort();
LOGGER.warn(warnMsg);
}
continue;
}
client = c;
current = i;
return;
} catch (final Exception ex) {
if (i == retries - 1) {
final String warnMsg = "Error writing to " + getName() + " at " + agent.getHost() + ":" +
agent.getPort();
LOGGER.warn(warnMsg, ex);
break;
}
sleep(delay);
}
} while (++i < retries);
}
}
throw new RuntimeException(msg);
}
private void sleep(final int delay) {
try {
Thread.sleep(delay);
} catch (final InterruptedException ex) {
Thread.currentThread().interrupt();
}
}
/**
* There is a very good chance that this will always return the first agent even if it isn't available.
* @param agents The list of agents to choose from
* @return The FlumeEventAvroServer.
*/
private AvroSourceProtocol connect(final List<Agent> agents) {
int i = 0;
for (final Agent agent : agents) {
final AvroSourceProtocol server = connect(agent.getHost(), agent.getPort());
if (server != null) {
current = i;
return server;
}
++i;
}
LOGGER.error("Flume manager " + getName() + " was unable to connect to any agents");
return null;
}
private AvroSourceProtocol connect(final String hostname, final int port) {
try {
if (transceiver == null) {
transceiver = new NettyTransceiver(new InetSocketAddress(hostname, port));
}
} catch (final IOException ioe) {
LOGGER.error("Unable to create transceiver", ioe);
return null;
}
try {
return SpecificRequestor.getClient(AvroSourceProtocol.class, transceiver);
} catch (final IOException ioe) {
LOGGER.error("Unable to create Avro client");
return null;
}
}
@Override
protected void releaseSub() {
if (transceiver != null) {
try {
transceiver.close();
} catch (final IOException ioe) {
LOGGER.error("Attempt to clean up Avro transceiver failed", ioe);
}
}
client = null;
}
/**
* Thread-safe List management of a batch.
*/
private static class EventList extends ArrayList<AvroFlumeEvent> {
/**
* Generated serial version ID.
*/
private static final long serialVersionUID = 20130806L;
public synchronized List<AvroFlumeEvent> addAndGet(final AvroFlumeEvent event, final int batchSize) {
super.add(event);
if (this.size() >= batchSize) {
final List<AvroFlumeEvent> events = new ArrayList<AvroFlumeEvent>();
events.addAll(this);
clear();
return events;
} else {
return null;
}
}
}
/**
* Factory data.
*/
private static class FactoryData {
private final String name;
private final List<Agent> agents;
private final int batchSize;
/**
* Constructor.
* @param name The name of the Appender.
* @param agents The agents.
* @param batchSize The number of events to include in a batch.
*/
public FactoryData(final String name, final List<Agent> agents, final int batchSize) {
this.name = name;
this.agents = agents;
this.batchSize = batchSize;
}
}
/**
* Avro Manager Factory.
*/
private static class AvroManagerFactory implements ManagerFactory<FlumeAvroManager, FactoryData> {
/**
* Create the FlumeAvroManager.
* @param name The name of the entity to manage.
* @param data The data required to create the entity.
* @return The FlumeAvroManager.
*/
@Override
public FlumeAvroManager createManager(final String name, final FactoryData data) {
try {
return new FlumeAvroManager(name, data.name, data.agents, data.batchSize);
} catch (final Exception ex) {
LOGGER.error("Could not create FlumeAvroManager", ex);
}
return null;
}
}
}
| UTF-8 | Java | 9,981 | java | FlumeAvroManager.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 net.opecko.logback.appenders.flume;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.avro.AvroRemoteException;
import org.apache.avro.ipc.NettyTransceiver;
import org.apache.avro.ipc.Transceiver;
import org.apache.avro.ipc.specific.SpecificRequestor;
import org.apache.flume.Event;
import org.apache.flume.source.avro.AvroFlumeEvent;
import org.apache.flume.source.avro.AvroSourceProtocol;
import org.apache.flume.source.avro.Status;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Manager for FlumeAvroAppenders.
*/
public class FlumeAvroManager extends FlumeManager {
private static final Logger LOGGER = LoggerFactory.getLogger(FlumeAvroManager.class);
/**
* The default reconnection delay (500 milliseconds or .5 seconds).
*/
public static final int DEFAULT_RECONNECTION_DELAY = 500;
private static final int DEFAULT_RECONNECTS = 3;
private static AvroManagerFactory factory = new AvroManagerFactory();
private AvroSourceProtocol client;
private final List<Agent> agents;
private final int batchSize;
private final EventList events = new EventList();
private int current = 0;
private Transceiver transceiver;
/**
* @param name The unique name of this manager.
* @param agents An array of Agents.
* @param batchSize The number of events to include in a batch.
*/
protected FlumeAvroManager(
final String name,
final String shortName,
final List<Agent> agents,
final int batchSize
) {
super(name);
this.agents = agents;
this.batchSize = batchSize;
this.client = connect(agents);
}
/**
* Returns a FlumeAvroManager
*
* @param name The name of the manager.
* @param agents The agents to use.
* @param batchSize The number of events to include in a batch.
* @return A FlumeAvroManager.
*/
public static FlumeAvroManager getManager(final String name, final List<Agent> agents, int batchSize) {
if (agents == null || agents.size() == 0) {
throw new IllegalArgumentException("At least one agent is required");
}
if (batchSize <= 0) {
batchSize = 1;
}
final StringBuilder sb = new StringBuilder("FlumeAvro[");
boolean first = true;
for (final Agent agent : agents) {
if (!first) {
sb.append(",");
}
sb.append(agent.getHost()).append(":").append(agent.getPort());
first = false;
}
sb.append("]");
return getManager(sb.toString(), factory, new FactoryData(name, agents, batchSize));
}
/**
* Returns the index of the current agent
*
* @return The index for the current agent.
*/
public int getCurrent() {
return current;
}
@Override
public synchronized void send(final Event event, int delay, int retries) {
if (delay == 0) {
delay = DEFAULT_RECONNECTION_DELAY;
}
if (retries == 0) {
retries = DEFAULT_RECONNECTS;
}
if (client == null) {
client = connect(agents);
}
String msg = "No Flume agents are available";
if (client != null) {
final AvroFlumeEvent avroEvent = new AvroFlumeEvent();
avroEvent.setBody(ByteBuffer.wrap(event.getBody()));
avroEvent.setHeaders(new HashMap<CharSequence, CharSequence>());
for (final Map.Entry<String, String> entry : event.getHeaders().entrySet()) {
avroEvent.getHeaders().put(entry.getKey(), entry.getValue());
}
final List<AvroFlumeEvent> batch = batchSize > 1 ? events.addAndGet(avroEvent, batchSize) : null;
if (batch == null && batchSize > 1) {
return;
}
int i = 0;
msg = "Error writing to " + getName();
do {
try {
final Status status = (batch == null) ? client.append(avroEvent) : client.appendBatch(batch);
if (!status.equals(Status.OK)) {
throw new AvroRemoteException("RPC communication failed to " + agents.get(current).getHost() +
":" + agents.get(current).getPort());
}
return;
} catch (final Exception ex) {
if (i == retries - 1) {
msg = "Error writing to " + getName() + " at " + agents.get(current).getHost() + ":" +
agents.get(current).getPort();
LOGGER.warn(msg, ex);
break;
}
sleep(delay);
}
} while (++i < retries);
for (int index = 0; index < agents.size(); ++index) {
if (index == current) {
continue;
}
final Agent agent = agents.get(index);
i = 0;
do {
try {
transceiver = null;
final AvroSourceProtocol c = connect(agent.getHost(), agent.getPort());
final Status status = (batch == null) ? c.append(avroEvent) : c.appendBatch(batch);
if (!status.equals(Status.OK)) {
if (i == retries - 1) {
final String warnMsg = "RPC communication failed to " + getName() + " at " +
agent.getHost() + ":" + agent.getPort();
LOGGER.warn(warnMsg);
}
continue;
}
client = c;
current = i;
return;
} catch (final Exception ex) {
if (i == retries - 1) {
final String warnMsg = "Error writing to " + getName() + " at " + agent.getHost() + ":" +
agent.getPort();
LOGGER.warn(warnMsg, ex);
break;
}
sleep(delay);
}
} while (++i < retries);
}
}
throw new RuntimeException(msg);
}
private void sleep(final int delay) {
try {
Thread.sleep(delay);
} catch (final InterruptedException ex) {
Thread.currentThread().interrupt();
}
}
/**
* There is a very good chance that this will always return the first agent even if it isn't available.
* @param agents The list of agents to choose from
* @return The FlumeEventAvroServer.
*/
private AvroSourceProtocol connect(final List<Agent> agents) {
int i = 0;
for (final Agent agent : agents) {
final AvroSourceProtocol server = connect(agent.getHost(), agent.getPort());
if (server != null) {
current = i;
return server;
}
++i;
}
LOGGER.error("Flume manager " + getName() + " was unable to connect to any agents");
return null;
}
private AvroSourceProtocol connect(final String hostname, final int port) {
try {
if (transceiver == null) {
transceiver = new NettyTransceiver(new InetSocketAddress(hostname, port));
}
} catch (final IOException ioe) {
LOGGER.error("Unable to create transceiver", ioe);
return null;
}
try {
return SpecificRequestor.getClient(AvroSourceProtocol.class, transceiver);
} catch (final IOException ioe) {
LOGGER.error("Unable to create Avro client");
return null;
}
}
@Override
protected void releaseSub() {
if (transceiver != null) {
try {
transceiver.close();
} catch (final IOException ioe) {
LOGGER.error("Attempt to clean up Avro transceiver failed", ioe);
}
}
client = null;
}
/**
* Thread-safe List management of a batch.
*/
private static class EventList extends ArrayList<AvroFlumeEvent> {
/**
* Generated serial version ID.
*/
private static final long serialVersionUID = 20130806L;
public synchronized List<AvroFlumeEvent> addAndGet(final AvroFlumeEvent event, final int batchSize) {
super.add(event);
if (this.size() >= batchSize) {
final List<AvroFlumeEvent> events = new ArrayList<AvroFlumeEvent>();
events.addAll(this);
clear();
return events;
} else {
return null;
}
}
}
/**
* Factory data.
*/
private static class FactoryData {
private final String name;
private final List<Agent> agents;
private final int batchSize;
/**
* Constructor.
* @param name The name of the Appender.
* @param agents The agents.
* @param batchSize The number of events to include in a batch.
*/
public FactoryData(final String name, final List<Agent> agents, final int batchSize) {
this.name = name;
this.agents = agents;
this.batchSize = batchSize;
}
}
/**
* Avro Manager Factory.
*/
private static class AvroManagerFactory implements ManagerFactory<FlumeAvroManager, FactoryData> {
/**
* Create the FlumeAvroManager.
* @param name The name of the entity to manage.
* @param data The data required to create the entity.
* @return The FlumeAvroManager.
*/
@Override
public FlumeAvroManager createManager(final String name, final FactoryData data) {
try {
return new FlumeAvroManager(name, data.name, data.agents, data.batchSize);
} catch (final Exception ex) {
LOGGER.error("Could not create FlumeAvroManager", ex);
}
return null;
}
}
}
| 9,981 | 0.62639 | 0.622683 | 322 | 29.996895 | 26.771231 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.487578 | false | false | 10 |
94adc7bf5a81596bb9787698d176dd387152906a | 17,480,516,897,431 | 656882f25331be6994b177eca5cffd6004861550 | /src/main/java/mx/sintelti/spring/entity/Persona.java | bf0d0553923dda07c1f2aaf167e2c898640c083b | []
| no_license | jverde48/JSF-SPRING-HIBERNATE | https://github.com/jverde48/JSF-SPRING-HIBERNATE | afcd28e0ddb1f3a4924ba1dcdf2f2b11ce266003 | 6921c09fb4e4114b5aa143d45eee1375ae2fb0b5 | refs/heads/master | 2022-08-25T13:46:58.774000 | 2020-06-02T02:47:41 | 2020-06-02T02:47:41 | 38,519,907 | 0 | 1 | null | false | 2022-08-11T21:17:16 | 2015-07-04T03:18:18 | 2020-06-02T02:47:44 | 2022-08-11T21:17:13 | 3,615 | 0 | 1 | 1 | Java | false | false | package mx.sintelti.spring.entity;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;
@Entity
@Table(name="PERSONA")
public class Persona implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name="NOMBRE", nullable=false, length=50)
private String nombre;
@Column(name="PRIMER_APELLIDO", nullable=false, length=50)
private String primerApellido;
@Column(name="SEGUNDO_APELLIDO", nullable=true, length=50)
private String segundoApellido;
@Column(name="EDAD", nullable=false)
private Integer edad;
@Column(name="FECHA_NACIMIENTO", nullable=false)
private Date fechaNacimiento;
@Column(name="EMAIL", nullable=false, length=50)
private String correoElectronico;
@Column(name="USUARIO", nullable=false, length=50)
private String usuario;
@Column(name="CONTRASENIA", nullable=false)
private String contrasenia;
@OneToOne(cascade=CascadeType.ALL)
private Direccion direccion;
public Persona() {}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getPrimerApellido() {
return primerApellido;
}
public void setPrimerApellido(String primerApellido) {
this.primerApellido = primerApellido;
}
public String getSegundoApellido() {
return segundoApellido;
}
public void setSegundoApellido(String segundoApellido) {
this.segundoApellido = segundoApellido;
}
public Integer getEdad() {
return edad;
}
public void setEdad(Integer edad) {
this.edad = edad;
}
public Date getFechaNacimiento() {
return fechaNacimiento;
}
public void setFechaNacimiento(Date fechaNacimiento) {
this.fechaNacimiento = fechaNacimiento;
}
public String getCorreoElectronico() {
return correoElectronico;
}
public void setCorreoElectronico(String correoElectronico) {
this.correoElectronico = correoElectronico;
}
public String getUsuario() {
return usuario;
}
public void setUsuario(String usuario) {
this.usuario = usuario;
}
public String getContrasenia() {
return contrasenia;
}
public void setContrasenia(String contrasenia) {
this.contrasenia = contrasenia;
}
public Direccion getDireccion() {
return direccion;
}
public void setDireccion(Direccion direccion) {
this.direccion = direccion;
}
@Override
public String toString() {
return nombre + " " + primerApellido + " " + segundoApellido;
}
}
| UTF-8 | Java | 2,868 | java | Persona.java | Java | []
| null | []
| package mx.sintelti.spring.entity;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;
@Entity
@Table(name="PERSONA")
public class Persona implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name="NOMBRE", nullable=false, length=50)
private String nombre;
@Column(name="PRIMER_APELLIDO", nullable=false, length=50)
private String primerApellido;
@Column(name="SEGUNDO_APELLIDO", nullable=true, length=50)
private String segundoApellido;
@Column(name="EDAD", nullable=false)
private Integer edad;
@Column(name="FECHA_NACIMIENTO", nullable=false)
private Date fechaNacimiento;
@Column(name="EMAIL", nullable=false, length=50)
private String correoElectronico;
@Column(name="USUARIO", nullable=false, length=50)
private String usuario;
@Column(name="CONTRASENIA", nullable=false)
private String contrasenia;
@OneToOne(cascade=CascadeType.ALL)
private Direccion direccion;
public Persona() {}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getPrimerApellido() {
return primerApellido;
}
public void setPrimerApellido(String primerApellido) {
this.primerApellido = primerApellido;
}
public String getSegundoApellido() {
return segundoApellido;
}
public void setSegundoApellido(String segundoApellido) {
this.segundoApellido = segundoApellido;
}
public Integer getEdad() {
return edad;
}
public void setEdad(Integer edad) {
this.edad = edad;
}
public Date getFechaNacimiento() {
return fechaNacimiento;
}
public void setFechaNacimiento(Date fechaNacimiento) {
this.fechaNacimiento = fechaNacimiento;
}
public String getCorreoElectronico() {
return correoElectronico;
}
public void setCorreoElectronico(String correoElectronico) {
this.correoElectronico = correoElectronico;
}
public String getUsuario() {
return usuario;
}
public void setUsuario(String usuario) {
this.usuario = usuario;
}
public String getContrasenia() {
return contrasenia;
}
public void setContrasenia(String contrasenia) {
this.contrasenia = contrasenia;
}
public Direccion getDireccion() {
return direccion;
}
public void setDireccion(Direccion direccion) {
this.direccion = direccion;
}
@Override
public String toString() {
return nombre + " " + primerApellido + " " + segundoApellido;
}
}
| 2,868 | 0.746862 | 0.743026 | 140 | 19.485714 | 18.742422 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.342857 | false | false | 10 |
3bdd78ea0baa3af73ef27a4de5c95a1a8f866914 | 18,116,172,093,267 | 26f3495d91dc155edbcea56e9a9757693424f548 | /Ex 1/src/MVCDriver.java | 575090b4aa43d9e05c553fd28a86b4f85a60bfd7 | []
| no_license | SOFE3650/Assignment3 | https://github.com/SOFE3650/Assignment3 | 3a73865f1384af8ad7838750803165a7c60dd248 | 300ed3b13c1fe86c8df141f7e4360601c2a99b65 | refs/heads/main | 2023-08-29T14:09:38.062000 | 2021-10-13T01:46:12 | 2021-10-13T01:46:12 | 416,493,203 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | public class MVCDriver {
public static void main(String[] args){
//Creates a new Display and TicketPrinter to use as our views
Display display=new Display();
TicketPrinter printer=new TicketPrinter();
//Creates a new CashRegister with the display and printer views to use as our Model
CashRegister model=new CashRegister(display,printer);
//Creates a new Keyboard and Scanner with the model to use as our Controllers
Keyboard keys=new Keyboard(model);
Scanner scan=new Scanner(model);
//Small functionality test of controllers and views
scan.scannedUPCCode(10);
keys.updateDisplay();
keys.setUPCCode(11);
keys.updateTicket();
}
}
| UTF-8 | Java | 767 | java | MVCDriver.java | Java | []
| null | []
| public class MVCDriver {
public static void main(String[] args){
//Creates a new Display and TicketPrinter to use as our views
Display display=new Display();
TicketPrinter printer=new TicketPrinter();
//Creates a new CashRegister with the display and printer views to use as our Model
CashRegister model=new CashRegister(display,printer);
//Creates a new Keyboard and Scanner with the model to use as our Controllers
Keyboard keys=new Keyboard(model);
Scanner scan=new Scanner(model);
//Small functionality test of controllers and views
scan.scannedUPCCode(10);
keys.updateDisplay();
keys.setUPCCode(11);
keys.updateTicket();
}
}
| 767 | 0.65189 | 0.646675 | 21 | 34.523811 | 27.282681 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.47619 | false | false | 10 |
c2a648fb3c255631ee3836f34721cbeeae629b63 | 21,603,685,554,681 | ff8ff4b1b1104ae44fe683d79bbe01e83b441fbd | /RBO/src/main/java/com/flying/api/controller/LoginController.java | 19c7e24964c8c77816d51b60fb6559f788b6561b | []
| no_license | flyingJiang/JavaVueEasyUI | https://github.com/flyingJiang/JavaVueEasyUI | b73efcf5f7a79432165dfc717ea922a23ad816f1 | 460f95f73727699c0bcfdfa6c9730cca49ea55ca | refs/heads/master | 2022-06-24T02:28:35.835000 | 2019-12-09T11:33:38 | 2019-12-09T11:33:38 | 226,854,145 | 3 | 1 | null | false | 2022-06-17T02:43:25 | 2019-12-09T11:21:57 | 2022-05-07T08:42:13 | 2022-06-17T02:43:22 | 2,963 | 3 | 1 | 24 | CSS | false | false | package com.flying.api.controller;
import com.flying.model.entity.User;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/rest")
public class LoginController {
@RequestMapping(value = "/Login", method = {RequestMethod.POST, RequestMethod.GET})
public boolean Login(@RequestBody User user){
System.out.println("userName: " + user.toString());
return Boolean.TRUE;
}
}
| UTF-8 | Java | 631 | java | LoginController.java | Java | []
| null | []
| package com.flying.api.controller;
import com.flying.model.entity.User;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/rest")
public class LoginController {
@RequestMapping(value = "/Login", method = {RequestMethod.POST, RequestMethod.GET})
public boolean Login(@RequestBody User user){
System.out.println("userName: " + user.toString());
return Boolean.TRUE;
}
}
| 631 | 0.770206 | 0.770206 | 18 | 34.055557 | 26.401751 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.555556 | false | false | 10 |
265169ca278849bebbf43e7cabb0ed08a83d4c7c | 12,945,031,468,348 | ede8647f50384cfc91428970a4733f4461daf7c7 | /Daniujia/daniujia/src/main/java/com/xiaojia/daniujia/ui/frag/CommitSuccessFragment.java | 097b730d5141992a6fe9e0178b5696cda15d7fac | []
| no_license | ZLOVE320483/Daniujia | https://github.com/ZLOVE320483/Daniujia | b58e577a7ecaa3c02b51b616daa06d458dd18fc1 | db83c139a7010192a2846b90d7a40b4a58b4a242 | refs/heads/master | 2021-01-19T09:55:08.845000 | 2017-02-16T07:18:16 | 2017-02-16T07:18:16 | 82,150,935 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.xiaojia.daniujia.ui.frag;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextPaint;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.view.View;
import android.widget.TextView;
import com.xiaojia.daniujia.IntentKey;
import com.xiaojia.daniujia.PrefKeyConst;
import com.xiaojia.daniujia.R;
import com.xiaojia.daniujia.ui.act.ActLogin;
import com.xiaojia.daniujia.ui.act.ActMain;
import com.xiaojia.daniujia.utils.SysUtil;
/**
* Created by Administrator on 2016/10/18.
*/
public class CommitSuccessFragment extends BaseFragment {
private TextView mTvContact;
@Override
protected int getInflateLayout() {
return R.layout.frag_commit_success;
}
@Override
protected void setUpView(View view) {
setBackButton(view.findViewById(R.id.id_back));
((TextView) view.findViewById(R.id.id_title)).setText("提交成功");
mTvContact = (TextView) view.findViewById(R.id.commit_success_tv_contact);
}
@Override
public void onResume() {
super.onResume();
initView();
}
private void initView(){
if (SysUtil.getBooleanPref(PrefKeyConst.PREF_IS_LOGIN)){
String blueText = "大牛家客服";
SpannableString loginSpan = new SpannableString(blueText);
ClickableSpan clickableSpan = new ShowClickableSpan(blueText,getActivity());
loginSpan.setSpan(clickableSpan, 0, blueText.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
mTvContact.setText("您也可以直接和");
mTvContact.append(loginSpan);
mTvContact.append("进行沟通,或者拨打客服电话");
} else {
String blueText = "登录";
SpannableString loginSpan = new SpannableString(blueText);
ClickableSpan clickableSpan = new ShowClickableSpan(blueText,getActivity());
loginSpan.setSpan(clickableSpan, 0, blueText.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
mTvContact.setText("您也可以");
mTvContact.append(loginSpan);
mTvContact.append("后直接和大牛家客服进行沟通,或者拨打客服电话");
}
String phone = "4000903022";
SpannableString phoneSpan = new SpannableString(phone);
ClickableSpan clickablePhone = new MyLinkSpan(phone);
phoneSpan.setSpan(clickablePhone, 0, phone.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
mTvContact.append(phoneSpan);
mTvContact.append("与我们联系。");
mTvContact.setHighlightColor(Color.TRANSPARENT);
mTvContact.setMovementMethod(LinkMovementMethod.getInstance());
}
public class ShowClickableSpan extends ClickableSpan {
String string;
Context context;
public ShowClickableSpan(String str,Context context){
super();
this.string = str;
this.context = context;
}
@Override
public void updateDrawState(TextPaint ds) {
ds.setColor(0xff2c90de);
}
@Override
public void onClick(View widget) {
if (string != null) {
if (string.equals("登录")) {
Intent intent = new Intent(getActivity(), ActLogin.class);
startActivity(intent);
} else {
Intent intent = new Intent(getActivity(), ActMain.class);
intent.putExtra(IntentKey.INTENT_KEY_CHAT_TOPIC, "eric");
startActivity(intent);
}
}
}
}
public class MyLinkSpan extends ClickableSpan{
private String phone;
public MyLinkSpan(String phone) {
this.phone = phone;
}
@Override
public void onClick(View widget) {
Intent intent = new Intent(Intent.ACTION_DIAL);
Uri data = Uri.parse("tel:" + phone);
intent.setData(data);
startActivity(intent);
}
@Override
public void updateDrawState(TextPaint ds) {
super.updateDrawState(ds);
ds.setColor(0xff888888); //设置文件颜色
ds.setUnderlineText(true);
}
}
}
| UTF-8 | Java | 4,426 | java | CommitSuccessFragment.java | Java | [
{
"context": "xiaojia.daniujia.utils.SysUtil;\n\n/**\n * Created by Administrator on 2016/10/18.\n */\npublic class CommitSuccessFrag",
"end": 677,
"score": 0.6738505959510803,
"start": 664,
"tag": "NAME",
"value": "Administrator"
}
]
| null | []
| package com.xiaojia.daniujia.ui.frag;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextPaint;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.view.View;
import android.widget.TextView;
import com.xiaojia.daniujia.IntentKey;
import com.xiaojia.daniujia.PrefKeyConst;
import com.xiaojia.daniujia.R;
import com.xiaojia.daniujia.ui.act.ActLogin;
import com.xiaojia.daniujia.ui.act.ActMain;
import com.xiaojia.daniujia.utils.SysUtil;
/**
* Created by Administrator on 2016/10/18.
*/
public class CommitSuccessFragment extends BaseFragment {
private TextView mTvContact;
@Override
protected int getInflateLayout() {
return R.layout.frag_commit_success;
}
@Override
protected void setUpView(View view) {
setBackButton(view.findViewById(R.id.id_back));
((TextView) view.findViewById(R.id.id_title)).setText("提交成功");
mTvContact = (TextView) view.findViewById(R.id.commit_success_tv_contact);
}
@Override
public void onResume() {
super.onResume();
initView();
}
private void initView(){
if (SysUtil.getBooleanPref(PrefKeyConst.PREF_IS_LOGIN)){
String blueText = "大牛家客服";
SpannableString loginSpan = new SpannableString(blueText);
ClickableSpan clickableSpan = new ShowClickableSpan(blueText,getActivity());
loginSpan.setSpan(clickableSpan, 0, blueText.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
mTvContact.setText("您也可以直接和");
mTvContact.append(loginSpan);
mTvContact.append("进行沟通,或者拨打客服电话");
} else {
String blueText = "登录";
SpannableString loginSpan = new SpannableString(blueText);
ClickableSpan clickableSpan = new ShowClickableSpan(blueText,getActivity());
loginSpan.setSpan(clickableSpan, 0, blueText.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
mTvContact.setText("您也可以");
mTvContact.append(loginSpan);
mTvContact.append("后直接和大牛家客服进行沟通,或者拨打客服电话");
}
String phone = "4000903022";
SpannableString phoneSpan = new SpannableString(phone);
ClickableSpan clickablePhone = new MyLinkSpan(phone);
phoneSpan.setSpan(clickablePhone, 0, phone.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
mTvContact.append(phoneSpan);
mTvContact.append("与我们联系。");
mTvContact.setHighlightColor(Color.TRANSPARENT);
mTvContact.setMovementMethod(LinkMovementMethod.getInstance());
}
public class ShowClickableSpan extends ClickableSpan {
String string;
Context context;
public ShowClickableSpan(String str,Context context){
super();
this.string = str;
this.context = context;
}
@Override
public void updateDrawState(TextPaint ds) {
ds.setColor(0xff2c90de);
}
@Override
public void onClick(View widget) {
if (string != null) {
if (string.equals("登录")) {
Intent intent = new Intent(getActivity(), ActLogin.class);
startActivity(intent);
} else {
Intent intent = new Intent(getActivity(), ActMain.class);
intent.putExtra(IntentKey.INTENT_KEY_CHAT_TOPIC, "eric");
startActivity(intent);
}
}
}
}
public class MyLinkSpan extends ClickableSpan{
private String phone;
public MyLinkSpan(String phone) {
this.phone = phone;
}
@Override
public void onClick(View widget) {
Intent intent = new Intent(Intent.ACTION_DIAL);
Uri data = Uri.parse("tel:" + phone);
intent.setData(data);
startActivity(intent);
}
@Override
public void updateDrawState(TextPaint ds) {
super.updateDrawState(ds);
ds.setColor(0xff888888); //设置文件颜色
ds.setUnderlineText(true);
}
}
}
| 4,426 | 0.632463 | 0.625 | 133 | 31.240601 | 24.923689 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.631579 | false | false | 10 |
244d19e8e784a35a88f6b81981c106ae165dda1f | 29,360,396,478,481 | 6c87a75c014dc790344ba03358bb9b0a779bf522 | /src/com/yc/dp/Solution.java | 87f305dbfad2f72a247ca5a9236181d64a39b2b7 | []
| no_license | Ychennn/leetcode | https://github.com/Ychennn/leetcode | e55e7aed8a9673a83bf1a60b54b0e6f5bbc8ad6c | 8c6a5040d59b82486dcd28df6b72ab6fae4d1239 | refs/heads/master | 2023-02-23T09:14:11.505000 | 2021-01-24T01:19:32 | 2021-01-24T01:19:32 | 265,738,766 | 4 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.yc.dp;
public class Solution {//判断子序列
public static boolean isSubsequence(String s, String t) {
if (s.length() == 0) return true;
int count = 0;
int len = s.length();
char[] chars = s.toCharArray();
char[] chart = t.toCharArray();
for (int i = 0; i < t.length(); i++) {
if (chars[count] == chart[i])
count++;
if (count == len) return true;
}
return false;
}
public static boolean isSubsequence2(String s, String t) {
int index = -1;
for (int i = 0; i < s.length(); i++) {
index = t.indexOf(s.charAt(i), index + 1);
if (index == -1) return false;
}
return true;
}
public static void main(String[] args) {
boolean subsequence = isSubsequence2("abc", "addsbdsac");
System.out.println(subsequence);
}
} | UTF-8 | Java | 924 | java | Solution.java | Java | []
| null | []
| package com.yc.dp;
public class Solution {//判断子序列
public static boolean isSubsequence(String s, String t) {
if (s.length() == 0) return true;
int count = 0;
int len = s.length();
char[] chars = s.toCharArray();
char[] chart = t.toCharArray();
for (int i = 0; i < t.length(); i++) {
if (chars[count] == chart[i])
count++;
if (count == len) return true;
}
return false;
}
public static boolean isSubsequence2(String s, String t) {
int index = -1;
for (int i = 0; i < s.length(); i++) {
index = t.indexOf(s.charAt(i), index + 1);
if (index == -1) return false;
}
return true;
}
public static void main(String[] args) {
boolean subsequence = isSubsequence2("abc", "addsbdsac");
System.out.println(subsequence);
}
} | 924 | 0.513129 | 0.503282 | 32 | 27.59375 | 19.979458 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.71875 | false | false | 10 |
e85f3f47ea6968f05327e9c2237177f9b53ca9df | 601,295,473,038 | 5ce47fa409193a3530e96526b5892f313b4910c4 | /src/oishish/main/FunctionBodyParser.java | d074233deeb5b91b6bf340a83f139966efdde458 | []
| no_license | oishish/MathParser | https://github.com/oishish/MathParser | cf9e40051604e443543bee78e4248c03912df356 | 938367577b05328557c7d0ac1cf93915dae83ab8 | refs/heads/master | 2020-04-03T06:57:15.916000 | 2018-11-10T21:59:57 | 2018-11-10T21:59:57 | 155,089,295 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package oishish.main;
import oishish.model.AddBody;
import oishish.model.FunctionBody;
import oishish.model.MultiplierBody;
import java.util.ArrayList;
import java.util.List;
public class FunctionBodyParser {
private String input;
private FunctionBody output;
public FunctionBodyParser(String input){
this.input = input;
parse();
}
//Implementing a function body parser which works in reverse PEMDAS order
private void parse(){
if(input.contains("+")) {
output = new AddBody(parseListBody("+"));
} else if (input.contains("-")){
output = new AddBody(parseSubtraction());
} else if (input.contains("*")){
output = new MultiplierBody(parseListBody("*"));
}
}
private List<FunctionBody> parseListBody(String effector){
char effectorchar = effector.charAt(0);
long numInstances = input.chars().filter(ch -> ch == effectorchar).count();
int prevIndex = 0;
List<FunctionBody> terms= new ArrayList<>();
while(numInstances>0){
int index = input.indexOf(effector);
FunctionBodyParser term = new FunctionBodyParser(input.substring(prevIndex, index));
terms.add(term.getOutput());
prevIndex = index;
numInstances--;
}
return terms;
}
private List<FunctionBody> parseSubtraction(){
List <FunctionBody> terms = parseListBody("-");
for (int i = 0; i < terms.size(); i++) {
if (i > 0) {
terms.get(i).setSign(false);
}
}
return terms;
}
private FunctionBody getOutput(){
return output;
}
}
| UTF-8 | Java | 1,721 | java | FunctionBodyParser.java | Java | []
| null | []
| package oishish.main;
import oishish.model.AddBody;
import oishish.model.FunctionBody;
import oishish.model.MultiplierBody;
import java.util.ArrayList;
import java.util.List;
public class FunctionBodyParser {
private String input;
private FunctionBody output;
public FunctionBodyParser(String input){
this.input = input;
parse();
}
//Implementing a function body parser which works in reverse PEMDAS order
private void parse(){
if(input.contains("+")) {
output = new AddBody(parseListBody("+"));
} else if (input.contains("-")){
output = new AddBody(parseSubtraction());
} else if (input.contains("*")){
output = new MultiplierBody(parseListBody("*"));
}
}
private List<FunctionBody> parseListBody(String effector){
char effectorchar = effector.charAt(0);
long numInstances = input.chars().filter(ch -> ch == effectorchar).count();
int prevIndex = 0;
List<FunctionBody> terms= new ArrayList<>();
while(numInstances>0){
int index = input.indexOf(effector);
FunctionBodyParser term = new FunctionBodyParser(input.substring(prevIndex, index));
terms.add(term.getOutput());
prevIndex = index;
numInstances--;
}
return terms;
}
private List<FunctionBody> parseSubtraction(){
List <FunctionBody> terms = parseListBody("-");
for (int i = 0; i < terms.size(); i++) {
if (i > 0) {
terms.get(i).setSign(false);
}
}
return terms;
}
private FunctionBody getOutput(){
return output;
}
}
| 1,721 | 0.593841 | 0.590936 | 65 | 25.476923 | 22.89179 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.461538 | false | false | 10 |
31c2dcfb289077265883de6e55a32cf8220dfa63 | 30,099,130,844,424 | c25acba016fc3e20289ee6e594b9425990adff82 | /test/src/main/java/ca/burnison/configuration/TestSource.java | 60895af1c3bd219e7fadfbba54fee7de3496a7e8 | []
| no_license | burnison/simple-configuration | https://github.com/burnison/simple-configuration | f002bdd320ce9bb19e516c6de2eb5c2a6854f1aa | ae57c26859cd0b4d3b075d23e06ef70973fa5830 | refs/heads/master | 2021-06-01T02:49:27.206000 | 2016-08-08T23:03:00 | 2016-08-28T13:03:51 | 63,377,720 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ca.burnison.configuration;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import javax.annotation.Nonnull;
/**
* A source implementation intended only for single-threaded tests. This
* class may be used as a light-weight option for unit tests.
*/
public final class TestSource implements StaticSource {
private final Map<String, String> map = new HashMap<>();
private TestSource() {
}
/**
* Create a new, empty source with no initial values.
*
* @return A new source.
*/
public static TestSource empty() {
return new TestSource();
}
/**
* Create a new source with the specified initial String value.
* @param key The non-null key of this property.
* @param value The value of this property.
* @return A new source with the specified initial values.
* @throws NullPointerException If the key is null.
*/
public static TestSource initially(@Nonnull final String key, final String value) {
return empty().with(key, value);
}
/**
* Create a new source with the specified initial Number value.
* @param key The non-null key of this property.
* @param value The value of this property.
* @return A new source with the specified initial values.
* @throws NullPointerException If the key is null.
*/
public static TestSource initially(@Nonnull final String key, final Number value) {
return empty().with(key, value);
}
/**
* Create a new source with the specified initial Boolean value.
*
* @param key The non-null key of this property.
* @param value The value of this property.
* @return A new source with the specified initial values.
* @throws NullPointerException If the key is null.
*/
public static TestSource initially(@Nonnull final String key, final Boolean value) {
return empty().with(key, value);
}
/**
* Add the specified non-null key and nullable value.
*
* @param key The unique property name.
* @param value The property value.
* @return The current source.
* @throws NullPointerException If the key is null.
*/
public TestSource with(@Nonnull final String key, final String value) {
this.map.put(
Objects.requireNonNull(key, "A property key may not be null."),
value);
return this;
}
/**
* Add the specified non-null key and nullable value.
*
* @param key The unique property name.
* @param value The property value.
* @return The current source.
* @throws NullPointerException If the key is null.
*/
public TestSource with(@Nonnull final String key, final Number value) {
return this.with(key, value == null ? null : value.toString());
}
/**
* Add the specified non-null key and nullable value.
*
* @param key The unique property name.
* @param value The property value.
* @return The current source.
* @throws NullPointerException If the key is null.
*/
public TestSource with(@Nonnull final String key, final Boolean value) {
return this.with(key, value == null ? null : value.toString());
}
/**
* Removes a value from this source.
*
* @param key A non-null property key to remove.
* @return The current source.
*/
public TestSource without(@Nonnull final String key) {
this.map.remove(Objects.requireNonNull(key, "A non-null key is required."));
return this;
}
/**
* {@inheritDoc}
*/
@Override
public boolean contains(final String key) {
return this.map.containsKey(key);
}
/**
* {@inheritDoc}
*/
@Override
public String get(final String key) {
return this.map.get(key);
}
/**
* {@inheritDoc}
*/
@Override
public String getOrDefault(final String key, final String defaultValue) {
return this.map.getOrDefault(key, defaultValue);
}
}
| UTF-8 | Java | 4,058 | java | TestSource.java | Java | []
| null | []
| package ca.burnison.configuration;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import javax.annotation.Nonnull;
/**
* A source implementation intended only for single-threaded tests. This
* class may be used as a light-weight option for unit tests.
*/
public final class TestSource implements StaticSource {
private final Map<String, String> map = new HashMap<>();
private TestSource() {
}
/**
* Create a new, empty source with no initial values.
*
* @return A new source.
*/
public static TestSource empty() {
return new TestSource();
}
/**
* Create a new source with the specified initial String value.
* @param key The non-null key of this property.
* @param value The value of this property.
* @return A new source with the specified initial values.
* @throws NullPointerException If the key is null.
*/
public static TestSource initially(@Nonnull final String key, final String value) {
return empty().with(key, value);
}
/**
* Create a new source with the specified initial Number value.
* @param key The non-null key of this property.
* @param value The value of this property.
* @return A new source with the specified initial values.
* @throws NullPointerException If the key is null.
*/
public static TestSource initially(@Nonnull final String key, final Number value) {
return empty().with(key, value);
}
/**
* Create a new source with the specified initial Boolean value.
*
* @param key The non-null key of this property.
* @param value The value of this property.
* @return A new source with the specified initial values.
* @throws NullPointerException If the key is null.
*/
public static TestSource initially(@Nonnull final String key, final Boolean value) {
return empty().with(key, value);
}
/**
* Add the specified non-null key and nullable value.
*
* @param key The unique property name.
* @param value The property value.
* @return The current source.
* @throws NullPointerException If the key is null.
*/
public TestSource with(@Nonnull final String key, final String value) {
this.map.put(
Objects.requireNonNull(key, "A property key may not be null."),
value);
return this;
}
/**
* Add the specified non-null key and nullable value.
*
* @param key The unique property name.
* @param value The property value.
* @return The current source.
* @throws NullPointerException If the key is null.
*/
public TestSource with(@Nonnull final String key, final Number value) {
return this.with(key, value == null ? null : value.toString());
}
/**
* Add the specified non-null key and nullable value.
*
* @param key The unique property name.
* @param value The property value.
* @return The current source.
* @throws NullPointerException If the key is null.
*/
public TestSource with(@Nonnull final String key, final Boolean value) {
return this.with(key, value == null ? null : value.toString());
}
/**
* Removes a value from this source.
*
* @param key A non-null property key to remove.
* @return The current source.
*/
public TestSource without(@Nonnull final String key) {
this.map.remove(Objects.requireNonNull(key, "A non-null key is required."));
return this;
}
/**
* {@inheritDoc}
*/
@Override
public boolean contains(final String key) {
return this.map.containsKey(key);
}
/**
* {@inheritDoc}
*/
@Override
public String get(final String key) {
return this.map.get(key);
}
/**
* {@inheritDoc}
*/
@Override
public String getOrDefault(final String key, final String defaultValue) {
return this.map.getOrDefault(key, defaultValue);
}
}
| 4,058 | 0.634795 | 0.634795 | 134 | 29.283583 | 25.910181 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.276119 | false | false | 10 |
b95ffb349f69e1b7f594ebb2c1ca5ddd369adc52 | 18,966,575,629,873 | a1f94955c480d73d042fe939cf229774ac1c0646 | /src/main/java/slimeknights/tconstruct/smeltery/block/entity/module/package-info.java | 5e3b40160108aba81b018ee7449af106688a448c | [
"MIT"
]
| permissive | SlimeKnights/TinkersConstruct | https://github.com/SlimeKnights/TinkersConstruct | 6d581a9a52df175b1a9bb7cee17c1822ccfc00b4 | 09626c7f3f379ebe68e37312395af07b8c16e475 | refs/heads/1.18.2 | 2023-08-26T08:59:01.749000 | 2023-08-09T07:07:40 | 2023-08-09T07:07:40 | 7,760,890 | 1,126 | 911 | MIT | false | 2023-08-22T15:57:33 | 2013-01-22T20:46:32 | 2023-08-20T23:56:37 | 2023-08-22T15:54:27 | 59,770 | 1,137 | 718 | 71 | Java | false | false | @ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package slimeknights.tconstruct.smeltery.block.entity.module;
import net.minecraft.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
| UTF-8 | Java | 233 | java | package-info.java | Java | []
| null | []
| @ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package slimeknights.tconstruct.smeltery.block.entity.module;
import net.minecraft.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
| 233 | 0.896996 | 0.896996 | 7 | 32.285713 | 23.119036 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 10 |
a2760ab18c3ff832bfb4bb74e03cc6e0d689110f | 14,714,557,977,942 | d1d5d4d55d548415572eff3e526431037fac9132 | /Thread/src/exercise1/TimePrinter.java | 2def4b6b85384ad5467de9a1fe9f60f92f909dae | []
| no_license | Lcren123/samples | https://github.com/Lcren123/samples | 62baadc783a0c373c1e205d9612cce7d77360cab | a6c7a70c9a418aeeb21b6c7288ddb3057ac0eb7f | refs/heads/master | 2023-04-22T00:51:28.523000 | 2021-05-09T15:34:18 | 2021-05-09T15:34:18 | 348,950,728 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package exercise1;
public class TimePrinter extends Thread {
public void printTime() {
for (int counter = 0; counter < 10; counter++) {
System.out.println(java.time.LocalTime.now());
}
}
@Override
public void run() {
// Execute task to print statements
printTime();
}
}
| UTF-8 | Java | 325 | java | TimePrinter.java | Java | []
| null | []
| package exercise1;
public class TimePrinter extends Thread {
public void printTime() {
for (int counter = 0; counter < 10; counter++) {
System.out.println(java.time.LocalTime.now());
}
}
@Override
public void run() {
// Execute task to print statements
printTime();
}
}
| 325 | 0.596923 | 0.584615 | 21 | 13.476191 | 16.723576 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.47619 | false | false | 10 |
2fada4f395aede5caf1cfe7fe8981ab918c5d9e5 | 17,102,559,804,567 | 6dcfde1506dff96353b22b776f78e7c066fa5946 | /src/tw/com/cht/pams/dataaccess/edtrunk/persistent/EqAp.java | 5526081f1e579309f43f4e967a170aa2c841e37c | []
| no_license | chenyunru/rs | https://github.com/chenyunru/rs | f50421f5bbbdfdfc37f81f9b1d753628e817902c | de9ab76d2a70872e356994483d3047f9cafe5a12 | refs/heads/master | 2017-12-19T21:53:08.162000 | 2016-12-18T08:21:32 | 2016-12-18T08:21:32 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package tw.com.cht.pams.dataaccess.edtrunk.persistent;
// Generated 2013/11/13 �U�� 01:46:57 by Hibernate Tools 3.4.0.CR1
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.Proxy;
/**
* EqAp generated by hbm2java
*/
@Entity
@Table(name = "eq_ap")
@Proxy(lazy = false)
public class EqAp implements java.io.Serializable {
private int apsq;
private short apisq;
private Integer apOfcde;
private String apServno;
private String apVendor;
private Integer apDdate;
private Integer apCdate;
private Integer apLife;
private Character apLntpy;
private String apBand;
private String apDire;
private String apFreq;
private String apIp;
private String apPrid;
private String apBgno;
private String apFtype;
private String apRmk;
private Character apSta;
private Character apUsei;
private Integer apUsec;
private String apUseno;
private String apUser;
private String apPerson;
private String apAno;
private String apMacno;
public EqAp() {
}
public EqAp(int apsq, short apisq, String apServno) {
this.apsq = apsq;
this.apisq = apisq;
this.apServno = apServno;
}
public EqAp(int apsq, short apisq, Integer apOfcde, String apServno,
String apVendor, Integer apDdate, Integer apCdate, Integer apLife,
Character apLntpy, String apBand, String apDire, String apFreq,
String apIp, String apPrid, String apBgno, String apFtype,
String apRmk, Character apSta, Character apUsei, Integer apUsec,
String apUseno, String apUser, String apPerson, String apAno,
String apMacno) {
this.apsq = apsq;
this.apisq = apisq;
this.apOfcde = apOfcde;
this.apServno = apServno;
this.apVendor = apVendor;
this.apDdate = apDdate;
this.apCdate = apCdate;
this.apLife = apLife;
this.apLntpy = apLntpy;
this.apBand = apBand;
this.apDire = apDire;
this.apFreq = apFreq;
this.apIp = apIp;
this.apPrid = apPrid;
this.apBgno = apBgno;
this.apFtype = apFtype;
this.apRmk = apRmk;
this.apSta = apSta;
this.apUsei = apUsei;
this.apUsec = apUsec;
this.apUseno = apUseno;
this.apUser = apUser;
this.apPerson = apPerson;
this.apAno = apAno;
this.apMacno = apMacno;
}
@Id
@Column(name = "apsq", unique = true, nullable = false)
@GeneratedValue(strategy = GenerationType.AUTO)
public int getApsq() {
return this.apsq;
}
public void setApsq(int apsq) {
this.apsq = apsq;
}
@Column(name = "apisq", nullable = false)
public short getApisq() {
return this.apisq;
}
public void setApisq(short apisq) {
this.apisq = apisq;
}
@Column(name = "ap_ofcde")
public Integer getApOfcde() {
return this.apOfcde;
}
public void setApOfcde(Integer apOfcde) {
this.apOfcde = apOfcde;
}
@Column(name = "ap_servno", nullable = false, length = 12)
public String getApServno() {
return this.apServno;
}
public void setApServno(String apServno) {
this.apServno = apServno;
}
@Column(name = "ap_vendor", length = 12)
public String getApVendor() {
return this.apVendor;
}
public void setApVendor(String apVendor) {
this.apVendor = apVendor;
}
@Column(name = "ap_ddate")
public Integer getApDdate() {
return this.apDdate;
}
public void setApDdate(Integer apDdate) {
this.apDdate = apDdate;
}
@Column(name = "ap_cdate")
public Integer getApCdate() {
return this.apCdate;
}
public void setApCdate(Integer apCdate) {
this.apCdate = apCdate;
}
@Column(name = "ap_life")
public Integer getApLife() {
return this.apLife;
}
public void setApLife(Integer apLife) {
this.apLife = apLife;
}
@Column(name = "ap_lntpy", length = 1)
public Character getApLntpy() {
return this.apLntpy;
}
public void setApLntpy(Character apLntpy) {
this.apLntpy = apLntpy;
}
@Column(name = "ap_band", length = 8)
public String getApBand() {
return this.apBand;
}
public void setApBand(String apBand) {
this.apBand = apBand;
}
@Column(name = "ap_dire", length = 6)
public String getApDire() {
return this.apDire;
}
public void setApDire(String apDire) {
this.apDire = apDire;
}
@Column(name = "ap_freq", length = 6)
public String getApFreq() {
return this.apFreq;
}
public void setApFreq(String apFreq) {
this.apFreq = apFreq;
}
@Column(name = "ap_ip", length = 15)
public String getApIp() {
return this.apIp;
}
public void setApIp(String apIp) {
this.apIp = apIp;
}
@Column(name = "ap_prid", length = 20)
public String getApPrid() {
return this.apPrid;
}
public void setApPrid(String apPrid) {
this.apPrid = apPrid;
}
@Column(name = "ap_bgno", length = 15)
public String getApBgno() {
return this.apBgno;
}
public void setApBgno(String apBgno) {
this.apBgno = apBgno;
}
@Column(name = "ap_ftype", length = 6)
public String getApFtype() {
return this.apFtype;
}
public void setApFtype(String apFtype) {
this.apFtype = apFtype;
}
@Column(name = "ap_rmk", length = 30)
public String getApRmk() {
return this.apRmk;
}
public void setApRmk(String apRmk) {
this.apRmk = apRmk;
}
@Column(name = "ap_sta", length = 1)
public Character getApSta() {
return this.apSta;
}
public void setApSta(Character apSta) {
this.apSta = apSta;
}
@Column(name = "ap_usei", length = 1)
public Character getApUsei() {
return this.apUsei;
}
public void setApUsei(Character apUsei) {
this.apUsei = apUsei;
}
@Column(name = "ap_usec")
public Integer getApUsec() {
return this.apUsec;
}
public void setApUsec(Integer apUsec) {
this.apUsec = apUsec;
}
@Column(name = "ap_useno", length = 20)
public String getApUseno() {
return this.apUseno;
}
public void setApUseno(String apUseno) {
this.apUseno = apUseno;
}
@Column(name = "ap_user", length = 20)
public String getApUser() {
return this.apUser;
}
public void setApUser(String apUser) {
this.apUser = apUser;
}
@Column(name = "ap_person", length = 10)
public String getApPerson() {
return this.apPerson;
}
public void setApPerson(String apPerson) {
this.apPerson = apPerson;
}
@Column(name = "ap_ano", length = 20)
public String getApAno() {
return this.apAno;
}
public void setApAno(String apAno) {
this.apAno = apAno;
}
@Column(name = "ap_macno", length = 20)
public String getApMacno() {
return this.apMacno;
}
public void setApMacno(String apMacno) {
this.apMacno = apMacno;
}
}
| UTF-8 | Java | 6,800 | java | EqAp.java | Java | []
| null | []
| package tw.com.cht.pams.dataaccess.edtrunk.persistent;
// Generated 2013/11/13 �U�� 01:46:57 by Hibernate Tools 3.4.0.CR1
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.Proxy;
/**
* EqAp generated by hbm2java
*/
@Entity
@Table(name = "eq_ap")
@Proxy(lazy = false)
public class EqAp implements java.io.Serializable {
private int apsq;
private short apisq;
private Integer apOfcde;
private String apServno;
private String apVendor;
private Integer apDdate;
private Integer apCdate;
private Integer apLife;
private Character apLntpy;
private String apBand;
private String apDire;
private String apFreq;
private String apIp;
private String apPrid;
private String apBgno;
private String apFtype;
private String apRmk;
private Character apSta;
private Character apUsei;
private Integer apUsec;
private String apUseno;
private String apUser;
private String apPerson;
private String apAno;
private String apMacno;
public EqAp() {
}
public EqAp(int apsq, short apisq, String apServno) {
this.apsq = apsq;
this.apisq = apisq;
this.apServno = apServno;
}
public EqAp(int apsq, short apisq, Integer apOfcde, String apServno,
String apVendor, Integer apDdate, Integer apCdate, Integer apLife,
Character apLntpy, String apBand, String apDire, String apFreq,
String apIp, String apPrid, String apBgno, String apFtype,
String apRmk, Character apSta, Character apUsei, Integer apUsec,
String apUseno, String apUser, String apPerson, String apAno,
String apMacno) {
this.apsq = apsq;
this.apisq = apisq;
this.apOfcde = apOfcde;
this.apServno = apServno;
this.apVendor = apVendor;
this.apDdate = apDdate;
this.apCdate = apCdate;
this.apLife = apLife;
this.apLntpy = apLntpy;
this.apBand = apBand;
this.apDire = apDire;
this.apFreq = apFreq;
this.apIp = apIp;
this.apPrid = apPrid;
this.apBgno = apBgno;
this.apFtype = apFtype;
this.apRmk = apRmk;
this.apSta = apSta;
this.apUsei = apUsei;
this.apUsec = apUsec;
this.apUseno = apUseno;
this.apUser = apUser;
this.apPerson = apPerson;
this.apAno = apAno;
this.apMacno = apMacno;
}
@Id
@Column(name = "apsq", unique = true, nullable = false)
@GeneratedValue(strategy = GenerationType.AUTO)
public int getApsq() {
return this.apsq;
}
public void setApsq(int apsq) {
this.apsq = apsq;
}
@Column(name = "apisq", nullable = false)
public short getApisq() {
return this.apisq;
}
public void setApisq(short apisq) {
this.apisq = apisq;
}
@Column(name = "ap_ofcde")
public Integer getApOfcde() {
return this.apOfcde;
}
public void setApOfcde(Integer apOfcde) {
this.apOfcde = apOfcde;
}
@Column(name = "ap_servno", nullable = false, length = 12)
public String getApServno() {
return this.apServno;
}
public void setApServno(String apServno) {
this.apServno = apServno;
}
@Column(name = "ap_vendor", length = 12)
public String getApVendor() {
return this.apVendor;
}
public void setApVendor(String apVendor) {
this.apVendor = apVendor;
}
@Column(name = "ap_ddate")
public Integer getApDdate() {
return this.apDdate;
}
public void setApDdate(Integer apDdate) {
this.apDdate = apDdate;
}
@Column(name = "ap_cdate")
public Integer getApCdate() {
return this.apCdate;
}
public void setApCdate(Integer apCdate) {
this.apCdate = apCdate;
}
@Column(name = "ap_life")
public Integer getApLife() {
return this.apLife;
}
public void setApLife(Integer apLife) {
this.apLife = apLife;
}
@Column(name = "ap_lntpy", length = 1)
public Character getApLntpy() {
return this.apLntpy;
}
public void setApLntpy(Character apLntpy) {
this.apLntpy = apLntpy;
}
@Column(name = "ap_band", length = 8)
public String getApBand() {
return this.apBand;
}
public void setApBand(String apBand) {
this.apBand = apBand;
}
@Column(name = "ap_dire", length = 6)
public String getApDire() {
return this.apDire;
}
public void setApDire(String apDire) {
this.apDire = apDire;
}
@Column(name = "ap_freq", length = 6)
public String getApFreq() {
return this.apFreq;
}
public void setApFreq(String apFreq) {
this.apFreq = apFreq;
}
@Column(name = "ap_ip", length = 15)
public String getApIp() {
return this.apIp;
}
public void setApIp(String apIp) {
this.apIp = apIp;
}
@Column(name = "ap_prid", length = 20)
public String getApPrid() {
return this.apPrid;
}
public void setApPrid(String apPrid) {
this.apPrid = apPrid;
}
@Column(name = "ap_bgno", length = 15)
public String getApBgno() {
return this.apBgno;
}
public void setApBgno(String apBgno) {
this.apBgno = apBgno;
}
@Column(name = "ap_ftype", length = 6)
public String getApFtype() {
return this.apFtype;
}
public void setApFtype(String apFtype) {
this.apFtype = apFtype;
}
@Column(name = "ap_rmk", length = 30)
public String getApRmk() {
return this.apRmk;
}
public void setApRmk(String apRmk) {
this.apRmk = apRmk;
}
@Column(name = "ap_sta", length = 1)
public Character getApSta() {
return this.apSta;
}
public void setApSta(Character apSta) {
this.apSta = apSta;
}
@Column(name = "ap_usei", length = 1)
public Character getApUsei() {
return this.apUsei;
}
public void setApUsei(Character apUsei) {
this.apUsei = apUsei;
}
@Column(name = "ap_usec")
public Integer getApUsec() {
return this.apUsec;
}
public void setApUsec(Integer apUsec) {
this.apUsec = apUsec;
}
@Column(name = "ap_useno", length = 20)
public String getApUseno() {
return this.apUseno;
}
public void setApUseno(String apUseno) {
this.apUseno = apUseno;
}
@Column(name = "ap_user", length = 20)
public String getApUser() {
return this.apUser;
}
public void setApUser(String apUser) {
this.apUser = apUser;
}
@Column(name = "ap_person", length = 10)
public String getApPerson() {
return this.apPerson;
}
public void setApPerson(String apPerson) {
this.apPerson = apPerson;
}
@Column(name = "ap_ano", length = 20)
public String getApAno() {
return this.apAno;
}
public void setApAno(String apAno) {
this.apAno = apAno;
}
@Column(name = "ap_macno", length = 20)
public String getApMacno() {
return this.apMacno;
}
public void setApMacno(String apMacno) {
this.apMacno = apMacno;
}
}
| 6,800 | 0.663674 | 0.656609 | 318 | 19.36478 | 16.392942 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.544025 | false | false | 10 |
da10565f3c018613433fc658c3fcca98769f65c5 | 31,129,922,981,604 | 3802d30326183b02653a6e3ad49d8553860ae2de | /domain/src/main/java/com/cardvalue/penguin/repository/ReferrerLinkRepository.java | a811917c0042e83547e8d8f2df684bc6f8692247 | []
| no_license | chenguojia/penguin | https://github.com/chenguojia/penguin | 9c666bcdb2ea4ef71a4a51c9594d1525c789bfe7 | 5bf1c31a2d9a1cb0332e207c64306df13183e423 | refs/heads/master | 2020-12-24T18:55:51.351000 | 2016-04-14T09:08:16 | 2016-04-14T09:08:16 | 56,222,863 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.cardvalue.penguin.repository;
import com.cardvalue.penguin.dto.RemoteAddMerchantDTO;
import com.cardvalue.penguin.model.ReferrerLink;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface ReferrerLinkRepository {
public ReferrerLink create(int referrerId, RemoteAddMerchantDTO dto);
public ReferrerLink create(int referrerId, String mid);
public ReferrerLink clone(long linkId);
public ReferrerLink findLinkByShortKey(String key);
public ReferrerLink findById(long id);
public void valid(long id);
public ReferrerLink attachOpenId(long id, String openId);
public int removeExpiredLinks();
public List<ReferrerLink> findLinkByMid(String mid);
}
| UTF-8 | Java | 732 | java | ReferrerLinkRepository.java | Java | []
| null | []
| package com.cardvalue.penguin.repository;
import com.cardvalue.penguin.dto.RemoteAddMerchantDTO;
import com.cardvalue.penguin.model.ReferrerLink;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface ReferrerLinkRepository {
public ReferrerLink create(int referrerId, RemoteAddMerchantDTO dto);
public ReferrerLink create(int referrerId, String mid);
public ReferrerLink clone(long linkId);
public ReferrerLink findLinkByShortKey(String key);
public ReferrerLink findById(long id);
public void valid(long id);
public ReferrerLink attachOpenId(long id, String openId);
public int removeExpiredLinks();
public List<ReferrerLink> findLinkByMid(String mid);
}
| 732 | 0.807377 | 0.807377 | 30 | 23.4 | 23.857353 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.066667 | false | false | 10 |
e098f72ac698cf66e7dba4de2c4bb971c6e2a2ea | 21,328,807,648,701 | 571db34c01662e0fb4d3f1318187c567ed3e1c14 | /src/com/manojkhannakm/textmining/a/two/LSA.java | 8c5e77a7492d4aa54547b91c944dd31500314666 | []
| no_license | manojmkhanna/text-mining | https://github.com/manojmkhanna/text-mining | 50f27de8fc5551da12a3cae5bab820e8279a4721 | a438f7e1712d0fe19f320d459675fb0aa626b750 | refs/heads/master | 2021-06-19T01:52:38.950000 | 2017-07-07T19:30:01 | 2017-07-07T19:30:01 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.manojkhannakm.textmining.a.two;
import edu.stanford.nlp.ling.CoreAnnotations;
import edu.stanford.nlp.ling.CoreLabel;
import edu.stanford.nlp.pipeline.StanfordCoreNLP;
import edu.stanford.nlp.util.CoreMap;
import org.apache.commons.math3.linear.MatrixUtils;
import org.apache.commons.math3.linear.RealMatrix;
import org.apache.commons.math3.linear.SingularValueDecomposition;
import java.io.*;
import java.util.ArrayList;
import java.util.Properties;
import java.util.TreeMap;
import java.util.TreeSet;
/**
* Latent Semantic Analysis
*
* @author Manoj Khanna
*/
public class LSA {
private static StanfordCoreNLP pipeline;
private static Trie stopWordTrie;
public static void main(String[] args) throws IOException {
System.out.println("Reading input.txt...");
long startTime = System.currentTimeMillis();
// BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
BufferedReader bufferedReader = new BufferedReader(new FileReader("res/a2/input.txt"));
String line;
ArrayList<String> lineList = new ArrayList<>();
while ((line = bufferedReader.readLine()) != null && !line.isEmpty()) {
lineList.add(line);
}
System.out.format("Read %d sentences in %.2fs\n", lineList.size(), (System.currentTimeMillis() - startTime) / 1000.0f);
System.out.println("");
System.out.println("Pre-processing sentences...");
startTime = System.currentTimeMillis();
Properties properties = new Properties();
properties.setProperty("annotators", "tokenize, ssplit, pos, lemma");
pipeline = new StanfordCoreNLP(properties);
BufferedReader stopWordBufferedReader = new BufferedReader(new FileReader("res/stop_words.txt"));
stopWordTrie = new Trie();
while ((line = stopWordBufferedReader.readLine()) != null) {
stopWordTrie.add(line);
}
stopWordBufferedReader.close();
ArrayList<Sentence> sentenceList = new ArrayList<>();
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter("res/a2/output.txt"));
for (String s : lineList) {
Sentence sentence = new Sentence(s);
sentenceList.add(sentence);
bufferedWriter.write(sentence + "\n");
}
bufferedWriter.write("\n");
System.out.format("Pre-processed sentences in %.2fs\n", (System.currentTimeMillis() - startTime) / 1000.0f);
System.out.println("");
System.out.println("Constructing term-document matrix...");
startTime = System.currentTimeMillis();
TreeSet<String> wordSet = new TreeSet<>();
for (Sentence sentence : sentenceList) {
for (String word : sentence.wordList) {
wordSet.add(word);
}
}
ArrayList<String> wordList = new ArrayList<>(wordSet);
int wordCount = wordList.size(),
sentenceCount = sentenceList.size();
double[][] a = new double[wordCount][sentenceCount];
for (int i = 0; i < sentenceList.size(); i++) {
for (String word : sentenceList.get(i).wordList) {
a[wordList.indexOf(word)][i]++;
}
}
bufferedWriter.write(String.format("%-14s", "A"));
for (int i = 1; i <= sentenceCount; i++) {
bufferedWriter.write(String.format("S%-6d", i));
}
bufferedWriter.write("\n\n");
for (int i = 0; i < wordCount; i++) {
bufferedWriter.write(String.format("%-14s", wordList.get(i)));
for (int j = 0; j < sentenceCount; j++) {
bufferedWriter.write(String.format("%-7d", (int) a[i][j]));
}
bufferedWriter.write("\n\n");
}
System.out.format("Constructed term-document matrix as %dx%d in %.2fs\n", wordCount, sentenceCount, (System.currentTimeMillis() - startTime) / 1000.0f);
System.out.println("");
System.out.println("Decomposing term-document matrix...");
RealMatrix aMatrix = MatrixUtils.createRealMatrix(a);
SingularValueDecomposition svd = new SingularValueDecomposition(aMatrix);
int k = Integer.parseInt(bufferedReader.readLine());
RealMatrix uMatrix = svd.getU().getSubMatrix(0, wordCount - 1, 0, k - 1),
sMatrix = svd.getS().getSubMatrix(0, k - 1, 0, k - 1),
vMatrix = svd.getVT().getSubMatrix(0, k - 1, 0, sentenceCount - 1),
usMatrix = uMatrix.multiply(sMatrix),
svMatrix = sMatrix.multiply(vMatrix);
bufferedWriter.write(String.format("%-14s", "U"));
for (int i = 1; i <= k; i++) {
bufferedWriter.write(String.format("%-7d", i));
}
bufferedWriter.write("\n\n");
for (int i = 0; i < wordCount; i++) {
bufferedWriter.write(String.format("%-14s", wordList.get(i)));
for (int j = 0; j < k; j++) {
bufferedWriter.write(String.format("%-7.2f", uMatrix.getData()[i][j]));
}
bufferedWriter.write("\n\n");
}
bufferedWriter.write(String.format("%-14s", "S"));
for (int i = 1; i <= k; i++) {
bufferedWriter.write(String.format("%-7d", i));
}
bufferedWriter.write("\n\n");
for (int i = 0; i < k; i++) {
bufferedWriter.write(String.format("%-14d", i + 1));
for (int j = 0; j < k; j++) {
bufferedWriter.write(String.format("%-7.2f", sMatrix.getData()[i][j]));
}
bufferedWriter.write("\n\n");
}
bufferedWriter.write(String.format("%-14s", "V"));
for (int i = 1; i <= sentenceCount; i++) {
bufferedWriter.write(String.format("S%-6d", i));
}
bufferedWriter.write("\n\n");
for (int i = 0; i < k; i++) {
bufferedWriter.write(String.format("%-14d", i + 1));
for (int j = 0; j < sentenceCount; j++) {
bufferedWriter.write(String.format("%-7.2f", vMatrix.getData()[i][j]));
}
bufferedWriter.write("\n\n");
}
bufferedWriter.write(String.format("%-14s", "US"));
for (int i = 1; i <= k; i++) {
bufferedWriter.write(String.format("%-7d", i));
}
bufferedWriter.write("\n\n");
for (int i = 0; i < wordCount; i++) {
bufferedWriter.write(String.format("%-14s", wordList.get(i)));
for (int j = 0; j < k; j++) {
bufferedWriter.write(String.format("%-7.2f", usMatrix.getData()[i][j]));
}
bufferedWriter.write("\n\n");
}
bufferedWriter.write(String.format("%-14s", "SV"));
for (int i = 1; i <= sentenceCount; i++) {
bufferedWriter.write(String.format("S%-6d", i));
}
bufferedWriter.write("\n\n");
for (int i = 0; i < k; i++) {
bufferedWriter.write(String.format("%-14d", i + 1));
for (int j = 0; j < sentenceCount; j++) {
bufferedWriter.write(String.format("%-7.2f", svMatrix.getData()[i][j]));
}
bufferedWriter.write("\n\n");
}
System.out.format("Decomposed term-document matrix in %.2fs\n", (System.currentTimeMillis() - startTime) / 1000.0f);
bufferedReader.readLine();
Sentence sentence = new Sentence(bufferedReader.readLine());
bufferedWriter.write(sentence + "\n\n");
RealMatrix qMatrix = MatrixUtils.createRealMatrix(1, k);
for (String word : sentence.wordList) {
int i = wordList.indexOf(word);
if (i >= 0) {
qMatrix = qMatrix.add(usMatrix.getRowMatrix(i));
}
}
qMatrix = qMatrix.scalarMultiply(1.0 / sentence.wordList.size());
bufferedWriter.write(String.format("%-14s", "Q"));
for (int i = 1; i <= k; i++) {
bufferedWriter.write(String.format("%-7d", i));
}
bufferedWriter.write("\n\n");
bufferedWriter.write(String.format("%-14d", 1));
for (int j = 0; j < k; j++) {
bufferedWriter.write(String.format("%-7.2f", qMatrix.getData()[0][j]));
}
bufferedWriter.write("\n\n");
for (int i = 0; i < sentenceCount; i++) {
double[][] sv = svMatrix.getData(),
q = qMatrix.getData();
double x = 0.0;
for (int j = 0; j < k; j++) {
x += sv[j][i] * q[0][j];
}
double y1 = 0.0;
for (int j = 0; j < k; j++) {
y1 += sv[j][i] * sv[j][i];
}
y1 = Math.sqrt(y1);
double y2 = 0.0;
for (int j = 0; j < k; j++) {
y2 += q[0][j] * q[0][j];
}
y2 = Math.sqrt(y2);
bufferedWriter.write(String.format("cos(S%d, Q) = %.4f\n", i + 1, x / (y1 * y2)));
}
bufferedReader.close();
bufferedWriter.close();
}
private static class Trie {
private Node rootNode = new Node();
public void add(String word) {
Node node = rootNode;
for (int i = 0; i < word.length(); i++) {
char c = word.charAt(i);
Node childNode = node.childNodeMap.get(c);
if (childNode == null) {
childNode = new Node();
node.childNodeMap.put(c, childNode);
}
node = childNode;
}
node.word = true;
}
public boolean contains(String word) {
Node node = rootNode;
for (int i = 0; i < word.length(); i++) {
Node childNode = node.childNodeMap.get(word.charAt(i));
if (childNode == null) {
return false;
}
node = childNode;
}
return node.word;
}
private class Node {
private boolean word;
private TreeMap<Character, Node> childNodeMap = new TreeMap<>();
}
}
private static class Sentence {
private ArrayList<String> wordList = new ArrayList<>();
public Sentence(String s) {
for (CoreMap sentence : pipeline.process(s).get(CoreAnnotations.SentencesAnnotation.class)) {
for (CoreLabel token : sentence.get(CoreAnnotations.TokensAnnotation.class)) {
String word = token.get(CoreAnnotations.LemmaAnnotation.class)
.toLowerCase()
.replaceAll("[^a-z]", "");
if (!word.isEmpty()
&& !stopWordTrie.contains(word)) {
wordList.add(word);
}
}
}
}
@Override
public String toString() {
String s = "";
for (String word : wordList) {
s += word + " ";
}
return s;
}
}
}
| UTF-8 | Java | 11,117 | java | LSA.java | Java | [
{
"context": "et;\n\n/**\n * Latent Semantic Analysis\n *\n * @author Manoj Khanna\n */\n\npublic class LSA {\n\n private static Stanf",
"end": 576,
"score": 0.9998804926872253,
"start": 564,
"tag": "NAME",
"value": "Manoj Khanna"
}
]
| null | []
| package com.manojkhannakm.textmining.a.two;
import edu.stanford.nlp.ling.CoreAnnotations;
import edu.stanford.nlp.ling.CoreLabel;
import edu.stanford.nlp.pipeline.StanfordCoreNLP;
import edu.stanford.nlp.util.CoreMap;
import org.apache.commons.math3.linear.MatrixUtils;
import org.apache.commons.math3.linear.RealMatrix;
import org.apache.commons.math3.linear.SingularValueDecomposition;
import java.io.*;
import java.util.ArrayList;
import java.util.Properties;
import java.util.TreeMap;
import java.util.TreeSet;
/**
* Latent Semantic Analysis
*
* @author <NAME>
*/
public class LSA {
private static StanfordCoreNLP pipeline;
private static Trie stopWordTrie;
public static void main(String[] args) throws IOException {
System.out.println("Reading input.txt...");
long startTime = System.currentTimeMillis();
// BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
BufferedReader bufferedReader = new BufferedReader(new FileReader("res/a2/input.txt"));
String line;
ArrayList<String> lineList = new ArrayList<>();
while ((line = bufferedReader.readLine()) != null && !line.isEmpty()) {
lineList.add(line);
}
System.out.format("Read %d sentences in %.2fs\n", lineList.size(), (System.currentTimeMillis() - startTime) / 1000.0f);
System.out.println("");
System.out.println("Pre-processing sentences...");
startTime = System.currentTimeMillis();
Properties properties = new Properties();
properties.setProperty("annotators", "tokenize, ssplit, pos, lemma");
pipeline = new StanfordCoreNLP(properties);
BufferedReader stopWordBufferedReader = new BufferedReader(new FileReader("res/stop_words.txt"));
stopWordTrie = new Trie();
while ((line = stopWordBufferedReader.readLine()) != null) {
stopWordTrie.add(line);
}
stopWordBufferedReader.close();
ArrayList<Sentence> sentenceList = new ArrayList<>();
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter("res/a2/output.txt"));
for (String s : lineList) {
Sentence sentence = new Sentence(s);
sentenceList.add(sentence);
bufferedWriter.write(sentence + "\n");
}
bufferedWriter.write("\n");
System.out.format("Pre-processed sentences in %.2fs\n", (System.currentTimeMillis() - startTime) / 1000.0f);
System.out.println("");
System.out.println("Constructing term-document matrix...");
startTime = System.currentTimeMillis();
TreeSet<String> wordSet = new TreeSet<>();
for (Sentence sentence : sentenceList) {
for (String word : sentence.wordList) {
wordSet.add(word);
}
}
ArrayList<String> wordList = new ArrayList<>(wordSet);
int wordCount = wordList.size(),
sentenceCount = sentenceList.size();
double[][] a = new double[wordCount][sentenceCount];
for (int i = 0; i < sentenceList.size(); i++) {
for (String word : sentenceList.get(i).wordList) {
a[wordList.indexOf(word)][i]++;
}
}
bufferedWriter.write(String.format("%-14s", "A"));
for (int i = 1; i <= sentenceCount; i++) {
bufferedWriter.write(String.format("S%-6d", i));
}
bufferedWriter.write("\n\n");
for (int i = 0; i < wordCount; i++) {
bufferedWriter.write(String.format("%-14s", wordList.get(i)));
for (int j = 0; j < sentenceCount; j++) {
bufferedWriter.write(String.format("%-7d", (int) a[i][j]));
}
bufferedWriter.write("\n\n");
}
System.out.format("Constructed term-document matrix as %dx%d in %.2fs\n", wordCount, sentenceCount, (System.currentTimeMillis() - startTime) / 1000.0f);
System.out.println("");
System.out.println("Decomposing term-document matrix...");
RealMatrix aMatrix = MatrixUtils.createRealMatrix(a);
SingularValueDecomposition svd = new SingularValueDecomposition(aMatrix);
int k = Integer.parseInt(bufferedReader.readLine());
RealMatrix uMatrix = svd.getU().getSubMatrix(0, wordCount - 1, 0, k - 1),
sMatrix = svd.getS().getSubMatrix(0, k - 1, 0, k - 1),
vMatrix = svd.getVT().getSubMatrix(0, k - 1, 0, sentenceCount - 1),
usMatrix = uMatrix.multiply(sMatrix),
svMatrix = sMatrix.multiply(vMatrix);
bufferedWriter.write(String.format("%-14s", "U"));
for (int i = 1; i <= k; i++) {
bufferedWriter.write(String.format("%-7d", i));
}
bufferedWriter.write("\n\n");
for (int i = 0; i < wordCount; i++) {
bufferedWriter.write(String.format("%-14s", wordList.get(i)));
for (int j = 0; j < k; j++) {
bufferedWriter.write(String.format("%-7.2f", uMatrix.getData()[i][j]));
}
bufferedWriter.write("\n\n");
}
bufferedWriter.write(String.format("%-14s", "S"));
for (int i = 1; i <= k; i++) {
bufferedWriter.write(String.format("%-7d", i));
}
bufferedWriter.write("\n\n");
for (int i = 0; i < k; i++) {
bufferedWriter.write(String.format("%-14d", i + 1));
for (int j = 0; j < k; j++) {
bufferedWriter.write(String.format("%-7.2f", sMatrix.getData()[i][j]));
}
bufferedWriter.write("\n\n");
}
bufferedWriter.write(String.format("%-14s", "V"));
for (int i = 1; i <= sentenceCount; i++) {
bufferedWriter.write(String.format("S%-6d", i));
}
bufferedWriter.write("\n\n");
for (int i = 0; i < k; i++) {
bufferedWriter.write(String.format("%-14d", i + 1));
for (int j = 0; j < sentenceCount; j++) {
bufferedWriter.write(String.format("%-7.2f", vMatrix.getData()[i][j]));
}
bufferedWriter.write("\n\n");
}
bufferedWriter.write(String.format("%-14s", "US"));
for (int i = 1; i <= k; i++) {
bufferedWriter.write(String.format("%-7d", i));
}
bufferedWriter.write("\n\n");
for (int i = 0; i < wordCount; i++) {
bufferedWriter.write(String.format("%-14s", wordList.get(i)));
for (int j = 0; j < k; j++) {
bufferedWriter.write(String.format("%-7.2f", usMatrix.getData()[i][j]));
}
bufferedWriter.write("\n\n");
}
bufferedWriter.write(String.format("%-14s", "SV"));
for (int i = 1; i <= sentenceCount; i++) {
bufferedWriter.write(String.format("S%-6d", i));
}
bufferedWriter.write("\n\n");
for (int i = 0; i < k; i++) {
bufferedWriter.write(String.format("%-14d", i + 1));
for (int j = 0; j < sentenceCount; j++) {
bufferedWriter.write(String.format("%-7.2f", svMatrix.getData()[i][j]));
}
bufferedWriter.write("\n\n");
}
System.out.format("Decomposed term-document matrix in %.2fs\n", (System.currentTimeMillis() - startTime) / 1000.0f);
bufferedReader.readLine();
Sentence sentence = new Sentence(bufferedReader.readLine());
bufferedWriter.write(sentence + "\n\n");
RealMatrix qMatrix = MatrixUtils.createRealMatrix(1, k);
for (String word : sentence.wordList) {
int i = wordList.indexOf(word);
if (i >= 0) {
qMatrix = qMatrix.add(usMatrix.getRowMatrix(i));
}
}
qMatrix = qMatrix.scalarMultiply(1.0 / sentence.wordList.size());
bufferedWriter.write(String.format("%-14s", "Q"));
for (int i = 1; i <= k; i++) {
bufferedWriter.write(String.format("%-7d", i));
}
bufferedWriter.write("\n\n");
bufferedWriter.write(String.format("%-14d", 1));
for (int j = 0; j < k; j++) {
bufferedWriter.write(String.format("%-7.2f", qMatrix.getData()[0][j]));
}
bufferedWriter.write("\n\n");
for (int i = 0; i < sentenceCount; i++) {
double[][] sv = svMatrix.getData(),
q = qMatrix.getData();
double x = 0.0;
for (int j = 0; j < k; j++) {
x += sv[j][i] * q[0][j];
}
double y1 = 0.0;
for (int j = 0; j < k; j++) {
y1 += sv[j][i] * sv[j][i];
}
y1 = Math.sqrt(y1);
double y2 = 0.0;
for (int j = 0; j < k; j++) {
y2 += q[0][j] * q[0][j];
}
y2 = Math.sqrt(y2);
bufferedWriter.write(String.format("cos(S%d, Q) = %.4f\n", i + 1, x / (y1 * y2)));
}
bufferedReader.close();
bufferedWriter.close();
}
private static class Trie {
private Node rootNode = new Node();
public void add(String word) {
Node node = rootNode;
for (int i = 0; i < word.length(); i++) {
char c = word.charAt(i);
Node childNode = node.childNodeMap.get(c);
if (childNode == null) {
childNode = new Node();
node.childNodeMap.put(c, childNode);
}
node = childNode;
}
node.word = true;
}
public boolean contains(String word) {
Node node = rootNode;
for (int i = 0; i < word.length(); i++) {
Node childNode = node.childNodeMap.get(word.charAt(i));
if (childNode == null) {
return false;
}
node = childNode;
}
return node.word;
}
private class Node {
private boolean word;
private TreeMap<Character, Node> childNodeMap = new TreeMap<>();
}
}
private static class Sentence {
private ArrayList<String> wordList = new ArrayList<>();
public Sentence(String s) {
for (CoreMap sentence : pipeline.process(s).get(CoreAnnotations.SentencesAnnotation.class)) {
for (CoreLabel token : sentence.get(CoreAnnotations.TokensAnnotation.class)) {
String word = token.get(CoreAnnotations.LemmaAnnotation.class)
.toLowerCase()
.replaceAll("[^a-z]", "");
if (!word.isEmpty()
&& !stopWordTrie.contains(word)) {
wordList.add(word);
}
}
}
}
@Override
public String toString() {
String s = "";
for (String word : wordList) {
s += word + " ";
}
return s;
}
}
}
| 11,111 | 0.530719 | 0.517586 | 311 | 34.745979 | 28.239613 | 160 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.81672 | false | false | 10 |
1e55418c7b9b7a9d0b74a4f477a6a028bc64cc6a | 15,066,745,344,443 | deca82af39da85b66764f313b62f8c291c78f6a1 | /CatalogPageObject/src/com/catalog/pageobjects/HomePage.java | 13983a2c76a4a616dcd19fca69770a7582d5e1b5 | []
| no_license | philipsTanoto/CatalogPage | https://github.com/philipsTanoto/CatalogPage | 8a3c10d1ae5cc04e39ce807b3af019a08ffdc42a | dc78f8744cca8223e61a808b075b8c44884b7a4b | refs/heads/master | 2021-01-01T04:35:39.115000 | 2016-05-14T07:42:37 | 2016-05-14T07:42:37 | 58,795,968 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.catalog.pageobjects;
import com.catalog.common.Common;
public class HomePage{
public Common CM;
public String LOGYOURSELFLINK="//*[@id='bodyContent']/div/div[1]/a[1]/u";
public void clickLogYourSelfLink(){
CM = new Common(null);
CM.clickElementByXpath(LOGYOURSELFLINK);
}
}
| UTF-8 | Java | 305 | java | HomePage.java | Java | []
| null | []
| package com.catalog.pageobjects;
import com.catalog.common.Common;
public class HomePage{
public Common CM;
public String LOGYOURSELFLINK="//*[@id='bodyContent']/div/div[1]/a[1]/u";
public void clickLogYourSelfLink(){
CM = new Common(null);
CM.clickElementByXpath(LOGYOURSELFLINK);
}
}
| 305 | 0.721311 | 0.714754 | 16 | 18.0625 | 20.725796 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.125 | false | false | 10 |
8d96cd4f5538748fdf9f736d354fee8b528aa53c | 20,349,555,065,847 | 27370260c5f9af5594d93d1790f08186688dffa0 | /app/src/main/java/com/example/aquafish/MainActivity.java | c7f605d14e61a988209a2b08cae593d1df9d4ece | []
| no_license | adpp420/AquaFish | https://github.com/adpp420/AquaFish | a613cc59c60d2880ff727ea22b04c01b39dbe70c | a4b2d490ed6705021b71cf8c1e1110d50f10c7cf | refs/heads/master | 2023-04-02T14:38:49.631000 | 2021-04-16T19:32:18 | 2021-04-16T19:32:18 | 355,626,357 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.aquafish;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import android.content.Context;
import android.graphics.Typeface;
import android.os.Bundle;
import android.text.SpannableStringBuilder;
import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.widget.AppCompatTextView;
import com.google.android.material.bottomnavigation.BottomNavigationView;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new TraderFragment()).commit();
BottomNavigationView bottomNavigationView = (BottomNavigationView) findViewById(R.id.bottom_navigation);
Typeface font = Typeface.createFromAsset(getAssets(), "fonts/unicode.futurab.ttf");
CustomTypefaceSpan typefaceSpan = new CustomTypefaceSpan("", font);
for (int i = 0; i <bottomNavigationView.getMenu().size(); i++) {
MenuItem menuItem = bottomNavigationView.getMenu().getItem(i);
SpannableStringBuilder spannableTitle = new SpannableStringBuilder(menuItem.getTitle());
spannableTitle.setSpan(typefaceSpan, 0, spannableTitle.length(), 0);
menuItem.setTitle(spannableTitle);
}
bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
Fragment selectedFragment = null;
switch (item.getItemId()) {
case R.id.action_trader:
// Toast.makeText(MainActivity.this, "Trader", Toast.LENGTH_SHORT).show();
selectedFragment = new TraderFragment();
break;
case R.id.action_order:
// Toast.makeText(MainActivity.this, "Order", Toast.LENGTH_SHORT).show();
selectedFragment = new OrderFragment();
break;
case R.id.action_bill:
// Toast.makeText(MainActivity.this, "Bill", Toast.LENGTH_SHORT).show();
selectedFragment = new BillFragment();
break;
case R.id.action_stock:
// Toast.makeText(MainActivity.this, "Stock", Toast.LENGTH_SHORT).show();
selectedFragment = new StockFragment();
break;
case R.id.action_setting:
// Toast.makeText(MainActivity.this, "Setting", Toast.LENGTH_SHORT).show();
selectedFragment = new SettingFragment();
break;
}
openFragment(selectedFragment);
return true;
}
});
// ActionBar actionBar = this.getSupportActionBar();
// actionBar.setDisplayHomeAsUpEnabled(true); //For back button in titlebar
}
// @Override
// protected void attachBaseContext(Context newBase) {
// super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
// }
// @Override
// protected void attachBaseContext(Context newBase) {
// super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase));
// }
// static {
// AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
// }
private void openFragment(Fragment fragment) {
FragmentTransaction fm = getSupportFragmentManager().beginTransaction();
fm.replace(R.id.fragment_container, fragment).commit();
}
}
| UTF-8 | Java | 4,280 | java | MainActivity.java | Java | []
| null | []
| package com.example.aquafish;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import android.content.Context;
import android.graphics.Typeface;
import android.os.Bundle;
import android.text.SpannableStringBuilder;
import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.widget.AppCompatTextView;
import com.google.android.material.bottomnavigation.BottomNavigationView;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new TraderFragment()).commit();
BottomNavigationView bottomNavigationView = (BottomNavigationView) findViewById(R.id.bottom_navigation);
Typeface font = Typeface.createFromAsset(getAssets(), "fonts/unicode.futurab.ttf");
CustomTypefaceSpan typefaceSpan = new CustomTypefaceSpan("", font);
for (int i = 0; i <bottomNavigationView.getMenu().size(); i++) {
MenuItem menuItem = bottomNavigationView.getMenu().getItem(i);
SpannableStringBuilder spannableTitle = new SpannableStringBuilder(menuItem.getTitle());
spannableTitle.setSpan(typefaceSpan, 0, spannableTitle.length(), 0);
menuItem.setTitle(spannableTitle);
}
bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
Fragment selectedFragment = null;
switch (item.getItemId()) {
case R.id.action_trader:
// Toast.makeText(MainActivity.this, "Trader", Toast.LENGTH_SHORT).show();
selectedFragment = new TraderFragment();
break;
case R.id.action_order:
// Toast.makeText(MainActivity.this, "Order", Toast.LENGTH_SHORT).show();
selectedFragment = new OrderFragment();
break;
case R.id.action_bill:
// Toast.makeText(MainActivity.this, "Bill", Toast.LENGTH_SHORT).show();
selectedFragment = new BillFragment();
break;
case R.id.action_stock:
// Toast.makeText(MainActivity.this, "Stock", Toast.LENGTH_SHORT).show();
selectedFragment = new StockFragment();
break;
case R.id.action_setting:
// Toast.makeText(MainActivity.this, "Setting", Toast.LENGTH_SHORT).show();
selectedFragment = new SettingFragment();
break;
}
openFragment(selectedFragment);
return true;
}
});
// ActionBar actionBar = this.getSupportActionBar();
// actionBar.setDisplayHomeAsUpEnabled(true); //For back button in titlebar
}
// @Override
// protected void attachBaseContext(Context newBase) {
// super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
// }
// @Override
// protected void attachBaseContext(Context newBase) {
// super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase));
// }
// static {
// AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
// }
private void openFragment(Fragment fragment) {
FragmentTransaction fm = getSupportFragmentManager().beginTransaction();
fm.replace(R.id.fragment_container, fragment).commit();
}
}
| 4,280 | 0.650467 | 0.649766 | 107 | 39 | 32.829781 | 126 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.700935 | false | false | 10 |
6e5df4ed24ac434a9ed4f5878ba2589b22849e5e | 2,267,742,803,009 | a4a51084cfb715c7076c810520542af38a854868 | /src/main/java/com/google/android/gms/internal/vision/zzag.java | f00b4573457de1763ececfd70817a4238c9c2227 | []
| no_license | BharathPalanivelu/repotest | https://github.com/BharathPalanivelu/repotest | ddaf56a94eb52867408e0e769f35bef2d815da72 | f78ae38738d2ba6c9b9b4049f3092188fabb5b59 | refs/heads/master | 2020-09-30T18:55:04.802000 | 2019-12-02T10:52:08 | 2019-12-02T10:52:08 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.google.android.gms.internal.vision;
import android.os.Parcel;
import android.os.Parcelable;
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelWriter;
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
@SafeParcelable.Class(creator = "WordBoxParcelCreator")
@SafeParcelable.Reserved({1})
public final class zzag extends AbstractSafeParcelable {
public static final Parcelable.Creator<zzag> CREATOR = new zzah();
@SafeParcelable.Field(id = 6)
private final float zzco;
@SafeParcelable.Field(id = 7)
public final String zzdd;
@SafeParcelable.Field(id = 3)
public final zzr zzdj;
@SafeParcelable.Field(id = 4)
private final zzr zzdk;
@SafeParcelable.Field(id = 5)
public final String zzdm;
@SafeParcelable.Field(id = 2)
private final zzab[] zzds;
@SafeParcelable.Field(id = 8)
private final boolean zzdt;
@SafeParcelable.Constructor
public zzag(@SafeParcelable.Param(id = 2) zzab[] zzabArr, @SafeParcelable.Param(id = 3) zzr zzr, @SafeParcelable.Param(id = 4) zzr zzr2, @SafeParcelable.Param(id = 5) String str, @SafeParcelable.Param(id = 6) float f2, @SafeParcelable.Param(id = 7) String str2, @SafeParcelable.Param(id = 8) boolean z) {
this.zzds = zzabArr;
this.zzdj = zzr;
this.zzdk = zzr2;
this.zzdm = str;
this.zzco = f2;
this.zzdd = str2;
this.zzdt = z;
}
public final void writeToParcel(Parcel parcel, int i) {
int beginObjectHeader = SafeParcelWriter.beginObjectHeader(parcel);
SafeParcelWriter.writeTypedArray(parcel, 2, this.zzds, i, false);
SafeParcelWriter.writeParcelable(parcel, 3, this.zzdj, i, false);
SafeParcelWriter.writeParcelable(parcel, 4, this.zzdk, i, false);
SafeParcelWriter.writeString(parcel, 5, this.zzdm, false);
SafeParcelWriter.writeFloat(parcel, 6, this.zzco);
SafeParcelWriter.writeString(parcel, 7, this.zzdd, false);
SafeParcelWriter.writeBoolean(parcel, 8, this.zzdt);
SafeParcelWriter.finishObjectHeader(parcel, beginObjectHeader);
}
}
| UTF-8 | Java | 2,214 | java | zzag.java | Java | []
| null | []
| package com.google.android.gms.internal.vision;
import android.os.Parcel;
import android.os.Parcelable;
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelWriter;
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
@SafeParcelable.Class(creator = "WordBoxParcelCreator")
@SafeParcelable.Reserved({1})
public final class zzag extends AbstractSafeParcelable {
public static final Parcelable.Creator<zzag> CREATOR = new zzah();
@SafeParcelable.Field(id = 6)
private final float zzco;
@SafeParcelable.Field(id = 7)
public final String zzdd;
@SafeParcelable.Field(id = 3)
public final zzr zzdj;
@SafeParcelable.Field(id = 4)
private final zzr zzdk;
@SafeParcelable.Field(id = 5)
public final String zzdm;
@SafeParcelable.Field(id = 2)
private final zzab[] zzds;
@SafeParcelable.Field(id = 8)
private final boolean zzdt;
@SafeParcelable.Constructor
public zzag(@SafeParcelable.Param(id = 2) zzab[] zzabArr, @SafeParcelable.Param(id = 3) zzr zzr, @SafeParcelable.Param(id = 4) zzr zzr2, @SafeParcelable.Param(id = 5) String str, @SafeParcelable.Param(id = 6) float f2, @SafeParcelable.Param(id = 7) String str2, @SafeParcelable.Param(id = 8) boolean z) {
this.zzds = zzabArr;
this.zzdj = zzr;
this.zzdk = zzr2;
this.zzdm = str;
this.zzco = f2;
this.zzdd = str2;
this.zzdt = z;
}
public final void writeToParcel(Parcel parcel, int i) {
int beginObjectHeader = SafeParcelWriter.beginObjectHeader(parcel);
SafeParcelWriter.writeTypedArray(parcel, 2, this.zzds, i, false);
SafeParcelWriter.writeParcelable(parcel, 3, this.zzdj, i, false);
SafeParcelWriter.writeParcelable(parcel, 4, this.zzdk, i, false);
SafeParcelWriter.writeString(parcel, 5, this.zzdm, false);
SafeParcelWriter.writeFloat(parcel, 6, this.zzco);
SafeParcelWriter.writeString(parcel, 7, this.zzdd, false);
SafeParcelWriter.writeBoolean(parcel, 8, this.zzdt);
SafeParcelWriter.finishObjectHeader(parcel, beginObjectHeader);
}
}
| 2,214 | 0.710479 | 0.697832 | 50 | 43.279999 | 44.334202 | 308 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.2 | false | false | 10 |
85d3c985bf0acabbde26a98db3dc3b4aabc30475 | 17,420,387,410,222 | a46465ea05648608d3541a261bff3bc2409dcda9 | /hibernate/src/com/dao/PageManager.java | 187d9e0819ef318b9ccdffa4f458aa2201229f2f | []
| no_license | picls/synchronize | https://github.com/picls/synchronize | f15a7084b2d7d8f6472e93c3f20b48b557316787 | f43a603681439e659dc5d942e81105954e57b440 | refs/heads/master | 2016-09-06T10:16:59.968000 | 2015-05-16T03:40:49 | 2015-05-16T03:40:49 | 35,668,740 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.dao;
public class PageManager {
}
| UTF-8 | Java | 48 | java | PageManager.java | Java | []
| null | []
| package com.dao;
public class PageManager {
}
| 48 | 0.729167 | 0.729167 | 5 | 8.6 | 10.613199 | 26 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false | 10 |
2cc38ce0f665fdc95d66babbbad68bd84ab0130a | 5,403,068,912,270 | 87ffe6cef639e2b96b8d5236b5ace57e16499491 | /app/src/main/java/org/apache/thrift/protocol/d.java | 7d561b39a6e5a02255aeaf4196abf47ded16ab9a | []
| no_license | leerduo/FoodsNutrition | https://github.com/leerduo/FoodsNutrition | 24ffeea902754b84a2b9fbd3299cf4fceb38da3f | a448a210e54f789201566da48cc44eceb719b212 | refs/heads/master | 2020-12-11T05:45:34.531000 | 2015-08-28T04:35:05 | 2015-08-28T04:35:05 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.apache.thrift.protocol;
public final class d
{
public final byte a;
public final int b;
public d()
{
this((byte)0, 0);
}
public d(byte paramByte, int paramInt)
{
this.a = paramByte;
this.b = paramInt;
}
}
/* Location: D:\15036015\反编译\shiwuku\classes_dex2jar.jar
* Qualified Name: org.apache.thrift.protocol.d
* JD-Core Version: 0.7.0-SNAPSHOT-20130630
*/ | UTF-8 | Java | 429 | java | d.java | Java | []
| null | []
| package org.apache.thrift.protocol;
public final class d
{
public final byte a;
public final int b;
public d()
{
this((byte)0, 0);
}
public d(byte paramByte, int paramInt)
{
this.a = paramByte;
this.b = paramInt;
}
}
/* Location: D:\15036015\反编译\shiwuku\classes_dex2jar.jar
* Qualified Name: org.apache.thrift.protocol.d
* JD-Core Version: 0.7.0-SNAPSHOT-20130630
*/ | 429 | 0.628842 | 0.576832 | 24 | 16.666666 | 18.494743 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 10 |
53692d900d1c7448745d9530826cc44051d2bdc8 | 20,675,972,607,800 | c61b08c9fb5999a4e6a9ba84254baadf805333af | /src/main/java/org/vashonsd/Utils/Minigame.java | 7a34d6f9b0473bc38c6df2d4f30750ec054070c9 | []
| no_license | ajamesVISD/Minigames | https://github.com/ajamesVISD/Minigames | bb8056e67c8fac251997320b58e8b5d1bb97b0f8 | 93e5a31fd3df123a7a2eea80a3d8921fcf50efbd | refs/heads/master | 2020-03-15T03:13:26.981000 | 2018-06-22T02:32:08 | 2018-06-22T02:32:08 | 131,937,192 | 1 | 8 | null | false | 2018-06-23T21:44:28 | 2018-05-03T03:30:21 | 2018-06-22T02:32:26 | 2018-06-23T21:43:42 | 137 | 1 | 9 | 1 | Java | false | null | package org.vashonsd.Utils;
/**
* A Minigame can be run as a text-based game that interacts with the user.
*
* The mechanics of interacting with the user are left out of this code.
* It uses public methods to start, to finish, and, in between, respond
* to Strings with Strings.
*/
public abstract class Minigame {
protected String name;
protected String description;
protected String quitWord;
public Minigame(String name, String description, String quitWord) {
this.name = name;
this.description = description;
this.quitWord = quitWord;
}
public String getName() {
return this.name;
}
public String getDescription() {
return this.description;
}
public String getQuitWord() {
return this.quitWord;
}
/**
* This method will be called when the game is started.
*
* This method can be used just to return a welcome message,
* or it could also be used to set up the starting state of a game.
* If the game will ever restarting, consider creating a setUp()
* method that can be reused.
*
* @return A String representing a greeting.
*/
public abstract String start();
/**
* This method will be called while the game is in play.
*
* handle() is the sole public method that should be called during
* game interactions.
*
* @param str The String representing input from the user.
* @return The response to the user.
*/
public abstract String handle(String str);
// //Handle method which interacts with the user in the game.
/**
* This method will be called with the user signals a quit.
*
* @return A String representing an exit message
*/
public abstract String quit();
}
| UTF-8 | Java | 1,809 | java | Minigame.java | Java | []
| null | []
| package org.vashonsd.Utils;
/**
* A Minigame can be run as a text-based game that interacts with the user.
*
* The mechanics of interacting with the user are left out of this code.
* It uses public methods to start, to finish, and, in between, respond
* to Strings with Strings.
*/
public abstract class Minigame {
protected String name;
protected String description;
protected String quitWord;
public Minigame(String name, String description, String quitWord) {
this.name = name;
this.description = description;
this.quitWord = quitWord;
}
public String getName() {
return this.name;
}
public String getDescription() {
return this.description;
}
public String getQuitWord() {
return this.quitWord;
}
/**
* This method will be called when the game is started.
*
* This method can be used just to return a welcome message,
* or it could also be used to set up the starting state of a game.
* If the game will ever restarting, consider creating a setUp()
* method that can be reused.
*
* @return A String representing a greeting.
*/
public abstract String start();
/**
* This method will be called while the game is in play.
*
* handle() is the sole public method that should be called during
* game interactions.
*
* @param str The String representing input from the user.
* @return The response to the user.
*/
public abstract String handle(String str);
// //Handle method which interacts with the user in the game.
/**
* This method will be called with the user signals a quit.
*
* @return A String representing an exit message
*/
public abstract String quit();
}
| 1,809 | 0.647872 | 0.647872 | 65 | 26.830769 | 24.742098 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.323077 | false | false | 10 |
58f488989dc5566c2f56138001cb7fdd40dbb8d4 | 24,446,953,905,836 | e32c46bba067c7cc723946cc5c666333fccc72ca | /src/main/java/progressMonitor/MyStompSessionHandler.java | e4cf4fa8011ac5d192ebd101826ec5da811f3aa3 | []
| no_license | accessallow/live-progress-monitor | https://github.com/accessallow/live-progress-monitor | 199378cd6944e7acc4dc8f7a01949fa4e221aa80 | 8c16b72eca885f85912da08d291bb3cc25880930 | refs/heads/master | 2020-05-22T06:02:16.835000 | 2019-11-11T03:49:19 | 2019-11-11T03:49:19 | 186,246,421 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package progressMonitor;
import java.lang.reflect.Type;
import org.springframework.messaging.simp.stomp.StompCommand;
import org.springframework.messaging.simp.stomp.StompHeaders;
import org.springframework.messaging.simp.stomp.StompSession;
import org.springframework.messaging.simp.stomp.StompSessionHandler;
public class MyStompSessionHandler implements StompSessionHandler {
StompSession commonSession = null;
boolean connected = false;
@Override
public Type getPayloadType(StompHeaders arg0) {
return null;
}
@Override
public void handleFrame(StompHeaders headers, Object payload) {
}
@Override
public void afterConnected(StompSession session, StompHeaders connectedHeaders) {
this.commonSession = session;
session.subscribe("/topic/greetings", this);
connected = true;
}
public void sendMessage(ProgressReport progressReport){
if(connected){
synchronized (commonSession) {
// System.out.println(progressReport);
commonSession.send("/app/hello", progressReport);
}
}
}
@Override
public void handleException(StompSession arg0, StompCommand arg1, StompHeaders arg2, byte[] arg3, Throwable arg4) {
}
@Override
public void handleTransportError(StompSession arg0, Throwable arg1) {
}
}
| UTF-8 | Java | 1,256 | java | MyStompSessionHandler.java | Java | []
| null | []
| package progressMonitor;
import java.lang.reflect.Type;
import org.springframework.messaging.simp.stomp.StompCommand;
import org.springframework.messaging.simp.stomp.StompHeaders;
import org.springframework.messaging.simp.stomp.StompSession;
import org.springframework.messaging.simp.stomp.StompSessionHandler;
public class MyStompSessionHandler implements StompSessionHandler {
StompSession commonSession = null;
boolean connected = false;
@Override
public Type getPayloadType(StompHeaders arg0) {
return null;
}
@Override
public void handleFrame(StompHeaders headers, Object payload) {
}
@Override
public void afterConnected(StompSession session, StompHeaders connectedHeaders) {
this.commonSession = session;
session.subscribe("/topic/greetings", this);
connected = true;
}
public void sendMessage(ProgressReport progressReport){
if(connected){
synchronized (commonSession) {
// System.out.println(progressReport);
commonSession.send("/app/hello", progressReport);
}
}
}
@Override
public void handleException(StompSession arg0, StompCommand arg1, StompHeaders arg2, byte[] arg3, Throwable arg4) {
}
@Override
public void handleTransportError(StompSession arg0, Throwable arg1) {
}
}
| 1,256 | 0.774682 | 0.768312 | 50 | 24.120001 | 28.184137 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.62 | false | false | 10 |
7274bef8c9dcc6163c3ec1048b4d4fbed1132a86 | 7,730,941,182,836 | 9d4452c73ff657db1e24b85bdb12c5ec5f9e99ab | /Java-Collections-Homework/src/CardsFrequencies.java | 6533af1cd81bb36923ea7c3db5888a918cf316ab | []
| no_license | IgnatDishliev/SoftUni-Java-Fundamentals-03.2016 | https://github.com/IgnatDishliev/SoftUni-Java-Fundamentals-03.2016 | 87e564fa6cd0b7d463ec84567b82992a5dc912fd | 44a17a1543ca03bd17bd669ba952b8bd727e63a5 | refs/heads/master | 2018-01-07T23:34:23.787000 | 2016-05-12T08:44:05 | 2016-05-12T08:44:05 | 54,634,037 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.*;
public class CardsFrequencies {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
List<String> cards = Arrays.asList((console.nextLine().split(" ")));
Map<String, Double> cardsFrequency = new LinkedHashMap<>();
for (int i = 0; i < cards.size(); i++) {
String currentCard = cards.get(i).substring(0, cards.get(i).length() - 1);
double currentCardCount = 1;
if (cardsFrequency.containsKey(currentCard)) {
continue;
}
for (int j = 0; j < cards.size(); j++) {
String checkedCard = cards.get(j).substring(0, cards.get(j).length() - 1);
if (i == j ) {
continue;
}
if (currentCard.equals(checkedCard)) {
currentCardCount++;
}
}
cardsFrequency.put(currentCard, currentCardCount / cards.size() * 100);
}
for (Map.Entry<String, Double> pair : cardsFrequency.entrySet()) {
System.out.printf("%s -> %.2f%%%n", pair.getKey(), pair.getValue());
}
}
}
| UTF-8 | Java | 1,195 | java | CardsFrequencies.java | Java | []
| null | []
| import java.util.*;
public class CardsFrequencies {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
List<String> cards = Arrays.asList((console.nextLine().split(" ")));
Map<String, Double> cardsFrequency = new LinkedHashMap<>();
for (int i = 0; i < cards.size(); i++) {
String currentCard = cards.get(i).substring(0, cards.get(i).length() - 1);
double currentCardCount = 1;
if (cardsFrequency.containsKey(currentCard)) {
continue;
}
for (int j = 0; j < cards.size(); j++) {
String checkedCard = cards.get(j).substring(0, cards.get(j).length() - 1);
if (i == j ) {
continue;
}
if (currentCard.equals(checkedCard)) {
currentCardCount++;
}
}
cardsFrequency.put(currentCard, currentCardCount / cards.size() * 100);
}
for (Map.Entry<String, Double> pair : cardsFrequency.entrySet()) {
System.out.printf("%s -> %.2f%%%n", pair.getKey(), pair.getValue());
}
}
}
| 1,195 | 0.51046 | 0.501255 | 37 | 31.297297 | 29.326553 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.621622 | false | false | 10 |
ebc50c6381ccc6dd3900d2343d398d6bcd309703 | 16,887,811,431,429 | fffb5ff783b350e0e0ba0edf6f240ded34e69644 | /PrismCoreWS/src/com/project/prism/http/ServletController.java | 629dc851de5f84b678c3c57769e541c1f926e8fe | []
| no_license | tuanhaibk/PRISM | https://github.com/tuanhaibk/PRISM | 5e1b802a20ed5d12afe3fa941d3f0f85360274d9 | b1ebf107fe008e188aaebf8d37d741c5919bc323 | refs/heads/master | 2017-06-30T02:01:51.577000 | 2017-06-29T02:14:57 | 2017-06-29T02:14:57 | 95,099,214 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.project.prism.http;
import com.google.gson.Gson;
import com.project.prism.controller.CommonActivity;
import com.project.prism.object.GroupPost;
import com.project.prism.object.User;
import com.project.prism.util.Constant;
import com.project.prism.util.MySqlManager;
import com.project.prism.util.Util;
import java.io.IOException;
import java.io.PrintWriter;
import org.apache.log4j.Logger;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.simple.JSONArray;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import org.openqa.selenium.remote.RemoteWebDriver;
/**
*
* @author haipt22_prism
*/
public class ServletController extends HttpServlet {
private static final Logger log = Util.doLog(ServletController.class);
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
String resultStr;
try {
String cmd = request.getParameter("cmd");
JSONObject jsobj = new JSONObject();
switch (cmd) {
case COMMAND_TYPE.PUBLIST_TO_GROUP:
String content = request.getParameter("arrayPost");
log.info(content);
JSONParser parser = new JSONParser();
Object obj = null;
try {
obj = parser.parse(content);
} catch (ParseException ex) {
log.error(ex);
}
JSONArray array = (JSONArray) obj;
for (Object object : array) {
Gson g = new Gson();
GroupPost group = g.fromJson(object.toString(), GroupPost.class);
String group_id = group.getGroupId();
log.info("group_id = " + group_id);
String user = group.getUser();
log.info("user " + user);
String message = group.getContent();
log.info("message " + message);
String path_image = group.getImage();
log.info("image " + path_image);
// path_image = Util.getValueProperties("avatar") + "2.jpg";
String time = group.getTime();
log.info("time " + time);
//
String pass = MySqlManager.getResultStatement("account", new String[]{"user"}, new String[]{user}, new String[]{"password"})[0];
RemoteWebDriver driver = CommonActivity.initDriver("chrome", new User(user, pass));
CommonActivity.loginFacebook(new User(user, pass), driver);
String status = MySqlManager.getResultStatement("account", new String[]{"user"}, new String[]{user}, new String[]{"status"})[0];
if (status.equals(Constant.ACCOUNT_STATUS.SUCCESS)) {
// BreedingAcc.randomActivity(driver);
boolean result = CommonActivity.publishPostGroup(driver, Constant.FB_URL_COMMON.GROUP + group_id, path_image, message);
if (result) {
try {
jsobj.put(group_id, "1");
} catch (JSONException ex) {
log.error(ex);
}
// resultStr = "Success post to " + Constant.FB_URL_COMMON.GROUP + group_id;
} else {
try {
jsobj.put(group_id, "0");
} catch (JSONException ex) {
log.error(ex);
}
// resultStr = "Fail post to " + Constant.FB_URL_COMMON.GROUP + group_id;
}
} else {
// resultStr = "Login fail acc " + user;
try {
jsobj.put(group_id, "3");
} catch (JSONException ex) {
log.error(ex);
}
}
// driver.quit();
}
resultStr = jsobj.toString();
break;
case "test":
String message1 = request.getParameter("message");
log.info("message " + message1);
resultStr = "Success " + message1;
break;
default:
resultStr = "cmd wrong";
break;
}
} catch (Exception e) {
log.error("processRequest fail", e);
resultStr = "fail";
}
log.info("Result = " + resultStr);
response.setContentType("text/html;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
/* TODO output your page here. You may use following sample code. */
// out.println("<!DOCTYPE html>");
// out.println("<html>");
// out.println("<head>");
// out.println("<title>Servlet ServletController</title>");
// out.println("</head>");
// out.println("<body>");
// out.println("<h1>RESULT IS: " + resultStr + "</h1>");
// out.println("</body>");
// out.println("</html>");
out.println(resultStr);
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
public interface COMMAND_TYPE {
public static String PUBLIST_TO_GROUP = "publish_group";
}
}
| UTF-8 | Java | 7,881 | java | ServletController.java | Java | [
{
"context": "elenium.remote.RemoteWebDriver;\n\n/**\n *\n * @author haipt22_prism\n */\npublic class ServletController extends HttpSe",
"end": 1023,
"score": 0.9996214509010315,
"start": 1010,
"tag": "USERNAME",
"value": "haipt22_prism"
}
]
| null | []
| /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.project.prism.http;
import com.google.gson.Gson;
import com.project.prism.controller.CommonActivity;
import com.project.prism.object.GroupPost;
import com.project.prism.object.User;
import com.project.prism.util.Constant;
import com.project.prism.util.MySqlManager;
import com.project.prism.util.Util;
import java.io.IOException;
import java.io.PrintWriter;
import org.apache.log4j.Logger;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.simple.JSONArray;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import org.openqa.selenium.remote.RemoteWebDriver;
/**
*
* @author haipt22_prism
*/
public class ServletController extends HttpServlet {
private static final Logger log = Util.doLog(ServletController.class);
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
String resultStr;
try {
String cmd = request.getParameter("cmd");
JSONObject jsobj = new JSONObject();
switch (cmd) {
case COMMAND_TYPE.PUBLIST_TO_GROUP:
String content = request.getParameter("arrayPost");
log.info(content);
JSONParser parser = new JSONParser();
Object obj = null;
try {
obj = parser.parse(content);
} catch (ParseException ex) {
log.error(ex);
}
JSONArray array = (JSONArray) obj;
for (Object object : array) {
Gson g = new Gson();
GroupPost group = g.fromJson(object.toString(), GroupPost.class);
String group_id = group.getGroupId();
log.info("group_id = " + group_id);
String user = group.getUser();
log.info("user " + user);
String message = group.getContent();
log.info("message " + message);
String path_image = group.getImage();
log.info("image " + path_image);
// path_image = Util.getValueProperties("avatar") + "2.jpg";
String time = group.getTime();
log.info("time " + time);
//
String pass = MySqlManager.getResultStatement("account", new String[]{"user"}, new String[]{user}, new String[]{"password"})[0];
RemoteWebDriver driver = CommonActivity.initDriver("chrome", new User(user, pass));
CommonActivity.loginFacebook(new User(user, pass), driver);
String status = MySqlManager.getResultStatement("account", new String[]{"user"}, new String[]{user}, new String[]{"status"})[0];
if (status.equals(Constant.ACCOUNT_STATUS.SUCCESS)) {
// BreedingAcc.randomActivity(driver);
boolean result = CommonActivity.publishPostGroup(driver, Constant.FB_URL_COMMON.GROUP + group_id, path_image, message);
if (result) {
try {
jsobj.put(group_id, "1");
} catch (JSONException ex) {
log.error(ex);
}
// resultStr = "Success post to " + Constant.FB_URL_COMMON.GROUP + group_id;
} else {
try {
jsobj.put(group_id, "0");
} catch (JSONException ex) {
log.error(ex);
}
// resultStr = "Fail post to " + Constant.FB_URL_COMMON.GROUP + group_id;
}
} else {
// resultStr = "Login fail acc " + user;
try {
jsobj.put(group_id, "3");
} catch (JSONException ex) {
log.error(ex);
}
}
// driver.quit();
}
resultStr = jsobj.toString();
break;
case "test":
String message1 = request.getParameter("message");
log.info("message " + message1);
resultStr = "Success " + message1;
break;
default:
resultStr = "cmd wrong";
break;
}
} catch (Exception e) {
log.error("processRequest fail", e);
resultStr = "fail";
}
log.info("Result = " + resultStr);
response.setContentType("text/html;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
/* TODO output your page here. You may use following sample code. */
// out.println("<!DOCTYPE html>");
// out.println("<html>");
// out.println("<head>");
// out.println("<title>Servlet ServletController</title>");
// out.println("</head>");
// out.println("<body>");
// out.println("<h1>RESULT IS: " + resultStr + "</h1>");
// out.println("</body>");
// out.println("</html>");
out.println(resultStr);
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
public interface COMMAND_TYPE {
public static String PUBLIST_TO_GROUP = "publish_group";
}
}
| 7,881 | 0.532039 | 0.529882 | 191 | 40.26178 | 27.988302 | 152 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.623037 | false | false | 10 |
59c292190d0bb357fcad49c35604bafabf4ec06f | 15,882,789,083,266 | 78fc30c57b5f37d92a83ed4229a6cd74b12e74bf | /src/main/java/com/synergygb/panama/democda/models/db/Usuarios.java | 812ff9fbe89b0b2c4d390c9c68513b33796af473 | []
| no_license | juanjgarcial/demo-cda-rest | https://github.com/juanjgarcial/demo-cda-rest | 49bd1f9377ccd9e9419e6cdd0d02b558a852edc7 | 59afbb88ed0b2b26549abfe499a39f50f21d3b4a | refs/heads/master | 2021-01-10T09:29:24.983000 | 2015-11-19T16:02:25 | 2015-11-19T16:02:25 | 43,773,837 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.synergygb.panama.democda.models.db;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
*
* @author Juan Garcia <juan.garcia@synergy-gb.com>
*/
@Entity
@Table(name = "usuarios")
@NamedQueries({
@NamedQuery(name = "Usuarios.findAll", query = "SELECT u FROM Usuarios u"),
@NamedQuery(name = "Usuarios.findByUId", query = "SELECT u FROM Usuarios u WHERE u.uId = :uId"),
@NamedQuery(name = "Usuarios.findByUName", query = "SELECT u FROM Usuarios u WHERE u.uName = :uName"),
@NamedQuery(name = "Usuarios.findByULastname", query = "SELECT u FROM Usuarios u WHERE u.uLastname = :uLastname"),
@NamedQuery(name = "Usuarios.findByUEmail", query = "SELECT u FROM Usuarios u WHERE u.uEmail = :uEmail"),
@NamedQuery(name = "Usuarios.findByUPhone", query = "SELECT u FROM Usuarios u WHERE u.uPhone = :uPhone"),
@NamedQuery(name = "Usuarios.findByUPicture", query = "SELECT u FROM Usuarios u WHERE u.uPicture = :uPicture"),
@NamedQuery(name = "Usuarios.findByUUser", query = "SELECT u FROM Usuarios u WHERE u.uUser = :uUser"),
@NamedQuery(name = "Usuarios.findByUPassword", query = "SELECT u FROM Usuarios u WHERE u.uPassword = :uPassword"),
@NamedQuery(name = "Usuarios.findByUuserCreate", query = "SELECT u FROM Usuarios u WHERE u.uuserCreate = :uuserCreate"),
@NamedQuery(name = "Usuarios.findByUuserUpdate", query = "SELECT u FROM Usuarios u WHERE u.uuserUpdate = :uuserUpdate"),
@NamedQuery(name = "Usuarios.findByUdateCreate", query = "SELECT u FROM Usuarios u WHERE u.udateCreate = :udateCreate"),
@NamedQuery(name = "Usuarios.findByUdateUpdate", query = "SELECT u FROM Usuarios u WHERE u.udateUpdate = :udateUpdate"),
@NamedQuery(name = "Usuarios.findByUPermitology", query = "SELECT u FROM Usuarios u WHERE u.uPermitology = :uPermitology")})
public class Usuarios implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "u_id")
private Integer uId;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 100)
@Column(name = "u_name")
private String uName;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 100)
@Column(name = "u_lastname")
private String uLastname;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 150)
@Column(name = "u_email")
private String uEmail;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 12)
@Column(name = "u_phone")
private String uPhone;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 200)
@Column(name = "u_picture")
private String uPicture;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 50)
@Column(name = "u_user")
private String uUser;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 16)
@Column(name = "u_password")
private String uPassword;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 20)
@Column(name = "u_userCreate")
private String uuserCreate;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 20)
@Column(name = "u_userUpdate")
private String uuserUpdate;
@Basic(optional = false)
@NotNull
@Column(name = "u_dateCreate")
@Temporal(TemporalType.DATE)
private Date udateCreate;
@Basic(optional = false)
@NotNull
@Column(name = "u_dateUpdate")
@Temporal(TemporalType.DATE)
private Date udateUpdate;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 70)
@Column(name = "u_permitology")
private String uPermitology;
@JoinColumn(name = "u_tipo", referencedColumnName = "tu_id")
@ManyToOne(optional = false)
private TipoUsuarios uTipo;
public Usuarios() {
}
public Usuarios(Integer uId) {
this.uId = uId;
}
public Usuarios(Integer uId, String uName, String uLastname, String uEmail, String uPhone, String uPicture, String uUser, String uPassword, String uuserCreate, String uuserUpdate, Date udateCreate, Date udateUpdate, String uPermitology) {
this.uId = uId;
this.uName = uName;
this.uLastname = uLastname;
this.uEmail = uEmail;
this.uPhone = uPhone;
this.uPicture = uPicture;
this.uUser = uUser;
this.uPassword = uPassword;
this.uuserCreate = uuserCreate;
this.uuserUpdate = uuserUpdate;
this.udateCreate = udateCreate;
this.udateUpdate = udateUpdate;
this.uPermitology = uPermitology;
}
public Integer getUId() {
return uId;
}
public void setUId(Integer uId) {
this.uId = uId;
}
public String getUName() {
return uName;
}
public void setUName(String uName) {
this.uName = uName;
}
public String getULastname() {
return uLastname;
}
public void setULastname(String uLastname) {
this.uLastname = uLastname;
}
public String getUEmail() {
return uEmail;
}
public void setUEmail(String uEmail) {
this.uEmail = uEmail;
}
public String getUPhone() {
return uPhone;
}
public void setUPhone(String uPhone) {
this.uPhone = uPhone;
}
public String getUPicture() {
return uPicture;
}
public void setUPicture(String uPicture) {
this.uPicture = uPicture;
}
public String getUUser() {
return uUser;
}
public void setUUser(String uUser) {
this.uUser = uUser;
}
public String getUPassword() {
return uPassword;
}
public void setUPassword(String uPassword) {
this.uPassword = uPassword;
}
public String getUuserCreate() {
return uuserCreate;
}
public void setUuserCreate(String uuserCreate) {
this.uuserCreate = uuserCreate;
}
public String getUuserUpdate() {
return uuserUpdate;
}
public void setUuserUpdate(String uuserUpdate) {
this.uuserUpdate = uuserUpdate;
}
public Date getUdateCreate() {
return udateCreate;
}
public void setUdateCreate(Date udateCreate) {
this.udateCreate = udateCreate;
}
public Date getUdateUpdate() {
return udateUpdate;
}
public void setUdateUpdate(Date udateUpdate) {
this.udateUpdate = udateUpdate;
}
public String getUPermitology() {
return uPermitology;
}
public void setUPermitology(String uPermitology) {
this.uPermitology = uPermitology;
}
public TipoUsuarios getUTipo() {
return uTipo;
}
public void setUTipo(TipoUsuarios uTipo) {
this.uTipo = uTipo;
}
@Override
public int hashCode() {
int hash = 0;
hash += (uId != null ? uId.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Usuarios)) {
return false;
}
Usuarios other = (Usuarios) object;
if ((this.uId == null && other.uId != null) || (this.uId != null && !this.uId.equals(other.uId))) {
return false;
}
return true;
}
@Override
public String toString() {
return "com.synergygb.panama.democda.models.db.Usuarios[ uId=" + uId + " ]";
}
}
| UTF-8 | Java | 8,031 | java | Usuarios.java | Java | [
{
"context": "ax.validation.constraints.Size;\n\n/**\n *\n * @author Juan Garcia <juan.garcia@synergy-gb.com>\n */\n@Entity\n@Table(n",
"end": 682,
"score": 0.9998761415481567,
"start": 671,
"tag": "NAME",
"value": "Juan Garcia"
},
{
"context": "constraints.Size;\n\n/**\n *\n * @author Juan Garcia <juan.garcia@synergy-gb.com>\n */\n@Entity\n@Table(name = \"usuarios\")\n@NamedQuer",
"end": 710,
"score": 0.9999358654022217,
"start": 684,
"tag": "EMAIL",
"value": "juan.garcia@synergy-gb.com"
},
{
"context": " this.uUser = uUser;\n this.uPassword = uPassword;\n this.uuserCreate = uuserCreate;\n ",
"end": 4933,
"score": 0.9955925941467285,
"start": 4924,
"tag": "PASSWORD",
"value": "uPassword"
}
]
| null | []
| package com.synergygb.panama.democda.models.db;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
*
* @author <NAME> <<EMAIL>>
*/
@Entity
@Table(name = "usuarios")
@NamedQueries({
@NamedQuery(name = "Usuarios.findAll", query = "SELECT u FROM Usuarios u"),
@NamedQuery(name = "Usuarios.findByUId", query = "SELECT u FROM Usuarios u WHERE u.uId = :uId"),
@NamedQuery(name = "Usuarios.findByUName", query = "SELECT u FROM Usuarios u WHERE u.uName = :uName"),
@NamedQuery(name = "Usuarios.findByULastname", query = "SELECT u FROM Usuarios u WHERE u.uLastname = :uLastname"),
@NamedQuery(name = "Usuarios.findByUEmail", query = "SELECT u FROM Usuarios u WHERE u.uEmail = :uEmail"),
@NamedQuery(name = "Usuarios.findByUPhone", query = "SELECT u FROM Usuarios u WHERE u.uPhone = :uPhone"),
@NamedQuery(name = "Usuarios.findByUPicture", query = "SELECT u FROM Usuarios u WHERE u.uPicture = :uPicture"),
@NamedQuery(name = "Usuarios.findByUUser", query = "SELECT u FROM Usuarios u WHERE u.uUser = :uUser"),
@NamedQuery(name = "Usuarios.findByUPassword", query = "SELECT u FROM Usuarios u WHERE u.uPassword = :uPassword"),
@NamedQuery(name = "Usuarios.findByUuserCreate", query = "SELECT u FROM Usuarios u WHERE u.uuserCreate = :uuserCreate"),
@NamedQuery(name = "Usuarios.findByUuserUpdate", query = "SELECT u FROM Usuarios u WHERE u.uuserUpdate = :uuserUpdate"),
@NamedQuery(name = "Usuarios.findByUdateCreate", query = "SELECT u FROM Usuarios u WHERE u.udateCreate = :udateCreate"),
@NamedQuery(name = "Usuarios.findByUdateUpdate", query = "SELECT u FROM Usuarios u WHERE u.udateUpdate = :udateUpdate"),
@NamedQuery(name = "Usuarios.findByUPermitology", query = "SELECT u FROM Usuarios u WHERE u.uPermitology = :uPermitology")})
public class Usuarios implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "u_id")
private Integer uId;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 100)
@Column(name = "u_name")
private String uName;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 100)
@Column(name = "u_lastname")
private String uLastname;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 150)
@Column(name = "u_email")
private String uEmail;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 12)
@Column(name = "u_phone")
private String uPhone;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 200)
@Column(name = "u_picture")
private String uPicture;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 50)
@Column(name = "u_user")
private String uUser;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 16)
@Column(name = "u_password")
private String uPassword;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 20)
@Column(name = "u_userCreate")
private String uuserCreate;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 20)
@Column(name = "u_userUpdate")
private String uuserUpdate;
@Basic(optional = false)
@NotNull
@Column(name = "u_dateCreate")
@Temporal(TemporalType.DATE)
private Date udateCreate;
@Basic(optional = false)
@NotNull
@Column(name = "u_dateUpdate")
@Temporal(TemporalType.DATE)
private Date udateUpdate;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 70)
@Column(name = "u_permitology")
private String uPermitology;
@JoinColumn(name = "u_tipo", referencedColumnName = "tu_id")
@ManyToOne(optional = false)
private TipoUsuarios uTipo;
public Usuarios() {
}
public Usuarios(Integer uId) {
this.uId = uId;
}
public Usuarios(Integer uId, String uName, String uLastname, String uEmail, String uPhone, String uPicture, String uUser, String uPassword, String uuserCreate, String uuserUpdate, Date udateCreate, Date udateUpdate, String uPermitology) {
this.uId = uId;
this.uName = uName;
this.uLastname = uLastname;
this.uEmail = uEmail;
this.uPhone = uPhone;
this.uPicture = uPicture;
this.uUser = uUser;
this.uPassword = <PASSWORD>;
this.uuserCreate = uuserCreate;
this.uuserUpdate = uuserUpdate;
this.udateCreate = udateCreate;
this.udateUpdate = udateUpdate;
this.uPermitology = uPermitology;
}
public Integer getUId() {
return uId;
}
public void setUId(Integer uId) {
this.uId = uId;
}
public String getUName() {
return uName;
}
public void setUName(String uName) {
this.uName = uName;
}
public String getULastname() {
return uLastname;
}
public void setULastname(String uLastname) {
this.uLastname = uLastname;
}
public String getUEmail() {
return uEmail;
}
public void setUEmail(String uEmail) {
this.uEmail = uEmail;
}
public String getUPhone() {
return uPhone;
}
public void setUPhone(String uPhone) {
this.uPhone = uPhone;
}
public String getUPicture() {
return uPicture;
}
public void setUPicture(String uPicture) {
this.uPicture = uPicture;
}
public String getUUser() {
return uUser;
}
public void setUUser(String uUser) {
this.uUser = uUser;
}
public String getUPassword() {
return uPassword;
}
public void setUPassword(String uPassword) {
this.uPassword = uPassword;
}
public String getUuserCreate() {
return uuserCreate;
}
public void setUuserCreate(String uuserCreate) {
this.uuserCreate = uuserCreate;
}
public String getUuserUpdate() {
return uuserUpdate;
}
public void setUuserUpdate(String uuserUpdate) {
this.uuserUpdate = uuserUpdate;
}
public Date getUdateCreate() {
return udateCreate;
}
public void setUdateCreate(Date udateCreate) {
this.udateCreate = udateCreate;
}
public Date getUdateUpdate() {
return udateUpdate;
}
public void setUdateUpdate(Date udateUpdate) {
this.udateUpdate = udateUpdate;
}
public String getUPermitology() {
return uPermitology;
}
public void setUPermitology(String uPermitology) {
this.uPermitology = uPermitology;
}
public TipoUsuarios getUTipo() {
return uTipo;
}
public void setUTipo(TipoUsuarios uTipo) {
this.uTipo = uTipo;
}
@Override
public int hashCode() {
int hash = 0;
hash += (uId != null ? uId.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Usuarios)) {
return false;
}
Usuarios other = (Usuarios) object;
if ((this.uId == null && other.uId != null) || (this.uId != null && !this.uId.equals(other.uId))) {
return false;
}
return true;
}
@Override
public String toString() {
return "com.synergygb.panama.democda.models.db.Usuarios[ uId=" + uId + " ]";
}
}
| 8,008 | 0.645872 | 0.641265 | 273 | 28.417582 | 29.142344 | 242 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.494505 | false | false | 10 |
4bcdbc094726bb15af4858c6f6de8b0efd90ce46 | 17,248,588,662,817 | 1d2fda2245888413e3eef8798a61236822f022db | /com/sun/xml/bind/v2/runtime/unmarshaller/StAXStreamConnector.java | b3c6d53408284bd8df8df9f2ac9c87b0e4fe1636 | [
"IJG"
]
| permissive | SynieztroLedPar/Wu | https://github.com/SynieztroLedPar/Wu | 3b4391e916f6a5605d60663f800702f3e45d5dfc | 5f7daebc2fb430411ddb76a179005eeecde9802b | refs/heads/master | 2023-04-29T17:27:08.301000 | 2020-10-10T22:28:40 | 2020-10-10T22:28:40 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.sun.xml.bind.v2.runtime.unmarshaller;
import com.sun.xml.bind.WhiteSpaceProcessor;
import java.lang.reflect.Constructor;
import javax.xml.stream.Location;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
class StAXStreamConnector
extends StAXConnector
{
private final XMLStreamReader staxStreamReader;
public static StAXConnector create(XMLStreamReader reader, XmlVisitor visitor)
{
Class readerClass = reader.getClass();
if ((FI_STAX_READER_CLASS != null) && (FI_STAX_READER_CLASS.isAssignableFrom(readerClass)) && (FI_CONNECTOR_CTOR != null)) {
try
{
return (StAXConnector)FI_CONNECTOR_CTOR.newInstance(new Object[] { reader, visitor });
}
catch (Exception t) {}
}
boolean isZephyr = readerClass.getName().equals("com.sun.xml.stream.XMLReaderImpl");
if (!isZephyr) {
if (!checkImplementaionNameOfSjsxp(reader)) {
if ((!getBoolProp(reader, "org.codehaus.stax2.internNames")) || (!getBoolProp(reader, "org.codehaus.stax2.internNsUris"))) {
visitor = new InterningXmlVisitor(visitor);
}
}
}
if ((STAX_EX_READER_CLASS != null) && (STAX_EX_READER_CLASS.isAssignableFrom(readerClass))) {
try
{
return (StAXConnector)STAX_EX_CONNECTOR_CTOR.newInstance(new Object[] { reader, visitor });
}
catch (Exception t) {}
}
return new StAXStreamConnector(reader, visitor);
}
private static boolean checkImplementaionNameOfSjsxp(XMLStreamReader reader)
{
try
{
Object name = reader.getProperty("http://java.sun.com/xml/stream/properties/implementation-name");
return (name != null) && (name.equals("sjsxp"));
}
catch (Exception e) {}
return false;
}
private static boolean getBoolProp(XMLStreamReader r, String n)
{
try
{
Object o = r.getProperty(n);
if ((o instanceof Boolean)) {
return ((Boolean)o).booleanValue();
}
return false;
}
catch (Exception e) {}
return false;
}
protected final StringBuilder buffer = new StringBuilder();
protected boolean textReported = false;
protected StAXStreamConnector(XMLStreamReader staxStreamReader, XmlVisitor visitor)
{
super(visitor);
this.staxStreamReader = staxStreamReader;
}
public void bridge()
throws XMLStreamException
{
try
{
int depth = 0;
int event = this.staxStreamReader.getEventType();
if (event == 7) {
while (!this.staxStreamReader.isStartElement()) {
event = this.staxStreamReader.next();
}
}
if (event != 1) {
throw new IllegalStateException("The current event is not START_ELEMENT\n but " + event);
}
handleStartDocument(this.staxStreamReader.getNamespaceContext());
for (;;)
{
switch (event)
{
case 1:
handleStartElement();
depth++;
break;
case 2:
depth--;
handleEndElement();
if (depth != 0) {
break;
}
break;
case 4:
case 6:
case 12:
handleCharacters();
}
event = this.staxStreamReader.next();
}
this.staxStreamReader.next();
handleEndDocument();
}
catch (SAXException e)
{
throw new XMLStreamException(e);
}
}
protected Location getCurrentLocation()
{
return this.staxStreamReader.getLocation();
}
protected String getCurrentQName()
{
return getQName(this.staxStreamReader.getPrefix(), this.staxStreamReader.getLocalName());
}
private void handleEndElement()
throws SAXException
{
processText(false);
this.tagName.uri = fixNull(this.staxStreamReader.getNamespaceURI());
this.tagName.local = this.staxStreamReader.getLocalName();
this.visitor.endElement(this.tagName);
int nsCount = this.staxStreamReader.getNamespaceCount();
for (int i = nsCount - 1; i >= 0; i--) {
this.visitor.endPrefixMapping(fixNull(this.staxStreamReader.getNamespacePrefix(i)));
}
}
private void handleStartElement()
throws SAXException
{
processText(true);
int nsCount = this.staxStreamReader.getNamespaceCount();
for (int i = 0; i < nsCount; i++) {
this.visitor.startPrefixMapping(fixNull(this.staxStreamReader.getNamespacePrefix(i)), fixNull(this.staxStreamReader.getNamespaceURI(i)));
}
this.tagName.uri = fixNull(this.staxStreamReader.getNamespaceURI());
this.tagName.local = this.staxStreamReader.getLocalName();
this.tagName.atts = this.attributes;
this.visitor.startElement(this.tagName);
}
private final Attributes attributes = new Attributes()
{
public int getLength()
{
return StAXStreamConnector.this.staxStreamReader.getAttributeCount();
}
public String getURI(int index)
{
String uri = StAXStreamConnector.this.staxStreamReader.getAttributeNamespace(index);
if (uri == null) {
return "";
}
return uri;
}
public String getLocalName(int index)
{
return StAXStreamConnector.this.staxStreamReader.getAttributeLocalName(index);
}
public String getQName(int index)
{
String prefix = StAXStreamConnector.this.staxStreamReader.getAttributePrefix(index);
if ((prefix == null) || (prefix.length() == 0)) {
return getLocalName(index);
}
return prefix + ':' + getLocalName(index);
}
public String getType(int index)
{
return StAXStreamConnector.this.staxStreamReader.getAttributeType(index);
}
public String getValue(int index)
{
return StAXStreamConnector.this.staxStreamReader.getAttributeValue(index);
}
public int getIndex(String uri, String localName)
{
for (int i = getLength() - 1; i >= 0; i--) {
if ((localName.equals(getLocalName(i))) && (uri.equals(getURI(i)))) {
return i;
}
}
return -1;
}
public int getIndex(String qName)
{
for (int i = getLength() - 1; i >= 0; i--) {
if (qName.equals(getQName(i))) {
return i;
}
}
return -1;
}
public String getType(String uri, String localName)
{
int index = getIndex(uri, localName);
if (index < 0) {
return null;
}
return getType(index);
}
public String getType(String qName)
{
int index = getIndex(qName);
if (index < 0) {
return null;
}
return getType(index);
}
public String getValue(String uri, String localName)
{
int index = getIndex(uri, localName);
if (index < 0) {
return null;
}
return getValue(index);
}
public String getValue(String qName)
{
int index = getIndex(qName);
if (index < 0) {
return null;
}
return getValue(index);
}
};
protected void handleCharacters()
throws XMLStreamException, SAXException
{
if (this.predictor.expectText()) {
this.buffer.append(this.staxStreamReader.getTextCharacters(), this.staxStreamReader.getTextStart(), this.staxStreamReader.getTextLength());
}
}
private void processText(boolean ignorable)
throws SAXException
{
if ((this.predictor.expectText()) && ((!ignorable) || (!WhiteSpaceProcessor.isWhiteSpace(this.buffer)))) {
if (this.textReported) {
this.textReported = false;
} else {
this.visitor.text(this.buffer);
}
}
this.buffer.setLength(0);
}
private static final Class FI_STAX_READER_CLASS = ;
private static final Constructor<? extends StAXConnector> FI_CONNECTOR_CTOR = initFastInfosetConnectorClass();
private static Class initFIStAXReaderClass()
{
try
{
Class fisr = UnmarshallerImpl.class.getClassLoader().loadClass("org.jvnet.fastinfoset.stax.FastInfosetStreamReader");
Class sdp = UnmarshallerImpl.class.getClassLoader().loadClass("com.sun.xml.fastinfoset.stax.StAXDocumentParser");
if (fisr.isAssignableFrom(sdp)) {
return sdp;
}
return null;
}
catch (Throwable e) {}
return null;
}
private static Constructor<? extends StAXConnector> initFastInfosetConnectorClass()
{
try
{
if (FI_STAX_READER_CLASS == null) {
return null;
}
Class c = UnmarshallerImpl.class.getClassLoader().loadClass("com.sun.xml.bind.v2.runtime.unmarshaller.FastInfosetConnector");
return c.getConstructor(new Class[] { FI_STAX_READER_CLASS, XmlVisitor.class });
}
catch (Throwable e) {}
return null;
}
private static final Class STAX_EX_READER_CLASS = initStAXExReader();
private static final Constructor<? extends StAXConnector> STAX_EX_CONNECTOR_CTOR = initStAXExConnector();
private static Class initStAXExReader()
{
try
{
return UnmarshallerImpl.class.getClassLoader().loadClass("org.jvnet.staxex.XMLStreamReaderEx");
}
catch (Throwable e) {}
return null;
}
private static Constructor<? extends StAXConnector> initStAXExConnector()
{
try
{
Class c = UnmarshallerImpl.class.getClassLoader().loadClass("com.sun.xml.bind.v2.runtime.unmarshaller.StAXExConnector");
return c.getConstructor(new Class[] { STAX_EX_READER_CLASS, XmlVisitor.class });
}
catch (Throwable e) {}
return null;
}
}
/* Location: C:\Games\SteamLibrary\steamapps\common\Wurm Unlimited Dedicated Server\server.jar!\com\sun\xml\bind\v2\runtime\unmarshaller\StAXStreamConnector.class
* Java compiler version: 5 (49.0)
* JD-Core Version: 0.7.1
*/ | UTF-8 | Java | 9,849 | java | StAXStreamConnector.java | Java | []
| null | []
| package com.sun.xml.bind.v2.runtime.unmarshaller;
import com.sun.xml.bind.WhiteSpaceProcessor;
import java.lang.reflect.Constructor;
import javax.xml.stream.Location;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
class StAXStreamConnector
extends StAXConnector
{
private final XMLStreamReader staxStreamReader;
public static StAXConnector create(XMLStreamReader reader, XmlVisitor visitor)
{
Class readerClass = reader.getClass();
if ((FI_STAX_READER_CLASS != null) && (FI_STAX_READER_CLASS.isAssignableFrom(readerClass)) && (FI_CONNECTOR_CTOR != null)) {
try
{
return (StAXConnector)FI_CONNECTOR_CTOR.newInstance(new Object[] { reader, visitor });
}
catch (Exception t) {}
}
boolean isZephyr = readerClass.getName().equals("com.sun.xml.stream.XMLReaderImpl");
if (!isZephyr) {
if (!checkImplementaionNameOfSjsxp(reader)) {
if ((!getBoolProp(reader, "org.codehaus.stax2.internNames")) || (!getBoolProp(reader, "org.codehaus.stax2.internNsUris"))) {
visitor = new InterningXmlVisitor(visitor);
}
}
}
if ((STAX_EX_READER_CLASS != null) && (STAX_EX_READER_CLASS.isAssignableFrom(readerClass))) {
try
{
return (StAXConnector)STAX_EX_CONNECTOR_CTOR.newInstance(new Object[] { reader, visitor });
}
catch (Exception t) {}
}
return new StAXStreamConnector(reader, visitor);
}
private static boolean checkImplementaionNameOfSjsxp(XMLStreamReader reader)
{
try
{
Object name = reader.getProperty("http://java.sun.com/xml/stream/properties/implementation-name");
return (name != null) && (name.equals("sjsxp"));
}
catch (Exception e) {}
return false;
}
private static boolean getBoolProp(XMLStreamReader r, String n)
{
try
{
Object o = r.getProperty(n);
if ((o instanceof Boolean)) {
return ((Boolean)o).booleanValue();
}
return false;
}
catch (Exception e) {}
return false;
}
protected final StringBuilder buffer = new StringBuilder();
protected boolean textReported = false;
protected StAXStreamConnector(XMLStreamReader staxStreamReader, XmlVisitor visitor)
{
super(visitor);
this.staxStreamReader = staxStreamReader;
}
public void bridge()
throws XMLStreamException
{
try
{
int depth = 0;
int event = this.staxStreamReader.getEventType();
if (event == 7) {
while (!this.staxStreamReader.isStartElement()) {
event = this.staxStreamReader.next();
}
}
if (event != 1) {
throw new IllegalStateException("The current event is not START_ELEMENT\n but " + event);
}
handleStartDocument(this.staxStreamReader.getNamespaceContext());
for (;;)
{
switch (event)
{
case 1:
handleStartElement();
depth++;
break;
case 2:
depth--;
handleEndElement();
if (depth != 0) {
break;
}
break;
case 4:
case 6:
case 12:
handleCharacters();
}
event = this.staxStreamReader.next();
}
this.staxStreamReader.next();
handleEndDocument();
}
catch (SAXException e)
{
throw new XMLStreamException(e);
}
}
protected Location getCurrentLocation()
{
return this.staxStreamReader.getLocation();
}
protected String getCurrentQName()
{
return getQName(this.staxStreamReader.getPrefix(), this.staxStreamReader.getLocalName());
}
private void handleEndElement()
throws SAXException
{
processText(false);
this.tagName.uri = fixNull(this.staxStreamReader.getNamespaceURI());
this.tagName.local = this.staxStreamReader.getLocalName();
this.visitor.endElement(this.tagName);
int nsCount = this.staxStreamReader.getNamespaceCount();
for (int i = nsCount - 1; i >= 0; i--) {
this.visitor.endPrefixMapping(fixNull(this.staxStreamReader.getNamespacePrefix(i)));
}
}
private void handleStartElement()
throws SAXException
{
processText(true);
int nsCount = this.staxStreamReader.getNamespaceCount();
for (int i = 0; i < nsCount; i++) {
this.visitor.startPrefixMapping(fixNull(this.staxStreamReader.getNamespacePrefix(i)), fixNull(this.staxStreamReader.getNamespaceURI(i)));
}
this.tagName.uri = fixNull(this.staxStreamReader.getNamespaceURI());
this.tagName.local = this.staxStreamReader.getLocalName();
this.tagName.atts = this.attributes;
this.visitor.startElement(this.tagName);
}
private final Attributes attributes = new Attributes()
{
public int getLength()
{
return StAXStreamConnector.this.staxStreamReader.getAttributeCount();
}
public String getURI(int index)
{
String uri = StAXStreamConnector.this.staxStreamReader.getAttributeNamespace(index);
if (uri == null) {
return "";
}
return uri;
}
public String getLocalName(int index)
{
return StAXStreamConnector.this.staxStreamReader.getAttributeLocalName(index);
}
public String getQName(int index)
{
String prefix = StAXStreamConnector.this.staxStreamReader.getAttributePrefix(index);
if ((prefix == null) || (prefix.length() == 0)) {
return getLocalName(index);
}
return prefix + ':' + getLocalName(index);
}
public String getType(int index)
{
return StAXStreamConnector.this.staxStreamReader.getAttributeType(index);
}
public String getValue(int index)
{
return StAXStreamConnector.this.staxStreamReader.getAttributeValue(index);
}
public int getIndex(String uri, String localName)
{
for (int i = getLength() - 1; i >= 0; i--) {
if ((localName.equals(getLocalName(i))) && (uri.equals(getURI(i)))) {
return i;
}
}
return -1;
}
public int getIndex(String qName)
{
for (int i = getLength() - 1; i >= 0; i--) {
if (qName.equals(getQName(i))) {
return i;
}
}
return -1;
}
public String getType(String uri, String localName)
{
int index = getIndex(uri, localName);
if (index < 0) {
return null;
}
return getType(index);
}
public String getType(String qName)
{
int index = getIndex(qName);
if (index < 0) {
return null;
}
return getType(index);
}
public String getValue(String uri, String localName)
{
int index = getIndex(uri, localName);
if (index < 0) {
return null;
}
return getValue(index);
}
public String getValue(String qName)
{
int index = getIndex(qName);
if (index < 0) {
return null;
}
return getValue(index);
}
};
protected void handleCharacters()
throws XMLStreamException, SAXException
{
if (this.predictor.expectText()) {
this.buffer.append(this.staxStreamReader.getTextCharacters(), this.staxStreamReader.getTextStart(), this.staxStreamReader.getTextLength());
}
}
private void processText(boolean ignorable)
throws SAXException
{
if ((this.predictor.expectText()) && ((!ignorable) || (!WhiteSpaceProcessor.isWhiteSpace(this.buffer)))) {
if (this.textReported) {
this.textReported = false;
} else {
this.visitor.text(this.buffer);
}
}
this.buffer.setLength(0);
}
private static final Class FI_STAX_READER_CLASS = ;
private static final Constructor<? extends StAXConnector> FI_CONNECTOR_CTOR = initFastInfosetConnectorClass();
private static Class initFIStAXReaderClass()
{
try
{
Class fisr = UnmarshallerImpl.class.getClassLoader().loadClass("org.jvnet.fastinfoset.stax.FastInfosetStreamReader");
Class sdp = UnmarshallerImpl.class.getClassLoader().loadClass("com.sun.xml.fastinfoset.stax.StAXDocumentParser");
if (fisr.isAssignableFrom(sdp)) {
return sdp;
}
return null;
}
catch (Throwable e) {}
return null;
}
private static Constructor<? extends StAXConnector> initFastInfosetConnectorClass()
{
try
{
if (FI_STAX_READER_CLASS == null) {
return null;
}
Class c = UnmarshallerImpl.class.getClassLoader().loadClass("com.sun.xml.bind.v2.runtime.unmarshaller.FastInfosetConnector");
return c.getConstructor(new Class[] { FI_STAX_READER_CLASS, XmlVisitor.class });
}
catch (Throwable e) {}
return null;
}
private static final Class STAX_EX_READER_CLASS = initStAXExReader();
private static final Constructor<? extends StAXConnector> STAX_EX_CONNECTOR_CTOR = initStAXExConnector();
private static Class initStAXExReader()
{
try
{
return UnmarshallerImpl.class.getClassLoader().loadClass("org.jvnet.staxex.XMLStreamReaderEx");
}
catch (Throwable e) {}
return null;
}
private static Constructor<? extends StAXConnector> initStAXExConnector()
{
try
{
Class c = UnmarshallerImpl.class.getClassLoader().loadClass("com.sun.xml.bind.v2.runtime.unmarshaller.StAXExConnector");
return c.getConstructor(new Class[] { STAX_EX_READER_CLASS, XmlVisitor.class });
}
catch (Throwable e) {}
return null;
}
}
/* Location: C:\Games\SteamLibrary\steamapps\common\Wurm Unlimited Dedicated Server\server.jar!\com\sun\xml\bind\v2\runtime\unmarshaller\StAXStreamConnector.class
* Java compiler version: 5 (49.0)
* JD-Core Version: 0.7.1
*/ | 9,849 | 0.638339 | 0.634481 | 349 | 27.223495 | 30.999611 | 175 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.409742 | false | false | 10 |
071c4c2685d0490c2d129e7a0c68cf0a8184717b | 11,647,951,368,277 | 59f9c6369a2302232fc94f1aedf67bc71a9a3a97 | /tuan/src/java/com/tuan/service/FeedbackService.java | 4028a4973944a08f2b505032c430bd640ac54afc | []
| no_license | brucesq/51tuan | https://github.com/brucesq/51tuan | ff78e190a30514e4a239753a5780f5f16bf6c6d3 | d9d75975a13bb6c59e9219b65eaceb6af4e8c1f1 | refs/heads/master | 2021-05-28T08:16:24.473000 | 2010-09-26T08:17:22 | 2010-09-26T08:17:22 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* FeedbackService.java
*
* Created on 2010-6-25
*
* Copyright(C) 2010, by Ambow Develop & Research Branch.
*
* Original Author: liujia
* Contributor(s):
*
* Changes
* -------
* $Log$
*/
package com.tuan.service;
import java.util.List;
import com.tuan.domain.Feedback;
public interface FeedbackService {
public void addFeedback(Feedback feedback);
public List<Feedback> getFeedbackList();
}
| UTF-8 | Java | 446 | java | FeedbackService.java | Java | [
{
"context": "velop & Research Branch.\r\n * \r\n * Original Author: liujia\r\n * Contributor(s):\r\n * \r\n * Changes \r\n * -------",
"end": 155,
"score": 0.9995096325874329,
"start": 149,
"tag": "USERNAME",
"value": "liujia"
}
]
| null | []
| /*
* FeedbackService.java
*
* Created on 2010-6-25
*
* Copyright(C) 2010, by Ambow Develop & Research Branch.
*
* Original Author: liujia
* Contributor(s):
*
* Changes
* -------
* $Log$
*/
package com.tuan.service;
import java.util.List;
import com.tuan.domain.Feedback;
public interface FeedbackService {
public void addFeedback(Feedback feedback);
public List<Feedback> getFeedbackList();
}
| 446 | 0.639013 | 0.61435 | 26 | 15.153846 | 15.912482 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.346154 | false | false | 10 |
f1f465d0936cc178f5d69e7431d7ec2fa1cc00bc | 19,292,993,095,663 | 3fe3aaf3523953500ee4a7db1da532d8ae4e1fa3 | /hybris/bin/isvpaymentaddon/src/isv/sap/payment/addon/strategy/impl/AbstractSaleRequester.java | dc660bf39e6af90cfe3b4014e91eaf65bb1e8f83 | []
| no_license | cybersource-tpi/cybersource-plugins-saphybris | https://github.com/cybersource-tpi/cybersource-plugins-saphybris | ce2c49597681e0d550bc5cd61cef9d7eaecca393 | a6a56254b35fc8818a3a5b5be833681879cb61d9 | refs/heads/master | 2023-08-02T00:38:26.467000 | 2021-10-01T16:20:04 | 2021-10-01T16:20:04 | 412,541,102 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package isv.sap.payment.addon.strategy.impl;
import java.util.Map;
import javax.annotation.Resource;
import de.hybris.platform.acceleratorservices.config.SiteConfigService;
import de.hybris.platform.acceleratorservices.urlresolver.SiteBaseUrlResolutionService;
import de.hybris.platform.core.model.order.AbstractOrderModel;
import de.hybris.platform.servicelayer.config.ConfigurationService;
import de.hybris.platform.servicelayer.util.ServicesUtil;
import de.hybris.platform.site.BaseSiteService;
import isv.cjl.payment.enums.AlternativePaymentMethod;
import isv.cjl.payment.service.executor.PaymentServiceExecutor;
import isv.cjl.payment.service.executor.PaymentServiceResult;
import isv.sap.payment.addon.strategy.AlternativePaymentSaleRequester;
public abstract class AbstractSaleRequester implements AlternativePaymentSaleRequester
{
protected static final String MERCHANT_NAME = "isv.payment.alternativepayment.merchantName";
@Resource
private SiteConfigService siteConfigService;
@Resource
private SiteBaseUrlResolutionService siteBaseUrlResolutionService;
@Resource
private BaseSiteService baseSiteService;
@Resource
private ConfigurationService configurationService;
@Resource(name = "isv.sap.payment.paymentServiceExecutor")
private PaymentServiceExecutor paymentServiceExecutor;
@Override
public PaymentServiceResult initiateSale(final AbstractOrderModel cart,
final AlternativePaymentMethod paymentType,
final String merchantId, final Map<String, Object> optionalParams)
{
if (!supports(paymentType))
{
throw new IllegalArgumentException("Given requester doesn't supports: " + paymentType);
}
return internalInitiateSale(cart, paymentType, merchantId, optionalParams);
}
protected abstract PaymentServiceResult internalInitiateSale(final AbstractOrderModel cart,
final AlternativePaymentMethod paymentType, final String merchantId,
final Map<String, Object> optionalParams);
@Override
public boolean supports(final AlternativePaymentMethod paymentType)
{
ServicesUtil.validateParameterNotNullStandardMessage("paymentType", paymentType);
return internalSupports(paymentType);
}
protected abstract boolean internalSupports(final AlternativePaymentMethod paymentType);
protected String convertToAbsoluteURL(final String relativeURL, final boolean secure)
{
return getSiteBaseUrlResolutionService().
getWebsiteUrlForSite(getBaseSiteService().getCurrentBaseSite(), secure, relativeURL);
}
public SiteBaseUrlResolutionService getSiteBaseUrlResolutionService()
{
return siteBaseUrlResolutionService;
}
public void setSiteBaseUrlResolutionService(
final SiteBaseUrlResolutionService siteBaseUrlResolutionService)
{
this.siteBaseUrlResolutionService = siteBaseUrlResolutionService;
}
public BaseSiteService getBaseSiteService()
{
return baseSiteService;
}
public void setBaseSiteService(final BaseSiteService baseSiteService)
{
this.baseSiteService = baseSiteService;
}
public PaymentServiceExecutor getPaymentServiceExecutor()
{
return paymentServiceExecutor;
}
public void setPaymentServiceExecutor(final PaymentServiceExecutor paymentServiceExecutor)
{
this.paymentServiceExecutor = paymentServiceExecutor;
}
public ConfigurationService getConfigurationService()
{
return configurationService;
}
public void setConfigurationService(final ConfigurationService configurationService)
{
this.configurationService = configurationService;
}
protected String getProperty(final String key)
{
return configurationService.getConfiguration().getString(key);
}
protected int getIntProperty(final String key, final int defaultValue)
{
return configurationService.getConfiguration().getInt(key, defaultValue);
}
protected SiteConfigService getSiteConfigService()
{
return siteConfigService;
}
public void setSiteConfigService(final SiteConfigService siteConfigService)
{
this.siteConfigService = siteConfigService;
}
}
| UTF-8 | Java | 4,318 | java | AbstractSaleRequester.java | Java | []
| null | []
| package isv.sap.payment.addon.strategy.impl;
import java.util.Map;
import javax.annotation.Resource;
import de.hybris.platform.acceleratorservices.config.SiteConfigService;
import de.hybris.platform.acceleratorservices.urlresolver.SiteBaseUrlResolutionService;
import de.hybris.platform.core.model.order.AbstractOrderModel;
import de.hybris.platform.servicelayer.config.ConfigurationService;
import de.hybris.platform.servicelayer.util.ServicesUtil;
import de.hybris.platform.site.BaseSiteService;
import isv.cjl.payment.enums.AlternativePaymentMethod;
import isv.cjl.payment.service.executor.PaymentServiceExecutor;
import isv.cjl.payment.service.executor.PaymentServiceResult;
import isv.sap.payment.addon.strategy.AlternativePaymentSaleRequester;
public abstract class AbstractSaleRequester implements AlternativePaymentSaleRequester
{
protected static final String MERCHANT_NAME = "isv.payment.alternativepayment.merchantName";
@Resource
private SiteConfigService siteConfigService;
@Resource
private SiteBaseUrlResolutionService siteBaseUrlResolutionService;
@Resource
private BaseSiteService baseSiteService;
@Resource
private ConfigurationService configurationService;
@Resource(name = "isv.sap.payment.paymentServiceExecutor")
private PaymentServiceExecutor paymentServiceExecutor;
@Override
public PaymentServiceResult initiateSale(final AbstractOrderModel cart,
final AlternativePaymentMethod paymentType,
final String merchantId, final Map<String, Object> optionalParams)
{
if (!supports(paymentType))
{
throw new IllegalArgumentException("Given requester doesn't supports: " + paymentType);
}
return internalInitiateSale(cart, paymentType, merchantId, optionalParams);
}
protected abstract PaymentServiceResult internalInitiateSale(final AbstractOrderModel cart,
final AlternativePaymentMethod paymentType, final String merchantId,
final Map<String, Object> optionalParams);
@Override
public boolean supports(final AlternativePaymentMethod paymentType)
{
ServicesUtil.validateParameterNotNullStandardMessage("paymentType", paymentType);
return internalSupports(paymentType);
}
protected abstract boolean internalSupports(final AlternativePaymentMethod paymentType);
protected String convertToAbsoluteURL(final String relativeURL, final boolean secure)
{
return getSiteBaseUrlResolutionService().
getWebsiteUrlForSite(getBaseSiteService().getCurrentBaseSite(), secure, relativeURL);
}
public SiteBaseUrlResolutionService getSiteBaseUrlResolutionService()
{
return siteBaseUrlResolutionService;
}
public void setSiteBaseUrlResolutionService(
final SiteBaseUrlResolutionService siteBaseUrlResolutionService)
{
this.siteBaseUrlResolutionService = siteBaseUrlResolutionService;
}
public BaseSiteService getBaseSiteService()
{
return baseSiteService;
}
public void setBaseSiteService(final BaseSiteService baseSiteService)
{
this.baseSiteService = baseSiteService;
}
public PaymentServiceExecutor getPaymentServiceExecutor()
{
return paymentServiceExecutor;
}
public void setPaymentServiceExecutor(final PaymentServiceExecutor paymentServiceExecutor)
{
this.paymentServiceExecutor = paymentServiceExecutor;
}
public ConfigurationService getConfigurationService()
{
return configurationService;
}
public void setConfigurationService(final ConfigurationService configurationService)
{
this.configurationService = configurationService;
}
protected String getProperty(final String key)
{
return configurationService.getConfiguration().getString(key);
}
protected int getIntProperty(final String key, final int defaultValue)
{
return configurationService.getConfiguration().getInt(key, defaultValue);
}
protected SiteConfigService getSiteConfigService()
{
return siteConfigService;
}
public void setSiteConfigService(final SiteConfigService siteConfigService)
{
this.siteConfigService = siteConfigService;
}
}
| 4,318 | 0.763085 | 0.763085 | 129 | 32.47287 | 32.830093 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.426357 | false | false | 10 |
47f3162d650523176b19b5a76c1f2378e61ea44d | 39,711,267,625,042 | bde01c3c3b183d78daa9c6d87394a6bfee01a79c | /BDEPortal-webapp/src/main/java/com/bde/portal/web/gui/util/LoginFilter.java | 790fd0bb6e3c4cf190d61fedc363f591a3db1d5d | []
| no_license | jwiesner/my-portal | https://github.com/jwiesner/my-portal | 29d06b6abd3bc2ad349fc0b7ab5d121cccb5b0eb | 807d2430f0a1ae671e4e667d011901f4db1e5155 | refs/heads/master | 2016-08-03T03:51:02.719000 | 2015-08-27T08:02:07 | 2015-08-27T08:02:07 | 9,194,604 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.bde.portal.web.gui.util;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.log4j.Logger;
public class LoginFilter implements Filter {
private static final Logger LOG = Logger.getLogger(LoginFilter.class.getName());
@Override
public void init(FilterConfig config) throws ServletException {
// If you have any <init-param> in web.xml, then you could get them
// here by config.getInitParameter("name") and assign it as field.
}
@Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
HttpSession session = request.getSession(false);
if (session == null) {
// No valid session found, so redirect to expired page.
String url = request.getContextPath() + "/sessionexpired.jsf";
// if an ajax request, send a special redirect
if (isAJAXRequest(request)) {
response.setContentType("text/xml");
response.getWriter()
.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")
.printf("<partial-response><redirect url=\"%s\"></redirect></partial-response>", url);
LOG.info("Login Filter send ajax-redirect... because no session object found");
} else {
response.sendRedirect(url);
LOG.info("Login Filter send redirect... because no session object found");
}
} else if (session.getAttribute("selectedUser") == null) {
// No logged-in user found, so redirect to logout page.
String url = request.getContextPath() + "/logout.jsf";
// if an ajax request, send a special redirect
if (isAJAXRequest(request)) {
response.setContentType("text/xml");
response.getWriter()
.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")
.printf("<partial-response><redirect url=\"%s\"></redirect></partial-response>", url);
LOG.info("Login Filter send ajax-redirect... because no logged in user was found");
} else {
response.sendRedirect(url);
LOG.info("Login Filter send redirect... because no logged in user was found");
}
} else {
// Logged-in user found, so just continue request.
LOG.info("Login Filter continues the request...");
response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1.
response.setHeader("Pragma", "no-cache");
response.setDateHeader("Expires", -1);
//response.addHeader("X-UA-Compatible", "IE=9");
chain.doFilter(req, res);
}
}
private boolean isAJAXRequest(HttpServletRequest request) {
boolean check = false;
String facesRequest = request.getHeader("Faces-Request");
if (facesRequest != null && facesRequest.equals("partial/ajax")) {
check = true;
}
return check;
}
@Override
public void destroy() {
// If you have assigned any expensive resources as field of
// this Filter class, then you could clean/close them here.
}
}
| UTF-8 | Java | 3,874 | java | LoginFilter.java | Java | []
| null | []
| package com.bde.portal.web.gui.util;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.log4j.Logger;
public class LoginFilter implements Filter {
private static final Logger LOG = Logger.getLogger(LoginFilter.class.getName());
@Override
public void init(FilterConfig config) throws ServletException {
// If you have any <init-param> in web.xml, then you could get them
// here by config.getInitParameter("name") and assign it as field.
}
@Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
HttpSession session = request.getSession(false);
if (session == null) {
// No valid session found, so redirect to expired page.
String url = request.getContextPath() + "/sessionexpired.jsf";
// if an ajax request, send a special redirect
if (isAJAXRequest(request)) {
response.setContentType("text/xml");
response.getWriter()
.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")
.printf("<partial-response><redirect url=\"%s\"></redirect></partial-response>", url);
LOG.info("Login Filter send ajax-redirect... because no session object found");
} else {
response.sendRedirect(url);
LOG.info("Login Filter send redirect... because no session object found");
}
} else if (session.getAttribute("selectedUser") == null) {
// No logged-in user found, so redirect to logout page.
String url = request.getContextPath() + "/logout.jsf";
// if an ajax request, send a special redirect
if (isAJAXRequest(request)) {
response.setContentType("text/xml");
response.getWriter()
.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")
.printf("<partial-response><redirect url=\"%s\"></redirect></partial-response>", url);
LOG.info("Login Filter send ajax-redirect... because no logged in user was found");
} else {
response.sendRedirect(url);
LOG.info("Login Filter send redirect... because no logged in user was found");
}
} else {
// Logged-in user found, so just continue request.
LOG.info("Login Filter continues the request...");
response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1.
response.setHeader("Pragma", "no-cache");
response.setDateHeader("Expires", -1);
//response.addHeader("X-UA-Compatible", "IE=9");
chain.doFilter(req, res);
}
}
private boolean isAJAXRequest(HttpServletRequest request) {
boolean check = false;
String facesRequest = request.getHeader("Faces-Request");
if (facesRequest != null && facesRequest.equals("partial/ajax")) {
check = true;
}
return check;
}
@Override
public void destroy() {
// If you have assigned any expensive resources as field of
// this Filter class, then you could clean/close them here.
}
}
| 3,874 | 0.602736 | 0.599897 | 89 | 41.528091 | 31.162527 | 123 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.640449 | false | false | 10 |
8b0dbfc660cdf3d68005d95f6788e588a02df250 | 34,746,285,483,267 | 6cadf4663cf819de1454a70d861826bf6fc6c49f | /java/src/main/java/com/revature/postLike/PostLikes.java | da53973bcffe2437d00f9ff1e20500b136f7b880 | []
| no_license | jboud17/RevSocial | https://github.com/jboud17/RevSocial | 36413f797c7c4d979ca65c5a79cb17144e7ef9b7 | 2ed73404cac8e1866a3a877b4097de852bd2dd0b | refs/heads/master | 2020-03-07T03:06:14.943000 | 2018-03-29T23:59:31 | 2018-03-29T23:59:31 | 127,226,263 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.revature.postLike;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name="POST_LIKES")
public class PostLikes {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="ID")
private int id;
@Column(name="POST_ID")
private int post_id;
@Column(name="USER_ID")
private int user_id;
public PostLikes(int post_id, int user_id) {
super();
this.post_id = post_id;
this.user_id = user_id;
}
public PostLikes() {
super();
// TODO Auto-generated constructor stub
}
public int getUser_id() {
return user_id;
}
public void setUser_id(int user_id) {
this.user_id = user_id;
}
public int getPost_id() {
return post_id;
}
public void setPost_id(int post_id) {
this.post_id = post_id;
}
@Override
public String toString() {
return "PostLikes [user_id=" + user_id + ", post_id=" + post_id + "]";
}
} | UTF-8 | Java | 1,037 | java | PostLikes.java | Java | []
| null | []
| package com.revature.postLike;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name="POST_LIKES")
public class PostLikes {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="ID")
private int id;
@Column(name="POST_ID")
private int post_id;
@Column(name="USER_ID")
private int user_id;
public PostLikes(int post_id, int user_id) {
super();
this.post_id = post_id;
this.user_id = user_id;
}
public PostLikes() {
super();
// TODO Auto-generated constructor stub
}
public int getUser_id() {
return user_id;
}
public void setUser_id(int user_id) {
this.user_id = user_id;
}
public int getPost_id() {
return post_id;
}
public void setPost_id(int post_id) {
this.post_id = post_id;
}
@Override
public String toString() {
return "PostLikes [user_id=" + user_id + ", post_id=" + post_id + "]";
}
} | 1,037 | 0.690453 | 0.690453 | 58 | 16.896551 | 16.123114 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.155172 | false | false | 10 |
5491ebe760f15febf8d83de386a0bd95dcc835a2 | 19,859,928,846,005 | d40b4d6e3cc68557c02101911373f46138fe70b4 | /src/프로그래머스/파일명정렬.java | 95d32453a36cea25e290b6f811a810808c6a7cec | []
| no_license | dkwjdi/Algorithm | https://github.com/dkwjdi/Algorithm | 311e227014392fb4d936f5c315ea1542889870a6 | 4691c96b1766d2898ef01e92a0d6cf7e4941a4e3 | refs/heads/master | 2023-04-06T03:15:30.406000 | 2021-04-01T13:53:31 | 2021-04-01T13:53:31 | 286,984,864 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package 프로그래머스;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class 파일명정렬 {
static class Solution {
class Info implements Comparable<Info>{
int index;
String realhead, head, number ,tail;
public Info(int index, String realhead, String head, String number, String tail) {
this.index = index;
this.realhead = realhead;
this.head = head;
this.number = number;
this.tail = tail;
}
@Override
public int compareTo(Info o) {
if(this.head.equals(o.head)) {
return Integer.parseInt(this.number)-Integer.parseInt(o.number);
}
return this.head.compareTo(o.head);
//return 0;
}
}
List<Info> list = new ArrayList<>();
public String[] solution(String[] files) {
for(int i=0; i<files.length; i++) {
String head="";
String number="";
String tail="";
String file=files[i];
int j=0;
for(; j<file.length(); j++) {
char ch=file.charAt(j);
if(Character.isDigit(ch)) break;
head=head.concat(Character.toString(ch));
}
int cnt=0;
for(; j<file.length(); j++) {
char ch=file.charAt(j);
if(!Character.isDigit(ch)) break;
if(cnt>5) {
j--;
break;
}
number=number.concat(Character.toString(ch));
cnt++;
}
for(; j<file.length(); j++) {
char ch=file.charAt(j);
tail=tail.concat(Character.toString(ch));
}
list.add(new Info(i,head,head.toLowerCase(),number,tail));
}
Collections.sort(list);
String[] answer = new String[list.size()];
for(int i=0; i<list.size(); i++) {
Info info=list.get(i);
String input=info.realhead+info.number+info.tail;
answer[i]=input;
}
System.out.println(Arrays.toString(answer));
return answer;
}
}
public static void main(String[] args) {
System.out.println("Ddd");
String[] files= {
"F-5 Freedom Fighter", "B-50 Superfortress", "A-10 Thunderbolt II", "F-14 Tomcat"
};
new Solution().solution(files);
}
}
| UTF-8 | Java | 2,383 | java | 파일명정렬.java | Java | []
| null | []
| package 프로그래머스;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class 파일명정렬 {
static class Solution {
class Info implements Comparable<Info>{
int index;
String realhead, head, number ,tail;
public Info(int index, String realhead, String head, String number, String tail) {
this.index = index;
this.realhead = realhead;
this.head = head;
this.number = number;
this.tail = tail;
}
@Override
public int compareTo(Info o) {
if(this.head.equals(o.head)) {
return Integer.parseInt(this.number)-Integer.parseInt(o.number);
}
return this.head.compareTo(o.head);
//return 0;
}
}
List<Info> list = new ArrayList<>();
public String[] solution(String[] files) {
for(int i=0; i<files.length; i++) {
String head="";
String number="";
String tail="";
String file=files[i];
int j=0;
for(; j<file.length(); j++) {
char ch=file.charAt(j);
if(Character.isDigit(ch)) break;
head=head.concat(Character.toString(ch));
}
int cnt=0;
for(; j<file.length(); j++) {
char ch=file.charAt(j);
if(!Character.isDigit(ch)) break;
if(cnt>5) {
j--;
break;
}
number=number.concat(Character.toString(ch));
cnt++;
}
for(; j<file.length(); j++) {
char ch=file.charAt(j);
tail=tail.concat(Character.toString(ch));
}
list.add(new Info(i,head,head.toLowerCase(),number,tail));
}
Collections.sort(list);
String[] answer = new String[list.size()];
for(int i=0; i<list.size(); i++) {
Info info=list.get(i);
String input=info.realhead+info.number+info.tail;
answer[i]=input;
}
System.out.println(Arrays.toString(answer));
return answer;
}
}
public static void main(String[] args) {
System.out.println("Ddd");
String[] files= {
"F-5 Freedom Fighter", "B-50 Superfortress", "A-10 Thunderbolt II", "F-14 Tomcat"
};
new Solution().solution(files);
}
}
| 2,383 | 0.529013 | 0.523507 | 92 | 24.663044 | 18.906679 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.826087 | false | false | 10 |
24eccbdf83d0f2f9b8105b961cb8278206b3b66b | 13,503,377,212,075 | 4d7aff2f097c2cedb800eb621a66b52a87add5a1 | /app/src/main/java/com/wgz/ant/antinstall/bean/Detail.java | 072540e804f34bb5cc869c159df9558d5d0d6552 | []
| no_license | ultranumblol/ANTInstall2 | https://github.com/ultranumblol/ANTInstall2 | 27e7956a37a9843a9f84e021595d6f00b6120e11 | e765687fbecb036fa466e4ba96e31e8b7ffe66c3 | refs/heads/master | 2021-01-10T02:02:22.554000 | 2016-03-22T01:44:58 | 2016-03-22T01:44:58 | 46,386,455 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.wgz.ant.antinstall.bean;
/**
* Created by qwerr on 2015/12/23.
*/
public class Detail {
private String name;
private String price;
private String count;
private String type;
private String goodname;
private String phone;
private String address;
private String date;
private String aznumber;
private String azreservation;
private String delivery;
private String serverType;
private String servicestype;
private String pilot;
private String pilotphone;
public void setPilot(String pilot) {
this.pilot = pilot;
}
public void setPilotphone(String pilotphone) {
this.pilotphone = pilotphone;
}
public String getPilot() {
return pilot;
}
public String getPilotphone() {
return pilotphone;
}
public String getServicestype() {
return servicestype;
}
public void setServicestype(String servicestype) {
this.servicestype = servicestype;
}
public String getServerType() {
return serverType;
}
public void setServerType(String serverType) {
this.serverType = serverType;
}
public void setAzreservation(String azreservation) {
this.azreservation = azreservation;
}
public void setDelivery(String delivery) {
this.delivery = delivery;
}
public String getAzreservation() {
return azreservation;
}
public String getDelivery() {
return delivery;
}
public void setAznumber(String aznumber) {
this.aznumber = aznumber;
}
public String getAznumber() {
return aznumber;
}
public void setGoodname(String goodname) {
this.goodname = goodname;
}
public void setPhone(String phone) {
this.phone = phone;
}
public void setAddress(String address) {
this.address = address;
}
public void setDate(String date) {
this.date = date;
}
public void setGoodsmoeny(String goodsmoeny) {
this.goodsmoeny = goodsmoeny;
}
public String getGoodname() {
return goodname;
}
public String getPhone() {
return phone;
}
public String getAddress() {
return address;
}
public String getDate() {
return date;
}
public String getGoodsmoeny() {
return goodsmoeny;
}
private String goodsmoeny;
public String getName() {
return name;
}
public String getPrice() {
return price;
}
public String getCount() {
return count;
}
public String getType() {
return type;
}
public void setName(String name) {
this.name = name;
}
public void setPrice(String price) {
this.price = price;
}
public void setCount(String count) {
this.count = count;
}
public void setType(String type) {
this.type = type;
}
@Override
public String toString() {
return "Detail{" +
"name='" + name + '\'' +
", price='" + price + '\'' +
", count='" + count + '\'' +
", type='" + type + '\'' +
", goodname='" + goodname + '\'' +
", phone='" + phone + '\'' +
", address='" + address + '\'' +
", date='" + date + '\'' +
", aznumber='" + aznumber + '\'' +
", azreservation='" + azreservation + '\'' +
", delivery='" + delivery + '\'' +
", serverType='" + serverType + '\'' +
", servicestype='" + servicestype + '\'' +
", pilot='" + pilot + '\'' +
", pilotphone='" + pilotphone + '\'' +
", goodsmoeny='" + goodsmoeny + '\'' +
'}';
}
}
| UTF-8 | Java | 3,860 | java | Detail.java | Java | [
{
"context": "ge com.wgz.ant.antinstall.bean;\n\n/**\n * Created by qwerr on 2015/12/23.\n */\npublic class Detail {\n priv",
"end": 61,
"score": 0.999528169631958,
"start": 56,
"tag": "USERNAME",
"value": "qwerr"
}
]
| null | []
| package com.wgz.ant.antinstall.bean;
/**
* Created by qwerr on 2015/12/23.
*/
public class Detail {
private String name;
private String price;
private String count;
private String type;
private String goodname;
private String phone;
private String address;
private String date;
private String aznumber;
private String azreservation;
private String delivery;
private String serverType;
private String servicestype;
private String pilot;
private String pilotphone;
public void setPilot(String pilot) {
this.pilot = pilot;
}
public void setPilotphone(String pilotphone) {
this.pilotphone = pilotphone;
}
public String getPilot() {
return pilot;
}
public String getPilotphone() {
return pilotphone;
}
public String getServicestype() {
return servicestype;
}
public void setServicestype(String servicestype) {
this.servicestype = servicestype;
}
public String getServerType() {
return serverType;
}
public void setServerType(String serverType) {
this.serverType = serverType;
}
public void setAzreservation(String azreservation) {
this.azreservation = azreservation;
}
public void setDelivery(String delivery) {
this.delivery = delivery;
}
public String getAzreservation() {
return azreservation;
}
public String getDelivery() {
return delivery;
}
public void setAznumber(String aznumber) {
this.aznumber = aznumber;
}
public String getAznumber() {
return aznumber;
}
public void setGoodname(String goodname) {
this.goodname = goodname;
}
public void setPhone(String phone) {
this.phone = phone;
}
public void setAddress(String address) {
this.address = address;
}
public void setDate(String date) {
this.date = date;
}
public void setGoodsmoeny(String goodsmoeny) {
this.goodsmoeny = goodsmoeny;
}
public String getGoodname() {
return goodname;
}
public String getPhone() {
return phone;
}
public String getAddress() {
return address;
}
public String getDate() {
return date;
}
public String getGoodsmoeny() {
return goodsmoeny;
}
private String goodsmoeny;
public String getName() {
return name;
}
public String getPrice() {
return price;
}
public String getCount() {
return count;
}
public String getType() {
return type;
}
public void setName(String name) {
this.name = name;
}
public void setPrice(String price) {
this.price = price;
}
public void setCount(String count) {
this.count = count;
}
public void setType(String type) {
this.type = type;
}
@Override
public String toString() {
return "Detail{" +
"name='" + name + '\'' +
", price='" + price + '\'' +
", count='" + count + '\'' +
", type='" + type + '\'' +
", goodname='" + goodname + '\'' +
", phone='" + phone + '\'' +
", address='" + address + '\'' +
", date='" + date + '\'' +
", aznumber='" + aznumber + '\'' +
", azreservation='" + azreservation + '\'' +
", delivery='" + delivery + '\'' +
", serverType='" + serverType + '\'' +
", servicestype='" + servicestype + '\'' +
", pilot='" + pilot + '\'' +
", pilotphone='" + pilotphone + '\'' +
", goodsmoeny='" + goodsmoeny + '\'' +
'}';
}
}
| 3,860 | 0.540155 | 0.538083 | 176 | 20.931818 | 17.561447 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.369318 | false | false | 10 |
5fa432a5fb75ae9fb5ee242a1fbb0b72bbcdb628 | 30,227,979,868,786 | 57cdfcfdc7d4ff04c62754e684206185ac29c756 | /src/com/osp/ide/resource/model/property/EditFieldPropertySource.java | b5c34a3ae4716e60098e04544c86005e38238d7f | []
| no_license | romanm11/bada-SDK-1.0.0-com.osp.ide.resource | https://github.com/romanm11/bada-SDK-1.0.0-com.osp.ide.resource | 93eef3acb1584cd5c3d777b4bdd493cee6110fdd | c6d17b60ff13b3ac9312199c8068fe463bcebcb7 | refs/heads/master | 2021-01-01T05:47:58.675000 | 2010-10-27T18:58:28 | 2010-10-27T18:58:28 | 1,132,317 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.osp.ide.resource.model.property;
import java.util.ArrayList;
import org.eclipse.ui.views.properties.ComboBoxPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.PropertyDescriptor;
import org.eclipse.ui.views.properties.TextPropertyDescriptor;
import com.osp.ide.resource.Activator;
import com.osp.ide.resource.common.EditableComboPropertyDescriptor;
import com.osp.ide.resource.common.FramePropertyPage;
import com.osp.ide.resource.model.EditField;
import com.osp.ide.resource.model.FrameNode;
import com.osp.ide.resource.model.PanelFrame;
import com.osp.ide.resource.resinfo.EDITFIELD_INFO;
import com.osp.ide.resource.resinfo.Layout;
public class EditFieldPropertySource extends OspNodePropertySource {
public EditFieldPropertySource(EditField node) {
this.node = node;
EDITFIELD_INFO info = node.getItem().clone();
this.info = info;
if (this.info != null) {
int mode = node.getModeIndex();
Layout rect = node.getLayout(mode);
Layout newLayout = new Layout(rect);
this.info.SetLayout(newLayout);
if (mode == PORTRAIT) {
rect = node.getLayout(LANDCAPE);
} else {
rect = node.getLayout(PORTRAIT);
}
newLayout = new Layout(rect);
this.info.SetLayout(newLayout);
}
}
protected void initDescriptor() {
properties = new ArrayList<IPropertyDescriptor>();
initStringId();
initControlId();
PropertyDescriptor StyleDescriptor = (new ComboBoxPropertyDescriptor(
FrameNode.PROPERTY_STYLE, "EditField Style", cszStyle[STYLE_EDITFIELD]));
StyleDescriptor.setCategory(FrameNode.GROUP_STYLE);
properties.add(StyleDescriptor);
PropertyDescriptor GroupStyleDescriptor =
(new ComboBoxPropertyDescriptor(FrameNode.PROPERTY_GROUPSTYLE,
"Group Style", cszGroupStyle));
GroupStyleDescriptor.setCategory(FrameNode.GROUP_STYLE);
properties.add(GroupStyleDescriptor);
FrameNode parent = node.getParent();
if(parent instanceof PanelFrame) {
PropertyDescriptor InputStyleDescriptor = (new ComboBoxPropertyDescriptor(
FrameNode.PROPERTY_INPUTSTYLE, "Input Style", cszInputStyle));
InputStyleDescriptor.setCategory(FrameNode.GROUP_STYLE);
properties.add(InputStyleDescriptor);
} else {
PropertyDescriptor InputStyleDescriptor = new PropertyDescriptor(
FrameNode.PROPERTY_INPUTSTYLE, "Input Style");
InputStyleDescriptor.setCategory(FrameNode.GROUP_STYLE);
InputStyleDescriptor.setDescription(FramePropertyPage.PROPERTY_DISABLE);
properties.add(InputStyleDescriptor);
}
PropertyDescriptor ShowtitleTextDescriptor = (new ComboBoxPropertyDescriptor(
FrameNode.PROPERTY_SHOWTITLETEXT, "Show Title Text", BOOL));
ShowtitleTextDescriptor.setCategory(FrameNode.GROUP_STYLE);
properties.add(ShowtitleTextDescriptor);
PropertyDescriptor HeightDescriptor = (new TextPropertyDescriptor(
FrameNode.PROPERTY_HEIGHT, "Height"));
HeightDescriptor.setCategory(FrameNode.GROUP_LAYOUT);
properties.add(HeightDescriptor);
PropertyDescriptor ParentDescriptor = (new ComboBoxPropertyDescriptor(
FrameNode.PROPERTY_PARENT, "Parent ID", controlId));
ParentDescriptor.setCategory(FrameNode.GROUP_LAYOUT);
properties.add(ParentDescriptor);
PropertyDescriptor WidthDescriptor = (new TextPropertyDescriptor(
FrameNode.PROPERTY_WIDTH, "Width"));
WidthDescriptor.setCategory(FrameNode.GROUP_LAYOUT);
properties.add(WidthDescriptor);
PropertyDescriptor PointXlDescriptor = (new TextPropertyDescriptor(
FrameNode.PROPERTY_POINTX, "X Position"));
PointXlDescriptor.setCategory(FrameNode.GROUP_LAYOUT);
properties.add(PointXlDescriptor);
PropertyDescriptor PointYDescriptor = (new TextPropertyDescriptor(
FrameNode.PROPERTY_POINTY, "Y Position"));
PointYDescriptor.setCategory(FrameNode.GROUP_LAYOUT);
properties.add(PointYDescriptor);
PropertyDescriptor GuideTextDescriptor = (new EditableComboPropertyDescriptor(
FrameNode.PROPERTY_GUIDETEXT, "Guide Text", stringId));
GuideTextDescriptor.setCategory(FrameNode.GROUP_PROPERTIES);
properties.add(GuideTextDescriptor);
PropertyDescriptor NameDescriptor = (new TextPropertyDescriptor(
FrameNode.PROPERTY_RENAME, "ID"));
NameDescriptor.setCategory(FrameNode.GROUP_PROPERTIES);
properties.add(NameDescriptor);
PropertyDescriptor KeypadEnabledDescriptor = (new ComboBoxPropertyDescriptor(
FrameNode.PROPERTY_KEYPADENABLED, "Keypad Enabled", BOOL));
KeypadEnabledDescriptor.setCategory(FrameNode.GROUP_PROPERTIES);
properties.add(KeypadEnabledDescriptor);
PropertyDescriptor TextDescriptor = (new EditableComboPropertyDescriptor(
FrameNode.PROPERTY_TEXT, "Text", stringId));
TextDescriptor.setCategory(FrameNode.GROUP_PROPERTIES);
properties.add(TextDescriptor);
// PropertyDescriptor BorderStyleDescriptor = (new ComboBoxPropertyDescriptor(
// FrameNode.PROPERTY_BORDERSTYLE, "Border Style", cszBorderStyle));
// BorderStyleDescriptor.setCategory("Property");
// properties.add(BorderStyleDescriptor);
PropertyDescriptor LimitLengthlDescriptor = (new TextPropertyDescriptor(
FrameNode.PROPERTY_LIMITLENGTH,
"Text Limit Length [Range: 0 ~ 1000]"));
LimitLengthlDescriptor.setCategory(FrameNode.GROUP_PROPERTIES);
properties.add(LimitLengthlDescriptor);
PropertyDescriptor titleTextDescriptor = (new EditableComboPropertyDescriptor(
FrameNode.PROPERTY_TITLETEXT, "Title Text", stringId));
titleTextDescriptor.setCategory(FrameNode.GROUP_PROPERTIES);
properties.add(titleTextDescriptor);
}
@Override
public Object getPropertyValue(Object id) {
EditField node = (EditField) this.node;
int minY = getMinY(node);
String text = "";
if (id.equals(FrameNode.PROPERTY_RENAME)) {
return node.getName();
} else if (id.equals(FrameNode.PROPERTY_MODE))
return node.getLayout().mode;
else if (id.equals(FrameNode.PROPERTY_PARENT))
return getControlIndex(node.getParentId());
else if (id.equals(FrameNode.PROPERTY_STYLE)) {
return FrameNode.getStyleIndex(STYLE_EDITFIELD,
node.getLayout().style);
} else if (id.equals(FrameNode.PROPERTY_POINTX))
return Integer.toString(node.getLayout().x);
else if (id.equals(FrameNode.PROPERTY_POINTY))
return Integer.toString(node.getLayout().y - minY);
else if (id.equals(FrameNode.PROPERTY_WIDTH))
return Integer.toString(node.getLayout().width);
else if (id.equals(FrameNode.PROPERTY_HEIGHT))
return Integer.toString(node.getLayout().height);
else if (id.equals(FrameNode.PROPERTY_TYPE))
return "WINDOW_" + cszCtlType[node.getType()];
else if (id.equals(FrameNode.PROPERTY_TEXT)) {
text = node.getText();
if (text.indexOf("::") < 0)
return text;
else {
return getStringIndex(text.replace("::", ""));
}
} else if (id.equals(FrameNode.PROPERTY_BORDERSTYLE)){
return node.getBorderStyleIndex();
} else if (id.equals(FrameNode.PROPERTY_LIMITLENGTH)) {
return Integer.toString(node.getLimitLength());
} else if (id.equals(FrameNode.PROPERTY_INPUTSTYLE)) {
if(node.getParent() instanceof PanelFrame) {
return FrameNode.getInputStyleIndex(node.getInputStyle());
}
node.setInputStyle(cszInputStyle[0]);
return cszInputStyle[0];
} else if (id.equals(FrameNode.PROPERTY_TITLETEXT)) {
text = node.getTitleText();
if (text.indexOf("::") < 0)
return text;
else {
return getStringIndex(text.replace("::", ""));
}
} else if (id.equals(FrameNode.PROPERTY_SHOWTITLETEXT)) {
return node.getShowTitleText();
} else if (id.equals(FrameNode.PROPERTY_KEYPADENABLED)) {
return node.getKeypadEnabled();
} else if (id.equals(FrameNode.PROPERTY_GROUPSTYLE)) {
return node.getGroupStyleIndex();
} else if (id.equals(FrameNode.PROPERTY_GUIDETEXT)) {
text = node.getGuideText();
if (text.indexOf("::") < 0)
return text;
else {
return getStringIndex(text.replace("::", ""));
}
} else if(handlerList != null && handlerList.contains(id)) {
return 0;
}
return null;
}
@Override
public void resetPropertyValue(Object id) {
EDITFIELD_INFO info = (EDITFIELD_INFO) this.info;
EditField node = (EditField) this.node;
if (id.equals(FrameNode.PROPERTY_RENAME)) {
node.reName(info.Id);
} else if (id.equals(FrameNode.PROPERTY_TYPE)) {
node.setType(info.type);
} else if (id.equals(FrameNode.PROPERTY_PARENT)) {
node.setParentId(info.pID);
} else if (id.equals(FrameNode.PROPERTY_POINTX)) {
Layout rect = node.getLayout();
rect.x = info.GetLayout(node.getModeIndex()).x;
node.setLayout(rect);
} else if (id.equals(FrameNode.PROPERTY_POINTY)) {
Layout rect = node.getLayout();
rect.y = info.GetLayout(node.getModeIndex()).y;
node.setLayout(rect);
} else if (id.equals(FrameNode.PROPERTY_WIDTH)) {
Layout rect = node.getLayout();
rect.width = info.GetLayout(node.getModeIndex()).width;
node.setLayout(rect);
} else if (id.equals(FrameNode.PROPERTY_HEIGHT)) {
Layout rect = node.getLayout();
rect.height = info.GetLayout(node.getModeIndex()).height;
node.setLayout(rect);
} else if (id.equals(FrameNode.PROPERTY_STYLE)) {
node.setStyle(info.GetLayout(node.getModeIndex()).style);
} else if (id.equals(FrameNode.PROPERTY_TEXT)) {
node.setText(info.text);
} else if (id.equals(FrameNode.PROPERTY_BORDERSTYLE)) {
node.setBorderStyle(node.getBorderStyle());
} else if (id.equals(FrameNode.PROPERTY_LIMITLENGTH)) {
node.setLimitLength(info.limitLength);
} else if (id.equals(FrameNode.PROPERTY_INPUTSTYLE)) {
node.setInputStyle(info.inputStyle);
} else if (id.equals(FrameNode.PROPERTY_TITLETEXT)) {
node.setTitleText(info.titleText);
} else if (id.equals(FrameNode.PROPERTY_SHOWTITLETEXT)) {
node.setShowTitleText(info.ShowTitleText);
} else if (id.equals(FrameNode.PROPERTY_KEYPADENABLED)) {
node.setKeypadEnabled(info.KeypadEnabled);
} else if (id.equals(FrameNode.PROPERTY_GUIDETEXT)) {
node.setGuideText(info.guideText);
} else if (id.equals(FrameNode.PROPERTY_GROUPSTYLE)) {
node.setGroupStyle(node.getGroupStyle());
}
}
@Override
public void setPropertyValue(Object id, Object value) {
if(isValidate(id, value) == false)
return;
EditField node = (EditField) this.node;
String text = "";
if (id.equals(FrameNode.PROPERTY_RENAME)) {
node.reName((String) value);
} else if (id.equals(FrameNode.PROPERTY_PARENT)) {
int index = (Integer) value;
if (index < 0)
return;
node.setParentId(controlId[(Integer) value]);
} else if (id.equals(FrameNode.PROPERTY_POINTX)) {
try {
Layout rect = node.getLayout();
Integer pointx = Integer.parseInt((String) value);
rect.x = pointx;
node.setLayout(rect);
} catch (NumberFormatException e) {
Activator.setErrorMessage(
"EditFieldPropertySource.setPropertyValue()", id
+ " NumberFormatException - " + e.getMessage(), e);
}
} else if (id.equals(FrameNode.PROPERTY_POINTY)) {
try {
Layout rect = node.getLayout();
Integer pointy = Integer.parseInt((String) value);
int minY = getMinY(node);
rect.y = pointy + minY;
node.setLayout(rect);
} catch (NumberFormatException e) {
Activator.setErrorMessage(
"EditFieldPropertySource.setPropertyValue()", id
+ " NumberFormatException - " + e.getMessage(), e);
}
} else if (id.equals(FrameNode.PROPERTY_WIDTH)) {
try {
Layout rect = node.getLayout();
Integer pointwidth = Integer.parseInt((String) value);
rect.width = pointwidth;
node.setLayout(rect);
} catch (NumberFormatException e) {
Activator.setErrorMessage(
"EditFieldPropertySource.setPropertyValue()", id
+ " NumberFormatException - " + e.getMessage(), e);
}
} else if (id.equals(FrameNode.PROPERTY_HEIGHT)) {
try {
Layout rect = node.getLayout();
Integer pointheight = Integer.parseInt((String) value);
rect.height = pointheight;
node.setLayout(rect);
} catch (NumberFormatException e) {
Activator.setErrorMessage(
"EditFieldPropertySource.setPropertyValue()", id
+ " NumberFormatException - " + e.getMessage(), e);
}
} else if (id.equals(FrameNode.PROPERTY_STYLE)) {
int index = (Integer) value;
if (index < 0)
return;
String style = cszStyle[STYLE_EDITFIELD][(Integer) value];
node.setStyle(style);
} else if (id.equals(FrameNode.PROPERTY_TEXT)) {
if (value instanceof Integer)
text = "::" + stringId[(Integer) value];
else
text = (String) value;
if (text.indexOf("::") < 0 && text.length() > node.getLimitLength())
text = text.substring(0, node.getLimitLength());
node.setText(text);
} else if (id.equals(FrameNode.PROPERTY_BORDERSTYLE)) {
int index = (Integer) value;
if (index < 0)
return;
String borderstyle = cszBorderStyle[(Integer) value];
node.setBorderStyle(borderstyle);
} else if (id.equals(FrameNode.PROPERTY_LIMITLENGTH)) {
try {
Integer length = Integer.parseInt((String) value);
String empty = node.getText();
if (length < 0)
length = 0;
if (length > 1000)
length = 1000;
if (empty.indexOf("::") < 0 && length < empty.length()) {
empty = empty.substring(0, length);
node.setText(empty);
}
node.setLimitLength(length);
} catch (NumberFormatException e) {
Activator.setErrorMessage(
"EditFieldPropertySource.setPropertyValue()", id
+ " NumberFormatException - " + e.getMessage(), e);
}
} else if (id.equals(FrameNode.PROPERTY_INPUTSTYLE)) {
int index = (Integer) value;
if (index < 0)
return;
node.setInputStyle(cszInputStyle[(Integer) value]);
} else if (id.equals(FrameNode.PROPERTY_TITLETEXT)) {
if (value instanceof Integer)
text = "::" + stringId[(Integer) value];
else
text = (String) value;
node.setTitleText(text);
} else if (id.equals(FrameNode.PROPERTY_SHOWTITLETEXT)) {
int index = (Integer) value;
if (index < 0 || index > 1)
return;
node.setShowTitleText(index);
} else if (id.equals(FrameNode.PROPERTY_KEYPADENABLED)) {
int index = (Integer) value;
if (index < 0 || index > 1)
return;
node.setKeypadEnabled(index);
} else if (id.equals(FrameNode.PROPERTY_GUIDETEXT)) {
if (value instanceof Integer)
text = "::" + stringId[(Integer) value];
else
text = (String) value;
node.setGuideText(text);
} else if (id.equals(FrameNode.PROPERTY_GROUPSTYLE)) {
int index = (Integer) value;
if (index < 0)
return;
String bgstyle = cszGroupStyle[(Integer) value];
node.setGroupStyle(bgstyle);
} else if(handlerList.contains(id)) {
IPropertyDescriptor property = getPropertyDescriptor(id);
if(property == null)
return;
String op = property.getLabelProvider().getText(value);
operateHandler((String) id, op);
}
}
}
| UTF-8 | Java | 15,860 | java | EditFieldPropertySource.java | Java | []
| null | []
| package com.osp.ide.resource.model.property;
import java.util.ArrayList;
import org.eclipse.ui.views.properties.ComboBoxPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.PropertyDescriptor;
import org.eclipse.ui.views.properties.TextPropertyDescriptor;
import com.osp.ide.resource.Activator;
import com.osp.ide.resource.common.EditableComboPropertyDescriptor;
import com.osp.ide.resource.common.FramePropertyPage;
import com.osp.ide.resource.model.EditField;
import com.osp.ide.resource.model.FrameNode;
import com.osp.ide.resource.model.PanelFrame;
import com.osp.ide.resource.resinfo.EDITFIELD_INFO;
import com.osp.ide.resource.resinfo.Layout;
public class EditFieldPropertySource extends OspNodePropertySource {
public EditFieldPropertySource(EditField node) {
this.node = node;
EDITFIELD_INFO info = node.getItem().clone();
this.info = info;
if (this.info != null) {
int mode = node.getModeIndex();
Layout rect = node.getLayout(mode);
Layout newLayout = new Layout(rect);
this.info.SetLayout(newLayout);
if (mode == PORTRAIT) {
rect = node.getLayout(LANDCAPE);
} else {
rect = node.getLayout(PORTRAIT);
}
newLayout = new Layout(rect);
this.info.SetLayout(newLayout);
}
}
protected void initDescriptor() {
properties = new ArrayList<IPropertyDescriptor>();
initStringId();
initControlId();
PropertyDescriptor StyleDescriptor = (new ComboBoxPropertyDescriptor(
FrameNode.PROPERTY_STYLE, "EditField Style", cszStyle[STYLE_EDITFIELD]));
StyleDescriptor.setCategory(FrameNode.GROUP_STYLE);
properties.add(StyleDescriptor);
PropertyDescriptor GroupStyleDescriptor =
(new ComboBoxPropertyDescriptor(FrameNode.PROPERTY_GROUPSTYLE,
"Group Style", cszGroupStyle));
GroupStyleDescriptor.setCategory(FrameNode.GROUP_STYLE);
properties.add(GroupStyleDescriptor);
FrameNode parent = node.getParent();
if(parent instanceof PanelFrame) {
PropertyDescriptor InputStyleDescriptor = (new ComboBoxPropertyDescriptor(
FrameNode.PROPERTY_INPUTSTYLE, "Input Style", cszInputStyle));
InputStyleDescriptor.setCategory(FrameNode.GROUP_STYLE);
properties.add(InputStyleDescriptor);
} else {
PropertyDescriptor InputStyleDescriptor = new PropertyDescriptor(
FrameNode.PROPERTY_INPUTSTYLE, "Input Style");
InputStyleDescriptor.setCategory(FrameNode.GROUP_STYLE);
InputStyleDescriptor.setDescription(FramePropertyPage.PROPERTY_DISABLE);
properties.add(InputStyleDescriptor);
}
PropertyDescriptor ShowtitleTextDescriptor = (new ComboBoxPropertyDescriptor(
FrameNode.PROPERTY_SHOWTITLETEXT, "Show Title Text", BOOL));
ShowtitleTextDescriptor.setCategory(FrameNode.GROUP_STYLE);
properties.add(ShowtitleTextDescriptor);
PropertyDescriptor HeightDescriptor = (new TextPropertyDescriptor(
FrameNode.PROPERTY_HEIGHT, "Height"));
HeightDescriptor.setCategory(FrameNode.GROUP_LAYOUT);
properties.add(HeightDescriptor);
PropertyDescriptor ParentDescriptor = (new ComboBoxPropertyDescriptor(
FrameNode.PROPERTY_PARENT, "Parent ID", controlId));
ParentDescriptor.setCategory(FrameNode.GROUP_LAYOUT);
properties.add(ParentDescriptor);
PropertyDescriptor WidthDescriptor = (new TextPropertyDescriptor(
FrameNode.PROPERTY_WIDTH, "Width"));
WidthDescriptor.setCategory(FrameNode.GROUP_LAYOUT);
properties.add(WidthDescriptor);
PropertyDescriptor PointXlDescriptor = (new TextPropertyDescriptor(
FrameNode.PROPERTY_POINTX, "X Position"));
PointXlDescriptor.setCategory(FrameNode.GROUP_LAYOUT);
properties.add(PointXlDescriptor);
PropertyDescriptor PointYDescriptor = (new TextPropertyDescriptor(
FrameNode.PROPERTY_POINTY, "Y Position"));
PointYDescriptor.setCategory(FrameNode.GROUP_LAYOUT);
properties.add(PointYDescriptor);
PropertyDescriptor GuideTextDescriptor = (new EditableComboPropertyDescriptor(
FrameNode.PROPERTY_GUIDETEXT, "Guide Text", stringId));
GuideTextDescriptor.setCategory(FrameNode.GROUP_PROPERTIES);
properties.add(GuideTextDescriptor);
PropertyDescriptor NameDescriptor = (new TextPropertyDescriptor(
FrameNode.PROPERTY_RENAME, "ID"));
NameDescriptor.setCategory(FrameNode.GROUP_PROPERTIES);
properties.add(NameDescriptor);
PropertyDescriptor KeypadEnabledDescriptor = (new ComboBoxPropertyDescriptor(
FrameNode.PROPERTY_KEYPADENABLED, "Keypad Enabled", BOOL));
KeypadEnabledDescriptor.setCategory(FrameNode.GROUP_PROPERTIES);
properties.add(KeypadEnabledDescriptor);
PropertyDescriptor TextDescriptor = (new EditableComboPropertyDescriptor(
FrameNode.PROPERTY_TEXT, "Text", stringId));
TextDescriptor.setCategory(FrameNode.GROUP_PROPERTIES);
properties.add(TextDescriptor);
// PropertyDescriptor BorderStyleDescriptor = (new ComboBoxPropertyDescriptor(
// FrameNode.PROPERTY_BORDERSTYLE, "Border Style", cszBorderStyle));
// BorderStyleDescriptor.setCategory("Property");
// properties.add(BorderStyleDescriptor);
PropertyDescriptor LimitLengthlDescriptor = (new TextPropertyDescriptor(
FrameNode.PROPERTY_LIMITLENGTH,
"Text Limit Length [Range: 0 ~ 1000]"));
LimitLengthlDescriptor.setCategory(FrameNode.GROUP_PROPERTIES);
properties.add(LimitLengthlDescriptor);
PropertyDescriptor titleTextDescriptor = (new EditableComboPropertyDescriptor(
FrameNode.PROPERTY_TITLETEXT, "Title Text", stringId));
titleTextDescriptor.setCategory(FrameNode.GROUP_PROPERTIES);
properties.add(titleTextDescriptor);
}
@Override
public Object getPropertyValue(Object id) {
EditField node = (EditField) this.node;
int minY = getMinY(node);
String text = "";
if (id.equals(FrameNode.PROPERTY_RENAME)) {
return node.getName();
} else if (id.equals(FrameNode.PROPERTY_MODE))
return node.getLayout().mode;
else if (id.equals(FrameNode.PROPERTY_PARENT))
return getControlIndex(node.getParentId());
else if (id.equals(FrameNode.PROPERTY_STYLE)) {
return FrameNode.getStyleIndex(STYLE_EDITFIELD,
node.getLayout().style);
} else if (id.equals(FrameNode.PROPERTY_POINTX))
return Integer.toString(node.getLayout().x);
else if (id.equals(FrameNode.PROPERTY_POINTY))
return Integer.toString(node.getLayout().y - minY);
else if (id.equals(FrameNode.PROPERTY_WIDTH))
return Integer.toString(node.getLayout().width);
else if (id.equals(FrameNode.PROPERTY_HEIGHT))
return Integer.toString(node.getLayout().height);
else if (id.equals(FrameNode.PROPERTY_TYPE))
return "WINDOW_" + cszCtlType[node.getType()];
else if (id.equals(FrameNode.PROPERTY_TEXT)) {
text = node.getText();
if (text.indexOf("::") < 0)
return text;
else {
return getStringIndex(text.replace("::", ""));
}
} else if (id.equals(FrameNode.PROPERTY_BORDERSTYLE)){
return node.getBorderStyleIndex();
} else if (id.equals(FrameNode.PROPERTY_LIMITLENGTH)) {
return Integer.toString(node.getLimitLength());
} else if (id.equals(FrameNode.PROPERTY_INPUTSTYLE)) {
if(node.getParent() instanceof PanelFrame) {
return FrameNode.getInputStyleIndex(node.getInputStyle());
}
node.setInputStyle(cszInputStyle[0]);
return cszInputStyle[0];
} else if (id.equals(FrameNode.PROPERTY_TITLETEXT)) {
text = node.getTitleText();
if (text.indexOf("::") < 0)
return text;
else {
return getStringIndex(text.replace("::", ""));
}
} else if (id.equals(FrameNode.PROPERTY_SHOWTITLETEXT)) {
return node.getShowTitleText();
} else if (id.equals(FrameNode.PROPERTY_KEYPADENABLED)) {
return node.getKeypadEnabled();
} else if (id.equals(FrameNode.PROPERTY_GROUPSTYLE)) {
return node.getGroupStyleIndex();
} else if (id.equals(FrameNode.PROPERTY_GUIDETEXT)) {
text = node.getGuideText();
if (text.indexOf("::") < 0)
return text;
else {
return getStringIndex(text.replace("::", ""));
}
} else if(handlerList != null && handlerList.contains(id)) {
return 0;
}
return null;
}
@Override
public void resetPropertyValue(Object id) {
EDITFIELD_INFO info = (EDITFIELD_INFO) this.info;
EditField node = (EditField) this.node;
if (id.equals(FrameNode.PROPERTY_RENAME)) {
node.reName(info.Id);
} else if (id.equals(FrameNode.PROPERTY_TYPE)) {
node.setType(info.type);
} else if (id.equals(FrameNode.PROPERTY_PARENT)) {
node.setParentId(info.pID);
} else if (id.equals(FrameNode.PROPERTY_POINTX)) {
Layout rect = node.getLayout();
rect.x = info.GetLayout(node.getModeIndex()).x;
node.setLayout(rect);
} else if (id.equals(FrameNode.PROPERTY_POINTY)) {
Layout rect = node.getLayout();
rect.y = info.GetLayout(node.getModeIndex()).y;
node.setLayout(rect);
} else if (id.equals(FrameNode.PROPERTY_WIDTH)) {
Layout rect = node.getLayout();
rect.width = info.GetLayout(node.getModeIndex()).width;
node.setLayout(rect);
} else if (id.equals(FrameNode.PROPERTY_HEIGHT)) {
Layout rect = node.getLayout();
rect.height = info.GetLayout(node.getModeIndex()).height;
node.setLayout(rect);
} else if (id.equals(FrameNode.PROPERTY_STYLE)) {
node.setStyle(info.GetLayout(node.getModeIndex()).style);
} else if (id.equals(FrameNode.PROPERTY_TEXT)) {
node.setText(info.text);
} else if (id.equals(FrameNode.PROPERTY_BORDERSTYLE)) {
node.setBorderStyle(node.getBorderStyle());
} else if (id.equals(FrameNode.PROPERTY_LIMITLENGTH)) {
node.setLimitLength(info.limitLength);
} else if (id.equals(FrameNode.PROPERTY_INPUTSTYLE)) {
node.setInputStyle(info.inputStyle);
} else if (id.equals(FrameNode.PROPERTY_TITLETEXT)) {
node.setTitleText(info.titleText);
} else if (id.equals(FrameNode.PROPERTY_SHOWTITLETEXT)) {
node.setShowTitleText(info.ShowTitleText);
} else if (id.equals(FrameNode.PROPERTY_KEYPADENABLED)) {
node.setKeypadEnabled(info.KeypadEnabled);
} else if (id.equals(FrameNode.PROPERTY_GUIDETEXT)) {
node.setGuideText(info.guideText);
} else if (id.equals(FrameNode.PROPERTY_GROUPSTYLE)) {
node.setGroupStyle(node.getGroupStyle());
}
}
@Override
public void setPropertyValue(Object id, Object value) {
if(isValidate(id, value) == false)
return;
EditField node = (EditField) this.node;
String text = "";
if (id.equals(FrameNode.PROPERTY_RENAME)) {
node.reName((String) value);
} else if (id.equals(FrameNode.PROPERTY_PARENT)) {
int index = (Integer) value;
if (index < 0)
return;
node.setParentId(controlId[(Integer) value]);
} else if (id.equals(FrameNode.PROPERTY_POINTX)) {
try {
Layout rect = node.getLayout();
Integer pointx = Integer.parseInt((String) value);
rect.x = pointx;
node.setLayout(rect);
} catch (NumberFormatException e) {
Activator.setErrorMessage(
"EditFieldPropertySource.setPropertyValue()", id
+ " NumberFormatException - " + e.getMessage(), e);
}
} else if (id.equals(FrameNode.PROPERTY_POINTY)) {
try {
Layout rect = node.getLayout();
Integer pointy = Integer.parseInt((String) value);
int minY = getMinY(node);
rect.y = pointy + minY;
node.setLayout(rect);
} catch (NumberFormatException e) {
Activator.setErrorMessage(
"EditFieldPropertySource.setPropertyValue()", id
+ " NumberFormatException - " + e.getMessage(), e);
}
} else if (id.equals(FrameNode.PROPERTY_WIDTH)) {
try {
Layout rect = node.getLayout();
Integer pointwidth = Integer.parseInt((String) value);
rect.width = pointwidth;
node.setLayout(rect);
} catch (NumberFormatException e) {
Activator.setErrorMessage(
"EditFieldPropertySource.setPropertyValue()", id
+ " NumberFormatException - " + e.getMessage(), e);
}
} else if (id.equals(FrameNode.PROPERTY_HEIGHT)) {
try {
Layout rect = node.getLayout();
Integer pointheight = Integer.parseInt((String) value);
rect.height = pointheight;
node.setLayout(rect);
} catch (NumberFormatException e) {
Activator.setErrorMessage(
"EditFieldPropertySource.setPropertyValue()", id
+ " NumberFormatException - " + e.getMessage(), e);
}
} else if (id.equals(FrameNode.PROPERTY_STYLE)) {
int index = (Integer) value;
if (index < 0)
return;
String style = cszStyle[STYLE_EDITFIELD][(Integer) value];
node.setStyle(style);
} else if (id.equals(FrameNode.PROPERTY_TEXT)) {
if (value instanceof Integer)
text = "::" + stringId[(Integer) value];
else
text = (String) value;
if (text.indexOf("::") < 0 && text.length() > node.getLimitLength())
text = text.substring(0, node.getLimitLength());
node.setText(text);
} else if (id.equals(FrameNode.PROPERTY_BORDERSTYLE)) {
int index = (Integer) value;
if (index < 0)
return;
String borderstyle = cszBorderStyle[(Integer) value];
node.setBorderStyle(borderstyle);
} else if (id.equals(FrameNode.PROPERTY_LIMITLENGTH)) {
try {
Integer length = Integer.parseInt((String) value);
String empty = node.getText();
if (length < 0)
length = 0;
if (length > 1000)
length = 1000;
if (empty.indexOf("::") < 0 && length < empty.length()) {
empty = empty.substring(0, length);
node.setText(empty);
}
node.setLimitLength(length);
} catch (NumberFormatException e) {
Activator.setErrorMessage(
"EditFieldPropertySource.setPropertyValue()", id
+ " NumberFormatException - " + e.getMessage(), e);
}
} else if (id.equals(FrameNode.PROPERTY_INPUTSTYLE)) {
int index = (Integer) value;
if (index < 0)
return;
node.setInputStyle(cszInputStyle[(Integer) value]);
} else if (id.equals(FrameNode.PROPERTY_TITLETEXT)) {
if (value instanceof Integer)
text = "::" + stringId[(Integer) value];
else
text = (String) value;
node.setTitleText(text);
} else if (id.equals(FrameNode.PROPERTY_SHOWTITLETEXT)) {
int index = (Integer) value;
if (index < 0 || index > 1)
return;
node.setShowTitleText(index);
} else if (id.equals(FrameNode.PROPERTY_KEYPADENABLED)) {
int index = (Integer) value;
if (index < 0 || index > 1)
return;
node.setKeypadEnabled(index);
} else if (id.equals(FrameNode.PROPERTY_GUIDETEXT)) {
if (value instanceof Integer)
text = "::" + stringId[(Integer) value];
else
text = (String) value;
node.setGuideText(text);
} else if (id.equals(FrameNode.PROPERTY_GROUPSTYLE)) {
int index = (Integer) value;
if (index < 0)
return;
String bgstyle = cszGroupStyle[(Integer) value];
node.setGroupStyle(bgstyle);
} else if(handlerList.contains(id)) {
IPropertyDescriptor property = getPropertyDescriptor(id);
if(property == null)
return;
String op = property.getLabelProvider().getText(value);
operateHandler((String) id, op);
}
}
}
| 15,860 | 0.670681 | 0.668537 | 412 | 36.495144 | 22.704037 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.601942 | false | false | 10 |
8613df95c4e6fce6a5c24c1019f1128ed8cdbfbf | 15,960,098,507,233 | 65f85534491fac7f3161a0ff411f607a83af80bb | /src/superKeyword/BMW.java | 8fbe0bd533adbcbc70aff15a6609b25ead37c44e | []
| no_license | gburhade/NAL_Dec2020_JavaSessions | https://github.com/gburhade/NAL_Dec2020_JavaSessions | fb96bdbbda4b4954f0eb513e900f76cdf15dcd9e | 085ca9c9578e7cb73feb46979414c0811374c496 | refs/heads/master | 2023-03-20T14:15:39.789000 | 2021-03-10T01:52:59 | 2021-03-10T01:52:59 | 346,198,049 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package superKeyword;
public class BMW extends Car
{
String name;
int price;
public BMW()
{
super("BMW 520d", 40);
//System.out.println("BMW --> default Constructor");
}
public BMW(String name, int price)
{
super(name,price);
this.name = name;
this.price = price;
System.out.println(super.name);
System.out.println(super.price);
}
}
| UTF-8 | Java | 370 | java | BMW.java | Java | []
| null | []
| package superKeyword;
public class BMW extends Car
{
String name;
int price;
public BMW()
{
super("BMW 520d", 40);
//System.out.println("BMW --> default Constructor");
}
public BMW(String name, int price)
{
super(name,price);
this.name = name;
this.price = price;
System.out.println(super.name);
System.out.println(super.price);
}
}
| 370 | 0.645946 | 0.632432 | 25 | 13.8 | 14.696939 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.6 | false | false | 10 |
ae35ab9de02f042bd69ce961810d9b4a23829672 | 12,223,476,965,426 | 41505bda511412e275f5fe3b68b26e557407efbf | /src/main/java/at/uibk/apis/stocks/worldTradingData/queryParamter/SymbolParameter.java | 8ca793a9c171d4b2d0f78d339b9e4566c563de0b | []
| no_license | thopert/stocks-web-tool | https://github.com/thopert/stocks-web-tool | e4807d85cea357965ecd4349a8b9f7a322e63ed9 | 6e64211ed6f3267b2bab27a18b2797a5423e0b22 | refs/heads/master | 2021-06-17T02:01:08.140000 | 2019-10-21T18:44:59 | 2019-10-21T18:44:59 | 199,000,892 | 0 | 0 | null | false | 2021-04-26T19:22:35 | 2019-07-26T10:52:50 | 2019-10-21T18:45:33 | 2021-04-26T19:22:34 | 737 | 0 | 0 | 1 | TSQL | false | false | package at.uibk.apis.stocks.worldTradingData.queryParamter;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class SymbolParameter implements QueryParameter {
private List<String> symbols;
public SymbolParameter(List<String> symbols) {
this.symbols = symbols;
}
public SymbolParameter(String... symbols) {
this.symbols = Arrays.stream(symbols).collect(Collectors.toList());
}
@Override
public String getKey() {
return "symbol";
}
@Override
public String getValue() {
return String.join(",", symbols);
}
}
| UTF-8 | Java | 632 | java | SymbolParameter.java | Java | []
| null | []
| package at.uibk.apis.stocks.worldTradingData.queryParamter;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class SymbolParameter implements QueryParameter {
private List<String> symbols;
public SymbolParameter(List<String> symbols) {
this.symbols = symbols;
}
public SymbolParameter(String... symbols) {
this.symbols = Arrays.stream(symbols).collect(Collectors.toList());
}
@Override
public String getKey() {
return "symbol";
}
@Override
public String getValue() {
return String.join(",", symbols);
}
}
| 632 | 0.674051 | 0.674051 | 30 | 20.066668 | 21.28056 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.366667 | false | false | 10 |
9bea21f3cdf9737b244655a62a5a96bbea92c8f7 | 12,317,966,250,098 | 7f491d04e8665c1ecdf65f56294b67e985b94a16 | /tigon-client/src/main/java/co/cask/tigon/cli/FlowOperations.java | 32190242928b131b331cd73c5dab181bec9a73d4 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
]
| permissive | caskdata/tigon | https://github.com/caskdata/tigon | 743798218b84273a5dc7eca39913e2ceb80887e9 | 5be6dffd7c79519d1211bb08f75be7dcfbbad392 | refs/heads/develop | 2023-05-31T07:27:01.068000 | 2017-04-05T16:12:12 | 2017-04-05T16:12:12 | 22,634,457 | 105 | 28 | null | false | 2017-04-05T16:12:13 | 2014-08-05T07:26:39 | 2017-03-23T21:25:50 | 2017-04-05T16:12:13 | 283,282 | 236 | 35 | 1 | C++ | null | null | /*
* Copyright © 2014 Cask Data, Inc.
*
* 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 co.cask.tigon.cli;
import com.google.common.util.concurrent.Service;
import org.apache.twill.api.TwillRunResources;
import java.io.File;
import java.io.PrintStream;
import java.net.InetSocketAddress;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* Flow Operations.
*/
public interface FlowOperations extends Service {
/**
* Starts a Flow.
* @param jarPath Path to the Flow Jar.
* @param className Flow ClassName that needs to be started.
* @param userArgs Map of User Runtime Arguments that can be accessed in the Flow.
* @param debug Indicates if the Flow needs to be started in debug mode.
*/
void startFlow(File jarPath, String className, Map<String, String> userArgs, boolean debug);
/**
* Get the status of a Flow.
* @param flowName Name of the Flow.
* @return {@link State} of Flow.
*/
State getStatus(String flowName);
/**
* List the names of all the Flows currently running.
* @return List of Flow names.
*/
List<String> listAllFlows();
/**
* Stop a Flow.
* @param flowName Name of the Flow.
*/
void stopFlow(String flowName);
/**
* Stops a Flow and deletes all the queues associated with the Flow.
* @param flowName Name of the Flow.
*/
void deleteFlow(String flowName);
/**
* Returns the List of services announced in the Flow.
* @param flowName Name of the Flow.
* @return List of Service Names.
*/
List<String> getServices(String flowName);
/**
* Discover the Service endpoints announced in the Flow.
* @param flowName Name of the Flow.
* @param service Name of the Service used while announcing the endpoint.
* @return List of InetSocketAddress
*/
List<InetSocketAddress> discover(String flowName, String service);
/**
* Set the number of instances of Flowlets.
* @param flowName Name of the Flow.
* @param flowletName Name of the Flowlet.
* @param instanceCount
*/
void setInstances(String flowName, String flowletName, int instanceCount);
/**
* Returns the Flowlets in the Flow and the {@link TwillRunResources} of each Flowlet.
* @param flowName Name of the Flow.
* @return Map of Flowlet Names and {@link TwillRunResources} of each Flowlet.
*/
Map<String, Collection<TwillRunResources>> getFlowInfo(String flowName);
/**
* Adds a Log Handler to the PrintStream for receiving live logs from the Flow.
* @param flowName Name of the Flow.
* @param out PrintStream to which logs need to be sent.
*/
void addLogHandler(String flowName, PrintStream out);
}
| UTF-8 | Java | 3,185 | java | FlowOperations.java | Java | [
{
"context": "/*\n * Copyright © 2014 Cask Data, Inc.\n *\n * Licensed under the Apache License, Ve",
"end": 32,
"score": 0.8074707984924316,
"start": 23,
"tag": "NAME",
"value": "Cask Data"
}
]
| null | []
| /*
* Copyright © 2014 <NAME>, Inc.
*
* 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 co.cask.tigon.cli;
import com.google.common.util.concurrent.Service;
import org.apache.twill.api.TwillRunResources;
import java.io.File;
import java.io.PrintStream;
import java.net.InetSocketAddress;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* Flow Operations.
*/
public interface FlowOperations extends Service {
/**
* Starts a Flow.
* @param jarPath Path to the Flow Jar.
* @param className Flow ClassName that needs to be started.
* @param userArgs Map of User Runtime Arguments that can be accessed in the Flow.
* @param debug Indicates if the Flow needs to be started in debug mode.
*/
void startFlow(File jarPath, String className, Map<String, String> userArgs, boolean debug);
/**
* Get the status of a Flow.
* @param flowName Name of the Flow.
* @return {@link State} of Flow.
*/
State getStatus(String flowName);
/**
* List the names of all the Flows currently running.
* @return List of Flow names.
*/
List<String> listAllFlows();
/**
* Stop a Flow.
* @param flowName Name of the Flow.
*/
void stopFlow(String flowName);
/**
* Stops a Flow and deletes all the queues associated with the Flow.
* @param flowName Name of the Flow.
*/
void deleteFlow(String flowName);
/**
* Returns the List of services announced in the Flow.
* @param flowName Name of the Flow.
* @return List of Service Names.
*/
List<String> getServices(String flowName);
/**
* Discover the Service endpoints announced in the Flow.
* @param flowName Name of the Flow.
* @param service Name of the Service used while announcing the endpoint.
* @return List of InetSocketAddress
*/
List<InetSocketAddress> discover(String flowName, String service);
/**
* Set the number of instances of Flowlets.
* @param flowName Name of the Flow.
* @param flowletName Name of the Flowlet.
* @param instanceCount
*/
void setInstances(String flowName, String flowletName, int instanceCount);
/**
* Returns the Flowlets in the Flow and the {@link TwillRunResources} of each Flowlet.
* @param flowName Name of the Flow.
* @return Map of Flowlet Names and {@link TwillRunResources} of each Flowlet.
*/
Map<String, Collection<TwillRunResources>> getFlowInfo(String flowName);
/**
* Adds a Log Handler to the PrintStream for receiving live logs from the Flow.
* @param flowName Name of the Flow.
* @param out PrintStream to which logs need to be sent.
*/
void addLogHandler(String flowName, PrintStream out);
}
| 3,182 | 0.708229 | 0.705716 | 104 | 29.615385 | 27.582153 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.326923 | false | false | 10 |
913b0d34ca2bb71e83531ab6d0895bcbbbfed8f8 | 6,262,062,357,970 | 15fa4fa16edafea771c54b28228f2c4d7212a249 | /app/src/main/java/com/example/nicholas/fuckingtabsmite/FragmentFOckingPageaAdapter.java | 6ba92151e0758ed4963ece08ff0c60d42927e0b5 | []
| no_license | Barbats14/TabsMite | https://github.com/Barbats14/TabsMite | a5e1658ec54a5e6894f56f3baadfd5bca352f125 | 3ecefb5b479e0ceec29778cc73f4d1d6191ae380 | refs/heads/master | 2021-06-06T19:11:01.464000 | 2016-07-20T00:31:17 | 2016-07-20T00:31:17 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.nicholas.fuckingtabsmite;
import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
/**
* Created by Nicholas on 7/19/2016.
*/
public class FragmentFOckingPageaAdapter extends FragmentPagerAdapter {
private String[] fockingTabs = new String[]{"Active Focking tab mite","Past Focking tab mite"};
private Context context;
public FragmentFOckingPageaAdapter(FragmentManager fm, Context context) {
super(fm);
this.context = context;
}
@Override
public Fragment getItem(int position) {
if (position == 0){
return new ActiveTabFragment();
}
else if (position ==1){
return new PastTabFragment();
}
return null;
}
@Override
public int getCount() {
return 2;
}
@Override
public CharSequence getPageTitle(int position) {
return fockingTabs[position];
}
}
| UTF-8 | Java | 1,038 | java | FragmentFOckingPageaAdapter.java | Java | [
{
"context": "rt.v4.app.FragmentPagerAdapter;\n\n/**\n * Created by Nicholas on 7/19/2016.\n */\npublic class FragmentFOckingPag",
"end": 246,
"score": 0.9987465739250183,
"start": 238,
"tag": "NAME",
"value": "Nicholas"
}
]
| null | []
| package com.example.nicholas.fuckingtabsmite;
import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
/**
* Created by Nicholas on 7/19/2016.
*/
public class FragmentFOckingPageaAdapter extends FragmentPagerAdapter {
private String[] fockingTabs = new String[]{"Active Focking tab mite","Past Focking tab mite"};
private Context context;
public FragmentFOckingPageaAdapter(FragmentManager fm, Context context) {
super(fm);
this.context = context;
}
@Override
public Fragment getItem(int position) {
if (position == 0){
return new ActiveTabFragment();
}
else if (position ==1){
return new PastTabFragment();
}
return null;
}
@Override
public int getCount() {
return 2;
}
@Override
public CharSequence getPageTitle(int position) {
return fockingTabs[position];
}
}
| 1,038 | 0.663777 | 0.651252 | 44 | 22.59091 | 23.47757 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.363636 | false | false | 10 |
8dd1e3538650722eadd3fdde46afd100f35b7ce6 | 26,139,171,004,058 | 7ee56c8f8c1f34926107e00fb0abd3737dc4bcde | /ApplicationProgramming/src/Alphabet1.java | d2eb913008b058cc0392cdf19f18a436fb0a5f72 | []
| no_license | lamin1990/java_encoding | https://github.com/lamin1990/java_encoding | ee1ffbb930e1eaf800a7b02449902add1bb86f51 | 90bc110f79918993ea9ee60397a4928bd7f5365d | refs/heads/master | 2020-03-10T00:52:06.069000 | 2018-04-11T12:32:16 | 2018-04-11T12:32:16 | 129,093,504 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class Alphabet1 {
public static void main(String[] args) {
// 1. Write the shortest possible program that outputs the numbers between 0 and 100 to the console. hint: use a loop.
for(int i=1; i < 100; i++)
System.out.println(i);
// 2. Write the shortest possible program that outputs all the lower case letters of the alphabet to the console. hint: use a loop with a 'char' type variable.
for(char c='a'; c <= 'z'; c++)
System.out.println(c);
// 3. Write the shortest possible program that outputs all the upper case letters of the alphabet, in reverse order, to the console.
for(char c='Z'; c >= 'A'; c--)
System.out.println(c);
}
}
| UTF-8 | Java | 679 | java | Alphabet1.java | Java | []
| null | []
|
public class Alphabet1 {
public static void main(String[] args) {
// 1. Write the shortest possible program that outputs the numbers between 0 and 100 to the console. hint: use a loop.
for(int i=1; i < 100; i++)
System.out.println(i);
// 2. Write the shortest possible program that outputs all the lower case letters of the alphabet to the console. hint: use a loop with a 'char' type variable.
for(char c='a'; c <= 'z'; c++)
System.out.println(c);
// 3. Write the shortest possible program that outputs all the upper case letters of the alphabet, in reverse order, to the console.
for(char c='Z'; c >= 'A'; c--)
System.out.println(c);
}
}
| 679 | 0.671576 | 0.653903 | 19 | 34.684212 | 47.418686 | 161 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.210526 | false | false | 10 |
167edd616a92064b8b181d15ae96ae8861a0cc18 | 489,626,319,344 | fc97069a0b4701fd7ee5d489e94abbfdba273066 | /src/main/java/d/v/c/l1/d0$d.java | 4ee91b7579883a1cbdfd45914b5de53d15c6ed35 | []
| no_license | bellmit/zycami-ded | https://github.com/bellmit/zycami-ded | 8604f1eb24fb767e4cf499e019d6e4568451bb4b | 27686ca846de6d164692c81bac2ae7f85710361f | refs/heads/main | 2023-06-17T20:36:29.589000 | 2021-07-19T18:58:18 | 2021-07-19T18:58:18 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Decompiled with CFR 0.151.
*/
package d.v.c.l1;
import com.zhiyun.cama.data.api.entity.ProductPlatformListBean;
import com.zhiyun.net.BaseEntity;
import com.zhiyun.pay.data.PayFlowResult;
import d.v.c.l1.d0;
import java.util.List;
import k.d;
import k.f;
import k.r;
import m.a.a;
public class d0$d
implements f {
public final /* synthetic */ d0 a;
public d0$d(d0 d02) {
this.a = d02;
}
public void onFailure(d object, Throwable object2) {
object = new Object[]{};
m.a.a.e("---primepay \u5546\u54c1\u5e73\u53f0\u5217\u8868\u670d\u52a1\u5668\u8bf7\u6c42\u5931\u8d25", object);
object = this.a;
object2 = PayFlowResult.PAY_FLOW_PRODUCT_PLATFORM_COMPLETE;
d0.c((d0)object, (PayFlowResult)((Object)object2));
}
public void onResponse(d object, r object2) {
int n10;
object = (ProductPlatformListBean)((r)object2).a();
boolean n102 = ((r)object2).g();
if (n102 && object != null && (n10 = ((BaseEntity)object).errcode) == 0) {
object2 = this.a;
object = ((ProductPlatformListBean)object).getData();
d0.d((d0)object2, (List)object);
return;
}
object = new Object[]{};
m.a.a.e("---primepay \u670d\u52a1\u5668\u8fd4\u56de\u5546\u54c1\u5e73\u53f0\u5217\u8868\u9519\u8bef", (Object[])object);
object = this.a;
object2 = PayFlowResult.PAY_FLOW_PRODUCT_PLATFORM_COMPLETE;
d0.c((d0)object, (PayFlowResult)((Object)object2));
}
}
| UTF-8 | Java | 1,533 | java | d0$d.java | Java | []
| null | []
| /*
* Decompiled with CFR 0.151.
*/
package d.v.c.l1;
import com.zhiyun.cama.data.api.entity.ProductPlatformListBean;
import com.zhiyun.net.BaseEntity;
import com.zhiyun.pay.data.PayFlowResult;
import d.v.c.l1.d0;
import java.util.List;
import k.d;
import k.f;
import k.r;
import m.a.a;
public class d0$d
implements f {
public final /* synthetic */ d0 a;
public d0$d(d0 d02) {
this.a = d02;
}
public void onFailure(d object, Throwable object2) {
object = new Object[]{};
m.a.a.e("---primepay \u5546\u54c1\u5e73\u53f0\u5217\u8868\u670d\u52a1\u5668\u8bf7\u6c42\u5931\u8d25", object);
object = this.a;
object2 = PayFlowResult.PAY_FLOW_PRODUCT_PLATFORM_COMPLETE;
d0.c((d0)object, (PayFlowResult)((Object)object2));
}
public void onResponse(d object, r object2) {
int n10;
object = (ProductPlatformListBean)((r)object2).a();
boolean n102 = ((r)object2).g();
if (n102 && object != null && (n10 = ((BaseEntity)object).errcode) == 0) {
object2 = this.a;
object = ((ProductPlatformListBean)object).getData();
d0.d((d0)object2, (List)object);
return;
}
object = new Object[]{};
m.a.a.e("---primepay \u670d\u52a1\u5668\u8fd4\u56de\u5546\u54c1\u5e73\u53f0\u5217\u8868\u9519\u8bef", (Object[])object);
object = this.a;
object2 = PayFlowResult.PAY_FLOW_PRODUCT_PLATFORM_COMPLETE;
d0.c((d0)object, (PayFlowResult)((Object)object2));
}
}
| 1,533 | 0.619048 | 0.537508 | 48 | 30.916666 | 29.204618 | 128 | false | false | 0 | 0 | 78 | 0.101761 | 0 | 0 | 0.75 | false | false | 10 |
6a43182e35cb2cab371b920f91587fbbac5aa669 | 20,779,051,813,312 | ed5fb7a3bf340ccb7370c865180bed42a0a679b1 | /ittsb2b_ons.provider/src/main/java/com/qunar/flight/ib2b/ons/dbquery/core/service/impl/OnsOrderInfoService.java | ac13859d844428929240abfaf74380f8083d60bd | []
| no_license | xuliugen/ons | https://github.com/xuliugen/ons | 633081c2ac327eeaef4c4c8816e888e0ad8009be | b8e2cbe960a6352a20ac66bcd864688d3aa833c2 | refs/heads/master | 2015-09-26T10:50:56.512000 | 2015-09-21T12:52:32 | 2015-09-21T12:52:32 | 42,865,927 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.qunar.flight.ib2b.ons.dbquery.core.service.impl;
import com.qunar.flight.ib2b.ons.dbquery.core.bean.OnsOrderInfo;
import com.qunar.flight.ib2b.ons.dbquery.core.bean.condition.OnsOrderInfoCondition;
import com.qunar.flight.ib2b.ons.dbquery.core.repository.IOnsOrderInfoRepository;
import com.qunar.flight.ib2b.ons.dbquery.core.service.IOnsOrderInfoService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* Created by liugen.xu on 2015/7/29.
*/
@Service
public class OnsOrderInfoService implements IOnsOrderInfoService{
@Resource
private IOnsOrderInfoRepository onsOrderInfoRepository;
@Override
public OnsOrderInfo selectByPrimaryKey(Integer id) {
return onsOrderInfoRepository.selectByPrimaryKey(id);
}
@Override
public List<OnsOrderInfo> queryByCondition(OnsOrderInfoCondition onsOrderInfoCondition) {
return onsOrderInfoRepository.queryByCondition(onsOrderInfoCondition);
}
@Override
public int getTotalRecord(OnsOrderInfo onsOrderInfo) {
return onsOrderInfoRepository.getTotalRecord(onsOrderInfo);
}
@Override
public List<OnsOrderInfo> getCurrentPageValue(int currentPage) {
return onsOrderInfoRepository.getCurrentPageValue(currentPage);
}
}
| UTF-8 | Java | 1,357 | java | OnsOrderInfoService.java | Java | [
{
"context": "rce;\r\nimport java.util.List;\r\n\r\n/**\r\n * Created by liugen.xu on 2015/7/29.\r\n */\r\n@Service\r\npublic class",
"end": 507,
"score": 0.5280656218528748,
"start": 505,
"tag": "NAME",
"value": "li"
},
{
"context": ";\r\nimport java.util.List;\r\n\r\n/**\r\n * Created by liugen.xu on 2015/7/29.\r\n */\r\n@Service\r\npublic class OnsOrd",
"end": 514,
"score": 0.856289803981781,
"start": 507,
"tag": "USERNAME",
"value": "ugen.xu"
}
]
| null | []
| package com.qunar.flight.ib2b.ons.dbquery.core.service.impl;
import com.qunar.flight.ib2b.ons.dbquery.core.bean.OnsOrderInfo;
import com.qunar.flight.ib2b.ons.dbquery.core.bean.condition.OnsOrderInfoCondition;
import com.qunar.flight.ib2b.ons.dbquery.core.repository.IOnsOrderInfoRepository;
import com.qunar.flight.ib2b.ons.dbquery.core.service.IOnsOrderInfoService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* Created by liugen.xu on 2015/7/29.
*/
@Service
public class OnsOrderInfoService implements IOnsOrderInfoService{
@Resource
private IOnsOrderInfoRepository onsOrderInfoRepository;
@Override
public OnsOrderInfo selectByPrimaryKey(Integer id) {
return onsOrderInfoRepository.selectByPrimaryKey(id);
}
@Override
public List<OnsOrderInfo> queryByCondition(OnsOrderInfoCondition onsOrderInfoCondition) {
return onsOrderInfoRepository.queryByCondition(onsOrderInfoCondition);
}
@Override
public int getTotalRecord(OnsOrderInfo onsOrderInfo) {
return onsOrderInfoRepository.getTotalRecord(onsOrderInfo);
}
@Override
public List<OnsOrderInfo> getCurrentPageValue(int currentPage) {
return onsOrderInfoRepository.getCurrentPageValue(currentPage);
}
}
| 1,357 | 0.764186 | 0.755343 | 40 | 31.924999 | 31.186045 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.325 | false | false | 10 |
95476b123e9c8077ec40d4261922e475d9eb88bb | 32,667,521,288,721 | a4a98c0814286a6d9edb5181d31e5fe47fe72d3f | /retail-core/src/main/java/com/jzfq/retail/core/messaging/vo/lw/RepaymentStatusInformReqBody.java | 8bcc0037d6dd652d6f341c8aa0da75f528cae1fc | []
| no_license | mingjer/juzi | https://github.com/mingjer/juzi | 2144dbaa5c24524ff791d911b57cd0af11cb009f | 369b7a1394cca323c1937536ba09a9dc83477e21 | refs/heads/master | 2020-04-11T08:36:53.728000 | 2018-09-11T05:30:07 | 2018-09-11T05:30:29 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.jzfq.retail.core.messaging.vo.lw;
import com.alibaba.fastjson.annotation.JSONField;
import com.jzfq.retail.core.messaging.vo.base.MQRequestBody;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author lagon
* @time 2017/10/18 16:25
* @description 贷后订单状态通知请求主体
*/
@NoArgsConstructor
@Getter
@Setter
@ToString
public class RepaymentStatusInformReqBody extends MQRequestBody {
private Integer period;//期数
private String status;//状态:1表还款成功,2表还款失败
@JSONField(format="yyyy-MM-dd HH:mm:ss")
private Date repayDate;//还款时间,格式为:yyyy-MM-dd HH:mm:ss
private BigDecimal actualRepaymentTotal;//还款金额
private String desc;//描述信息
}
| UTF-8 | Java | 860 | java | RepaymentStatusInformReqBody.java | Java | [
{
"context": "BigDecimal;\nimport java.util.Date;\n\n/**\n * @author lagon\n * @time 2017/10/18 16:25\n * @description 贷后订单状态通",
"end": 333,
"score": 0.999649167060852,
"start": 328,
"tag": "USERNAME",
"value": "lagon"
}
]
| null | []
| package com.jzfq.retail.core.messaging.vo.lw;
import com.alibaba.fastjson.annotation.JSONField;
import com.jzfq.retail.core.messaging.vo.base.MQRequestBody;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author lagon
* @time 2017/10/18 16:25
* @description 贷后订单状态通知请求主体
*/
@NoArgsConstructor
@Getter
@Setter
@ToString
public class RepaymentStatusInformReqBody extends MQRequestBody {
private Integer period;//期数
private String status;//状态:1表还款成功,2表还款失败
@JSONField(format="yyyy-MM-dd HH:mm:ss")
private Date repayDate;//还款时间,格式为:yyyy-MM-dd HH:mm:ss
private BigDecimal actualRepaymentTotal;//还款金额
private String desc;//描述信息
}
| 860 | 0.767532 | 0.749351 | 31 | 23.838709 | 19.679852 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.451613 | false | false | 10 |
49d38ae38bda85d558d37ebe7f900f61d170cadd | 979,252,592,164 | b2f02770b50d4a7e866382f74cc9081d05760943 | /JDBCproj/.scannerwork/scanner-report/source-36.txt | 9e116bedec4bfa66883cf708527bab0c47c1c674 | []
| no_license | IgorPystovit/JDBC | https://github.com/IgorPystovit/JDBC | b691ff65af7c3e92f59a301e498f1e1b415b67ee | 1a71f79536979fb726ab4235ce43f21d6f810bb1 | refs/heads/master | 2022-06-24T23:23:37.338000 | 2019-07-30T12:59:16 | 2019-07-30T12:59:16 | 194,424,346 | 0 | 0 | null | false | 2022-06-21T01:25:34 | 2019-06-29T16:06:56 | 2019-07-30T12:59:42 | 2022-06-21T01:25:31 | 269 | 0 | 0 | 3 | Java | false | false | package com.epam.igorpystovit.model.entityfactory;
import com.epam.igorpystovit.model.Reader;
import com.epam.igorpystovit.model.entities.TownsEntity;
public class TownsEntityFactory extends EntityFactory<TownsEntity,Integer>{
@Override
protected TownsEntity create(Integer id) {
// logger.info("Input town entity id:");
// int townId = Reader.readInt();
logger.info("Input town name:");
String name = Reader.readString();
return new TownsEntity(id,name);
}
}
| UTF-8 | Java | 512 | txt | source-36.txt | Java | []
| null | []
| package com.epam.igorpystovit.model.entityfactory;
import com.epam.igorpystovit.model.Reader;
import com.epam.igorpystovit.model.entities.TownsEntity;
public class TownsEntityFactory extends EntityFactory<TownsEntity,Integer>{
@Override
protected TownsEntity create(Integer id) {
// logger.info("Input town entity id:");
// int townId = Reader.readInt();
logger.info("Input town name:");
String name = Reader.readString();
return new TownsEntity(id,name);
}
}
| 512 | 0.708984 | 0.708984 | 15 | 33.133335 | 22.570974 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false | 10 |
38c22845e2f181b4bf2b37ecf0d0b47dad085a00 | 29,489,245,492,953 | 1497107bf453e354d8c8874a909a56605abab6ae | /src/main/java/cs545/proj/domain/TicketProgress.java | 7cbd55823a4ff7c5723816d83d6b86b77b431fa5 | []
| no_license | sovicheacheth/HelpDesk24 | https://github.com/sovicheacheth/HelpDesk24 | 66320e1767b340534182768c7f46af4d742e64ed | 4d95b39ef1392833fca4b4f1463a057ddf1b0ed8 | refs/heads/master | 2020-07-04T02:13:52.182000 | 2016-11-23T19:30:48 | 2016-11-23T19:30:48 | 74,220,346 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cs545.proj.domain;
import java.util.Date;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.NotBlank;
@Entity
public class TicketProgress {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
// @NotBlank
private String note;
// @NotBlank
// @Enumerated
// private Status status;
private String status;
@Temporal(TemporalType.DATE)
private Date date;
// @NotNull
// @ManyToOne(cascade=CascadeType.ALL)
// private Staff staff_id;
//
// @NotNull
// @ManyToOne(cascade=CascadeType.ALL)
// private Ticket ticket_id;
private int staff_id;
private int ticket_id;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public int getStaff_id() {
return staff_id;
}
public void setStaff_id(int staff_id) {
this.staff_id = staff_id;
}
public int getTicket_id() {
return ticket_id;
}
public void setTicket_id(int ticket_id) {
this.ticket_id = ticket_id;
}
}
| UTF-8 | Java | 1,761 | java | TicketProgress.java | Java | []
| null | []
| package cs545.proj.domain;
import java.util.Date;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.NotBlank;
@Entity
public class TicketProgress {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
// @NotBlank
private String note;
// @NotBlank
// @Enumerated
// private Status status;
private String status;
@Temporal(TemporalType.DATE)
private Date date;
// @NotNull
// @ManyToOne(cascade=CascadeType.ALL)
// private Staff staff_id;
//
// @NotNull
// @ManyToOne(cascade=CascadeType.ALL)
// private Ticket ticket_id;
private int staff_id;
private int ticket_id;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public int getStaff_id() {
return staff_id;
}
public void setStaff_id(int staff_id) {
this.staff_id = staff_id;
}
public int getTicket_id() {
return ticket_id;
}
public void setTicket_id(int ticket_id) {
this.ticket_id = ticket_id;
}
}
| 1,761 | 0.69222 | 0.690517 | 87 | 18.241379 | 14.620066 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.264368 | false | false | 10 |
7ff82c247c8045b6d5ff6c1b086759175d458e35 | 12,936,441,504,762 | 2f95306859923d28ae7fbdcef8da352474d88135 | /src/main/java/gob/grsm/denuncia/model/Denunciante.java | d4c3e5f1e2b9867b06e7c86706539cc3f1c76273 | []
| no_license | githubgrsm/denuncia | https://github.com/githubgrsm/denuncia | a455f335d99d14162168a79443774dfd3d9923c2 | 95f4d41a0b1cd50e45ec5316fe7250db23c93630 | refs/heads/master | 2020-04-16T19:46:19.587000 | 2019-01-15T15:18:31 | 2019-01-15T15:18:31 | 165,873,346 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package gob.grsm.denuncia.model;
import java.io.Serializable;
import javax.persistence.*;
import java.util.List;
/**
* The persistent class for the denunciante database table.
*
*/
@Entity
@NamedQuery(name="Denunciante.findAll", query="SELECT d FROM Denunciante d")
public class Denunciante implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name="id_denunciante")
private Long idDenunciante;
private String dni;
private String email;
private String nombres;
//bi-directional many-to-one association to Denuncia
@OneToMany(mappedBy="denunciante")
private List<Denuncia> denuncias;
public Denunciante() {
}
public Long getIdDenunciante() {
return this.idDenunciante;
}
public void setIdDenunciante(Long idDenunciante) {
this.idDenunciante = idDenunciante;
}
public String getDni() {
return this.dni;
}
public void setDni(String dni) {
this.dni = dni;
}
public String getEmail() {
return this.email;
}
public void setEmail(String email) {
this.email = email;
}
public String getNombres() {
return this.nombres;
}
public void setNombres(String nombres) {
this.nombres = nombres;
}
public List<Denuncia> getDenuncias() {
return this.denuncias;
}
public void setDenuncias(List<Denuncia> denuncias) {
this.denuncias = denuncias;
}
public Denuncia addDenuncia(Denuncia denuncia) {
getDenuncias().add(denuncia);
denuncia.setDenunciante(this);
return denuncia;
}
public Denuncia removeDenuncia(Denuncia denuncia) {
getDenuncias().remove(denuncia);
denuncia.setDenunciante(null);
return denuncia;
}
} | UTF-8 | Java | 1,622 | java | Denunciante.java | Java | []
| null | []
| package gob.grsm.denuncia.model;
import java.io.Serializable;
import javax.persistence.*;
import java.util.List;
/**
* The persistent class for the denunciante database table.
*
*/
@Entity
@NamedQuery(name="Denunciante.findAll", query="SELECT d FROM Denunciante d")
public class Denunciante implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name="id_denunciante")
private Long idDenunciante;
private String dni;
private String email;
private String nombres;
//bi-directional many-to-one association to Denuncia
@OneToMany(mappedBy="denunciante")
private List<Denuncia> denuncias;
public Denunciante() {
}
public Long getIdDenunciante() {
return this.idDenunciante;
}
public void setIdDenunciante(Long idDenunciante) {
this.idDenunciante = idDenunciante;
}
public String getDni() {
return this.dni;
}
public void setDni(String dni) {
this.dni = dni;
}
public String getEmail() {
return this.email;
}
public void setEmail(String email) {
this.email = email;
}
public String getNombres() {
return this.nombres;
}
public void setNombres(String nombres) {
this.nombres = nombres;
}
public List<Denuncia> getDenuncias() {
return this.denuncias;
}
public void setDenuncias(List<Denuncia> denuncias) {
this.denuncias = denuncias;
}
public Denuncia addDenuncia(Denuncia denuncia) {
getDenuncias().add(denuncia);
denuncia.setDenunciante(this);
return denuncia;
}
public Denuncia removeDenuncia(Denuncia denuncia) {
getDenuncias().remove(denuncia);
denuncia.setDenunciante(null);
return denuncia;
}
} | 1,622 | 0.734895 | 0.734279 | 88 | 17.443182 | 18.426054 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.079545 | false | false | 10 |
13dc8d76340b271d66634bc42d613a2149bbfd62 | 21,878,563,409,760 | e37295e61668adf84c54c53f6454b93c7e90fc7e | /src/omicron/app/dbManagement/CebaCebaderoDbAdapter.java | bb310a546004044966d9301de1360a315bc12f2b | []
| no_license | alvagui/app | https://github.com/alvagui/app | b4175f228269bf43905003f63c967c3ad9d94f1b | 9747ec4a1181cd9f55a3d715efcb38e9841dcd33 | refs/heads/master | 2021-01-10T21:15:49.401000 | 2014-06-05T14:39:14 | 2014-06-05T14:39:14 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package omicron.app.dbManagement;
import android.content.Context;
public class CebaCebaderoDbAdapter extends DbAdapter {
public CebaCebaderoDbAdapter(Context ctx) {
super(ctx);
}
}
| UTF-8 | Java | 200 | java | CebaCebaderoDbAdapter.java | Java | []
| null | []
| package omicron.app.dbManagement;
import android.content.Context;
public class CebaCebaderoDbAdapter extends DbAdapter {
public CebaCebaderoDbAdapter(Context ctx) {
super(ctx);
}
}
| 200 | 0.745 | 0.745 | 11 | 16.181818 | 19.530016 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.636364 | false | false | 10 |
14a951e4d73caefe93b207a33e45ad8b91132521 | 15,187,004,401,469 | 991f528f49f1fd8318ec018a26f20f44ec4bfbc1 | /app/src/main/java/com/example/classchat/Activity/Activity_CourseNote.java | 47cfdfd1c2b70d2c546952e73b267bd4627fdea3 | []
| no_license | SingXuY/ClassChat | https://github.com/SingXuY/ClassChat | 8979ed541af7a631ff56a71da8567ba808970c06 | a31ef5fc64ec91ab3ef45160da6c2507df910cf9 | refs/heads/master | 2020-06-19T01:43:05.568000 | 2019-07-12T13:38:35 | 2019-07-12T13:38:35 | 196,522,226 | 0 | 0 | null | true | 2019-07-12T13:38:37 | 2019-07-12T06:31:58 | 2019-07-12T07:56:10 | 2019-07-12T13:38:36 | 129 | 0 | 0 | 0 | Java | false | false | package com.example.classchat.Activity;
public class Activity_CourseNote {
}
| UTF-8 | Java | 79 | java | Activity_CourseNote.java | Java | []
| null | []
| package com.example.classchat.Activity;
public class Activity_CourseNote {
}
| 79 | 0.797468 | 0.797468 | 5 | 14.8 | 17.792133 | 39 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false | 10 |
e5d8e4d36d4c714dc5499fa7969853677e097688 | 10,737,418,258,468 | 2722918daf29c8a20e3eee433e0c107b59f09fdf | /pattern/factory/ChCheesePizza.java | bda3b27e3ae1439f7656b96e41b7719372889a57 | []
| no_license | parlak1/pattern | https://github.com/parlak1/pattern | 0a3f4a8670d2c9fbe1ee46183b65730616e3aa97 | 5c0ae36a38d0b6a4b00e9461f03c300342b72814 | refs/heads/master | 2023-06-24T12:33:39.090000 | 2023-06-09T01:05:01 | 2023-06-09T01:05:01 | 181,515,210 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pattern.factory;
public class ChCheesePizza implements Pizza {
@Override
public String getName() {
return "Chicago style cheese pizza";
}
}
| UTF-8 | Java | 171 | java | ChCheesePizza.java | Java | []
| null | []
| package pattern.factory;
public class ChCheesePizza implements Pizza {
@Override
public String getName() {
return "Chicago style cheese pizza";
}
}
| 171 | 0.678363 | 0.678363 | 10 | 16.1 | 17.265284 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false | 10 |
ca8011d775a276a20f17b8c76f7af611f744b7be | 4,114,578,706,619 | 40487db8336f5862637408b9a7ac324a00716f7a | /src/main/java/jags/backend/repositories/CoordonneeRepository.java | f3ceaffab6c978ce439813f7c16b8ea61e141a0a | []
| no_license | albertpinot/OrganismeFormationBackend | https://github.com/albertpinot/OrganismeFormationBackend | 44be0c1e0db66b97a899fd8f51068f5a7543818f | a88f6a19e8a3faaeb725b1d57bfa74c82eaae0b4 | refs/heads/master | 2023-04-13T18:08:13.743000 | 2021-04-14T15:54:42 | 2021-04-14T15:54:42 | 349,458,003 | 0 | 0 | null | true | 2021-03-19T14:50:22 | 2021-03-19T14:50:22 | 2021-03-18T20:31:24 | 2021-03-18T20:31:12 | 507 | 0 | 0 | 0 | null | false | false | package jags.backend.repositories;
import org.springframework.data.jpa.repository.JpaRepository;
import jags.backend.entities.Coordonnee;
public interface CoordonneeRepository extends JpaRepository<Coordonnee, Long> {
public Coordonnee findByMail(String mail);
public Boolean existsCoordonneeByMail(String mail);
}
| UTF-8 | Java | 322 | java | CoordonneeRepository.java | Java | []
| null | []
| package jags.backend.repositories;
import org.springframework.data.jpa.repository.JpaRepository;
import jags.backend.entities.Coordonnee;
public interface CoordonneeRepository extends JpaRepository<Coordonnee, Long> {
public Coordonnee findByMail(String mail);
public Boolean existsCoordonneeByMail(String mail);
}
| 322 | 0.835404 | 0.835404 | 12 | 25.833334 | 27.784388 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false | 10 |
5c9837a6f0e4ab1780f3de89c011676ec2da19a4 | 12,429,635,406,941 | 3255f76c2e3c6b3a06980dc90d62d19234679384 | /J2ME/Darna/src/sprintMobile/ClientHandler.java | 6f1e6ce85bd518462c49093dd3c704748e9e420a | []
| no_license | chihebbha/darna | https://github.com/chihebbha/darna | e19df76258f60407e58aa7b48e8e642ecc6cda3b | b8eb4b207aab27ebd9e862a61e5e65df289913c1 | refs/heads/master | 2021-01-12T12:13:36.743000 | 2016-10-30T20:48:31 | 2016-10-30T20:48:31 | 72,374,574 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package sprintMobile;
import java.util.Vector;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
public class ClientHandler extends DefaultHandler{
private Vector clients;
String idTag="close";
String nomTag = "close";
String prenTag = "close";
String passwordTag="close";
String EmailTag="close";
String TelTag="close";
String DateTag="close";
public ClientHandler() {
clients = new Vector();
}
public Personne[] getPersonne() {
Personne[] personness = new Personne[clients.size()];
clients.copyInto(personness);
return personness;
}
// VARIABLES TO MAINTAIN THE PARSER'S STATE DURING PROCESSING
private Client currentClient;
// XML EVENT PROCESSING METHODS (DEFINED BY DefaultHandler)
// startElement is the opening part of the tag "<tagname...>"
//les balises ouvrantes
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
//qname c'est la balise xml /instancier persone à partir du fichier xml
if (qName.equals("person")) {
currentClient = new Client();
//2ème methode pour parser les attributs
currentClient.setId(Integer.parseInt(attributes.getValue("id")));
currentClient.setNom(attributes.getValue("nom"));
currentClient.setPrenom(attributes.getValue("prenom"));
currentClient.setDate(attributes.getValue("date"));
currentClient.setEmail(attributes.getValue("email"));
currentClient.setPassword(attributes.getValue("password"));
currentClient.setTel(Integer.parseInt(attributes.getValue("tel")));
/****/
} else if (qName.equals("id")) {
idTag = "open";
} else if (qName.equals("nom")) {
nomTag = "open";
} else if (qName.equals("prenom")) {
prenTag = "open";
}
else if (qName.equals("date")) {
DateTag = "open";
}
else if (qName.equals("email")) {
EmailTag = "open";
}
else if (qName.equals("password")) {
passwordTag = "open";
}
else if (qName.equals("tel")) {
TelTag = "open";
}
}
//les balises fermantes
public void endElement(String uri, String localName, String qName) throws SAXException {
if (qName.equals("person")) {
// we are no longer processing a <reg.../> tag
clients.addElement(currentClient);
currentClient = null;
} else if (qName.equals("id")) {
idTag = "close";
} else if (qName.equals("nom")) {
nomTag = "close";
} else if (qName.equals("prenom")) {
prenTag = "close";
}
else if (qName.equals("password")) {
passwordTag= "close";
}
else if (qName.equals("date")) {
DateTag= "close";
}
else if (qName.equals("email")) {
EmailTag = "close";
}
else if (qName.equals("tel")) {
TelTag = "close";
}
}
// "characters" are the text between tags
public void characters(char[] ch, int start, int length) throws SAXException {
// we're only interested in this inside a <phone.../> tag
if (currentClient != null) {
// don't forget to trim excess spaces from the ends of the string
if (idTag.equals("open")) {
String id = new String(ch, start, length).trim();
currentClient.setId(Integer.parseInt(id.trim()));
} else
if (nomTag.equals("open")) {
String nom = new String(ch, start, length).trim();
currentClient.setNom(nom);
} else
if (prenTag.equals("open")) {
String pren = new String(ch, start, length).trim();
currentClient.setPrenom(pren);
}
}else
if (EmailTag.equals("open")) {
String pren = new String(ch, start, length).trim();
String email = null;
currentClient.setEmail(email);
}else
if (passwordTag.equals("open")) {
String password = new String(ch, start, length).trim();;
currentClient.setPassword(password);
}else
if (DateTag.equals("open")) {
String date = new String(ch, start, length).trim();;
currentClient.setDate(date);
}else
if (TelTag.equals("open")) {
int tel = 0;
currentClient.setTel(tel);
}
}
}
| UTF-8 | Java | 5,027 | java | ClientHandler.java | Java | []
| null | []
| package sprintMobile;
import java.util.Vector;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
public class ClientHandler extends DefaultHandler{
private Vector clients;
String idTag="close";
String nomTag = "close";
String prenTag = "close";
String passwordTag="close";
String EmailTag="close";
String TelTag="close";
String DateTag="close";
public ClientHandler() {
clients = new Vector();
}
public Personne[] getPersonne() {
Personne[] personness = new Personne[clients.size()];
clients.copyInto(personness);
return personness;
}
// VARIABLES TO MAINTAIN THE PARSER'S STATE DURING PROCESSING
private Client currentClient;
// XML EVENT PROCESSING METHODS (DEFINED BY DefaultHandler)
// startElement is the opening part of the tag "<tagname...>"
//les balises ouvrantes
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
//qname c'est la balise xml /instancier persone à partir du fichier xml
if (qName.equals("person")) {
currentClient = new Client();
//2ème methode pour parser les attributs
currentClient.setId(Integer.parseInt(attributes.getValue("id")));
currentClient.setNom(attributes.getValue("nom"));
currentClient.setPrenom(attributes.getValue("prenom"));
currentClient.setDate(attributes.getValue("date"));
currentClient.setEmail(attributes.getValue("email"));
currentClient.setPassword(attributes.getValue("password"));
currentClient.setTel(Integer.parseInt(attributes.getValue("tel")));
/****/
} else if (qName.equals("id")) {
idTag = "open";
} else if (qName.equals("nom")) {
nomTag = "open";
} else if (qName.equals("prenom")) {
prenTag = "open";
}
else if (qName.equals("date")) {
DateTag = "open";
}
else if (qName.equals("email")) {
EmailTag = "open";
}
else if (qName.equals("password")) {
passwordTag = "open";
}
else if (qName.equals("tel")) {
TelTag = "open";
}
}
//les balises fermantes
public void endElement(String uri, String localName, String qName) throws SAXException {
if (qName.equals("person")) {
// we are no longer processing a <reg.../> tag
clients.addElement(currentClient);
currentClient = null;
} else if (qName.equals("id")) {
idTag = "close";
} else if (qName.equals("nom")) {
nomTag = "close";
} else if (qName.equals("prenom")) {
prenTag = "close";
}
else if (qName.equals("password")) {
passwordTag= "close";
}
else if (qName.equals("date")) {
DateTag= "close";
}
else if (qName.equals("email")) {
EmailTag = "close";
}
else if (qName.equals("tel")) {
TelTag = "close";
}
}
// "characters" are the text between tags
public void characters(char[] ch, int start, int length) throws SAXException {
// we're only interested in this inside a <phone.../> tag
if (currentClient != null) {
// don't forget to trim excess spaces from the ends of the string
if (idTag.equals("open")) {
String id = new String(ch, start, length).trim();
currentClient.setId(Integer.parseInt(id.trim()));
} else
if (nomTag.equals("open")) {
String nom = new String(ch, start, length).trim();
currentClient.setNom(nom);
} else
if (prenTag.equals("open")) {
String pren = new String(ch, start, length).trim();
currentClient.setPrenom(pren);
}
}else
if (EmailTag.equals("open")) {
String pren = new String(ch, start, length).trim();
String email = null;
currentClient.setEmail(email);
}else
if (passwordTag.equals("open")) {
String password = new String(ch, start, length).trim();;
currentClient.setPassword(password);
}else
if (DateTag.equals("open")) {
String date = new String(ch, start, length).trim();;
currentClient.setDate(date);
}else
if (TelTag.equals("open")) {
int tel = 0;
currentClient.setTel(tel);
}
}
}
| 5,027 | 0.525373 | 0.524975 | 140 | 33.892857 | 22.962608 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.557143 | false | false | 10 |
67e2390b2598944b253d83bd1216425006df797e | 25,082,609,069,510 | 1fdb0a37ff9b2f858add6dc9d67cf983a5add082 | /src/main/java/ma/treroc/GestionRhTrerocApplication.java | 99603859f2abf715285e3ca513cb7d62a450773b | []
| no_license | mousciss2020/gestion_rh_treroc | https://github.com/mousciss2020/gestion_rh_treroc | cffb62672b6cf819ec4a07e2e554b26ba3d10ed3 | 74e9f0749517e67b15be8604c7489a812c6c0ef0 | refs/heads/master | 2023-03-24T17:39:57.685000 | 2021-03-15T20:47:55 | 2021-03-15T20:47:55 | 346,069,329 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ma.treroc;
import ch.qos.logback.core.net.SyslogOutputStream;
import ma.treroc.gestionEmploye.models.Departement;
import ma.treroc.gestionEmploye.models.Employe;
import ma.treroc.gestionEmploye.repositories.DepartementRepository;
import ma.treroc.gestionEmploye.repositories.EmployeRepository;
import ma.treroc.gestionEmploye.services.EmployeService;
import net.bytebuddy.utility.RandomString;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import java.time.LocalDate;
import java.util.Collection;
import java.util.List;
import java.util.Random;
@SpringBootApplication
public class GestionRhTrerocApplication implements CommandLineRunner {
public static void main(String[] args) {
SpringApplication.run(GestionRhTrerocApplication.class, args);
}
@Autowired
EmployeService service;
@Autowired
DepartementRepository departementRepository;
@Autowired
EmployeRepository employeRepository;
@Override
public void run(String... args) throws Exception {
Employe employe = new Employe();
employe.setNom("employe");
employeRepository.saveAndFlush(employe);
Departement dpart = new Departement();
dpart.setNomDepart("Contrôle qualité");
dpart.setDescription(RandomString.make(20));
dpart.setResp(employe);
departementRepository.saveAndFlush(dpart);
Departement dpart1 = new Departement();
dpart1.setNomDepart("Logistique");
dpart1.setDescription(RandomString.make(20));
dpart1.setResp(employe);
departementRepository.saveAndFlush(dpart1);
Departement dpart2 = new Departement();
dpart2.setNomDepart("RH");
dpart2.setDescription(RandomString.make(20));
dpart2.setResp(employe);
departementRepository.saveAndFlush(dpart2);
Departement dpart3 = new Departement();
dpart3.setNomDepart("Production");
dpart3.setDescription(RandomString.make(20));
dpart3.setResp(employe);
departementRepository.saveAndFlush(dpart3);
//employeRepository.saveAndFlush(employe);
departementRepository.findAll().forEach(departement -> {
Random rd = new Random();
for (int i = 0; i < 10; i++) {
Employe emp = new Employe();
emp.setCin(RandomString.make(5));
emp.setPays("Maroc");
emp.setCNSS(RandomString.make(8));
emp.setContrat("CDI");
emp.setMatricule(RandomString.make(12));
emp.setSituationFamiliale("celibataire");
emp.setNom(RandomString.make(10));
emp.setPrenom(RandomString.make(10));
emp.setGenre("male");
emp.setAdresse(RandomString.make(20));
emp.setEmail("email@gmail.com");
emp.setTelephone("0601020304");
emp.setSalaire(2500+rd.nextInt(15000));
emp.setLieuxNaiss(RandomString.make(10));
emp.setDateNaiss(LocalDate.of(1992,03,05));
int age = emp.calculAge(emp.getDateNaiss(), LocalDate.now());
emp.setAge(age);
emp.setDateEntree(LocalDate.now());
emp.setDepartement(departement);
service.newEmploye(emp);
}
});
/**
for (int i = 0; i < 10; i++) {
Employe emp = new Employe();
emp.setMatricule(RandomString.make(12));
emp.setSituationFamiliale("Marie");
emp.setNom(RandomString.make(10));
emp.setPrenom(RandomString.make(10));
emp.setGenre("M");
emp.setAdresse(RandomString.make(20));
emp.setEmail("email@gmail.com");
emp.setTelephone("0601020304");
emp.setSalaire(2500+rd.nextInt(15000));
emp.setLieuxNaiss(RandomString.make(10));
emp.setDateNaiss(LocalDate.of(1992,03,05));
int age = emp.calculAge(emp.getDateNaiss(), LocalDate.now());
emp.setAge(age);
emp.setDateEntree(LocalDate.now());
//emp.setDepartement(dpart);
service.newEmploye(emp);
}**/
}
}
| UTF-8 | Java | 4,405 | java | GestionRhTrerocApplication.java | Java | [
{
"context": " employe = new Employe();\n employe.setNom(\"employe\");\n employeRepository.saveAndFlush(employe",
"end": 1268,
"score": 0.8513579368591309,
"start": 1261,
"tag": "NAME",
"value": "employe"
},
{
"context": "ndomString.make(5));\n emp.setPays(\"Maroc\");\n emp.setCNSS(RandomString.make(",
"end": 2568,
"score": 0.8442705273628235,
"start": 2563,
"tag": "NAME",
"value": "Maroc"
},
{
"context": "omString.make(20));\n emp.setEmail(\"email@gmail.com\");\n emp.setTelephone(\"0601020304\")",
"end": 3020,
"score": 0.9999058842658997,
"start": 3005,
"tag": "EMAIL",
"value": "email@gmail.com"
},
{
"context": "RandomString.make(20));\n emp.setEmail(\"email@gmail.com\");\n emp.setTelephone(\"0601020304\");\n ",
"end": 3942,
"score": 0.9999240040779114,
"start": 3927,
"tag": "EMAIL",
"value": "email@gmail.com"
}
]
| null | []
| package ma.treroc;
import ch.qos.logback.core.net.SyslogOutputStream;
import ma.treroc.gestionEmploye.models.Departement;
import ma.treroc.gestionEmploye.models.Employe;
import ma.treroc.gestionEmploye.repositories.DepartementRepository;
import ma.treroc.gestionEmploye.repositories.EmployeRepository;
import ma.treroc.gestionEmploye.services.EmployeService;
import net.bytebuddy.utility.RandomString;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import java.time.LocalDate;
import java.util.Collection;
import java.util.List;
import java.util.Random;
@SpringBootApplication
public class GestionRhTrerocApplication implements CommandLineRunner {
public static void main(String[] args) {
SpringApplication.run(GestionRhTrerocApplication.class, args);
}
@Autowired
EmployeService service;
@Autowired
DepartementRepository departementRepository;
@Autowired
EmployeRepository employeRepository;
@Override
public void run(String... args) throws Exception {
Employe employe = new Employe();
employe.setNom("employe");
employeRepository.saveAndFlush(employe);
Departement dpart = new Departement();
dpart.setNomDepart("Contrôle qualité");
dpart.setDescription(RandomString.make(20));
dpart.setResp(employe);
departementRepository.saveAndFlush(dpart);
Departement dpart1 = new Departement();
dpart1.setNomDepart("Logistique");
dpart1.setDescription(RandomString.make(20));
dpart1.setResp(employe);
departementRepository.saveAndFlush(dpart1);
Departement dpart2 = new Departement();
dpart2.setNomDepart("RH");
dpart2.setDescription(RandomString.make(20));
dpart2.setResp(employe);
departementRepository.saveAndFlush(dpart2);
Departement dpart3 = new Departement();
dpart3.setNomDepart("Production");
dpart3.setDescription(RandomString.make(20));
dpart3.setResp(employe);
departementRepository.saveAndFlush(dpart3);
//employeRepository.saveAndFlush(employe);
departementRepository.findAll().forEach(departement -> {
Random rd = new Random();
for (int i = 0; i < 10; i++) {
Employe emp = new Employe();
emp.setCin(RandomString.make(5));
emp.setPays("Maroc");
emp.setCNSS(RandomString.make(8));
emp.setContrat("CDI");
emp.setMatricule(RandomString.make(12));
emp.setSituationFamiliale("celibataire");
emp.setNom(RandomString.make(10));
emp.setPrenom(RandomString.make(10));
emp.setGenre("male");
emp.setAdresse(RandomString.make(20));
emp.setEmail("<EMAIL>");
emp.setTelephone("0601020304");
emp.setSalaire(2500+rd.nextInt(15000));
emp.setLieuxNaiss(RandomString.make(10));
emp.setDateNaiss(LocalDate.of(1992,03,05));
int age = emp.calculAge(emp.getDateNaiss(), LocalDate.now());
emp.setAge(age);
emp.setDateEntree(LocalDate.now());
emp.setDepartement(departement);
service.newEmploye(emp);
}
});
/**
for (int i = 0; i < 10; i++) {
Employe emp = new Employe();
emp.setMatricule(RandomString.make(12));
emp.setSituationFamiliale("Marie");
emp.setNom(RandomString.make(10));
emp.setPrenom(RandomString.make(10));
emp.setGenre("M");
emp.setAdresse(RandomString.make(20));
emp.setEmail("<EMAIL>");
emp.setTelephone("0601020304");
emp.setSalaire(2500+rd.nextInt(15000));
emp.setLieuxNaiss(RandomString.make(10));
emp.setDateNaiss(LocalDate.of(1992,03,05));
int age = emp.calculAge(emp.getDateNaiss(), LocalDate.now());
emp.setAge(age);
emp.setDateEntree(LocalDate.now());
//emp.setDepartement(dpart);
service.newEmploye(emp);
}**/
}
}
| 4,389 | 0.638883 | 0.615035 | 119 | 36 | 21.064528 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.798319 | false | false | 10 |
2d79c4881f17d214ccd7f921026adaa7a67f0fe0 | 4,561,255,329,164 | 92d0561ecb2a1adc87ec493f7915e16df9f61bf5 | /app/src/main/java/com/makina/collect/activities/ActivityEditForm.java | 48839468346b6f836366568b17591ba8e6693d31 | []
| no_license | makinacorpus/MakinaCollect | https://github.com/makinacorpus/MakinaCollect | f2ac0688639a527bb7eab7f7da235713c901bca7 | 822da3f632a1926e6f91e3590ce6c6768c9d753c | refs/heads/master | 2023-06-05T05:36:30.772000 | 2015-06-15T15:36:30 | 2015-06-15T15:36:30 | 14,424,370 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright (C) 2009 University of Washington
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package com.makina.collect.activities;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.content.ContentUris;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.provider.BaseColumns;
import android.support.v7.widget.SearchView;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.ListView;
import android.widget.Toast;
import com.makina.collect.R;
import com.makina.collect.activity.AbstractBaseActivity;
import com.makina.collect.adapters.FormsListAdapter;
import com.makina.collect.dialog.DialogAboutUs;
import com.makina.collect.dialog.DialogHelpWithConfirmation;
import com.makina.collect.listeners.DeleteInstancesListener;
import com.makina.collect.listeners.DiskSyncListener;
import com.makina.collect.model.Form;
import com.makina.collect.preferences.ActivityPreferences;
import com.makina.collect.provider.FormsProvider;
import com.makina.collect.provider.FormsProviderAPI.FormsColumns;
import com.makina.collect.provider.InstanceProvider;
import com.makina.collect.tasks.DiskSyncTask;
import com.makina.collect.utilities.Finish;
import com.makina.collect.views.CroutonView;
import com.makina.collect.views.CustomFontTextview;
import java.util.ArrayList;
import java.util.List;
import de.keyboardsurfer.android.widget.crouton.Style;
/**
* Responsible for displaying all the valid forms in the forms directory. Stores the path to
* selected form for use by ActivityMainMenu.
*
* @author Yaw Anokwa (yanokwa@gmail.com)
* @author Carl Hartung (carlhartung@gmail.com)
*/
@Deprecated
@SuppressLint("NewApi")
public class ActivityEditForm extends AbstractBaseActivity
implements DiskSyncListener, SearchView.OnQueryTextListener, DeleteInstancesListener {
private static final String t = "FormChooserList";
private static final String syncMsgKey = "syncmsgkey";
private DiskSyncTask mDiskSyncTask;
private AlertDialog mAlertDialog;
protected ListView mList;
private String statusText;
private ArrayList<Long> mSelected;
private FormsListAdapter instances;
private final int RESULT_PREFERENCES=1;
private SearchView mSearchView;
private List<Form> forms;
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit_form);
Finish.activityEditForm=this;
getSupportActionBar().setDisplayShowCustomEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(false);
LayoutInflater inflator = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = inflator.inflate(R.layout.actionbar_title_layout_edit_form, null);
getSupportActionBar().setCustomView(v);
mList = (ListView) findViewById(android.R.id.list);
if (!getSharedPreferences("session", MODE_PRIVATE).getBoolean("help_edit", false))
DialogHelpWithConfirmation.helpDialog(this, getString(R.string.help_title2), getString(R.string.help_edit));
loadListView();
if (savedInstanceState != null && savedInstanceState.containsKey(syncMsgKey)) {
statusText = savedInstanceState.getString(syncMsgKey);
}
// DiskSyncTask checks the disk for any forms not already in the content provider
// that is, put here by dragging and dropping onto the SDCard
//mDiskSyncTask = (DiskSyncTask) getActivity().getLastNonConfigurationInstance();
if (mDiskSyncTask == null) {
Log.i(t, "Starting new disk sync task");
mDiskSyncTask = new DiskSyncTask();
mDiskSyncTask.setDiskSyncListener(this);
mDiskSyncTask.execute((Void[]) null);
}
CustomFontTextview textview_download_form=(CustomFontTextview) findViewById(R.id.textview_download_form);
textview_download_form.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
startActivity(new Intent(getApplicationContext(),
ActivityDownloadForm.class));
}
});
mList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent,
View view,
int position,
long id) {
ActivityForm.current_page = 1;
// get uri to form
long idFormsTable = forms.get(position)
.getId();
Uri formUri = ContentUris.withAppendedId(FormsColumns.CONTENT_URI,
idFormsTable);
String action = getIntent().getAction();
if (Intent.ACTION_PICK.equals(action)) {
// caller is waiting on a picked form
setResult(RESULT_OK,
new Intent().setData(formUri));
}
else {
// caller wants to view/edit a form, so launch formentryactivity
Intent i = new Intent(Intent.ACTION_EDIT,
formUri);
i.putExtra("newForm",
true);
startActivity(i);
}
//TODO
//getActivity().finish();
}
});
mList.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> arg0,
View arg1,
int position,
long arg3) {
// TODO Auto-generated method stub
createDialogDelete(position);
return false;
}
});
}
private void createDialogDelete(final int position)
{
final Form formDeleted=forms.get(position);
forms.remove(position);
instances.notifyDataSetChanged();
AlertDialog.Builder adb = new AlertDialog.Builder(ActivityEditForm.this);
adb.setTitle(getString(R.string.delete));
adb.setMessage(getString(R.string.delete_confirmation, formDeleted.getName()));
adb.setIconAttribute(R.attr.dialog_icon_delete);
adb.setNegativeButton(getString(android.R.string.cancel),new AlertDialog.OnClickListener()
{
public void onClick(DialogInterface dialog,int which)
{
forms.add(position, formDeleted);
instances.notifyDataSetChanged();
}
});
adb.setPositiveButton(getString(android.R.string.yes), new AlertDialog.OnClickListener()
{
public void onClick(DialogInterface dialog,int which)
{
int countInstances=InstanceProvider.getCountInstancesByFormId(formDeleted.getForm_id());
if (countInstances>1)
CroutonView.showBuiltInCrouton(ActivityEditForm.this, countInstances+" "+getString(R.string.instances_exist), Style.ALERT);
else if (countInstances==1)
CroutonView.showBuiltInCrouton(ActivityEditForm.this, getString(R.string.instance_exist), Style.ALERT);
else
{
FormsProvider.deleteFileOrDir(formDeleted.getFile_path());
FormsProvider.deleteFileOrDir(formDeleted.getDirectory_path());
FormsProvider.deleteForm(formDeleted.getForm_id());
}
if (countInstances>0)
{
forms.add(position, formDeleted);
instances.notifyDataSetChanged();
}
}
});
adb.show();
}
private void loadListView()
{
String sortOrder = FormsColumns.DISPLAY_NAME + " ASC, " + FormsColumns.JR_VERSION + " DESC";
Cursor c = managedQuery(FormsColumns.CONTENT_URI, null, null, null, sortOrder);
if(c.getCount()> 0)
{
forms=new ArrayList<Form>();
while (c.moveToNext())
forms.add(new Form(c.getInt(c.getColumnIndex(BaseColumns._ID)),c.getString(c.getColumnIndex(FormsColumns.JR_FORM_ID)),c.getString(c.getColumnIndex(FormsColumns.DISPLAY_NAME)), c.getString(c.getColumnIndex(FormsColumns.DISPLAY_SUBTEXT)),c.getString(c.getColumnIndex(FormsColumns.FORM_FILE_PATH)),c.getString(c.getColumnIndex(FormsColumns.FORM_MEDIA_PATH))));
instances=new FormsListAdapter(this, forms);
mList.setAdapter(instances);
}
}
public int convertDpToPixel(float dp) {
DisplayMetrics metrics = getResources().getDisplayMetrics();
float px = dp * (metrics.densityDpi / 160f);
return (int) px;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
final MenuInflater menuInflater = getMenuInflater();
menuInflater.inflate(R.menu.search,
menu);
menuInflater.inflate(R.menu.settings,
menu);
final MenuItem searchItem = menu.findItem(R.id.menu_search);
mSearchView = (SearchView) searchItem.getActionView();
mSearchView.setOnQueryTextListener(this);
return true;
}
@Override
public boolean onQueryTextChange(String newText)
{
String sortOrder = FormsColumns.DISPLAY_NAME + " ASC, " + FormsColumns.JR_VERSION + " DESC";
String condition=FormsColumns.DISPLAY_NAME+" LIKE '%"+newText+"%'";
Cursor c = managedQuery(FormsColumns.CONTENT_URI, null, condition, null, sortOrder);
if(c.getCount()> 0)
{
forms=new ArrayList<Form>();
while (c.moveToNext())
forms.add(new Form(c.getInt(c.getColumnIndex(BaseColumns._ID)),c.getString(c.getColumnIndex(FormsColumns.JR_FORM_ID)),c.getString(c.getColumnIndex(FormsColumns.DISPLAY_NAME)), c.getString(c.getColumnIndex(FormsColumns.DISPLAY_SUBTEXT)),c.getString(c.getColumnIndex(FormsColumns.FORM_FILE_PATH)),c.getString(c.getColumnIndex(FormsColumns.FORM_MEDIA_PATH))));
instances=new FormsListAdapter(this, forms);
mList.setAdapter(instances);
}
return false;
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
// The action bar home/up action should open or close the drawer.
// ActionBarDrawerToggle will take care of this.
// Handle action buttons for all fragments
switch(item.getItemId())
{
case android.R.id.home:
Finish.finishHome();
return true;
case R.id.menu_settings:
startActivityForResult((new Intent(getApplicationContext(), ActivityPreferences.class)),RESULT_PREFERENCES);
return true;
case R.id.menu_help:
Intent mIntent=new Intent(this, ActivityHelp.class);
Bundle mBundle=new Bundle();
mBundle.putInt("position", 1);
mIntent.putExtras(mBundle);
startActivity(mIntent);
return true;
case R.id.menu_about_us:
DialogAboutUs.aboutUs(this);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString(syncMsgKey, statusText);
}
/**
* Stores the path of selected form and finishes.
*/
/*@Override
public void onListItemClick(ListView listView, View view, int position, long id) {
// get uri to form
long idFormsTable = ((SimpleCursorAdapter) getListAdapter()).getItemId(position);
Uri formUri = ContentUris.withAppendedId(FormsColumns.CONTENT_URI, idFormsTable);
Collect.getInstance().getActivityLogger().logAction(this, "onListItemClick", formUri.toString());
String action = getIntent().getAction();
if (Intent.ACTION_PICK.equals(action)) {
// caller is waiting on a picked form
setResult(RESULT_OK, new Intent().setData(formUri));
} else {
// caller wants to view/edit a form, so launch formentryactivity
Intent i = new Intent(Intent.ACTION_EDIT, formUri);
i.putExtra("newForm", true);
startActivity(i);
}
//TODO
//getActivity().finish();
}*/
//TODO Back to previous task
/*public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// This is called when the Home (Up) button is pressed
// in the Action Bar.
Intent parentActivityIntent = new Intent(this, MainMenuActivity.class);
parentActivityIntent.addFlags(
Intent.FLAG_ACTIVITY_CLEAR_TOP |
Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(parentActivityIntent);
finish();
return true;
}
return super.onOptionsItemSelected(item);
}*/
@Override
public void onResume() {
mDiskSyncTask.setDiskSyncListener(this);
super.onResume();
if (mDiskSyncTask.getStatus() == AsyncTask.Status.FINISHED) {
syncComplete(mDiskSyncTask.getStatusMessage());
}
}
@Override
public void onPause() {
mDiskSyncTask.setDiskSyncListener(null);
super.onPause();
}
/**
* Called by DiskSyncTask when the task is finished
*/
@Override
public void syncComplete(String result) {
Log.i(t, "disk sync task complete");
statusText = result;
}
/**
* Creates a dialog with the given message. Will exit the activity when the user preses "ok" if
* shouldExit is set to true.
*
* @param errorMsg
* @param shouldExit
*/
private void createErrorDialog(String errorMsg, final boolean shouldExit) {
mAlertDialog = new AlertDialog.Builder(this).create();
mAlertDialog.setIconAttribute(R.attr.dialog_icon_info);
mAlertDialog.setMessage(errorMsg);
DialogInterface.OnClickListener errorListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int i) {
switch (i) {
case DialogInterface.BUTTON1:
if (shouldExit) {
finish();
}
break;
}
}
};
mAlertDialog.setCancelable(false);
mAlertDialog.setButton(getString(R.string.ok), errorListener);
mAlertDialog.show();
}
@Override
public boolean onQueryTextSubmit(String query) {
InputMethodManager imm = (InputMethodManager)getSystemService( Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mSearchView.getWindowToken(), 0);
return false;
}
@Override
public void deleteComplete(int deletedInstances) {
// TODO Auto-generated method stub
if (deletedInstances == mSelected.size()) {
// all deletes were successful
Toast.makeText(getApplicationContext(),getString(R.string.file_deleted_ok, deletedInstances),Toast.LENGTH_SHORT).show();
} else {
// had some failures
Toast.makeText(getApplicationContext(),getString(R.string.file_deleted_error, mSelected.size()- deletedInstances, mSelected.size()),Toast.LENGTH_LONG).show();
}
}
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
if (requestCode == RESULT_PREFERENCES)
{
Intent i = getIntent();
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
}
}
/*
@Override
public void onConfigurationChanged(Configuration newConfig) {
// TODO Auto-generated method stub
super.onConfigurationChanged(newConfig);
Theme.changeTheme(this);
LayoutInflater inflator = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v;
if(newConfig.orientation==Configuration.ORIENTATION_LANDSCAPE)
v = inflator.inflate(R.layout.actionbar_title_layout_edit_form_land, null);
else
v = inflator.inflate(R.layout.actionbar_title_layout_edit_form, null);
getSupportActionBar().setCustomView(v);
}
*/
} | UTF-8 | Java | 18,418 | java | ActivityEditForm.java | Java | [
{
"context": "d form for use by ActivityMainMenu.\n * \n * @author Yaw Anokwa (yanokwa@gmail.com)\n * @author Carl Hartung (carl",
"end": 2625,
"score": 0.9998688697814941,
"start": 2615,
"tag": "NAME",
"value": "Yaw Anokwa"
},
{
"context": "e by ActivityMainMenu.\n * \n * @author Yaw Anokwa (yanokwa@gmail.com)\n * @author Carl Hartung (carlhartung@gmail.com)\n",
"end": 2644,
"score": 0.9999327659606934,
"start": 2627,
"tag": "EMAIL",
"value": "yanokwa@gmail.com"
},
{
"context": " @author Yaw Anokwa (yanokwa@gmail.com)\n * @author Carl Hartung (carlhartung@gmail.com)\n */\n@Deprecated\n@Suppress",
"end": 2669,
"score": 0.9998669624328613,
"start": 2657,
"tag": "NAME",
"value": "Carl Hartung"
},
{
"context": "okwa (yanokwa@gmail.com)\n * @author Carl Hartung (carlhartung@gmail.com)\n */\n@Deprecated\n@SuppressLint(\"NewApi\")\npublic c",
"end": 2692,
"score": 0.9999335408210754,
"start": 2671,
"tag": "EMAIL",
"value": "carlhartung@gmail.com"
}
]
| null | []
| /*
* Copyright (C) 2009 University of Washington
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package com.makina.collect.activities;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.content.ContentUris;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.provider.BaseColumns;
import android.support.v7.widget.SearchView;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.ListView;
import android.widget.Toast;
import com.makina.collect.R;
import com.makina.collect.activity.AbstractBaseActivity;
import com.makina.collect.adapters.FormsListAdapter;
import com.makina.collect.dialog.DialogAboutUs;
import com.makina.collect.dialog.DialogHelpWithConfirmation;
import com.makina.collect.listeners.DeleteInstancesListener;
import com.makina.collect.listeners.DiskSyncListener;
import com.makina.collect.model.Form;
import com.makina.collect.preferences.ActivityPreferences;
import com.makina.collect.provider.FormsProvider;
import com.makina.collect.provider.FormsProviderAPI.FormsColumns;
import com.makina.collect.provider.InstanceProvider;
import com.makina.collect.tasks.DiskSyncTask;
import com.makina.collect.utilities.Finish;
import com.makina.collect.views.CroutonView;
import com.makina.collect.views.CustomFontTextview;
import java.util.ArrayList;
import java.util.List;
import de.keyboardsurfer.android.widget.crouton.Style;
/**
* Responsible for displaying all the valid forms in the forms directory. Stores the path to
* selected form for use by ActivityMainMenu.
*
* @author <NAME> (<EMAIL>)
* @author <NAME> (<EMAIL>)
*/
@Deprecated
@SuppressLint("NewApi")
public class ActivityEditForm extends AbstractBaseActivity
implements DiskSyncListener, SearchView.OnQueryTextListener, DeleteInstancesListener {
private static final String t = "FormChooserList";
private static final String syncMsgKey = "syncmsgkey";
private DiskSyncTask mDiskSyncTask;
private AlertDialog mAlertDialog;
protected ListView mList;
private String statusText;
private ArrayList<Long> mSelected;
private FormsListAdapter instances;
private final int RESULT_PREFERENCES=1;
private SearchView mSearchView;
private List<Form> forms;
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit_form);
Finish.activityEditForm=this;
getSupportActionBar().setDisplayShowCustomEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(false);
LayoutInflater inflator = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = inflator.inflate(R.layout.actionbar_title_layout_edit_form, null);
getSupportActionBar().setCustomView(v);
mList = (ListView) findViewById(android.R.id.list);
if (!getSharedPreferences("session", MODE_PRIVATE).getBoolean("help_edit", false))
DialogHelpWithConfirmation.helpDialog(this, getString(R.string.help_title2), getString(R.string.help_edit));
loadListView();
if (savedInstanceState != null && savedInstanceState.containsKey(syncMsgKey)) {
statusText = savedInstanceState.getString(syncMsgKey);
}
// DiskSyncTask checks the disk for any forms not already in the content provider
// that is, put here by dragging and dropping onto the SDCard
//mDiskSyncTask = (DiskSyncTask) getActivity().getLastNonConfigurationInstance();
if (mDiskSyncTask == null) {
Log.i(t, "Starting new disk sync task");
mDiskSyncTask = new DiskSyncTask();
mDiskSyncTask.setDiskSyncListener(this);
mDiskSyncTask.execute((Void[]) null);
}
CustomFontTextview textview_download_form=(CustomFontTextview) findViewById(R.id.textview_download_form);
textview_download_form.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
startActivity(new Intent(getApplicationContext(),
ActivityDownloadForm.class));
}
});
mList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent,
View view,
int position,
long id) {
ActivityForm.current_page = 1;
// get uri to form
long idFormsTable = forms.get(position)
.getId();
Uri formUri = ContentUris.withAppendedId(FormsColumns.CONTENT_URI,
idFormsTable);
String action = getIntent().getAction();
if (Intent.ACTION_PICK.equals(action)) {
// caller is waiting on a picked form
setResult(RESULT_OK,
new Intent().setData(formUri));
}
else {
// caller wants to view/edit a form, so launch formentryactivity
Intent i = new Intent(Intent.ACTION_EDIT,
formUri);
i.putExtra("newForm",
true);
startActivity(i);
}
//TODO
//getActivity().finish();
}
});
mList.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> arg0,
View arg1,
int position,
long arg3) {
// TODO Auto-generated method stub
createDialogDelete(position);
return false;
}
});
}
private void createDialogDelete(final int position)
{
final Form formDeleted=forms.get(position);
forms.remove(position);
instances.notifyDataSetChanged();
AlertDialog.Builder adb = new AlertDialog.Builder(ActivityEditForm.this);
adb.setTitle(getString(R.string.delete));
adb.setMessage(getString(R.string.delete_confirmation, formDeleted.getName()));
adb.setIconAttribute(R.attr.dialog_icon_delete);
adb.setNegativeButton(getString(android.R.string.cancel),new AlertDialog.OnClickListener()
{
public void onClick(DialogInterface dialog,int which)
{
forms.add(position, formDeleted);
instances.notifyDataSetChanged();
}
});
adb.setPositiveButton(getString(android.R.string.yes), new AlertDialog.OnClickListener()
{
public void onClick(DialogInterface dialog,int which)
{
int countInstances=InstanceProvider.getCountInstancesByFormId(formDeleted.getForm_id());
if (countInstances>1)
CroutonView.showBuiltInCrouton(ActivityEditForm.this, countInstances+" "+getString(R.string.instances_exist), Style.ALERT);
else if (countInstances==1)
CroutonView.showBuiltInCrouton(ActivityEditForm.this, getString(R.string.instance_exist), Style.ALERT);
else
{
FormsProvider.deleteFileOrDir(formDeleted.getFile_path());
FormsProvider.deleteFileOrDir(formDeleted.getDirectory_path());
FormsProvider.deleteForm(formDeleted.getForm_id());
}
if (countInstances>0)
{
forms.add(position, formDeleted);
instances.notifyDataSetChanged();
}
}
});
adb.show();
}
private void loadListView()
{
String sortOrder = FormsColumns.DISPLAY_NAME + " ASC, " + FormsColumns.JR_VERSION + " DESC";
Cursor c = managedQuery(FormsColumns.CONTENT_URI, null, null, null, sortOrder);
if(c.getCount()> 0)
{
forms=new ArrayList<Form>();
while (c.moveToNext())
forms.add(new Form(c.getInt(c.getColumnIndex(BaseColumns._ID)),c.getString(c.getColumnIndex(FormsColumns.JR_FORM_ID)),c.getString(c.getColumnIndex(FormsColumns.DISPLAY_NAME)), c.getString(c.getColumnIndex(FormsColumns.DISPLAY_SUBTEXT)),c.getString(c.getColumnIndex(FormsColumns.FORM_FILE_PATH)),c.getString(c.getColumnIndex(FormsColumns.FORM_MEDIA_PATH))));
instances=new FormsListAdapter(this, forms);
mList.setAdapter(instances);
}
}
public int convertDpToPixel(float dp) {
DisplayMetrics metrics = getResources().getDisplayMetrics();
float px = dp * (metrics.densityDpi / 160f);
return (int) px;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
final MenuInflater menuInflater = getMenuInflater();
menuInflater.inflate(R.menu.search,
menu);
menuInflater.inflate(R.menu.settings,
menu);
final MenuItem searchItem = menu.findItem(R.id.menu_search);
mSearchView = (SearchView) searchItem.getActionView();
mSearchView.setOnQueryTextListener(this);
return true;
}
@Override
public boolean onQueryTextChange(String newText)
{
String sortOrder = FormsColumns.DISPLAY_NAME + " ASC, " + FormsColumns.JR_VERSION + " DESC";
String condition=FormsColumns.DISPLAY_NAME+" LIKE '%"+newText+"%'";
Cursor c = managedQuery(FormsColumns.CONTENT_URI, null, condition, null, sortOrder);
if(c.getCount()> 0)
{
forms=new ArrayList<Form>();
while (c.moveToNext())
forms.add(new Form(c.getInt(c.getColumnIndex(BaseColumns._ID)),c.getString(c.getColumnIndex(FormsColumns.JR_FORM_ID)),c.getString(c.getColumnIndex(FormsColumns.DISPLAY_NAME)), c.getString(c.getColumnIndex(FormsColumns.DISPLAY_SUBTEXT)),c.getString(c.getColumnIndex(FormsColumns.FORM_FILE_PATH)),c.getString(c.getColumnIndex(FormsColumns.FORM_MEDIA_PATH))));
instances=new FormsListAdapter(this, forms);
mList.setAdapter(instances);
}
return false;
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
// The action bar home/up action should open or close the drawer.
// ActionBarDrawerToggle will take care of this.
// Handle action buttons for all fragments
switch(item.getItemId())
{
case android.R.id.home:
Finish.finishHome();
return true;
case R.id.menu_settings:
startActivityForResult((new Intent(getApplicationContext(), ActivityPreferences.class)),RESULT_PREFERENCES);
return true;
case R.id.menu_help:
Intent mIntent=new Intent(this, ActivityHelp.class);
Bundle mBundle=new Bundle();
mBundle.putInt("position", 1);
mIntent.putExtras(mBundle);
startActivity(mIntent);
return true;
case R.id.menu_about_us:
DialogAboutUs.aboutUs(this);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString(syncMsgKey, statusText);
}
/**
* Stores the path of selected form and finishes.
*/
/*@Override
public void onListItemClick(ListView listView, View view, int position, long id) {
// get uri to form
long idFormsTable = ((SimpleCursorAdapter) getListAdapter()).getItemId(position);
Uri formUri = ContentUris.withAppendedId(FormsColumns.CONTENT_URI, idFormsTable);
Collect.getInstance().getActivityLogger().logAction(this, "onListItemClick", formUri.toString());
String action = getIntent().getAction();
if (Intent.ACTION_PICK.equals(action)) {
// caller is waiting on a picked form
setResult(RESULT_OK, new Intent().setData(formUri));
} else {
// caller wants to view/edit a form, so launch formentryactivity
Intent i = new Intent(Intent.ACTION_EDIT, formUri);
i.putExtra("newForm", true);
startActivity(i);
}
//TODO
//getActivity().finish();
}*/
//TODO Back to previous task
/*public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// This is called when the Home (Up) button is pressed
// in the Action Bar.
Intent parentActivityIntent = new Intent(this, MainMenuActivity.class);
parentActivityIntent.addFlags(
Intent.FLAG_ACTIVITY_CLEAR_TOP |
Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(parentActivityIntent);
finish();
return true;
}
return super.onOptionsItemSelected(item);
}*/
@Override
public void onResume() {
mDiskSyncTask.setDiskSyncListener(this);
super.onResume();
if (mDiskSyncTask.getStatus() == AsyncTask.Status.FINISHED) {
syncComplete(mDiskSyncTask.getStatusMessage());
}
}
@Override
public void onPause() {
mDiskSyncTask.setDiskSyncListener(null);
super.onPause();
}
/**
* Called by DiskSyncTask when the task is finished
*/
@Override
public void syncComplete(String result) {
Log.i(t, "disk sync task complete");
statusText = result;
}
/**
* Creates a dialog with the given message. Will exit the activity when the user preses "ok" if
* shouldExit is set to true.
*
* @param errorMsg
* @param shouldExit
*/
private void createErrorDialog(String errorMsg, final boolean shouldExit) {
mAlertDialog = new AlertDialog.Builder(this).create();
mAlertDialog.setIconAttribute(R.attr.dialog_icon_info);
mAlertDialog.setMessage(errorMsg);
DialogInterface.OnClickListener errorListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int i) {
switch (i) {
case DialogInterface.BUTTON1:
if (shouldExit) {
finish();
}
break;
}
}
};
mAlertDialog.setCancelable(false);
mAlertDialog.setButton(getString(R.string.ok), errorListener);
mAlertDialog.show();
}
@Override
public boolean onQueryTextSubmit(String query) {
InputMethodManager imm = (InputMethodManager)getSystemService( Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mSearchView.getWindowToken(), 0);
return false;
}
@Override
public void deleteComplete(int deletedInstances) {
// TODO Auto-generated method stub
if (deletedInstances == mSelected.size()) {
// all deletes were successful
Toast.makeText(getApplicationContext(),getString(R.string.file_deleted_ok, deletedInstances),Toast.LENGTH_SHORT).show();
} else {
// had some failures
Toast.makeText(getApplicationContext(),getString(R.string.file_deleted_error, mSelected.size()- deletedInstances, mSelected.size()),Toast.LENGTH_LONG).show();
}
}
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
if (requestCode == RESULT_PREFERENCES)
{
Intent i = getIntent();
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
}
}
/*
@Override
public void onConfigurationChanged(Configuration newConfig) {
// TODO Auto-generated method stub
super.onConfigurationChanged(newConfig);
Theme.changeTheme(this);
LayoutInflater inflator = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v;
if(newConfig.orientation==Configuration.ORIENTATION_LANDSCAPE)
v = inflator.inflate(R.layout.actionbar_title_layout_edit_form_land, null);
else
v = inflator.inflate(R.layout.actionbar_title_layout_edit_form, null);
getSupportActionBar().setCustomView(v);
}
*/
} | 18,384 | 0.624281 | 0.622815 | 464 | 38.696121 | 36.250271 | 362 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.831897 | false | false | 10 |
6b2b31d89485f9c50f4007ab193fa246b0ac1d91 | 5,325,759,463,175 | 76eedf4c796beff38cce29811fbaaf4bb39b36b1 | /src/br/fatec/pi/evento/AulasDAO.java | 4e6cefdd6bee500a097cd41dfed4560a3b997c5c | []
| no_license | luclissi/box.show | https://github.com/luclissi/box.show | a5bd1d58d850e8479e165f9de349d5da37fd2943 | 50afb926db0c8ac163183a64f89a1717a30429d1 | refs/heads/master | 2021-09-08T06:52:33.051000 | 2018-03-08T03:31:49 | 2018-03-08T03:31:49 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.fatec.pi.evento;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import br.fatec.pi.config.BD;
import br.fatec.pi.entidade.Aulas;
/**
* Classe de Manipulação de tabela aulas
* @author luccame
*
*/
public class AulasDAO extends Aulas{
private BD bd = new BD();
private String sql;
/**
* Método que executa a query, e retorna um Array de Aulas
*
* @param query String para que se deseja executar.
* @return ArrayList do tipo Aulas.
*/
public ArrayList<Aulas> executar( String query ) {
ArrayList<Aulas> array = new ArrayList<>();
try {
bd.st = bd.con.createStatement();
bd.rs = bd.st.executeQuery(query);
while(bd.rs.next()) {
Aulas a = new Aulas();
a.setCodAula(bd.rs.getInt("cod_aula"));
a.setNomeAula(bd.rs.getString("nome_aula"));
a.setDescricao(bd.rs.getString("descricao"));
a.setTipo(bd.rs.getString("tipo"));
array.add(a);
}
} catch ( SQLException e ) {
e.printStackTrace();
}
return array;
}
/**
* Método que executa a query, e retorna um Array de Aulas
*
* @return ArrayList do tipo Aulas.
*/
public ArrayList<Aulas> selecionar() {
ArrayList<Aulas> array = new ArrayList<>();
try {
sql = "SELECT * FROM Aulas";
if(!bd.getConnection())
return array;
bd.st = bd.con.createStatement();
bd.rs = bd.st.executeQuery(sql);
while(bd.rs.next()) {
Aulas a = new Aulas();
a.setCodAula(bd.rs.getInt("cod_aula"));
a.setNomeAula(bd.rs.getString("nome_aula"));
a.setDescricao(bd.rs.getString("descricao"));
a.setTipo(bd.rs.getString("tipo"));
array.add(a);
}
} catch ( SQLException e ) {
e.printStackTrace();
} finally {
bd.close();
}
return array;
}
/**
* Executa uma query insert.
*
* @return 0 para um insert mal sucedido e 1 para bem sucedido
*/
public int inserir() {
try {
sql = "INSERT INTO Aulas (nome_aula,descricao,tipo) VALUES(?,?,?)";
if(!bd.getConnection())
return 0;
PreparedStatement pre = bd.con.prepareStatement(sql);
pre.setString(1, getNomeAula());
pre.setString(2, getDescricao());
pre.setString(3, getTipo());
return pre.executeUpdate();
} catch ( SQLException e ) {
e.printStackTrace();
} finally {
bd.close();
}
return 0;
}
/**
* Executa uma query alterar.
*
* @return 0 para um alterar mal sucedido e 1 para bem sucedido
*/
public int alterar() {
try {
sql = "UPDATE Aulas SET nome_aula = ? ,descricao = ?, tipo = ?"
+ " WHERE cod_aula = ?;";
if(!bd.getConnection())
return 0;
PreparedStatement pre = bd.con.prepareStatement(sql);
pre.setString(1, getNomeAula());
pre.setString(2, getDescricao());
pre.setString(3, getTipo());
pre.setInt(4, getCodAula());
return pre.executeUpdate();
} catch ( SQLException e ) {
e.printStackTrace();
} finally {
bd.close();
}
return 0;
}
/**
* Executa uma query remover.
*
* @return 0 para um remover mal sucedido e 1 para bem sucedido
*/
public int remover() {
try {
sql = "DELETE FROM Aulas "
+ " WHERE cod_aula = ?;";
if(!bd.getConnection())
return 0;
PreparedStatement pre = bd.con.prepareStatement(sql);
pre.setInt(1, getCodAula());
return pre.executeUpdate();
} catch ( SQLException e ) {
e.printStackTrace();
} finally {
bd.close();
}
return 0;
}
}
| UTF-8 | Java | 4,081 | java | AulasDAO.java | Java | [
{
"context": "* Classe de Manipulação de tabela aulas\n * @author luccame\n *\n */\npublic class AulasDAO extends Aulas{\n\n\tpri",
"end": 253,
"score": 0.9988722801208496,
"start": 246,
"tag": "USERNAME",
"value": "luccame"
}
]
| null | []
| package br.fatec.pi.evento;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import br.fatec.pi.config.BD;
import br.fatec.pi.entidade.Aulas;
/**
* Classe de Manipulação de tabela aulas
* @author luccame
*
*/
public class AulasDAO extends Aulas{
private BD bd = new BD();
private String sql;
/**
* Método que executa a query, e retorna um Array de Aulas
*
* @param query String para que se deseja executar.
* @return ArrayList do tipo Aulas.
*/
public ArrayList<Aulas> executar( String query ) {
ArrayList<Aulas> array = new ArrayList<>();
try {
bd.st = bd.con.createStatement();
bd.rs = bd.st.executeQuery(query);
while(bd.rs.next()) {
Aulas a = new Aulas();
a.setCodAula(bd.rs.getInt("cod_aula"));
a.setNomeAula(bd.rs.getString("nome_aula"));
a.setDescricao(bd.rs.getString("descricao"));
a.setTipo(bd.rs.getString("tipo"));
array.add(a);
}
} catch ( SQLException e ) {
e.printStackTrace();
}
return array;
}
/**
* Método que executa a query, e retorna um Array de Aulas
*
* @return ArrayList do tipo Aulas.
*/
public ArrayList<Aulas> selecionar() {
ArrayList<Aulas> array = new ArrayList<>();
try {
sql = "SELECT * FROM Aulas";
if(!bd.getConnection())
return array;
bd.st = bd.con.createStatement();
bd.rs = bd.st.executeQuery(sql);
while(bd.rs.next()) {
Aulas a = new Aulas();
a.setCodAula(bd.rs.getInt("cod_aula"));
a.setNomeAula(bd.rs.getString("nome_aula"));
a.setDescricao(bd.rs.getString("descricao"));
a.setTipo(bd.rs.getString("tipo"));
array.add(a);
}
} catch ( SQLException e ) {
e.printStackTrace();
} finally {
bd.close();
}
return array;
}
/**
* Executa uma query insert.
*
* @return 0 para um insert mal sucedido e 1 para bem sucedido
*/
public int inserir() {
try {
sql = "INSERT INTO Aulas (nome_aula,descricao,tipo) VALUES(?,?,?)";
if(!bd.getConnection())
return 0;
PreparedStatement pre = bd.con.prepareStatement(sql);
pre.setString(1, getNomeAula());
pre.setString(2, getDescricao());
pre.setString(3, getTipo());
return pre.executeUpdate();
} catch ( SQLException e ) {
e.printStackTrace();
} finally {
bd.close();
}
return 0;
}
/**
* Executa uma query alterar.
*
* @return 0 para um alterar mal sucedido e 1 para bem sucedido
*/
public int alterar() {
try {
sql = "UPDATE Aulas SET nome_aula = ? ,descricao = ?, tipo = ?"
+ " WHERE cod_aula = ?;";
if(!bd.getConnection())
return 0;
PreparedStatement pre = bd.con.prepareStatement(sql);
pre.setString(1, getNomeAula());
pre.setString(2, getDescricao());
pre.setString(3, getTipo());
pre.setInt(4, getCodAula());
return pre.executeUpdate();
} catch ( SQLException e ) {
e.printStackTrace();
} finally {
bd.close();
}
return 0;
}
/**
* Executa uma query remover.
*
* @return 0 para um remover mal sucedido e 1 para bem sucedido
*/
public int remover() {
try {
sql = "DELETE FROM Aulas "
+ " WHERE cod_aula = ?;";
if(!bd.getConnection())
return 0;
PreparedStatement pre = bd.con.prepareStatement(sql);
pre.setInt(1, getCodAula());
return pre.executeUpdate();
} catch ( SQLException e ) {
e.printStackTrace();
} finally {
bd.close();
}
return 0;
}
}
| 4,081 | 0.524405 | 0.5195 | 149 | 26.362415 | 19.003784 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.020134 | false | false | 10 |
14dfb1a94117511034bc636cebcba0252f0b1e03 | 13,314,398,617,647 | ce9c0621200094c4542693ce407e5d0b44582b30 | /ConfirmationScreen.java | 24c5d7b1290db45b8fbf9497ffe0f41b32cf1aef | []
| no_license | akvh3/space_trader | https://github.com/akvh3/space_trader | 7b7cd9554b78bf2d5d49759601a3f2664b614f5c | bde4c776f84c32d082f5312d5716ef9c6f75340d | refs/heads/master | 2023-03-31T14:32:15.867000 | 2021-04-20T03:23:09 | 2021-04-20T03:23:09 | 359,671,003 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.IOException;
/**
* Screen that confirms your selections from configuration,
* such as skills, name, and difficulty.
*/
public class ConfirmationScreen
extends JFrame implements ActionListener, WindowListener {
private JFrame confirmFrame;
private JPanel confirmPanel;
private String characterName;
private JButton shipButton;
private String level;
private int credits;
private int totalPoints;
private int fighterSkill;
private int merchantSkill;
private int engineerSkill;
private int pilotSkill;
private JPanel textP;
private Player player;
public ConfirmationScreen(String title, String character,
int skillPoints, int fSkill,
int mSkill, int eSkill, int pSkill) {
confirmFrame = new JFrame(title);
confirmFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
characterName = character;
this.totalPoints = skillPoints;
fighterSkill = fSkill;
merchantSkill = mSkill;
engineerSkill = eSkill;
pilotSkill = pSkill;
if (skillPoints == 16) {
credits = 1000;
level = "Easy";
} else if (skillPoints == 12) {
credits = 500;
level = "Medium";
} else if (skillPoints == 8) {
credits = 100;
level = "Hard";
}
player = new Player(skillPoints,
fighterSkill, merchantSkill,
engineerSkill, pilotSkill, level, characterName);
Game game = new Game(player);
game.startGame();
createGUI();
}
public void createGUI() {
confirmFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);
JPanel pane = makeConfirmPane();
confirmFrame.add(pane);
confirmPanel = new JPanel();
confirmPanel.setLayout(new GridLayout(15, 15, 5, 0));
shipButton = new JButton("Choose a Ship");
confirmFrame.add(makeTextPane("Confirmation Page"));
confirmFrame.add(addLabel("Character Name: " + characterName));
confirmFrame.add(addLabel("Difficulty: " + level));
confirmFrame.add(addLabel("Skills: "));
confirmFrame.add(addLabel(" Fighter: " + fighterSkill));
confirmFrame.add(addLabel(" Merchant: " + merchantSkill));
confirmFrame.add(addLabel(" Engineering: " + engineerSkill));
confirmFrame.add(addLabel(" Pilot: " + pilotSkill));
confirmFrame.add(addLabel("Starting credits: " + credits));
confirmFrame.add(addGoodButton("Select a Ship"));
confirmFrame.pack();
confirmFrame.setVisible(true);
shipButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
confirmFrame.dispose();
try {
JFrame shipScreen = new ShipScreen(player);
} catch (IOException ex) {
ex.printStackTrace();
}
}
});
}
public String getLevel() {
return this.level;
}
public JPanel addLabel(String label) {
JLabel words = new JLabel(label);
confirmPanel.add(words);
return confirmPanel;
}
public JPanel makeConfirmPane() {
JPanel p = new JPanel();
p.setBorder(BorderFactory.createTitledBorder("Confirmation"));
BoxLayout layout = new BoxLayout(p, BoxLayout.X_AXIS);
p.setLayout(layout);
return p;
}
public JPanel makeTextPane(String name) {
textP = new JPanel();
addText(name, textP);
return textP;
}
public JPanel addGoodButton(String label) {
JButton button = new JButton(label);
confirmPanel.add(shipButton);
return confirmPanel;
}
public JPanel makeButtonPane() {
JPanel p = new JPanel();
BoxLayout layout = new BoxLayout(p, BoxLayout.X_AXIS);
p.setLayout(layout);
addButton(shipButton, p);
return p;
}
private void addButton(JButton myButton, Container container) {
JButton button = myButton;
button.setAlignmentX(CENTER_ALIGNMENT);
button.setAlignmentY(BOTTOM_ALIGNMENT);
container.add(button);
}
private void addText(String text, Container container) {
JLabel newText = new JLabel(text);
container.add(newText);
}
public Player getPlayer() {
return player;
}
@Override
public void actionPerformed(ActionEvent e) {
}
@Override
public void windowOpened(WindowEvent e) {
}
@Override
public void windowClosing(WindowEvent e) {
}
@Override
public void windowClosed(WindowEvent e) {
}
@Override
public void windowIconified(WindowEvent e) {
}
@Override
public void windowDeiconified(WindowEvent e) {
}
@Override
public void windowActivated(WindowEvent e) {
}
@Override
public void windowDeactivated(WindowEvent e) {
}
} | UTF-8 | Java | 5,168 | java | ConfirmationScreen.java | Java | []
| null | []
| import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.IOException;
/**
* Screen that confirms your selections from configuration,
* such as skills, name, and difficulty.
*/
public class ConfirmationScreen
extends JFrame implements ActionListener, WindowListener {
private JFrame confirmFrame;
private JPanel confirmPanel;
private String characterName;
private JButton shipButton;
private String level;
private int credits;
private int totalPoints;
private int fighterSkill;
private int merchantSkill;
private int engineerSkill;
private int pilotSkill;
private JPanel textP;
private Player player;
public ConfirmationScreen(String title, String character,
int skillPoints, int fSkill,
int mSkill, int eSkill, int pSkill) {
confirmFrame = new JFrame(title);
confirmFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
characterName = character;
this.totalPoints = skillPoints;
fighterSkill = fSkill;
merchantSkill = mSkill;
engineerSkill = eSkill;
pilotSkill = pSkill;
if (skillPoints == 16) {
credits = 1000;
level = "Easy";
} else if (skillPoints == 12) {
credits = 500;
level = "Medium";
} else if (skillPoints == 8) {
credits = 100;
level = "Hard";
}
player = new Player(skillPoints,
fighterSkill, merchantSkill,
engineerSkill, pilotSkill, level, characterName);
Game game = new Game(player);
game.startGame();
createGUI();
}
public void createGUI() {
confirmFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);
JPanel pane = makeConfirmPane();
confirmFrame.add(pane);
confirmPanel = new JPanel();
confirmPanel.setLayout(new GridLayout(15, 15, 5, 0));
shipButton = new JButton("Choose a Ship");
confirmFrame.add(makeTextPane("Confirmation Page"));
confirmFrame.add(addLabel("Character Name: " + characterName));
confirmFrame.add(addLabel("Difficulty: " + level));
confirmFrame.add(addLabel("Skills: "));
confirmFrame.add(addLabel(" Fighter: " + fighterSkill));
confirmFrame.add(addLabel(" Merchant: " + merchantSkill));
confirmFrame.add(addLabel(" Engineering: " + engineerSkill));
confirmFrame.add(addLabel(" Pilot: " + pilotSkill));
confirmFrame.add(addLabel("Starting credits: " + credits));
confirmFrame.add(addGoodButton("Select a Ship"));
confirmFrame.pack();
confirmFrame.setVisible(true);
shipButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
confirmFrame.dispose();
try {
JFrame shipScreen = new ShipScreen(player);
} catch (IOException ex) {
ex.printStackTrace();
}
}
});
}
public String getLevel() {
return this.level;
}
public JPanel addLabel(String label) {
JLabel words = new JLabel(label);
confirmPanel.add(words);
return confirmPanel;
}
public JPanel makeConfirmPane() {
JPanel p = new JPanel();
p.setBorder(BorderFactory.createTitledBorder("Confirmation"));
BoxLayout layout = new BoxLayout(p, BoxLayout.X_AXIS);
p.setLayout(layout);
return p;
}
public JPanel makeTextPane(String name) {
textP = new JPanel();
addText(name, textP);
return textP;
}
public JPanel addGoodButton(String label) {
JButton button = new JButton(label);
confirmPanel.add(shipButton);
return confirmPanel;
}
public JPanel makeButtonPane() {
JPanel p = new JPanel();
BoxLayout layout = new BoxLayout(p, BoxLayout.X_AXIS);
p.setLayout(layout);
addButton(shipButton, p);
return p;
}
private void addButton(JButton myButton, Container container) {
JButton button = myButton;
button.setAlignmentX(CENTER_ALIGNMENT);
button.setAlignmentY(BOTTOM_ALIGNMENT);
container.add(button);
}
private void addText(String text, Container container) {
JLabel newText = new JLabel(text);
container.add(newText);
}
public Player getPlayer() {
return player;
}
@Override
public void actionPerformed(ActionEvent e) {
}
@Override
public void windowOpened(WindowEvent e) {
}
@Override
public void windowClosing(WindowEvent e) {
}
@Override
public void windowClosed(WindowEvent e) {
}
@Override
public void windowIconified(WindowEvent e) {
}
@Override
public void windowDeiconified(WindowEvent e) {
}
@Override
public void windowActivated(WindowEvent e) {
}
@Override
public void windowDeactivated(WindowEvent e) {
}
} | 5,168 | 0.606231 | 0.602167 | 189 | 26.349207 | 21.348328 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.57672 | false | false | 10 |
6d118dcdefc07af3bacba46c6db9b460caf3f52b | 12,902,081,765,020 | 1ad12ba6a1461610ec0ffdb5683592c29258372e | /org.gyfor.dao.test/src/org/gyfor/dao/test/data/GLTransaction.java | 51d4ca1a44b1c147a2b44a76ac448bd03b784c6a | []
| no_license | kevinau/gyfor | https://github.com/kevinau/gyfor | 88bbb0b0ab918e3c9b163cf1b0c4362ae556f85a | 355ad037c777dd9983a9104266bdbbbe5bad1a28 | refs/heads/master | 2020-07-01T20:10:16.721000 | 2019-04-03T11:38:03 | 2019-04-03T11:38:03 | 74,261,617 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.gyfor.dao.test.data;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Arrays;
import org.gyfor.value.EntityLife;
import org.gyfor.value.VersionTime;
public class GLTransaction {
private int id;
private VersionTime version;
private EntityLife entityLife;
private LocalDate date;
private String narrative;
private GLAllocation[] allocations = new GLAllocation[0];
public void addAllocation (GLAccount account, BigDecimal debit, BigDecimal credit) {
int n = allocations.length;
allocations = Arrays.copyOf(allocations, n + 1);
allocations[n - 1] = new GLAllocation(this, account, debit, credit);
}
public static void main (String[] args) {
Field[] fields = GLAllocation.class.getDeclaredFields();
for (Field field : fields) {
System.out.println(field);
System.out.println(field.getName());
}
}
}
| UTF-8 | Java | 991 | java | GLTransaction.java | Java | []
| null | []
| package org.gyfor.dao.test.data;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Arrays;
import org.gyfor.value.EntityLife;
import org.gyfor.value.VersionTime;
public class GLTransaction {
private int id;
private VersionTime version;
private EntityLife entityLife;
private LocalDate date;
private String narrative;
private GLAllocation[] allocations = new GLAllocation[0];
public void addAllocation (GLAccount account, BigDecimal debit, BigDecimal credit) {
int n = allocations.length;
allocations = Arrays.copyOf(allocations, n + 1);
allocations[n - 1] = new GLAllocation(this, account, debit, credit);
}
public static void main (String[] args) {
Field[] fields = GLAllocation.class.getDeclaredFields();
for (Field field : fields) {
System.out.println(field);
System.out.println(field.getName());
}
}
}
| 991 | 0.680121 | 0.677094 | 41 | 22.170732 | 21.931047 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.609756 | false | false | 10 |
8aaf47ce5488eff662d0bb6df91ef46b798a3bab | 25,125,558,703,141 | 7b456dc1f1c01cab7519c62a54ff032302ca4475 | /app/src/main/java/com/example/sarthak_mehta/e_cakery/MainActivity.java | 288c98685cc0d10229eeb0506468156cfc438a39 | []
| no_license | mehtavinit9896/E-Cakery-App | https://github.com/mehtavinit9896/E-Cakery-App | a727c696e4af73aa2e1a692a2ac2314ee82fb69d | 9e50ea4b7b82cef0c8717e5a9767a5478f081791 | refs/heads/master | 2021-01-18T16:18:41.783000 | 2017-04-05T13:10:52 | 2017-04-05T13:10:52 | 86,734,387 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.sarthak_mehta.e_cakery;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestParams;
import org.json.JSONException;
import org.json.JSONObject;
public class MainActivity extends AppCompatActivity {
SharedPreferences sharedpreferences;
public static final String MyPREFERENCES = "MyPrefs" ;
String email;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
sharedpreferences = getSharedPreferences(MyPREFERENCES, Context.MODE_PRIVATE);
if(sharedpreferences.contains("email")){
navigatetoHomeActivity();
}else
{
setContentView(R.layout.activity_main);
Button button = (Button) findViewById(R.id.btn_login);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
EditText emailET = (EditText) findViewById(R.id.input_email);
email = emailET.getText().toString();
EditText pwdET = (EditText) findViewById(R.id.input_password);
// Get Password Edit View Value
String password = pwdET.getText().toString();
// Instantiate Http Request Param Object
RequestParams params = new RequestParams();
// Put Http parameter username with value of Email Edit View control
params.put("username", email);
// Put Http parameter password with value of Password Edit Value control
params.put("password", password);
// Invoke RESTful Web Service with Http parameters
invokeWS(params);
}
});
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
public void invokeWS(final RequestParams params){
// Make RESTful webservice call using AsyncHttpClient object
AsyncHttpClient client = new AsyncHttpClient();
client.get("http://192.168.0.101:8080/E-Cakery/rest/webservices/usercheck",params ,new AsyncHttpResponseHandler() {
// When the response returned by REST has Http response code '200'
@Override
public void onSuccess(String response) {
try {
// JSON Object
JSONObject obj = new JSONObject(response);
// When the JSON response has status boolean value assigned with true
if(obj.getBoolean("status")){
sharedpreferences = getSharedPreferences(MyPREFERENCES, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString("email", email);
editor.commit();
Toast.makeText(getApplicationContext(), "You are successfully logged in!", Toast.LENGTH_LONG).show();
// Navigate to Home screen
navigatetoHomeActivity();
}
// Else display error message
else{
Toast.makeText(getApplicationContext(), obj.getString("error_msg"), Toast.LENGTH_LONG).show();
}
} catch (JSONException e) {
// TODO Auto-generated catch block
Toast.makeText(getApplicationContext(), "Error Occured [Server's JSON response might be invalid]!", Toast.LENGTH_LONG).show();
e.printStackTrace();
}
}
// When the response returned by REST has Http response code other than '200'
@Override
public void onFailure(int statusCode, Throwable error,
String content) {
// When Http response code is '404'
if(statusCode == 404){
Toast.makeText(getApplicationContext(), "Requested resource not found", Toast.LENGTH_LONG).show();
}
// When Http response code is '500'
else if(statusCode == 500){
Toast.makeText(getApplicationContext(), "Something went wrong at server end", Toast.LENGTH_LONG).show();
}
// When Http response code other than 404, 500
else{
Toast.makeText(getApplicationContext(), "No internet connection", Toast.LENGTH_LONG).show();
}
}
});
}
/**
* Method which navigates from Main Activity to Home Activity
*/
public void navigatetoHomeActivity(){
Intent homeIntent = new Intent(getApplicationContext(),HomeActivity.class);
homeIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(homeIntent);
finish();
}
@Override
public void onBackPressed() {
finish();
}
}
| UTF-8 | Java | 6,353 | java | MainActivity.java | Java | [
{
"context": "package com.example.sarthak_mehta.e_cakery;\n\nimport android.content.Context;\nimport",
"end": 33,
"score": 0.9911249876022339,
"start": 20,
"tag": "USERNAME",
"value": "sarthak_mehta"
},
{
"context": "new AsyncHttpClient();\n client.get(\"http://192.168.0.101:8080/E-Cakery/rest/webservices/usercheck\",params ",
"end": 3428,
"score": 0.9996533989906311,
"start": 3415,
"tag": "IP_ADDRESS",
"value": "192.168.0.101"
}
]
| null | []
| package com.example.sarthak_mehta.e_cakery;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestParams;
import org.json.JSONException;
import org.json.JSONObject;
public class MainActivity extends AppCompatActivity {
SharedPreferences sharedpreferences;
public static final String MyPREFERENCES = "MyPrefs" ;
String email;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
sharedpreferences = getSharedPreferences(MyPREFERENCES, Context.MODE_PRIVATE);
if(sharedpreferences.contains("email")){
navigatetoHomeActivity();
}else
{
setContentView(R.layout.activity_main);
Button button = (Button) findViewById(R.id.btn_login);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
EditText emailET = (EditText) findViewById(R.id.input_email);
email = emailET.getText().toString();
EditText pwdET = (EditText) findViewById(R.id.input_password);
// Get Password Edit View Value
String password = pwdET.getText().toString();
// Instantiate Http Request Param Object
RequestParams params = new RequestParams();
// Put Http parameter username with value of Email Edit View control
params.put("username", email);
// Put Http parameter password with value of Password Edit Value control
params.put("password", password);
// Invoke RESTful Web Service with Http parameters
invokeWS(params);
}
});
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
public void invokeWS(final RequestParams params){
// Make RESTful webservice call using AsyncHttpClient object
AsyncHttpClient client = new AsyncHttpClient();
client.get("http://192.168.0.101:8080/E-Cakery/rest/webservices/usercheck",params ,new AsyncHttpResponseHandler() {
// When the response returned by REST has Http response code '200'
@Override
public void onSuccess(String response) {
try {
// JSON Object
JSONObject obj = new JSONObject(response);
// When the JSON response has status boolean value assigned with true
if(obj.getBoolean("status")){
sharedpreferences = getSharedPreferences(MyPREFERENCES, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString("email", email);
editor.commit();
Toast.makeText(getApplicationContext(), "You are successfully logged in!", Toast.LENGTH_LONG).show();
// Navigate to Home screen
navigatetoHomeActivity();
}
// Else display error message
else{
Toast.makeText(getApplicationContext(), obj.getString("error_msg"), Toast.LENGTH_LONG).show();
}
} catch (JSONException e) {
// TODO Auto-generated catch block
Toast.makeText(getApplicationContext(), "Error Occured [Server's JSON response might be invalid]!", Toast.LENGTH_LONG).show();
e.printStackTrace();
}
}
// When the response returned by REST has Http response code other than '200'
@Override
public void onFailure(int statusCode, Throwable error,
String content) {
// When Http response code is '404'
if(statusCode == 404){
Toast.makeText(getApplicationContext(), "Requested resource not found", Toast.LENGTH_LONG).show();
}
// When Http response code is '500'
else if(statusCode == 500){
Toast.makeText(getApplicationContext(), "Something went wrong at server end", Toast.LENGTH_LONG).show();
}
// When Http response code other than 404, 500
else{
Toast.makeText(getApplicationContext(), "No internet connection", Toast.LENGTH_LONG).show();
}
}
});
}
/**
* Method which navigates from Main Activity to Home Activity
*/
public void navigatetoHomeActivity(){
Intent homeIntent = new Intent(getApplicationContext(),HomeActivity.class);
homeIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(homeIntent);
finish();
}
@Override
public void onBackPressed() {
finish();
}
}
| 6,353 | 0.605226 | 0.598615 | 154 | 40.253246 | 31.06143 | 146 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.584416 | false | false | 10 |
8ab44de495faecf67df37d231edead58cffdf84a | 1,803,886,290,451 | fb1da37bbb61b861de230d55efed09b816c96dbc | /extranet/src/main/java/com/gruppo/isc/extranet/service/AvanzamentoServiceImp.java | a3d213c9f83e7cd85db57a8b43bb459bd51d0ed2 | []
| no_license | Minfrey/Git_Extranet | https://github.com/Minfrey/Git_Extranet | c47a086de9141d7cb6add512357f89a7bf80f68d | 52598423f7c1b74102094fdf9ad8e0f1bc891d1d | refs/heads/main | 2023-03-20T04:14:33.201000 | 2021-03-09T09:41:39 | 2021-03-09T09:41:39 | 332,261,207 | 0 | 0 | null | false | 2021-03-08T17:20:43 | 2021-01-23T16:55:27 | 2021-03-08T09:49:27 | 2021-03-08T17:20:42 | 267 | 0 | 0 | 0 | Java | false | false | package com.gruppo.isc.extranet.service;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import javax.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import com.gruppo.isc.extranet.model.Attivita;
import com.gruppo.isc.extranet.model.Avanzamento;
import com.gruppo.isc.extranet.model.Commessa;
import com.gruppo.isc.extranet.model.TipoAvanzamento;
import com.gruppo.isc.extranet.repository.AttivitaRepoImp;
import com.gruppo.isc.extranet.repository.AvanzamentoRepoImp;
import com.gruppo.isc.extranet.repository.CommessaRepoImp;
@Service
public class AvanzamentoServiceImp implements AvanzamentoService
{
@Autowired
AvanzamentoRepoImp arr;
@Autowired
CommessaRepoImp cri;
@Override
@Transactional
public String setAvanzamento(Avanzamento a)
{
Calendar alfa = new GregorianCalendar();
alfa.set(a.getAnno().getNumero(), (a.getMese().getId_mese()-1), 15);
java.sql.Date javaSqlDate = new java.sql.Date(alfa.getTime().getTime());
a.setData(javaSqlDate);
System.out.println(a.getData());
Integer percentualelocale = a.getPercentuale();
Double valore = a.getAttivita().getValore();
Double valoreava = (valore*percentualelocale)/100;
a.setValore(valoreava);
String messaggio="";
java.sql.Date inizio = a.getAttivita().getCommessa().getInizio();
System.out.println(inizio);
java.sql.Date fine = a.getAttivita().getCommessa().getFine();
System.out.println(fine);
if(inizio.before(a.getData()) && fine.after(a.getData()))
{
if(arr.controlloDuplicatiInserimento(a).size()==0)
{
if(a.getTipoAvanzamento().getId_tipo_avanzamento()==2 || a.getTipoAvanzamento().getId_tipo_avanzamento()==3)
{
List controllo = arr.controlloInserimento(a);
if(controllo.size()>=1 && a.getTipoAvanzamento().getId_tipo_avanzamento()==2)
{
messaggio = ("\"Sono già stati inseriti i ricavi di questa attività\"");
}
else if(controllo.size()>=1 && a.getTipoAvanzamento().getId_tipo_avanzamento()==3)
{
messaggio = ("\"È già stato inserito un preventivo per i ricavi di questa attività\"");
}
else
{
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
arr.setAvanzamento(a);
messaggio = ("\"Attivita Inserita\"");
if(a.getTipoAvanzamento().getId_tipo_avanzamento()==2)
{
// prendo id della commessa e inserisco il valore dell'attivita nel fatturato essendo id 2 il computo dei ricavi
// aggiungere fattura
cri.fatturatoCommessa(a.getAttivita().getValore(), a.getAttivita().getCommessa().getId_commessa());
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
//se esite un avanzamento dello stesso tipo con lo stesso nome della stessa commessa allora errore
else
{
/////////////////////////////////////////
boolean controlloprec = false;
List<Avanzamento> percent = arr.controlloPercentuale(a);
Avanzamento massimominimo = new Avanzamento();
Avanzamento minimomassimo = new Avanzamento();
for(int i=0;i<percent.size();i++)
{
if(a.getData().before(percent.get(i).getData())/* && a.getPercentuale()<percent.get(i).getPercentuale()*/)
{
if(minimomassimo.getData()==null)
{
minimomassimo = percent.get(i);
}
else if(minimomassimo.getData().after(percent.get(i).getData())/*&& minimomassimo.getPercentuale()>percent.get(i).getPercentuale()*/)
{
minimomassimo = percent.get(i);
}
}
else if(a.getData().after(percent.get(i).getData())/* && a.getPercentuale()>percent.get(i).getPercentuale()*/)
{
if(massimominimo.getData()==null)
{
massimominimo = percent.get(i);
}
else if(massimominimo.getData().before(percent.get(i).getData())/*&& massimominimo.getPercentuale()<percent.get(i).getPercentuale()*/)
{
massimominimo = percent.get(i);
}
}
}
System.out.println("estremo inferiore "+massimominimo.getData()+" "+massimominimo.getPercentuale());
System.out.println("inserito "+a.getData()+" "+a.getPercentuale());
System.out.println("estremo superiore "+minimomassimo.getData()+" "+minimomassimo.getPercentuale());
if(massimominimo.getData()==null && minimomassimo.getData()==null)
{
System.out.println("liberoooooooooooooooooooo");
arr.setAvanzamento(a);
messaggio = ("\"Attivita Inserita\"");
}
else if(massimominimo.getData()==null && a.getData().before(minimomassimo.getData()) && a.getPercentuale()<minimomassimo.getPercentuale() )
{
System.out.println("estremo inferiore nulloooooooooooo");
arr.setAvanzamento(a);
messaggio = ("\"Attivita Inserita\"");
}
else if(minimomassimo.getData()==null && a.getData().after(massimominimo.getData()) && a.getPercentuale()>massimominimo.getPercentuale())
{
System.out.println("estremo superiore nulloooooooooooo");
arr.setAvanzamento(a);
messaggio = ("\"Attivita Inserita\"");
}
///////////////////////////////
else if (massimominimo.getData()!=null
&& massimominimo.getData().before(a.getData())
&& minimomassimo.getData()!=null
&& a.getData().before(minimomassimo.getData())
&& massimominimo.getPercentuale()<a.getPercentuale()
&& a.getPercentuale()<minimomassimo.getPercentuale())
{
System.out.println("nessuno e nulloooooooooo");
arr.setAvanzamento(a);
messaggio = ("\"Attivita Inserita\"");
}
else
{
System.out.println(massimominimo.getData().before(a.getData()));
// System.out.println(a.getData().before(minimomassimo.getData()));
System.out.println(massimominimo.getPercentuale()<a.getPercentuale());
// System.out.println(a.getPercentuale()<minimomassimo.getPercentuale());
messaggio = ("\"Errore\"");
}
}
}
else
{
messaggio= ("\"Attivita Duplicata\"");
}
}
else
{
messaggio="\"Data non corretta\"";
}
return messaggio;
}
@Override
@Transactional
public String modAvanzamento(Avanzamento a)
{
String messaggio="";
Avanzamento consolid = arr.getAvanzamentoByID(a.getId_avanzamento());
if(consolid.getConsolida()==null)
{
Calendar alfa = new GregorianCalendar();
alfa.set(a.getAnno().getNumero(), (a.getMese().getId_mese()-1), 15);
java.sql.Date javaSqlDate = new java.sql.Date(alfa.getTime().getTime());
a.setData(javaSqlDate);
//calcola valore da percentuale
Integer percentualelocale = a.getPercentuale();
Double valore = a.getAttivita().getValore();
Double valoreava = (valore*percentualelocale)/100;
a.setValore(valoreava);
/////////////////////////////////////////
boolean controlloprec = false;
List<Avanzamento> percent = arr.controlloPercentuale(a);
Avanzamento massimominimo = new Avanzamento();
Avanzamento minimomassimo = new Avanzamento();
for(int i=0;i<percent.size();i++)
{
if(a.getMese().getId_mese()==percent.get(i).getMese().getId_mese() && a.getAnno().getId_anno()==percent.get(i).getAnno().getId_anno())
{
continue;
}
if(a.getData().before(percent.get(i).getData())/* && a.getPercentuale()<percent.get(i).getPercentuale()*/)
{
if(minimomassimo.getData()==null)
{
minimomassimo = percent.get(i);
}
else if(minimomassimo.getData().after(percent.get(i).getData())/*&& minimomassimo.getPercentuale()>percent.get(i).getPercentuale()*/)
{
minimomassimo = percent.get(i);
}
}
else if(a.getData().after(percent.get(i).getData())/* && a.getPercentuale()>percent.get(i).getPercentuale()*/)
{
if(massimominimo.getData()==null)
{
massimominimo = percent.get(i);
}
else if(massimominimo.getData().before(percent.get(i).getData())/*&& massimominimo.getPercentuale()<percent.get(i).getPercentuale()*/)
{
massimominimo = percent.get(i);
}
}
}
System.out.println("estremo inferiore "+massimominimo.getData()+" "+massimominimo.getPercentuale());
System.out.println("inserito "+a.getData()+" "+a.getPercentuale());
System.out.println("estremo superiore "+minimomassimo.getData()+" "+minimomassimo.getPercentuale());
if(massimominimo.getData()==null && minimomassimo.getData()==null)
{
System.out.println("liberoooooooooooooooooooo");
arr.modAvanzamento(a);
messaggio = ("\"Attivita Inserita\"");
}
else if(massimominimo.getData()==null && a.getData().before(minimomassimo.getData()) && a.getPercentuale()<minimomassimo.getPercentuale() )
{
System.out.println("estremo inferiore nulloooooooooooo");
arr.modAvanzamento(a);
messaggio = ("\"Attivita Inserita\"");
}
else if(minimomassimo.getData()==null && a.getData().after(massimominimo.getData()) && a.getPercentuale()>massimominimo.getPercentuale())
{
System.out.println("estremo superiore nulloooooooooooo");
arr.modAvanzamento(a);
messaggio = ("\"Attivita Inserita\"");
}
///////////////////////////////
else if (massimominimo.getData().before(a.getData())
&& a.getData().before(minimomassimo.getData())
&& massimominimo.getPercentuale()<a.getPercentuale()
&& a.getPercentuale()<minimomassimo.getPercentuale())
{
System.out.println("nessuno e nulloooooooooo");
arr.modAvanzamento(a);
messaggio = ("\"Attivita Inserita\"");
}
else
{
System.out.println(massimominimo.getData().before(a.getData()));
System.out.println(a.getData().before(minimomassimo.getData()));
System.out.println(massimominimo.getPercentuale()<a.getPercentuale());
System.out.println(a.getPercentuale()<minimomassimo.getPercentuale());
messaggio = ("\"Errore\"");
}
}
else
{
messaggio = ("\"Avanzamento consolidato non e possibile modificarlo\"");
}
return messaggio;
}
public List<Avanzamento> getListAvanzamento()
{
return arr.getAvanzamentoList();
}
public List<Avanzamento> getAvanzamentoByAttivita2(int id)
{
List<Avanzamento> a = arr.getAvanzamentoByAttivita2(id);
System.out.println(a.get(0).getAnno().getNumero());
return arr.getAvanzamentoByAttivita2(id);
}
public List<Avanzamento> getAvanzamentoByCommessaType(int id, int idt)
{
return arr.getAvanzamentoByCommessaType(id, idt);
}
@Transactional
public String consolidaav(Avanzamento a)
{
String messaggio = "";
Avanzamento b = arr.consolidav(a);
Integer numcom = a.getAttivita().getCommessa().getId_commessa();
if(a.getTipoAvanzamento().getId_tipo_avanzamento()==3)
{
cri.previsionefatturatoCommessa(a.getAttivita().getValore(), numcom);
}
if(b.getConsolida()!=null)
{
messaggio="\"Consolidato\"";
}
else
{
messaggio="\"Non Consolidato\"";
}
return messaggio;
}
}
| UTF-8 | Java | 11,233 | java | AvanzamentoServiceImp.java | Java | []
| null | []
| package com.gruppo.isc.extranet.service;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import javax.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import com.gruppo.isc.extranet.model.Attivita;
import com.gruppo.isc.extranet.model.Avanzamento;
import com.gruppo.isc.extranet.model.Commessa;
import com.gruppo.isc.extranet.model.TipoAvanzamento;
import com.gruppo.isc.extranet.repository.AttivitaRepoImp;
import com.gruppo.isc.extranet.repository.AvanzamentoRepoImp;
import com.gruppo.isc.extranet.repository.CommessaRepoImp;
@Service
public class AvanzamentoServiceImp implements AvanzamentoService
{
@Autowired
AvanzamentoRepoImp arr;
@Autowired
CommessaRepoImp cri;
@Override
@Transactional
public String setAvanzamento(Avanzamento a)
{
Calendar alfa = new GregorianCalendar();
alfa.set(a.getAnno().getNumero(), (a.getMese().getId_mese()-1), 15);
java.sql.Date javaSqlDate = new java.sql.Date(alfa.getTime().getTime());
a.setData(javaSqlDate);
System.out.println(a.getData());
Integer percentualelocale = a.getPercentuale();
Double valore = a.getAttivita().getValore();
Double valoreava = (valore*percentualelocale)/100;
a.setValore(valoreava);
String messaggio="";
java.sql.Date inizio = a.getAttivita().getCommessa().getInizio();
System.out.println(inizio);
java.sql.Date fine = a.getAttivita().getCommessa().getFine();
System.out.println(fine);
if(inizio.before(a.getData()) && fine.after(a.getData()))
{
if(arr.controlloDuplicatiInserimento(a).size()==0)
{
if(a.getTipoAvanzamento().getId_tipo_avanzamento()==2 || a.getTipoAvanzamento().getId_tipo_avanzamento()==3)
{
List controllo = arr.controlloInserimento(a);
if(controllo.size()>=1 && a.getTipoAvanzamento().getId_tipo_avanzamento()==2)
{
messaggio = ("\"Sono già stati inseriti i ricavi di questa attività\"");
}
else if(controllo.size()>=1 && a.getTipoAvanzamento().getId_tipo_avanzamento()==3)
{
messaggio = ("\"È già stato inserito un preventivo per i ricavi di questa attività\"");
}
else
{
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
arr.setAvanzamento(a);
messaggio = ("\"Attivita Inserita\"");
if(a.getTipoAvanzamento().getId_tipo_avanzamento()==2)
{
// prendo id della commessa e inserisco il valore dell'attivita nel fatturato essendo id 2 il computo dei ricavi
// aggiungere fattura
cri.fatturatoCommessa(a.getAttivita().getValore(), a.getAttivita().getCommessa().getId_commessa());
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
//se esite un avanzamento dello stesso tipo con lo stesso nome della stessa commessa allora errore
else
{
/////////////////////////////////////////
boolean controlloprec = false;
List<Avanzamento> percent = arr.controlloPercentuale(a);
Avanzamento massimominimo = new Avanzamento();
Avanzamento minimomassimo = new Avanzamento();
for(int i=0;i<percent.size();i++)
{
if(a.getData().before(percent.get(i).getData())/* && a.getPercentuale()<percent.get(i).getPercentuale()*/)
{
if(minimomassimo.getData()==null)
{
minimomassimo = percent.get(i);
}
else if(minimomassimo.getData().after(percent.get(i).getData())/*&& minimomassimo.getPercentuale()>percent.get(i).getPercentuale()*/)
{
minimomassimo = percent.get(i);
}
}
else if(a.getData().after(percent.get(i).getData())/* && a.getPercentuale()>percent.get(i).getPercentuale()*/)
{
if(massimominimo.getData()==null)
{
massimominimo = percent.get(i);
}
else if(massimominimo.getData().before(percent.get(i).getData())/*&& massimominimo.getPercentuale()<percent.get(i).getPercentuale()*/)
{
massimominimo = percent.get(i);
}
}
}
System.out.println("estremo inferiore "+massimominimo.getData()+" "+massimominimo.getPercentuale());
System.out.println("inserito "+a.getData()+" "+a.getPercentuale());
System.out.println("estremo superiore "+minimomassimo.getData()+" "+minimomassimo.getPercentuale());
if(massimominimo.getData()==null && minimomassimo.getData()==null)
{
System.out.println("liberoooooooooooooooooooo");
arr.setAvanzamento(a);
messaggio = ("\"Attivita Inserita\"");
}
else if(massimominimo.getData()==null && a.getData().before(minimomassimo.getData()) && a.getPercentuale()<minimomassimo.getPercentuale() )
{
System.out.println("estremo inferiore nulloooooooooooo");
arr.setAvanzamento(a);
messaggio = ("\"Attivita Inserita\"");
}
else if(minimomassimo.getData()==null && a.getData().after(massimominimo.getData()) && a.getPercentuale()>massimominimo.getPercentuale())
{
System.out.println("estremo superiore nulloooooooooooo");
arr.setAvanzamento(a);
messaggio = ("\"Attivita Inserita\"");
}
///////////////////////////////
else if (massimominimo.getData()!=null
&& massimominimo.getData().before(a.getData())
&& minimomassimo.getData()!=null
&& a.getData().before(minimomassimo.getData())
&& massimominimo.getPercentuale()<a.getPercentuale()
&& a.getPercentuale()<minimomassimo.getPercentuale())
{
System.out.println("nessuno e nulloooooooooo");
arr.setAvanzamento(a);
messaggio = ("\"Attivita Inserita\"");
}
else
{
System.out.println(massimominimo.getData().before(a.getData()));
// System.out.println(a.getData().before(minimomassimo.getData()));
System.out.println(massimominimo.getPercentuale()<a.getPercentuale());
// System.out.println(a.getPercentuale()<minimomassimo.getPercentuale());
messaggio = ("\"Errore\"");
}
}
}
else
{
messaggio= ("\"Attivita Duplicata\"");
}
}
else
{
messaggio="\"Data non corretta\"";
}
return messaggio;
}
@Override
@Transactional
public String modAvanzamento(Avanzamento a)
{
String messaggio="";
Avanzamento consolid = arr.getAvanzamentoByID(a.getId_avanzamento());
if(consolid.getConsolida()==null)
{
Calendar alfa = new GregorianCalendar();
alfa.set(a.getAnno().getNumero(), (a.getMese().getId_mese()-1), 15);
java.sql.Date javaSqlDate = new java.sql.Date(alfa.getTime().getTime());
a.setData(javaSqlDate);
//calcola valore da percentuale
Integer percentualelocale = a.getPercentuale();
Double valore = a.getAttivita().getValore();
Double valoreava = (valore*percentualelocale)/100;
a.setValore(valoreava);
/////////////////////////////////////////
boolean controlloprec = false;
List<Avanzamento> percent = arr.controlloPercentuale(a);
Avanzamento massimominimo = new Avanzamento();
Avanzamento minimomassimo = new Avanzamento();
for(int i=0;i<percent.size();i++)
{
if(a.getMese().getId_mese()==percent.get(i).getMese().getId_mese() && a.getAnno().getId_anno()==percent.get(i).getAnno().getId_anno())
{
continue;
}
if(a.getData().before(percent.get(i).getData())/* && a.getPercentuale()<percent.get(i).getPercentuale()*/)
{
if(minimomassimo.getData()==null)
{
minimomassimo = percent.get(i);
}
else if(minimomassimo.getData().after(percent.get(i).getData())/*&& minimomassimo.getPercentuale()>percent.get(i).getPercentuale()*/)
{
minimomassimo = percent.get(i);
}
}
else if(a.getData().after(percent.get(i).getData())/* && a.getPercentuale()>percent.get(i).getPercentuale()*/)
{
if(massimominimo.getData()==null)
{
massimominimo = percent.get(i);
}
else if(massimominimo.getData().before(percent.get(i).getData())/*&& massimominimo.getPercentuale()<percent.get(i).getPercentuale()*/)
{
massimominimo = percent.get(i);
}
}
}
System.out.println("estremo inferiore "+massimominimo.getData()+" "+massimominimo.getPercentuale());
System.out.println("inserito "+a.getData()+" "+a.getPercentuale());
System.out.println("estremo superiore "+minimomassimo.getData()+" "+minimomassimo.getPercentuale());
if(massimominimo.getData()==null && minimomassimo.getData()==null)
{
System.out.println("liberoooooooooooooooooooo");
arr.modAvanzamento(a);
messaggio = ("\"Attivita Inserita\"");
}
else if(massimominimo.getData()==null && a.getData().before(minimomassimo.getData()) && a.getPercentuale()<minimomassimo.getPercentuale() )
{
System.out.println("estremo inferiore nulloooooooooooo");
arr.modAvanzamento(a);
messaggio = ("\"Attivita Inserita\"");
}
else if(minimomassimo.getData()==null && a.getData().after(massimominimo.getData()) && a.getPercentuale()>massimominimo.getPercentuale())
{
System.out.println("estremo superiore nulloooooooooooo");
arr.modAvanzamento(a);
messaggio = ("\"Attivita Inserita\"");
}
///////////////////////////////
else if (massimominimo.getData().before(a.getData())
&& a.getData().before(minimomassimo.getData())
&& massimominimo.getPercentuale()<a.getPercentuale()
&& a.getPercentuale()<minimomassimo.getPercentuale())
{
System.out.println("nessuno e nulloooooooooo");
arr.modAvanzamento(a);
messaggio = ("\"Attivita Inserita\"");
}
else
{
System.out.println(massimominimo.getData().before(a.getData()));
System.out.println(a.getData().before(minimomassimo.getData()));
System.out.println(massimominimo.getPercentuale()<a.getPercentuale());
System.out.println(a.getPercentuale()<minimomassimo.getPercentuale());
messaggio = ("\"Errore\"");
}
}
else
{
messaggio = ("\"Avanzamento consolidato non e possibile modificarlo\"");
}
return messaggio;
}
public List<Avanzamento> getListAvanzamento()
{
return arr.getAvanzamentoList();
}
public List<Avanzamento> getAvanzamentoByAttivita2(int id)
{
List<Avanzamento> a = arr.getAvanzamentoByAttivita2(id);
System.out.println(a.get(0).getAnno().getNumero());
return arr.getAvanzamentoByAttivita2(id);
}
public List<Avanzamento> getAvanzamentoByCommessaType(int id, int idt)
{
return arr.getAvanzamentoByCommessaType(id, idt);
}
@Transactional
public String consolidaav(Avanzamento a)
{
String messaggio = "";
Avanzamento b = arr.consolidav(a);
Integer numcom = a.getAttivita().getCommessa().getId_commessa();
if(a.getTipoAvanzamento().getId_tipo_avanzamento()==3)
{
cri.previsionefatturatoCommessa(a.getAttivita().getValore(), numcom);
}
if(b.getConsolida()!=null)
{
messaggio="\"Consolidato\"";
}
else
{
messaggio="\"Non Consolidato\"";
}
return messaggio;
}
}
| 11,233 | 0.64829 | 0.645796 | 326 | 33.441719 | 34.172352 | 144 | false | false | 0 | 0 | 0 | 0 | 122 | 0.021553 | 3.837423 | false | false | 10 |
34450abd701fd6cd02bccf94940239713a8ed21d | 8,194,797,625,386 | 89422a6f268810e433dab2cd75b8ab1833a2aaaf | /exercises/ASDLabs - Shared Group/Lab6/prob2/Component.java | 19b0695305e92aea393d616b25584912b1b7374f | []
| no_license | luatnguyen1979/asd | https://github.com/luatnguyen1979/asd | 3bdaa95e2a7f23b41442ce9d952ceb21988607a2 | 2f79ac75ae60d43e1a3e77e0d698ded630737943 | refs/heads/master | 2021-05-11T16:55:56.293000 | 2018-02-02T16:53:53 | 2018-02-02T16:53:53 | 117,780,283 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.asd.lab6.prob2;
import java.util.ArrayList;
import java.util.Collection;
public abstract class Component implements ItreeProvider{
private Collection<Component> tree = new ArrayList<Component>();
protected String title;
public Component(String title){
this.title = title;
}
public String getTitle(){
return this.title;
}
}
| UTF-8 | Java | 377 | java | Component.java | Java | []
| null | []
| package com.asd.lab6.prob2;
import java.util.ArrayList;
import java.util.Collection;
public abstract class Component implements ItreeProvider{
private Collection<Component> tree = new ArrayList<Component>();
protected String title;
public Component(String title){
this.title = title;
}
public String getTitle(){
return this.title;
}
}
| 377 | 0.70557 | 0.700265 | 21 | 15.952381 | 18.899424 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.952381 | false | false | 10 |
351f00a3dc069b1af7d5a4eedb49b6cc6b0e02b0 | 32,323,923,889,442 | 9c6651a14fee8aa8918e1ab5c5b3a9364a168497 | /src/com/strings/Tostrng.java | 19291df46d045626aee01fe2a0ae46d8391d3482 | []
| no_license | dsubrahmanyam/core-java-programs | https://github.com/dsubrahmanyam/core-java-programs | 51dca799de3145089e76191779f07373297de39b | 7b8b028efd6b09ee59f5d1e89e9131491ec0d299 | refs/heads/master | 2020-12-02T03:42:29.094000 | 2019-12-30T10:10:41 | 2019-12-30T10:10:41 | 230,875,865 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.strings;
public class Tostrng {
public static void main(String[] args) {
Tostrng t = new Tostrng();
System.out.println(t);
System.out.println(t.toString());//object class toString() executed
String r="gaga";
System.out.println(r);
System.out.println(r.toString());//String class toString() executed
StringBuffer sb = new StringBuffer("anu");
System.out.println(sb);
System.out.println(sb.toString());////StringBuffer class toString() executed
}}
| UTF-8 | Java | 475 | java | Tostrng.java | Java | []
| null | []
| package com.strings;
public class Tostrng {
public static void main(String[] args) {
Tostrng t = new Tostrng();
System.out.println(t);
System.out.println(t.toString());//object class toString() executed
String r="gaga";
System.out.println(r);
System.out.println(r.toString());//String class toString() executed
StringBuffer sb = new StringBuffer("anu");
System.out.println(sb);
System.out.println(sb.toString());////StringBuffer class toString() executed
}}
| 475 | 0.717895 | 0.717895 | 16 | 28.6875 | 24.134308 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.5 | false | false | 10 |
59ea949d46342a980a6b050f63b8cc158811ebdc | 7,808,250,564,584 | cafde31c6287de1772b5d7f2fe0a19a1704be0d2 | /src/main/java/hw4/Builder/TestDataModel.java | 81bedd34850bdb965a6a2f69b7170050c6df918b | []
| no_license | Innokentiy945/InnokentiiObraztcov | https://github.com/Innokentiy945/InnokentiiObraztcov | a3bcf902bfb365c681258cce563983ed1708586e | 17c119823b34cc4777fc754fc3ad5863da65d3b9 | refs/heads/master | 2022-07-16T06:23:00.237000 | 2020-05-18T17:49:05 | 2020-05-18T17:49:05 | 250,230,780 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package hw4.Builder;
import hw4.Enums.*;
import hw4.Enums.Colors;
import java.util.List;
public class TestDataModel {
private String odd;
private String even;
private Colors colors;
private Metals metals;
private List<Vegetables> vegetables;
private List<Elements> elements;
protected TestDataModel(String odd, String even, Colors colors, Metals metals, List<Vegetables> vegetables, List<Elements> elements) {
this.odd = odd;
this.even = even;
this.colors = colors;
this.metals = metals;
this.vegetables = vegetables;
this.elements = elements;
}
public TestDataModel() {
}
public String getOdd() {
return odd;
}
public String getEven() {
return even;
}
public String getColors() {
return colors.toString();
}
public String getMetals() {
return metals.toString();
}
public List<Vegetables> getVegetables() {
return vegetables;
}
public List<Elements> getElements() {
return elements;
}
public String getVegetablesAsString() {
if (vegetables == null) {
return null;
}
StringBuilder stringBuilder = new StringBuilder();
vegetables.stream().forEach(e -> stringBuilder.append(e.toString()));
return stringBuilder.toString();
}
public String getElementsAsString() {
if (elements == null) {
return null;
}
StringBuilder stringBuilder = new StringBuilder();
elements.stream().forEach(e -> stringBuilder.append(e.toString()));
return stringBuilder.toString();
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private String odd;
private String even;
private Colors colors;
private Metals metals;
private List<Vegetables> vegetables;
private List<Elements> elements;
public Builder() {
}
public Builder setOdd(String odd) {
this.odd = odd;
return this;
}
public Builder setEven(String even) {
this.even = even;
return this;
}
public Builder setColors(Colors colors) {
this.colors = colors;
return this;
}
public Builder setMetals(Metals metals) {
this.metals = metals;
return this;
}
public Builder setVegetables(List<Vegetables> vegetables) {
this.vegetables = vegetables;
return this;
}
public Builder setElements(List<Elements> elements) {
this.elements = elements;
return this;
}
public TestDataModel build() {
return new TestDataModel(odd, even, colors, metals, vegetables, elements);
}
}
} | UTF-8 | Java | 3,043 | java | TestDataModel.java | Java | []
| null | []
| package hw4.Builder;
import hw4.Enums.*;
import hw4.Enums.Colors;
import java.util.List;
public class TestDataModel {
private String odd;
private String even;
private Colors colors;
private Metals metals;
private List<Vegetables> vegetables;
private List<Elements> elements;
protected TestDataModel(String odd, String even, Colors colors, Metals metals, List<Vegetables> vegetables, List<Elements> elements) {
this.odd = odd;
this.even = even;
this.colors = colors;
this.metals = metals;
this.vegetables = vegetables;
this.elements = elements;
}
public TestDataModel() {
}
public String getOdd() {
return odd;
}
public String getEven() {
return even;
}
public String getColors() {
return colors.toString();
}
public String getMetals() {
return metals.toString();
}
public List<Vegetables> getVegetables() {
return vegetables;
}
public List<Elements> getElements() {
return elements;
}
public String getVegetablesAsString() {
if (vegetables == null) {
return null;
}
StringBuilder stringBuilder = new StringBuilder();
vegetables.stream().forEach(e -> stringBuilder.append(e.toString()));
return stringBuilder.toString();
}
public String getElementsAsString() {
if (elements == null) {
return null;
}
StringBuilder stringBuilder = new StringBuilder();
elements.stream().forEach(e -> stringBuilder.append(e.toString()));
return stringBuilder.toString();
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private String odd;
private String even;
private Colors colors;
private Metals metals;
private List<Vegetables> vegetables;
private List<Elements> elements;
public Builder() {
}
public Builder setOdd(String odd) {
this.odd = odd;
return this;
}
public Builder setEven(String even) {
this.even = even;
return this;
}
public Builder setColors(Colors colors) {
this.colors = colors;
return this;
}
public Builder setMetals(Metals metals) {
this.metals = metals;
return this;
}
public Builder setVegetables(List<Vegetables> vegetables) {
this.vegetables = vegetables;
return this;
}
public Builder setElements(List<Elements> elements) {
this.elements = elements;
return this;
}
public TestDataModel build() {
return new TestDataModel(odd, even, colors, metals, vegetables, elements);
}
}
} | 3,043 | 0.558988 | 0.558002 | 127 | 21.976377 | 21.611628 | 138 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.472441 | false | false | 10 |
293e030ee1528b1fd392a6cd76888440f8103567 | 26,542,897,909,173 | a6170b7561e11f81f51856793627e9d721662f1e | /City.java | 8a86b18837c002e51bf3a551295509f07c207bd0 | []
| no_license | maganoegi/Dijkstra_Floyd | https://github.com/maganoegi/Dijkstra_Floyd | 5d4582e85a47d75e4f5e8074e3a60d828ab80565 | 0b4708f6627f82b888159bf5ef489c378e855193 | refs/heads/master | 2023-04-14T11:29:52.954000 | 2021-04-21T06:58:43 | 2021-04-21T06:58:43 | 358,906,058 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class City {
private String name;
private int longitude;
private int latitude;
public City(String name, int longitude, int latitude) {
this.name = name;
this.longitude = longitude;
this.latitude = latitude;
}
public String name() { return this.name; }
public int longitude() { return this.longitude; }
public int latitude() { return this.latitude; }
@Override
public String toString() {
return this.name;
}
@Override
public int hashCode() {
return this.name.hashCode();
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || o.getClass() != this.getClass()) {
return false;
}
City that = (City)o;
return this.name.equals(that.name());
}
}
| UTF-8 | Java | 886 | java | City.java | Java | []
| null | []
|
public class City {
private String name;
private int longitude;
private int latitude;
public City(String name, int longitude, int latitude) {
this.name = name;
this.longitude = longitude;
this.latitude = latitude;
}
public String name() { return this.name; }
public int longitude() { return this.longitude; }
public int latitude() { return this.latitude; }
@Override
public String toString() {
return this.name;
}
@Override
public int hashCode() {
return this.name.hashCode();
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || o.getClass() != this.getClass()) {
return false;
}
City that = (City)o;
return this.name.equals(that.name());
}
}
| 886 | 0.55079 | 0.55079 | 42 | 20 | 17.784424 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.452381 | false | false | 10 |
58d1b443552b3f47813f72a4cefc139f53a2dde1 | 26,542,897,910,079 | cfc14196840185aff111cdeeeccb32b53daacc5d | /app/src/main/java/com/programacion/fragments/ui/acerca/AcercaFragment.java | 593a5c83588639c235746f6cdf87d35b684be7d7 | []
| no_license | SKevinIvan/Fragments | https://github.com/SKevinIvan/Fragments | aef34629558b0d47d9d30506f83426f734b27f56 | e7b3dd8a044a45bcbaac4fa50b0d87fd49dbad4f | refs/heads/master | 2023-09-02T18:22:57.598000 | 2021-11-15T07:48:20 | 2021-11-15T07:48:20 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.programacion.fragments.ui.acerca;
import androidx.lifecycle.ViewModelProvider;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.programacion.fragments.R;
public class AcercaFragment extends Fragment {
private AcercaViewModel mViewModel;
ImageView imgFace;
ImageView imgInsta;
ImageView imgGit;
public static AcercaFragment newInstance() {
return new AcercaFragment();
}
private String urlF = "https://www.facebook.com/SKevinIvan/";
private String urlI = "https://www.instagram.com/s.kevin_ivan/";
private String urlG = "https://github.com/KevinSanchez-Cat";
private String urlE = "https://www.facebook.com/SKevinIvan/";
private String urlY = "https://www.facebook.com/SKevinIvan/";
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_acerca, container, false);
imgFace = root.findViewById(R.id.iBtnRedFace);
imgInsta = root.findViewById(R.id.iBtnRedInsta);
imgGit= root.findViewById(R.id.iBtnRedGit
);
imgFace = root.findViewById(R.id.iBtnRedFace);
imgFace.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Uri uri = Uri.parse(urlF);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
});
imgInsta.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Uri uri = Uri.parse(urlI);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
});
imgGit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Uri uri = Uri.parse(urlG);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
});
return root;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mViewModel = new ViewModelProvider(this).get(AcercaViewModel.class);
// TODO: Use the ViewModel
}
} | UTF-8 | Java | 2,735 | java | AcercaFragment.java | Java | [
{
"context": " private String urlF = \"https://www.facebook.com/SKevinIvan/\";\n private String urlI = \"https://www.instagr",
"end": 766,
"score": 0.999709963798523,
"start": 756,
"tag": "USERNAME",
"value": "SKevinIvan"
},
{
"context": " private String urlI = \"https://www.instagram.com/s.kevin_ivan/\";\n private String urlG = \"https://github.com/",
"end": 835,
"score": 0.9997597932815552,
"start": 823,
"tag": "USERNAME",
"value": "s.kevin_ivan"
},
{
"context": "/\";\n private String urlG = \"https://github.com/KevinSanchez-Cat\";\n private String urlE = \"https://www.facebook",
"end": 901,
"score": 0.9997540712356567,
"start": 885,
"tag": "USERNAME",
"value": "KevinSanchez-Cat"
},
{
"context": " private String urlE = \"https://www.facebook.com/SKevinIvan/\";\n private String urlY = \"https://www.faceboo",
"end": 966,
"score": 0.9997211694717407,
"start": 956,
"tag": "USERNAME",
"value": "SKevinIvan"
},
{
"context": " private String urlY = \"https://www.facebook.com/SKevinIvan/\";\n\n @Override\n public View onCreateView(@N",
"end": 1032,
"score": 0.9997186660766602,
"start": 1022,
"tag": "USERNAME",
"value": "SKevinIvan"
}
]
| null | []
| package com.programacion.fragments.ui.acerca;
import androidx.lifecycle.ViewModelProvider;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.programacion.fragments.R;
public class AcercaFragment extends Fragment {
private AcercaViewModel mViewModel;
ImageView imgFace;
ImageView imgInsta;
ImageView imgGit;
public static AcercaFragment newInstance() {
return new AcercaFragment();
}
private String urlF = "https://www.facebook.com/SKevinIvan/";
private String urlI = "https://www.instagram.com/s.kevin_ivan/";
private String urlG = "https://github.com/KevinSanchez-Cat";
private String urlE = "https://www.facebook.com/SKevinIvan/";
private String urlY = "https://www.facebook.com/SKevinIvan/";
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_acerca, container, false);
imgFace = root.findViewById(R.id.iBtnRedFace);
imgInsta = root.findViewById(R.id.iBtnRedInsta);
imgGit= root.findViewById(R.id.iBtnRedGit
);
imgFace = root.findViewById(R.id.iBtnRedFace);
imgFace.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Uri uri = Uri.parse(urlF);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
});
imgInsta.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Uri uri = Uri.parse(urlI);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
});
imgGit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Uri uri = Uri.parse(urlG);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
});
return root;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mViewModel = new ViewModelProvider(this).get(AcercaViewModel.class);
// TODO: Use the ViewModel
}
} | 2,735 | 0.64936 | 0.64936 | 80 | 33.200001 | 24.280857 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.625 | false | false | 10 |
747489fc85ddd1895debfe4d97b6a40121f296b9 | 8,160,437,887,860 | 78f300cf693af3f33e66b8c0198b173271e8eb72 | /Map.java | e1a99b2b0ff9f298f1e88e28af80fa05aa9b3b4b | []
| no_license | pujanov69/SimpleConsoleJavaGame | https://github.com/pujanov69/SimpleConsoleJavaGame | f7019157b2e4eed3c19157aec73422a2314d9b92 | fb990f6fe67baad627bca9e93ca3836fffbf7fb5 | refs/heads/master | 2022-11-22T01:54:49.717000 | 2020-07-28T21:08:08 | 2020-07-28T21:08:08 | 281,102,844 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.Scanner;
public class Map {
protected int playerXPos;
protected int playerYPos;
public Map() {
playerXPos = 0;
playerYPos = 0;
}
/*
* public void move() { Scanner scanner = new Scanner(System.in); int selection
* = 1; System.out.println("1) North, 2) East, 3) South, 4) West: "); selection
* = scanner.nextInt();
*
* switch (selection) { case 1: // North playerYPos++; break; case 2: // East
* playerXPos++; break; case 3: // South playerYPos--; break; default: // West
* playerXPos--; break; } }
*/
public void printPlayerPos() {
System.out.println("Player Position = (" + playerYPos + ", "
+ playerYPos + ")");
}
public Enemy[] checkForEnemies() {
int roll = Utility.random(0, 20);
int rollMultipleEnemy = Utility.random(0, 10);
int enemyReplicationNumber = Utility.random(1, 3);
// System.out.println("This is the replication number " + enemyReplicationNumber);
Enemy[] enemies = null;
if (roll <= 10) {
if(rollMultipleEnemy < 3) {
enemies = new Enemy[(enemyReplicationNumber + 1)];
} else {
enemies = new Enemy[1];
}
Weapon weapon = new Weapon("dagger", 5, 10);
Shield shield = new Shield("Wooden", 10);
Enemy enemy = new Enemy("Zombie", 10, 8, 200, weapon, shield);
enemies[0] = enemy;
System.out.println("This is the size of array " + enemies.length);
if(rollMultipleEnemy < 3) {
for(int i = 1; i <= enemyReplicationNumber; i++) {
System.out.println("This is the index " + i);
enemies[i] = new Enemy("Zombie", 10, 8, 200, weapon, shield);
}
}
System.out.println("You encountered " + enemies.length + " Zombie!");
System.out.println("Prepare for battle!");
}
else if (roll >= 11 && roll <= 15) {
if(rollMultipleEnemy < 3) {
enemies = new Enemy[(enemyReplicationNumber + 1)];
} else {
enemies = new Enemy[1];
}
Weapon weapon = new Weapon("dagger", 5, 10);
Shield shield = new Shield("Wooden", 10);
Enemy enemy = new Enemy("Dark soul", 10, 6, 200, weapon, shield);
enemies[0] = enemy;
System.out.println("This is the size of array " + enemies.length);
if(rollMultipleEnemy < 3) {
for(int i = 1; i <= enemyReplicationNumber; i++) {
System.out.println("This is the index " + i);
enemies[i] = new Enemy("Dark soul", 10, 6, 200, weapon, shield);
}
}
System.out.println("You encountered " + enemies.length + "Dark soul!");
System.out.println("Prepare for battle!");
}
return enemies;
}
}
| UTF-8 | Java | 2,965 | java | Map.java | Java | []
| null | []
| import java.util.Scanner;
public class Map {
protected int playerXPos;
protected int playerYPos;
public Map() {
playerXPos = 0;
playerYPos = 0;
}
/*
* public void move() { Scanner scanner = new Scanner(System.in); int selection
* = 1; System.out.println("1) North, 2) East, 3) South, 4) West: "); selection
* = scanner.nextInt();
*
* switch (selection) { case 1: // North playerYPos++; break; case 2: // East
* playerXPos++; break; case 3: // South playerYPos--; break; default: // West
* playerXPos--; break; } }
*/
public void printPlayerPos() {
System.out.println("Player Position = (" + playerYPos + ", "
+ playerYPos + ")");
}
public Enemy[] checkForEnemies() {
int roll = Utility.random(0, 20);
int rollMultipleEnemy = Utility.random(0, 10);
int enemyReplicationNumber = Utility.random(1, 3);
// System.out.println("This is the replication number " + enemyReplicationNumber);
Enemy[] enemies = null;
if (roll <= 10) {
if(rollMultipleEnemy < 3) {
enemies = new Enemy[(enemyReplicationNumber + 1)];
} else {
enemies = new Enemy[1];
}
Weapon weapon = new Weapon("dagger", 5, 10);
Shield shield = new Shield("Wooden", 10);
Enemy enemy = new Enemy("Zombie", 10, 8, 200, weapon, shield);
enemies[0] = enemy;
System.out.println("This is the size of array " + enemies.length);
if(rollMultipleEnemy < 3) {
for(int i = 1; i <= enemyReplicationNumber; i++) {
System.out.println("This is the index " + i);
enemies[i] = new Enemy("Zombie", 10, 8, 200, weapon, shield);
}
}
System.out.println("You encountered " + enemies.length + " Zombie!");
System.out.println("Prepare for battle!");
}
else if (roll >= 11 && roll <= 15) {
if(rollMultipleEnemy < 3) {
enemies = new Enemy[(enemyReplicationNumber + 1)];
} else {
enemies = new Enemy[1];
}
Weapon weapon = new Weapon("dagger", 5, 10);
Shield shield = new Shield("Wooden", 10);
Enemy enemy = new Enemy("Dark soul", 10, 6, 200, weapon, shield);
enemies[0] = enemy;
System.out.println("This is the size of array " + enemies.length);
if(rollMultipleEnemy < 3) {
for(int i = 1; i <= enemyReplicationNumber; i++) {
System.out.println("This is the index " + i);
enemies[i] = new Enemy("Dark soul", 10, 6, 200, weapon, shield);
}
}
System.out.println("You encountered " + enemies.length + "Dark soul!");
System.out.println("Prepare for battle!");
}
return enemies;
}
}
| 2,965 | 0.525801 | 0.502192 | 83 | 34.722893 | 27.176937 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.337349 | false | false | 10 |
ab2f2e4bda06a4a47b51886444140110553d48ea | 29,463,475,672,624 | dffeec3063d3a823409c4156130a667357620822 | /src/main/java/com/qingshixun/project/eshop/util/EmailService.java | ee48df242cf8aa6e2b94668b5cd7c52b1666b1b4 | []
| no_license | LVLIN27/eshop | https://github.com/LVLIN27/eshop | 839fc49c37d24858b14a5c363bba01a041fdaf15 | 33e66d160aaa7577479a7a26bea6aa52713d1771 | refs/heads/master | 2020-07-12T21:36:14.290000 | 2019-09-02T12:15:51 | 2019-09-02T12:15:51 | 204,912,299 | 1 | 0 | null | true | 2019-09-02T12:15:53 | 2019-08-28T11:06:25 | 2019-08-31T09:08:59 | 2019-09-02T12:15:52 | 8,068 | 0 | 0 | 0 | JavaScript | false | false | /********************************************
* Copyright (c) 2016, www.qingshixun.com
*
* All rights reserved
*
*********************************************/
package com.qingshixun.project.eshop.util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Service;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
/**
* 发送邮件
*/
@Service
public class EmailService {
@Autowired
private JavaMailSender mailSender;
@Value("${spring.mail.username}")
private String username;
/**
* 发送邮件
*
* @param to 收件人邮箱
* @param subject 标题
* @param htmlContent html邮件内容
*
* @throws MessagingException
*/
public void sendMail(String to, String subject, String htmlContent) throws MessagingException {
MimeMessage mailMessage = mailSender.createMimeMessage();
MimeMessageHelper mail = new MimeMessageHelper(mailMessage, true, "utf-8");
mail.setFrom(username);
mail.setTo(to);
mail.setSubject(subject);
mail.setText(htmlContent, true);
mailSender.send(mailMessage);
}
}
| UTF-8 | Java | 1,389 | java | EmailService.java | Java | []
| null | []
| /********************************************
* Copyright (c) 2016, www.qingshixun.com
*
* All rights reserved
*
*********************************************/
package com.qingshixun.project.eshop.util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Service;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
/**
* 发送邮件
*/
@Service
public class EmailService {
@Autowired
private JavaMailSender mailSender;
@Value("${spring.mail.username}")
private String username;
/**
* 发送邮件
*
* @param to 收件人邮箱
* @param subject 标题
* @param htmlContent html邮件内容
*
* @throws MessagingException
*/
public void sendMail(String to, String subject, String htmlContent) throws MessagingException {
MimeMessage mailMessage = mailSender.createMimeMessage();
MimeMessageHelper mail = new MimeMessageHelper(mailMessage, true, "utf-8");
mail.setFrom(username);
mail.setTo(to);
mail.setSubject(subject);
mail.setText(htmlContent, true);
mailSender.send(mailMessage);
}
}
| 1,389 | 0.656551 | 0.65285 | 48 | 27.145834 | 23.740778 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.479167 | false | false | 10 |
ff281f97f32a2c82582a1409ab2a10388f5407bd | 14,431,090,142,913 | 30160580232dbf0b6a68bd69c3ec24e12e49cdd3 | /src/main/java/com/google/dialogflow/controller/DialogFlowController.java | 6fce90a3e05688b4f9e4e941152347a431ad8833 | []
| no_license | gandhewarnikita/dialogflow-app | https://github.com/gandhewarnikita/dialogflow-app | 5be8b8c44508df10c740cd7deb90fb8b9aed7dbb | ce2e559ceeeddb57983367dd555c589a82e7edd1 | refs/heads/master | 2020-12-23T19:10:51.715000 | 2020-01-30T15:41:16 | 2020-01-30T15:41:16 | 237,244,319 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.google.dialogflow.controller;
import java.io.IOException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.HttpClientBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.google.actions.api.ActionResponse;
import com.google.actions.api.App;
import com.google.api.client.json.Json;
@RestController
@RequestMapping(value = "/api/dialog")
public class DialogFlowController {
private static final Logger LOGGER = LoggerFactory.getLogger(DialogFlowController.class);
@Value("${GOOGLE_URL}")
public String Url;
@Value("${GOOGLE_AUTH_TOKEN}")
public String GOOGLE_AUTH_TOKEN;
private final App actionsApp = new DialogApp();
@RequestMapping(value = "/action", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public String getAction(@RequestHeader Map<String, String> headers)
throws InterruptedException, ExecutionException, ClientProtocolException, IOException {
LOGGER.info("in getAction()");
String payload = "";
String listPayload = "";
LOGGER.info("Url : " + Url);
HttpPost post = new HttpPost(Url);
post.setHeader("Content-Type", "application/json");
post.setHeader("Authorization", "Bearer " + GOOGLE_AUTH_TOKEN);
// payload = "\"{\\\"queryInput\\\":{\\\"text\\\":{\\\"text\\\":\\\"talk to
// cdc\\\",\\\"languageCode\\\":\\\"en\\\"}},\\\"queryParams\\\":{\\\"timeZone\\\":\\\"Asia\\/Calcutta\\\"}}\"";
// payload = "{\"queryInput\":{\"text\":{\"text\":\"talk to
// cdc\",\"languageCode\":\"en\"}},\"queryParams\":{\"timeZone\":\"Asia/Calcutta\"}}\"";
// payload = "\"{\\\"queryInput\\\":{\\\"text\\\":{\\\"text\\\":\\\"talk to
// cdc\\\",\\\"languageCode\\\":\\\"en\\\"}},\\\"queryParams\\\":{\\\"timeZone\\\":\\\"Asia\\/Calcutta\\\"}}\"";
payload = "{\"queryInput\":{\"text\":{\"text\":\"talk to cdc\",\"languageCode\":\"en\"}},\"queryParams\":{\"timeZone\":\"Asia/Calcutta\"}}";
listPayload = "{\"queryInput\":{\"text\":{\"text\":\"list cdc themes\",\"languageCode\":\"en\"}},\"queryParams\":{\"timeZone\":\"Asia/Calcutta\"}}";
StringEntity entity = new StringEntity(payload, ContentType.APPLICATION_JSON);
post.setEntity(entity);
LOGGER.info("post entity : " + post.getEntity());
HttpClient client1 = HttpClientBuilder.create().build();
HttpResponse response = client1.execute(post);
LOGGER.info("response : " + response);
String responseString = new BasicResponseHandler().handleResponse(response);
LOGGER.info("responseString : " + responseString);
return responseString;
}
}
| UTF-8 | Java | 3,589 | java | DialogFlowController.java | Java | []
| null | []
| package com.google.dialogflow.controller;
import java.io.IOException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.HttpClientBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.google.actions.api.ActionResponse;
import com.google.actions.api.App;
import com.google.api.client.json.Json;
@RestController
@RequestMapping(value = "/api/dialog")
public class DialogFlowController {
private static final Logger LOGGER = LoggerFactory.getLogger(DialogFlowController.class);
@Value("${GOOGLE_URL}")
public String Url;
@Value("${GOOGLE_AUTH_TOKEN}")
public String GOOGLE_AUTH_TOKEN;
private final App actionsApp = new DialogApp();
@RequestMapping(value = "/action", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public String getAction(@RequestHeader Map<String, String> headers)
throws InterruptedException, ExecutionException, ClientProtocolException, IOException {
LOGGER.info("in getAction()");
String payload = "";
String listPayload = "";
LOGGER.info("Url : " + Url);
HttpPost post = new HttpPost(Url);
post.setHeader("Content-Type", "application/json");
post.setHeader("Authorization", "Bearer " + GOOGLE_AUTH_TOKEN);
// payload = "\"{\\\"queryInput\\\":{\\\"text\\\":{\\\"text\\\":\\\"talk to
// cdc\\\",\\\"languageCode\\\":\\\"en\\\"}},\\\"queryParams\\\":{\\\"timeZone\\\":\\\"Asia\\/Calcutta\\\"}}\"";
// payload = "{\"queryInput\":{\"text\":{\"text\":\"talk to
// cdc\",\"languageCode\":\"en\"}},\"queryParams\":{\"timeZone\":\"Asia/Calcutta\"}}\"";
// payload = "\"{\\\"queryInput\\\":{\\\"text\\\":{\\\"text\\\":\\\"talk to
// cdc\\\",\\\"languageCode\\\":\\\"en\\\"}},\\\"queryParams\\\":{\\\"timeZone\\\":\\\"Asia\\/Calcutta\\\"}}\"";
payload = "{\"queryInput\":{\"text\":{\"text\":\"talk to cdc\",\"languageCode\":\"en\"}},\"queryParams\":{\"timeZone\":\"Asia/Calcutta\"}}";
listPayload = "{\"queryInput\":{\"text\":{\"text\":\"list cdc themes\",\"languageCode\":\"en\"}},\"queryParams\":{\"timeZone\":\"Asia/Calcutta\"}}";
StringEntity entity = new StringEntity(payload, ContentType.APPLICATION_JSON);
post.setEntity(entity);
LOGGER.info("post entity : " + post.getEntity());
HttpClient client1 = HttpClientBuilder.create().build();
HttpResponse response = client1.execute(post);
LOGGER.info("response : " + response);
String responseString = new BasicResponseHandler().handleResponse(response);
LOGGER.info("responseString : " + responseString);
return responseString;
}
}
| 3,589 | 0.720535 | 0.71942 | 94 | 37.180851 | 33.226803 | 150 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.43617 | false | false | 10 |
3890317700403ee5c27f4224a8374b611b6b8854 | 197,568,529,618 | c0c90abf05e8b77f1521048aa0dbe0b5a49dd8f6 | /src/de/fungistudii/enjhin/graphics/tweenEngine/BlinkingComponent.java | 3b81ea01cb0e5daa35556bb9fe3631332e19c5b4 | []
| no_license | Fungaria/Enjhin | https://github.com/Fungaria/Enjhin | 80e0ddd9fd5427e9909298fd54afc25a9f80ea90 | efa148d57bf723aac9793e96bb037b88c436c5be | refs/heads/master | 2020-04-05T18:47:19.362000 | 2018-11-11T19:20:19 | 2018-11-11T19:20:19 | 157,112,626 | 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 de.fungistudii.enjhin.graphics.tweenEngine;
import aurelienribon.tweenengine.Tween;
import com.badlogic.ashley.core.Component;
import com.badlogic.gdx.graphics.Color;
/**
*
* @author Samuel
*/
public class BlinkingComponent implements Component{
public Color color;
public float duration = 10;
public float colorDuration;
public float neutralDuration;
public Tween to;
public Tween back;
public boolean shouldStart;
public BlinkingComponent(Color color, float duration, float speed) {
this(color, duration, speed, speed);
}
public BlinkingComponent(Color color, float duration, float colorDuration, float neutralDuration) {
this.color = color;
this.duration = duration;
this.neutralDuration = neutralDuration;
this.colorDuration = colorDuration;
}
public void start(){
shouldStart = true;
}
}
| UTF-8 | Java | 1,153 | java | BlinkingComponent.java | Java | [
{
"context": "adlogic.gdx.graphics.Color;\r\n\r\n/**\r\n *\r\n * @author Samuel\r\n */\r\npublic class BlinkingComponent implements C",
"end": 399,
"score": 0.9991099238395691,
"start": 393,
"tag": "NAME",
"value": "Samuel"
}
]
| 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 de.fungistudii.enjhin.graphics.tweenEngine;
import aurelienribon.tweenengine.Tween;
import com.badlogic.ashley.core.Component;
import com.badlogic.gdx.graphics.Color;
/**
*
* @author Samuel
*/
public class BlinkingComponent implements Component{
public Color color;
public float duration = 10;
public float colorDuration;
public float neutralDuration;
public Tween to;
public Tween back;
public boolean shouldStart;
public BlinkingComponent(Color color, float duration, float speed) {
this(color, duration, speed, speed);
}
public BlinkingComponent(Color color, float duration, float colorDuration, float neutralDuration) {
this.color = color;
this.duration = duration;
this.neutralDuration = neutralDuration;
this.colorDuration = colorDuration;
}
public void start(){
shouldStart = true;
}
}
| 1,153 | 0.675629 | 0.673894 | 41 | 26.121952 | 24.146095 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.682927 | false | false | 10 |
6b98541f3ea09dddd1e7e50ceb0d3bf1a567fa20 | 25,065,429,165,037 | edf32e1e5202d61467f3e6115de757f35369baf2 | /src/main/java/br/fameg/edu/domain/model/Matricula.java | 4a532ea30d7db949b83c7abb7f9eaed676ebcd30 | [
"MIT"
]
| permissive | LucasKr/school-management-api | https://github.com/LucasKr/school-management-api | 500f00374fdf70e0f5b00774bafdd2e0e8dc6de8 | 25f89e688e0c7bc2ba7fee48d1fd68c13dec7775 | refs/heads/master | 2021-01-21T11:14:40.811000 | 2017-06-07T22:27:01 | 2017-06-07T22:27:01 | 91,730,335 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.fameg.edu.domain.model;
import br.fameg.edu.utils.DateDeserializer;
import br.fameg.edu.utils.DateSerializer;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import java.util.Date;
import javax.persistence.*;
@Entity
@Table(uniqueConstraints = @UniqueConstraint(columnNames = {"disciplina_id", "aluno_id", "semestre_id"}))
public class Matricula {
@Id @GeneratedValue
private Long id;
@OneToOne(optional = false)
private Disciplina disciplina;
@OneToOne(optional = false)
private Aluno aluno;
@OneToOne(optional = false)
private Semestre semestre;
@OneToOne(optional = false)
private Turma turma;
@Column(nullable = false)
@Temporal(TemporalType.DATE)
@JsonSerialize(using = DateSerializer.class)
@JsonDeserialize(using = DateDeserializer.class)
private Date dataMatricula;
private boolean trancada;
public Matricula() {}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Disciplina getDisciplina() {
return disciplina;
}
public void setDisciplina(Disciplina disciplina) {
this.disciplina = disciplina;
}
public Aluno getAluno() {
return aluno;
}
public void setAluno(Aluno aluno) {
this.aluno = aluno;
}
public Semestre getSemestre() {
return semestre;
}
public void setSemestre(Semestre semestre) {
this.semestre = semestre;
}
public Turma getTurma() {
return turma;
}
public void setTurma(Turma turma) {
this.turma = turma;
}
public Date getDataMatricula() {
return dataMatricula;
}
public void setDataMatricula(Date dataMatricula) {
this.dataMatricula = dataMatricula;
}
public boolean isTrancada() {
return trancada;
}
public void setTrancada(boolean trancada) {
this.trancada = trancada;
}
}
| UTF-8 | Java | 2,095 | java | Matricula.java | Java | []
| null | []
| package br.fameg.edu.domain.model;
import br.fameg.edu.utils.DateDeserializer;
import br.fameg.edu.utils.DateSerializer;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import java.util.Date;
import javax.persistence.*;
@Entity
@Table(uniqueConstraints = @UniqueConstraint(columnNames = {"disciplina_id", "aluno_id", "semestre_id"}))
public class Matricula {
@Id @GeneratedValue
private Long id;
@OneToOne(optional = false)
private Disciplina disciplina;
@OneToOne(optional = false)
private Aluno aluno;
@OneToOne(optional = false)
private Semestre semestre;
@OneToOne(optional = false)
private Turma turma;
@Column(nullable = false)
@Temporal(TemporalType.DATE)
@JsonSerialize(using = DateSerializer.class)
@JsonDeserialize(using = DateDeserializer.class)
private Date dataMatricula;
private boolean trancada;
public Matricula() {}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Disciplina getDisciplina() {
return disciplina;
}
public void setDisciplina(Disciplina disciplina) {
this.disciplina = disciplina;
}
public Aluno getAluno() {
return aluno;
}
public void setAluno(Aluno aluno) {
this.aluno = aluno;
}
public Semestre getSemestre() {
return semestre;
}
public void setSemestre(Semestre semestre) {
this.semestre = semestre;
}
public Turma getTurma() {
return turma;
}
public void setTurma(Turma turma) {
this.turma = turma;
}
public Date getDataMatricula() {
return dataMatricula;
}
public void setDataMatricula(Date dataMatricula) {
this.dataMatricula = dataMatricula;
}
public boolean isTrancada() {
return trancada;
}
public void setTrancada(boolean trancada) {
this.trancada = trancada;
}
}
| 2,095 | 0.645346 | 0.645346 | 90 | 22.277779 | 18.846767 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 10 |
b15f29dd06518e0c8eac296c715fd8bfffe99f4d | 25,065,429,166,337 | 479be2e7ca88223fdd9cc81931ef00adab1bc79b | /app/src/main/java/com/example/grewordspractice/models/WordDao.java | c9c62e9afdcffb583db38978ae679a97c2d24df9 | []
| no_license | shambu2k/GRE-Words-Practice | https://github.com/shambu2k/GRE-Words-Practice | 504b4e7d16381c69fedcbadabb2cf71012ea3df8 | 023bd418dc1db027974e8723d621356f94a3bd25 | refs/heads/master | 2021-05-17T10:00:18.350000 | 2020-05-13T14:41:15 | 2020-05-13T14:41:15 | 250,732,763 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.grewordspractice.models;
import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;
import java.util.List;
import io.reactivex.Completable;
import io.reactivex.Flowable;
@Dao
public interface WordDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
void addWord(Word word);
@Query("SELECT * FROM temp_words")
LiveData<List<Word>> getAllWords();
@Delete
void deleteWord(Word word);
@Query("DELETE FROM temp_words")
void deleteAllWords();
@Query("SELECT * FROM temp_words WHERE word LIKE :word")
List<Word> getRepeatWords(String word);
}
| UTF-8 | Java | 767 | java | WordDao.java | Java | []
| null | []
| package com.example.grewordspractice.models;
import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;
import java.util.List;
import io.reactivex.Completable;
import io.reactivex.Flowable;
@Dao
public interface WordDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
void addWord(Word word);
@Query("SELECT * FROM temp_words")
LiveData<List<Word>> getAllWords();
@Delete
void deleteWord(Word word);
@Query("DELETE FROM temp_words")
void deleteAllWords();
@Query("SELECT * FROM temp_words WHERE word LIKE :word")
List<Word> getRepeatWords(String word);
}
| 767 | 0.745763 | 0.745763 | 34 | 21.558823 | 17.70874 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.470588 | false | false | 10 |
749ae46fd48a7883b4b4eac156353392cce89821 | 15,461,882,296,181 | 73b07f940c4ec7d0f4c6a9aadbc83a9b61f850a6 | /tk-integration-fu/src/test/java/org/acme/controller/MultipartControllerNativeTest.java | a91ea66d1623f1b7e893268ab3cfec248a1f1950 | []
| no_license | spannozzo/tk-integration | https://github.com/spannozzo/tk-integration | 3cdc6e71fe4401e2bbf29c401c9177019ce3700f | 1c9036797a0a6b35368aecd4e98185cdc134714f | refs/heads/master | 2023-01-03T11:32:29.566000 | 2020-10-11T22:41:45 | 2020-10-11T22:41:45 | 301,767,580 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.acme.controller;
import io.quarkus.test.junit.NativeImageTest;
@NativeImageTest
public class MultipartControllerNativeTest extends MultipartControllerTest {
// Execute the same tests but in native mode.
} | UTF-8 | Java | 224 | java | MultipartControllerNativeTest.java | Java | []
| null | []
| package org.acme.controller;
import io.quarkus.test.junit.NativeImageTest;
@NativeImageTest
public class MultipartControllerNativeTest extends MultipartControllerTest {
// Execute the same tests but in native mode.
} | 224 | 0.8125 | 0.8125 | 9 | 24 | 26.272081 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.222222 | false | false | 10 |
35fdc91184c30ffd1ae6b230955b9555b0e4a698 | 15,461,882,295,024 | 76651bfabe52456db8aa6c3d5cc40443c2020dbe | /src/main/java/xyz/blackmonster/resume/layer/contract/ClassConverter.java | a5155dd0583df4b70e4b8b63b5a9ab70b2abc5a4 | []
| no_license | jklancic/resume-back | https://github.com/jklancic/resume-back | 7d84adf22175b7d0cc07eaa65fa3326f1f4ce47a | ef8f9c7fe702c857d15b2289f77a75f6f0238e08 | refs/heads/master | 2021-03-14T13:57:46.792000 | 2020-03-12T07:31:26 | 2020-03-12T07:31:26 | 246,770,239 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package xyz.blackmonster.resume.layer.contract;
import xyz.blackmonster.resume.json.v1.common.*;
import xyz.blackmonster.resume.json.v1.auth.User;
import xyz.blackmonster.resume.json.v1.user.HomeUserProfile;
import xyz.blackmonster.resume.json.v1.user.UserContact;
import xyz.blackmonster.resume.json.v1.user.UserProfile;
import xyz.blackmonster.resume.service.model.*;
public interface ClassConverter {
Address transform(AddressBean addressBean);
AddressBean transform(Address address);
Company transform(CompanyBean companyBean);
CompanyBean transform(Company company);
Education transform(EducationBean educationBean);
EducationBean transform(Education education);
Expertise transform(ExpertiseBean expertiseBean);
ExpertiseBean transform(Expertise expertise);
Job transform(JobBean jobBean);
JobBean transform(Job job);
JobDescription transform(JobDescriptionBean jobDescriptionBean);
JobDescriptionBean transform(JobDescription jobDescription);
Skill transform(SkillBean skillBean);
SkillBean transform(Skill skill);
User transform(UserBean userBean);
UserBean transform(User user);
UserContact transform(UserContactBean userContactBean);
UserContactBean transform(UserContact userContact);
UserProfile transform(UserProfileBean userProfileBean);
HomeUserProfile transformForHome(UserProfileBean userProfileBean);
UserProfileBean transform(UserProfile userProfile);
}
| UTF-8 | Java | 1,460 | java | ClassConverter.java | Java | []
| null | []
| package xyz.blackmonster.resume.layer.contract;
import xyz.blackmonster.resume.json.v1.common.*;
import xyz.blackmonster.resume.json.v1.auth.User;
import xyz.blackmonster.resume.json.v1.user.HomeUserProfile;
import xyz.blackmonster.resume.json.v1.user.UserContact;
import xyz.blackmonster.resume.json.v1.user.UserProfile;
import xyz.blackmonster.resume.service.model.*;
public interface ClassConverter {
Address transform(AddressBean addressBean);
AddressBean transform(Address address);
Company transform(CompanyBean companyBean);
CompanyBean transform(Company company);
Education transform(EducationBean educationBean);
EducationBean transform(Education education);
Expertise transform(ExpertiseBean expertiseBean);
ExpertiseBean transform(Expertise expertise);
Job transform(JobBean jobBean);
JobBean transform(Job job);
JobDescription transform(JobDescriptionBean jobDescriptionBean);
JobDescriptionBean transform(JobDescription jobDescription);
Skill transform(SkillBean skillBean);
SkillBean transform(Skill skill);
User transform(UserBean userBean);
UserBean transform(User user);
UserContact transform(UserContactBean userContactBean);
UserContactBean transform(UserContact userContact);
UserProfile transform(UserProfileBean userProfileBean);
HomeUserProfile transformForHome(UserProfileBean userProfileBean);
UserProfileBean transform(UserProfile userProfile);
}
| 1,460 | 0.806849 | 0.803425 | 33 | 43.242424 | 18.571777 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.848485 | false | false | 10 |
dc3e8b567ee6924c7567bacc8dce6008b518be63 | 15,461,882,298,140 | abc3dce6d8e1d2d350b37fff64a87f1bcef1a641 | /cursoSE8JavaBasico/src/br/com/javaBasico/metodosStaticos/CursoTEste.java | b0ffdbaa770ddc5420cee47b759c820cfd7ef340 | []
| no_license | Jofofe/cursoSE8 | https://github.com/Jofofe/cursoSE8 | df18904985788d318b912ef40b6aa4e06cb8cd3d | 0ffc72df3e649464d47a16ab4b7810d7faf60286 | refs/heads/master | 2021-09-10T04:41:56.755000 | 2018-03-21T02:32:34 | 2018-03-21T02:32:34 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.com.javaBasico.metodosStaticos;
public class CursoTEste {
public static void main(String[] args) {
Curso.insiraNota();
Curso.calculaMedia();
Curso.exibiMedia();
}
} | UTF-8 | Java | 196 | java | CursoTEste.java | Java | []
| null | []
| package br.com.javaBasico.metodosStaticos;
public class CursoTEste {
public static void main(String[] args) {
Curso.insiraNota();
Curso.calculaMedia();
Curso.exibiMedia();
}
} | 196 | 0.688776 | 0.688776 | 11 | 16 | 15.579707 | 42 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.090909 | false | false | 10 |
ff98a9534cb769ec403158ce24ff427e1bfd13f0 | 15,290,083,623,548 | d2c131fa6f82a12a93ecebe3abbf35382c5d4666 | /app/src/main/java/com/likebamboo/phoneshow/widget/overlay/OverlayView.java | c7255984f6fca5069d038ca7bde3ef666e47255b | []
| no_license | ywlAndroidSpace/PhoneShow | https://github.com/ywlAndroidSpace/PhoneShow | 1f1d0577d77c316893769b43607fb5beec3d4417 | 5debebbeb0af6317b5ba26cabe6e09e9fd269470 | refs/heads/master | 2021-01-19T02:25:33.515000 | 2016-11-11T07:12:14 | 2016-11-11T07:12:14 | 73,454,710 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.likebamboo.phoneshow.widget.overlay;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.graphics.PixelFormat;
import android.graphics.Point;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.view.Display;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import com.likebamboo.phoneshow.R;
import com.likebamboo.phoneshow.adapter.CityAdapter;
import com.likebamboo.phoneshow.entities.City;
import com.likebamboo.phoneshow.task.GetInfoTask;
import com.likebamboo.phoneshow.util.Utils;
import com.likebamboo.phoneshow.widget.Title;
import java.util.ArrayList;
/**
* 半屏显示
*
* @author likebamboo
*/
public class OverlayView extends Overlay {
/**
* 网络操作结果
*/
public static final int MSG_OK = 0x1000;
/**
* 网络操作结果
*/
public static final int MSG_FAILED = 0x1001;
/**
* 来电号码extra
*/
public static final String EXTRA_PHONE_NUM = "phoneNum";
private static Context mContext = null;
/**
* 标题栏
*/
private static Title mTitle = null;
/**
* 正在加载布局
*/
private static LinearLayout mLoadingLayout = null;
/**
* 正在加载文字显示
*/
private static TextView mLoadingTv = null;
/**
* 网络操作结果界面。
*/
private static LinearLayout mRetLayout = null;
/**
* 城市结果列表
*/
private static ListView mCityList = null;
/**
* 城市适配器
*/
private static CityAdapter mCityAdapter = null;
/**
* 挂电话按钮
*/
private static Button mEndCallBt = null;
/**
* 接听电话按钮
*/
private static Button mAnswerCallBt = null;
/**
* 异步查询任务
*/
private static GetInfoTask getInfoTask = null;
@SuppressLint("HandlerLeak")
private static Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
// TODO Auto-generated method stub
// super.handleMessage(msg);
switch (msg.what) {
case MSG_OK:
String json = msg.getData().getString("data");
ArrayList<City> data = new ArrayList<City>();
if (Utils.parseData(data, json)) {
mCityAdapter = new CityAdapter(mContext, data);
mCityList.setAdapter(mCityAdapter);
mCityAdapter.notifyDataSetChanged();
}
mLoadingLayout.setVisibility(View.GONE);
mRetLayout.setVisibility(View.VISIBLE);
break;
case MSG_FAILED:
mLoadingTv.setText(msg.obj + "");
break;
default:
break;
}
}
};
/**
* 显示
*
* @param context 上下文对象
* @param number
*/
public static void show(final Context context, final String number, final int percentScreen) {
synchronized (monitor) {
mContext = context;
init(context, number, R.layout.call_over_layout, percentScreen);
InputMethodManager imm = (InputMethodManager)context
.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,
InputMethodManager.HIDE_IMPLICIT_ONLY);
imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
// 启动查询
startSearch();
}
}
/**
* 启动查询
*/
@SuppressLint("NewApi")
private static void startSearch() {
synchronized (monitor) {
if (getInfoTask != null && getInfoTask.isRunning()) {
getInfoTask.cancel();
getInfoTask = null;
}
// TODO Auto-generated method stub
getInfoTask = new GetInfoTask(mContext, new GetInfoTask.IOnResultListener() {
@Override
public void onResult(boolean success, String error, String result) {
// TODO Auto-generated method stub
Message msg = handler.obtainMessage();
if (success) {
msg.what = MSG_OK;
msg.getData().putString("data", result);
} else {
msg.what = MSG_FAILED;
msg.obj = error;
}
handler.sendMessage(msg);
}
});
if (Utils.hasHoneycomb()) {
getInfoTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} else {
getInfoTask.execute();
}
}
}
/**
* 隐藏
*
* @param context
*/
public static void hide(Context context) {
synchronized (monitor) {
if (mOverlay != null) {
try {
WindowManager wm = (WindowManager)context
.getSystemService(Context.WINDOW_SERVICE);
// Remove view from WindowManager
wm.removeView(mOverlay);
} catch (Exception e) {
e.printStackTrace();
}
mOverlay = null;
}
}
}
/**
* 初始化布局
*
* @param context 上下文对象
* @param number 电话号码
* @param layout 布局文件
* @return 布局
*/
private static ViewGroup init(Context context, String number, int layout, int percentScreen) {
WindowManager.LayoutParams params = getShowingParams();
int height = getHeight(context, percentScreen);
params.height = height;
ViewGroup overlay = init(context, layout, params);
initView(overlay, number, percentScreen);
return overlay;
}
/**
* 初始化界面
*/
private static void initView(View v, String phoneNum, int percentScreen) {
// 标题栏
mTitle = (Title)v.findViewById(R.id.overlay_title);
mTitle.setTitle(R.string.call_ringing);
// 显示来电电话
((TextView)v.findViewById(R.id.overlay_result_msg))
.setText(Utils.formatHtml(mContext.getString(R.string.call_ringing_msg,
"<font color='red'>" + phoneNum + "</font>")));
// 初始化各个控件
mLoadingLayout = (LinearLayout)v.findViewById(R.id.overlay_loading_layout);
mLoadingTv = (TextView)v.findViewById(R.id.overlay_loading_tv);
mRetLayout = (LinearLayout)v.findViewById(R.id.overlay_result_layout);
mCityList = (ListView)v.findViewById(R.id.overlay_result_list);
// 显示正在加载数据。
mLoadingLayout.setVisibility(View.VISIBLE);
v.findViewById(R.id.overlay_loading_pb).setVisibility(View.VISIBLE);
mRetLayout.setVisibility(View.GONE);
if (percentScreen == 100) {
// 接听电话与挂断电话
mEndCallBt = (Button)v.findViewById(R.id.overlay_end_call_bt);
mAnswerCallBt = (Button)v.findViewById(R.id.overlay_answer_call_bt);
v.findViewById(R.id.overlay_dealwith_layout).setVisibility(View.VISIBLE);
addListener();
}
}
/**
* 添加监听器
*/
private static void addListener() {
mEndCallBt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Utils.endCall(mContext);
}
});
mAnswerCallBt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (Utils.hasGingerbread()) {
Utils.answerRingingCall(mContext);
} else {
Utils.answerRingingCall(mContext);
}
}
});
}
/**
* 获取显示参数
*
* @return
*/
private static WindowManager.LayoutParams getShowingParams() {
WindowManager.LayoutParams params = new WindowManager.LayoutParams();
params.type = WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
// TYPE_TOAST TYPE_SYSTEM_OVERLAY 在其他应用上层 在通知栏下层 位置不能动鸟
// TYPE_PHONE 在其他应用上层 在通知栏下层
// TYPE_PRIORITY_PHONE TYPE_SYSTEM_ALERT 在其他应用上层 在通知栏上层 没试出来区别是啥
// TYPE_SYSTEM_ERROR 最顶层(通过对比360和天天动听歌词得出)
params.width = WindowManager.LayoutParams.MATCH_PARENT;
params.x = 0;
params.y = 0;
params.format = PixelFormat.RGBA_8888;// value = 1
params.gravity = Gravity.TOP;
params.flags = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
| WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
| WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
| WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD;
params.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
return params;
}
/**
* 获取界面显示的高度 ,默认为手机高度的2/3
*
* @param context 上下文对象
* @return
*/
private static int getHeight(Context context, int percentScreen) {
return getLarger(context) * percentScreen / 100;
}
@SuppressWarnings("deprecation")
private static int getLarger(Context context) {
WindowManager wm = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
int height = 0;
if (Utils.hasHoneycombMR2()) {
height = getLarger(display);
} else {
height = display.getHeight() > display.getWidth() ? display.getHeight() : display
.getWidth();
}
System.out.println("getLarger: " + height);
return height;
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
private static int getLarger(Display display) {
Point size = new Point();
display.getSize(size);
return size.y > size.x ? size.y : size.x;
}
}
| UTF-8 | Java | 11,243 | java | OverlayView.java | Java | [
{
"context": "t java.util.ArrayList;\n\n/**\n * 半屏显示\n * \n * @author likebamboo\n */\npublic class OverlayView extends Overlay {\n\n ",
"end": 1051,
"score": 0.9995376467704773,
"start": 1041,
"tag": "USERNAME",
"value": "likebamboo"
}
]
| null | []
|
package com.likebamboo.phoneshow.widget.overlay;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.graphics.PixelFormat;
import android.graphics.Point;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.view.Display;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import com.likebamboo.phoneshow.R;
import com.likebamboo.phoneshow.adapter.CityAdapter;
import com.likebamboo.phoneshow.entities.City;
import com.likebamboo.phoneshow.task.GetInfoTask;
import com.likebamboo.phoneshow.util.Utils;
import com.likebamboo.phoneshow.widget.Title;
import java.util.ArrayList;
/**
* 半屏显示
*
* @author likebamboo
*/
public class OverlayView extends Overlay {
/**
* 网络操作结果
*/
public static final int MSG_OK = 0x1000;
/**
* 网络操作结果
*/
public static final int MSG_FAILED = 0x1001;
/**
* 来电号码extra
*/
public static final String EXTRA_PHONE_NUM = "phoneNum";
private static Context mContext = null;
/**
* 标题栏
*/
private static Title mTitle = null;
/**
* 正在加载布局
*/
private static LinearLayout mLoadingLayout = null;
/**
* 正在加载文字显示
*/
private static TextView mLoadingTv = null;
/**
* 网络操作结果界面。
*/
private static LinearLayout mRetLayout = null;
/**
* 城市结果列表
*/
private static ListView mCityList = null;
/**
* 城市适配器
*/
private static CityAdapter mCityAdapter = null;
/**
* 挂电话按钮
*/
private static Button mEndCallBt = null;
/**
* 接听电话按钮
*/
private static Button mAnswerCallBt = null;
/**
* 异步查询任务
*/
private static GetInfoTask getInfoTask = null;
@SuppressLint("HandlerLeak")
private static Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
// TODO Auto-generated method stub
// super.handleMessage(msg);
switch (msg.what) {
case MSG_OK:
String json = msg.getData().getString("data");
ArrayList<City> data = new ArrayList<City>();
if (Utils.parseData(data, json)) {
mCityAdapter = new CityAdapter(mContext, data);
mCityList.setAdapter(mCityAdapter);
mCityAdapter.notifyDataSetChanged();
}
mLoadingLayout.setVisibility(View.GONE);
mRetLayout.setVisibility(View.VISIBLE);
break;
case MSG_FAILED:
mLoadingTv.setText(msg.obj + "");
break;
default:
break;
}
}
};
/**
* 显示
*
* @param context 上下文对象
* @param number
*/
public static void show(final Context context, final String number, final int percentScreen) {
synchronized (monitor) {
mContext = context;
init(context, number, R.layout.call_over_layout, percentScreen);
InputMethodManager imm = (InputMethodManager)context
.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,
InputMethodManager.HIDE_IMPLICIT_ONLY);
imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
// 启动查询
startSearch();
}
}
/**
* 启动查询
*/
@SuppressLint("NewApi")
private static void startSearch() {
synchronized (monitor) {
if (getInfoTask != null && getInfoTask.isRunning()) {
getInfoTask.cancel();
getInfoTask = null;
}
// TODO Auto-generated method stub
getInfoTask = new GetInfoTask(mContext, new GetInfoTask.IOnResultListener() {
@Override
public void onResult(boolean success, String error, String result) {
// TODO Auto-generated method stub
Message msg = handler.obtainMessage();
if (success) {
msg.what = MSG_OK;
msg.getData().putString("data", result);
} else {
msg.what = MSG_FAILED;
msg.obj = error;
}
handler.sendMessage(msg);
}
});
if (Utils.hasHoneycomb()) {
getInfoTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} else {
getInfoTask.execute();
}
}
}
/**
* 隐藏
*
* @param context
*/
public static void hide(Context context) {
synchronized (monitor) {
if (mOverlay != null) {
try {
WindowManager wm = (WindowManager)context
.getSystemService(Context.WINDOW_SERVICE);
// Remove view from WindowManager
wm.removeView(mOverlay);
} catch (Exception e) {
e.printStackTrace();
}
mOverlay = null;
}
}
}
/**
* 初始化布局
*
* @param context 上下文对象
* @param number 电话号码
* @param layout 布局文件
* @return 布局
*/
private static ViewGroup init(Context context, String number, int layout, int percentScreen) {
WindowManager.LayoutParams params = getShowingParams();
int height = getHeight(context, percentScreen);
params.height = height;
ViewGroup overlay = init(context, layout, params);
initView(overlay, number, percentScreen);
return overlay;
}
/**
* 初始化界面
*/
private static void initView(View v, String phoneNum, int percentScreen) {
// 标题栏
mTitle = (Title)v.findViewById(R.id.overlay_title);
mTitle.setTitle(R.string.call_ringing);
// 显示来电电话
((TextView)v.findViewById(R.id.overlay_result_msg))
.setText(Utils.formatHtml(mContext.getString(R.string.call_ringing_msg,
"<font color='red'>" + phoneNum + "</font>")));
// 初始化各个控件
mLoadingLayout = (LinearLayout)v.findViewById(R.id.overlay_loading_layout);
mLoadingTv = (TextView)v.findViewById(R.id.overlay_loading_tv);
mRetLayout = (LinearLayout)v.findViewById(R.id.overlay_result_layout);
mCityList = (ListView)v.findViewById(R.id.overlay_result_list);
// 显示正在加载数据。
mLoadingLayout.setVisibility(View.VISIBLE);
v.findViewById(R.id.overlay_loading_pb).setVisibility(View.VISIBLE);
mRetLayout.setVisibility(View.GONE);
if (percentScreen == 100) {
// 接听电话与挂断电话
mEndCallBt = (Button)v.findViewById(R.id.overlay_end_call_bt);
mAnswerCallBt = (Button)v.findViewById(R.id.overlay_answer_call_bt);
v.findViewById(R.id.overlay_dealwith_layout).setVisibility(View.VISIBLE);
addListener();
}
}
/**
* 添加监听器
*/
private static void addListener() {
mEndCallBt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Utils.endCall(mContext);
}
});
mAnswerCallBt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (Utils.hasGingerbread()) {
Utils.answerRingingCall(mContext);
} else {
Utils.answerRingingCall(mContext);
}
}
});
}
/**
* 获取显示参数
*
* @return
*/
private static WindowManager.LayoutParams getShowingParams() {
WindowManager.LayoutParams params = new WindowManager.LayoutParams();
params.type = WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
// TYPE_TOAST TYPE_SYSTEM_OVERLAY 在其他应用上层 在通知栏下层 位置不能动鸟
// TYPE_PHONE 在其他应用上层 在通知栏下层
// TYPE_PRIORITY_PHONE TYPE_SYSTEM_ALERT 在其他应用上层 在通知栏上层 没试出来区别是啥
// TYPE_SYSTEM_ERROR 最顶层(通过对比360和天天动听歌词得出)
params.width = WindowManager.LayoutParams.MATCH_PARENT;
params.x = 0;
params.y = 0;
params.format = PixelFormat.RGBA_8888;// value = 1
params.gravity = Gravity.TOP;
params.flags = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
| WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
| WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
| WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD;
params.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
return params;
}
/**
* 获取界面显示的高度 ,默认为手机高度的2/3
*
* @param context 上下文对象
* @return
*/
private static int getHeight(Context context, int percentScreen) {
return getLarger(context) * percentScreen / 100;
}
@SuppressWarnings("deprecation")
private static int getLarger(Context context) {
WindowManager wm = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
int height = 0;
if (Utils.hasHoneycombMR2()) {
height = getLarger(display);
} else {
height = display.getHeight() > display.getWidth() ? display.getHeight() : display
.getWidth();
}
System.out.println("getLarger: " + height);
return height;
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
private static int getLarger(Display display) {
Point size = new Point();
display.getSize(size);
return size.y > size.x ? size.y : size.x;
}
}
| 11,243 | 0.578001 | 0.575021 | 347 | 29.939482 | 24.649925 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.443804 | false | false | 10 |
837edc07f103671472543d878682592324b47287 | 24,816,321,090,360 | 886739ef63cb1481e6792a80b0d54fd6e8a7cb7c | /src/MagicDrafter.java | e67d2c166ed4a535bb6a67b94ccb444bdcb8f8f3 | []
| no_license | fatefulsoftware/Magic-Drafter | https://github.com/fatefulsoftware/Magic-Drafter | 27320b6b42ff37c7478e8643f3649dff2f690988 | c2454bcacca772687ff7a826d74c65f0b904edc4 | refs/heads/master | 2020-04-05T11:31:49.391000 | 2011-12-12T08:06:25 | 2011-12-12T08:06:25 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
public class MagicDrafter {
Draft draft;
public MagicDrafter () {
draft = new Draft();
}
public static void main (String[] args) {
MagicDrafter drafter;
drafter = new MagicDrafter();
drafter.start();
}
public void start () {
Player player;
Set set;
List<Card> cards;
set = new InnistradSet();
draft = new Draft();
try {
cards = getCards();
set.addCards(cards);
draft.addSet(set);
player = new DraftBot(cards);
player.name = "Player 1";
draft.addPlayer(player);
player = new Player();
player.name = "Player 2";
draft.addPlayer(player);/*
player = new Player();
player.name = "Player 3";
draft.addPlayer(player);
player = new Player();
player.name = "Player 4";
draft.addPlayer(player);
player = new Player();
player.name = "Player 5";
draft.addPlayer(player);
player = new Player();
player.name = "Player 6";
draft.addPlayer(player);
player = new Player();
player.name = "Player 7";
draft.addPlayer(player);
player = new Player();
player.name = "Player 8";
draft.addPlayer(player);*/
run();
} catch (FileNotFoundException e) {
System.out.println("Cards file not found");
} catch (IOException e) {
System.out.println("IOException thrown");
}
}
public static List<Card> getCards () throws FileNotFoundException, IOException {
BufferedReader reader;
String str;
Card card;
List<Card> cards;
int i, pos;
final String MYTHIC_RARE = "Mythic Rare", RARE = "Rare", UNCOMMON = "Uncommon", COMMON = "Common";
reader = new BufferedReader(new FileReader("cards.csv"));
cards = new ArrayList<Card>();
while ((str = reader.readLine()) != null) {
i = 0;
pos = -1;
while (i != -1) {
i = str.indexOf(",", i + 1);
if (i != -1)
pos = i;
}
if (pos == -1)
continue;
card = new Card();
card.name = str.substring(0, pos);
str = str.substring(pos + 1);
if (str.equals(COMMON))
card.rarity = Rarity.Common;
else if (str.equals(UNCOMMON))
card.rarity = Rarity.Uncommon;
else if (str.equals(RARE))
card.rarity = Rarity.Rare;
else if (str.equals(MYTHIC_RARE))
card.rarity = Rarity.MythicRare;
card.doubleSided = card.name.contains("//");
cards.add(card);
}
return cards;
}
public void run () {
List<Card> pack;
int i;
BufferedReader in;
String str;
StringBuilder builder;
builder = new StringBuilder();
in = new BufferedReader(new InputStreamReader(System.in));
draft.start();
while (draft.isRunning()) {
for (Player player : draft.getSeats()) {
pack = draft.getPack(player);
builder.delete(0, builder.length());
if (player.getDeck().size() > 0) {
builder.append(player.getDeck().get(0).name);
for (i = 1; i < player.getDeck().size(); i++)
builder.append(", " + player.getDeck().get(i).name);
System.out.println(builder.toString());
}
i = 1;
for (Card card : pack) {
System.out.println(String.format("%d: %s", i, card.name));
i++;
}
draft.pick(player, pack, player.pick(pack));
}
}
for (Player player : draft.getSeats()) {
System.out.println(player.name + ":");
for (Card card : player.getDeck())
System.out.println(card.name);
System.out.println();
}
}
}
| UTF-8 | Java | 3,629 | java | MagicDrafter.java | Java | []
| null | []
| import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
public class MagicDrafter {
Draft draft;
public MagicDrafter () {
draft = new Draft();
}
public static void main (String[] args) {
MagicDrafter drafter;
drafter = new MagicDrafter();
drafter.start();
}
public void start () {
Player player;
Set set;
List<Card> cards;
set = new InnistradSet();
draft = new Draft();
try {
cards = getCards();
set.addCards(cards);
draft.addSet(set);
player = new DraftBot(cards);
player.name = "Player 1";
draft.addPlayer(player);
player = new Player();
player.name = "Player 2";
draft.addPlayer(player);/*
player = new Player();
player.name = "Player 3";
draft.addPlayer(player);
player = new Player();
player.name = "Player 4";
draft.addPlayer(player);
player = new Player();
player.name = "Player 5";
draft.addPlayer(player);
player = new Player();
player.name = "Player 6";
draft.addPlayer(player);
player = new Player();
player.name = "Player 7";
draft.addPlayer(player);
player = new Player();
player.name = "Player 8";
draft.addPlayer(player);*/
run();
} catch (FileNotFoundException e) {
System.out.println("Cards file not found");
} catch (IOException e) {
System.out.println("IOException thrown");
}
}
public static List<Card> getCards () throws FileNotFoundException, IOException {
BufferedReader reader;
String str;
Card card;
List<Card> cards;
int i, pos;
final String MYTHIC_RARE = "Mythic Rare", RARE = "Rare", UNCOMMON = "Uncommon", COMMON = "Common";
reader = new BufferedReader(new FileReader("cards.csv"));
cards = new ArrayList<Card>();
while ((str = reader.readLine()) != null) {
i = 0;
pos = -1;
while (i != -1) {
i = str.indexOf(",", i + 1);
if (i != -1)
pos = i;
}
if (pos == -1)
continue;
card = new Card();
card.name = str.substring(0, pos);
str = str.substring(pos + 1);
if (str.equals(COMMON))
card.rarity = Rarity.Common;
else if (str.equals(UNCOMMON))
card.rarity = Rarity.Uncommon;
else if (str.equals(RARE))
card.rarity = Rarity.Rare;
else if (str.equals(MYTHIC_RARE))
card.rarity = Rarity.MythicRare;
card.doubleSided = card.name.contains("//");
cards.add(card);
}
return cards;
}
public void run () {
List<Card> pack;
int i;
BufferedReader in;
String str;
StringBuilder builder;
builder = new StringBuilder();
in = new BufferedReader(new InputStreamReader(System.in));
draft.start();
while (draft.isRunning()) {
for (Player player : draft.getSeats()) {
pack = draft.getPack(player);
builder.delete(0, builder.length());
if (player.getDeck().size() > 0) {
builder.append(player.getDeck().get(0).name);
for (i = 1; i < player.getDeck().size(); i++)
builder.append(", " + player.getDeck().get(i).name);
System.out.println(builder.toString());
}
i = 1;
for (Card card : pack) {
System.out.println(String.format("%d: %s", i, card.name));
i++;
}
draft.pick(player, pack, player.pick(pack));
}
}
for (Player player : draft.getSeats()) {
System.out.println(player.name + ":");
for (Card card : player.getDeck())
System.out.println(card.name);
System.out.println();
}
}
}
| 3,629 | 0.604574 | 0.598788 | 173 | 19.976879 | 16.967482 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.179191 | false | false | 10 |
e4ba17481c2c7f1b9f410b65866f7c891062c222 | 9,320,079,042,167 | 40e7f2734676250b985cd18b344329cea8a7c42b | /instrumentation/tomcat/tomcat-7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/tomcat/v7_0/Tomcat7Singletons.java | 297731da7d99831058ff3b91bae3d0bae8d627ef | [
"Apache-2.0"
]
| permissive | open-telemetry/opentelemetry-java-instrumentation | https://github.com/open-telemetry/opentelemetry-java-instrumentation | d6f375148715f8ddb2d4a987c0b042cb6badbfa2 | b0a8bd4f47e55624fb3942e34b7a7051d075f2a5 | refs/heads/main | 2023-09-01T15:10:10.287000 | 2023-09-01T08:07:11 | 2023-09-01T08:07:11 | 210,933,087 | 1,349 | 689 | Apache-2.0 | false | 2023-09-14T18:42:00 | 2019-09-25T20:19:14 | 2023-09-14T06:58:29 | 2023-09-14T18:41:58 | 171,005 | 1,439 | 661 | 330 | Java | false | false | /*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.javaagent.instrumentation.tomcat.v7_0;
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
import io.opentelemetry.javaagent.instrumentation.servlet.v3_0.Servlet3Accessor;
import io.opentelemetry.javaagent.instrumentation.servlet.v3_0.Servlet3Singletons;
import io.opentelemetry.javaagent.instrumentation.tomcat.common.TomcatHelper;
import io.opentelemetry.javaagent.instrumentation.tomcat.common.TomcatInstrumenterFactory;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.coyote.Request;
import org.apache.coyote.Response;
public final class Tomcat7Singletons {
private static final String INSTRUMENTATION_NAME = "io.opentelemetry.tomcat-7.0";
private static final Instrumenter<Request, Response> INSTRUMENTER =
TomcatInstrumenterFactory.create(INSTRUMENTATION_NAME, Servlet3Accessor.INSTANCE);
private static final TomcatHelper<HttpServletRequest, HttpServletResponse> HELPER =
new TomcatHelper<>(
INSTRUMENTER, Tomcat7ServletEntityProvider.INSTANCE, Servlet3Singletons.helper());
public static TomcatHelper<HttpServletRequest, HttpServletResponse> helper() {
return HELPER;
}
private Tomcat7Singletons() {}
}
| UTF-8 | Java | 1,346 | java | Tomcat7Singletons.java | Java | []
| null | []
| /*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.javaagent.instrumentation.tomcat.v7_0;
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
import io.opentelemetry.javaagent.instrumentation.servlet.v3_0.Servlet3Accessor;
import io.opentelemetry.javaagent.instrumentation.servlet.v3_0.Servlet3Singletons;
import io.opentelemetry.javaagent.instrumentation.tomcat.common.TomcatHelper;
import io.opentelemetry.javaagent.instrumentation.tomcat.common.TomcatInstrumenterFactory;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.coyote.Request;
import org.apache.coyote.Response;
public final class Tomcat7Singletons {
private static final String INSTRUMENTATION_NAME = "io.opentelemetry.tomcat-7.0";
private static final Instrumenter<Request, Response> INSTRUMENTER =
TomcatInstrumenterFactory.create(INSTRUMENTATION_NAME, Servlet3Accessor.INSTANCE);
private static final TomcatHelper<HttpServletRequest, HttpServletResponse> HELPER =
new TomcatHelper<>(
INSTRUMENTER, Tomcat7ServletEntityProvider.INSTANCE, Servlet3Singletons.helper());
public static TomcatHelper<HttpServletRequest, HttpServletResponse> helper() {
return HELPER;
}
private Tomcat7Singletons() {}
}
| 1,346 | 0.820951 | 0.808321 | 31 | 42.419353 | 33.329998 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.645161 | false | false | 10 |
20fb315fe95bcc7b206c4ae9781cf2277342d75f | 6,794,638,310,944 | df946526795a19c7f46e6c5085440e9d439a3ce1 | /inventory/src/main/java/com/benjaminrperry/inventory/repository/InventoryTransactionRepository.java | 96a0e9c60aaab1f5502c369018522d28bb9074a9 | []
| no_license | morimizu/inventory | https://github.com/morimizu/inventory | 950ebf5223419db37eefc92a9d014ee16a460035 | 1e39422d7ccbaaeae8bf806b30057e8d81626215 | refs/heads/master | 2023-02-24T21:26:26.635000 | 2021-01-31T16:44:43 | 2021-01-31T16:44:43 | 334,700,851 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.benjaminrperry.inventory.repository;
import com.benjaminrperry.inventory.domain.InventoryTransaction;
import com.benjaminrperry.inventory.dto.InventoryRecordDto;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
public interface InventoryTransactionRepository extends JpaRepository<InventoryTransaction,Long> {
@Query("Select new ")
List<InventoryRecordDto> getUserInventory(Long userId);
}
| UTF-8 | Java | 503 | java | InventoryTransactionRepository.java | Java | [
{
"context": "package com.benjaminrperry.inventory.repository;\n\nimport com.benjaminrperry.",
"end": 26,
"score": 0.7816567420959473,
"start": 12,
"tag": "USERNAME",
"value": "benjaminrperry"
},
{
"context": ".benjaminrperry.inventory.repository;\n\nimport com.benjaminrperry.inventory.domain.InventoryTransaction;\nimport com",
"end": 75,
"score": 0.925040602684021,
"start": 61,
"tag": "USERNAME",
"value": "benjaminrperry"
},
{
"context": "inventory.domain.InventoryTransaction;\nimport com.benjaminrperry.inventory.dto.InventoryRecordDto;\nimport org.spri",
"end": 140,
"score": 0.900855541229248,
"start": 126,
"tag": "USERNAME",
"value": "benjaminrperry"
}
]
| null | []
| package com.benjaminrperry.inventory.repository;
import com.benjaminrperry.inventory.domain.InventoryTransaction;
import com.benjaminrperry.inventory.dto.InventoryRecordDto;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
public interface InventoryTransactionRepository extends JpaRepository<InventoryTransaction,Long> {
@Query("Select new ")
List<InventoryRecordDto> getUserInventory(Long userId);
}
| 503 | 0.840954 | 0.840954 | 13 | 37.692307 | 30.554831 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.615385 | false | false | 10 |
769059f786aa7c324d215a0e4119f772c8ed03f1 | 19,241,453,536,158 | 4850a3ae87e314d5eafdd627c515db16e873d6ff | /p19.java | 64166a6a03e4877763bdd9fafec904055d88c6d6 | []
| no_license | amoriqbal/EasyJavaPrograms | https://github.com/amoriqbal/EasyJavaPrograms | 15ed75317429cac78d13a001b6ce7301b8f4b55e | 559736548a22a20fcda9d83c0963f68a07cacaad | refs/heads/master | 2022-12-13T07:57:34.238000 | 2020-09-20T09:37:02 | 2020-09-20T09:37:02 | 297,043,909 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.*;
public class p19 {
public static void main(String[] args){
int r,c;
Scanner sc=new Scanner(System.in);
System.out.println("Enter the number of rows and columns in first matrix");
r=sc.nextInt();
c=sc.nextInt();
Matrix a=new Matrix(r,c);
a.acceptVals();
System.out.println("Enter the number of rows and columns in second matrix");
r=sc.nextInt();
c=sc.nextInt();
Matrix b=new Matrix(r,c);
b.acceptVals();
Matrix z=Matrix.mult(a,b);
z.display();
}
}
class Matrix{
int rows,cols;
int vals[][];
public Matrix(int r, int c){
rows=r;
cols=c;
vals=new int[r][c];
}
public int[] size(){
int sz[]={rows,cols};
return sz;
}
public int[][] values(){
return vals;
}
public void acceptVals(){
Scanner sc=new Scanner(System.in);
System.out.println("Enter the values one by one.");
for(int i=0;i<rows;i++){
for(int j=0;j<cols;j++){
vals[i][j]=sc.nextInt();
}
}
}
public static Matrix mult(Matrix a, Matrix b){
int m,n,p,q;
m=a.size()[0];
n=a.size()[1];
p=b.size()[0];
q=b.size()[1];
Matrix res=new Matrix(m,q);
for(int i=0;i<m;i++){
for(int j=0;j<q;j++){
for(int k=0;k<n;k++){
res.values()[i][j]+=a.values()[i][k]*b.values()[k][j];
}
}
}
return res;
}
public void display(){
for(int i=0;i<rows;i++){
for(int j=0;j<cols;j++){
System.out.print(vals[i][j]+ "\t");
}
System.out.println();
}
}
}; | UTF-8 | Java | 1,827 | java | p19.java | Java | []
| null | []
| import java.util.*;
public class p19 {
public static void main(String[] args){
int r,c;
Scanner sc=new Scanner(System.in);
System.out.println("Enter the number of rows and columns in first matrix");
r=sc.nextInt();
c=sc.nextInt();
Matrix a=new Matrix(r,c);
a.acceptVals();
System.out.println("Enter the number of rows and columns in second matrix");
r=sc.nextInt();
c=sc.nextInt();
Matrix b=new Matrix(r,c);
b.acceptVals();
Matrix z=Matrix.mult(a,b);
z.display();
}
}
class Matrix{
int rows,cols;
int vals[][];
public Matrix(int r, int c){
rows=r;
cols=c;
vals=new int[r][c];
}
public int[] size(){
int sz[]={rows,cols};
return sz;
}
public int[][] values(){
return vals;
}
public void acceptVals(){
Scanner sc=new Scanner(System.in);
System.out.println("Enter the values one by one.");
for(int i=0;i<rows;i++){
for(int j=0;j<cols;j++){
vals[i][j]=sc.nextInt();
}
}
}
public static Matrix mult(Matrix a, Matrix b){
int m,n,p,q;
m=a.size()[0];
n=a.size()[1];
p=b.size()[0];
q=b.size()[1];
Matrix res=new Matrix(m,q);
for(int i=0;i<m;i++){
for(int j=0;j<q;j++){
for(int k=0;k<n;k++){
res.values()[i][j]+=a.values()[i][k]*b.values()[k][j];
}
}
}
return res;
}
public void display(){
for(int i=0;i<rows;i++){
for(int j=0;j<cols;j++){
System.out.print(vals[i][j]+ "\t");
}
System.out.println();
}
}
}; | 1,827 | 0.457581 | 0.450465 | 79 | 22.13924 | 18.06019 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.797468 | false | false | 10 |
30d5be5c56f8b2f4581b12a9ffd1b6cb8072ec4b | 26,774,826,140,442 | d7f50b57dfd5fa6b8b9514af43af601f66351d09 | /mavibotv2-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotRdnIndex.java | 4e8220e5a7fc1b72a9025509970e601ff6571a6d | [
"OLDAP-2.8",
"LicenseRef-scancode-jdbm-1.00",
"MIT",
"Apache-2.0",
"EPL-1.0",
"LicenseRef-scancode-ietf",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.1-only",
"ANTLR-PD",
"LicenseRef-scancode-unknown"
]
| permissive | apache/directory-server | https://github.com/apache/directory-server | 5c2b0e916c0c52b0a27b5e28aced98fd923715a2 | 6f1e16fe919307a8d6048c993ee26cb1796a8fbc | refs/heads/master | 2023-09-06T00:32:42.101000 | 2023-09-05T05:01:12 | 2023-09-05T05:01:12 | 206,437 | 125 | 97 | Apache-2.0 | false | 2023-09-12T06:10:21 | 2009-05-21T02:25:07 | 2023-09-07T03:48:12 | 2023-09-12T06:10:19 | 72,481 | 127 | 86 | 5 | 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.directory.server.core.partition.impl.btree.mavibot;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import org.apache.directory.api.ldap.model.schema.AttributeType;
import org.apache.directory.api.ldap.model.schema.MatchingRule;
import org.apache.directory.api.ldap.model.schema.SchemaManager;
import org.apache.directory.mavibot.btree.serializer.StringSerializer;
import org.apache.directory.server.constants.ApacheSchemaConstants;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.xdbm.ParentIdAndRdn;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* A special index which stores Rdn objects.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
public class MavibotRdnIndex extends MavibotIndex<ParentIdAndRdn>
{
/** A logger for this class */
private static final Logger LOG = LoggerFactory.getLogger( MavibotRdnIndex.class );
public MavibotRdnIndex()
{
super( ApacheSchemaConstants.APACHE_RDN_AT_OID, true );
initialized = false;
}
public void init( SchemaManager schemaManager, AttributeType attributeType ) throws IOException
{
LOG.debug( "Initializing an Index for attribute '{}'", attributeType.getName() );
this.attributeType = attributeType;
if ( attributeId == null )
{
setAttributeId( attributeType.getName() );
}
if ( this.wkDirPath == null )
{
NullPointerException e = new NullPointerException( "The index working directory has not be set" );
throw e;
}
String path = new File( this.wkDirPath, attributeType.getOid() ).getAbsolutePath();
try
{
initTables( schemaManager );
}
catch ( IOException e )
{
// clean up
close();
throw e;
}
// finally write a text file in the format <OID>-<attribute-name>.txt
FileWriter fw = new FileWriter( new File( path + "-" + attributeType.getName() + ".txt" ) );
// write the AttributeType description
fw.write( attributeType.toString() );
fw.close();
initialized = true;
}
/**
* Initializes the forward and reverse tables used by this Index.
*
* @param schemaManager The server schemaManager
* @throws IOException if we cannot initialize the forward and reverse
* tables
* @throws NamingException
*/
private void initTables( SchemaManager schemaManager ) throws IOException
{
MatchingRule mr = attributeType.getEquality();
if ( mr == null )
{
throw new IOException( I18n.err( I18n.ERR_574, attributeType.getName() ) );
}
MavibotParentIdAndRdnSerializer.setSchemaManager( schemaManager );
MavibotParentIdAndRdnSerializer parentIdAndSerializer = new MavibotParentIdAndRdnSerializer();
String forwardTableName = attributeType.getOid() + FORWARD_BTREE;
forward = new MavibotTable<ParentIdAndRdn, String>( recordMan, schemaManager, forwardTableName,
parentIdAndSerializer, StringSerializer.INSTANCE, false );
String reverseTableName = attributeType.getOid() + REVERSE_BTREE;
reverse = new MavibotTable<String, ParentIdAndRdn>( recordMan, schemaManager, reverseTableName,
StringSerializer.INSTANCE, parentIdAndSerializer, false );
}
}
| UTF-8 | Java | 4,337 | java | MavibotRdnIndex.java | Java | [
{
"context": "stores Rdn objects.\n *\n * @author <a href=\"mailto:dev@directory.apache.org\">Apache Directory Project</a>\n */\npublic class Ma",
"end": 1586,
"score": 0.9999298453330994,
"start": 1562,
"tag": "EMAIL",
"value": "dev@directory.apache.org"
}
]
| 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.directory.server.core.partition.impl.btree.mavibot;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import org.apache.directory.api.ldap.model.schema.AttributeType;
import org.apache.directory.api.ldap.model.schema.MatchingRule;
import org.apache.directory.api.ldap.model.schema.SchemaManager;
import org.apache.directory.mavibot.btree.serializer.StringSerializer;
import org.apache.directory.server.constants.ApacheSchemaConstants;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.xdbm.ParentIdAndRdn;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* A special index which stores Rdn objects.
*
* @author <a href="mailto:<EMAIL>">Apache Directory Project</a>
*/
public class MavibotRdnIndex extends MavibotIndex<ParentIdAndRdn>
{
/** A logger for this class */
private static final Logger LOG = LoggerFactory.getLogger( MavibotRdnIndex.class );
public MavibotRdnIndex()
{
super( ApacheSchemaConstants.APACHE_RDN_AT_OID, true );
initialized = false;
}
public void init( SchemaManager schemaManager, AttributeType attributeType ) throws IOException
{
LOG.debug( "Initializing an Index for attribute '{}'", attributeType.getName() );
this.attributeType = attributeType;
if ( attributeId == null )
{
setAttributeId( attributeType.getName() );
}
if ( this.wkDirPath == null )
{
NullPointerException e = new NullPointerException( "The index working directory has not be set" );
throw e;
}
String path = new File( this.wkDirPath, attributeType.getOid() ).getAbsolutePath();
try
{
initTables( schemaManager );
}
catch ( IOException e )
{
// clean up
close();
throw e;
}
// finally write a text file in the format <OID>-<attribute-name>.txt
FileWriter fw = new FileWriter( new File( path + "-" + attributeType.getName() + ".txt" ) );
// write the AttributeType description
fw.write( attributeType.toString() );
fw.close();
initialized = true;
}
/**
* Initializes the forward and reverse tables used by this Index.
*
* @param schemaManager The server schemaManager
* @throws IOException if we cannot initialize the forward and reverse
* tables
* @throws NamingException
*/
private void initTables( SchemaManager schemaManager ) throws IOException
{
MatchingRule mr = attributeType.getEquality();
if ( mr == null )
{
throw new IOException( I18n.err( I18n.ERR_574, attributeType.getName() ) );
}
MavibotParentIdAndRdnSerializer.setSchemaManager( schemaManager );
MavibotParentIdAndRdnSerializer parentIdAndSerializer = new MavibotParentIdAndRdnSerializer();
String forwardTableName = attributeType.getOid() + FORWARD_BTREE;
forward = new MavibotTable<ParentIdAndRdn, String>( recordMan, schemaManager, forwardTableName,
parentIdAndSerializer, StringSerializer.INSTANCE, false );
String reverseTableName = attributeType.getOid() + REVERSE_BTREE;
reverse = new MavibotTable<String, ParentIdAndRdn>( recordMan, schemaManager, reverseTableName,
StringSerializer.INSTANCE, parentIdAndSerializer, false );
}
}
| 4,320 | 0.684344 | 0.680424 | 126 | 33.420635 | 32.133736 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.468254 | false | false | 10 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.