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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cf300b64fd46b97881743f7cbb05b0cee481a1c1 | 20,693,152,436,005 | fc6c869ee0228497e41bf357e2803713cdaed63e | /weixin6519android1140/src/sourcecode/com/tencent/mm/plugin/appbrand/config/h.java | e13a29d1c3d7df23ce33fa43df496fe5460f5132 | [] | no_license | hyb1234hi/reverse-wechat | https://github.com/hyb1234hi/reverse-wechat | cbd26658a667b0c498d2a26a403f93dbeb270b72 | 75d3fd35a2c8a0469dbb057cd16bca3b26c7e736 | refs/heads/master | 2020-09-26T10:12:47.484000 | 2017-11-16T06:54:20 | 2017-11-16T06:54:20 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.tencent.mm.plugin.appbrand.config;
import com.tencent.gmtrace.GMTrace;
import com.tencent.mm.plugin.appbrand.app.e;
import com.tencent.mm.sdk.platformtools.w;
public enum h
{
static
{
GMTrace.i(10569914515456L, 78752);
hRj = new h[0];
GMTrace.o(10569914515456L, 78752);
}
public static int pl(String paramString)
{
GMTrace.i(10569780297728L, 78751);
WxaAttributes localWxaAttributes = e.Se().e(paramString, new String[] { "dynamicInfo" });
if (localWxaAttributes == null)
{
i = -1;
w.i("MicroMsg.AppServiceSettingMMManager", "readAppFileStorageMaxSizeInBytes, appId = %s, MaxLocalstorageSize = %d", new Object[] { paramString, Integer.valueOf(i) });
if (localWxaAttributes == null) {
break label95;
}
}
label95:
for (int i = localWxaAttributes.UE().hRR.hRT;; i = 5)
{
GMTrace.o(10569780297728L, 78751);
return i * 1048576;
i = localWxaAttributes.UE().hRR.hRT;
break;
}
}
}
/* Location: D:\tools\apktool\weixin6519android1140\jar\classes2-dex2jar.jar!\com\tencent\mm\plugin\appbrand\config\h.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | UTF-8 | Java | 1,215 | java | h.java | Java | [] | null | [] | package com.tencent.mm.plugin.appbrand.config;
import com.tencent.gmtrace.GMTrace;
import com.tencent.mm.plugin.appbrand.app.e;
import com.tencent.mm.sdk.platformtools.w;
public enum h
{
static
{
GMTrace.i(10569914515456L, 78752);
hRj = new h[0];
GMTrace.o(10569914515456L, 78752);
}
public static int pl(String paramString)
{
GMTrace.i(10569780297728L, 78751);
WxaAttributes localWxaAttributes = e.Se().e(paramString, new String[] { "dynamicInfo" });
if (localWxaAttributes == null)
{
i = -1;
w.i("MicroMsg.AppServiceSettingMMManager", "readAppFileStorageMaxSizeInBytes, appId = %s, MaxLocalstorageSize = %d", new Object[] { paramString, Integer.valueOf(i) });
if (localWxaAttributes == null) {
break label95;
}
}
label95:
for (int i = localWxaAttributes.UE().hRR.hRT;; i = 5)
{
GMTrace.o(10569780297728L, 78751);
return i * 1048576;
i = localWxaAttributes.UE().hRR.hRT;
break;
}
}
}
/* Location: D:\tools\apktool\weixin6519android1140\jar\classes2-dex2jar.jar!\com\tencent\mm\plugin\appbrand\config\h.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | 1,215 | 0.655144 | 0.567078 | 43 | 27.27907 | 34.79129 | 173 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.651163 | false | false | 3 |
041a4ef24dc75ac01d98528249e3d14564ba506c | 20,469,814,155,988 | 68755341aa6c0a81873df8e025be173057653cf4 | /src/bankelmaghrib/demandeAction.java | 619abdcae9a32814999a38795c5d703ff4820aec | [] | no_license | lemkhantar1/gestionnaire-tenues | https://github.com/lemkhantar1/gestionnaire-tenues | 6fdf741b929e2c02fdb124ed38dc072bdd676d85 | 1191c30e7ebcb822fd519587d3577ec0a0fd5bed | refs/heads/master | 2021-04-29T04:06:49.988000 | 2017-01-04T15:56:17 | 2017-01-04T15:56:17 | 78,029,860 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package bankelmaghrib;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.Vector;
import javax.servlet.http.HttpServletRequest;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.SessionAware;
import com.opensymphony.xwork2.ActionSupport;
import entities.*;
import freemarker.template.TemplateNumberModel;
import model.*;
import sun.management.resources.agent;
public class demandeAction extends ActionSupport implements ServletRequestAware, SessionAware {
private HttpServletRequest servletRequest;
private Map<String,Object> session ;
FileInputStream fileInputStream;
public FileInputStream getFileInputStream() {
return fileInputStream;
}
public void setFileInputStream(FileInputStream fileInputStream) {
this.fileInputStream = fileInputStream;
}
public Hashtable<String, Integer> getQperAgent() {
return QperAgent;
}
public void setQperAgent(Hashtable<String, Integer> qperAgent) {
QperAgent = qperAgent;
}
public HttpServletRequest getServletRequest() {
return servletRequest;
}
public Map<String, Object> getSession() {
return session;
}
Hashtable<String, Hashtable<String, Integer>> QperArticle;
Hashtable<String, Integer> QperAgent;
public Hashtable<String, Hashtable<String, Integer>> getQperArticle() {
return QperArticle;
}
public void setQperArticle(Hashtable<String, Hashtable<String, Integer>> qperArticle) {
QperArticle = qperArticle;
}
public String execute()
{
if(!session.containsKey("admin"))return "logout";
Vector<String> chaussures = new Vector<String>(Arrays.asList("ESPADRILLES","PAIRE DE SOQUETTES","SANDALES", "CHAUSSURE CLASSIQUE", "SABOTS"));
ArticleModel articleModel = new ArticleModel();
List<Article> articles = articleModel.findAll();
AgentModel agentModel = new AgentModel();
List<Agent> agents = agentModel.findAll();
QperArticle = new Hashtable<String, Hashtable<String, Integer>>();
for(int i=0; i<articles.size(); i++)
{
Article article = articles.get(i);
QperAgent = new Hashtable<>();
for(int k=0; k<agents.size(); k++)
{
Agent angent = agents.get(k);
Hashtable<String, Integer> articlesDuAgent = getArticlesAgent(angent);
if(articlesDuAgent.containsKey(article.getIntitule()))
{
Integer nouvelleQuantite = articlesDuAgent.get(article.getIntitule());
String taille;
if(chaussures.contains(article.getIntitule()))
taille = Integer.toString(angent.getMesure().getPointure());
else
taille = angent.getMesure().getTaille();
if(QperAgent.containsKey(taille))
{
Integer ancienneQuantite = QperAgent.get(taille);
QperAgent.put(taille, ancienneQuantite+nouvelleQuantite);
}
else
{
QperAgent.put(taille, nouvelleQuantite);
}
}
}
if(QperAgent.size()>0)
QperArticle.put(article.getIntitule(), QperAgent);
}
System.out.println(QperArticle);
session.put("commande", QperArticle);
return SUCCESS;
}
public Hashtable<String, Integer> getArticlesAgent(Agent agent)
{
PosteModel posteModel = new PosteModel();
String tenue = posteModel.find(agent.getPoste().getIntitule()).getTenue().getIntitule();
TenueArticleModel tenueArticleModel = new TenueArticleModel();
List<TenueArticle> relations = tenueArticleModel.findAll();
Hashtable<String, Integer> ArticlePerQuantite = new Hashtable<>();
for(int i=0; i<relations.size(); i++)
{
TenueArticle relation = relations.get(i);
if(tenue.equals(relation.getTenue().getIntitule()))
{
ArticlePerQuantite.put(relation.getArticle().getIntitule(), relation.getQuantite());
}
}
return ArticlePerQuantite;
}
public String downloadDemande() throws FileNotFoundException
{
if(!session.containsKey("admin"))return "logout";
File file;
String filePath = servletRequest.getSession().getServletContext().getRealPath("/")+"upload";
File folder = new File(filePath);
if(!folder.exists()){
folder.mkdir();
}
file = new File(filePath, "COMMANDE_ACHAT.XLSX.xlsx");
//Blank workbook
XSSFWorkbook workbook = new XSSFWorkbook();
//Create a blank sheet
XSSFSheet sheet = workbook.createSheet("COMMANDE_ACHAT");
XSSFCellStyle myStyle = workbook.createCellStyle();
//This data needs to be written (Object[])
Map<String, Object[]> data = new TreeMap<String, Object[]>();
data.put("1", new Object[] {"Article", "Taille/Pointure", "Quantite"});
Hashtable<String, Hashtable<String, Integer>> commande = (Hashtable<String, Hashtable<String, Integer>>) session.get("commande");
Set<String> articles = commande.keySet();
int i=10000;
for(String key1: articles)
{
data.put(i+"", new Object[] {key1,"----","----"});
i++;
Set<String> tailles = commande.get(key1).keySet();
for(String key2: tailles)
{
data.put(i+"", new Object[] {"",key2,commande.get(key1).get(key2)});
i++;
}
}
//Iterate over data and write to sheet
Set<String> keyset = data.keySet();
int rownum = 0;
for (String key : keyset)
{
Row row = sheet.createRow(rownum++);
if(rownum==0)row.setRowStyle(myStyle);
Object [] objArr = data.get(key);
int cellnum = 0;
for (Object obj : objArr)
{
Cell cell = row.createCell(cellnum++);
if(obj instanceof String)
cell.setCellValue((String)obj);
else if(obj instanceof Integer)
cell.setCellValue((Integer)obj);
}
}
try
{
//Write the workbook in file system
FileOutputStream out = new FileOutputStream(file);
workbook.write(out);
out.close();
}
catch (Exception e)
{
e.printStackTrace();
}
fileInputStream = new FileInputStream(file);
return SUCCESS;
}
@Override
public void setServletRequest(HttpServletRequest arg0) {
// TODO Auto-generated method stub
this.servletRequest = arg0;
}
@Override
public void setSession(Map<String, Object> arg0) {
// TODO Auto-generated method stub
this.session = arg0;
}
}
| UTF-8 | Java | 6,899 | java | demandeAction.java | Java | [] | null | [] | package bankelmaghrib;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.Vector;
import javax.servlet.http.HttpServletRequest;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.SessionAware;
import com.opensymphony.xwork2.ActionSupport;
import entities.*;
import freemarker.template.TemplateNumberModel;
import model.*;
import sun.management.resources.agent;
public class demandeAction extends ActionSupport implements ServletRequestAware, SessionAware {
private HttpServletRequest servletRequest;
private Map<String,Object> session ;
FileInputStream fileInputStream;
public FileInputStream getFileInputStream() {
return fileInputStream;
}
public void setFileInputStream(FileInputStream fileInputStream) {
this.fileInputStream = fileInputStream;
}
public Hashtable<String, Integer> getQperAgent() {
return QperAgent;
}
public void setQperAgent(Hashtable<String, Integer> qperAgent) {
QperAgent = qperAgent;
}
public HttpServletRequest getServletRequest() {
return servletRequest;
}
public Map<String, Object> getSession() {
return session;
}
Hashtable<String, Hashtable<String, Integer>> QperArticle;
Hashtable<String, Integer> QperAgent;
public Hashtable<String, Hashtable<String, Integer>> getQperArticle() {
return QperArticle;
}
public void setQperArticle(Hashtable<String, Hashtable<String, Integer>> qperArticle) {
QperArticle = qperArticle;
}
public String execute()
{
if(!session.containsKey("admin"))return "logout";
Vector<String> chaussures = new Vector<String>(Arrays.asList("ESPADRILLES","PAIRE DE SOQUETTES","SANDALES", "CHAUSSURE CLASSIQUE", "SABOTS"));
ArticleModel articleModel = new ArticleModel();
List<Article> articles = articleModel.findAll();
AgentModel agentModel = new AgentModel();
List<Agent> agents = agentModel.findAll();
QperArticle = new Hashtable<String, Hashtable<String, Integer>>();
for(int i=0; i<articles.size(); i++)
{
Article article = articles.get(i);
QperAgent = new Hashtable<>();
for(int k=0; k<agents.size(); k++)
{
Agent angent = agents.get(k);
Hashtable<String, Integer> articlesDuAgent = getArticlesAgent(angent);
if(articlesDuAgent.containsKey(article.getIntitule()))
{
Integer nouvelleQuantite = articlesDuAgent.get(article.getIntitule());
String taille;
if(chaussures.contains(article.getIntitule()))
taille = Integer.toString(angent.getMesure().getPointure());
else
taille = angent.getMesure().getTaille();
if(QperAgent.containsKey(taille))
{
Integer ancienneQuantite = QperAgent.get(taille);
QperAgent.put(taille, ancienneQuantite+nouvelleQuantite);
}
else
{
QperAgent.put(taille, nouvelleQuantite);
}
}
}
if(QperAgent.size()>0)
QperArticle.put(article.getIntitule(), QperAgent);
}
System.out.println(QperArticle);
session.put("commande", QperArticle);
return SUCCESS;
}
public Hashtable<String, Integer> getArticlesAgent(Agent agent)
{
PosteModel posteModel = new PosteModel();
String tenue = posteModel.find(agent.getPoste().getIntitule()).getTenue().getIntitule();
TenueArticleModel tenueArticleModel = new TenueArticleModel();
List<TenueArticle> relations = tenueArticleModel.findAll();
Hashtable<String, Integer> ArticlePerQuantite = new Hashtable<>();
for(int i=0; i<relations.size(); i++)
{
TenueArticle relation = relations.get(i);
if(tenue.equals(relation.getTenue().getIntitule()))
{
ArticlePerQuantite.put(relation.getArticle().getIntitule(), relation.getQuantite());
}
}
return ArticlePerQuantite;
}
public String downloadDemande() throws FileNotFoundException
{
if(!session.containsKey("admin"))return "logout";
File file;
String filePath = servletRequest.getSession().getServletContext().getRealPath("/")+"upload";
File folder = new File(filePath);
if(!folder.exists()){
folder.mkdir();
}
file = new File(filePath, "COMMANDE_ACHAT.XLSX.xlsx");
//Blank workbook
XSSFWorkbook workbook = new XSSFWorkbook();
//Create a blank sheet
XSSFSheet sheet = workbook.createSheet("COMMANDE_ACHAT");
XSSFCellStyle myStyle = workbook.createCellStyle();
//This data needs to be written (Object[])
Map<String, Object[]> data = new TreeMap<String, Object[]>();
data.put("1", new Object[] {"Article", "Taille/Pointure", "Quantite"});
Hashtable<String, Hashtable<String, Integer>> commande = (Hashtable<String, Hashtable<String, Integer>>) session.get("commande");
Set<String> articles = commande.keySet();
int i=10000;
for(String key1: articles)
{
data.put(i+"", new Object[] {key1,"----","----"});
i++;
Set<String> tailles = commande.get(key1).keySet();
for(String key2: tailles)
{
data.put(i+"", new Object[] {"",key2,commande.get(key1).get(key2)});
i++;
}
}
//Iterate over data and write to sheet
Set<String> keyset = data.keySet();
int rownum = 0;
for (String key : keyset)
{
Row row = sheet.createRow(rownum++);
if(rownum==0)row.setRowStyle(myStyle);
Object [] objArr = data.get(key);
int cellnum = 0;
for (Object obj : objArr)
{
Cell cell = row.createCell(cellnum++);
if(obj instanceof String)
cell.setCellValue((String)obj);
else if(obj instanceof Integer)
cell.setCellValue((Integer)obj);
}
}
try
{
//Write the workbook in file system
FileOutputStream out = new FileOutputStream(file);
workbook.write(out);
out.close();
}
catch (Exception e)
{
e.printStackTrace();
}
fileInputStream = new FileInputStream(file);
return SUCCESS;
}
@Override
public void setServletRequest(HttpServletRequest arg0) {
// TODO Auto-generated method stub
this.servletRequest = arg0;
}
@Override
public void setSession(Map<String, Object> arg0) {
// TODO Auto-generated method stub
this.session = arg0;
}
}
| 6,899 | 0.668938 | 0.665024 | 226 | 29.526548 | 25.985729 | 144 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2 | false | false | 3 |
67826ec9523df1d2f31a4eddc9e844bb48e46154 | 7,181,185,330,302 | dd5a31c0c69c70ac31f3c5f915ca57e5ce5492ce | /advancedfinalexam/src/model/Product.java | b3b73af5699ca328b5b52d846eb2e9253ad05141 | [] | no_license | yusufasln26/advanced-programming-final-exam | https://github.com/yusufasln26/advanced-programming-final-exam | bff15f2b4fbd36af48f0023d660e642587dd8cd7 | 36463d9edb18ad2d9523f0e5bda0e82e4a41d5f8 | refs/heads/master | 2020-03-19T05:41:15.615000 | 2018-06-04T01:00:26 | 2018-06-04T01:00:26 | 135,953,519 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package model;
import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
/**
* The persistent class for the product database table.
*
*/
@Entity
@NamedQuery(name="Product.findAll", query="SELECT p FROM Product p")
public class Product implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name="product_id")
private Integer productId;
private String available;
private String description;
@Column(name="manufacture_id")
private Integer manufactureId;
private String markup;
@Column(name="product_code")
private String productCode;
@Column(name="purchase_cost")
private String purchaseCost;
@Column(name="quantity_on_hand")
private String quantityOnHand;
public Product() {
}
public Integer getProductId() {
return this.productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
public String getAvailable() {
return this.available;
}
public void setAvailable(String available) {
this.available = available;
}
public String getDescription() {
return this.description;
}
public void setDescription(String description) {
this.description = description;
}
public Integer getManufactureId() {
return this.manufactureId;
}
public void setManufactureId(Integer manufactureId) {
this.manufactureId = manufactureId;
}
public String getMarkup() {
return this.markup;
}
public void setMarkup(String markup) {
this.markup = markup;
}
public String getProductCode() {
return this.productCode;
}
public void setProductCode(String productCode) {
this.productCode = productCode;
}
public String getPurchaseCost() {
return this.purchaseCost;
}
public void setPurchaseCost(String purchaseCost) {
this.purchaseCost = purchaseCost;
}
public String getQuantityOnHand() {
return this.quantityOnHand;
}
public void setQuantityOnHand(String quantityOnHand) {
this.quantityOnHand = quantityOnHand;
}
} | UTF-8 | Java | 1,982 | java | Product.java | Java | [] | null | [] | package model;
import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
/**
* The persistent class for the product database table.
*
*/
@Entity
@NamedQuery(name="Product.findAll", query="SELECT p FROM Product p")
public class Product implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name="product_id")
private Integer productId;
private String available;
private String description;
@Column(name="manufacture_id")
private Integer manufactureId;
private String markup;
@Column(name="product_code")
private String productCode;
@Column(name="purchase_cost")
private String purchaseCost;
@Column(name="quantity_on_hand")
private String quantityOnHand;
public Product() {
}
public Integer getProductId() {
return this.productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
public String getAvailable() {
return this.available;
}
public void setAvailable(String available) {
this.available = available;
}
public String getDescription() {
return this.description;
}
public void setDescription(String description) {
this.description = description;
}
public Integer getManufactureId() {
return this.manufactureId;
}
public void setManufactureId(Integer manufactureId) {
this.manufactureId = manufactureId;
}
public String getMarkup() {
return this.markup;
}
public void setMarkup(String markup) {
this.markup = markup;
}
public String getProductCode() {
return this.productCode;
}
public void setProductCode(String productCode) {
this.productCode = productCode;
}
public String getPurchaseCost() {
return this.purchaseCost;
}
public void setPurchaseCost(String purchaseCost) {
this.purchaseCost = purchaseCost;
}
public String getQuantityOnHand() {
return this.quantityOnHand;
}
public void setQuantityOnHand(String quantityOnHand) {
this.quantityOnHand = quantityOnHand;
}
} | 1,982 | 0.74218 | 0.741675 | 110 | 17.027273 | 17.909094 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.036364 | false | false | 3 |
1a65e0eb808312755a01ad4bfcff24daf7461d64 | 22,239,340,690,633 | 259a5175ea41db309d5ab03389c1c331e8414c51 | /app/src/main/java/com/rpgapp/devapp/rpgapp/Screens/AdventureDetails/PlayersTab/CharactersAdapter.java | 6c2948b83a0b1cd6296feb4c749e6106299444f2 | [] | no_license | herculesS/RPGapp | https://github.com/herculesS/RPGapp | 863644e021d04e98b160b93d904e28196043b93b | 9f0222ca74afba220da6c1fc4056c3293f04d427 | refs/heads/master | 2020-03-28T06:16:08.730000 | 2018-11-30T12:24:31 | 2018-11-30T12:24:31 | 147,824,071 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.rpgapp.devapp.rpgapp.Screens.AdventureDetails.PlayersTab;
import android.media.Image;
import android.support.annotation.NonNull;
import android.support.v4.app.FragmentManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.firestore.CollectionReference;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.FirebaseFirestore;
import com.rpgapp.devapp.rpgapp.MainActivity;
import com.rpgapp.devapp.rpgapp.Model.Adventure;
import com.rpgapp.devapp.rpgapp.Model.Character;
import com.rpgapp.devapp.rpgapp.Model.User;
import com.rpgapp.devapp.rpgapp.R;
import com.rpgapp.devapp.rpgapp.Screens.AddAttack.AddAttackFragment;
import java.util.ArrayList;
public class CharactersAdapter extends RecyclerView.Adapter<CharactersAdapter.ViewHolder> {
private ArrayList<Character> mCharacters;
private FragmentManager mFragmentManager;
private MainActivity mMainActivity;
private Adventure mAdventure;
public CharactersAdapter(ArrayList<Character> characters, FragmentManager fragmentManager, MainActivity mainActivity, Adventure adventure) {
mCharacters = characters;
mFragmentManager = fragmentManager;
mMainActivity = mainActivity;
mAdventure = adventure;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.characters_list_item, parent, false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, final int position) {
holder.mCharacterName.setText(mCharacters.get(position).getName());
final TextView playerName = holder.mPlayerName;
final View addButton = holder.mAddAttack;
CollectionReference usersCollection = FirebaseFirestore.getInstance().collection("Users");
final User CurrentUser = mMainActivity.getCurrentUser();
usersCollection
.document(mCharacters.get(position).getUserId())
.get()
.addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
@Override
public void onComplete(@NonNull Task<DocumentSnapshot> task) {
if(task.isSuccessful()) {
DocumentSnapshot document = task.getResult();
if(document != null) {
User user = document.toObject(User.class);
playerName.setText(user.getName());
notifyDataSetChanged();
}
} else {
playerName.setText("NO NAME!");
}
}
});
}
@Override
public int getItemCount() {
return mCharacters != null ? mCharacters.size() : 0;
}
public class ViewHolder extends RecyclerView.ViewHolder {
public View mItemView;
public ImageView mAddAttack;
public TextView mCharacterName;
public TextView mPlayerName;
public ViewHolder(View itemView) {
super(itemView);
mCharacterName = itemView.findViewById(R.id.text_view_character_name);
mPlayerName = itemView.findViewById(R.id.text_view_player_name);
mAddAttack = itemView.findViewById(R.id.add_attack);
mItemView = itemView;
}
}
}
| UTF-8 | Java | 3,927 | java | CharactersAdapter.java | Java | [] | null | [] | package com.rpgapp.devapp.rpgapp.Screens.AdventureDetails.PlayersTab;
import android.media.Image;
import android.support.annotation.NonNull;
import android.support.v4.app.FragmentManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.firestore.CollectionReference;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.FirebaseFirestore;
import com.rpgapp.devapp.rpgapp.MainActivity;
import com.rpgapp.devapp.rpgapp.Model.Adventure;
import com.rpgapp.devapp.rpgapp.Model.Character;
import com.rpgapp.devapp.rpgapp.Model.User;
import com.rpgapp.devapp.rpgapp.R;
import com.rpgapp.devapp.rpgapp.Screens.AddAttack.AddAttackFragment;
import java.util.ArrayList;
public class CharactersAdapter extends RecyclerView.Adapter<CharactersAdapter.ViewHolder> {
private ArrayList<Character> mCharacters;
private FragmentManager mFragmentManager;
private MainActivity mMainActivity;
private Adventure mAdventure;
public CharactersAdapter(ArrayList<Character> characters, FragmentManager fragmentManager, MainActivity mainActivity, Adventure adventure) {
mCharacters = characters;
mFragmentManager = fragmentManager;
mMainActivity = mainActivity;
mAdventure = adventure;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.characters_list_item, parent, false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, final int position) {
holder.mCharacterName.setText(mCharacters.get(position).getName());
final TextView playerName = holder.mPlayerName;
final View addButton = holder.mAddAttack;
CollectionReference usersCollection = FirebaseFirestore.getInstance().collection("Users");
final User CurrentUser = mMainActivity.getCurrentUser();
usersCollection
.document(mCharacters.get(position).getUserId())
.get()
.addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
@Override
public void onComplete(@NonNull Task<DocumentSnapshot> task) {
if(task.isSuccessful()) {
DocumentSnapshot document = task.getResult();
if(document != null) {
User user = document.toObject(User.class);
playerName.setText(user.getName());
notifyDataSetChanged();
}
} else {
playerName.setText("NO NAME!");
}
}
});
}
@Override
public int getItemCount() {
return mCharacters != null ? mCharacters.size() : 0;
}
public class ViewHolder extends RecyclerView.ViewHolder {
public View mItemView;
public ImageView mAddAttack;
public TextView mCharacterName;
public TextView mPlayerName;
public ViewHolder(View itemView) {
super(itemView);
mCharacterName = itemView.findViewById(R.id.text_view_character_name);
mPlayerName = itemView.findViewById(R.id.text_view_player_name);
mAddAttack = itemView.findViewById(R.id.add_attack);
mItemView = itemView;
}
}
}
| 3,927 | 0.67176 | 0.670996 | 99 | 38.666668 | 27.247093 | 144 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.636364 | false | false | 3 |
9b2be9dfcb498aa255ef611a0f4b519c1c11d01b | 25,649,544,736,866 | b8f531f2f49c142ce293388053bf341a0b66f615 | /atsd-jdbc/src/main/java/com/axibase/tsd/driver/jdbc/enums/MetricColumn.java | a6b1b167ca0e28fbea2986f7485f5d1e1bd27ce9 | [
"Apache-2.0"
] | permissive | axibase/atsd-jdbc | https://github.com/axibase/atsd-jdbc | d97b0ce20827611e08d2660f3c3329f05b91676e | 29336f61a98fcc597aef06650f64a36bf00e6108 | refs/heads/master | 2022-11-30T00:29:43.981000 | 2021-10-30T14:56:09 | 2021-10-30T14:56:09 | 49,562,317 | 10 | 7 | Apache-2.0 | false | 2022-11-15T23:51:14 | 2016-01-13T09:06:00 | 2021-10-30T14:56:12 | 2022-11-15T23:51:09 | 18,873 | 6 | 4 | 4 | Java | false | false | package com.axibase.tsd.driver.jdbc.enums;
import com.axibase.tsd.driver.jdbc.intf.MetadataColumnDefinition;
import com.axibase.tsd.driver.jdbc.util.AtsdColumn;
import lombok.Getter;
import org.apache.commons.lang3.ArrayUtils;
import static com.axibase.tsd.driver.jdbc.enums.AtsdType.*;
@Getter
public enum MetricColumn implements MetadataColumnDefinition {
CREATION_TIME(AtsdColumn.METRIC_CREATION_TIME, BIGINT_DATA_TYPE),
DATA_TYPE(AtsdColumn.METRIC_DATA_TYPE, STRING_DATA_TYPE),
DESCRIPTION(AtsdColumn.METRIC_DESCRIPTION, STRING_DATA_TYPE),
ENABLED(AtsdColumn.METRIC_ENABLED, BOOLEAN_DATA_TYPE),
FILTER(AtsdColumn.METRIC_FILTER, STRING_DATA_TYPE),
INTERPOLATE(AtsdColumn.METRIC_INTERPOLATE, STRING_DATA_TYPE),
INVALID_VALUE_ACTION(AtsdColumn.METRIC_INVALID_VALUE_ACTION, STRING_DATA_TYPE),
LABEL(AtsdColumn.METRIC_LABEL, STRING_DATA_TYPE),
LAST_INSERT_TIME(AtsdColumn.METRIC_LAST_INSERT_TIME, BIGINT_DATA_TYPE),
MAX_VALUE(AtsdColumn.METRIC_MAX_VALUE, DOUBLE_DATA_TYPE),
MIN_VALUE(AtsdColumn.METRIC_MIN_VALUE, DOUBLE_DATA_TYPE),
NAME(AtsdColumn.METRIC_NAME, STRING_DATA_TYPE),
PERSISTENT(AtsdColumn.METRIC_PERSISTENT, BOOLEAN_DATA_TYPE),
RETENTION_INTERVAL_DAYS(AtsdColumn.METRIC_RETENTION_INTERVAL_DAYS, INTEGER_DATA_TYPE),
TAGS(AtsdColumn.METRIC_TAGS, STRING_DATA_TYPE),
TIME_ZONE(AtsdColumn.METRIC_TIME_ZONE, STRING_DATA_TYPE),
VERSIONING(AtsdColumn.METRIC_VERSIONING, BOOLEAN_DATA_TYPE),
UNITS(AtsdColumn.METRIC_UNITS, STRING_DATA_TYPE);
private final String columnNamePrefix;
private final AtsdType type;
private final int nullable = 1;
private final boolean metaColumn = true;
MetricColumn(String prefix, AtsdType type) {
this.columnNamePrefix = prefix;
this.type = type;
}
private static final int PREFIX_LENGTH = "metric.".length();
@Override
public String getNullableAsString() {
return NULLABLE_AS_STRING[nullable];
}
@Override
public AtsdType getType(AtsdType metricType) {
return type;
}
@Override
public String getShortColumnNamePrefix() {
return columnNamePrefix.substring(PREFIX_LENGTH);
}
public static MetricColumn[] values(boolean withCreationTime) {
final MetricColumn[] values = MetricColumn.values();
return withCreationTime ? values : ArrayUtils.removeElements(values, CREATION_TIME);
}
} | UTF-8 | Java | 2,423 | java | MetricColumn.java | Java | [] | null | [] | package com.axibase.tsd.driver.jdbc.enums;
import com.axibase.tsd.driver.jdbc.intf.MetadataColumnDefinition;
import com.axibase.tsd.driver.jdbc.util.AtsdColumn;
import lombok.Getter;
import org.apache.commons.lang3.ArrayUtils;
import static com.axibase.tsd.driver.jdbc.enums.AtsdType.*;
@Getter
public enum MetricColumn implements MetadataColumnDefinition {
CREATION_TIME(AtsdColumn.METRIC_CREATION_TIME, BIGINT_DATA_TYPE),
DATA_TYPE(AtsdColumn.METRIC_DATA_TYPE, STRING_DATA_TYPE),
DESCRIPTION(AtsdColumn.METRIC_DESCRIPTION, STRING_DATA_TYPE),
ENABLED(AtsdColumn.METRIC_ENABLED, BOOLEAN_DATA_TYPE),
FILTER(AtsdColumn.METRIC_FILTER, STRING_DATA_TYPE),
INTERPOLATE(AtsdColumn.METRIC_INTERPOLATE, STRING_DATA_TYPE),
INVALID_VALUE_ACTION(AtsdColumn.METRIC_INVALID_VALUE_ACTION, STRING_DATA_TYPE),
LABEL(AtsdColumn.METRIC_LABEL, STRING_DATA_TYPE),
LAST_INSERT_TIME(AtsdColumn.METRIC_LAST_INSERT_TIME, BIGINT_DATA_TYPE),
MAX_VALUE(AtsdColumn.METRIC_MAX_VALUE, DOUBLE_DATA_TYPE),
MIN_VALUE(AtsdColumn.METRIC_MIN_VALUE, DOUBLE_DATA_TYPE),
NAME(AtsdColumn.METRIC_NAME, STRING_DATA_TYPE),
PERSISTENT(AtsdColumn.METRIC_PERSISTENT, BOOLEAN_DATA_TYPE),
RETENTION_INTERVAL_DAYS(AtsdColumn.METRIC_RETENTION_INTERVAL_DAYS, INTEGER_DATA_TYPE),
TAGS(AtsdColumn.METRIC_TAGS, STRING_DATA_TYPE),
TIME_ZONE(AtsdColumn.METRIC_TIME_ZONE, STRING_DATA_TYPE),
VERSIONING(AtsdColumn.METRIC_VERSIONING, BOOLEAN_DATA_TYPE),
UNITS(AtsdColumn.METRIC_UNITS, STRING_DATA_TYPE);
private final String columnNamePrefix;
private final AtsdType type;
private final int nullable = 1;
private final boolean metaColumn = true;
MetricColumn(String prefix, AtsdType type) {
this.columnNamePrefix = prefix;
this.type = type;
}
private static final int PREFIX_LENGTH = "metric.".length();
@Override
public String getNullableAsString() {
return NULLABLE_AS_STRING[nullable];
}
@Override
public AtsdType getType(AtsdType metricType) {
return type;
}
@Override
public String getShortColumnNamePrefix() {
return columnNamePrefix.substring(PREFIX_LENGTH);
}
public static MetricColumn[] values(boolean withCreationTime) {
final MetricColumn[] values = MetricColumn.values();
return withCreationTime ? values : ArrayUtils.removeElements(values, CREATION_TIME);
}
} | 2,423 | 0.740817 | 0.739992 | 63 | 37.476189 | 27.442787 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.888889 | false | false | 3 |
1ab2efc0d4bb9e05b77eaf697382c65bd9a967cb | 9,878,424,814,158 | 64653e8a5527ebaa51bce91993fada9b8458db3b | /src/main/java/com/besd/InventoryManagement/repository/CustomerRepository.java | 6d0f609856cd899b7e907d844cc21f1f3f8a50b0 | [] | no_license | MattShortle96/SpringBoot-Week2 | https://github.com/MattShortle96/SpringBoot-Week2 | 87cc306fc81e1d5141ef47adc142e772e2bac541 | f909a485a4e14f314ead15cec5be6ecb1b52e8e5 | refs/heads/master | 2023-01-23T17:27:06.573000 | 2020-11-29T04:00:20 | 2020-11-29T04:00:20 | 316,871,875 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.besd.InventoryManagement.repository;
import org.springframework.data.repository.CrudRepository;
import com.besd.InventoryManagement.entity.Customer;
public interface CustomerRepository extends CrudRepository<Customer, Long>{
}
| UTF-8 | Java | 243 | java | CustomerRepository.java | Java | [] | null | [] | package com.besd.InventoryManagement.repository;
import org.springframework.data.repository.CrudRepository;
import com.besd.InventoryManagement.entity.Customer;
public interface CustomerRepository extends CrudRepository<Customer, Long>{
}
| 243 | 0.851852 | 0.851852 | 9 | 26 | 29.653555 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false | 3 |
d7813f8daf0a92173be106a111c86e9c07201e6f | 128,849,060,433 | b1d77f8abb81463ca26595391ede4cea8ea711c4 | /src/Yinh/Test.java | 8dafcc7d30dee98861b23ab1d01d9858cc0fa800 | [] | no_license | Caichanghe/Ch | https://github.com/Caichanghe/Ch | a89d0828c40710acde01c145d9645e29ff403627 | c00d993b1f2799f766479bb3aadb1f01fa8441e0 | refs/heads/master | 2023-04-07T07:25:18.355000 | 2021-04-20T09:45:35 | 2021-04-20T09:45:35 | 359,761,140 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Yinh;
public class Test {
public static void main(String[] args) {
Bank a=new Bank();
Person1 p1=new Person1(a);
Person2 p2=new Person2(a);
Thread t1=new Thread(p1);
Thread t2=new Thread(p2);
t1.start();
t2.start();
}
}
| UTF-8 | Java | 294 | java | Test.java | Java | [] | null | [] | package Yinh;
public class Test {
public static void main(String[] args) {
Bank a=new Bank();
Person1 p1=new Person1(a);
Person2 p2=new Person2(a);
Thread t1=new Thread(p1);
Thread t2=new Thread(p2);
t1.start();
t2.start();
}
}
| 294 | 0.544218 | 0.503401 | 14 | 20 | 14.091537 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.571429 | false | false | 3 |
d3d1b32e4664a1c4a794334bf2c923cf048d1678 | 31,593,779,471,076 | 06ed59464af5eb4626597e62538a6b3a13e7420d | /app/src/main/java/com/zzz/easyshare/api/URL.java | 1f89dedc065eb7047376169ff0bc02e62ae740ec | [] | no_license | smilEdit/EShareeee | https://github.com/smilEdit/EShareeee | 66e1d59d0e2cd55f73a0674bfcf2c956daac80d9 | f9d84513c3f26128f43ff302882f438192bdffa4 | refs/heads/master | 2020-09-14T16:50:57.442000 | 2016-10-08T03:36:55 | 2016-10-08T03:36:55 | 67,116,322 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.zzz.easyshare.api;
/**
* @创建者 zzz
* @创建时间 2016/8/19 15:27
*/
public class URL {
public static final String url = "http://gank.io/api/data/";
}
| UTF-8 | Java | 177 | java | URL.java | Java | [
{
"context": "package com.zzz.easyshare.api;\n\n/**\n * @创建者 zzz\n * @创建时间 2016/8/19 15:27\n */\npublic class URL {\n ",
"end": 47,
"score": 0.9995860457420349,
"start": 44,
"tag": "USERNAME",
"value": "zzz"
}
] | null | [] | package com.zzz.easyshare.api;
/**
* @创建者 zzz
* @创建时间 2016/8/19 15:27
*/
public class URL {
public static final String url = "http://gank.io/api/data/";
}
| 177 | 0.631902 | 0.564417 | 9 | 17.111111 | 19.439047 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.222222 | false | false | 3 |
2dbc940c22edfe0c975ceecd19e8e7209e43111a | 24,730,421,724,415 | b43ad63f93b665bd8783392104ad5b77a8e052ef | /src/main/java/com/techstack/gcmm/repository/CollateralRepository.java | db6abb4acdfed8b253a7b3da912f53bde52f065a | [
"MIT"
] | permissive | karthikeyan-ng/gcmm | https://github.com/karthikeyan-ng/gcmm | 53ec00e3ddc182190b5619d813c97ca33c96dd19 | 024c62efbd47857f274acf407c446eceb5fe0a63 | refs/heads/master | 2021-02-08T19:40:28.845000 | 2020-03-01T17:50:21 | 2020-03-01T17:50:21 | 244,189,362 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.techstack.gcmm.repository;
import com.techstack.gcmm.controller.api.PurchaseOrderInfo;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
/**
*
* This class stores each PurchaseOrderInfo in it's local in-memory data store.
* Based on various business usecase, retrieval of data is possible
*
* @author Karthikeyan N
*
*/
public interface CollateralRepository {
/**
* Save the given PurchaseOrderInfo in to in memory data store
*
* @param purchaseOrderInfo
*/
void save(PurchaseOrderInfo purchaseOrderInfo);
/**
* Get all the available Map Entries
*
* @return Map of LocalDateTime as Key and PurchaseOrderInfo as Value
*/
Map<LocalDateTime, PurchaseOrderInfo> getTransactions();
/**
* This method fetches last 30 minutes records from in-memory data store.
*
* @return List of PurchaseOrderInfo
*/
List<PurchaseOrderInfo> findLatestTransactionWithinLast30Minutes();
} | UTF-8 | Java | 952 | java | CollateralRepository.java | Java | [
{
"context": "case, retrieval of data is possible\n * \n * @author Karthikeyan N\n *\n */\npublic interface CollateralRepository {\n\n\t",
"end": 363,
"score": 0.9997853636741638,
"start": 350,
"tag": "NAME",
"value": "Karthikeyan N"
}
] | null | [] | package com.techstack.gcmm.repository;
import com.techstack.gcmm.controller.api.PurchaseOrderInfo;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
/**
*
* This class stores each PurchaseOrderInfo in it's local in-memory data store.
* Based on various business usecase, retrieval of data is possible
*
* @author <NAME>
*
*/
public interface CollateralRepository {
/**
* Save the given PurchaseOrderInfo in to in memory data store
*
* @param purchaseOrderInfo
*/
void save(PurchaseOrderInfo purchaseOrderInfo);
/**
* Get all the available Map Entries
*
* @return Map of LocalDateTime as Key and PurchaseOrderInfo as Value
*/
Map<LocalDateTime, PurchaseOrderInfo> getTransactions();
/**
* This method fetches last 30 minutes records from in-memory data store.
*
* @return List of PurchaseOrderInfo
*/
List<PurchaseOrderInfo> findLatestTransactionWithinLast30Minutes();
} | 945 | 0.746849 | 0.742647 | 40 | 22.825001 | 25.994122 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.7 | false | false | 3 |
eeff81e99f58c7a07fb953efdf7361d4ab05d576 | 14,405,320,348,512 | 9a7bd8acc42b2e411acd2baaefed52bfcf7c84b6 | /service-panel/src/main/java/com/exact/service/panel/service/clases/FooterService.java | 02487519397e776dede946964a418dcaff6fe494 | [] | no_license | RonaldSantosR/service-panel | https://github.com/RonaldSantosR/service-panel | 0b1098acf0dcd29a42800ea6d219e5429255b6bd | ced2d7cb84d28079d5ae62ccb88c7c4c9c1f24a9 | refs/heads/master | 2021-06-18T09:41:31.797000 | 2019-09-19T16:37:52 | 2019-09-19T16:37:52 | 202,572,462 | 0 | 0 | null | false | 2021-04-26T19:27:44 | 2019-08-15T16:07:45 | 2019-09-19T16:37:55 | 2021-04-26T19:27:44 | 176 | 0 | 0 | 1 | Java | false | false | package com.exact.service.panel.service.clases;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.exact.service.panel.dao.IFooterDao;
import com.exact.service.panel.entity.Footer;
import com.exact.service.panel.service.interfaces.IFooterService;
@Service
public class FooterService implements IFooterService{
@Autowired
IFooterDao footerDao;
@Value("${ruta.logos}")
String rutaLogo;
@Override
public Iterable<Footer> listarFooter() {
return footerDao.findAll();
}
@Override
public String modificarFooter(Footer footer) {
Optional<Footer> footerOpt = footerDao.findById(footer.getId());
if(!footerOpt.isPresent()) {
return "No se encontró el footer";
}
Footer footerActualizado = footerOpt.get();
if(footer.getDescripcion()!=null) {
footerActualizado.setDescripcion(footer.getDescripcion());
}
if(footer.getColor()!=null) {
footerActualizado.setColor(footer.getColor());
}
if(footer.getColorDescripcion()!=null) {
footerActualizado.setColorDescripcion(footer.getColorDescripcion());
}
if(footer.getLogo()!=null) {
footerActualizado.setLogo(rutaLogo+footer.getLogo());
}
footerDao.save(footerActualizado);
return "Se modificó el footer";
}
}
| UTF-8 | Java | 1,423 | java | FooterService.java | Java | [] | null | [] | package com.exact.service.panel.service.clases;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.exact.service.panel.dao.IFooterDao;
import com.exact.service.panel.entity.Footer;
import com.exact.service.panel.service.interfaces.IFooterService;
@Service
public class FooterService implements IFooterService{
@Autowired
IFooterDao footerDao;
@Value("${ruta.logos}")
String rutaLogo;
@Override
public Iterable<Footer> listarFooter() {
return footerDao.findAll();
}
@Override
public String modificarFooter(Footer footer) {
Optional<Footer> footerOpt = footerDao.findById(footer.getId());
if(!footerOpt.isPresent()) {
return "No se encontró el footer";
}
Footer footerActualizado = footerOpt.get();
if(footer.getDescripcion()!=null) {
footerActualizado.setDescripcion(footer.getDescripcion());
}
if(footer.getColor()!=null) {
footerActualizado.setColor(footer.getColor());
}
if(footer.getColorDescripcion()!=null) {
footerActualizado.setColorDescripcion(footer.getColorDescripcion());
}
if(footer.getLogo()!=null) {
footerActualizado.setLogo(rutaLogo+footer.getLogo());
}
footerDao.save(footerActualizado);
return "Se modificó el footer";
}
}
| 1,423 | 0.732583 | 0.732583 | 52 | 25.326923 | 22.738243 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.557692 | false | false | 3 |
0789b89277e14905af819a24307ced0904a38171 | 27,152,783,278,205 | 289d8c61601119632736c3fa8c6190be8d83881d | /src/test/java/com/testinium/testiniumAssesment/controller/BookControllerTest.java | 49a3063978e46afcbd2200dc5034e0f4e87fba0b | [] | no_license | ibrahimuzug/testiniumHomework | https://github.com/ibrahimuzug/testiniumHomework | 5eb89bfe720c9d360ad3bb857f526df00b163242 | eefe8ec1185709fb449369307736c98ab6c20472 | refs/heads/master | 2021-01-08T00:39:17.062000 | 2020-02-20T22:50:21 | 2020-02-20T22:50:21 | 241,864,129 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.testinium.testiniumAssesment.controller;
import com.testinium.testiniumAssesment.dto.BookDto;
import com.testinium.testiniumAssesment.service.BookService;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import java.util.Optional;
import static org.mockito.Mockito.when;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@AutoConfigureMockMvc
class BookControllerTest {
@Autowired
private MockMvc mockMvc;
@Autowired
private BookService bookService;
@Test
void getBookById() throws Exception {
BookDto bookDto = new BookDto();
bookDto.setName("Ölü Canlar");
bookDto.setCategory("Klasik Roman");
bookDto.setBookStore("Doğuş Yayınevi");
bookDto.setPrice(12.5);
when(bookService.getBookById(1)).thenReturn(Optional.of(bookDto));
mockMvc.perform(MockMvcRequestBuilders
.get("/book/{id}", 1)
.accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultHandlers.print())
.andExpect(MockMvcResultMatchers.status().isOk())
.andExpect(MockMvcResultMatchers.content().string(""));
}
@Test
void createBook() {
}
} | UTF-8 | Java | 1,864 | java | BookControllerTest.java | Java | [
{
"context": "bookDto = new BookDto();\n bookDto.setName(\"Ölü Canlar\");\n bookDto.setCategory(\"Klasik Roman\");\n ",
"end": 1276,
"score": 0.9666094183921814,
"start": 1266,
"tag": "NAME",
"value": "Ölü Canlar"
}
] | null | [] | package com.testinium.testiniumAssesment.controller;
import com.testinium.testiniumAssesment.dto.BookDto;
import com.testinium.testiniumAssesment.service.BookService;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import java.util.Optional;
import static org.mockito.Mockito.when;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@AutoConfigureMockMvc
class BookControllerTest {
@Autowired
private MockMvc mockMvc;
@Autowired
private BookService bookService;
@Test
void getBookById() throws Exception {
BookDto bookDto = new BookDto();
bookDto.setName("<NAME>");
bookDto.setCategory("Klasik Roman");
bookDto.setBookStore("Doğuş Yayınevi");
bookDto.setPrice(12.5);
when(bookService.getBookById(1)).thenReturn(Optional.of(bookDto));
mockMvc.perform(MockMvcRequestBuilders
.get("/book/{id}", 1)
.accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultHandlers.print())
.andExpect(MockMvcResultMatchers.status().isOk())
.andExpect(MockMvcResultMatchers.content().string(""));
}
@Test
void createBook() {
}
} | 1,858 | 0.750403 | 0.747176 | 51 | 35.470589 | 25.197536 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.509804 | false | false | 3 |
41e631e43ff774bdc039491160cc5f257e4b5cee | 28,458,453,337,657 | f5f56de9695f15c15516a06cf0cc5addfa2dce19 | /StudentManager.java | ab926f0cba4d60adee6187be126ad94ebe252503 | [] | no_license | truong25111998/Array1D | https://github.com/truong25111998/Array1D | efd3e15ed496a1fc89696dfdeb7c6a8966b159bf | 44214689c1d2f8a57828cb064585d6ea27579543 | refs/heads/master | 2020-08-15T02:58:40.460000 | 2019-10-15T10:31:23 | 2019-10-15T10:31:23 | 215,269,699 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Student;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
public class StudentManager {
private List<Student> students ;
public StudentManager(){
students = new ArrayList<Student>();
}
public void addStudent(Student s){
students.add(s);
}
public void printAllStudent(){
for ( int i = 0; i < students.size(); i++){
Student sI = students.get(i);
sI.inTT();
System.out.println("---------------------");
}
}
public Student findStudentByName(String name){
for ( int i = 0; i < students.size(); i++){
Student sI = students.get(i);
if (sI.getName().equals(name)){
return sI;
}
}
return null;
}
public void sortByPoint(){
for(int i = 0; i < students.size()-1; i++){
for ( int j = i+1; j < students.size(); j++){
Student s1 = students.get(i);
Student s2 = students.get(j);
if(s1.getPoint()> s2.getPoint()){
students.set(i, s2);
students.set(j, s1);
}
}
}
}
public void sortByAge(){
for(int i = 0; i < students.size()-1; i++){
for ( int j = i+1; j < students.size(); j++){
Student s1 = students.get(i);
Student s2 = students.get(j);
if ( s1.getAge() > s2.getAge()){
//doi cho
students.set(i, s2);
students.set(j, s1);
}
}
}
}
public void sortByName(){
for(int i = 0; i < students.size()-1; i++){
for ( int j = i+1; j < students.size(); j++){
Student s1 = students.get(i);
Student s2 = students.get(j);
if ( s1.getName().compareTo(s2.getName()) > 0){
//doi cho
students.set(i, s2);
students.set(j, s1);
}
}
}
}
public void sortByNameAndAge(){
for(int i = 0; i < students.size()-1; i++){
for ( int j = i+1; j < students.size(); j++){
Student s1 = students.get(i);
Student s2 = students.get(j);
if ( s1.getName().compareTo(s2.getName()) > 0||
s1.getName().compareTo(s2.getName()) == 0 &&
s1.getAge()>s2.getAge())
{
students.set(i, s2);
students.set(j, s1);
}
}
}
}
public void sortByCompare(){
Comparator<Student> cp = new Comparator<Student>() {
@Override
public int compare(Student o1, Student o2) {
int co = o1.getName().compareTo(o2.getName());
if(co>0 ){
return 1;
}
if(co<0){
return -1;
}
if(o1.getAge()>o2.getAge()){
return 1;
}
if(o1.getAge()<o2.getAge()){
return -1;
}
return 0;
}
};
}
public void sortquick(){
Comparator<Student> c = new Comparator<Student>() {
@Override
public int compare(Student o1, Student o2) {
return 0;
}
};
students.sort(c);
//cach 2
// students.sort(new Comparator<Student>() {
// @Override
// public int compare(Student o1, Student o2) {
// int co = o1.getName().compareTo(o2.getName());
// if(co>0 ){
// return 1;
//
// }
// if(co<0){
// return -1;
// }
//
// if(o1.getAge()>o2.getAge()){
// return 1;
// }
// if(o1.getAge()<o2.getAge()){
// return -1;
// }
// return 0;
// }
//
// }
}
}
| UTF-8 | Java | 4,488 | java | StudentManager.java | Java | [] | null | [] | package Student;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
public class StudentManager {
private List<Student> students ;
public StudentManager(){
students = new ArrayList<Student>();
}
public void addStudent(Student s){
students.add(s);
}
public void printAllStudent(){
for ( int i = 0; i < students.size(); i++){
Student sI = students.get(i);
sI.inTT();
System.out.println("---------------------");
}
}
public Student findStudentByName(String name){
for ( int i = 0; i < students.size(); i++){
Student sI = students.get(i);
if (sI.getName().equals(name)){
return sI;
}
}
return null;
}
public void sortByPoint(){
for(int i = 0; i < students.size()-1; i++){
for ( int j = i+1; j < students.size(); j++){
Student s1 = students.get(i);
Student s2 = students.get(j);
if(s1.getPoint()> s2.getPoint()){
students.set(i, s2);
students.set(j, s1);
}
}
}
}
public void sortByAge(){
for(int i = 0; i < students.size()-1; i++){
for ( int j = i+1; j < students.size(); j++){
Student s1 = students.get(i);
Student s2 = students.get(j);
if ( s1.getAge() > s2.getAge()){
//doi cho
students.set(i, s2);
students.set(j, s1);
}
}
}
}
public void sortByName(){
for(int i = 0; i < students.size()-1; i++){
for ( int j = i+1; j < students.size(); j++){
Student s1 = students.get(i);
Student s2 = students.get(j);
if ( s1.getName().compareTo(s2.getName()) > 0){
//doi cho
students.set(i, s2);
students.set(j, s1);
}
}
}
}
public void sortByNameAndAge(){
for(int i = 0; i < students.size()-1; i++){
for ( int j = i+1; j < students.size(); j++){
Student s1 = students.get(i);
Student s2 = students.get(j);
if ( s1.getName().compareTo(s2.getName()) > 0||
s1.getName().compareTo(s2.getName()) == 0 &&
s1.getAge()>s2.getAge())
{
students.set(i, s2);
students.set(j, s1);
}
}
}
}
public void sortByCompare(){
Comparator<Student> cp = new Comparator<Student>() {
@Override
public int compare(Student o1, Student o2) {
int co = o1.getName().compareTo(o2.getName());
if(co>0 ){
return 1;
}
if(co<0){
return -1;
}
if(o1.getAge()>o2.getAge()){
return 1;
}
if(o1.getAge()<o2.getAge()){
return -1;
}
return 0;
}
};
}
public void sortquick(){
Comparator<Student> c = new Comparator<Student>() {
@Override
public int compare(Student o1, Student o2) {
return 0;
}
};
students.sort(c);
//cach 2
// students.sort(new Comparator<Student>() {
// @Override
// public int compare(Student o1, Student o2) {
// int co = o1.getName().compareTo(o2.getName());
// if(co>0 ){
// return 1;
//
// }
// if(co<0){
// return -1;
// }
//
// if(o1.getAge()>o2.getAge()){
// return 1;
// }
// if(o1.getAge()<o2.getAge()){
// return -1;
// }
// return 0;
// }
//
// }
}
}
| 4,488 | 0.370544 | 0.352941 | 145 | 28.951725 | 17.487072 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.537931 | false | false | 3 |
d3c6dbe1954e254cb958eedb25f6f54467a2e4d6 | 21,603,685,555,003 | 7d116e01cf92755b016652243cf8746c91d785b5 | /src/main/java/hrms/Recruitment/service/MailService.java | faf9b85aae01c45cd2b1f02c40110da92fb45e8c | [] | no_license | Burhan-repo/EHRMS | https://github.com/Burhan-repo/EHRMS | e31cc341c71e6bc648abf4fd259efeb0b246ffd9 | 111a02a9e5af1a201096aaaac4415b70333c0e84 | refs/heads/master | 2022-12-23T05:41:54.569000 | 2020-10-07T09:11:53 | 2020-10-07T09:11:53 | 301,980,633 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package hrms.Recruitment.service;
public interface MailService {
void sendEmail(String from,String to, String subject,String content,String fileName,byte[] data,String contentType);
}
| UTF-8 | Java | 196 | java | MailService.java | Java | [] | null | [] | package hrms.Recruitment.service;
public interface MailService {
void sendEmail(String from,String to, String subject,String content,String fileName,byte[] data,String contentType);
}
| 196 | 0.770408 | 0.770408 | 7 | 26 | 39.54744 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.428571 | false | false | 3 |
f4875cf31ce1d4199957e52a41a999d21739c894 | 5,892,695,182,084 | 1a33c32426bcc1d9cdd95c6f810dba19a164cd24 | /foreign/src/main/java/com/springcloud/book/foreign/controller/JournalController.java | 1ae6146228ca1acbb52c60fcc477ff9c7d9e60d6 | [] | no_license | arraykyky/demo_one | https://github.com/arraykyky/demo_one | bfb07369f9973f7a4622c7d1df31ed79fac2fbbe | ca1057ada50968294c73402266fcbe75c92e57e3 | refs/heads/master | 2022-06-29T00:34:48.062000 | 2019-10-31T03:56:45 | 2019-10-31T03:56:45 | 218,674,105 | 0 | 0 | null | false | 2022-06-21T02:08:54 | 2019-10-31T03:08:46 | 2019-10-31T03:58:53 | 2022-06-21T02:08:52 | 42,804 | 0 | 0 | 7 | Java | false | false | package com.springcloud.book.foreign.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.springcloud.book.foreign.config.OverallConfig;
import com.springcloud.book.foreign.config.PageData;
import com.springcloud.book.foreign.controller.webDeals.WebSolrDeals;
import com.springcloud.book.foreign.domain.vo.JournalNavigationMenuVO;
import com.springcloud.book.foreign.enums.SolrSearchFieldEnum;
import com.springcloud.book.foreign.service.JournalService;
import com.springcloud.book.foreign.service.SolrSearchService;
import com.springcloud.book.foreign.util.Tools;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* <p>
* 期刊导航
* </p>
*
* @author grl
* @since 2019-08-09
*/
@RestController
@RequestMapping("/journal")
public class JournalController extends BaseController{
private Logger logger = LoggerFactory.getLogger(JournalController.class);
@Autowired
private SolrSearchService solrSearchService;
@Autowired
private JournalService journalService;
/**
* 期刊导航 期刊检索
* @param page
* @param journalNavigationMenuVO 期刊检索VO 包含必要字段searchWorld —— 检索字段
* //101--ISSN ; 102--主题范畴 ; 103--学科分类 ; 104--语言 ; 105--期刊分类(收录机构) ;
* 107--期刊首字母 ; 108109 --期刊英文108/期刊中文109
* searchValue —— 检索值
* sortWorld —— 排序字段,默认106以影响因子
* sortType —— 排序类型,默认1以大于0升序,小于0降序
* @return
*/
@GetMapping("/list")
public Object getJournalPageByClassificationMenuValue(Page page, JournalNavigationMenuVO journalNavigationMenuVO){
PageData pageData = new PageData();
List<Map> searchFieldList = new ArrayList<>();
//101--ISSN ; 102--主题范畴 ; 103--学科分类 ; 104--语言 ; 105--期刊分类(收录机构) ; 107--期刊首字母 ; 108109 --期刊英文108/期刊中文109
String searchWorld = journalNavigationMenuVO.getSearchWorld();
if (searchWorld != null && !"".equals(searchWorld)){
if ("107".equals(searchWorld)){
Map<String, Object> map0 = WebSolrDeals.searchFieldMap("", searchWorld, journalNavigationMenuVO.getSearchValue() + "*");
Map<String, Object> map1 = WebSolrDeals.searchFieldMap("1", searchWorld, journalNavigationMenuVO.getSearchValue().toLowerCase() + "*");
searchFieldList.add(map0);
searchFieldList.add(map1);
}else if ("101".equals(searchWorld) || "108109".equals(searchWorld)) {
String value = Tools.getTextTrim(journalNavigationMenuVO.getSearchValue().replaceAll(":", " ").replaceAll(" ", " "));
if ("108109".equals(searchWorld)) {
if (Tools.isChinese(value)) {
searchWorld = "109";
} else {
searchWorld = "108";
}
}
Map<String, Object> mapOthers = WebSolrDeals.searchFieldMap("", searchWorld, "\"" + value + "\"");
searchFieldList.add(mapOthers);
if ("108".equals(searchWorld)) {
Map<String, Object> mapOthersSimp = WebSolrDeals.searchFieldMap("1", "110", "\"" + value + "\"");
searchFieldList.add(mapOthersSimp);
}
}else {
if ("103".equals(searchWorld)){
journalNavigationMenuVO.setSearchValue("\""+ journalNavigationMenuVO.getSearchValue() +"\"");
}
Map<String, Object> mapOthers = WebSolrDeals.searchFieldMap("", searchWorld, journalNavigationMenuVO.getSearchValue());
searchFieldList.add(mapOthers);
}
}
String sortField = null;
try {
if (searchFieldList.isEmpty()){
sortField = SolrSearchFieldEnum.getTableFieldByKey(Integer.valueOf(journalNavigationMenuVO.getSortWorld()));;
}
}catch (Exception e){
logger.error(e.getMessage(),e);
pageData.put(OverallConfig.CODE,OverallConfig.ERROR);
pageData.put(OverallConfig.MSG,e.getMessage());
}
Integer sortType = journalNavigationMenuVO.getSortType();
this.solrMoreFieldsSearchJournal(page,searchFieldList,solrSearchService,sortField,sortType,pageData);
return pageData;
}
/**
* 期刊导航 期刊详情
* @param journalNavigationMenuVO 包含必要字段journalId —— 期刊id
* @return
*/
@GetMapping("/info")
public Object getJournalInfoByJournalId(JournalNavigationMenuVO journalNavigationMenuVO){
PageData pageData = new PageData();
this.solrJournalByJournalId(pageData,solrSearchService,journalNavigationMenuVO);
return pageData;
}
/**
* 期刊导航 期刊详情的入库期卷的年份数据
* @param journalNavigationMenuVO 包含必要字段journalId —— 期刊id
* @return
* @throws Exception
*/
@GetMapping("/year_counts")
public Object getJournalYearCounts(JournalNavigationMenuVO journalNavigationMenuVO){
PageData pageData = new PageData();
try {
List<Map> yearList = journalService.getJournalYearCounts(journalNavigationMenuVO);
pageData.put(OverallConfig.CODE,OverallConfig.SUCCESS);
pageData.put(OverallConfig.MSG,OverallConfig.SUCCESS_MSG);
pageData.put(OverallConfig.DATA,yearList);
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(),e);
pageData.put(OverallConfig.CODE,OverallConfig.ERROR);
pageData.put(OverallConfig.MSG,e.getMessage());
}
return pageData;
}
/**
*
* @param page
* @param journalNavigationMenuVO 包含必要字段 journalId —— 期刊id
* year —— 年
* volume —— 卷
* issue —— 期
* @param token 用户登录标记
* @return
*/
@GetMapping("/abstracts")
public Object getCurrentJournalVolumsIssueAbstracts(Page page,JournalNavigationMenuVO journalNavigationMenuVO,String token){
PageData pageData = new PageData();
List<Map> searchFieldList = new ArrayList<>();
if (journalNavigationMenuVO.getJournalId() != null && !"".equals(journalNavigationMenuVO.getJournalId())){
Map<String,Object> jIdMap = WebSolrDeals.searchFieldMap("","26",journalNavigationMenuVO.getJournalId());
searchFieldList.add(jIdMap);
}
if (journalNavigationMenuVO.getYear() != null && !"".equals(journalNavigationMenuVO.getYear())){
Integer year = journalNavigationMenuVO.getYear();
if (year != null){
String dateStr = WebSolrDeals.solrDateSearchStr(String.valueOf(year),String.valueOf(year));
Map<String,Object> jIdMap = WebSolrDeals.searchFieldMap("","13",dateStr);
searchFieldList.add(jIdMap);
}
}
if (journalNavigationMenuVO.getVolume() != null && !"".equals(journalNavigationMenuVO.getVolume())){
Map<String,Object> jVdMap = WebSolrDeals.searchFieldMap("","14",journalNavigationMenuVO.getVolume());
searchFieldList.add(jVdMap);
//卷数不为空时,再拼接期信息
if (journalNavigationMenuVO.getIssue() != null && !"".equals(journalNavigationMenuVO.getIssue())){
Map<String,Object> jIdMap = WebSolrDeals.searchFieldMap("","15",journalNavigationMenuVO.getIssue());
searchFieldList.add(jIdMap);
}
}else{
Map<String,Object> jVdMap = WebSolrDeals.searchFieldMap("","14","*");
searchFieldList.add(jVdMap);
Map<String,Object> jIdMap = WebSolrDeals.searchFieldMap("","15","*");
searchFieldList.add(jIdMap);
}
this.solrMoreFieldsSearch(false,page,token,searchFieldList,solrSearchService,pageData,null);
return pageData;
}
}
| UTF-8 | Java | 8,918 | java | JournalController.java | Java | [
{
"context": "il.Map;\n\n/**\n * <p>\n * 期刊导航\n * </p>\n *\n * @author grl\n * @since 2019-08-09\n */\n@RestController\n@Request",
"end": 1030,
"score": 0.9995542764663696,
"start": 1027,
"tag": "USERNAME",
"value": "grl"
},
{
"context": " issue —— 期\n * @para... | null | [] | package com.springcloud.book.foreign.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.springcloud.book.foreign.config.OverallConfig;
import com.springcloud.book.foreign.config.PageData;
import com.springcloud.book.foreign.controller.webDeals.WebSolrDeals;
import com.springcloud.book.foreign.domain.vo.JournalNavigationMenuVO;
import com.springcloud.book.foreign.enums.SolrSearchFieldEnum;
import com.springcloud.book.foreign.service.JournalService;
import com.springcloud.book.foreign.service.SolrSearchService;
import com.springcloud.book.foreign.util.Tools;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* <p>
* 期刊导航
* </p>
*
* @author grl
* @since 2019-08-09
*/
@RestController
@RequestMapping("/journal")
public class JournalController extends BaseController{
private Logger logger = LoggerFactory.getLogger(JournalController.class);
@Autowired
private SolrSearchService solrSearchService;
@Autowired
private JournalService journalService;
/**
* 期刊导航 期刊检索
* @param page
* @param journalNavigationMenuVO 期刊检索VO 包含必要字段searchWorld —— 检索字段
* //101--ISSN ; 102--主题范畴 ; 103--学科分类 ; 104--语言 ; 105--期刊分类(收录机构) ;
* 107--期刊首字母 ; 108109 --期刊英文108/期刊中文109
* searchValue —— 检索值
* sortWorld —— 排序字段,默认106以影响因子
* sortType —— 排序类型,默认1以大于0升序,小于0降序
* @return
*/
@GetMapping("/list")
public Object getJournalPageByClassificationMenuValue(Page page, JournalNavigationMenuVO journalNavigationMenuVO){
PageData pageData = new PageData();
List<Map> searchFieldList = new ArrayList<>();
//101--ISSN ; 102--主题范畴 ; 103--学科分类 ; 104--语言 ; 105--期刊分类(收录机构) ; 107--期刊首字母 ; 108109 --期刊英文108/期刊中文109
String searchWorld = journalNavigationMenuVO.getSearchWorld();
if (searchWorld != null && !"".equals(searchWorld)){
if ("107".equals(searchWorld)){
Map<String, Object> map0 = WebSolrDeals.searchFieldMap("", searchWorld, journalNavigationMenuVO.getSearchValue() + "*");
Map<String, Object> map1 = WebSolrDeals.searchFieldMap("1", searchWorld, journalNavigationMenuVO.getSearchValue().toLowerCase() + "*");
searchFieldList.add(map0);
searchFieldList.add(map1);
}else if ("101".equals(searchWorld) || "108109".equals(searchWorld)) {
String value = Tools.getTextTrim(journalNavigationMenuVO.getSearchValue().replaceAll(":", " ").replaceAll(" ", " "));
if ("108109".equals(searchWorld)) {
if (Tools.isChinese(value)) {
searchWorld = "109";
} else {
searchWorld = "108";
}
}
Map<String, Object> mapOthers = WebSolrDeals.searchFieldMap("", searchWorld, "\"" + value + "\"");
searchFieldList.add(mapOthers);
if ("108".equals(searchWorld)) {
Map<String, Object> mapOthersSimp = WebSolrDeals.searchFieldMap("1", "110", "\"" + value + "\"");
searchFieldList.add(mapOthersSimp);
}
}else {
if ("103".equals(searchWorld)){
journalNavigationMenuVO.setSearchValue("\""+ journalNavigationMenuVO.getSearchValue() +"\"");
}
Map<String, Object> mapOthers = WebSolrDeals.searchFieldMap("", searchWorld, journalNavigationMenuVO.getSearchValue());
searchFieldList.add(mapOthers);
}
}
String sortField = null;
try {
if (searchFieldList.isEmpty()){
sortField = SolrSearchFieldEnum.getTableFieldByKey(Integer.valueOf(journalNavigationMenuVO.getSortWorld()));;
}
}catch (Exception e){
logger.error(e.getMessage(),e);
pageData.put(OverallConfig.CODE,OverallConfig.ERROR);
pageData.put(OverallConfig.MSG,e.getMessage());
}
Integer sortType = journalNavigationMenuVO.getSortType();
this.solrMoreFieldsSearchJournal(page,searchFieldList,solrSearchService,sortField,sortType,pageData);
return pageData;
}
/**
* 期刊导航 期刊详情
* @param journalNavigationMenuVO 包含必要字段journalId —— 期刊id
* @return
*/
@GetMapping("/info")
public Object getJournalInfoByJournalId(JournalNavigationMenuVO journalNavigationMenuVO){
PageData pageData = new PageData();
this.solrJournalByJournalId(pageData,solrSearchService,journalNavigationMenuVO);
return pageData;
}
/**
* 期刊导航 期刊详情的入库期卷的年份数据
* @param journalNavigationMenuVO 包含必要字段journalId —— 期刊id
* @return
* @throws Exception
*/
@GetMapping("/year_counts")
public Object getJournalYearCounts(JournalNavigationMenuVO journalNavigationMenuVO){
PageData pageData = new PageData();
try {
List<Map> yearList = journalService.getJournalYearCounts(journalNavigationMenuVO);
pageData.put(OverallConfig.CODE,OverallConfig.SUCCESS);
pageData.put(OverallConfig.MSG,OverallConfig.SUCCESS_MSG);
pageData.put(OverallConfig.DATA,yearList);
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(),e);
pageData.put(OverallConfig.CODE,OverallConfig.ERROR);
pageData.put(OverallConfig.MSG,e.getMessage());
}
return pageData;
}
/**
*
* @param page
* @param journalNavigationMenuVO 包含必要字段 journalId —— 期刊id
* year —— 年
* volume —— 卷
* issue —— 期
* @param token 用户登录标记
* @return
*/
@GetMapping("/abstracts")
public Object getCurrentJournalVolumsIssueAbstracts(Page page,JournalNavigationMenuVO journalNavigationMenuVO,String token){
PageData pageData = new PageData();
List<Map> searchFieldList = new ArrayList<>();
if (journalNavigationMenuVO.getJournalId() != null && !"".equals(journalNavigationMenuVO.getJournalId())){
Map<String,Object> jIdMap = WebSolrDeals.searchFieldMap("","26",journalNavigationMenuVO.getJournalId());
searchFieldList.add(jIdMap);
}
if (journalNavigationMenuVO.getYear() != null && !"".equals(journalNavigationMenuVO.getYear())){
Integer year = journalNavigationMenuVO.getYear();
if (year != null){
String dateStr = WebSolrDeals.solrDateSearchStr(String.valueOf(year),String.valueOf(year));
Map<String,Object> jIdMap = WebSolrDeals.searchFieldMap("","13",dateStr);
searchFieldList.add(jIdMap);
}
}
if (journalNavigationMenuVO.getVolume() != null && !"".equals(journalNavigationMenuVO.getVolume())){
Map<String,Object> jVdMap = WebSolrDeals.searchFieldMap("","14",journalNavigationMenuVO.getVolume());
searchFieldList.add(jVdMap);
//卷数不为空时,再拼接期信息
if (journalNavigationMenuVO.getIssue() != null && !"".equals(journalNavigationMenuVO.getIssue())){
Map<String,Object> jIdMap = WebSolrDeals.searchFieldMap("","15",journalNavigationMenuVO.getIssue());
searchFieldList.add(jIdMap);
}
}else{
Map<String,Object> jVdMap = WebSolrDeals.searchFieldMap("","14","*");
searchFieldList.add(jVdMap);
Map<String,Object> jIdMap = WebSolrDeals.searchFieldMap("","15","*");
searchFieldList.add(jIdMap);
}
this.solrMoreFieldsSearch(false,page,token,searchFieldList,solrSearchService,pageData,null);
return pageData;
}
}
| 8,918 | 0.611916 | 0.596962 | 186 | 44.655914 | 37.139374 | 151 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.827957 | false | false | 3 |
8b5405550b6fa8ea38a7d085e2ac11ed19118010 | 13,829,794,743,044 | 3f39c3ab7d94f35e8a3919e6f24a7be35e261d85 | /src/main/java/cylon/creole/Rule.java | 74a91b996dbda6585e775be6c952047215b380ee | [] | no_license | eungju/cylon | https://github.com/eungju/cylon | 68c833ec679026e6d84ebde2f12ef74ccc5e0945 | cb82bc7e17ed92d61427b556a2a41172e3af3aa8 | refs/heads/master | 2021-01-13T16:11:32.505000 | 2015-03-31T02:03:26 | 2015-03-31T02:03:26 | 22,243,018 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cylon.creole;
import java.util.regex.Pattern;
public class Rule {
private String expression;
private int groupCount;
public Rule(String expression) {
this.expression = expression;
this.groupCount = Pattern.compile(expression).matcher("").groupCount();
}
public String expression() {
return expression;
}
public int groupCount() {
return groupCount;
}
} | UTF-8 | Java | 402 | java | Rule.java | Java | [] | null | [] | package cylon.creole;
import java.util.regex.Pattern;
public class Rule {
private String expression;
private int groupCount;
public Rule(String expression) {
this.expression = expression;
this.groupCount = Pattern.compile(expression).matcher("").groupCount();
}
public String expression() {
return expression;
}
public int groupCount() {
return groupCount;
}
} | 402 | 0.696517 | 0.696517 | 21 | 17.238094 | 17.644382 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.190476 | false | false | 3 |
e6bf8e39630d326b5758f080bc2f3ac121e155f1 | 12,970,801,285,222 | 44a5cde72fa3904ff7a10b78fda7265dfa674c56 | /modules/auth/src/main/java/com/clanout/application/module/auth/domain/observer/NewUserRegistrationObserver.java | a4637166bb1374035e823fdda4710e716939e8bd | [] | no_license | clanout/core-application | https://github.com/clanout/core-application | ad11f75bddf4a4467ed22b3362d39e3c01e8be05 | 0cd44fad47926e35612df72fb14ac8a4146b3f77 | refs/heads/master | 2021-05-15T03:52:49.014000 | 2016-07-01T14:48:59 | 2016-07-01T14:48:59 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.clanout.application.module.auth.domain.observer;
public interface NewUserRegistrationObserver
{
void onNewUserRegistered(String userId);
}
| UTF-8 | Java | 156 | java | NewUserRegistrationObserver.java | Java | [] | null | [] | package com.clanout.application.module.auth.domain.observer;
public interface NewUserRegistrationObserver
{
void onNewUserRegistered(String userId);
}
| 156 | 0.826923 | 0.826923 | 6 | 25 | 24.913183 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 3 |
8cfdac99592a51949dc1f35806f04d981be2eb97 | 28,879,360,147,919 | ea944e9c502af20b3e30ca44c936af6efb68acfa | /fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/helper/NormalHelper.java | 2e207650134d004625a387143facdaf35135eb4a | [
"Apache-2.0"
] | permissive | FabricMC/fabric | https://github.com/FabricMC/fabric | 641a329770db8aabcaad1facd3eb82523e9be5b6 | 11da534fdcd8bafe01ef961318b388c432b7679e | refs/heads/1.20.2 | 2023-08-16T13:55:50.525000 | 2023-08-13T15:26:33 | 2023-08-13T15:26:33 | 156,061,229 | 2,155 | 655 | Apache-2.0 | false | 2023-09-11T07:43:23 | 2018-11-04T09:02:05 | 2023-09-08T17:46:51 | 2023-09-11T07:43:22 | 7,960 | 1,860 | 357 | 117 | Java | false | false | /*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.fabricmc.fabric.impl.client.indigo.renderer.helper;
import org.jetbrains.annotations.NotNull;
import org.joml.Vector3f;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3i;
import net.fabricmc.fabric.api.renderer.v1.mesh.QuadView;
/**
* Static routines of general utility for renderer implementations.
* Renderers are not required to use these helpers, but they were
* designed to be usable without the default renderer.
*/
public abstract class NormalHelper {
private NormalHelper() { }
private static final float PACK = 127.0f;
private static final float UNPACK = 1.0f / PACK;
/**
* Stores a normal plus an extra value as a quartet of signed bytes.
* This is the same normal format that vanilla rendering expects.
* The extra value is for use by shaders.
*/
public static int packNormal(float x, float y, float z, float w) {
x = MathHelper.clamp(x, -1, 1);
y = MathHelper.clamp(y, -1, 1);
z = MathHelper.clamp(z, -1, 1);
w = MathHelper.clamp(w, -1, 1);
return ((int) (x * PACK) & 0xFF) | (((int) (y * PACK) & 0xFF) << 8) | (((int) (z * PACK) & 0xFF) << 16) | (((int) (w * PACK) & 0xFF) << 24);
}
/**
* Version of {@link #packNormal(float, float, float, float)} that accepts a vector type.
*/
public static int packNormal(Vector3f normal, float w) {
return packNormal(normal.x(), normal.y(), normal.z(), w);
}
/**
* Like {@link #packNormal(float, float, float, float)}, but without a {@code w} value.
*/
public static int packNormal(float x, float y, float z) {
x = MathHelper.clamp(x, -1, 1);
y = MathHelper.clamp(y, -1, 1);
z = MathHelper.clamp(z, -1, 1);
return ((int) (x * PACK) & 0xFF) | (((int) (y * PACK) & 0xFF) << 8) | (((int) (z * PACK) & 0xFF) << 16);
}
/**
* Like {@link #packNormal(Vector3f, float)}, but without a {@code w} value.
*/
public static int packNormal(Vector3f normal) {
return packNormal(normal.x(), normal.y(), normal.z());
}
public static float unpackNormalX(int packedNormal) {
return ((byte) (packedNormal & 0xFF)) * UNPACK;
}
public static float unpackNormalY(int packedNormal) {
return ((byte) ((packedNormal >>> 8) & 0xFF)) * UNPACK;
}
public static float unpackNormalZ(int packedNormal) {
return ((byte) ((packedNormal >>> 16) & 0xFF)) * UNPACK;
}
public static float unpackNormalW(int packedNormal) {
return ((byte) ((packedNormal >>> 24) & 0xFF)) * UNPACK;
}
public static void unpackNormal(int packedNormal, Vector3f target) {
target.set(unpackNormalX(packedNormal), unpackNormalY(packedNormal), unpackNormalZ(packedNormal));
}
/**
* Computes the face normal of the given quad and saves it in the provided non-null vector.
* If {@link QuadView#nominalFace()} is set will optimize by confirming quad is parallel to that
* face and, if so, use the standard normal for that face direction.
*
* <p>Will work with triangles also. Assumes counter-clockwise winding order, which is the norm.
* Expects convex quads with all points co-planar.
*/
public static void computeFaceNormal(@NotNull Vector3f saveTo, QuadView q) {
final Direction nominalFace = q.nominalFace();
if (nominalFace != null && GeometryHelper.isQuadParallelToFace(nominalFace, q)) {
Vec3i vec = nominalFace.getVector();
saveTo.set(vec.getX(), vec.getY(), vec.getZ());
return;
}
final float x0 = q.x(0);
final float y0 = q.y(0);
final float z0 = q.z(0);
final float x1 = q.x(1);
final float y1 = q.y(1);
final float z1 = q.z(1);
final float x2 = q.x(2);
final float y2 = q.y(2);
final float z2 = q.z(2);
final float x3 = q.x(3);
final float y3 = q.y(3);
final float z3 = q.z(3);
final float dx0 = x2 - x0;
final float dy0 = y2 - y0;
final float dz0 = z2 - z0;
final float dx1 = x3 - x1;
final float dy1 = y3 - y1;
final float dz1 = z3 - z1;
float normX = dy0 * dz1 - dz0 * dy1;
float normY = dz0 * dx1 - dx0 * dz1;
float normZ = dx0 * dy1 - dy0 * dx1;
float l = (float) Math.sqrt(normX * normX + normY * normY + normZ * normZ);
if (l != 0) {
normX /= l;
normY /= l;
normZ /= l;
}
saveTo.set(normX, normY, normZ);
}
}
| UTF-8 | Java | 4,808 | java | NormalHelper.java | Java | [] | null | [] | /*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.fabricmc.fabric.impl.client.indigo.renderer.helper;
import org.jetbrains.annotations.NotNull;
import org.joml.Vector3f;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3i;
import net.fabricmc.fabric.api.renderer.v1.mesh.QuadView;
/**
* Static routines of general utility for renderer implementations.
* Renderers are not required to use these helpers, but they were
* designed to be usable without the default renderer.
*/
public abstract class NormalHelper {
private NormalHelper() { }
private static final float PACK = 127.0f;
private static final float UNPACK = 1.0f / PACK;
/**
* Stores a normal plus an extra value as a quartet of signed bytes.
* This is the same normal format that vanilla rendering expects.
* The extra value is for use by shaders.
*/
public static int packNormal(float x, float y, float z, float w) {
x = MathHelper.clamp(x, -1, 1);
y = MathHelper.clamp(y, -1, 1);
z = MathHelper.clamp(z, -1, 1);
w = MathHelper.clamp(w, -1, 1);
return ((int) (x * PACK) & 0xFF) | (((int) (y * PACK) & 0xFF) << 8) | (((int) (z * PACK) & 0xFF) << 16) | (((int) (w * PACK) & 0xFF) << 24);
}
/**
* Version of {@link #packNormal(float, float, float, float)} that accepts a vector type.
*/
public static int packNormal(Vector3f normal, float w) {
return packNormal(normal.x(), normal.y(), normal.z(), w);
}
/**
* Like {@link #packNormal(float, float, float, float)}, but without a {@code w} value.
*/
public static int packNormal(float x, float y, float z) {
x = MathHelper.clamp(x, -1, 1);
y = MathHelper.clamp(y, -1, 1);
z = MathHelper.clamp(z, -1, 1);
return ((int) (x * PACK) & 0xFF) | (((int) (y * PACK) & 0xFF) << 8) | (((int) (z * PACK) & 0xFF) << 16);
}
/**
* Like {@link #packNormal(Vector3f, float)}, but without a {@code w} value.
*/
public static int packNormal(Vector3f normal) {
return packNormal(normal.x(), normal.y(), normal.z());
}
public static float unpackNormalX(int packedNormal) {
return ((byte) (packedNormal & 0xFF)) * UNPACK;
}
public static float unpackNormalY(int packedNormal) {
return ((byte) ((packedNormal >>> 8) & 0xFF)) * UNPACK;
}
public static float unpackNormalZ(int packedNormal) {
return ((byte) ((packedNormal >>> 16) & 0xFF)) * UNPACK;
}
public static float unpackNormalW(int packedNormal) {
return ((byte) ((packedNormal >>> 24) & 0xFF)) * UNPACK;
}
public static void unpackNormal(int packedNormal, Vector3f target) {
target.set(unpackNormalX(packedNormal), unpackNormalY(packedNormal), unpackNormalZ(packedNormal));
}
/**
* Computes the face normal of the given quad and saves it in the provided non-null vector.
* If {@link QuadView#nominalFace()} is set will optimize by confirming quad is parallel to that
* face and, if so, use the standard normal for that face direction.
*
* <p>Will work with triangles also. Assumes counter-clockwise winding order, which is the norm.
* Expects convex quads with all points co-planar.
*/
public static void computeFaceNormal(@NotNull Vector3f saveTo, QuadView q) {
final Direction nominalFace = q.nominalFace();
if (nominalFace != null && GeometryHelper.isQuadParallelToFace(nominalFace, q)) {
Vec3i vec = nominalFace.getVector();
saveTo.set(vec.getX(), vec.getY(), vec.getZ());
return;
}
final float x0 = q.x(0);
final float y0 = q.y(0);
final float z0 = q.z(0);
final float x1 = q.x(1);
final float y1 = q.y(1);
final float z1 = q.z(1);
final float x2 = q.x(2);
final float y2 = q.y(2);
final float z2 = q.z(2);
final float x3 = q.x(3);
final float y3 = q.y(3);
final float z3 = q.z(3);
final float dx0 = x2 - x0;
final float dy0 = y2 - y0;
final float dz0 = z2 - z0;
final float dx1 = x3 - x1;
final float dy1 = y3 - y1;
final float dz1 = z3 - z1;
float normX = dy0 * dz1 - dz0 * dy1;
float normY = dz0 * dx1 - dx0 * dz1;
float normZ = dx0 * dy1 - dy0 * dx1;
float l = (float) Math.sqrt(normX * normX + normY * normY + normZ * normZ);
if (l != 0) {
normX /= l;
normY /= l;
normZ /= l;
}
saveTo.set(normX, normY, normZ);
}
}
| 4,808 | 0.667845 | 0.641223 | 149 | 31.268456 | 29.835934 | 142 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.785235 | false | false | 3 |
aded5b14b08843f557e419d2c8b8f9af81854985 | 27,212,912,790,560 | b02b8fbd1a9f1f90dd88ab655150ef67cae57925 | /Seleniumjava/src/main/java/Test/googleSearchTest.java | 851f4afcf9c8e5b9e4a58bd4a41a4d867ca91acd | [] | no_license | jarardraj/Selenium-java- | https://github.com/jarardraj/Selenium-java- | 813f3fd5bdece6c2f93bebd09a256456663874ed | bcfe6f6b58999ce7bc0aac95eca21f4cb9dccb9a | refs/heads/master | 2023-06-03T07:31:01.568000 | 2021-06-21T20:50:35 | 2021-06-21T20:50:35 | 379,056,568 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Test;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class googleSearchTest {
public static void main(String[] args) throws Exception {
googleSearch();
}
public static void googleSearch() throws InterruptedException {
String projectloc = System.getProperty("user.dir");
System.setProperty("webdriver.chrome.driver", projectloc +"/lib/drivers/chromedriver");
WebDriver driver = new ChromeDriver();
//go to google.com
driver.get("https://google.com");
Thread.sleep(4000);
WebElement search1= driver.findElement(By.name("q"));
search1.sendKeys("gladiators");
Thread.sleep(4000);
WebElement opt1= driver.findElement(By.xpath("//ul[@class=\"erkvQe\"]//li"));
//opt1.sendKeys(Keys.ARROW_DOWN);
opt1.click();
Thread.sleep(4000);
driver.close();
driver.quit();
System.out.println("Test Completed successfully");
}
}
| UTF-8 | Java | 1,040 | java | googleSearchTest.java | Java | [] | null | [] | package Test;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class googleSearchTest {
public static void main(String[] args) throws Exception {
googleSearch();
}
public static void googleSearch() throws InterruptedException {
String projectloc = System.getProperty("user.dir");
System.setProperty("webdriver.chrome.driver", projectloc +"/lib/drivers/chromedriver");
WebDriver driver = new ChromeDriver();
//go to google.com
driver.get("https://google.com");
Thread.sleep(4000);
WebElement search1= driver.findElement(By.name("q"));
search1.sendKeys("gladiators");
Thread.sleep(4000);
WebElement opt1= driver.findElement(By.xpath("//ul[@class=\"erkvQe\"]//li"));
//opt1.sendKeys(Keys.ARROW_DOWN);
opt1.click();
Thread.sleep(4000);
driver.close();
driver.quit();
System.out.println("Test Completed successfully");
}
}
| 1,040 | 0.714423 | 0.698077 | 45 | 22.088888 | 23.295992 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.777778 | false | false | 3 |
6540202d063d3d409aa7a4852d7e6c7b3a7f44ba | 1,219,770,718,623 | 17c6bf28b969501cad6ea7b65298922754dbe2a6 | /src/main/java/com/github/tartaricacid/netmusic/proxy/CommonProxy.java | dbc3a0a1b140b593f86ba838d749bffe256cd09a | [] | no_license | MikhailTapio/NetMusic | https://github.com/MikhailTapio/NetMusic | c0a7c41cfcbb1307a11019d2d940f71e48ba9d35 | 01989f484f2c2d5503fd33eb9f93bd6bd7b8e3f1 | refs/heads/master | 2023-07-15T21:44:48.487000 | 2021-08-29T13:04:08 | 2021-08-29T13:04:08 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.github.tartaricacid.netmusic.proxy;
import com.github.tartaricacid.netmusic.NetMusic;
import com.github.tartaricacid.netmusic.network.MusicToClientMessage;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import net.minecraftforge.fml.relauncher.Side;
public class CommonProxy {
public static SimpleNetworkWrapper INSTANCE = null;
public void preInit(FMLPreInitializationEvent event) {
INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(NetMusic.MOD_ID);
INSTANCE.registerMessage(MusicToClientMessage.Handler.class, MusicToClientMessage.class, 0, Side.CLIENT);
}
public void init(FMLInitializationEvent event) {
}
}
| UTF-8 | Java | 899 | java | CommonProxy.java | Java | [
{
"context": "package com.github.tartaricacid.netmusic.proxy;\n\nimport com.github.tartaricacid.n",
"end": 31,
"score": 0.9993459582328796,
"start": 19,
"tag": "USERNAME",
"value": "tartaricacid"
},
{
"context": "b.tartaricacid.netmusic.proxy;\n\nimport com.github.tartaricacid.netmus... | null | [] | package com.github.tartaricacid.netmusic.proxy;
import com.github.tartaricacid.netmusic.NetMusic;
import com.github.tartaricacid.netmusic.network.MusicToClientMessage;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import net.minecraftforge.fml.relauncher.Side;
public class CommonProxy {
public static SimpleNetworkWrapper INSTANCE = null;
public void preInit(FMLPreInitializationEvent event) {
INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(NetMusic.MOD_ID);
INSTANCE.registerMessage(MusicToClientMessage.Handler.class, MusicToClientMessage.class, 0, Side.CLIENT);
}
public void init(FMLInitializationEvent event) {
}
}
| 899 | 0.817575 | 0.816463 | 22 | 39.863636 | 33.005917 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.636364 | false | false | 3 |
c30590087660814e8c1966acdd3a4dc6c74f2c7b | 17,394,617,557,197 | 9b6e669381193a97728001e9de0ccdc15ff4d892 | /app/src/main/java/com/yksj/consultation/son/consultation/main/AtyAccountInfo.java | be1421a1868068ae1140450aa86933b02855ebeb | [] | no_license | 13525846841/ConSonP | https://github.com/13525846841/ConSonP | 94d0e14a67a0930ac65aacfae668ab6820287650 | 2a469de7b0e8c7547cbff23b88e0e036683a3bc6 | refs/heads/master | 2020-05-22T07:26:40.576000 | 2019-06-05T09:56:35 | 2019-06-05T09:56:35 | 186,260,855 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.yksj.consultation.son.consultation.main;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.squareup.okhttp.Request;
import com.yksj.consultation.comm.BaseFragmentActivity;
import com.yksj.consultation.son.R;
import com.yksj.healthtalk.net.http.HttpRestClient;
import com.yksj.healthtalk.net.http.MyResultCallback;
import com.yksj.healthtalk.net.http.ObjectHttpResponseHandler;
import com.yksj.healthtalk.net.socket.LoginServiceManeger;
import com.yksj.healthtalk.utils.ToastUtil;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
/**
* Created by HEKL on 15/12/21.
*/
/**
* 修改与16/11/7
*/
public class AtyAccountInfo extends BaseFragmentActivity implements View.OnClickListener {
private EditText mZFBNUMS, mZFBName, mBankNUMs, mBankName, mBankAccName, mPhone;
private TextView number;
private RelativeLayout rl_chongzhi;
private RelativeLayout rl_tixian;
private String balance;
@Override
protected void onCreate(Bundle arg0) {
super.onCreate(arg0);
setContentView(R.layout.aty_accountinfo);
intView();
}
@Override
protected void onResume() {
super.onResume();
initData2();
}
private void initData2() {
HttpRestClient.OKHttpACCOUNTBALANCE(LoginServiceManeger.instance().getLoginUserId(), new ObjectHttpResponseHandler(this) {
@Override
public Object onParseResponse(String content) {
if (content != null) {
return content;
} else {
return null;
}
}
@Override
public void onSuccess(Object response) {
super.onSuccess(response);
try {
if (response != null) {
JSONObject object = new JSONObject(response.toString());
balance = object.optString("balance");
number.setText(object.optString("balance"));
}
} catch (JSONException e) {
e.printStackTrace();
}
}
});
}
private void intView() {
initTitle();
titleTextV.setText("账户管理");
titleLeftBtn.setOnClickListener(this);
titleRightBtn2.setVisibility(View.VISIBLE);
titleRightBtn2.setText("账单明细");
titleRightBtn2.setOnClickListener(this);
number = (TextView) findViewById(R.id.tv_number);
rl_chongzhi = (RelativeLayout) findViewById(R.id.rl_chongzhi);
rl_tixian = (RelativeLayout) findViewById(R.id.rl_tixian);
rl_chongzhi.setOnClickListener(this);
rl_tixian.setOnClickListener(this);
// mZFBNUMS = (EditText) findViewById(R.id.et_zhifubaozhanghao);
// mZFBName = (EditText) findViewById(R.id.et_zhifubaoname);
// mBankNUMs = (EditText) findViewById(R.id.et_banknums);
// mBankName = (EditText) findViewById(R.id.et_bankname);
// mBankAccName = (EditText) findViewById(R.id.et_bankacceptname);
// mPhone = (EditText) findViewById(R.id.et_phone);
}
@Override
public void onClick(View view) {
Intent intent = null;
switch (view.getId()) {
case R.id.title_back:
onBackPressed();
break;
case R.id.title_right2://账单明细
intent = new Intent(this,AccountList.class);
startActivity(intent);
break;
case R.id.rl_chongzhi://充值
// intent = new Intent(this,TopUpActivity.class);
intent = new Intent(this,Recharge.class);
startActivity(intent);
break;
case R.id.rl_tixian://提现
intent = new Intent(this,GetMoney.class);
intent.putExtra("balance",balance);
startActivity(intent);
break;
// case R.id.title_right2:
// if ("".equals(mPhone.getText().toString().trim())){
// ToastUtil.showShort("请输入手机号码");
// }else {
// DoubleBtnFragmentDialog.showDefault(getSupportFragmentManager(), "确认提交您修改的账户信息吗?", "取消", "确定", new DoubleBtnFragmentDialog.OnDilaogClickListener() {
// @Override
// public void onDismiss(DialogFragment fragment) {
//
// }
// @Override
// public void onClick(DialogFragment fragment, View v) {
// doConfirm();
// }
// });
// }
// break;
}
}
/**
* 加载账户信息
*/
private void initData() {
List<BasicNameValuePair> valuePairs = new ArrayList<>();
valuePairs.add(new BasicNameValuePair("OPTION", "17"));
valuePairs.add(new BasicNameValuePair("CUSTID", LoginServiceManeger.instance().getLoginEntity().getId()));
HttpRestClient.OKHttpgetAccountInfo(valuePairs, new MyResultCallback<String>(this) {
@Override
public void onResponse(String response) {
super.onResponse(response);
if (!TextUtils.isEmpty(response)) {
try {
org.json.JSONObject obj = new org.json.JSONObject(response);
if (1 == obj.optInt("code")) {
mZFBName.setText(obj.getJSONObject("result").optString("ALI_PAY_NAME"));
mZFBNUMS.setText(obj.getJSONObject("result").optString("ALI_PAY_ACCOUNT"));
mBankName.setText(obj.getJSONObject("result").optString("ACCOUNT_BANK"));
mBankNUMs.setText(obj.getJSONObject("result").optString("UNIONPAY_ACCOUNT"));
mBankAccName.setText(obj.getJSONObject("result").optString("UNIONPAY_NAME"));
mPhone.setText(obj.getJSONObject("result").optString("TELPHONE"));
} else {
ToastUtil.showShort(obj.optString("message"));
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}
@Override
public void onError(Request request, Exception e) {
super.onError(request, e);
}
}, this);
}
/**
* 提交账户修改
*/
private void doConfirm() {
List<BasicNameValuePair> valuePairs = new ArrayList<>();
valuePairs.add(new BasicNameValuePair("OPTION", "16"));
valuePairs.add(new BasicNameValuePair("CUSTID", LoginServiceManeger.instance().getLoginEntity().getId()));
valuePairs.add(new BasicNameValuePair("ALI_PAY_NAME", mZFBName.getText().toString().trim()));
valuePairs.add(new BasicNameValuePair("ALI_PAY_ACCOUNT", mZFBNUMS.getText().toString().trim()));
valuePairs.add(new BasicNameValuePair("ACCOUNT_BANK", mBankName.getText().toString().trim()));
valuePairs.add(new BasicNameValuePair("UNIONPAY_ACCOUNT", mBankNUMs.getText().toString().trim()));
valuePairs.add(new BasicNameValuePair("UNIONPAY_NAME", mBankAccName.getText().toString().trim()));
valuePairs.add(new BasicNameValuePair("TELPHONE", mPhone.getText().toString().trim()));
HttpRestClient.OKHttpgetAccountInfo(valuePairs, new MyResultCallback<String>(this) {
@Override
public void onResponse(String response) {
super.onResponse(response);
if (!TextUtils.isEmpty(response)) {
try {
org.json.JSONObject obj = new org.json.JSONObject(response);
if (1 == obj.optInt("code")) {
ToastUtil.showShort(obj.optString("message"));
initData();
} else {
ToastUtil.showShort(obj.optString("message"));
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}
@Override
public void onError(Request request, Exception e) {
super.onError(request, e);
}
}, this);
}
}
| UTF-8 | Java | 8,848 | java | AtyAccountInfo.java | Java | [
{
"context": "rayList;\nimport java.util.List;\n\n/**\n * Created by HEKL on 15/12/21.\n */\n\n/**\n * 修改与16/11/7\n */\npublic cl",
"end": 882,
"score": 0.981808066368103,
"start": 878,
"tag": "USERNAME",
"value": "HEKL"
}
] | null | [] | package com.yksj.consultation.son.consultation.main;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.squareup.okhttp.Request;
import com.yksj.consultation.comm.BaseFragmentActivity;
import com.yksj.consultation.son.R;
import com.yksj.healthtalk.net.http.HttpRestClient;
import com.yksj.healthtalk.net.http.MyResultCallback;
import com.yksj.healthtalk.net.http.ObjectHttpResponseHandler;
import com.yksj.healthtalk.net.socket.LoginServiceManeger;
import com.yksj.healthtalk.utils.ToastUtil;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
/**
* Created by HEKL on 15/12/21.
*/
/**
* 修改与16/11/7
*/
public class AtyAccountInfo extends BaseFragmentActivity implements View.OnClickListener {
private EditText mZFBNUMS, mZFBName, mBankNUMs, mBankName, mBankAccName, mPhone;
private TextView number;
private RelativeLayout rl_chongzhi;
private RelativeLayout rl_tixian;
private String balance;
@Override
protected void onCreate(Bundle arg0) {
super.onCreate(arg0);
setContentView(R.layout.aty_accountinfo);
intView();
}
@Override
protected void onResume() {
super.onResume();
initData2();
}
private void initData2() {
HttpRestClient.OKHttpACCOUNTBALANCE(LoginServiceManeger.instance().getLoginUserId(), new ObjectHttpResponseHandler(this) {
@Override
public Object onParseResponse(String content) {
if (content != null) {
return content;
} else {
return null;
}
}
@Override
public void onSuccess(Object response) {
super.onSuccess(response);
try {
if (response != null) {
JSONObject object = new JSONObject(response.toString());
balance = object.optString("balance");
number.setText(object.optString("balance"));
}
} catch (JSONException e) {
e.printStackTrace();
}
}
});
}
private void intView() {
initTitle();
titleTextV.setText("账户管理");
titleLeftBtn.setOnClickListener(this);
titleRightBtn2.setVisibility(View.VISIBLE);
titleRightBtn2.setText("账单明细");
titleRightBtn2.setOnClickListener(this);
number = (TextView) findViewById(R.id.tv_number);
rl_chongzhi = (RelativeLayout) findViewById(R.id.rl_chongzhi);
rl_tixian = (RelativeLayout) findViewById(R.id.rl_tixian);
rl_chongzhi.setOnClickListener(this);
rl_tixian.setOnClickListener(this);
// mZFBNUMS = (EditText) findViewById(R.id.et_zhifubaozhanghao);
// mZFBName = (EditText) findViewById(R.id.et_zhifubaoname);
// mBankNUMs = (EditText) findViewById(R.id.et_banknums);
// mBankName = (EditText) findViewById(R.id.et_bankname);
// mBankAccName = (EditText) findViewById(R.id.et_bankacceptname);
// mPhone = (EditText) findViewById(R.id.et_phone);
}
@Override
public void onClick(View view) {
Intent intent = null;
switch (view.getId()) {
case R.id.title_back:
onBackPressed();
break;
case R.id.title_right2://账单明细
intent = new Intent(this,AccountList.class);
startActivity(intent);
break;
case R.id.rl_chongzhi://充值
// intent = new Intent(this,TopUpActivity.class);
intent = new Intent(this,Recharge.class);
startActivity(intent);
break;
case R.id.rl_tixian://提现
intent = new Intent(this,GetMoney.class);
intent.putExtra("balance",balance);
startActivity(intent);
break;
// case R.id.title_right2:
// if ("".equals(mPhone.getText().toString().trim())){
// ToastUtil.showShort("请输入手机号码");
// }else {
// DoubleBtnFragmentDialog.showDefault(getSupportFragmentManager(), "确认提交您修改的账户信息吗?", "取消", "确定", new DoubleBtnFragmentDialog.OnDilaogClickListener() {
// @Override
// public void onDismiss(DialogFragment fragment) {
//
// }
// @Override
// public void onClick(DialogFragment fragment, View v) {
// doConfirm();
// }
// });
// }
// break;
}
}
/**
* 加载账户信息
*/
private void initData() {
List<BasicNameValuePair> valuePairs = new ArrayList<>();
valuePairs.add(new BasicNameValuePair("OPTION", "17"));
valuePairs.add(new BasicNameValuePair("CUSTID", LoginServiceManeger.instance().getLoginEntity().getId()));
HttpRestClient.OKHttpgetAccountInfo(valuePairs, new MyResultCallback<String>(this) {
@Override
public void onResponse(String response) {
super.onResponse(response);
if (!TextUtils.isEmpty(response)) {
try {
org.json.JSONObject obj = new org.json.JSONObject(response);
if (1 == obj.optInt("code")) {
mZFBName.setText(obj.getJSONObject("result").optString("ALI_PAY_NAME"));
mZFBNUMS.setText(obj.getJSONObject("result").optString("ALI_PAY_ACCOUNT"));
mBankName.setText(obj.getJSONObject("result").optString("ACCOUNT_BANK"));
mBankNUMs.setText(obj.getJSONObject("result").optString("UNIONPAY_ACCOUNT"));
mBankAccName.setText(obj.getJSONObject("result").optString("UNIONPAY_NAME"));
mPhone.setText(obj.getJSONObject("result").optString("TELPHONE"));
} else {
ToastUtil.showShort(obj.optString("message"));
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}
@Override
public void onError(Request request, Exception e) {
super.onError(request, e);
}
}, this);
}
/**
* 提交账户修改
*/
private void doConfirm() {
List<BasicNameValuePair> valuePairs = new ArrayList<>();
valuePairs.add(new BasicNameValuePair("OPTION", "16"));
valuePairs.add(new BasicNameValuePair("CUSTID", LoginServiceManeger.instance().getLoginEntity().getId()));
valuePairs.add(new BasicNameValuePair("ALI_PAY_NAME", mZFBName.getText().toString().trim()));
valuePairs.add(new BasicNameValuePair("ALI_PAY_ACCOUNT", mZFBNUMS.getText().toString().trim()));
valuePairs.add(new BasicNameValuePair("ACCOUNT_BANK", mBankName.getText().toString().trim()));
valuePairs.add(new BasicNameValuePair("UNIONPAY_ACCOUNT", mBankNUMs.getText().toString().trim()));
valuePairs.add(new BasicNameValuePair("UNIONPAY_NAME", mBankAccName.getText().toString().trim()));
valuePairs.add(new BasicNameValuePair("TELPHONE", mPhone.getText().toString().trim()));
HttpRestClient.OKHttpgetAccountInfo(valuePairs, new MyResultCallback<String>(this) {
@Override
public void onResponse(String response) {
super.onResponse(response);
if (!TextUtils.isEmpty(response)) {
try {
org.json.JSONObject obj = new org.json.JSONObject(response);
if (1 == obj.optInt("code")) {
ToastUtil.showShort(obj.optString("message"));
initData();
} else {
ToastUtil.showShort(obj.optString("message"));
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}
@Override
public void onError(Request request, Exception e) {
super.onError(request, e);
}
}, this);
}
}
| 8,848 | 0.563774 | 0.560797 | 220 | 38.695454 | 30.013527 | 170 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.640909 | false | false | 3 |
13b9e11acef05187220342ddfc84becdd2b003f4 | 12,876,311,963,165 | 07a5539a5924f5d6bd92f66d73dfd1fdae603823 | /CardsandRecyclerViewexample/app/src/main/java/com/example/vbn001/cardsandrecyclerviewexample/AgentOneApplication.java | a940f78ea27122432f8c16e916e60b8cee8b8362 | [] | no_license | veeman181/RandomAppStuff | https://github.com/veeman181/RandomAppStuff | 1fe8ae3c3f983b38391de0695413d7e1decb30ed | b1eb77a4e44bed41ede9825edb5ac15c5e3ee9a2 | refs/heads/master | 2016-08-08T07:37:38.061000 | 2015-07-22T13:04:42 | 2015-07-22T13:04:42 | 39,506,127 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.vbn001.cardsandrecyclerviewexample;
import android.app.Application;
import android.content.res.Configuration;
import com.parse.Parse;
/**
* Created by VBN001 on 7/6/2015.
*/
public class AgentOneApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
Parse.enableLocalDatastore(getApplicationContext());
Parse.initialize(this, "4YBarCfwhDQKdD9w7edqe8fIazqWRXv8RhRbNgd7", "zUguFYSgfxNkzTw6lQGkCWssT1VCMWBccWD44MFw");
}
}
| UTF-8 | Java | 513 | java | AgentOneApplication.java | Java | [
{
"context": "ation;\n\nimport com.parse.Parse;\n\n/**\n * Created by VBN001 on 7/6/2015.\n */\npublic class AgentOneApplication",
"end": 181,
"score": 0.9996345639228821,
"start": 175,
"tag": "USERNAME",
"value": "VBN001"
},
{
"context": "cationContext());\n Parse.initialize(... | null | [] | package com.example.vbn001.cardsandrecyclerviewexample;
import android.app.Application;
import android.content.res.Configuration;
import com.parse.Parse;
/**
* Created by VBN001 on 7/6/2015.
*/
public class AgentOneApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
Parse.enableLocalDatastore(getApplicationContext());
Parse.initialize(this, "<KEY>", "<KEY>");
}
}
| 443 | 0.754386 | 0.711501 | 19 | 26 | 29.682531 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.473684 | false | false | 3 |
8b162471295ef50c93c61c2b7a015358bfe16f4a | 9,483,287,801,510 | 7efbed7596104937b3aadd08c6dd38460a4cb9d9 | /SCD/Practica2/Barberia.java | a7179fd48fb4d16907201a82064584d741ff53fa | [] | no_license | adritake/2_GII_UGR | https://github.com/adritake/2_GII_UGR | f17d0f375117897202de70850c9d2eeb8babf7ab | 3e4eee938f1f590a8a1c36e4855b87fcd5c6e7c4 | refs/heads/master | 2021-01-21T14:43:18.272000 | 2016-06-15T11:11:27 | 2016-06-15T11:11:27 | 59,602,486 | 3 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null | import monitor.*;
class Barberia extends AbstractMonitor{
private Condition durmiendo = makeCondition();
private Condition puede_pelar = makeCondition();
private int n_clientes = 0;
// Invcado por los clientes para cortarse el pelo
public void cortarPelo (){
enter();
//Si no hay clientes es que el barbero esta dormido y hay que despertarlo
if( n_clientes == 0 )
durmiendo.signal();
else
puede_pelar.await();
//Si se llama a cortarPelo() quiere decir que ha entrado un cliente nuevo
//por lo tanto se aumenta el numero de clientes
n_clientes++;
leave();
}
// Invocado por el barbero para esperar (si procede) a un nuevo cliente y
//sentarlo para el corte
public void siguienteCliente (){
enter();
//Esta función básicamente sirve para comprabar si no hay clientes en
//la barbería y que se duerma el barbero
if(n_clientes == 0){
System.out.println("El barbero se ha dormido.********************************************\n");
durmiendo.await();
System.out.println("El barbero se ha despertado.*******************************************\n");
}
leave();
}
// Invocado por el barbero para indicar que ha terminado de cortar el pelo
public void finCliente (){
enter();
//Se indica que ya puede pelar y se decrementa el número de clientes
puede_pelar.signal();
n_clientes--;
leave();
}
}
class Cliente implements Runnable{
public Thread thr;
private Barberia bar;
private int n_cliente;
//Constructor
public Cliente( Barberia nbar, int cli){
bar = nbar;
thr = new Thread(this,"cliente " + cli);
n_cliente = cli;
}
public void run(){
while( true ){
System.out.println("El cliente " + n_cliente + " esta esperando a ser pelado.\n");
bar.cortarPelo(); // el cliente espera (si procede) y se corta el pelo
System.out.println("El cliente " + n_cliente + " se ha pelado y se sale fuera.\n");
aux.dormir_max(2000); // el cliente está fuera de la barberia un tiempo
System.out.println("El cliente " + n_cliente + " ha vuelto a entrar a la barberia.\n");
}
}
}
class Barbero implements Runnable{
public Thread thr;
private Barberia bar;
//Constructor
public Barbero( Barberia nbar){
bar = nbar;
thr = new Thread(this,"barbero ");
}
public void run(){
while( true ){
//Primero siempre se llama al siguiente cliente y si no hay se duerme
bar.siguienteCliente ();
//Cuando llega un cliente se imprime que se esta pelando
System.out.println("El barbero esta pelando a un cliente\n");
aux.dormir_max( 2500 ); // el barbero esta cortando el pelo
System.out.println("El barbero ha pelado a un cliente\n");
//Se llama a finCliente que se encarga de indicar que se puede
//pelar y de reducir el numero de clientes
bar.finCliente ();
}
}
}
class MainBarbero{
public static void main( String[] args ){
if ( args.length != 1 ){
System.err.println("Uso: <n_clientes>");
return ;
}
int n_clientes = Integer.parseInt(args[0]);
Cliente[] clientes = new Cliente[ Integer.parseInt(args[0]) ];
Barberia barberia = new Barberia();
//Creacion de hebras
for( int i=0; i < n_clientes; i++)
clientes[i] = new Cliente( barberia, i );
Barbero barbero = new Barbero( barberia );
//Puesta en marcha de las hebras
barbero.thr.start();
for( int i=0; i < n_clientes; i++)
clientes[i].thr.start();
}
}
| UTF-8 | Java | 3,873 | java | Barberia.java | Java | [] | null | [] | import monitor.*;
class Barberia extends AbstractMonitor{
private Condition durmiendo = makeCondition();
private Condition puede_pelar = makeCondition();
private int n_clientes = 0;
// Invcado por los clientes para cortarse el pelo
public void cortarPelo (){
enter();
//Si no hay clientes es que el barbero esta dormido y hay que despertarlo
if( n_clientes == 0 )
durmiendo.signal();
else
puede_pelar.await();
//Si se llama a cortarPelo() quiere decir que ha entrado un cliente nuevo
//por lo tanto se aumenta el numero de clientes
n_clientes++;
leave();
}
// Invocado por el barbero para esperar (si procede) a un nuevo cliente y
//sentarlo para el corte
public void siguienteCliente (){
enter();
//Esta función básicamente sirve para comprabar si no hay clientes en
//la barbería y que se duerma el barbero
if(n_clientes == 0){
System.out.println("El barbero se ha dormido.********************************************\n");
durmiendo.await();
System.out.println("El barbero se ha despertado.*******************************************\n");
}
leave();
}
// Invocado por el barbero para indicar que ha terminado de cortar el pelo
public void finCliente (){
enter();
//Se indica que ya puede pelar y se decrementa el número de clientes
puede_pelar.signal();
n_clientes--;
leave();
}
}
class Cliente implements Runnable{
public Thread thr;
private Barberia bar;
private int n_cliente;
//Constructor
public Cliente( Barberia nbar, int cli){
bar = nbar;
thr = new Thread(this,"cliente " + cli);
n_cliente = cli;
}
public void run(){
while( true ){
System.out.println("El cliente " + n_cliente + " esta esperando a ser pelado.\n");
bar.cortarPelo(); // el cliente espera (si procede) y se corta el pelo
System.out.println("El cliente " + n_cliente + " se ha pelado y se sale fuera.\n");
aux.dormir_max(2000); // el cliente está fuera de la barberia un tiempo
System.out.println("El cliente " + n_cliente + " ha vuelto a entrar a la barberia.\n");
}
}
}
class Barbero implements Runnable{
public Thread thr;
private Barberia bar;
//Constructor
public Barbero( Barberia nbar){
bar = nbar;
thr = new Thread(this,"barbero ");
}
public void run(){
while( true ){
//Primero siempre se llama al siguiente cliente y si no hay se duerme
bar.siguienteCliente ();
//Cuando llega un cliente se imprime que se esta pelando
System.out.println("El barbero esta pelando a un cliente\n");
aux.dormir_max( 2500 ); // el barbero esta cortando el pelo
System.out.println("El barbero ha pelado a un cliente\n");
//Se llama a finCliente que se encarga de indicar que se puede
//pelar y de reducir el numero de clientes
bar.finCliente ();
}
}
}
class MainBarbero{
public static void main( String[] args ){
if ( args.length != 1 ){
System.err.println("Uso: <n_clientes>");
return ;
}
int n_clientes = Integer.parseInt(args[0]);
Cliente[] clientes = new Cliente[ Integer.parseInt(args[0]) ];
Barberia barberia = new Barberia();
//Creacion de hebras
for( int i=0; i < n_clientes; i++)
clientes[i] = new Cliente( barberia, i );
Barbero barbero = new Barbero( barberia );
//Puesta en marcha de las hebras
barbero.thr.start();
for( int i=0; i < n_clientes; i++)
clientes[i].thr.start();
}
}
| 3,873 | 0.575233 | 0.571096 | 162 | 22.876543 | 27.519413 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.339506 | false | false | 3 |
b4311627ba63a604ebae599b520320d04d55d4ff | 14,345,190,781,314 | e41ef7cd577206b364620d5e1758f04443642e52 | /app/src/main/java/com/askonlinesolutions/user/tabqyclient/utility/adapter/dummyDataGenrator/DummyDataGenerator.java | c089b28d37e36431eacfc23dd1eca1883670a4c5 | [] | no_license | askonlinesolutions/TABQYClient | https://github.com/askonlinesolutions/TABQYClient | 864c2e6dbf7a1809f1d3f16a091d8039a29b67f7 | 036b26091deb64eb64216c573d119d6b61b4e9e6 | refs/heads/master | 2020-03-30T16:14:17.374000 | 2019-01-23T13:44:15 | 2019-01-23T13:44:15 | 151,399,820 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.askonlinesolutions.user.tabqyclient.utility.adapter.dummyDataGenrator;
import java.util.ArrayList;
import java.util.List;
public class DummyDataGenerator {
public static List<String> getDummyStringList(int size) {
List<String> list = new ArrayList<>();
for (int i = 0; i < size; i++) {
list.add(i + "");
}
return list;
}
public static List<BankModel> getBankList() {
List<BankModel> bankList = new ArrayList<>();
for (int i = 0; i < 10; i++) {
BankModel model = new BankModel();
switch (i) {
case 0:
model.setBankName("Axis Bank");
break;
case 1:
model.setBankName("Bank Of Baroda");
break;
case 2:
model.setBankName("Bank Of India");
break;
case 3:
model.setBankName("City Bank");
break;
case 4:
model.setBankName("Dena Bank");
break;
case 5:
model.setBankName("HDFC Bank");
break;
case 6:
model.setBankName("IDFC Bank");
break;
case 7:
model.setBankName("ICICI Bank");
break;
case 8:
model.setBankName("IndusInd Bank");
break;
case 9:
model.setBankName("State Bank Of India");
break;
}
bankList.add(model);
}
return bankList;
}
}
| UTF-8 | Java | 1,751 | java | DummyDataGenerator.java | Java | [] | null | [] | package com.askonlinesolutions.user.tabqyclient.utility.adapter.dummyDataGenrator;
import java.util.ArrayList;
import java.util.List;
public class DummyDataGenerator {
public static List<String> getDummyStringList(int size) {
List<String> list = new ArrayList<>();
for (int i = 0; i < size; i++) {
list.add(i + "");
}
return list;
}
public static List<BankModel> getBankList() {
List<BankModel> bankList = new ArrayList<>();
for (int i = 0; i < 10; i++) {
BankModel model = new BankModel();
switch (i) {
case 0:
model.setBankName("Axis Bank");
break;
case 1:
model.setBankName("Bank Of Baroda");
break;
case 2:
model.setBankName("Bank Of India");
break;
case 3:
model.setBankName("City Bank");
break;
case 4:
model.setBankName("Dena Bank");
break;
case 5:
model.setBankName("HDFC Bank");
break;
case 6:
model.setBankName("IDFC Bank");
break;
case 7:
model.setBankName("ICICI Bank");
break;
case 8:
model.setBankName("IndusInd Bank");
break;
case 9:
model.setBankName("State Bank Of India");
break;
}
bankList.add(model);
}
return bankList;
}
}
| 1,751 | 0.43004 | 0.422045 | 59 | 28.677965 | 18.944559 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.576271 | false | false | 3 |
579ade909a3488242f2375c748078da1fe966464 | 32,693,291,063,369 | ed325f4f8795e879d92d7be501ddcaa54951f86b | /src/test/java/de/jug_h/cases/acceptance/MovementTest.java | b49a5f3e2c4263d6abe9f44a6f0804f3039dc005 | [] | no_license | hastebrot/FXmasAnts | https://github.com/hastebrot/FXmasAnts | fe00dbdee25a4d40154fdb95890a5a11adb7c217 | 11d9c67f826c31238f7ab38dd726a16f8127303f | refs/heads/master | 2021-01-25T05:35:11.290000 | 2014-12-10T15:32:54 | 2014-12-10T15:32:54 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package de.jug_h.cases.acceptance;
import de.jug_h.cases.FxRobotTestBase;
public class MovementTest extends FxRobotTestBase {
}
| UTF-8 | Java | 130 | java | MovementTest.java | Java | [] | null | [] | package de.jug_h.cases.acceptance;
import de.jug_h.cases.FxRobotTestBase;
public class MovementTest extends FxRobotTestBase {
}
| 130 | 0.807692 | 0.807692 | 6 | 20.666666 | 20.973528 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 3 |
f076e4f953e3f4a944215461c56e2abfe8d19f8d | 9,809,705,322,818 | a58dd4534a10577c60df31b1b73a23b4243d2e2c | /src/test/java/com/dto/account/TestGetAccountTemplate.java | 4715bbdcb44280cb842ee168258489745455aeef | [] | no_license | dk2n8806/WeaztWeb | https://github.com/dk2n8806/WeaztWeb | 1744c3b9801b84b2f3454235784eaaffe745cdd3 | 9a0fd595d5de4dd9f6e5360e580039c68f4e265f | refs/heads/master | 2021-06-26T12:07:07.356000 | 2017-09-12T05:36:54 | 2017-09-12T05:36:54 | 103,226,535 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.dto.account;
import java.util.List;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import com.BaseTest;
import com.common.dto.AccountTemplateDTO;
import com.common.type.AccountStatus;
import com.common.type.Role;
import com.common.util.date.DateInterval;
import com.core.service.account.dto.AccountTemplateDTOService;
public class TestGetAccountTemplate extends BaseTest {
@Autowired private AccountTemplateDTOService templateDTOService;
private Role role;
private AccountStatus status;
private DateInterval dateInterval;
private Pageable pageable;
@Test
public void test() {
List<AccountTemplateDTO> templateDTOs =
templateDTOService.getTemplates(role, status, dateInterval, pageable);
System.out.println(templateDTOs.size());
}
}
| UTF-8 | Java | 859 | java | TestGetAccountTemplate.java | Java | [] | null | [] | package com.dto.account;
import java.util.List;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import com.BaseTest;
import com.common.dto.AccountTemplateDTO;
import com.common.type.AccountStatus;
import com.common.type.Role;
import com.common.util.date.DateInterval;
import com.core.service.account.dto.AccountTemplateDTOService;
public class TestGetAccountTemplate extends BaseTest {
@Autowired private AccountTemplateDTOService templateDTOService;
private Role role;
private AccountStatus status;
private DateInterval dateInterval;
private Pageable pageable;
@Test
public void test() {
List<AccountTemplateDTO> templateDTOs =
templateDTOService.getTemplates(role, status, dateInterval, pageable);
System.out.println(templateDTOs.size());
}
}
| 859 | 0.811409 | 0.811409 | 32 | 25.84375 | 22.306263 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.21875 | false | false | 3 |
98d3e55335dd084497751ab1624a7ac5fd361ec4 | 9,809,705,321,185 | 329bb70df4a4530008458e5e096794c09f33cfa6 | /app/src/main/java/com/reactiveapps/chatty/utils/PermissionsUtil.java | f758ac9dfba13300c8adf39938eb3db7f93416cf | [] | no_license | reactive-coding/chatty | https://github.com/reactive-coding/chatty | 7c300f9de24045ec6dc7c8cc6e3fe25006bdade6 | d7a9b21cad5c6c51d42b2141ea01c8a401c77c48 | refs/heads/master | 2021-01-11T09:47:08.037000 | 2016-10-14T03:22:50 | 2016-10-14T03:22:50 | 69,223,024 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.reactiveapps.chatty.utils;
import android.Manifest;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import com.reactiveapps.chatty.App;
import com.reactiveapps.chatty.R;
public class PermissionsUtil implements ActivityCompat.OnRequestPermissionsResultCallback {
private static final String TAG = PermissionsUtil.class.getSimpleName();
private static PermissionsUtil mInstance;
private OnRequestPermissionsListener mOnRequestPermissionsListener;
public static synchronized PermissionsUtil getInstance() {
if (mInstance == null) {
mInstance = new PermissionsUtil();
}
return mInstance;
}
public interface OnRequestPermissionsListener {
void onRequestPermissionsSuccess();
void onRequestPermissionsFailured();
}
public void setonRequestPermissionsListener(OnRequestPermissionsListener listener) {
this.mOnRequestPermissionsListener = listener;
}
/**
* 检查权限
*/
public int checkPermission(Context context, String permission) {
return ContextCompat.checkSelfPermission(context, permission);
}
/***
* 是否有该权限
*/
public boolean hasPermission(Context context, String permission) {
boolean hasPermission = false;
int mPermission = ContextCompat.checkSelfPermission(context, permission);
if (mPermission == PackageManager.PERMISSION_GRANTED) {
hasPermission = true;
}
return hasPermission;
}
/***
* public int checkPermission(Context context, String permission) {
* return ContextCompat.checkSelfPermission(context, permission);
* }
* <p/>
* /**
* 是否需要展示请求权限的提示
*/
public boolean shouldShowRequestPermissionRationale(Activity activity, String permission, Object obj) {
boolean isShow = false;
if (obj instanceof Activity) {
isShow = ActivityCompat.shouldShowRequestPermissionRationale(activity, permission);
} else if (obj instanceof Fragment) {
Fragment fragment = (Fragment) obj;
isShow = fragment.shouldShowRequestPermissionRationale(permission);
}
return isShow;
}
/**
* 申请权限
*/
public void requestcheckPermission(Activity activity, String[] permission, int requestCode, Object obj) {
if (obj instanceof Activity) {
ActivityCompat.requestPermissions(activity, permission, requestCode);
} else if (obj instanceof Fragment) {
Fragment fragment = (Fragment) obj;
fragment.requestPermissions(permission, requestCode);
}
}
/**
* Activity申请权限回调,fragment自己实现回调方法
*/
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
if (grantResults != null) {
for (int i = 0; i < grantResults.length; i++) {
int grantResult = grantResults[i];
if (grantResult == PackageManager.PERMISSION_GRANTED) {
/** permission granted*/
if (mOnRequestPermissionsListener != null) {
Log.d(TAG, " ------onRequestPermissionsResult.onRequestPermissionsSuccess------");
mOnRequestPermissionsListener.onRequestPermissionsSuccess();
}
} else {
/** permission denied*/
if (mOnRequestPermissionsListener != null) {
Log.d(TAG, " ------onRequestPermissionsResult.onRequestPermissionsFailured------");
mOnRequestPermissionsListener.onRequestPermissionsFailured();
}
}
}
}
}
private Dialog dialog;
/**
* 申请一個权限
*/
public void requestPermission(final Activity activity, final String permission, final int requestCode, final Object object) {
int mPermission = PermissionsUtil.getInstance().checkPermission(App.getInst().getApplicationContext(), permission);
if (mPermission != PackageManager.PERMISSION_GRANTED) {
if (shouldShowRequestPermissionRationale(activity, permission, object)) {
Log.d(TAG, " ------shouldShowRequestPermissionRationale------");
dialog = DialogFactory.createDialogWithStyle2(activity, getDialogTitle(getPermissionName(permission)), App.getInst().getApplicationContext().getString(R.string.permission_dialog_cacel),
App.getInst().getApplicationContext().getString(R.string.permission_dialog_ok), new View.OnClickListener() {
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.dialog_permission_pos_button) {
dialog.dismiss();
ToastUtil.showLongToast(App.getInst().getApplicationContext().getString(R.string.permission_dialog_title2, getPermissionName(permission)));
} else if (id == R.id.dialog_permission_neg_button) {
dialog.dismiss();
requestcheckPermission(activity, new String[]{permission}, requestCode, object);
}
}
});
dialog.show();
} else {
Log.d(TAG, " ------requestcheckPermission------");
requestcheckPermission(activity, new String[]{permission}, requestCode, object);
}
} else {
if (mOnRequestPermissionsListener != null) {
mOnRequestPermissionsListener.onRequestPermissionsSuccess();
}
}
}
/**
* 申请多個权限,彈出框優先顯示第一個權限名字
*/
public void requestPermissions(final Activity activity, final String[] permission, final int requestCode, final Object object) {
for (String pm : permission) {
Log.d("permission:", pm);
int mPermission = PermissionsUtil.getInstance().checkPermission(App.getInst().getApplicationContext(), pm);
if (mPermission != PackageManager.PERMISSION_GRANTED) {
if (PermissionsUtil.shouldShowRationale(activity, permission)) {
dialog = DialogFactory.createDialogWithStyle2(activity, getDialogTitle(getPermissionNames(permission)), App.getInst().getApplicationContext().getString(R.string.permission_dialog_cacel),
App.getInst().getApplicationContext().getString(R.string.permission_dialog_ok), new View.OnClickListener() {
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.dialog_permission_pos_button) {
dialog.dismiss();
ToastUtil.showLongToast(App.getInst().getApplicationContext().getString(R.string.permission_dialog_title2, getPermissionNames(permission)));
} else if (id == R.id.dialog_permission_neg_button) {
dialog.dismiss();
requestcheckPermission(activity, permission, requestCode, object);
}
}
});
dialog.show();
} else {
requestcheckPermission(activity, permission, requestCode, object);
}
return;
}
}
if (mOnRequestPermissionsListener != null) {
mOnRequestPermissionsListener.onRequestPermissionsSuccess();
}
}
/**
* 是否是6.0以上版本
*
* @return
*/
public boolean isMNC() {
return Build.VERSION.SDK_INT >= 23;
}
public static String getPermissionName(String permission) {
String name;
switch (permission) {
case Manifest.permission.READ_PHONE_STATE:
name = App.getInst().getApplicationContext().getString(R.string.permission_read_phone_state);
break;
case Manifest.permission.ACCESS_FINE_LOCATION:
name = App.getInst().getApplicationContext().getString(R.string.permission_location);
break;
case Manifest.permission.READ_CONTACTS:
name = App.getInst().getApplicationContext().getString(R.string.permission_read_contacts);
break;
case Manifest.permission.CAMERA:
name = App.getInst().getApplicationContext().getString(R.string.permission_camera);
break;
case Manifest.permission.RECORD_AUDIO:
name = App.getInst().getApplicationContext().getString(R.string.permission_audio);
break;
case Manifest.permission.WRITE_EXTERNAL_STORAGE:
name = App.getInst().getApplicationContext().getString(R.string.permission_storage);
break;
default:
name = "";
break;
}
return name;
}
public static String getPermissionNames(String[] permissions) {
String name = "";
for (String permission : permissions) {
switch (permission) {
case Manifest.permission.READ_PHONE_STATE:
name = App.getInst().getApplicationContext().getString(R.string.permission_read_phone_state);
break;
case Manifest.permission.ACCESS_FINE_LOCATION:
name = App.getInst().getApplicationContext().getString(R.string.permission_location);
break;
case Manifest.permission.READ_CONTACTS:
name = App.getInst().getApplicationContext().getString(R.string.permission_read_contacts);
break;
case Manifest.permission.CAMERA:
if (!TextUtils.isEmpty(name)) {
name = name.concat("、").concat(App.getInst().getApplicationContext().getString(R.string.permission_camera));
} else {
name = App.getInst().getApplicationContext().getString(R.string.permission_camera);
}
break;
case Manifest.permission.RECORD_AUDIO:
if (!TextUtils.isEmpty(name)) {
name = name.concat("、").concat(App.getInst().getApplicationContext().getString(R.string.permission_audio));
} else {
name = App.getInst().getApplicationContext().getString(R.string.permission_audio);
}
break;
case Manifest.permission.WRITE_EXTERNAL_STORAGE:
if (!TextUtils.isEmpty(name)) {
name = name.concat("、").concat(App.getInst().getApplicationContext().getString(R.string.permission_storage));
} else {
name = App.getInst().getApplicationContext().getString(R.string.permission_storage);
}
break;
default:
name = "";
break;
}
}
return name;
}
public String getDialogTitle(String permissionName) {
String title = "";
if (App.getInst().getApplicationContext().getString(R.string.permission_read_phone_state).equals(permissionName)) {
title = App.getInst().getApplicationContext().getString(R.string.permission_dialog_title, permissionName);
} else {
title = App.getInst().getApplicationContext().getString(R.string.permission_dialog_title1, permissionName);
}
return title;
}
/**
* 是否应该提示用户,我们需要权限的原因
*/
public static boolean shouldShowRationale(Activity activity, String[] permissionsNeeded) {
boolean result = false;
for (String per : permissionsNeeded) {
result = result | ActivityCompat.shouldShowRequestPermissionRationale(activity, per);
}
return result;
}
}
| UTF-8 | Java | 12,921 | java | PermissionsUtil.java | Java | [] | null | [] | package com.reactiveapps.chatty.utils;
import android.Manifest;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import com.reactiveapps.chatty.App;
import com.reactiveapps.chatty.R;
public class PermissionsUtil implements ActivityCompat.OnRequestPermissionsResultCallback {
private static final String TAG = PermissionsUtil.class.getSimpleName();
private static PermissionsUtil mInstance;
private OnRequestPermissionsListener mOnRequestPermissionsListener;
public static synchronized PermissionsUtil getInstance() {
if (mInstance == null) {
mInstance = new PermissionsUtil();
}
return mInstance;
}
public interface OnRequestPermissionsListener {
void onRequestPermissionsSuccess();
void onRequestPermissionsFailured();
}
public void setonRequestPermissionsListener(OnRequestPermissionsListener listener) {
this.mOnRequestPermissionsListener = listener;
}
/**
* 检查权限
*/
public int checkPermission(Context context, String permission) {
return ContextCompat.checkSelfPermission(context, permission);
}
/***
* 是否有该权限
*/
public boolean hasPermission(Context context, String permission) {
boolean hasPermission = false;
int mPermission = ContextCompat.checkSelfPermission(context, permission);
if (mPermission == PackageManager.PERMISSION_GRANTED) {
hasPermission = true;
}
return hasPermission;
}
/***
* public int checkPermission(Context context, String permission) {
* return ContextCompat.checkSelfPermission(context, permission);
* }
* <p/>
* /**
* 是否需要展示请求权限的提示
*/
public boolean shouldShowRequestPermissionRationale(Activity activity, String permission, Object obj) {
boolean isShow = false;
if (obj instanceof Activity) {
isShow = ActivityCompat.shouldShowRequestPermissionRationale(activity, permission);
} else if (obj instanceof Fragment) {
Fragment fragment = (Fragment) obj;
isShow = fragment.shouldShowRequestPermissionRationale(permission);
}
return isShow;
}
/**
* 申请权限
*/
public void requestcheckPermission(Activity activity, String[] permission, int requestCode, Object obj) {
if (obj instanceof Activity) {
ActivityCompat.requestPermissions(activity, permission, requestCode);
} else if (obj instanceof Fragment) {
Fragment fragment = (Fragment) obj;
fragment.requestPermissions(permission, requestCode);
}
}
/**
* Activity申请权限回调,fragment自己实现回调方法
*/
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
if (grantResults != null) {
for (int i = 0; i < grantResults.length; i++) {
int grantResult = grantResults[i];
if (grantResult == PackageManager.PERMISSION_GRANTED) {
/** permission granted*/
if (mOnRequestPermissionsListener != null) {
Log.d(TAG, " ------onRequestPermissionsResult.onRequestPermissionsSuccess------");
mOnRequestPermissionsListener.onRequestPermissionsSuccess();
}
} else {
/** permission denied*/
if (mOnRequestPermissionsListener != null) {
Log.d(TAG, " ------onRequestPermissionsResult.onRequestPermissionsFailured------");
mOnRequestPermissionsListener.onRequestPermissionsFailured();
}
}
}
}
}
private Dialog dialog;
/**
* 申请一個权限
*/
public void requestPermission(final Activity activity, final String permission, final int requestCode, final Object object) {
int mPermission = PermissionsUtil.getInstance().checkPermission(App.getInst().getApplicationContext(), permission);
if (mPermission != PackageManager.PERMISSION_GRANTED) {
if (shouldShowRequestPermissionRationale(activity, permission, object)) {
Log.d(TAG, " ------shouldShowRequestPermissionRationale------");
dialog = DialogFactory.createDialogWithStyle2(activity, getDialogTitle(getPermissionName(permission)), App.getInst().getApplicationContext().getString(R.string.permission_dialog_cacel),
App.getInst().getApplicationContext().getString(R.string.permission_dialog_ok), new View.OnClickListener() {
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.dialog_permission_pos_button) {
dialog.dismiss();
ToastUtil.showLongToast(App.getInst().getApplicationContext().getString(R.string.permission_dialog_title2, getPermissionName(permission)));
} else if (id == R.id.dialog_permission_neg_button) {
dialog.dismiss();
requestcheckPermission(activity, new String[]{permission}, requestCode, object);
}
}
});
dialog.show();
} else {
Log.d(TAG, " ------requestcheckPermission------");
requestcheckPermission(activity, new String[]{permission}, requestCode, object);
}
} else {
if (mOnRequestPermissionsListener != null) {
mOnRequestPermissionsListener.onRequestPermissionsSuccess();
}
}
}
/**
* 申请多個权限,彈出框優先顯示第一個權限名字
*/
public void requestPermissions(final Activity activity, final String[] permission, final int requestCode, final Object object) {
for (String pm : permission) {
Log.d("permission:", pm);
int mPermission = PermissionsUtil.getInstance().checkPermission(App.getInst().getApplicationContext(), pm);
if (mPermission != PackageManager.PERMISSION_GRANTED) {
if (PermissionsUtil.shouldShowRationale(activity, permission)) {
dialog = DialogFactory.createDialogWithStyle2(activity, getDialogTitle(getPermissionNames(permission)), App.getInst().getApplicationContext().getString(R.string.permission_dialog_cacel),
App.getInst().getApplicationContext().getString(R.string.permission_dialog_ok), new View.OnClickListener() {
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.dialog_permission_pos_button) {
dialog.dismiss();
ToastUtil.showLongToast(App.getInst().getApplicationContext().getString(R.string.permission_dialog_title2, getPermissionNames(permission)));
} else if (id == R.id.dialog_permission_neg_button) {
dialog.dismiss();
requestcheckPermission(activity, permission, requestCode, object);
}
}
});
dialog.show();
} else {
requestcheckPermission(activity, permission, requestCode, object);
}
return;
}
}
if (mOnRequestPermissionsListener != null) {
mOnRequestPermissionsListener.onRequestPermissionsSuccess();
}
}
/**
* 是否是6.0以上版本
*
* @return
*/
public boolean isMNC() {
return Build.VERSION.SDK_INT >= 23;
}
public static String getPermissionName(String permission) {
String name;
switch (permission) {
case Manifest.permission.READ_PHONE_STATE:
name = App.getInst().getApplicationContext().getString(R.string.permission_read_phone_state);
break;
case Manifest.permission.ACCESS_FINE_LOCATION:
name = App.getInst().getApplicationContext().getString(R.string.permission_location);
break;
case Manifest.permission.READ_CONTACTS:
name = App.getInst().getApplicationContext().getString(R.string.permission_read_contacts);
break;
case Manifest.permission.CAMERA:
name = App.getInst().getApplicationContext().getString(R.string.permission_camera);
break;
case Manifest.permission.RECORD_AUDIO:
name = App.getInst().getApplicationContext().getString(R.string.permission_audio);
break;
case Manifest.permission.WRITE_EXTERNAL_STORAGE:
name = App.getInst().getApplicationContext().getString(R.string.permission_storage);
break;
default:
name = "";
break;
}
return name;
}
public static String getPermissionNames(String[] permissions) {
String name = "";
for (String permission : permissions) {
switch (permission) {
case Manifest.permission.READ_PHONE_STATE:
name = App.getInst().getApplicationContext().getString(R.string.permission_read_phone_state);
break;
case Manifest.permission.ACCESS_FINE_LOCATION:
name = App.getInst().getApplicationContext().getString(R.string.permission_location);
break;
case Manifest.permission.READ_CONTACTS:
name = App.getInst().getApplicationContext().getString(R.string.permission_read_contacts);
break;
case Manifest.permission.CAMERA:
if (!TextUtils.isEmpty(name)) {
name = name.concat("、").concat(App.getInst().getApplicationContext().getString(R.string.permission_camera));
} else {
name = App.getInst().getApplicationContext().getString(R.string.permission_camera);
}
break;
case Manifest.permission.RECORD_AUDIO:
if (!TextUtils.isEmpty(name)) {
name = name.concat("、").concat(App.getInst().getApplicationContext().getString(R.string.permission_audio));
} else {
name = App.getInst().getApplicationContext().getString(R.string.permission_audio);
}
break;
case Manifest.permission.WRITE_EXTERNAL_STORAGE:
if (!TextUtils.isEmpty(name)) {
name = name.concat("、").concat(App.getInst().getApplicationContext().getString(R.string.permission_storage));
} else {
name = App.getInst().getApplicationContext().getString(R.string.permission_storage);
}
break;
default:
name = "";
break;
}
}
return name;
}
public String getDialogTitle(String permissionName) {
String title = "";
if (App.getInst().getApplicationContext().getString(R.string.permission_read_phone_state).equals(permissionName)) {
title = App.getInst().getApplicationContext().getString(R.string.permission_dialog_title, permissionName);
} else {
title = App.getInst().getApplicationContext().getString(R.string.permission_dialog_title1, permissionName);
}
return title;
}
/**
* 是否应该提示用户,我们需要权限的原因
*/
public static boolean shouldShowRationale(Activity activity, String[] permissionsNeeded) {
boolean result = false;
for (String per : permissionsNeeded) {
result = result | ActivityCompat.shouldShowRequestPermissionRationale(activity, per);
}
return result;
}
}
| 12,921 | 0.579712 | 0.578691 | 290 | 42.886208 | 39.275124 | 206 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.593103 | false | false | 3 |
e1d2f2bc65aa78c1e8c3a530eb4ba0f88d1f0f88 | 7,000,796,710,886 | 823a6e9cf1703adcf504975717753a3a91dc0b6c | /src/main/java/tconstruct/client/tabs/InventoryTabVanilla.java | 292b191788ddc1801fa397540ee8247f5dc15187 | [] | no_license | Wolffe99/Flans-Mod-NPC-Vehicles | https://github.com/Wolffe99/Flans-Mod-NPC-Vehicles | b78554f70d8f7653ad28a801e084174104c97d56 | c23cbaaf350a502b3b145287a42f996726b203c9 | refs/heads/master | 2021-07-16T13:45:26.389000 | 2020-05-08T19:43:55 | 2020-05-08T19:43:55 | 147,932,702 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | //
// Decompiled by Procyon v0.5.30
//
package tconstruct.client.tabs;
import net.minecraft.item.ItemStack;
import net.minecraft.init.Blocks;
public class InventoryTabVanilla extends AbstractTab
{
public InventoryTabVanilla() {
super(0, 0, 0, new ItemStack(Blocks.crafting_table));
}
@Override
public void onTabClicked() {
TabRegistry.openInventoryGui();
}
@Override
public boolean shouldAddToList() {
return true;
}
}
| UTF-8 | Java | 490 | java | InventoryTabVanilla.java | Java | [] | null | [] | //
// Decompiled by Procyon v0.5.30
//
package tconstruct.client.tabs;
import net.minecraft.item.ItemStack;
import net.minecraft.init.Blocks;
public class InventoryTabVanilla extends AbstractTab
{
public InventoryTabVanilla() {
super(0, 0, 0, new ItemStack(Blocks.crafting_table));
}
@Override
public void onTabClicked() {
TabRegistry.openInventoryGui();
}
@Override
public boolean shouldAddToList() {
return true;
}
}
| 490 | 0.663265 | 0.64898 | 25 | 18.6 | 18.062115 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.36 | false | false | 3 |
eedceb2f29a1dbc03781813a63cb2258e32b4d94 | 22,514,218,579,389 | 6486f00a47cedc9af1ab5566b84f9187998f16f9 | /app/src/main/java/apps/ahqmrf/contestnotifier/auth/response/LoginResponse.java | 334b5a0268cd5e1048fee20d606d0573a36bbf49 | [] | no_license | ahqmrf/ContestNotifier | https://github.com/ahqmrf/ContestNotifier | d5b241025710f6d3f2d11cb4527a52eaab14fccc | 33c0e82f056588c6f7c2401f5da222ec0665ff43 | refs/heads/master | 2020-12-03T02:11:42.377000 | 2017-07-05T20:01:13 | 2017-07-05T20:01:13 | 95,914,336 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package apps.ahqmrf.contestnotifier.auth.response;
import com.google.gson.annotations.SerializedName;
import apps.ahqmrf.contestnotifier.base.BaseResponse;
/**
* Created by bsse0 on 6/28/2017.
*/
public class LoginResponse extends BaseResponse {
@SerializedName("id") private long id;
@SerializedName("username") private String username;
@SerializedName("name") private String name;
@SerializedName("email") private String email;
@SerializedName("workplace") private String workplace;
@SerializedName("token") private String token;
@SerializedName("isActivated") private boolean activated;
@SerializedName("isAdmin") private boolean admin;
@SerializedName("confirmationCode") private String code;
public long getId() {
return id;
}
public String getUsername() {
return username;
}
public String getName() {
return name;
}
public String getEmail() {
return email;
}
public String getWorkplace() {
return workplace;
}
public String getToken() {
return token;
}
public boolean isActivated() {
return activated;
}
public boolean isAdmin() {
return admin;
}
public String getCode() {
return code;
}
}
| UTF-8 | Java | 1,291 | java | LoginResponse.java | Java | [
{
"context": "testnotifier.base.BaseResponse;\n\n/**\n * Created by bsse0 on 6/28/2017.\n */\n\npublic class LoginResponse ext",
"end": 182,
"score": 0.9996428489685059,
"start": 177,
"tag": "USERNAME",
"value": "bsse0"
},
{
"context": "dName(\"id\") private long id;\n @Serialized... | null | [] | package apps.ahqmrf.contestnotifier.auth.response;
import com.google.gson.annotations.SerializedName;
import apps.ahqmrf.contestnotifier.base.BaseResponse;
/**
* Created by bsse0 on 6/28/2017.
*/
public class LoginResponse extends BaseResponse {
@SerializedName("id") private long id;
@SerializedName("username") private String username;
@SerializedName("name") private String name;
@SerializedName("email") private String email;
@SerializedName("workplace") private String workplace;
@SerializedName("token") private String token;
@SerializedName("isActivated") private boolean activated;
@SerializedName("isAdmin") private boolean admin;
@SerializedName("confirmationCode") private String code;
public long getId() {
return id;
}
public String getUsername() {
return username;
}
public String getName() {
return name;
}
public String getEmail() {
return email;
}
public String getWorkplace() {
return workplace;
}
public String getToken() {
return token;
}
public boolean isActivated() {
return activated;
}
public boolean isAdmin() {
return admin;
}
public String getCode() {
return code;
}
}
| 1,291 | 0.659179 | 0.652982 | 57 | 21.649122 | 20.177711 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.368421 | false | false | 3 |
de8951c835088c89f7aeeb6eb9bb65ff50c22505 | 29,652,454,240,432 | 532359b53166f9d6bc8cdbf01df2f66a225bc9d5 | /src/test/java/org/example/PageObjects/HeroPage.java | 146596f8d5680ad5f82ced760703df9ef6364a53 | [] | no_license | MrKrip/KpiTestLab3 | https://github.com/MrKrip/KpiTestLab3 | a91b85ecbe355f43de0d741c27951259972bd3ad | 9ea364e95b59bbbf7ee672009c56ee5e794b6c15 | refs/heads/main | 2023-03-27T19:23:17.832000 | 2021-03-31T16:53:34 | 2021-03-31T16:53:34 | 348,893,143 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.example.PageObjects;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import java.util.concurrent.TimeUnit;
public class HeroPage {
private WebDriver driver;
private WebDriverWait wait;
public HeroPage(WebDriver driver) {
this.driver = driver;
wait = new WebDriverWait(driver, 10);
}
@FindBy(xpath = "//a[@data-hero-id=\"dva\"]")
private WebElement DVa;
@FindBy(xpath = "//a[@data-hero-id=\"ana\"]")
private WebElement Ana;
@FindBy(xpath = "//a[@data-hero-id=\"mercy\"]")
private WebElement Mercy;
@FindBy(xpath = "//a[@data-hero-id=\"bastion\"]")
private WebElement Bastion;
@FindBy(xpath = "//a[@data-hero-id=\"baptiste\"]")
private WebElement Baptiste;
@FindBy(xpath = "//a[@data-hero-id=\"brigitte\"]")
private WebElement Brigitte;
public void CheckDVa()
{
//DVa.click();
WebElement element = driver.findElement(By.xpath ("//a[@data-hero-id=\"dva\"]"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", element);
Wait();
}
public void CheckAna()
{
//Ana.click();
WebElement element = driver.findElement(By.xpath ("//a[@data-hero-id=\"ana\"]"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", element);
Wait();
}
public void CheckMercy()
{
//Mercy.click();
WebElement element = driver.findElement(By.xpath ("//a[@data-hero-id=\"mercy\"]"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", element);
Wait();
}
public void CheckBastion()
{
//Bastion.click();
WebElement element = driver.findElement(By.xpath ("//a[@data-hero-id=\"bastion\"]"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", element);
Wait();
}
public void CheckBaptiste()
{
//Baptiste.click();
WebElement element = driver.findElement(By.xpath ("//a[@data-hero-id=\"baptiste\"]"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", element);
Wait();
}
public void CheckBrigitte()
{
//Brigitte.click();
WebElement element = driver.findElement(By.xpath ("//a[@data-hero-id=\"brigitte\"]"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", element);
Wait();
}
private void Wait()
{
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("abilities")));
}
public String getHeroUrl() {
return driver.getCurrentUrl();
}
}
| UTF-8 | Java | 3,265 | java | HeroPage.java | Java | [] | null | [] | package org.example.PageObjects;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import java.util.concurrent.TimeUnit;
public class HeroPage {
private WebDriver driver;
private WebDriverWait wait;
public HeroPage(WebDriver driver) {
this.driver = driver;
wait = new WebDriverWait(driver, 10);
}
@FindBy(xpath = "//a[@data-hero-id=\"dva\"]")
private WebElement DVa;
@FindBy(xpath = "//a[@data-hero-id=\"ana\"]")
private WebElement Ana;
@FindBy(xpath = "//a[@data-hero-id=\"mercy\"]")
private WebElement Mercy;
@FindBy(xpath = "//a[@data-hero-id=\"bastion\"]")
private WebElement Bastion;
@FindBy(xpath = "//a[@data-hero-id=\"baptiste\"]")
private WebElement Baptiste;
@FindBy(xpath = "//a[@data-hero-id=\"brigitte\"]")
private WebElement Brigitte;
public void CheckDVa()
{
//DVa.click();
WebElement element = driver.findElement(By.xpath ("//a[@data-hero-id=\"dva\"]"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", element);
Wait();
}
public void CheckAna()
{
//Ana.click();
WebElement element = driver.findElement(By.xpath ("//a[@data-hero-id=\"ana\"]"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", element);
Wait();
}
public void CheckMercy()
{
//Mercy.click();
WebElement element = driver.findElement(By.xpath ("//a[@data-hero-id=\"mercy\"]"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", element);
Wait();
}
public void CheckBastion()
{
//Bastion.click();
WebElement element = driver.findElement(By.xpath ("//a[@data-hero-id=\"bastion\"]"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", element);
Wait();
}
public void CheckBaptiste()
{
//Baptiste.click();
WebElement element = driver.findElement(By.xpath ("//a[@data-hero-id=\"baptiste\"]"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", element);
Wait();
}
public void CheckBrigitte()
{
//Brigitte.click();
WebElement element = driver.findElement(By.xpath ("//a[@data-hero-id=\"brigitte\"]"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", element);
Wait();
}
private void Wait()
{
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("abilities")));
}
public String getHeroUrl() {
return driver.getCurrentUrl();
}
}
| 3,265 | 0.614395 | 0.611945 | 105 | 29.095238 | 27.0884 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.609524 | false | false | 3 |
6d02c3259020d286a0550bff4d7a9212967b2d6a | 29,652,454,238,301 | e33641e38393833b179b793d590749a97272e818 | /app/src/main/java/dong/lan/smarttrip/presentation/viewfeatures/AddTravelView.java | 5b3a1054c35c7ed93be4540cbbdbdbe8fb6547aa | [] | no_license | donlan/SmartTrip | https://github.com/donlan/SmartTrip | 2a9daf6ee81da102c0160ba78b8225bb496d3d1f | 7f53b364cb9746f17f3c1e37b54d39304e40264c | refs/heads/master | 2021-01-24T11:08:35.299000 | 2017-07-15T06:49:32 | 2017-07-15T06:50:06 | 70,250,343 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package dong.lan.smarttrip.presentation.viewfeatures;
import android.app.Activity;
import dong.lan.smarttrip.base.ProgressView;
import dong.lan.model.features.ITravel;
/**
* Created by 梁桂栋 on 17-2-2 : 下午10:47.
* Email: 760625325@qq.com
* GitHub: github.com/donlan
* description: SmartTrip
*/
public interface AddTravelView extends ProgressView {
Activity activity();
void initView(ITravel travel);
}
| UTF-8 | Java | 444 | java | AddTravelView.java | Java | [
{
"context": "ong.lan.model.features.ITravel;\n\n/**\n * Created by 梁桂栋 on 17-2-2 : 下午10:47.\n * Email: 760625325@qq",
"end": 193,
"score": 0.9998926520347595,
"start": 190,
"tag": "NAME",
"value": "梁桂栋"
},
{
"context": "eated by 梁桂栋 on 17-2-2 : 下午10:47.\n * Email: 760625... | null | [] | package dong.lan.smarttrip.presentation.viewfeatures;
import android.app.Activity;
import dong.lan.smarttrip.base.ProgressView;
import dong.lan.model.features.ITravel;
/**
* Created by 梁桂栋 on 17-2-2 : 下午10:47.
* Email: <EMAIL>
* GitHub: github.com/donlan
* description: SmartTrip
*/
public interface AddTravelView extends ProgressView {
Activity activity();
void initView(ITravel travel);
}
| 435 | 0.726852 | 0.6875 | 22 | 18.636364 | 19.248484 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.272727 | false | false | 3 |
6fd158ac84329f154b31e90e4bea093b7453db9f | 171,798,754,547 | f28d0c8473e265f93fc2f804aa3ed500972fad4d | /src/template/Chat.java | c8eb1cb4af21106bd10f7a7ac9d85a29e7fdc805 | [] | no_license | 303725546/tangyang | https://github.com/303725546/tangyang | f526f3a7a25fc0e3d9385ca693d18eeb0628b9d0 | b60ad835ed5ecd782e5323e2ebd669bcc5b5b25f | refs/heads/master | 2020-07-03T02:04:11.523000 | 2019-08-11T10:58:17 | 2019-08-11T10:58:17 | 201,751,709 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package template;
public interface Chat {
void say(String msg);
}
| UTF-8 | Java | 71 | java | Chat.java | Java | [] | null | [] | package template;
public interface Chat {
void say(String msg);
}
| 71 | 0.704225 | 0.704225 | 5 | 13.2 | 10.703271 | 25 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 3 |
370a1db6bff4cb40c9d96612081b66fc194474f4 | 9,070,970,992,193 | 31bc1627743fcefb6ded06f07d41bc61853ab426 | /openflowjava/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/EnhancedMessageCodeKey.java | 87ebec53741d25333dc5dec189fa21ee08a03307 | [] | no_license | opendaylight/openflowplugin | https://github.com/opendaylight/openflowplugin | d67f2d311e812339ac977e09b1380ba22931d922 | bc15fa6cbd453a64d08bed885f4ac3afde171613 | refs/heads/master | 2023-09-01T19:48:38.338000 | 2023-08-31T18:50:02 | 2023-08-31T18:50:02 | 16,362,543 | 60 | 77 | null | false | 2019-07-11T09:23:02 | 2014-01-29T23:13:36 | 2019-07-09T05:31:01 | 2019-07-09T05:30:59 | 22,446 | 46 | 62 | 1 | Java | false | false | /*
* Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.openflowjava.protocol.api.extensibility;
import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
import org.opendaylight.yangtools.yang.common.Uint8;
/**
* Enhanced MessageCodeKey.
*
* @author michal.polkorab
*/
public class EnhancedMessageCodeKey extends MessageCodeKey {
private final int msgType2;
/**
* Constructor.
*
* @param version wire protocol version
* @param value used as distinguisher
* @param value2 used as detailed distinguisher
* @param clazz class of object that is going to be deserialized
*/
public EnhancedMessageCodeKey(final Uint8 version, final int value, final int value2, final Class<?> clazz) {
super(version, value, clazz);
this.msgType2 = value2;
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + msgType2;
return result;
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
EnhancedMessageCodeKey other = (EnhancedMessageCodeKey) obj;
if (msgType2 != other.msgType2) {
return false;
}
return true;
}
@Override
public String toString() {
return super.toString() + " msgType2: " + msgType2;
}
}
| UTF-8 | Java | 1,855 | java | EnhancedMessageCodeKey.java | Java | [
{
"context": "t8;\n\n/**\n * Enhanced MessageCodeKey.\n *\n * @author michal.polkorab\n */\npublic class EnhancedMessageCodeKey ",
"end": 561,
"score": 0.7131712436676025,
"start": 555,
"tag": "NAME",
"value": "michal"
},
{
"context": "*\n * Enhanced MessageCodeKey.\n *\n * @author m... | null | [] | /*
* Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.openflowjava.protocol.api.extensibility;
import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
import org.opendaylight.yangtools.yang.common.Uint8;
/**
* Enhanced MessageCodeKey.
*
* @author michal.polkorab
*/
public class EnhancedMessageCodeKey extends MessageCodeKey {
private final int msgType2;
/**
* Constructor.
*
* @param version wire protocol version
* @param value used as distinguisher
* @param value2 used as detailed distinguisher
* @param clazz class of object that is going to be deserialized
*/
public EnhancedMessageCodeKey(final Uint8 version, final int value, final int value2, final Class<?> clazz) {
super(version, value, clazz);
this.msgType2 = value2;
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + msgType2;
return result;
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
EnhancedMessageCodeKey other = (EnhancedMessageCodeKey) obj;
if (msgType2 != other.msgType2) {
return false;
}
return true;
}
@Override
public String toString() {
return super.toString() + " msgType2: " + msgType2;
}
}
| 1,855 | 0.638814 | 0.626954 | 64 | 27.984375 | 25.828455 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.359375 | false | false | 3 |
19e138c3646982f08abda80e095f8797366a1e86 | 6,201,932,826,506 | 3506db3b7a303f9c7d326e90fdfd6bbbcf5ecf0d | /src/test/HelloWorld.java | 4d46bf1a84b55e4f41bb9a195205fd1de75c9a5d | [] | no_license | Sherwain/HelloWorld | https://github.com/Sherwain/HelloWorld | af2efc1e199973c3851512c6571eb8c5fbaa149a | 477ea4c15fe53207b5110b1171fc6dbbc60ae5ba | refs/heads/master | 2016-08-12T12:55:00.676000 | 2015-10-17T04:15:37 | 2015-10-17T04:15:37 | 44,423,975 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package test;
public class HelloWorld {
public static void main(String[] args) {
System.out.println(6*6 / 2 * 3 + 4);
System.out.println(2 * 3 / 4);
System.out.println(2 / 3 * 4);
}
}
| UTF-8 | Java | 193 | java | HelloWorld.java | Java | [] | null | [] | package test;
public class HelloWorld {
public static void main(String[] args) {
System.out.println(6*6 / 2 * 3 + 4);
System.out.println(2 * 3 / 4);
System.out.println(2 / 3 * 4);
}
}
| 193 | 0.626943 | 0.569948 | 9 | 20.444445 | 15.671 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.333333 | false | false | 3 |
a1ec04bfd7693203236394ee78589b1ef979ede5 | 23,888,608,112,889 | f52d81e29cb7979c5744328c60597d5cfe8323ad | /generic-import/src/main/java/com/equinox/imports/file/ImportFileFilter.java | 9cbae12fbbec6deb80357e7d99e99126247efc33 | [
"MIT"
] | permissive | rnowif/import | https://github.com/rnowif/import | 5c1187672e9f54bf50cfd552b34707d3204261d2 | b710566d336b73a7772655e6f57be7d538dcc945 | refs/heads/master | 2021-01-22T10:09:25.566000 | 2016-09-13T14:15:17 | 2016-09-13T14:15:17 | 23,909,560 | 0 | 0 | null | false | 2016-09-13T14:15:18 | 2014-09-11T08:02:49 | 2016-08-30T07:14:50 | 2016-09-13T14:15:17 | 54 | 0 | 0 | 6 | Java | null | null | package com.equinox.imports.file;
public interface ImportFileFilter {
/**
* True if the line must be kept
*
* @param value
* @return
*/
boolean filter(String value);
}
| UTF-8 | Java | 197 | java | ImportFileFilter.java | Java | [] | null | [] | package com.equinox.imports.file;
public interface ImportFileFilter {
/**
* True if the line must be kept
*
* @param value
* @return
*/
boolean filter(String value);
}
| 197 | 0.619289 | 0.619289 | 13 | 13.153846 | 13.811067 | 35 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.692308 | false | false | 3 |
290e9e549733ae6e47ec52735d3dcf85cb27db87 | 1,443,109,074,873 | eaaddb508c2bd976daa3ad636cf3048b46f21dcf | /src/main/java/com/frequentlymisseddeadlines/chessuci/UciListener.java | e7d0c86b69e42032e79032a148f2c726cbeadf1e | [
"MIT"
] | permissive | FrequentlyMissedDeadlines/Chess-UCI | https://github.com/FrequentlyMissedDeadlines/Chess-UCI | fad521bdb26c072fe2fcefb41dfb15e2362d61a3 | 91b8712c5bde89baf0896ee6952a17014c45ce83 | refs/heads/main | 2023-03-05T11:21:56.805000 | 2021-02-21T10:35:46 | 2021-02-21T10:35:46 | 323,388,053 | 4 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.frequentlymisseddeadlines.chessuci;
import lombok.Generated;
import java.util.LinkedList;
/**
* Implement this interface to branch your engine on UCI protocol events
*/
public interface UciListener {
/**
* This method is called when a GUI get connected to your Chess Engine
*/
default void onConnection() {
}
/**
* Return your Chess Engine Name. It may be displayed in the GUI.
* @return chess engine name
*/
String getEngineName();
/**
* Return your name. It may be displayed in the GUI.
* @return your name
*/
String getAuthorName();
/**
* List all options that are supported by your engine. The GUI will send you back their values if they are supported.
* For example:
* <ul>
* <li>name NalimovPath type string default <empty></li>
* <li>name ClearHash type button</li>
* <li>name Nullmove type check default true</li>
* </ul>
* More details <a href="http://wbec-ridderkerk.nl/html/UCIProtocol.html">in the specs</a>.
* @return list of options supported by the engine
*/
default Iterable<String> listSupportedOptions() {
return new LinkedList<>();
}
/**
* This method is called when an option value is returned by the GUI. Feel free to use it or not in your Engine.
* Example value: <code>name NalimovCache value 32</code>
* @param option option name and value
*/
default void setOptionValue(String option) {
}
/**
* This method is called to synchronize the GUI with your engine in case it provided some input that could be long to process by
* the engine. If you are ready to proceed, simply return;
*/
default void getReady() {
}
/**
* This method is called when the position has changed. It provides the initial position and all moves done from it.
* @param initialPosition the initial position in <a href="https://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation">FEN notation</a>
* @param moves an array of String containing all moves done from the starting position. The moves are in origin-destination notation.
* For example:
* <ul>
* <li>
* e2e4
* </li>
* <li>
* e5e7
* </li>
* </ul>
*/
void setPosition(String initialPosition, String[] moves);
/**
* This method is called to tell the engine it should search for a move to play. Once it found one, it must
* return it as a origin-destination String.
* @param parameters the search parameters
* @return
*/
String go(GoParameters parameters);
}
| UTF-8 | Java | 2,781 | java | UciListener.java | Java | [] | null | [] | package com.frequentlymisseddeadlines.chessuci;
import lombok.Generated;
import java.util.LinkedList;
/**
* Implement this interface to branch your engine on UCI protocol events
*/
public interface UciListener {
/**
* This method is called when a GUI get connected to your Chess Engine
*/
default void onConnection() {
}
/**
* Return your Chess Engine Name. It may be displayed in the GUI.
* @return chess engine name
*/
String getEngineName();
/**
* Return your name. It may be displayed in the GUI.
* @return your name
*/
String getAuthorName();
/**
* List all options that are supported by your engine. The GUI will send you back their values if they are supported.
* For example:
* <ul>
* <li>name NalimovPath type string default <empty></li>
* <li>name ClearHash type button</li>
* <li>name Nullmove type check default true</li>
* </ul>
* More details <a href="http://wbec-ridderkerk.nl/html/UCIProtocol.html">in the specs</a>.
* @return list of options supported by the engine
*/
default Iterable<String> listSupportedOptions() {
return new LinkedList<>();
}
/**
* This method is called when an option value is returned by the GUI. Feel free to use it or not in your Engine.
* Example value: <code>name NalimovCache value 32</code>
* @param option option name and value
*/
default void setOptionValue(String option) {
}
/**
* This method is called to synchronize the GUI with your engine in case it provided some input that could be long to process by
* the engine. If you are ready to proceed, simply return;
*/
default void getReady() {
}
/**
* This method is called when the position has changed. It provides the initial position and all moves done from it.
* @param initialPosition the initial position in <a href="https://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation">FEN notation</a>
* @param moves an array of String containing all moves done from the starting position. The moves are in origin-destination notation.
* For example:
* <ul>
* <li>
* e2e4
* </li>
* <li>
* e5e7
* </li>
* </ul>
*/
void setPosition(String initialPosition, String[] moves);
/**
* This method is called to tell the engine it should search for a move to play. Once it found one, it must
* return it as a origin-destination String.
* @param parameters the search parameters
* @return
*/
String go(GoParameters parameters);
}
| 2,781 | 0.616325 | 0.61237 | 88 | 30.602272 | 35.662415 | 143 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.136364 | false | false | 3 |
70adc648a2f7998a488c23839a6b29ada73bbeb6 | 33,947,421,509,502 | 656ce78b903ef3426f8f1ecdaee57217f9fbc40e | /src/org/spongycastle/crypto/params/ECNamedDomainParameters.java | 936f53dd6aaa0cb30e480474c960a669f1edc2df | [] | no_license | zhuharev/periscope-android-source | https://github.com/zhuharev/periscope-android-source | 51bce2c1b0b356718be207789c0b84acf1e7e201 | 637ab941ed6352845900b9d465b8e302146b3f8f | refs/heads/master | 2021-01-10T01:47:19.177000 | 2015-12-25T16:51:27 | 2015-12-25T16:51:27 | 48,586,306 | 8 | 10 | null | null | null | null | null | null | null | null | null | null | null | null | null | // Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package org.spongycastle.crypto.params;
import java.math.BigInteger;
import org.spongycastle.asn1.ASN1ObjectIdentifier;
import org.spongycastle.math.ec.ECCurve;
import org.spongycastle.math.ec.ECPoint;
// Referenced classes of package org.spongycastle.crypto.params:
// ECDomainParameters
public class ECNamedDomainParameters extends ECDomainParameters
{
private ASN1ObjectIdentifier aho;
public ECNamedDomainParameters(ASN1ObjectIdentifier asn1objectidentifier, ECCurve eccurve, ECPoint ecpoint, BigInteger biginteger, BigInteger biginteger1, byte abyte0[])
{
super(eccurve, ecpoint, biginteger, biginteger1, abyte0);
aho = asn1objectidentifier;
}
}
| UTF-8 | Java | 874 | java | ECNamedDomainParameters.java | Java | [
{
"context": "// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.\n// Jad home page: http://www.geocities.com/kpdus",
"end": 61,
"score": 0.9996671676635742,
"start": 45,
"tag": "NAME",
"value": "Pavel Kouznetsov"
}
] | null | [] | // Decompiled by Jad v1.5.8e. Copyright 2001 <NAME>.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package org.spongycastle.crypto.params;
import java.math.BigInteger;
import org.spongycastle.asn1.ASN1ObjectIdentifier;
import org.spongycastle.math.ec.ECCurve;
import org.spongycastle.math.ec.ECPoint;
// Referenced classes of package org.spongycastle.crypto.params:
// ECDomainParameters
public class ECNamedDomainParameters extends ECDomainParameters
{
private ASN1ObjectIdentifier aho;
public ECNamedDomainParameters(ASN1ObjectIdentifier asn1objectidentifier, ECCurve eccurve, ECPoint ecpoint, BigInteger biginteger, BigInteger biginteger1, byte abyte0[])
{
super(eccurve, ecpoint, biginteger, biginteger1, abyte0);
aho = asn1objectidentifier;
}
}
| 864 | 0.778032 | 0.758581 | 25 | 33.959999 | 37.34111 | 173 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.68 | false | false | 3 |
672230f26126227d24068e41f3126da34bad21a0 | 515,396,136,704 | 9d68278633e982f507d6b41ce47857bb68672e51 | /common/src/main/java/com/bilalalp/common/repository/TvProcessInfoRepository.java | 32b861851594a44dc8d7b38c23601732ca7324fb | [] | no_license | lalib/linker | https://github.com/lalib/linker | 9f79ca2a15f7a89f3b7b2060be9d0c7bfe6c79fa | e2b2fcef04c634f196bc0901eba920cb1e0b0b98 | refs/heads/master | 2021-01-19T04:43:44.803000 | 2016-09-09T20:36:06 | 2016-09-09T20:36:06 | 45,192,045 | 5 | 2 | null | false | 2015-12-27T12:59:14 | 2015-10-29T15:24:55 | 2015-12-02T07:34:32 | 2015-12-27T12:59:14 | 142 | 3 | 1 | 0 | Java | null | null | package com.bilalalp.common.repository;
import com.bilalalp.common.entity.patent.SplitWordType;
import com.bilalalp.common.entity.tfidf.TvProcessInfo;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface TvProcessInfoRepository extends JpaRepository<TvProcessInfo, Long> {
@Query("select p from TvProcessInfo p order by p.tfIdfValue desc")
List<TvProcessInfo> findByLimit(Pageable pageable);
@Query("SELECT DISTINCT p FROM TvProcessInfo p, WordSummaryInfo w, PatentInfo i, SplitWordInfo s, AdditionalWordInfo aw " +
"WHERE w.id = p.wordId AND i.id in (:patentIds) AND s.patentInfo.id = i.id and w.word <> aw.word " +
"order by p.tfIdfValue desc")
List<TvProcessInfo> findByLimit(Pageable pageRequest, @Param("patentIds") List<Long> patentIds);
@Query("SELECT DISTINCT p FROM TvProcessInfo p, WordSummaryInfo w, PatentInfo i, SplitWordInfo s " +
"WHERE w.id = p.wordId AND s.patentInfo.id = i.id AND s.splitWordType = :splitWordType AND i.id in (:patentIds) AND s.patentInfo.id = i.id " +
"order by p.tfIdfValue desc")
List<TvProcessInfo> findByLimit(Pageable pageable, @Param("splitWordType") SplitWordType splitWordType,@Param("patentIds") List<Long> patentIds);
} | UTF-8 | Java | 1,565 | java | TvProcessInfoRepository.java | Java | [] | null | [] | package com.bilalalp.common.repository;
import com.bilalalp.common.entity.patent.SplitWordType;
import com.bilalalp.common.entity.tfidf.TvProcessInfo;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface TvProcessInfoRepository extends JpaRepository<TvProcessInfo, Long> {
@Query("select p from TvProcessInfo p order by p.tfIdfValue desc")
List<TvProcessInfo> findByLimit(Pageable pageable);
@Query("SELECT DISTINCT p FROM TvProcessInfo p, WordSummaryInfo w, PatentInfo i, SplitWordInfo s, AdditionalWordInfo aw " +
"WHERE w.id = p.wordId AND i.id in (:patentIds) AND s.patentInfo.id = i.id and w.word <> aw.word " +
"order by p.tfIdfValue desc")
List<TvProcessInfo> findByLimit(Pageable pageRequest, @Param("patentIds") List<Long> patentIds);
@Query("SELECT DISTINCT p FROM TvProcessInfo p, WordSummaryInfo w, PatentInfo i, SplitWordInfo s " +
"WHERE w.id = p.wordId AND s.patentInfo.id = i.id AND s.splitWordType = :splitWordType AND i.id in (:patentIds) AND s.patentInfo.id = i.id " +
"order by p.tfIdfValue desc")
List<TvProcessInfo> findByLimit(Pageable pageable, @Param("splitWordType") SplitWordType splitWordType,@Param("patentIds") List<Long> patentIds);
} | 1,565 | 0.761022 | 0.761022 | 29 | 53 | 44.484016 | 154 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.827586 | false | false | 3 |
df6330fb84b6e2fd7f33c5467609f50ac5f855ed | 25,829,933,354,011 | e3237d7a31397cbc76b102ed3e08f6533ccab3df | /hw01/src/Box.java | f5d3258a8581036709aa630145fe1c43e0e75715 | [] | no_license | timinmax/java3 | https://github.com/timinmax/java3 | 253d04f689abb86fde8b389975a4c8234013c8aa | 462c57b13115044d595bac84591e647ec02d9e2d | refs/heads/master | 2021-04-21T12:18:32.193000 | 2020-04-22T17:18:39 | 2020-04-22T17:18:39 | 249,779,011 | 0 | 0 | null | false | 2020-04-22T17:18:41 | 2020-03-24T17:53:06 | 2020-04-12T18:20:29 | 2020-04-22T17:18:40 | 2,215 | 0 | 0 | 0 | Java | false | false | import java.util.ArrayList;
public class Box <T extends Fruit> {
private ArrayList <T> boxContent;
public Box() {
this.boxContent = new ArrayList<T>();
}
public void addFruit(T fruit){
boxContent.add(fruit);
}
public float getWeight(){
float totalWeight = 0f;
for (T e: boxContent) totalWeight+= e.getWeight();
return totalWeight;
}
public boolean compare(Box anotherBox){
return getWeight()==anotherBox.getWeight();
}
public void moveFruits(Box<T> anotherBox){
for(T e: boxContent)anotherBox.addFruit(e);
boxContent.clear();
}
}
| UTF-8 | Java | 646 | java | Box.java | Java | [] | null | [] | import java.util.ArrayList;
public class Box <T extends Fruit> {
private ArrayList <T> boxContent;
public Box() {
this.boxContent = new ArrayList<T>();
}
public void addFruit(T fruit){
boxContent.add(fruit);
}
public float getWeight(){
float totalWeight = 0f;
for (T e: boxContent) totalWeight+= e.getWeight();
return totalWeight;
}
public boolean compare(Box anotherBox){
return getWeight()==anotherBox.getWeight();
}
public void moveFruits(Box<T> anotherBox){
for(T e: boxContent)anotherBox.addFruit(e);
boxContent.clear();
}
}
| 646 | 0.613003 | 0.611455 | 30 | 20.533333 | 19.207174 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 3 |
4c1eae8106a416527640e89cd07add89c51bda6a | 6,562,710,078,965 | f28ce1b57be8ed3056cd9be285015a0fe6d628a8 | /src/main/java/edu/uoa/cs/master/cloudmanufacturingnlp/business/nlp/NlpHelper.java | e8784d12eb0d4eaf27b1df107dcc906162a0089c | [
"Apache-2.0"
] | permissive | ping-zhao-yz/cloud-manufacturing-nlp | https://github.com/ping-zhao-yz/cloud-manufacturing-nlp | 2f4d7adccb883aa3c728826024274d71ed35a4dc | 6954a5cc6fe04f587d3b5e51437e039a3ae3d13b | refs/heads/master | 2022-03-05T20:29:09.971000 | 2022-02-27T00:28:16 | 2022-02-27T00:28:16 | 39,935,878 | 0 | 0 | Apache-2.0 | false | 2022-02-27T00:28:53 | 2015-07-30T06:54:36 | 2022-02-27T00:24:41 | 2022-02-27T00:28:16 | 11,709 | 0 | 0 | 0 | PostScript | false | false | /*
* Copyright (c) 2015 The University of Auckland
*
* 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.
*
* Authors: Ping Zhao (pzha291@aucklanduni.ac.nz)
* Created: 2015-06-10
* Last Updated: --
*/
package edu.uoa.cs.master.cloudmanufacturingnlp.business.nlp;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.commons.lang3.StringUtils;
import edu.uoa.cs.master.cloudmanufacturingnlp.business.dictionary.DictionaryService;
import edu.uoa.cs.master.cloudmanufacturingnlp.util.Constants;
import edu.uoa.cs.master.cloudmanufacturingnlp.util.Tools;
public class NlpHelper {
private DictionaryService dictionaryService;
public NlpHelper(DictionaryService dictionaryService) {
this.dictionaryService = dictionaryService;
}
/**
* Lookup the dependent from the triples.
*
* @param gov
* @param reln
* @return
*/
public String lookupDep(Map<String, Map<String, String>> triples, String gov, String reln) {
String dep = null;
Map<String, String> dep_reln_map = triples.get(gov);
if (dep_reln_map == null) {
return dep;
}
Iterator<Entry<String, String>> it = dep_reln_map.entrySet().iterator();
while (it.hasNext()) {
Entry<String, String> entry = it.next();
if (reln.equals(entry.getValue())) {
dep = entry.getKey();
break;
}
}
return dep;
}
/**
* Lookup the list of dependents from the triples.
*
* @param gov
* @param reln
* @return
*/
public List<String> lookupDeps(Map<String, Map<String, String>> triples, String gov, String reln) {
List<String> deps = null;
Map<String, String> dep_reln_map = triples.get(gov);
if (dep_reln_map == null) {
return deps;
}
Iterator<Entry<String, String>> it = dep_reln_map.entrySet().iterator();
while (it.hasNext()) {
Entry<String, String> entry = it.next();
if (this.dictionaryService.isSynonym(entry.getValue(), reln)) {
if (deps == null) {
deps = new ArrayList<String>();
}
deps.add(entry.getKey());
}
}
return deps;
}
/**
* Retrieve the base location which can be: NZ, New Zealand, Auckland, etc.
*
* @param originalString
* @return
*/
public String getBaseLocation(String originalString) {
// remove the suffix
String tempString = Tools.removeDashSuffix(originalString);
if (tempString.toLowerCase().endsWith(Constants.Nlp.BASED)) {
tempString = tempString.substring(0, tempString.toLowerCase().indexOf(Constants.Nlp.BASED));
}
tempString = tempString.trim();
if (tempString.endsWith("-")) {
tempString = tempString.substring(0, tempString.length() - 1);
}
String name = Tools.upperCaseString(tempString);
String countryName = this.dictionaryService.getCountryName(name);
return StringUtils.isBlank(countryName) ? name : countryName;
}
/**
* Get the comparison value. 1: more than -1: less than 0: equal
*
* @param triples
* @param yearsNum
* @return
*/
public String getComparison(Map<String, Map<String, String>> triples, String yearsNum) {
String quantmod = lookupDep(triples, yearsNum, Constants.Nlp.QUANTMOD);
if (this.dictionaryService.isSynonym(quantmod, "than")) {
return lookupDep(triples, quantmod, Constants.Nlp.MWE);
}
return null;
}
}
| UTF-8 | Java | 3,942 | java | NlpHelper.java | Java | [
{
"context": " * limitations under the License.\r\n *\r\n * Authors: Ping Zhao (pzha291@aucklanduni.ac.nz)\r\n * Created: 2015-06-",
"end": 652,
"score": 0.9998099207878113,
"start": 643,
"tag": "NAME",
"value": "Ping Zhao"
},
{
"context": "ns under the License.\r\n *\r\n * Authors: ... | null | [] | /*
* Copyright (c) 2015 The University of Auckland
*
* 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.
*
* Authors: <NAME> (<EMAIL>)
* Created: 2015-06-10
* Last Updated: --
*/
package edu.uoa.cs.master.cloudmanufacturingnlp.business.nlp;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.commons.lang3.StringUtils;
import edu.uoa.cs.master.cloudmanufacturingnlp.business.dictionary.DictionaryService;
import edu.uoa.cs.master.cloudmanufacturingnlp.util.Constants;
import edu.uoa.cs.master.cloudmanufacturingnlp.util.Tools;
public class NlpHelper {
private DictionaryService dictionaryService;
public NlpHelper(DictionaryService dictionaryService) {
this.dictionaryService = dictionaryService;
}
/**
* Lookup the dependent from the triples.
*
* @param gov
* @param reln
* @return
*/
public String lookupDep(Map<String, Map<String, String>> triples, String gov, String reln) {
String dep = null;
Map<String, String> dep_reln_map = triples.get(gov);
if (dep_reln_map == null) {
return dep;
}
Iterator<Entry<String, String>> it = dep_reln_map.entrySet().iterator();
while (it.hasNext()) {
Entry<String, String> entry = it.next();
if (reln.equals(entry.getValue())) {
dep = entry.getKey();
break;
}
}
return dep;
}
/**
* Lookup the list of dependents from the triples.
*
* @param gov
* @param reln
* @return
*/
public List<String> lookupDeps(Map<String, Map<String, String>> triples, String gov, String reln) {
List<String> deps = null;
Map<String, String> dep_reln_map = triples.get(gov);
if (dep_reln_map == null) {
return deps;
}
Iterator<Entry<String, String>> it = dep_reln_map.entrySet().iterator();
while (it.hasNext()) {
Entry<String, String> entry = it.next();
if (this.dictionaryService.isSynonym(entry.getValue(), reln)) {
if (deps == null) {
deps = new ArrayList<String>();
}
deps.add(entry.getKey());
}
}
return deps;
}
/**
* Retrieve the base location which can be: NZ, New Zealand, Auckland, etc.
*
* @param originalString
* @return
*/
public String getBaseLocation(String originalString) {
// remove the suffix
String tempString = Tools.removeDashSuffix(originalString);
if (tempString.toLowerCase().endsWith(Constants.Nlp.BASED)) {
tempString = tempString.substring(0, tempString.toLowerCase().indexOf(Constants.Nlp.BASED));
}
tempString = tempString.trim();
if (tempString.endsWith("-")) {
tempString = tempString.substring(0, tempString.length() - 1);
}
String name = Tools.upperCaseString(tempString);
String countryName = this.dictionaryService.getCountryName(name);
return StringUtils.isBlank(countryName) ? name : countryName;
}
/**
* Get the comparison value. 1: more than -1: less than 0: equal
*
* @param triples
* @param yearsNum
* @return
*/
public String getComparison(Map<String, Map<String, String>> triples, String yearsNum) {
String quantmod = lookupDep(triples, yearsNum, Constants.Nlp.QUANTMOD);
if (this.dictionaryService.isSynonym(quantmod, "than")) {
return lookupDep(triples, quantmod, Constants.Nlp.MWE);
}
return null;
}
}
| 3,921 | 0.676814 | 0.670218 | 141 | 25.957447 | 27.171865 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.624113 | false | false | 3 |
98787c68d5a9d457903cfc18fba9e850f109e184 | 20,718,922,273,557 | 251f56961cf8029361de3e916833672a06283430 | /com.hillel/src/main/java/lesson7/Main.java | b9d499bc4dbea7240084ced6341c4bee261e7bf7 | [] | no_license | DubovikovArtem/artemDubovikov | https://github.com/DubovikovArtem/artemDubovikov | 974e9893df59622e6e2381d18683046e7421bf06 | fe8461adb61bc6a1e5c8cb31e6f998bdb1488735 | refs/heads/master | 2023-08-07T09:51:24.879000 | 2021-10-08T12:40:18 | 2021-10-08T12:40:18 | 388,537,650 | 0 | 0 | null | false | 2021-10-08T12:40:18 | 2021-07-22T17:01:10 | 2021-09-20T10:25:00 | 2021-10-08T12:40:18 | 5,859 | 0 | 0 | 0 | Java | false | false | package lesson7;
public class Main {
public static void main(String[] args) {
StandardCalculation standard = new StandardCalculation();
standard.description();
}
}
| UTF-8 | Java | 189 | java | Main.java | Java | [] | null | [] | package lesson7;
public class Main {
public static void main(String[] args) {
StandardCalculation standard = new StandardCalculation();
standard.description();
}
}
| 189 | 0.671958 | 0.666667 | 8 | 22.625 | 21.418085 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.375 | false | false | 3 |
31f02847ea370c8a32a6691f235f62ea2ef0bdd5 | 14,216,341,797,616 | e0d15fb64b25a644cad5a17c678878262a475b82 | /loan/src/main/java/br/com/biblioteca/loan/loan/services/DeleteLoanServiceImpl.java | 5dcc3b85aec4fc0d6b067d1351921d712638f657 | [] | no_license | waldirmarques/biblioteca | https://github.com/waldirmarques/biblioteca | d7387bc07f2070f18a1bf6ec63da9363ddeb5daf | 4b3fa556ba0b40e7f357f36d057bd7bb834e6fef | refs/heads/master | 2022-04-25T09:46:52.674000 | 2020-04-28T15:10:42 | 2020-04-28T15:10:42 | 255,697,028 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.com.biblioteca.loan.loan.services;
import br.com.biblioteca.loan.exceptions.LoanNotDeletedException;
import br.com.biblioteca.loan.feign.UpdateBook;
import br.com.biblioteca.loan.feign.UpdateUserApp;
import br.com.biblioteca.loan.loan.Loan;
import br.com.biblioteca.loan.loan.LoanBookSpecificIdDTO;
import br.com.biblioteca.loan.loan.LoanRepository;
import br.com.biblioteca.loan.loan.LoanUserAppSpecificIdDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.Optional;
@RequiredArgsConstructor
@Service
public class DeleteLoanServiceImpl implements DeleteLoanService {
private final LoanRepository loanRepository;
private final UpdateUserApp updateUserApp;
private final UpdateBook updateBook;
@Override
public void delete(Long id) {
if (!loanRepository.existsById(id)) {
throw new LoanNotDeletedException();
}
Optional<Loan> loanApp = loanRepository.findById(id);
if (loanApp.isPresent()) {
Loan loan = loanApp.get();
updateUserApp.updateUserApp(loan.getUserApp(), new LoanUserAppSpecificIdDTO(null));
updateBook.updateBook(loan.getBook(), new LoanBookSpecificIdDTO(null));
}
loanRepository.deleteById(id);
}
}
| UTF-8 | Java | 1,304 | java | DeleteLoanServiceImpl.java | Java | [] | null | [] | package br.com.biblioteca.loan.loan.services;
import br.com.biblioteca.loan.exceptions.LoanNotDeletedException;
import br.com.biblioteca.loan.feign.UpdateBook;
import br.com.biblioteca.loan.feign.UpdateUserApp;
import br.com.biblioteca.loan.loan.Loan;
import br.com.biblioteca.loan.loan.LoanBookSpecificIdDTO;
import br.com.biblioteca.loan.loan.LoanRepository;
import br.com.biblioteca.loan.loan.LoanUserAppSpecificIdDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.Optional;
@RequiredArgsConstructor
@Service
public class DeleteLoanServiceImpl implements DeleteLoanService {
private final LoanRepository loanRepository;
private final UpdateUserApp updateUserApp;
private final UpdateBook updateBook;
@Override
public void delete(Long id) {
if (!loanRepository.existsById(id)) {
throw new LoanNotDeletedException();
}
Optional<Loan> loanApp = loanRepository.findById(id);
if (loanApp.isPresent()) {
Loan loan = loanApp.get();
updateUserApp.updateUserApp(loan.getUserApp(), new LoanUserAppSpecificIdDTO(null));
updateBook.updateBook(loan.getBook(), new LoanBookSpecificIdDTO(null));
}
loanRepository.deleteById(id);
}
}
| 1,304 | 0.750767 | 0.750767 | 37 | 34.243244 | 24.984758 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.594595 | false | false | 3 |
cbef82dc846d625f11a3cbf93552b40bba6e36af | 8,091,718,422,595 | 19cde55a80f6192fa70def8b89579ee28363761a | /src/com/colin/test/containers/PriorityQueueDemo.java | 7f882b7337ee95b761e0b7fa001fa2610091e30f | [] | no_license | jichen3000/colin-java | https://github.com/jichen3000/colin-java | 88587c235856ac831b4c9ce4b10fd30182851bf1 | 845d14fc496ac30d26a2e441803193c7c1945330 | refs/heads/master | 2016-09-05T19:01:07.298000 | 2011-07-17T06:45:18 | 2011-07-17T06:45:18 | 1,597,516 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.colin.test.containers;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Random;
import java.util.Set;
public class PriorityQueueDemo {
public static void main(String[] args){
PriorityQueue<Integer> pq = new PriorityQueue<Integer>();
Random rand = new Random(47);
for(int i=0; i<10; i++){
pq.offer(rand.nextInt(i+10));
}
QueueDemo.printQ(pq);
List<Integer> ints = Arrays.asList(25, 22, 30,4,6,4);
pq = new PriorityQueue<Integer>(ints);
QueueDemo.printQ(pq);
String fact = "EDUCATION SHOULD ESCHEW OBFUSCATION";
List<String> strings = Arrays.asList(fact.split(""));
PriorityQueue<String> spq = new PriorityQueue<String>(strings);
QueueDemo.printQ(spq);
spq = new PriorityQueue<String>(strings.size(), Collections.reverseOrder());
spq.addAll(strings);
QueueDemo.printQ(spq);
Set<Character> charSet = new HashSet<Character>();
for(char c : fact.toCharArray())
charSet.add(c);
PriorityQueue<Character> cpq =
new PriorityQueue<Character>(charSet);
QueueDemo.printQ(cpq);
}
}
| UTF-8 | Java | 1,149 | java | PriorityQueueDemo.java | Java | [] | null | [] | package com.colin.test.containers;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Random;
import java.util.Set;
public class PriorityQueueDemo {
public static void main(String[] args){
PriorityQueue<Integer> pq = new PriorityQueue<Integer>();
Random rand = new Random(47);
for(int i=0; i<10; i++){
pq.offer(rand.nextInt(i+10));
}
QueueDemo.printQ(pq);
List<Integer> ints = Arrays.asList(25, 22, 30,4,6,4);
pq = new PriorityQueue<Integer>(ints);
QueueDemo.printQ(pq);
String fact = "EDUCATION SHOULD ESCHEW OBFUSCATION";
List<String> strings = Arrays.asList(fact.split(""));
PriorityQueue<String> spq = new PriorityQueue<String>(strings);
QueueDemo.printQ(spq);
spq = new PriorityQueue<String>(strings.size(), Collections.reverseOrder());
spq.addAll(strings);
QueueDemo.printQ(spq);
Set<Character> charSet = new HashSet<Character>();
for(char c : fact.toCharArray())
charSet.add(c);
PriorityQueue<Character> cpq =
new PriorityQueue<Character>(charSet);
QueueDemo.printQ(cpq);
}
}
| 1,149 | 0.715405 | 0.70148 | 40 | 27.725 | 19.240566 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.275 | false | false | 3 |
94035f040d8596ee6e34faa57d91ad61e972ad27 | 30,734 | 451ae34831c0aa8b936a82dbde3a903de772aab3 | /framework/src/main/java/com/example/myapplication/util/BitmapUtils.java | b4dbaf0423435c279780912ae506547d30f14951 | [] | no_license | zhulvlong/MVVMDemo | https://github.com/zhulvlong/MVVMDemo | aeef0c588a88dfc948b38dad5805ef884a32588b | a84c600982406d03e502c98e52598f8098ed8868 | refs/heads/main | 2023-03-15T06:45:48.475000 | 2021-03-22T01:58:28 | 2021-03-22T01:58:28 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.myapplication.util;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Message;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import static android.os.FileUtils.copy;
public class BitmapUtils {
private static Bitmap bitmap;
/**
* 根据 图片URL 转换成 Bitmap
*
* @param url
* @return
*/
public static Bitmap getBitMap(final String url, final android.os.Handler handler) {
new Thread(new Runnable() {
@Override
public void run() {
URL imageurl = null;
try {
imageurl = new URL(url);
} catch (MalformedURLException e) {
e.printStackTrace();
}
try {
HttpURLConnection conn = (HttpURLConnection) imageurl.openConnection();
conn.setDoInput(true);
conn.connect();
InputStream is = conn.getInputStream();
bitmap = BitmapFactory.decodeStream(is);
Message message = handler.obtainMessage();
message.obj = bitmap;
message.arg1 = 1;
handler.sendMessage(message);
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}).start();
return bitmap;
}
}
| UTF-8 | Java | 1,630 | java | BitmapUtils.java | Java | [] | null | [] | package com.example.myapplication.util;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Message;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import static android.os.FileUtils.copy;
public class BitmapUtils {
private static Bitmap bitmap;
/**
* 根据 图片URL 转换成 Bitmap
*
* @param url
* @return
*/
public static Bitmap getBitMap(final String url, final android.os.Handler handler) {
new Thread(new Runnable() {
@Override
public void run() {
URL imageurl = null;
try {
imageurl = new URL(url);
} catch (MalformedURLException e) {
e.printStackTrace();
}
try {
HttpURLConnection conn = (HttpURLConnection) imageurl.openConnection();
conn.setDoInput(true);
conn.connect();
InputStream is = conn.getInputStream();
bitmap = BitmapFactory.decodeStream(is);
Message message = handler.obtainMessage();
message.obj = bitmap;
message.arg1 = 1;
handler.sendMessage(message);
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}).start();
return bitmap;
}
}
| 1,630 | 0.537129 | 0.535891 | 60 | 25.933332 | 20.999895 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.483333 | false | false | 3 |
e093623f309196e9148d870fde6fb2229e420e93 | 7,361,573,977,622 | 9abf4e74af2418b5b05f3e69fce2ca29682de0a6 | /Spring/custom_ioc_test/src/main/java/com/example/ioc/utils/BeanFactory.java | 890f6b542934b4e7bdaf5795045c5ae46a3e8c7f | [] | no_license | iuriimattos2/Superman | https://github.com/iuriimattos2/Superman | 77358073cb73ccc96505fdc6e22f79f8efe8b46b | 5011e59f8ac4bc29243f06af868049303b08e5fa | refs/heads/master | 2023-03-28T13:14:59.928000 | 2021-03-26T09:08:12 | 2021-03-26T09:08:12 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.ioc.utils;
import com.sun.corba.se.spi.ior.ObjectKey;
import com.sun.xml.internal.txw2.output.SaxSerializer;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.Node;
import org.dom4j.io.SAXReader;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class BeanFactory {
private static Map<String, Object> iocMap = new HashMap<>();
//程序启动时 初始化对象实例
static {
//1. 读取配置文件
ClassLoader classLoader = BeanFactory.class.getClassLoader();
//2. 加载配置文件
InputStream stream = classLoader.getResourceAsStream("beans.xml");
//3. 解析xml
SAXReader reader = new SAXReader();
try {
Document document = reader.read(stream);
//4. 编写xpath表达式
String xpath = "//bean";//获取bean标签
//根据xpath获取到所有bean标签
List<Element> list = document.selectNodes(xpath);
//5. 遍历并反射对象实例
for (Element element : list) {
String id = element.attributeValue("id");
String className = element.attributeValue("class");
//使用反射生成实例对象
Object o = Class.forName(className).newInstance();
//保存到Map - IOC 容器
iocMap.put(id, o);
}
} catch (DocumentException | ClassNotFoundException | IllegalAccessException | InstantiationException e) {
e.printStackTrace();
}
}
public static Object getBean(String beanId) {
return iocMap.get(beanId);
}
}
| UTF-8 | Java | 1,755 | java | BeanFactory.java | Java | [] | null | [] | package com.example.ioc.utils;
import com.sun.corba.se.spi.ior.ObjectKey;
import com.sun.xml.internal.txw2.output.SaxSerializer;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.Node;
import org.dom4j.io.SAXReader;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class BeanFactory {
private static Map<String, Object> iocMap = new HashMap<>();
//程序启动时 初始化对象实例
static {
//1. 读取配置文件
ClassLoader classLoader = BeanFactory.class.getClassLoader();
//2. 加载配置文件
InputStream stream = classLoader.getResourceAsStream("beans.xml");
//3. 解析xml
SAXReader reader = new SAXReader();
try {
Document document = reader.read(stream);
//4. 编写xpath表达式
String xpath = "//bean";//获取bean标签
//根据xpath获取到所有bean标签
List<Element> list = document.selectNodes(xpath);
//5. 遍历并反射对象实例
for (Element element : list) {
String id = element.attributeValue("id");
String className = element.attributeValue("class");
//使用反射生成实例对象
Object o = Class.forName(className).newInstance();
//保存到Map - IOC 容器
iocMap.put(id, o);
}
} catch (DocumentException | ClassNotFoundException | IllegalAccessException | InstantiationException e) {
e.printStackTrace();
}
}
public static Object getBean(String beanId) {
return iocMap.get(beanId);
}
}
| 1,755 | 0.619518 | 0.612724 | 51 | 30.745098 | 23.378256 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.588235 | false | false | 3 |
431a31c1b35481efd23ba8cd06c3590c0eb6e4df | 17,514,876,662,516 | e0beaef3e670b86c817dc8d9ff203b3ad30e105e | /src/test/java/junit/rules/httpserver/HttpServerRuleTest.java | 320ce27a602b20e2ab1c96371c5e213d8b6e666b | [
"MIT"
] | permissive | VijayEluri/junit-rules | https://github.com/VijayEluri/junit-rules | 16a5a277e25df98f78cee0578b42763e6a242f68 | 9a20f5b245c3f4e346ea01d571481318b59a19a4 | refs/heads/master | 2020-05-20T10:53:51.662000 | 2012-03-01T08:00:35 | 2012-03-01T08:00:35 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* junit-rules: JUnit Rules Library
*
* Copyright (c) 2009-2011 by Alistair A. Israel.
* This software is made available under the terms of the MIT License.
*
* Created Aug 28, 2009
*/
package junit.rules.httpserver;
import static java.lang.Boolean.FALSE;
import static java.lang.Boolean.TRUE;
import static java.net.HttpURLConnection.HTTP_OK;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.HttpURLConnection;
import junit.rules.util.SimpleReference;
import org.junit.Rule;
import org.junit.Test;
/**
* <p>
* JUnit test case for {@link HttpServerRule}.
* </p>
* <p>
* With contributions by <a href="https://github.com/beobal">Sam Tunnicliffe</a>.
* </p>
*
* @author Alistair A. Israel
*/
public final class HttpServerRuleTest {
// CHECKSTYLE:OFF
@Rule
public final HttpServerRule httpServer = new HttpServerRule();
// CHECKSTYLE:ON
/**
* Test and illustrate basic usage (HTTP GET).
*
* @throws Exception
* should never happen
*/
@Test
public void testHttpServerRule() throws Exception {
httpServer.addHandler("/", new SimpleHttpHandler() {
@Override
protected void onGet() throws IOException {
final PrintWriter out = getResponseWriter();
out.println("<?xml version=\"1.0\"?>");
out.println("<resource id=\"1234\" name=\"test\" />");
sendResponse(HTTP_OK);
}
});
final HttpURLConnection connection = httpServer.get("/");
final BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
assertEquals("<?xml version=\"1.0\"?>", in.readLine());
assertEquals("<resource id=\"1234\" name=\"test\" />", in.readLine());
assertEquals(HTTP_OK, connection.getResponseCode());
}
/**
* Test HTTP POST
*
* @throws Exception
* should never happen
*/
@Test
public void testHttpServerRulePostMethod() throws Exception {
httpServer.addHandler("/", new SimpleHttpHandler() {
@Override
protected void onPost() throws IOException {
final BufferedReader reader = new BufferedReader(new InputStreamReader(getRequestBody()));
getResponseWriter().write("Hello " + reader.readLine());
sendResponse(HTTP_OK);
}
});
final HttpURLConnection connection = httpServer.post("/");
final BufferedWriter out = new BufferedWriter(new OutputStreamWriter(connection.getOutputStream()));
out.write("World");
out.flush();
final BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
assertEquals("Hello World", in.readLine());
assertEquals(HTTP_OK, connection.getResponseCode());
}
/**
* Test HTTP PUT
*
* @throws Exception
* should never happen
*/
@Test
public void testHttpServerRulePutMethod() throws Exception {
httpServer.addHandler("/", new SimpleHttpHandler() {
@Override
protected void onPut() throws IOException {
final BufferedReader reader = new BufferedReader(new InputStreamReader(getRequestBody()));
getResponseWriter().write("Hello " + reader.readLine());
sendResponse(HTTP_OK);
}
});
final HttpURLConnection connection = httpServer.put("/");
final BufferedWriter out = new BufferedWriter(new OutputStreamWriter(connection.getOutputStream()));
out.write("Again");
out.flush();
final BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
assertEquals("Hello Again", in.readLine());
assertEquals(HTTP_OK, connection.getResponseCode());
}
/**
* Test HTTP DELETE
*
* @throws Exception
* should never happen
*/
@Test
public void testHttpServerRuleDeleteMethod() throws Exception {
final SimpleReference<Boolean> deleteIssued = SimpleReference.to(FALSE);
httpServer.addHandler("/", new SimpleHttpHandler() {
@Override
protected void onDelete() throws IOException {
deleteIssued.set(TRUE);
sendResponse(HTTP_OK);
}
});
final HttpURLConnection connection = httpServer.delete("/");
assertEquals(HTTP_OK, connection.getResponseCode());
assertTrue(deleteIssued.get());
}
}
| UTF-8 | Java | 4,814 | java | HttpServerRuleTest.java | Java | [
{
"context": "nit Rules Library\n *\n * Copyright (c) 2009-2011 by Alistair A. Israel.\n * This software is made available under the ter",
"end": 91,
"score": 0.9998942613601685,
"start": 73,
"tag": "NAME",
"value": "Alistair A. Israel"
},
{
"context": "With contributions by <a href=... | null | [] | /**
* junit-rules: JUnit Rules Library
*
* Copyright (c) 2009-2011 by <NAME>.
* This software is made available under the terms of the MIT License.
*
* Created Aug 28, 2009
*/
package junit.rules.httpserver;
import static java.lang.Boolean.FALSE;
import static java.lang.Boolean.TRUE;
import static java.net.HttpURLConnection.HTTP_OK;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.HttpURLConnection;
import junit.rules.util.SimpleReference;
import org.junit.Rule;
import org.junit.Test;
/**
* <p>
* JUnit test case for {@link HttpServerRule}.
* </p>
* <p>
* With contributions by <a href="https://github.com/beobal"><NAME></a>.
* </p>
*
* @author <NAME>
*/
public final class HttpServerRuleTest {
// CHECKSTYLE:OFF
@Rule
public final HttpServerRule httpServer = new HttpServerRule();
// CHECKSTYLE:ON
/**
* Test and illustrate basic usage (HTTP GET).
*
* @throws Exception
* should never happen
*/
@Test
public void testHttpServerRule() throws Exception {
httpServer.addHandler("/", new SimpleHttpHandler() {
@Override
protected void onGet() throws IOException {
final PrintWriter out = getResponseWriter();
out.println("<?xml version=\"1.0\"?>");
out.println("<resource id=\"1234\" name=\"test\" />");
sendResponse(HTTP_OK);
}
});
final HttpURLConnection connection = httpServer.get("/");
final BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
assertEquals("<?xml version=\"1.0\"?>", in.readLine());
assertEquals("<resource id=\"1234\" name=\"test\" />", in.readLine());
assertEquals(HTTP_OK, connection.getResponseCode());
}
/**
* Test HTTP POST
*
* @throws Exception
* should never happen
*/
@Test
public void testHttpServerRulePostMethod() throws Exception {
httpServer.addHandler("/", new SimpleHttpHandler() {
@Override
protected void onPost() throws IOException {
final BufferedReader reader = new BufferedReader(new InputStreamReader(getRequestBody()));
getResponseWriter().write("Hello " + reader.readLine());
sendResponse(HTTP_OK);
}
});
final HttpURLConnection connection = httpServer.post("/");
final BufferedWriter out = new BufferedWriter(new OutputStreamWriter(connection.getOutputStream()));
out.write("World");
out.flush();
final BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
assertEquals("Hello World", in.readLine());
assertEquals(HTTP_OK, connection.getResponseCode());
}
/**
* Test HTTP PUT
*
* @throws Exception
* should never happen
*/
@Test
public void testHttpServerRulePutMethod() throws Exception {
httpServer.addHandler("/", new SimpleHttpHandler() {
@Override
protected void onPut() throws IOException {
final BufferedReader reader = new BufferedReader(new InputStreamReader(getRequestBody()));
getResponseWriter().write("Hello " + reader.readLine());
sendResponse(HTTP_OK);
}
});
final HttpURLConnection connection = httpServer.put("/");
final BufferedWriter out = new BufferedWriter(new OutputStreamWriter(connection.getOutputStream()));
out.write("Again");
out.flush();
final BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
assertEquals("Hello Again", in.readLine());
assertEquals(HTTP_OK, connection.getResponseCode());
}
/**
* Test HTTP DELETE
*
* @throws Exception
* should never happen
*/
@Test
public void testHttpServerRuleDeleteMethod() throws Exception {
final SimpleReference<Boolean> deleteIssued = SimpleReference.to(FALSE);
httpServer.addHandler("/", new SimpleHttpHandler() {
@Override
protected void onDelete() throws IOException {
deleteIssued.set(TRUE);
sendResponse(HTTP_OK);
}
});
final HttpURLConnection connection = httpServer.delete("/");
assertEquals(HTTP_OK, connection.getResponseCode());
assertTrue(deleteIssued.get());
}
}
| 4,781 | 0.631699 | 0.626298 | 141 | 33.141846 | 28.261339 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.489362 | false | false | 3 |
a4b5ceb6aa27d7b995517f8ca65f7721efd6efbb | 24,343,874,665,198 | 9104f5c8f48795171f2874da209eaeffb6119a61 | /app/src/main/java/admin/eoe/squad/patient/SnackSub.java | 7d030d0555760a73cb548ab40b6b665f9c9957cf | [] | no_license | sbh69840/patient-app-demo | https://github.com/sbh69840/patient-app-demo | a80ab25f0f8d8422442090e0cf62584f438b0c86 | df7d1803249a9f58b02d66322442ca41d7322fc0 | refs/heads/master | 2021-08-16T07:50:03.336000 | 2017-11-19T09:12:17 | 2017-11-19T09:12:17 | 111,280,173 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package admin.eoe.squad.patient;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
/**
* Created by admin on 23/07/2017.
*/
public class SnackSub extends AppCompatActivity {
private EditText text;
private Button add;
private DatabaseReference database;
private ImageView back,set;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.snack_sub);
back = (ImageView) findViewById(R.id.toolbar_back_intake);
set = (ImageView) findViewById(R.id.menu_intake);
back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
set.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(getApplicationContext(),MainActivity.class));
}
});
text = (EditText) findViewById(R.id.snack_sub);
add = (Button) findViewById(R.id.snack_sub_button);
database = FirebaseDatabase.getInstance().getReference(FirebaseAuth.getInstance().getCurrentUser().getUid());
add.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
database.child("snacksub").setValue(text.getText().toString());
}
});
}
}
| UTF-8 | Java | 1,866 | java | SnackSub.java | Java | [
{
"context": "base.database.FirebaseDatabase;\n\n/**\n * Created by admin on 23/07/2017.\n */\n\npublic class SnackSub extends",
"end": 485,
"score": 0.9982877373695374,
"start": 480,
"tag": "USERNAME",
"value": "admin"
}
] | null | [] | package admin.eoe.squad.patient;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
/**
* Created by admin on 23/07/2017.
*/
public class SnackSub extends AppCompatActivity {
private EditText text;
private Button add;
private DatabaseReference database;
private ImageView back,set;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.snack_sub);
back = (ImageView) findViewById(R.id.toolbar_back_intake);
set = (ImageView) findViewById(R.id.menu_intake);
back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
set.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(getApplicationContext(),MainActivity.class));
}
});
text = (EditText) findViewById(R.id.snack_sub);
add = (Button) findViewById(R.id.snack_sub_button);
database = FirebaseDatabase.getInstance().getReference(FirebaseAuth.getInstance().getCurrentUser().getUid());
add.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
database.child("snacksub").setValue(text.getText().toString());
}
});
}
}
| 1,866 | 0.67149 | 0.666667 | 53 | 34.207546 | 24.438879 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.584906 | false | false | 3 |
3790ff501df6cb0b546448a1bf2cbdde21e497bb | 31,233,002,210,662 | 60d636e9f5b23ac987abc6ab876008e6c31014c7 | /src/com/wjd/speechnotepad/base/BaseActivity.java | bdd1e232a0938ba5d7e1f220dc3c20876af3d575 | [] | no_license | wu-jingdong/speechNotepad | https://github.com/wu-jingdong/speechNotepad | 41397535dc8492469adc9ce4c68e2621c28a40a9 | 433fa938252f6ecaeed0e90a7b6669aac6d865a8 | refs/heads/master | 2021-01-19T03:12:50.862000 | 2013-12-03T02:22:34 | 2013-12-03T02:22:34 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.wjd.speechnotepad.base;
import android.app.Activity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import com.wjd.speechnotepad.R;
public class BaseActivity extends Activity
{
protected void setSecondTitleBar(String title)
{
findViewById(R.id.btn_bar_back).setOnClickListener(
new OnClickListener()
{
@Override
public void onClick(View v)
{
finish();
}
});
((TextView) findViewById(R.id.tv_bar_title)).setText(title);
}
}
| UTF-8 | Java | 537 | java | BaseActivity.java | Java | [] | null | [] | package com.wjd.speechnotepad.base;
import android.app.Activity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import com.wjd.speechnotepad.R;
public class BaseActivity extends Activity
{
protected void setSecondTitleBar(String title)
{
findViewById(R.id.btn_bar_back).setOnClickListener(
new OnClickListener()
{
@Override
public void onClick(View v)
{
finish();
}
});
((TextView) findViewById(R.id.tv_bar_title)).setText(title);
}
}
| 537 | 0.716946 | 0.716946 | 26 | 19.653847 | 18.652576 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.076923 | false | false | 3 |
be0aaaa79e1bcea754f2ca184b995b7f0dd418e2 | 11,261,404,286,960 | 061bfc8b008283b49c70d281183f87c3e8ef2115 | /USACO-Gold-java/USACO-Gold-radio/src/Main.java | 2238f3c2cf8dbcdc9dc31f43583207296d60e3e9 | [] | no_license | cruizeship/competitive-programming | https://github.com/cruizeship/competitive-programming | 78dd47513cacc6a8fd2b9bb6338e4d1d31448711 | 7f2e439440b71d887d949d0b4da2b048a85c8b9c | refs/heads/main | 2023-08-16T17:46:41.771000 | 2023-08-05T07:28:04 | 2023-08-05T07:28:04 | 320,127,507 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.io.*;
import java.util.*;
class Main {
public static void main(String[] args) throws IOException {
Scanner s = new Scanner(new File("radio.in"));
int N = s.nextInt();
int M = s.nextInt();
int[][] farmerLocation = new int[N + 1][2];
int[][] bessieLocation = new int[M + 1][2];
farmerLocation[0] = new int[]{s.nextInt(), s.nextInt()};
bessieLocation[0] = new int[]{s.nextInt(), s.nextInt()};
String farmer = s.next();
for (int i = 1 ; i < N + 1; i++) {
farmerLocation[i] = farmerLocation[i - 1].clone();
if (Character.toString(farmer.charAt(i - 1)).equals("N")) {
farmerLocation[i][1] += 1;
}
if (Character.toString(farmer.charAt(i - 1)).equals("S")) {
farmerLocation[i][1] -= 1;
}
if (Character.toString(farmer.charAt(i - 1)).equals("E")) {
farmerLocation[i][0] += 1;
}
if (Character.toString(farmer.charAt(i - 1)).equals("W")) {
farmerLocation[i][0] -= 1;
}
}
String bessie = s.next();
for (int i = 1 ; i < M + 1; i++) {
bessieLocation[i] = bessieLocation[i - 1].clone();
if (Character.toString(bessie.charAt(i - 1)).equals("N")) {
bessieLocation[i][1] += 1;
}
if (Character.toString(bessie.charAt(i - 1)).equals("S")) {
bessieLocation[i][1] -= 1;
}
if (Character.toString(bessie.charAt(i - 1)).equals("E")) {
bessieLocation[i][0] += 1;
}
if (Character.toString(bessie.charAt(i - 1)).equals("W")) {
bessieLocation[i][0] -= 1;
}
}
int[][] dp = new int[N + 1][M + 1];
for (int i = 0; i < N + 1; i++) {
for (int j = 0; j < M + 1; j++) {
dp[i][j] = 2000000000;
}
}
dp[0][0] = 0;
for (int i = 0; i < N + 1; i++) {
for (int j = 0; j < M + 1; j++) {
if (i < N) {
//take only FJ
dp[i + 1][j] = Math.min(dp[i + 1][j], dp[i][j] + (int)Math.pow(farmerLocation[i + 1][0] - bessieLocation[j][0], 2) + (int)Math.pow(farmerLocation[i + 1][1] - bessieLocation[j][1], 2));
}
if (j < M) {
//take only Bessie
dp[i][j + 1] = Math.min(dp[i][j + 1], dp[i][j] + (int)Math.pow(farmerLocation[i][0] - bessieLocation[j + 1][0], 2) + (int)Math.pow(farmerLocation[i][1] - bessieLocation[j + 1][1], 2));
}
if (i < N && j < M) {
//take both
dp[i + 1][j + 1] = Math.min(dp[i + 1][j + 1], dp[i][j] + (int)Math.pow(farmerLocation[i + 1][0] - bessieLocation[j + 1][0], 2) + (int)Math.pow(farmerLocation[i + 1][1] - bessieLocation[j + 1][1], 2));
}
}
}
/*
for (int i = 0; i < N; i++) {
System.out.println(Arrays.toString(dp[N]));
}
*/
PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(new File("radio.out"))));
pw.println(dp[N][M]);
pw.close();
}
}
| UTF-8 | Java | 2,881 | java | Main.java | Java | [] | null | [] | import java.io.*;
import java.util.*;
class Main {
public static void main(String[] args) throws IOException {
Scanner s = new Scanner(new File("radio.in"));
int N = s.nextInt();
int M = s.nextInt();
int[][] farmerLocation = new int[N + 1][2];
int[][] bessieLocation = new int[M + 1][2];
farmerLocation[0] = new int[]{s.nextInt(), s.nextInt()};
bessieLocation[0] = new int[]{s.nextInt(), s.nextInt()};
String farmer = s.next();
for (int i = 1 ; i < N + 1; i++) {
farmerLocation[i] = farmerLocation[i - 1].clone();
if (Character.toString(farmer.charAt(i - 1)).equals("N")) {
farmerLocation[i][1] += 1;
}
if (Character.toString(farmer.charAt(i - 1)).equals("S")) {
farmerLocation[i][1] -= 1;
}
if (Character.toString(farmer.charAt(i - 1)).equals("E")) {
farmerLocation[i][0] += 1;
}
if (Character.toString(farmer.charAt(i - 1)).equals("W")) {
farmerLocation[i][0] -= 1;
}
}
String bessie = s.next();
for (int i = 1 ; i < M + 1; i++) {
bessieLocation[i] = bessieLocation[i - 1].clone();
if (Character.toString(bessie.charAt(i - 1)).equals("N")) {
bessieLocation[i][1] += 1;
}
if (Character.toString(bessie.charAt(i - 1)).equals("S")) {
bessieLocation[i][1] -= 1;
}
if (Character.toString(bessie.charAt(i - 1)).equals("E")) {
bessieLocation[i][0] += 1;
}
if (Character.toString(bessie.charAt(i - 1)).equals("W")) {
bessieLocation[i][0] -= 1;
}
}
int[][] dp = new int[N + 1][M + 1];
for (int i = 0; i < N + 1; i++) {
for (int j = 0; j < M + 1; j++) {
dp[i][j] = 2000000000;
}
}
dp[0][0] = 0;
for (int i = 0; i < N + 1; i++) {
for (int j = 0; j < M + 1; j++) {
if (i < N) {
//take only FJ
dp[i + 1][j] = Math.min(dp[i + 1][j], dp[i][j] + (int)Math.pow(farmerLocation[i + 1][0] - bessieLocation[j][0], 2) + (int)Math.pow(farmerLocation[i + 1][1] - bessieLocation[j][1], 2));
}
if (j < M) {
//take only Bessie
dp[i][j + 1] = Math.min(dp[i][j + 1], dp[i][j] + (int)Math.pow(farmerLocation[i][0] - bessieLocation[j + 1][0], 2) + (int)Math.pow(farmerLocation[i][1] - bessieLocation[j + 1][1], 2));
}
if (i < N && j < M) {
//take both
dp[i + 1][j + 1] = Math.min(dp[i + 1][j + 1], dp[i][j] + (int)Math.pow(farmerLocation[i + 1][0] - bessieLocation[j + 1][0], 2) + (int)Math.pow(farmerLocation[i + 1][1] - bessieLocation[j + 1][1], 2));
}
}
}
/*
for (int i = 0; i < N; i++) {
System.out.println(Arrays.toString(dp[N]));
}
*/
PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(new File("radio.out"))));
pw.println(dp[N][M]);
pw.close();
}
}
| 2,881 | 0.501562 | 0.468934 | 82 | 34.134148 | 38.887192 | 210 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.682927 | false | false | 3 |
2f26cd6cf52d564fd888eabdf53b3ab467a3fd24 | 25,769,803,809,786 | e5e968929293c36b304b7e70870cbb5646c074f7 | /00-languages/00-java/00-intro-to-java-programming/sec2/lab/src/lab/chunwang/TestMethodsInCollection.java | 9cde55011917c318f695f0e08393de9a20ec950a | [] | no_license | CherryMill/learningNotes | https://github.com/CherryMill/learningNotes | 23a16177959cde3aa799d1b0ac3b66c5f589458b | fd43b9ee518e58f502eb86fbb019e0c070e1a0d5 | refs/heads/master | 2018-09-16T22:55:30.110000 | 2018-06-23T06:22:01 | 2018-06-23T06:22:19 | 62,975,737 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package lab.chunwang;
import java.util.HashSet;
public class TestMethodsInCollection {
public static void main(String[] args) {
java.util.Set<String> set1 = new HashSet<>();
set1.add("L");
set1.add("A");
set1.add("C");
set1.add("D");
set1.add("L");
System.out.println("set1 is " + set1.toString());
System.out.println("set1 size is " + set1.size());
set1.remove("R");
System.out.println(set1.contains("L"));
set1.addAll(set1);
set1.removeAll(set1);
System.out.println(set1);
}
}
| UTF-8 | Java | 596 | java | TestMethodsInCollection.java | Java | [] | null | [] | package lab.chunwang;
import java.util.HashSet;
public class TestMethodsInCollection {
public static void main(String[] args) {
java.util.Set<String> set1 = new HashSet<>();
set1.add("L");
set1.add("A");
set1.add("C");
set1.add("D");
set1.add("L");
System.out.println("set1 is " + set1.toString());
System.out.println("set1 size is " + set1.size());
set1.remove("R");
System.out.println(set1.contains("L"));
set1.addAll(set1);
set1.removeAll(set1);
System.out.println(set1);
}
}
| 596 | 0.558725 | 0.530201 | 24 | 23.833334 | 18.39535 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.625 | false | false | 3 |
6653069528b329906ba9501f711c83722951a348 | 30,099,130,835,915 | fbf8add43ad05252fe69ec69e64009342c72851b | /yj-pojo/src/main/java/com/yj/db/entity/NewsMessage.java | 43a6358d1ce399eae5c03b4912bfe50946230911 | [] | no_license | xieyuwen/YjWxShop | https://github.com/xieyuwen/YjWxShop | 4d31529e37efdbddc042415a376d4d54dc1c9d2a | 2bae63bb0af6d5c3300d9159cb5c20200257ac0d | refs/heads/master | 2020-04-29T10:21:14.741000 | 2019-05-15T14:23:17 | 2019-05-15T14:23:17 | 176,047,209 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.yj.db.entity;
import java.util.List;
/*
* 图文消息
*/
public class NewsMessage extends BaseMessage{
private String ArticleCount;
private List<PicNews> Articles;
public String getArticleCount() {
return ArticleCount;
}
public void setArticleCount(String articleCount) {
ArticleCount = articleCount;
}
public List<PicNews> getArticles() {
return Articles;
}
public void setArticles(List<PicNews> articles) {
Articles = articles;
}
}
| UTF-8 | Java | 509 | java | NewsMessage.java | Java | [] | null | [] | package com.yj.db.entity;
import java.util.List;
/*
* 图文消息
*/
public class NewsMessage extends BaseMessage{
private String ArticleCount;
private List<PicNews> Articles;
public String getArticleCount() {
return ArticleCount;
}
public void setArticleCount(String articleCount) {
ArticleCount = articleCount;
}
public List<PicNews> getArticles() {
return Articles;
}
public void setArticles(List<PicNews> articles) {
Articles = articles;
}
}
| 509 | 0.684631 | 0.684631 | 30 | 14.7 | 16.749428 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.966667 | false | false | 3 |
c934243424509769db1312b98ef5cf3688f2c0c5 | 25,872,883,028,002 | e7988336c0d76c83110dbb9b3d3742edd85b71ad | /Hooker.java | 6e75f871076e6ce0ba915a0163140b3d7b5eb744 | [] | no_license | MIXVBRC/MineRP | https://github.com/MIXVBRC/MineRP | 3d73ff66c14df51dbaedbfe8c533a97df9af122c | ea3fe9c85b58e22d900ca05be087056e2d448552 | refs/heads/master | 2020-04-19T01:23:27.978000 | 2019-01-28T00:36:28 | 2019-01-28T00:36:28 | 167,870,867 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package min.baga;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.CraftItemEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.vehicle.VehicleEnterEvent;
import org.bukkit.event.vehicle.VehicleExitEvent;
import org.bukkit.event.weather.WeatherChangeEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scoreboard.Objective;
import org.bukkit.scoreboard.Scoreboard;
import org.spigotmc.event.entity.EntityDismountEvent;
public class Hooker implements Listener{
private Guns guns = new Guns();
private Cars cars = new Cars();
private Lamps lamps = new Lamps();
private Elevator elevator = new Elevator();
private Apartments apartments = new Apartments();
private Sit sit = new Sit();
private SilentMask silentMask = new SilentMask();
private PlayerJoinToServer playerJoinToServer = new PlayerJoinToServer();
private Shop shop = new Shop();
private DoNotDestroyBlocks doNotDestroyBlocks = new DoNotDestroyBlocks();
private Regeneration regeneration = new Regeneration();
private Money money = new Money();
@EventHandler
public void PlayerInteractEvent(PlayerInteractEvent event) {
Player player = event.getPlayer();
Action action = event.getAction();
Block block = event.getClickedBlock();
EquipmentSlot equipmentSlot = event.getHand();
if (equipmentSlot == EquipmentSlot.OFF_HAND) return;
if (block != null && action == Action.RIGHT_CLICK_BLOCK) {
this.cars.PlayerInteractEvent(player, action, block, equipmentSlot);
this.elevator.PlayerInteract(action, player, block, equipmentSlot);
this.sit.PlayerSit(block, action, player);
this.lamps.PlayerClickLamps(action, block, equipmentSlot);
this.guns.PlayerInteractEvent(player, action);
this.apartments.PlayerInteract(player, block, action, event);
}
}
@EventHandler
public void BlockPlaceEvent(SignChangeEvent event) {
Player player = event.getPlayer();
Block block = event.getBlock();
String[] sign = event.getLines();
this.elevator.CrateElevator(player, block, sign);
this.cars.BlockPlaceEvent(player, sign);
}
@EventHandler
public void InventoryCloseEvent(InventoryCloseEvent event) {
Player player = (Player) event.getPlayer();
this.silentMask.Mask(player);
}
@EventHandler
public void InventoryClickEvent(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
this.silentMask.Mask(player);
}
@EventHandler
public void join(PlayerJoinEvent event) {
Player player = event.getPlayer();
event.setJoinMessage(null);
this.playerJoinToServer.join(player);
}
@EventHandler
public void onProjectileHit(ProjectileHitEvent event) {
Entity entity = event.getEntity();
this.guns.onProjectileHit(entity);
}
@EventHandler
public void onEntityInteract(PlayerInteractEntityEvent event) {
Player player = event.getPlayer();
Entity entity = event.getRightClicked();
this.shop.onEntityInteract(player, entity);
}
@EventHandler
public void BlockBreakEvent(BlockBreakEvent event) {
Player player = event.getPlayer();
Block block = event.getBlock();
this.doNotDestroyBlocks.BlockBreakEvent(player, block, event);
}
@EventHandler
public void CraftItemEvent(CraftItemEvent event) {
this.doNotDestroyBlocks.CraftItemEvent(event);
}
@EventHandler
public void clickInv(InventoryClickEvent event) {
ClickType click = event.getClick();
System.out.print(click);
ItemStack item = event.getCurrentItem();
this.doNotDestroyBlocks.clickInv(event, item, click);
}
@EventHandler
public void VehicleExitEvent(EntityDismountEvent event) {
Entity entity = event.getDismounted();
if (entity.getType().equals(EntityType.ARROW)) {
this.sit.PlayerGetsUp(entity);
}
}
@EventHandler
public void WeatherChangeEvent(WeatherChangeEvent event) {
event.setCancelled(true);
}
@EventHandler
public void EntityRegainHealthEvent(EntityRegainHealthEvent event) {
RegainReason regen = event.getRegainReason();
this.regeneration.HealthRegeneration(regen, event);
}
@EventHandler
public void join(PlayerQuitEvent event) {
event.setQuitMessage("");
}
@EventHandler
public void EntityDeathEvent(EntityDeathEvent event) {
event.setDroppedExp(0);
event.getDrops().clear();
}
@EventHandler
public void PlayerDeathEvent(PlayerDeathEvent event) {
event.setKeepInventory(true);
event.setKeepLevel(true);
event.setDroppedExp(0);
event.setDeathMessage("");
Player player = event.getEntity();
Player damager = player.getKiller();
this.money.PlayerDeathEvent(player, damager);
}
@EventHandler
public void VehicleExitEvent(VehicleExitEvent event) {
if (event.getExited() instanceof Player && event.getExited() instanceof LivingEntity) {
Player player = (Player) event.getExited();
Entity entity = event.getVehicle();
this.cars.VehicleExitEvent(player, entity);
}
}
@EventHandler
public void VehicleEnterEvent(VehicleEnterEvent event) {
if (event.getVehicle() instanceof LivingEntity && event.getEntered() instanceof Player) {
Player player = (Player) event.getEntered();
LivingEntity entity = (LivingEntity) event.getVehicle();
this.cars.PlayerEnter(entity, player, event);
}
}
@EventHandler
public void PlayerMoveEvent(PlayerMoveEvent event) {
Player player = event.getPlayer();
float one = (float) event.getFrom().distance(event.getTo());
int two = (int) (one / 1000.0 * 360.0 * 100.0 * 4.3 / 2.11111);
Scoreboard scoreboard = player.getScoreboard();
Objective objective = scoreboard.getObjective("stats");
objective.getScore("Скорость:").setScore(Math.round(two));
if (player.isInsideVehicle() && player.getVehicle() instanceof LivingEntity) {
this.cars.PlayerMoveEvent(player, one);
}
}
}
| WINDOWS-1251 | Java | 7,194 | java | Hooker.java | Java | [] | null | [] | package min.baga;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.CraftItemEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.vehicle.VehicleEnterEvent;
import org.bukkit.event.vehicle.VehicleExitEvent;
import org.bukkit.event.weather.WeatherChangeEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scoreboard.Objective;
import org.bukkit.scoreboard.Scoreboard;
import org.spigotmc.event.entity.EntityDismountEvent;
public class Hooker implements Listener{
private Guns guns = new Guns();
private Cars cars = new Cars();
private Lamps lamps = new Lamps();
private Elevator elevator = new Elevator();
private Apartments apartments = new Apartments();
private Sit sit = new Sit();
private SilentMask silentMask = new SilentMask();
private PlayerJoinToServer playerJoinToServer = new PlayerJoinToServer();
private Shop shop = new Shop();
private DoNotDestroyBlocks doNotDestroyBlocks = new DoNotDestroyBlocks();
private Regeneration regeneration = new Regeneration();
private Money money = new Money();
@EventHandler
public void PlayerInteractEvent(PlayerInteractEvent event) {
Player player = event.getPlayer();
Action action = event.getAction();
Block block = event.getClickedBlock();
EquipmentSlot equipmentSlot = event.getHand();
if (equipmentSlot == EquipmentSlot.OFF_HAND) return;
if (block != null && action == Action.RIGHT_CLICK_BLOCK) {
this.cars.PlayerInteractEvent(player, action, block, equipmentSlot);
this.elevator.PlayerInteract(action, player, block, equipmentSlot);
this.sit.PlayerSit(block, action, player);
this.lamps.PlayerClickLamps(action, block, equipmentSlot);
this.guns.PlayerInteractEvent(player, action);
this.apartments.PlayerInteract(player, block, action, event);
}
}
@EventHandler
public void BlockPlaceEvent(SignChangeEvent event) {
Player player = event.getPlayer();
Block block = event.getBlock();
String[] sign = event.getLines();
this.elevator.CrateElevator(player, block, sign);
this.cars.BlockPlaceEvent(player, sign);
}
@EventHandler
public void InventoryCloseEvent(InventoryCloseEvent event) {
Player player = (Player) event.getPlayer();
this.silentMask.Mask(player);
}
@EventHandler
public void InventoryClickEvent(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
this.silentMask.Mask(player);
}
@EventHandler
public void join(PlayerJoinEvent event) {
Player player = event.getPlayer();
event.setJoinMessage(null);
this.playerJoinToServer.join(player);
}
@EventHandler
public void onProjectileHit(ProjectileHitEvent event) {
Entity entity = event.getEntity();
this.guns.onProjectileHit(entity);
}
@EventHandler
public void onEntityInteract(PlayerInteractEntityEvent event) {
Player player = event.getPlayer();
Entity entity = event.getRightClicked();
this.shop.onEntityInteract(player, entity);
}
@EventHandler
public void BlockBreakEvent(BlockBreakEvent event) {
Player player = event.getPlayer();
Block block = event.getBlock();
this.doNotDestroyBlocks.BlockBreakEvent(player, block, event);
}
@EventHandler
public void CraftItemEvent(CraftItemEvent event) {
this.doNotDestroyBlocks.CraftItemEvent(event);
}
@EventHandler
public void clickInv(InventoryClickEvent event) {
ClickType click = event.getClick();
System.out.print(click);
ItemStack item = event.getCurrentItem();
this.doNotDestroyBlocks.clickInv(event, item, click);
}
@EventHandler
public void VehicleExitEvent(EntityDismountEvent event) {
Entity entity = event.getDismounted();
if (entity.getType().equals(EntityType.ARROW)) {
this.sit.PlayerGetsUp(entity);
}
}
@EventHandler
public void WeatherChangeEvent(WeatherChangeEvent event) {
event.setCancelled(true);
}
@EventHandler
public void EntityRegainHealthEvent(EntityRegainHealthEvent event) {
RegainReason regen = event.getRegainReason();
this.regeneration.HealthRegeneration(regen, event);
}
@EventHandler
public void join(PlayerQuitEvent event) {
event.setQuitMessage("");
}
@EventHandler
public void EntityDeathEvent(EntityDeathEvent event) {
event.setDroppedExp(0);
event.getDrops().clear();
}
@EventHandler
public void PlayerDeathEvent(PlayerDeathEvent event) {
event.setKeepInventory(true);
event.setKeepLevel(true);
event.setDroppedExp(0);
event.setDeathMessage("");
Player player = event.getEntity();
Player damager = player.getKiller();
this.money.PlayerDeathEvent(player, damager);
}
@EventHandler
public void VehicleExitEvent(VehicleExitEvent event) {
if (event.getExited() instanceof Player && event.getExited() instanceof LivingEntity) {
Player player = (Player) event.getExited();
Entity entity = event.getVehicle();
this.cars.VehicleExitEvent(player, entity);
}
}
@EventHandler
public void VehicleEnterEvent(VehicleEnterEvent event) {
if (event.getVehicle() instanceof LivingEntity && event.getEntered() instanceof Player) {
Player player = (Player) event.getEntered();
LivingEntity entity = (LivingEntity) event.getVehicle();
this.cars.PlayerEnter(entity, player, event);
}
}
@EventHandler
public void PlayerMoveEvent(PlayerMoveEvent event) {
Player player = event.getPlayer();
float one = (float) event.getFrom().distance(event.getTo());
int two = (int) (one / 1000.0 * 360.0 * 100.0 * 4.3 / 2.11111);
Scoreboard scoreboard = player.getScoreboard();
Objective objective = scoreboard.getObjective("stats");
objective.getScore("Скорость:").setScore(Math.round(two));
if (player.isInsideVehicle() && player.getVehicle() instanceof LivingEntity) {
this.cars.PlayerMoveEvent(player, one);
}
}
}
| 7,194 | 0.724325 | 0.721124 | 256 | 26.070313 | 23.496902 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2 | false | false | 3 |
9699acba1e5cc8de2e77c525c040131574120267 | 4,209,067,990,754 | 8f17729d23e887136ec0daaff9dd0d7a13fa3514 | /oleg_chumak_web/src/main/java/taxi/domain/Role.java | 93138d1416b5bd6f0904cdbe9a27f1dbdf3fba64 | [] | no_license | RAZER-KIEV/proff25 | https://github.com/RAZER-KIEV/proff25 | e3901518ac9655255abf9245c4c2f861ac1c5c9d | 7e0c8811aad538d8ec67a77558a12f85f691edf6 | refs/heads/master | 2021-01-10T16:08:45.373000 | 2015-08-18T16:13:08 | 2015-08-18T16:13:08 | 47,151,116 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package taxi.domain;
import javax.persistence.*;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
/**
* Created by GFalcon on 16.07.15.
*/
@Entity
@Table(name = "ROLE")
public class Role {
@Id
@Column(name = "ROLE_NAME", nullable = false)
private String roleName;
@Column(name = "DISPATCHER_PANEL")
private boolean dispatcherPanelVisible;
@Column(name = "ADMIN_PANEL")
private boolean adminPanelVisible;
@OneToMany(mappedBy = "role",
cascade = {CascadeType.DETACH,
CascadeType.PERSIST,
CascadeType.MERGE,
CascadeType.REFRESH})
private Set<Operator> operators;
public Role() {
}
public Role(String roleName) {
this(roleName, false, true);
}
public Role(String roleName, boolean adminPanelVisible, boolean dispatcherPanelVisible) {
operators = new HashSet<>();
this.roleName = roleName;
this.adminPanelVisible = adminPanelVisible;
this.dispatcherPanelVisible = dispatcherPanelVisible;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
public boolean isDispatcherPanelVisible() {
return dispatcherPanelVisible;
}
public void setDispatcherPanelVisible(boolean dispatcherPanelVisible) {
this.dispatcherPanelVisible = dispatcherPanelVisible;
}
public boolean isAdminPanelVisible() {
return adminPanelVisible;
}
public void setAdminPanelVisible(boolean adminPanelVisible) {
this.adminPanelVisible = adminPanelVisible;
}
public Set<Operator> getOperators() {
return operators;
}
public void setOperators(Set<Operator> operators) {
this.operators = operators;
}
public boolean addOperator(Operator operator) {
return this.operators.add(operator);
}
public boolean removeOperator(Operator operator) {
return this.operators.remove(operator);
}
@Override
public String toString() {
return roleName + '|'
+ dispatcherPanelVisible + '|'
+ adminPanelVisible
;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Role role = (Role) o;
return Objects.equals(isDispatcherPanelVisible(), role.isDispatcherPanelVisible()) &&
Objects.equals(isAdminPanelVisible(), role.isAdminPanelVisible()) &&
Objects.equals(getRoleName(), role.getRoleName()) &&
Objects.equals(getOperators(), role.getOperators());
}
@Override
public int hashCode() {
return Objects.hash(getRoleName(), isDispatcherPanelVisible(), isAdminPanelVisible(), getOperators());
}
}
| UTF-8 | Java | 2,938 | java | Role.java | Java | [
{
"context": ".Objects;\nimport java.util.Set;\n\n/**\n * Created by GFalcon on 16.07.15.\n */\n@Entity\n@Table(name = \"ROLE\")\npu",
"end": 150,
"score": 0.9992364645004272,
"start": 143,
"tag": "USERNAME",
"value": "GFalcon"
}
] | null | [] | package taxi.domain;
import javax.persistence.*;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
/**
* Created by GFalcon on 16.07.15.
*/
@Entity
@Table(name = "ROLE")
public class Role {
@Id
@Column(name = "ROLE_NAME", nullable = false)
private String roleName;
@Column(name = "DISPATCHER_PANEL")
private boolean dispatcherPanelVisible;
@Column(name = "ADMIN_PANEL")
private boolean adminPanelVisible;
@OneToMany(mappedBy = "role",
cascade = {CascadeType.DETACH,
CascadeType.PERSIST,
CascadeType.MERGE,
CascadeType.REFRESH})
private Set<Operator> operators;
public Role() {
}
public Role(String roleName) {
this(roleName, false, true);
}
public Role(String roleName, boolean adminPanelVisible, boolean dispatcherPanelVisible) {
operators = new HashSet<>();
this.roleName = roleName;
this.adminPanelVisible = adminPanelVisible;
this.dispatcherPanelVisible = dispatcherPanelVisible;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
public boolean isDispatcherPanelVisible() {
return dispatcherPanelVisible;
}
public void setDispatcherPanelVisible(boolean dispatcherPanelVisible) {
this.dispatcherPanelVisible = dispatcherPanelVisible;
}
public boolean isAdminPanelVisible() {
return adminPanelVisible;
}
public void setAdminPanelVisible(boolean adminPanelVisible) {
this.adminPanelVisible = adminPanelVisible;
}
public Set<Operator> getOperators() {
return operators;
}
public void setOperators(Set<Operator> operators) {
this.operators = operators;
}
public boolean addOperator(Operator operator) {
return this.operators.add(operator);
}
public boolean removeOperator(Operator operator) {
return this.operators.remove(operator);
}
@Override
public String toString() {
return roleName + '|'
+ dispatcherPanelVisible + '|'
+ adminPanelVisible
;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Role role = (Role) o;
return Objects.equals(isDispatcherPanelVisible(), role.isDispatcherPanelVisible()) &&
Objects.equals(isAdminPanelVisible(), role.isAdminPanelVisible()) &&
Objects.equals(getRoleName(), role.getRoleName()) &&
Objects.equals(getOperators(), role.getOperators());
}
@Override
public int hashCode() {
return Objects.hash(getRoleName(), isDispatcherPanelVisible(), isAdminPanelVisible(), getOperators());
}
}
| 2,938 | 0.635466 | 0.633424 | 109 | 25.954128 | 24.45756 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.458716 | false | false | 3 |
f86b4b0536cabdfd5f3da464e525ca4cd9c66b78 | 1,348,619,795,747 | 9986cc1243192832fec788e8b843253294a40664 | /src/main/java/com/jasekraft/projectmanager/mvc/models/User.java | 10998b0544aa497bc728e6f5737c08907b99b8f0 | [] | no_license | jase-k/projectManagementJAVA | https://github.com/jase-k/projectManagementJAVA | 727129aa8f8d2f8daa74c103d3de1974827f7a89 | 8caa8e77971f66ff842bcbe125de44091343bdee | refs/heads/master | 2023-08-14T09:38:07.915000 | 2021-10-12T21:41:58 | 2021-10-12T21:41:58 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.jasekraft.projectmanager.mvc.models;
import java.util.Date;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;
import org.springframework.format.annotation.DateTimeFormat;
@Entity
@Table(name="users")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(updatable=false)
@DateTimeFormat(pattern="yyy-MM-dd")
private Date createdAt;
@DateTimeFormat(pattern="yyy-MM-dd")
private Date updatedAt;
@NotEmpty(message="First name is required!")
@Size(min=3, max=30, message="Username must be between 3 and 30 characters")
private String fName;
@NotEmpty(message="Last name is required!")
@Size(min=3, max=30, message="Username must be between 3 and 30 characters")
private String lName;
@NotEmpty(message="Email is required!")
@Email(message="Please enter a valid email!")
private String email;
@NotEmpty(message="Password is required!")
@Size(min=8, max=128, message="Password must be between 8 and 128 characters")
private String password;
@Transient
@NotEmpty(message="Confirm Password is required!")
@Size(min=8, max=128, message="Confirm Password must be between 8 and 128 characters")
private String confirm;
@OneToMany(mappedBy="teamLead", fetch = FetchType.LAZY)
private List<Project> projects;
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(
name = "projects_users",
joinColumns = @JoinColumn(name = "user_id"),
inverseJoinColumns = @JoinColumn(name = "project_id")
)
private List<Project> team_projects;
public User() {}
public User(
@NotEmpty(message = "First name is required!") @Size(min = 3, max = 30, message = "Username must be between 3 and 30 characters") String fName,
@NotEmpty(message = "Last name is required!") @Size(min = 3, max = 30, message = "Username must be between 3 and 30 characters") String lName,
@NotEmpty(message = "Email is required!") @Email(message = "Please enter a valid email!") String email,
@NotEmpty(message = "Password is required!") @Size(min = 8, max = 128, message = "Password must be between 8 and 128 characters") String password,
List<Project> projects, List<Project> team_projects) {
super();
this.fName = fName;
this.lName = lName;
this.email = email;
this.password = password;
this.projects = projects;
this.team_projects = team_projects;
}
@PrePersist
protected void onCreate() {
this.createdAt = new Date();
this.updatedAt = new Date();
}
@PreUpdate
protected void onUpdate() {
this.updatedAt = new Date();
}
public List<Project> getTeam_projects() {
return team_projects;
}
public void setTeam_projects(List<Project> team_projects) {
this.team_projects = team_projects;
}
public Long getId() {
return id;
}
public List<Project> getProjects() {
return projects;
}
public void setProjects(List<Project> projects) {
this.projects = projects;
}
public void setId(Long id) {
this.id = id;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
public String getfName() {
return fName;
}
public void setfName(String fName) {
this.fName = fName;
}
public String getlName() {
return lName;
}
public void setlName(String lName) {
this.lName = lName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getConfirm() {
return confirm;
}
public void setConfirm(String confirm) {
this.confirm = confirm;
}
} | UTF-8 | Java | 4,553 | java | User.java | Java | [
{
"context": "e = lName;\n\t\tthis.email = email;\n\t\tthis.password = password;\n\t\tthis.projects = projects;\n\t\tthis.team_projects",
"end": 3010,
"score": 0.9989543557167053,
"start": 3002,
"tag": "PASSWORD",
"value": "password"
},
{
"context": "mail;\n\t}\n\n\n\tpublic String g... | null | [] | package com.jasekraft.projectmanager.mvc.models;
import java.util.Date;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;
import org.springframework.format.annotation.DateTimeFormat;
@Entity
@Table(name="users")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(updatable=false)
@DateTimeFormat(pattern="yyy-MM-dd")
private Date createdAt;
@DateTimeFormat(pattern="yyy-MM-dd")
private Date updatedAt;
@NotEmpty(message="First name is required!")
@Size(min=3, max=30, message="Username must be between 3 and 30 characters")
private String fName;
@NotEmpty(message="Last name is required!")
@Size(min=3, max=30, message="Username must be between 3 and 30 characters")
private String lName;
@NotEmpty(message="Email is required!")
@Email(message="Please enter a valid email!")
private String email;
@NotEmpty(message="Password is required!")
@Size(min=8, max=128, message="Password must be between 8 and 128 characters")
private String password;
@Transient
@NotEmpty(message="Confirm Password is required!")
@Size(min=8, max=128, message="Confirm Password must be between 8 and 128 characters")
private String confirm;
@OneToMany(mappedBy="teamLead", fetch = FetchType.LAZY)
private List<Project> projects;
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(
name = "projects_users",
joinColumns = @JoinColumn(name = "user_id"),
inverseJoinColumns = @JoinColumn(name = "project_id")
)
private List<Project> team_projects;
public User() {}
public User(
@NotEmpty(message = "First name is required!") @Size(min = 3, max = 30, message = "Username must be between 3 and 30 characters") String fName,
@NotEmpty(message = "Last name is required!") @Size(min = 3, max = 30, message = "Username must be between 3 and 30 characters") String lName,
@NotEmpty(message = "Email is required!") @Email(message = "Please enter a valid email!") String email,
@NotEmpty(message = "Password is required!") @Size(min = 8, max = 128, message = "Password must be between 8 and 128 characters") String password,
List<Project> projects, List<Project> team_projects) {
super();
this.fName = fName;
this.lName = lName;
this.email = email;
this.password = <PASSWORD>;
this.projects = projects;
this.team_projects = team_projects;
}
@PrePersist
protected void onCreate() {
this.createdAt = new Date();
this.updatedAt = new Date();
}
@PreUpdate
protected void onUpdate() {
this.updatedAt = new Date();
}
public List<Project> getTeam_projects() {
return team_projects;
}
public void setTeam_projects(List<Project> team_projects) {
this.team_projects = team_projects;
}
public Long getId() {
return id;
}
public List<Project> getProjects() {
return projects;
}
public void setProjects(List<Project> projects) {
this.projects = projects;
}
public void setId(Long id) {
this.id = id;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
public String getfName() {
return fName;
}
public void setfName(String fName) {
this.fName = fName;
}
public String getlName() {
return lName;
}
public void setlName(String lName) {
this.lName = lName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return <PASSWORD>;
}
public void setPassword(String password) {
this.password = <PASSWORD>;
}
public String getConfirm() {
return confirm;
}
public void setConfirm(String confirm) {
this.confirm = confirm;
}
} | 4,559 | 0.704371 | 0.693828 | 204 | 21.32353 | 25.444927 | 149 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.044118 | false | false | 3 |
0b414ce68d49e6047811f064229636ef905d4a73 | 14,396,730,427,245 | 659dd1c17a602ef783f71f2eb82a8dca6cbaf9d8 | /src/core/world/blocks/frame/Frame.java | dcc62927a0699bc15868a66fe073f198a558a5e3 | [] | no_license | AmateurPotion/Core | https://github.com/AmateurPotion/Core | 6afbba657f639ea56a190eb297eabb0c2bd7b63a | c940d18d2c69f167f7042829b4a1cc44296602cd | refs/heads/master | 2023-06-27T02:44:06.089000 | 2021-07-30T11:15:35 | 2021-07-30T11:15:35 | 365,458,047 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package core.world.blocks.frame;
import arc.Core;
import arc.scene.ui.layout.Table;
import arc.struct.Seq;
import arc.util.Log;
import mindustry.gen.*;
import mindustry.type.Item;
import mindustry.type.ItemStack;
import mindustry.ui.Styles;
import mindustry.world.Block;
import static core.Variable.uic;
public class Frame extends Block {
public int craftTableSize = 1;
public Frame(String name) {
super(name);
researchCostMultiplier = 10;
health = size * 2 * 50;
configurable = true;
hasItems = true;
}
@SuppressWarnings("unused")
public class FrameBuild extends Building {
private boolean invUpdate = true;
public void buildConfiguration(Table table) {
table.button(Icon.upOpen, Styles.clearTransi, () -> {
Seq<ItemStack> inv;
uic.addChild("frameUI", cont -> {
cont.margin(14f);
cont.getMinWidth();
cont.label(() -> Core.bundle.format("frame.title"));
cont.visible = false;
});
uic.toggle("frameUI");
}).size(40f);
}
public boolean acceptItem(Building source, Item item) {
return items.get(item) < itemCapacity;
}
public void handleItem(Building source, Item item) {
invUpdate = true;
Log.info(source.getDisplayName() + " / " + item.name);
items.add(item, 1);
}
public void handleStack(Item item, int amount, Teamc source) {
invUpdate = true;
Log.info(source.team().name + " / " + item.name);
noSleep();
items.add(item, amount);
}
}
} | UTF-8 | Java | 1,748 | java | Frame.java | Java | [] | null | [] | package core.world.blocks.frame;
import arc.Core;
import arc.scene.ui.layout.Table;
import arc.struct.Seq;
import arc.util.Log;
import mindustry.gen.*;
import mindustry.type.Item;
import mindustry.type.ItemStack;
import mindustry.ui.Styles;
import mindustry.world.Block;
import static core.Variable.uic;
public class Frame extends Block {
public int craftTableSize = 1;
public Frame(String name) {
super(name);
researchCostMultiplier = 10;
health = size * 2 * 50;
configurable = true;
hasItems = true;
}
@SuppressWarnings("unused")
public class FrameBuild extends Building {
private boolean invUpdate = true;
public void buildConfiguration(Table table) {
table.button(Icon.upOpen, Styles.clearTransi, () -> {
Seq<ItemStack> inv;
uic.addChild("frameUI", cont -> {
cont.margin(14f);
cont.getMinWidth();
cont.label(() -> Core.bundle.format("frame.title"));
cont.visible = false;
});
uic.toggle("frameUI");
}).size(40f);
}
public boolean acceptItem(Building source, Item item) {
return items.get(item) < itemCapacity;
}
public void handleItem(Building source, Item item) {
invUpdate = true;
Log.info(source.getDisplayName() + " / " + item.name);
items.add(item, 1);
}
public void handleStack(Item item, int amount, Teamc source) {
invUpdate = true;
Log.info(source.team().name + " / " + item.name);
noSleep();
items.add(item, amount);
}
}
} | 1,748 | 0.564073 | 0.55778 | 63 | 26.761906 | 20.215281 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.68254 | false | false | 3 |
65fc6ba57d4f2a6de37d3cf53dfe0dafd5961816 | 13,142,599,988,082 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/18/18_80920285a3bab2e7367bbabbc841ac06a558a91f/MathLine/18_80920285a3bab2e7367bbabbc841ac06a558a91f_MathLine_t.java | 5f493e264632eb628b1b6139b22d92c308ce5a35 | [] | no_license | zhongxingyu/Seer | https://github.com/zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516000 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | false | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | 2023-06-21T00:53:27 | 2023-06-22T07:55:57 | 2,849,868 | 2 | 2 | 0 | null | false | false | package jm.tex.lib.equationeditor.editorboard.objects;
import java.util.Collections;
import jm.tex.lib.equationeditor.LaTeXMenu.DataObject;
import jm.tex.lib.equationeditor.editorboard.EditorBoard;
import android.content.Context;
import android.view.ViewGroup;
public class MathLine extends MathObject implements ParentInterface{
private MathObject begin,end;
private EditorBoard board;
private int depth;
private int lastOverTop,lastOverBottom,lastOutterTop,lastOutterBottom;
public MathLine(Context context,EditorBoard board,MathLine line,int depth) {
super(context,line);
this.depth = depth;
this.board = board;
}
public void addBegin(){
addBegin(false);
}
public void addBegin(boolean dontInvalidate){
if(begin==null){
end = begin = new EditTextMathObject(getContext(),this);
addView(begin,dontInvalidate);
}
//begin.measure(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
//minLineHeight = begin.getMeasuredHeight();
}
@Override
public void addView(MathObject object,boolean dontInvalidate){
children.add(object);
Collections.sort(children);
object.setParent(this,dontInvalidate);
}
@Override
public boolean isLine() {
return true;
}
public int getDepth(){
return depth;
}
public MathObject getEnd(){
return end;
}
public MathObject getBegin(){
return begin;
}
public EditorBoard getBoard(){
return board;
}
//Řádky sjednocují over a outter parametry do over parametru
@Override
public int getOverTop() {
return overTop+outterTop;
}
//Řádky sjednocují over a outter parametry do over parametru
@Override
public int getOverBottom() {
return overBottom+outterBottom;
}
@Override
public int getOutterBottom() {
return 0;
}
@Override
public int getOutterTop() {
return 0;
}
@Override
public int getOverTopLine() {
return overTop;
}
@Override
public int getOverBottomLine() {
return overBottom;
}
public void setBegin(MathObject newBegin) {
if(newBegin!=null){
if(begin!=null){
begin.setPrevious(newBegin);
newBegin.setNext(begin);
}
begin = newBegin;
}else if(newBegin==null){
begin = null;
}
}
public void putBehind(MathObject insert,MathObject behind){
if (behind == null) {
setBegin(insert);
} else {
MathObject next = behind.getNext();
if (next == null) {
end = insert;
} else {
next.setPrevious(insert);
insert.setNext(next);
}
behind.setNext(insert);
insert.setPrevious(behind);
}
}
@Override
protected void onMeasure(boolean recursive) {
lastOverTop = this.overTop;
lastOverBottom = this.overBottom;
lastOutterTop = this.outterTop;
lastOutterBottom = this.outterBottom;
int width = 0;
overTop = 0;
overBottom = 0;
inside = 0;
outterTop = 0;
outterBottom = 0;
for(MathObject child:this.children){
if(recursive)
child.measure(true);
else if(child.size==Size.FILL_PARENT)
child.measure(true);
width += child.getMeasuredWidth();
inside = Math.max(inside, child.inside);
overTop = Math.max(overTop, child.getOverTop());
overBottom = Math.max(overBottom, child.getOverBottom());
outterTop = Math.max(outterTop, child.getOutterTop());
outterBottom = Math.max(outterBottom, child.getOutterBottom());
}
setMeasuredDimension(width, inside+overTop+overBottom+outterTop+outterBottom);
}
@Override
protected void layoutChild(MathObject mathObject) {
int lineHeight = getMeasuredHeight();
if(lastOverTop!=overTop || lastOverBottom!=overBottom || lastOutterTop!=outterTop || lastOutterBottom!=outterBottom/* || lastInside!=inside*/){
int objectWidth = 0;
MathObject object = getBegin();
while(object!=null){
int nWidth = objectWidth+object.getMeasuredWidth();
if(object!=mathObject)
object.layout(left+objectWidth, top+overTop-object.getOverTop()+outterTop-object.getOutterTop(), left+nWidth, top+lineHeight);
else
object.setBounds(left+objectWidth, top+overTop-object.getOverTop()+outterTop-object.getOutterTop(), left+nWidth, top+lineHeight);
objectWidth = nWidth;
object = object.getNext();
}
}else{
MathObject prev = mathObject.getPrevious();
MathObject next = mathObject.getNext();
int startX,endX;
if(prev!=null)
startX = prev.getRight();
else{
startX = getLeft();
}
int width = mathObject.getMeasuredWidth();
int lastWidth = mathObject.getLastWidth();
endX = startX+width;
if(width!=lastWidth){
int s = endX;
while(next!=null){
next.left = s;
s += next.getMeasuredWidth();
next.right = s;
next.layout(true);
next = next.getNext();
}
}
mathObject.setBounds(startX, top+overTop-mathObject.getOverTop()+outterTop-mathObject.getOutterTop(), endX, top+getMeasuredHeight());
}
/*
if(!heightUpdate){
int e = endX;
for(int i=children.size()-1;i>=0;--i){
MathObject o = children.get(i);
if(o.getSize()!=Size.FILL_PARENT)
break;
children.get(i).layout(,e,top+lineHeight);
}
}*/
}
@Override
protected boolean measureChild(MathObject mathObject) {
int oldHeight = getMeasuredHeight();
int oldObjectWidth = mathObject.getLastWidth();
// mathObject.measure();
lastOverTop = this.overTop;
lastOverBottom = this.overBottom;
lastOutterTop = this.outterTop;
lastOutterBottom = this.outterBottom;
int ot = mathObject.getOverTop();
int ob = mathObject.getOverBottom();
int in = mathObject.getInside();
int outt = mathObject.getOutterTop();
int outb = mathObject.getOutterBottom();
overTop = overTop<ot?ot:overTop;
overBottom = overBottom<ob?ob:overBottom;
inside = inside<in?in:inside;
outterBottom = outterBottom<outb?outb:outterBottom;
outterTop = outterTop<outt?outt:outterTop;
int newHeight = inside+overTop+overBottom+outterTop+outterBottom;
int delta = mathObject.getMeasuredWidth()-oldObjectWidth;
if(delta!=0 || newHeight!=oldHeight){
if(newHeight!=oldHeight){
for(int i=children.size()-1;i>=0;--i){
MathObject o = children.get(i);
if(o.getSize()!=Size.FILL_PARENT)//Objekty s nastaveným FILL_PARENT můžou změnit šířku, když se změní výška řádku=> pole children je seřazené podle size, takže nejdříve prochází objekty s FILL_PARENT a jakmile narazí na první jiný, tak vím, že už tam žádný FILL_PARENT není
break;
if(o!=mathObject){
int w = o.getMeasuredWidth();
o.measure(true);
delta += o.getMeasuredWidth()-w;
}
}
}
setMeasuredDimension(getMeasuredWidth()+delta, newHeight);
return true;
}else{
//FIXME Tohle by tady asi úplně nemělo být, ale funguje to s tím. Když se změní overTop objektu, ale zároveň se nezmění overTop řádku a zároveň se nezmění jinak výška objektu ani šířka tak neprojde vyšším layoutem, tak je potom objekt posunutý níže až do dalšího updatu.
mathObject.top = top+overTop-mathObject.getOverTop()+outterTop-mathObject.getOutterTop();
}
return false;
}
@Override
protected void onLayout(int left, int top, int right, int bottom,boolean children) {
//if(children){
// if(changed){
int width = 0;
int height = getMeasuredHeight();
MathObject object = getBegin();
if(children){
while(object!=null){
int nWidth = width+object.getMeasuredWidth();
object.layout(left+width, top+overTop-object.getOverTop()+outterTop-object.getOutterTop(), left+nWidth, top+height);
width = nWidth;
object = object.getNext();
}
}else{
while(object!=null){
int nWidth = width+object.getMeasuredWidth();
object.setBounds(left+width, top+overTop-object.getOverTop()+outterTop-object.getOutterTop(), left+nWidth, top+height);
width = nWidth;
object = object.getNext();
}
}
//}
//}
}
}
| UTF-8 | Java | 8,069 | java | 18_80920285a3bab2e7367bbabbc841ac06a558a91f_MathLine_t.java | Java | [] | null | [] | package jm.tex.lib.equationeditor.editorboard.objects;
import java.util.Collections;
import jm.tex.lib.equationeditor.LaTeXMenu.DataObject;
import jm.tex.lib.equationeditor.editorboard.EditorBoard;
import android.content.Context;
import android.view.ViewGroup;
public class MathLine extends MathObject implements ParentInterface{
private MathObject begin,end;
private EditorBoard board;
private int depth;
private int lastOverTop,lastOverBottom,lastOutterTop,lastOutterBottom;
public MathLine(Context context,EditorBoard board,MathLine line,int depth) {
super(context,line);
this.depth = depth;
this.board = board;
}
public void addBegin(){
addBegin(false);
}
public void addBegin(boolean dontInvalidate){
if(begin==null){
end = begin = new EditTextMathObject(getContext(),this);
addView(begin,dontInvalidate);
}
//begin.measure(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
//minLineHeight = begin.getMeasuredHeight();
}
@Override
public void addView(MathObject object,boolean dontInvalidate){
children.add(object);
Collections.sort(children);
object.setParent(this,dontInvalidate);
}
@Override
public boolean isLine() {
return true;
}
public int getDepth(){
return depth;
}
public MathObject getEnd(){
return end;
}
public MathObject getBegin(){
return begin;
}
public EditorBoard getBoard(){
return board;
}
//Řádky sjednocují over a outter parametry do over parametru
@Override
public int getOverTop() {
return overTop+outterTop;
}
//Řádky sjednocují over a outter parametry do over parametru
@Override
public int getOverBottom() {
return overBottom+outterBottom;
}
@Override
public int getOutterBottom() {
return 0;
}
@Override
public int getOutterTop() {
return 0;
}
@Override
public int getOverTopLine() {
return overTop;
}
@Override
public int getOverBottomLine() {
return overBottom;
}
public void setBegin(MathObject newBegin) {
if(newBegin!=null){
if(begin!=null){
begin.setPrevious(newBegin);
newBegin.setNext(begin);
}
begin = newBegin;
}else if(newBegin==null){
begin = null;
}
}
public void putBehind(MathObject insert,MathObject behind){
if (behind == null) {
setBegin(insert);
} else {
MathObject next = behind.getNext();
if (next == null) {
end = insert;
} else {
next.setPrevious(insert);
insert.setNext(next);
}
behind.setNext(insert);
insert.setPrevious(behind);
}
}
@Override
protected void onMeasure(boolean recursive) {
lastOverTop = this.overTop;
lastOverBottom = this.overBottom;
lastOutterTop = this.outterTop;
lastOutterBottom = this.outterBottom;
int width = 0;
overTop = 0;
overBottom = 0;
inside = 0;
outterTop = 0;
outterBottom = 0;
for(MathObject child:this.children){
if(recursive)
child.measure(true);
else if(child.size==Size.FILL_PARENT)
child.measure(true);
width += child.getMeasuredWidth();
inside = Math.max(inside, child.inside);
overTop = Math.max(overTop, child.getOverTop());
overBottom = Math.max(overBottom, child.getOverBottom());
outterTop = Math.max(outterTop, child.getOutterTop());
outterBottom = Math.max(outterBottom, child.getOutterBottom());
}
setMeasuredDimension(width, inside+overTop+overBottom+outterTop+outterBottom);
}
@Override
protected void layoutChild(MathObject mathObject) {
int lineHeight = getMeasuredHeight();
if(lastOverTop!=overTop || lastOverBottom!=overBottom || lastOutterTop!=outterTop || lastOutterBottom!=outterBottom/* || lastInside!=inside*/){
int objectWidth = 0;
MathObject object = getBegin();
while(object!=null){
int nWidth = objectWidth+object.getMeasuredWidth();
if(object!=mathObject)
object.layout(left+objectWidth, top+overTop-object.getOverTop()+outterTop-object.getOutterTop(), left+nWidth, top+lineHeight);
else
object.setBounds(left+objectWidth, top+overTop-object.getOverTop()+outterTop-object.getOutterTop(), left+nWidth, top+lineHeight);
objectWidth = nWidth;
object = object.getNext();
}
}else{
MathObject prev = mathObject.getPrevious();
MathObject next = mathObject.getNext();
int startX,endX;
if(prev!=null)
startX = prev.getRight();
else{
startX = getLeft();
}
int width = mathObject.getMeasuredWidth();
int lastWidth = mathObject.getLastWidth();
endX = startX+width;
if(width!=lastWidth){
int s = endX;
while(next!=null){
next.left = s;
s += next.getMeasuredWidth();
next.right = s;
next.layout(true);
next = next.getNext();
}
}
mathObject.setBounds(startX, top+overTop-mathObject.getOverTop()+outterTop-mathObject.getOutterTop(), endX, top+getMeasuredHeight());
}
/*
if(!heightUpdate){
int e = endX;
for(int i=children.size()-1;i>=0;--i){
MathObject o = children.get(i);
if(o.getSize()!=Size.FILL_PARENT)
break;
children.get(i).layout(,e,top+lineHeight);
}
}*/
}
@Override
protected boolean measureChild(MathObject mathObject) {
int oldHeight = getMeasuredHeight();
int oldObjectWidth = mathObject.getLastWidth();
// mathObject.measure();
lastOverTop = this.overTop;
lastOverBottom = this.overBottom;
lastOutterTop = this.outterTop;
lastOutterBottom = this.outterBottom;
int ot = mathObject.getOverTop();
int ob = mathObject.getOverBottom();
int in = mathObject.getInside();
int outt = mathObject.getOutterTop();
int outb = mathObject.getOutterBottom();
overTop = overTop<ot?ot:overTop;
overBottom = overBottom<ob?ob:overBottom;
inside = inside<in?in:inside;
outterBottom = outterBottom<outb?outb:outterBottom;
outterTop = outterTop<outt?outt:outterTop;
int newHeight = inside+overTop+overBottom+outterTop+outterBottom;
int delta = mathObject.getMeasuredWidth()-oldObjectWidth;
if(delta!=0 || newHeight!=oldHeight){
if(newHeight!=oldHeight){
for(int i=children.size()-1;i>=0;--i){
MathObject o = children.get(i);
if(o.getSize()!=Size.FILL_PARENT)//Objekty s nastaveným FILL_PARENT můžou změnit šířku, když se změní výška řádku=> pole children je seřazené podle size, takže nejdříve prochází objekty s FILL_PARENT a jakmile narazí na první jiný, tak vím, že už tam žádný FILL_PARENT není
break;
if(o!=mathObject){
int w = o.getMeasuredWidth();
o.measure(true);
delta += o.getMeasuredWidth()-w;
}
}
}
setMeasuredDimension(getMeasuredWidth()+delta, newHeight);
return true;
}else{
//FIXME Tohle by tady asi úplně nemělo být, ale funguje to s tím. Když se změní overTop objektu, ale zároveň se nezmění overTop řádku a zároveň se nezmění jinak výška objektu ani šířka tak neprojde vyšším layoutem, tak je potom objekt posunutý níže až do dalšího updatu.
mathObject.top = top+overTop-mathObject.getOverTop()+outterTop-mathObject.getOutterTop();
}
return false;
}
@Override
protected void onLayout(int left, int top, int right, int bottom,boolean children) {
//if(children){
// if(changed){
int width = 0;
int height = getMeasuredHeight();
MathObject object = getBegin();
if(children){
while(object!=null){
int nWidth = width+object.getMeasuredWidth();
object.layout(left+width, top+overTop-object.getOverTop()+outterTop-object.getOutterTop(), left+nWidth, top+height);
width = nWidth;
object = object.getNext();
}
}else{
while(object!=null){
int nWidth = width+object.getMeasuredWidth();
object.setBounds(left+width, top+overTop-object.getOverTop()+outterTop-object.getOutterTop(), left+nWidth, top+height);
width = nWidth;
object = object.getNext();
}
}
//}
//}
}
}
| 8,069 | 0.679375 | 0.6775 | 265 | 29.184906 | 32.800823 | 279 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.154717 | false | false | 3 |
d910ccaa2bfa7d224d7295c10495578e49a4805e | 13,142,599,990,146 | dbd71a0f6135552f36c49c5669f0d54147f32035 | /annotations/src/main/java/com/rbmhtechnology/vind/annotations/Field.java | c4c066727f2c3864a0ed89bca78a05accbb618ad | [
"Apache-2.0",
"LicenseRef-scancode-proprietary-license"
] | permissive | RBMHTechnology/vind | https://github.com/RBMHTechnology/vind | 26969ebe3e79aa79639b01e610bca7d741103712 | 55155d121a7bdf55e1afcb9f1e5f54cae230a41b | refs/heads/master | 2021-06-04T06:27:36.531000 | 2021-05-27T14:40:27 | 2021-05-27T14:40:27 | 93,754,068 | 22 | 18 | Apache-2.0 | false | 2021-05-26T12:09:17 | 2017-06-08T13:42:42 | 2021-05-18T08:56:58 | 2021-05-26T12:09:16 | 6,600 | 25 | 13 | 25 | Java | false | false | package com.rbmhtechnology.vind.annotations;
import java.lang.annotation.*;
/**
* Field-level configuration on how the field is put into the Search-Index.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
@Documented
public @interface Field {
/**
* The name of this field in the Index. If left out, the name of the annotated Field will be used.
* @return {@link String} name of the field.
*/
String name() default "";
/**
* <strong>EXPERT:</strong>
* Mark this field as {@code indexed}. Indexed fields can be part of a query.
* @return boolean flag whether the field is indexed or not. Default true.
*/
boolean indexed() default true;
/**
* <strong>EXPERT:</strong>
* Mark this field as {@code stored}. Stored fields can be retrieved in a query.
* @return boolean flag whether the field is stored or not. Default true.
*/
boolean stored() default true;
}
| UTF-8 | Java | 958 | java | Field.java | Java | [] | null | [] | package com.rbmhtechnology.vind.annotations;
import java.lang.annotation.*;
/**
* Field-level configuration on how the field is put into the Search-Index.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
@Documented
public @interface Field {
/**
* The name of this field in the Index. If left out, the name of the annotated Field will be used.
* @return {@link String} name of the field.
*/
String name() default "";
/**
* <strong>EXPERT:</strong>
* Mark this field as {@code indexed}. Indexed fields can be part of a query.
* @return boolean flag whether the field is indexed or not. Default true.
*/
boolean indexed() default true;
/**
* <strong>EXPERT:</strong>
* Mark this field as {@code stored}. Stored fields can be retrieved in a query.
* @return boolean flag whether the field is stored or not. Default true.
*/
boolean stored() default true;
}
| 958 | 0.665971 | 0.665971 | 33 | 28.030304 | 29.631561 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.181818 | false | false | 3 |
d8a95e7cde1382e0951f7defe22820073d6ce911 | 2,233,383,017,651 | 41d0c54e2711ba468467d3ff936b03761796c469 | /src/infestation/gui/Loading.java | 742eb89d0b93a5d3dfb44d0889ed9f2f5bc6eb63 | [] | no_license | ThyChief/Infestation | https://github.com/ThyChief/Infestation | 9e1e0157b889827ccd54ec38ec25eb50c8b82288 | 97f27bc0f2aa06bd52e990c91e71d98f5031720f | refs/heads/master | 2016-08-04T11:04:54.772000 | 2014-05-31T16:36:15 | 2014-05-31T16:36:15 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package infestation.gui;
import infestation.Bitmap;
import infestation.Game;
import infestation.Renderable;
import infestation.Updateable;
import java.awt.Graphics2D;
import java.awt.Rectangle;
/**
* @author Austin Green
*/
public class Loading implements Renderable, Updateable, Control
{
private int x, y;
private int relX, relY;
private boolean visible = true;
private Bitmap animation;
@Override
public void draw(Graphics2D gfx) {
if (visible)
{
int w = animation.getFrameWidth();
int h = animation.getFrameHeight();
Rectangle buffer = new Rectangle(relX + x - (w / 2), relY + y - (h / 2), w, h);
animation.draw(gfx, buffer, 0);
}
}
@Override
public void update() {
if (visible)
{
animation.update();
}
}
@Override
public int getZ()
{
return 0;
}
public void setVisibility(boolean value)
{
this.visible = value;
}
public boolean isVisible()
{
return visible;
}
public void setRelativeX(int x)
{
this.relX = x;
}
public void setRelativeY(int y)
{
this.relY = y;
}
public int getRelativeX()
{
return relX;
}
public int getRelativeY()
{
return relY;
}
public Loading(Game game, int x, int y)
{
this.animation = game.getSprite("loading");
this.x = x;
this.y = y;
}
}
| UTF-8 | Java | 1,282 | java | Loading.java | Java | [
{
"context": "hics2D;\nimport java.awt.Rectangle;\n\n/**\n * @author Austin Green\n */\npublic class Loading implements Renderable, U",
"end": 224,
"score": 0.9995508193969727,
"start": 212,
"tag": "NAME",
"value": "Austin Green"
}
] | null | [] | package infestation.gui;
import infestation.Bitmap;
import infestation.Game;
import infestation.Renderable;
import infestation.Updateable;
import java.awt.Graphics2D;
import java.awt.Rectangle;
/**
* @author <NAME>
*/
public class Loading implements Renderable, Updateable, Control
{
private int x, y;
private int relX, relY;
private boolean visible = true;
private Bitmap animation;
@Override
public void draw(Graphics2D gfx) {
if (visible)
{
int w = animation.getFrameWidth();
int h = animation.getFrameHeight();
Rectangle buffer = new Rectangle(relX + x - (w / 2), relY + y - (h / 2), w, h);
animation.draw(gfx, buffer, 0);
}
}
@Override
public void update() {
if (visible)
{
animation.update();
}
}
@Override
public int getZ()
{
return 0;
}
public void setVisibility(boolean value)
{
this.visible = value;
}
public boolean isVisible()
{
return visible;
}
public void setRelativeX(int x)
{
this.relX = x;
}
public void setRelativeY(int y)
{
this.relY = y;
}
public int getRelativeX()
{
return relX;
}
public int getRelativeY()
{
return relY;
}
public Loading(Game game, int x, int y)
{
this.animation = game.getSprite("loading");
this.x = x;
this.y = y;
}
}
| 1,276 | 0.658346 | 0.653666 | 85 | 14.082353 | 15.766839 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.564706 | false | false | 3 |
a41f0bf8db9a12a3ad5f3fb6f5556e39a8aabc34 | 7,086,696,106,061 | 1469b2794f135f66993dc7783b26e8f0f54002a4 | /PunchManiaAndroid/app/src/main/java/punchmania/punchmania/SoundPlayer.java | ec303b995c45e38eb638cbb2e546a04667624cd2 | [] | no_license | MarcusNordstrom/PunchMania | https://github.com/MarcusNordstrom/PunchMania | b29ff18b46479fba5e6cf436766b8284baef47b6 | a01810316afae0ad240e7f84f9b38cff6b26135d | refs/heads/master | 2020-03-08T14:03:13.437000 | 2018-06-03T05:13:33 | 2018-06-03T05:13:33 | 128,174,511 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package punchmania.punchmania;
import android.content.Context;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.SoundPool;
public class SoundPlayer {
private static SoundPool soundPool;
private static int startSound;
private static int startSwoosh;
public SoundPlayer(Context context) {
soundPool = new SoundPool(2, AudioManager.STREAM_MUSIC, 0);
startSound = soundPool.load(context, R.raw.start,1);
}
public void playStartSound(){
soundPool.play(startSound, 1.0f, 1.0f, 1, 0, 1.0f);
}
}
| UTF-8 | Java | 588 | java | SoundPlayer.java | Java | [] | null | [] | package punchmania.punchmania;
import android.content.Context;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.SoundPool;
public class SoundPlayer {
private static SoundPool soundPool;
private static int startSound;
private static int startSwoosh;
public SoundPlayer(Context context) {
soundPool = new SoundPool(2, AudioManager.STREAM_MUSIC, 0);
startSound = soundPool.load(context, R.raw.start,1);
}
public void playStartSound(){
soundPool.play(startSound, 1.0f, 1.0f, 1, 0, 1.0f);
}
}
| 588 | 0.715986 | 0.697279 | 22 | 25.727272 | 20.920155 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.909091 | false | false | 3 |
d7562a171bf34078ed7af8f905d50cf8cec2be6a | 5,574,867,591,320 | bc55a5f0dfe742048fe52f476d5a597c8e804669 | /workspace/FreemarkerDemo/src/main/java/com/abr/json/JSONFormat.java | 66d3e5e83cb3dc398eb619436511875b484f7e2c | [
"Apache-2.0"
] | permissive | abrichards5/ABRJava | https://github.com/abrichards5/ABRJava | efe4db0df6df499481e6a1fe9a5ca4cfb6ad455c | def353152015694980e74f73e0df5da3256b47ab | refs/heads/master | 2017-09-24T06:53:10.183000 | 2017-06-15T23:44:22 | 2017-06-15T23:44:22 | 20,819,261 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.abr.json;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.map.ObjectMapper;
import java.io.IOException;
/**
* Created with IntelliJ IDEA.
* User: adam
* Date: 8/7/13
* Time: 9:25 AM
* To change this template use File | Settings | File Templates.
*/
public class JSONFormat {
public static String formatPretty(String uglyJSONString) throws IOException {
ObjectMapper mapper = new ObjectMapper();
Object json = mapper.readValue(uglyJSONString, Object.class);
String pretty = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(json);
//String pretty = mapper.defaultPrettyPrintingWriter().writeValueAsString(json);
return pretty;
}
public static boolean isValidJSON(final String json) {
boolean valid = false;
try {
final JsonParser parser = new ObjectMapper().getJsonFactory()
.createJsonParser(json);
while (parser.nextToken() != null) {
}
valid = true;
} catch (JsonParseException jpe) {
jpe.printStackTrace();
} catch (IOException ioe) {
ioe.printStackTrace();
}
return valid;
}
public static void validate(final String json) throws IOException {
final JsonParser parser = new ObjectMapper().getJsonFactory()
.createJsonParser(json);
while (parser.nextToken() != null) {
}
}
}
| UTF-8 | Java | 1,531 | java | JSONFormat.java | Java | [
{
"context": "tion;\n\n/**\n * Created with IntelliJ IDEA.\n * User: adam\n * Date: 8/7/13\n * Time: 9:25 AM\n * To change thi",
"end": 236,
"score": 0.9990031719207764,
"start": 232,
"tag": "USERNAME",
"value": "adam"
}
] | null | [] | package com.abr.json;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.map.ObjectMapper;
import java.io.IOException;
/**
* Created with IntelliJ IDEA.
* User: adam
* Date: 8/7/13
* Time: 9:25 AM
* To change this template use File | Settings | File Templates.
*/
public class JSONFormat {
public static String formatPretty(String uglyJSONString) throws IOException {
ObjectMapper mapper = new ObjectMapper();
Object json = mapper.readValue(uglyJSONString, Object.class);
String pretty = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(json);
//String pretty = mapper.defaultPrettyPrintingWriter().writeValueAsString(json);
return pretty;
}
public static boolean isValidJSON(final String json) {
boolean valid = false;
try {
final JsonParser parser = new ObjectMapper().getJsonFactory()
.createJsonParser(json);
while (parser.nextToken() != null) {
}
valid = true;
} catch (JsonParseException jpe) {
jpe.printStackTrace();
} catch (IOException ioe) {
ioe.printStackTrace();
}
return valid;
}
public static void validate(final String json) throws IOException {
final JsonParser parser = new ObjectMapper().getJsonFactory()
.createJsonParser(json);
while (parser.nextToken() != null) {
}
}
}
| 1,531 | 0.640758 | 0.636186 | 57 | 25.85965 | 26.185196 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.350877 | false | false | 3 |
18467c58223bc8b7500f52690d84e52fd259b1cc | 16,011,638,106,118 | 928a8323915612811b431d29da0477ee7130bda0 | /Index-Card-Management-System/USICMgmtSys_ReferenceImpl (1)/USICMgmtSys/src/org/dapeng/usicms/gui/LoadProject.java | 6c1cb95270df13ce3e4e1c364db0c60dd1f59483 | [
"MIT"
] | permissive | taylorrobertss/Index-Card-Management-System | https://github.com/taylorrobertss/Index-Card-Management-System | e7f3c09492a85bc2333983ead9db071eab158cf4 | 1de51f6fc5863c3a38ce31f3b01ac5f81fcbd572 | refs/heads/master | 2023-05-14T19:01:48.290000 | 2021-06-11T09:51:17 | 2021-06-11T09:51:17 | 375,967,195 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.dapeng.usicms.gui;
import java.awt.BorderLayout;
import java.awt.Desktop;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
import javax.swing.DefaultComboBoxModel;
import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.JTextPane;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.border.EmptyBorder;
import org.dapeng.usicms.handler.ProjectLevelConfigs;
import org.dapeng.usicms.model.UserStory;
import org.dapeng.usicms.model.UserStoryStatus;
import org.dapeng.usicms.model.UserStoryType;
public class LoadProject extends JDialog{
private final JPanel contentPanel = new JPanel();
public static JTextField userFileTextField;
public LoadProject() {
//JTextField test = CreateProjectDialog.projFileTextField;
// System.out.println(userFileTextField.getText());
setBounds(100, 100, 379, 97);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
JLabel lblNewLabel = new JLabel("Project Name:");
userFileTextField = new JTextField();
userFileTextField.setColumns(10);
GroupLayout gl_contentPanel = new GroupLayout(contentPanel);
gl_contentPanel
.setHorizontalGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING)
.addGroup(gl_contentPanel.createSequentialGroup().addComponent(lblNewLabel)
.addPreferredGap(ComponentPlacement.RELATED).addComponent(userFileTextField,
GroupLayout.PREFERRED_SIZE, 245, GroupLayout.PREFERRED_SIZE)
.addContainerGap(84, Short.MAX_VALUE)));
gl_contentPanel.setVerticalGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING)
.addGroup(gl_contentPanel.createSequentialGroup()
.addGroup(gl_contentPanel.createParallelGroup(Alignment.BASELINE).addComponent(lblNewLabel)
.addComponent(userFileTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
GroupLayout.PREFERRED_SIZE))
.addContainerGap(217, Short.MAX_VALUE)));
contentPanel.setLayout(gl_contentPanel);
{
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
getContentPane().add(buttonPane, BorderLayout.SOUTH);
{
JButton okButton = new JButton("OK");
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JTextField loadThisProject = userFileTextField;
Desktop desktop = Desktop.getDesktop();
File fileName = new File(loadThisProject.getText());
try {
desktop.open(fileName);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
dispose();
}
});
okButton.setActionCommand("OK");
buttonPane.add(okButton);
getRootPane().setDefaultButton(okButton);
}
{
JButton cancelButton = new JButton("Cancel");
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
}
});
cancelButton.setActionCommand("Cancel");
buttonPane.add(cancelButton);
}
}
}
}
| UTF-8 | Java | 3,692 | java | LoadProject.java | Java | [] | null | [] | package org.dapeng.usicms.gui;
import java.awt.BorderLayout;
import java.awt.Desktop;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
import javax.swing.DefaultComboBoxModel;
import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.JTextPane;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.border.EmptyBorder;
import org.dapeng.usicms.handler.ProjectLevelConfigs;
import org.dapeng.usicms.model.UserStory;
import org.dapeng.usicms.model.UserStoryStatus;
import org.dapeng.usicms.model.UserStoryType;
public class LoadProject extends JDialog{
private final JPanel contentPanel = new JPanel();
public static JTextField userFileTextField;
public LoadProject() {
//JTextField test = CreateProjectDialog.projFileTextField;
// System.out.println(userFileTextField.getText());
setBounds(100, 100, 379, 97);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
JLabel lblNewLabel = new JLabel("Project Name:");
userFileTextField = new JTextField();
userFileTextField.setColumns(10);
GroupLayout gl_contentPanel = new GroupLayout(contentPanel);
gl_contentPanel
.setHorizontalGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING)
.addGroup(gl_contentPanel.createSequentialGroup().addComponent(lblNewLabel)
.addPreferredGap(ComponentPlacement.RELATED).addComponent(userFileTextField,
GroupLayout.PREFERRED_SIZE, 245, GroupLayout.PREFERRED_SIZE)
.addContainerGap(84, Short.MAX_VALUE)));
gl_contentPanel.setVerticalGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING)
.addGroup(gl_contentPanel.createSequentialGroup()
.addGroup(gl_contentPanel.createParallelGroup(Alignment.BASELINE).addComponent(lblNewLabel)
.addComponent(userFileTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
GroupLayout.PREFERRED_SIZE))
.addContainerGap(217, Short.MAX_VALUE)));
contentPanel.setLayout(gl_contentPanel);
{
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
getContentPane().add(buttonPane, BorderLayout.SOUTH);
{
JButton okButton = new JButton("OK");
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JTextField loadThisProject = userFileTextField;
Desktop desktop = Desktop.getDesktop();
File fileName = new File(loadThisProject.getText());
try {
desktop.open(fileName);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
dispose();
}
});
okButton.setActionCommand("OK");
buttonPane.add(okButton);
getRootPane().setDefaultButton(okButton);
}
{
JButton cancelButton = new JButton("Cancel");
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
}
});
cancelButton.setActionCommand("Cancel");
buttonPane.add(cancelButton);
}
}
}
}
| 3,692 | 0.744854 | 0.737541 | 104 | 33.5 | 22.160255 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.740385 | false | false | 3 |
30ff5190c9269b44ca97903e70562735fafe95e4 | 19,172,734,016,188 | 1d04c117ab9d5447f983148d5fbe81863b1a911a | /Home/src/main/java/com/spring/rest/controller/StudentController.java | 27cfffdf9928bf2c9fe53ea729b3ebdbd75e64d7 | [] | no_license | thameur-kheribi/UploadFile | https://github.com/thameur-kheribi/UploadFile | e15584ebb06222ba7581233eb6afdc71b5907e89 | db37152c5e7302dd3666988d99d8f5ab976ebdc1 | refs/heads/master | 2021-06-14T10:02:39.520000 | 2019-06-13T19:48:50 | 2019-06-13T19:48:50 | 188,564,661 | 1 | 1 | null | false | 2021-04-26T19:10:41 | 2019-05-25T12:39:19 | 2019-06-13T19:59:06 | 2021-04-26T19:10:40 | 5,639 | 1 | 1 | 1 | Java | false | false | package com.spring.rest.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.spring.rest.model.Student;
import com.spring.rest.service.StudentService;
@RestController
public class StudentController {
@Autowired
StudentService studentService;
// GET /Students Gets all students
@RequestMapping("/Students")
public List<Student> getAll() {
return studentService.getAllStudents();
}
// GET /Students/id Get student by id
@RequestMapping(value = "/Students/{id}", method = RequestMethod.GET)
public Student getStudent(@PathVariable String id)
{
return studentService.getStudent(Long.valueOf(id));
}
// POST /Students Add student
@RequestMapping(value = "/Students", method = RequestMethod.POST)
public void addStudent(@RequestBody Student student)
{
studentService.addStudent(student);
}
// PUT /Students/id Update student
@RequestMapping(value = "/Students/{id}", method = RequestMethod.PUT)
public void updateStudent(@PathVariable String id,
@RequestBody Student student)
{
studentService.updateStudent(Long.valueOf(id), student);
}
@RequestMapping(value = "/Students/{id}", method = RequestMethod.DELETE)
public void deleteStudent(@PathVariable String id)
{
studentService.deleteStudent(Long.valueOf(id));
}
// @RequestMapping("/Students/accounts")
// public String getAccount(@RequestParam String id)
// {
// return "TEST OK";
// }
}
| UTF-8 | Java | 1,904 | java | StudentController.java | Java | [] | null | [] | package com.spring.rest.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.spring.rest.model.Student;
import com.spring.rest.service.StudentService;
@RestController
public class StudentController {
@Autowired
StudentService studentService;
// GET /Students Gets all students
@RequestMapping("/Students")
public List<Student> getAll() {
return studentService.getAllStudents();
}
// GET /Students/id Get student by id
@RequestMapping(value = "/Students/{id}", method = RequestMethod.GET)
public Student getStudent(@PathVariable String id)
{
return studentService.getStudent(Long.valueOf(id));
}
// POST /Students Add student
@RequestMapping(value = "/Students", method = RequestMethod.POST)
public void addStudent(@RequestBody Student student)
{
studentService.addStudent(student);
}
// PUT /Students/id Update student
@RequestMapping(value = "/Students/{id}", method = RequestMethod.PUT)
public void updateStudent(@PathVariable String id,
@RequestBody Student student)
{
studentService.updateStudent(Long.valueOf(id), student);
}
@RequestMapping(value = "/Students/{id}", method = RequestMethod.DELETE)
public void deleteStudent(@PathVariable String id)
{
studentService.deleteStudent(Long.valueOf(id));
}
// @RequestMapping("/Students/accounts")
// public String getAccount(@RequestParam String id)
// {
// return "TEST OK";
// }
}
| 1,904 | 0.73792 | 0.73792 | 62 | 28.709677 | 24.980242 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.16129 | false | false | 3 |
c4e84fa47815a0b0936f81ba6ef6f1e40cec23ba | 30,073,361,012,259 | 3da7f9f59cd446e2f56880dbde374b916a9fedad | /src/GUI/Add_OrdonnanceController.java | a9559337fc593ab56cf6ee4dc2ca0c3ee254e945 | [] | no_license | AsmaMatmati/JavaFX | https://github.com/AsmaMatmati/JavaFX | b8c6cd43cd45fa53274471e4411ad6177dd9659e | 8dd9c4f3467014660bb83c20ebc1b81b9282fbb6 | refs/heads/main | 2023-05-03T03:31:15.105000 | 2021-05-23T18:24:39 | 2021-05-23T18:24:39 | 370,113,809 | 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 GUI;
import Entity.Catégorie;
import Entity.Consultation;
import Entity.Médicament;
import Entity.Ordonnance;
import Entity.Patient;
import Entity.User;
import Service.ServiceCateg;
import Service.ServiceCons;
import Service.ServiceMedic;
import Service.ServiceOrdo;
import Service.ServicePat;
import Service.ServiceUser;
import java.io.IOException;
import java.net.URL;
import java.sql.SQLException;
import java.util.List;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.AnchorPane;
import javax.swing.JOptionPane;
/**
* FXML Controller class
*
* @author ASSOUMA
*/
public class Add_OrdonnanceController implements Initializable {
@FXML
private AnchorPane add_form;
@FXML
private Button Add_btn;
@FXML
private Button reset;
@FXML
private ComboBox<String> NomMed;
@FXML
private ComboBox<String> NomPat;
@FXML
private ComboBox<String> DateCons;
@FXML
private ComboBox<String> Medic;
@FXML
private ComboBox<String> categ;
@FXML
private TextField nbdose;
@FXML
private TextField nbfois;
@FXML
private TextField nbjrs;
@FXML
private TextField nbpaq;
@FXML
private TextField desc;
ObservableList<String> listMed = FXCollections.observableArrayList();
ObservableList<String> listnomPat = FXCollections.observableArrayList();
ObservableList<String> listCons = FXCollections.observableArrayList();
ObservableList<String> listMedic = FXCollections.observableArrayList();
ObservableList<String> listCateg = FXCollections.observableArrayList();
@FXML
private ImageView retour;
@FXML
private Button Bhome;
@FXML
private Button listOrdonnances;
@FXML
private Button AddOrdo;
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
try {
fillcomboMed();
fillcomboCateg();
fillcomboCons();
fillcomboPat();
fillcomboMedic();
} catch (SQLException ex) {
Logger.getLogger(Add_OrdonnanceController.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void fillcomboMed() throws SQLException {
ServiceUser us = new ServiceUser();
List<User> listU = us.afficher();
for (User aux : listU) {
listMed.add(aux.getUsername());
}
NomMed.setItems(listMed);
}
public void fillcomboPat() throws SQLException {
ServicePat pt = new ServicePat();
List<Patient> listP = pt.afficher();
for (Patient aux : listP) {
listnomPat.add(aux.getNom());
}
NomPat.setItems(listnomPat);
}
public void fillcomboCons() throws SQLException {
ServiceCons co = new ServiceCons();
List<Consultation> listC = co.afficher();
for (Consultation aux : listC) {
listCons.add(aux.getDate_c().toString());
}
DateCons.setItems(listCons);
}
public void fillcomboMedic() throws SQLException {
ServiceMedic sm = new ServiceMedic();
List<Médicament> listM = sm.afficher();
for (Médicament aux : listM) {
listMedic.add(aux.getName());
}
Medic.setItems(listMedic);
}
public void fillcomboCateg() throws SQLException {
ServiceCateg ser = new ServiceCateg();
List<Catégorie> listCA = ser.afficher();
for (Catégorie aux : listCA) {
listCateg.add(aux.getNom());
}
categ.setItems(listCateg);
}
@FXML
private void Reset(MouseEvent event) {
NomMed.getSelectionModel().clearSelection();
NomPat.getSelectionModel().clearSelection();
DateCons.getSelectionModel().clearSelection();
Medic.getSelectionModel().clearSelection();
categ.getSelectionModel().clearSelection();
nbdose.clear();
nbfois.clear();
nbjrs.clear();
nbpaq.clear();
desc.clear();
}
@FXML
private void Add_Ordo(MouseEvent event) throws SQLException {
String description = desc.getText();
int nbr_jrs = Integer.valueOf(nbjrs.getText());
int nbr_doses = Integer.valueOf(nbdose.getText());
int nbr_fois = Integer.valueOf(nbfois.getText());
int nbr_paquets = Integer.valueOf(nbpaq.getText());
ServiceCateg ser = new ServiceCateg();
Catégorie list = ser.getByNom(categ.getValue());
ServiceMedic sm = new ServiceMedic();
Médicament listm = sm.getByMedic(Medic.getValue());
ServiceCons co = new ServiceCons();
Consultation listc = co.getByDate(DateCons.getValue());
ServicePat pt = new ServicePat();
Patient listP = pt.getByNomP(NomPat.getValue());
ServiceUser us = new ServiceUser();
User listUsr = us.getByUserName(NomMed.getValue());
ServiceOrdo sOrd = new ServiceOrdo();
Ordonnance ord = new Ordonnance(listm.getId(), list.getId(), listc.getId(), listP.getId(), listUsr.getId(), description, nbr_jrs, nbr_doses, nbr_fois, nbr_paquets);
sOrd.ajouter(ord);
try {
AnchorPane root = FXMLLoader.load(getClass().getResource("/GUI/Ordo.fxml"));
add_form.getChildren().setAll(root);
} catch (IOException ex) {
}
}
@FXML
private void retour(MouseEvent event) throws IOException {
Parent root;
try {
root = FXMLLoader.load(getClass().getResource("Ordo.fxml"));
add_form.getChildren().setAll(root);
} catch (IOException ex) {
JOptionPane.showConfirmDialog(null, ex, "", JOptionPane.ERROR_MESSAGE);
}
}
@FXML
private void ActionModifOrdo(ActionEvent event) {
Parent root;
try {
root = FXMLLoader.load(getClass().getResource("Add_Ordonnance.fxml"));
add_form.getChildren().setAll(root);
} catch (IOException ex) {
JOptionPane.showConfirmDialog(null, ex, "", JOptionPane.ERROR_MESSAGE);
}
}
@FXML
private void Acceuil(ActionEvent event) {
Parent root;
try {
root = FXMLLoader.load(getClass().getResource("AcceuilAsma.fxml"));
add_form.getChildren().setAll(root);
} catch (IOException ex) {
JOptionPane.showConfirmDialog(null, ex, "", JOptionPane.ERROR_MESSAGE);
}
}
@FXML
private void ListOrdonn(ActionEvent event) {
Parent root;
try {
root = FXMLLoader.load(getClass().getResource("Ordo.fxml"));
add_form.getChildren().setAll(root);
} catch (IOException ex) {
JOptionPane.showConfirmDialog(null, ex, "", JOptionPane.ERROR_MESSAGE);
}
}
}
| UTF-8 | Java | 7,631 | java | Add_OrdonnanceController.java | Java | [
{
"context": "nPane;\n\n/**\n * FXML Controller class\n *\n * @author ASSOUMA\n */\npublic class Add_OrdonnanceController impleme",
"end": 1375,
"score": 0.9190062880516052,
"start": 1368,
"tag": "NAME",
"value": "ASSOUMA"
}
] | 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 GUI;
import Entity.Catégorie;
import Entity.Consultation;
import Entity.Médicament;
import Entity.Ordonnance;
import Entity.Patient;
import Entity.User;
import Service.ServiceCateg;
import Service.ServiceCons;
import Service.ServiceMedic;
import Service.ServiceOrdo;
import Service.ServicePat;
import Service.ServiceUser;
import java.io.IOException;
import java.net.URL;
import java.sql.SQLException;
import java.util.List;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.AnchorPane;
import javax.swing.JOptionPane;
/**
* FXML Controller class
*
* @author ASSOUMA
*/
public class Add_OrdonnanceController implements Initializable {
@FXML
private AnchorPane add_form;
@FXML
private Button Add_btn;
@FXML
private Button reset;
@FXML
private ComboBox<String> NomMed;
@FXML
private ComboBox<String> NomPat;
@FXML
private ComboBox<String> DateCons;
@FXML
private ComboBox<String> Medic;
@FXML
private ComboBox<String> categ;
@FXML
private TextField nbdose;
@FXML
private TextField nbfois;
@FXML
private TextField nbjrs;
@FXML
private TextField nbpaq;
@FXML
private TextField desc;
ObservableList<String> listMed = FXCollections.observableArrayList();
ObservableList<String> listnomPat = FXCollections.observableArrayList();
ObservableList<String> listCons = FXCollections.observableArrayList();
ObservableList<String> listMedic = FXCollections.observableArrayList();
ObservableList<String> listCateg = FXCollections.observableArrayList();
@FXML
private ImageView retour;
@FXML
private Button Bhome;
@FXML
private Button listOrdonnances;
@FXML
private Button AddOrdo;
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
try {
fillcomboMed();
fillcomboCateg();
fillcomboCons();
fillcomboPat();
fillcomboMedic();
} catch (SQLException ex) {
Logger.getLogger(Add_OrdonnanceController.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void fillcomboMed() throws SQLException {
ServiceUser us = new ServiceUser();
List<User> listU = us.afficher();
for (User aux : listU) {
listMed.add(aux.getUsername());
}
NomMed.setItems(listMed);
}
public void fillcomboPat() throws SQLException {
ServicePat pt = new ServicePat();
List<Patient> listP = pt.afficher();
for (Patient aux : listP) {
listnomPat.add(aux.getNom());
}
NomPat.setItems(listnomPat);
}
public void fillcomboCons() throws SQLException {
ServiceCons co = new ServiceCons();
List<Consultation> listC = co.afficher();
for (Consultation aux : listC) {
listCons.add(aux.getDate_c().toString());
}
DateCons.setItems(listCons);
}
public void fillcomboMedic() throws SQLException {
ServiceMedic sm = new ServiceMedic();
List<Médicament> listM = sm.afficher();
for (Médicament aux : listM) {
listMedic.add(aux.getName());
}
Medic.setItems(listMedic);
}
public void fillcomboCateg() throws SQLException {
ServiceCateg ser = new ServiceCateg();
List<Catégorie> listCA = ser.afficher();
for (Catégorie aux : listCA) {
listCateg.add(aux.getNom());
}
categ.setItems(listCateg);
}
@FXML
private void Reset(MouseEvent event) {
NomMed.getSelectionModel().clearSelection();
NomPat.getSelectionModel().clearSelection();
DateCons.getSelectionModel().clearSelection();
Medic.getSelectionModel().clearSelection();
categ.getSelectionModel().clearSelection();
nbdose.clear();
nbfois.clear();
nbjrs.clear();
nbpaq.clear();
desc.clear();
}
@FXML
private void Add_Ordo(MouseEvent event) throws SQLException {
String description = desc.getText();
int nbr_jrs = Integer.valueOf(nbjrs.getText());
int nbr_doses = Integer.valueOf(nbdose.getText());
int nbr_fois = Integer.valueOf(nbfois.getText());
int nbr_paquets = Integer.valueOf(nbpaq.getText());
ServiceCateg ser = new ServiceCateg();
Catégorie list = ser.getByNom(categ.getValue());
ServiceMedic sm = new ServiceMedic();
Médicament listm = sm.getByMedic(Medic.getValue());
ServiceCons co = new ServiceCons();
Consultation listc = co.getByDate(DateCons.getValue());
ServicePat pt = new ServicePat();
Patient listP = pt.getByNomP(NomPat.getValue());
ServiceUser us = new ServiceUser();
User listUsr = us.getByUserName(NomMed.getValue());
ServiceOrdo sOrd = new ServiceOrdo();
Ordonnance ord = new Ordonnance(listm.getId(), list.getId(), listc.getId(), listP.getId(), listUsr.getId(), description, nbr_jrs, nbr_doses, nbr_fois, nbr_paquets);
sOrd.ajouter(ord);
try {
AnchorPane root = FXMLLoader.load(getClass().getResource("/GUI/Ordo.fxml"));
add_form.getChildren().setAll(root);
} catch (IOException ex) {
}
}
@FXML
private void retour(MouseEvent event) throws IOException {
Parent root;
try {
root = FXMLLoader.load(getClass().getResource("Ordo.fxml"));
add_form.getChildren().setAll(root);
} catch (IOException ex) {
JOptionPane.showConfirmDialog(null, ex, "", JOptionPane.ERROR_MESSAGE);
}
}
@FXML
private void ActionModifOrdo(ActionEvent event) {
Parent root;
try {
root = FXMLLoader.load(getClass().getResource("Add_Ordonnance.fxml"));
add_form.getChildren().setAll(root);
} catch (IOException ex) {
JOptionPane.showConfirmDialog(null, ex, "", JOptionPane.ERROR_MESSAGE);
}
}
@FXML
private void Acceuil(ActionEvent event) {
Parent root;
try {
root = FXMLLoader.load(getClass().getResource("AcceuilAsma.fxml"));
add_form.getChildren().setAll(root);
} catch (IOException ex) {
JOptionPane.showConfirmDialog(null, ex, "", JOptionPane.ERROR_MESSAGE);
}
}
@FXML
private void ListOrdonn(ActionEvent event) {
Parent root;
try {
root = FXMLLoader.load(getClass().getResource("Ordo.fxml"));
add_form.getChildren().setAll(root);
} catch (IOException ex) {
JOptionPane.showConfirmDialog(null, ex, "", JOptionPane.ERROR_MESSAGE);
}
}
}
| 7,631 | 0.647514 | 0.647514 | 271 | 27.12915 | 24.319407 | 172 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.583026 | false | false | 3 |
ca59c3fca8272a66836943176677cb02f5858049 | 6,871,947,677,415 | e514f4f30c12960b1172682f0cf9eaf117a3118b | /source/tools/print/api/korequest/KORequestJax.java | 96cbb5f59d5eb16740501b83cb9f5ef43c479d66 | [] | no_license | kwalkeraz/GPWS | https://github.com/kwalkeraz/GPWS | 1b4b3bae7da9a369d06fe017ff28f7c275187857 | ac4121e97606d7a65d2388044da5f5e6e109e92d | refs/heads/master | 2020-06-22T19:21:11.553000 | 2019-07-19T16:11:19 | 2019-07-19T16:11:19 | 197,786,083 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package tools.print.api.korequest;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;
import tools.print.api.korequest.KORequests;
import tools.print.api.korequest.KORequestFactory;
import tools.print.api.korequest.ObjectFactory;
import tools.print.jaxrs.MediaTypesArray;
import tools.print.jaxrs.Populate;
import tools.print.jaxrs.RespBuilder;
import tools.print.lib.AppTools;
import tools.print.lib.CategoryTools;
import tools.print.rest.PrepareConnection;
@XmlRegistry
@Path("/keyop")
public class KORequestJax extends Populate {
//Global Variables
PrepareConnection pc = new PrepareConnection();
AppTools tools = new AppTools();
final static ObjectFactory factory = new ObjectFactory();
static KORequests requests = null;
protected String korequestid = "";
protected String reqemail = "", reqname = "", devicetype = "", devicename = "", cityValue = "", buildingValue = "", reqstatus = "";
protected String keyopname = "", keyopuserid = "", closecodeid = "", dateRangeStart = "", dateRangeEnd = "";
public String getRequestID() {
return korequestid;
}
public void setRequestID(String value) {
this.korequestid = value;
}
public String getReqEmail() {
return reqemail;
}
public void setReqEmail(String value) {
this.reqemail = value;
}
public String getReqName() {
return reqname;
}
public void setReqName(String value) {
this.reqname = value;
}
public String getDeviceType() {
return devicetype;
}
public void setDeviceType(String value) {
this.devicetype = value;
}
public String getDeviceName() {
return devicename;
}
public void setDeviceName(String value) {
this.devicename = value;
}
public String getCityValue() {
return cityValue;
}
public void setCityValue(String value) {
this.cityValue = value;
}
public String getBuildingValue() {
return buildingValue;
}
public void setBuildingValue(String value) {
this.buildingValue = value;
}
public String getReqStatus() {
return reqstatus;
}
public void setReqStatus(String value) {
this.reqstatus = value;
}
public String getKeyopName() {
return keyopname;
}
public void setKeyopName(String value) {
this.keyopname = value;
}
public String getKeyopUserID() {
return keyopuserid;
}
public void setKeyopUserID(String value) {
this.keyopuserid = value;
}
public String getCloseCodeID() {
return closecodeid;
}
public void setCloseCodeID(String value) {
this.closecodeid = value;
}
public String getDateRangeStart() {
return dateRangeStart;
}
public void setDateRangeStart(String value) {
this.dateRangeStart = value;
}
public String getDateRangeEnd() {
return dateRangeEnd;
}
public void setDateRangeEnd(String value) {
this.dateRangeEnd = value;
}
public void createList(List<Map<String, Object>> columns) {
requests = factory.createKORequests();
List<Map<String, Object>> notesArray;
try {
for (Map<String, Object> i : columns) {
int koRequestID = pc.returnKeyValueInt(i, "KEYOP_REQUESTID");
String reqEmail = pc.returnKeyValue(i, "REQUESTOR_EMAIL");
String reqName = pc.returnKeyValue(i, "REQUESTOR_NAME");
String reqTieline = pc.returnKeyValue(i, "REQUESTOR_TIELINE");
String reqExtPhone = pc.returnKeyValue(i, "REQUESTOR_EXT_PHONE");
String timeSubmitted = pc.returnKeyValue(i, "TIME_SUBMITTED");
int deviceID = pc.returnKeyValueInt(i, "DEVICEID");
String deviceName = pc.returnKeyValue(i, "DEVICE_NAME");
String deviceSerial = pc.returnKeyValue(i, "DEVICE_SERIAL");
String deviceType = pc.returnKeyValue(i, "DEVICE_TYPE");
String tier = pc.returnKeyValue(i, "TIER");
String e2eCategory = pc.returnKeyValue(i, "E2E_CATEGORY");
String city = pc.returnKeyValue(i, "CITY");
int cityid = pc.returnKeyValueInt(i, "CITYID");
String building = pc.returnKeyValue(i, "BUILDING");
int buildingid = pc.returnKeyValueInt(i, "BUILDINGID");
String floor = pc.returnKeyValue(i, "FLOOR");
String room = pc.returnKeyValue(i, "ROOM");
String description = pc.returnKeyValue(i, "DESCRIPTION");
String ccEmail = pc.returnKeyValue(i, "CC_EMAIL");
String reqStatus = pc.returnKeyValue(i, "REQ_STATUS");
String solution = pc.returnKeyValue(i, "SOLUTION");
int keyopUserID = pc.returnKeyValueInt(i, "KEYOP_USERID");
String keyopName = pc.returnKeyValue(i, "KEYOP_NAME");
String timeFinished = pc.returnKeyValue(i, "TIME_FINISHED");
String closedBy = pc.returnKeyValue(i, "CLOSED_BY");
String customerContacted = pc.returnKeyValue(i, "CUSTOMER_CONTACTED");
String keyopTimeStart = pc.returnKeyValue(i, "KEYOP_TIME_START");
String keyopTimeFinish = pc.returnKeyValue(i, "KEYOP_TIME_FINISH");
String ceRefNum = pc.returnKeyValue(i, "CE_REFERRAL_NUM");
String ceRefDate = pc.returnKeyValue(i, "CE_REFERRAL_DATE");
String hdRefNum = pc.returnKeyValue(i, "HD_REFERRAL_NUM");
String hdRefDate = pc.returnKeyValue(i, "HD_REFERRAL_DATE");
String bondReqNum = pc.returnKeyValue(i, "BOND_REQ_NUM");
int closeCodeID = pc.returnKeyValueInt(i, "CLOSE_CODEID");
String keyopFName = pc.returnKeyValue(i, "KEYOP_FNAME");
String keyopLName = pc.returnKeyValue(i, "KEYOP_LNAME");
int vendorID = pc.returnKeyValueInt(i, "VENDORID");
int keyopCompanyID = pc.returnKeyValueInt(i, "KO_COMPANYID");
String keyopCompanyName = pc.returnKeyValue(i, "KO_COMPANY_NAME");
String nArray = "";
notesArray = prepareConnection2(koRequestID);
for (Map<String, Object> x : notesArray) {
nArray += " ::: " + pc.returnKeyValue(x, "DATE_TIME") + ": " + pc.returnKeyValue(x, "ADDED_BY") + " - " + pc.returnKeyValue(x, "NOTE");
}
nArray = nArray.replaceFirst(" ::: ", "");
requests.getKORequest().add(KORequestFactory.KORequestCreateList(factory, koRequestID, reqEmail, reqName, reqTieline, reqExtPhone, timeSubmitted, deviceID, deviceName, deviceSerial, deviceType, tier,
e2eCategory, city, cityid, building, buildingid, floor, room, description, ccEmail, reqStatus, solution, keyopUserID, keyopName, timeFinished,
closedBy, customerContacted, keyopTimeStart, keyopTimeFinish, ceRefNum, ceRefDate, hdRefNum, hdRefDate, bondReqNum, closeCodeID, keyopFName, keyopLName, vendorID, keyopCompanyID,
keyopCompanyName, nArray));
}
} catch (Exception e) {
System.out.println("Error in formatXML.");
e.printStackTrace();
System.out.println(e);
} //for loop
}
/**
* Prepares the SQL query
* @param - None
* @return - List from result set
*/
@SuppressWarnings("unchecked")
public List<Map<String, Object>> prepareConnection() {
List<Map<String, Object>> columns = new ArrayList<Map<String, Object>>();
String numRows = CategoryTools.getCategoryValue1("API-MaxResults", "korequest");
numRows = (numRows.equals("")) ? numRows = "10": numRows;
String sSQL = "SELECT KEYOP_REQUESTID, REQUESTOR_EMAIL, REQUESTOR_NAME, REQUESTOR_TIELINE, REQUESTOR_EXT_PHONE, TIME_SUBMITTED, DEVICEID, DEVICE_NAME, DEVICE_SERIAL, " +
"DEVICE_TYPE, TIER, E2E_CATEGORY, CITY, CITYID, BUILDING, BUILDINGID, FLOOR, ROOM, DESCRIPTION, CC_EMAIL, REQ_STATUS, SOLUTION, KEYOP_USERID, KEYOP_NAME, TIME_FINISHED, " +
"CLOSED_BY, CUSTOMER_CONTACTED, KEYOP_TIME_START, KEYOP_TIME_FINISH, CE_REFERRAL_NUM, CE_REFERRAL_DATE, HD_REFERRAL_NUM, HD_REFERRAL_DATE, BOND_REQ_NUM, CLOSE_CODEID, " +
"KEYOP_FNAME, KEYOP_LNAME, VENDORID, KO_COMPANYID, KO_COMPANY_NAME " +
"FROM GPWS.KEYOP_REQUEST_VIEW";
String sWhere = " WHERE 1=1";
if (korequestid != null && !korequestid.equals("")) {
sWhere += " AND KEYOP_REQUESTID = ?";
}
if (reqemail != null && !reqemail.equals("")) {
sWhere += " AND UPPER(REQUESTOR_EMAIL) LIKE ?";
}
if (reqname != null && !reqname.equals("")) {
sWhere += " AND UPPER(REQUESTOR_NAME) LIKE ?";
}
if (devicetype != null && !devicetype.equals("")) {
sWhere += " AND UPPER(DEVICE_TYPE) LIKE ?";
}
if (devicename != null && !devicename.equals("")) {
sWhere += " AND UPPER(DEVICE_NAME) LIKE ?";
}
if (cityValue != null && !cityValue.equals("")) {
sWhere += " AND UPPER(CITY) LIKE ?";
}
if (buildingValue != null && !buildingValue.equals("")) {
sWhere += " AND UPPER(BUILDING) LIKE ?";
}
if (reqstatus != null && !reqstatus.equals("")) {
sWhere += " AND UPPER(REQ_STATUS) LIKE ?";
}
if (keyopname != null && !keyopname.equals("")) {
sWhere += " AND UPPER(KEYOP_NAME) LIKE ?";
}
if (keyopuserid != null && !keyopuserid.equals("")) {
sWhere += " AND KEYOP_USERID = ?";
}
if (closecodeid != null && !closecodeid.equals("")) {
sWhere += " AND CLOSE_CODEID = ?";
}
if (dateRangeStart != null && !dateRangeStart.equals("") && dateRangeEnd != null && !dateRangeEnd.equals("")) {
sWhere += " AND ( (TIME_SUBMITTED >= ? AND TIME_SUBMITTED <= ?) OR (TIME_FINISHED >= ? AND TIME_FINISHED <= ?) )";
}
String sOrderBy = " ORDER BY KEYOP_REQUESTID FETCH FIRST " + numRows + " ROWS ONLY";
System.out.println("SQL is " + sSQL + sWhere + sOrderBy);
//To initialize the parameters, pass them as a hashmap
// (<hashmap index - integer>, <value to search for>)
int x = 1;
@SuppressWarnings("rawtypes")
HashMap hm = new HashMap();
if (korequestid != null && !korequestid.equals("")) {
hm.put(x, korequestid);
x++;
}
if (reqemail != null && !reqemail.equals("")) {
hm.put(x, "%" + reqemail.toUpperCase() + "%");
x++;
}
if (reqname != null && !reqname.equals("")) {
hm.put(x, "%" + reqname.toUpperCase() + "%");
x++;
}
if (devicetype != null && !devicetype.equals("")) {
hm.put(x, "%" + devicetype.toUpperCase() + "%");
x++;
}
if (devicename != null && !devicename.equals("")) {
hm.put(x, "%" + devicename.toUpperCase() + "%");
x++;
}
if (cityValue != null && !cityValue.equals("")) {
hm.put(x, "%" + cityValue.toUpperCase() + "%");
x++;
}
if (buildingValue != null && !buildingValue.equals("")) {
hm.put(x, "%" + buildingValue.toUpperCase() + "%");
x++;
}
if (reqstatus != null && !reqstatus.equals("")) {
hm.put(x, "%" + reqstatus.toUpperCase() + "%");
x++;
}
if (keyopname != null && !keyopname.equals("")) {
hm.put(x, "%" + keyopname.toUpperCase() + "%");
x++;
}
if (keyopuserid != null && !keyopuserid.equals("")) {
hm.put(x, keyopuserid);
x++;
}
if (closecodeid != null && !closecodeid.equals("")) {
hm.put(x, closecodeid);
x++;
}
if (dateRangeStart != null && !dateRangeStart.equals("") && dateRangeEnd != null && !dateRangeEnd.equals("")) {
hm.put(x, dateRangeStart + "-00.00.00.00");
x++;
hm.put(x, dateRangeEnd + "-00.00.00.00");
x++;
hm.put(x, dateRangeStart + "-00.00.00.00");
x++;
hm.put(x, dateRangeEnd + "-00.00.00.00");
x++;
}
columns = pc.prepareConnection(sSQL + sWhere + sOrderBy, hm);
return columns;
}
/**
* Prepares the SQL query
* @param - None
* @return - List from result set
*/
@SuppressWarnings("unchecked")
public List<Map<String, Object>> prepareConnection2(int id) {
List<Map<String, Object>> columns = new ArrayList<Map<String, Object>>();
String sSQL = "SELECT DATE_TIME, NOTE, ADDED_BY FROM GPWS.KO_REQUEST_NOTES WHERE KEYOP_REQUESTID = ? ORDER BY DATE_TIME";
System.out.println("SQL is " + sSQL);
//To initialize the parameters, pass them as a hashmap
// (<hashmap index - integer>, <value to search for>)
@SuppressWarnings("rawtypes")
HashMap hm = new HashMap();
hm.put(1, id);
columns = pc.prepareConnection(sSQL, hm);
return columns;
}
@GET
@Produces({MediaTypesArray.xmlType, MediaTypesArray.jsonType, MediaTypesArray.textXmlType, MediaTypesArray.textJsonType})
public JAXBElement<KORequests> getRequestwParam(@Context HttpServletRequest req) throws IOException {
setDeviceName(tools.nullStringConverter(req.getParameter("devicename")));
setRequestID(tools.nullStringConverter(req.getParameter("korequestid")));
setReqEmail(tools.nullStringConverter(req.getParameter("reqemail")));
setReqName(tools.nullStringConverter(req.getParameter("reqname")));
setDeviceType(tools.nullStringConverter(req.getParameter("devicetype")));
setDeviceName(tools.nullStringConverter(req.getParameter("devicename")));
setCityValue(tools.nullStringConverter(req.getParameter("city")));
setBuildingValue(tools.nullStringConverter(req.getParameter("building")));
setReqStatus(tools.nullStringConverter(req.getParameter("reqstatus")));
setKeyopName(tools.nullStringConverter(req.getParameter("keyopname")));
setKeyopUserID(tools.nullStringConverter(req.getParameter("keyopuserid")));
setCloseCodeID(tools.nullStringConverter(req.getParameter("closecodeid")));
setDateRangeStart(tools.nullStringConverter(req.getParameter("daterangestart")));
setDateRangeEnd(tools.nullStringConverter(req.getParameter("daterangeend")));
if (korequestid.equals("") && devicename.equals("") && reqemail.equals("") && reqname.equals("") && devicetype.equals("") && cityValue.equals("") && buildingValue.equals("") && reqstatus.equals("")
&& keyopname.equals("") && keyopuserid.equals("") && closecodeid.equals("") && dateRangeStart.equals("") && dateRangeEnd.equals("")) {
RespBuilder.createResponse(412);
} else {
populateList();
}
return createRequests(requests);
}
@GET
@Path("/korequestid/{id}")
@Produces({MediaTypesArray.xmlType, MediaTypesArray.jsonType, MediaTypesArray.textXmlType, MediaTypesArray.textJsonType})
public JAXBElement<KORequests> getKORequestByID(@PathParam("id") String name, @Context HttpServletRequest req) {
setRequestID(name);
populateList();
return createRequests(requests);
}
@GET
@Path("/reqemail/{name}")
@Produces({MediaTypesArray.xmlType, MediaTypesArray.jsonType, MediaTypesArray.textXmlType, MediaTypesArray.textJsonType})
public JAXBElement<KORequests> getByReqEmail(@PathParam("name") String name, @Context HttpServletRequest req) {
setReqEmail(name);
populateList();
return createRequests(requests);
}
@GET
@Path("/reqname/{name}")
@Produces({MediaTypesArray.xmlType, MediaTypesArray.jsonType, MediaTypesArray.textXmlType, MediaTypesArray.textJsonType})
public JAXBElement<KORequests> getByReqName(@PathParam("name") String name, @Context HttpServletRequest req) {
setReqName(name);
populateList();
return createRequests(requests);
}
@GET
@Path("/devicetype/{name}")
@Produces({MediaTypesArray.xmlType, MediaTypesArray.jsonType, MediaTypesArray.textXmlType, MediaTypesArray.textJsonType})
public JAXBElement<KORequests> getByDeviceType(@PathParam("name") String name, @Context HttpServletRequest req) {
setDeviceType(name);
populateList();
return createRequests(requests);
}
@GET
@Path("/devicename/{name}")
@Produces({MediaTypesArray.xmlType, MediaTypesArray.jsonType, MediaTypesArray.textXmlType, MediaTypesArray.textJsonType})
public JAXBElement<KORequests> getByDeviceName(@PathParam("name") String name, @Context HttpServletRequest req) {
setDeviceName(name);
populateList();
return createRequests(requests);
}
@GET
@Path("/city/{name}")
@Produces({MediaTypesArray.xmlType, MediaTypesArray.jsonType, MediaTypesArray.textXmlType, MediaTypesArray.textJsonType})
public JAXBElement<KORequests> getByCity(@PathParam("name") String name, @Context HttpServletRequest req) {
setCityValue(name);
populateList();
return createRequests(requests);
}
@GET
@Path("/building/{name}")
@Produces({MediaTypesArray.xmlType, MediaTypesArray.jsonType, MediaTypesArray.textXmlType, MediaTypesArray.textJsonType})
public JAXBElement<KORequests> getByBuilding(@PathParam("name") String name, @Context HttpServletRequest req) {
setBuildingValue(name);
populateList();
return createRequests(requests);
}
@GET
@Path("/reqstatus/{name}")
@Produces({MediaTypesArray.xmlType, MediaTypesArray.jsonType, MediaTypesArray.textXmlType, MediaTypesArray.textJsonType})
public JAXBElement<KORequests> getByReqStatus(@PathParam("name") String name, @Context HttpServletRequest req) {
setReqStatus(name);
populateList();
return createRequests(requests);
}
@GET
@Path("/keyopname/{name}")
@Produces({MediaTypesArray.xmlType, MediaTypesArray.jsonType, MediaTypesArray.textXmlType, MediaTypesArray.textJsonType})
public JAXBElement<KORequests> getByKeyopName(@PathParam("name") String name, @Context HttpServletRequest req) {
setKeyopName(name);
populateList();
return createRequests(requests);
}
@GET
@Path("/keyopuserid/{id}")
@Produces({MediaTypesArray.xmlType, MediaTypesArray.jsonType, MediaTypesArray.textXmlType, MediaTypesArray.textJsonType})
public JAXBElement<KORequests> getByKeyopUserID(@PathParam("id") String id, @Context HttpServletRequest req) {
setKeyopUserID(id);
populateList();
return createRequests(requests);
}
@GET
@Path("/closecodeid/{id}")
@Produces({MediaTypesArray.xmlType, MediaTypesArray.jsonType, MediaTypesArray.textXmlType, MediaTypesArray.textJsonType})
public JAXBElement<KORequests> getByCloseCodeID(@PathParam("id") String id, @Context HttpServletRequest req) {
setCloseCodeID(id);
populateList();
return createRequests(requests);
}
@GET
@Path("/rangestart/{start}/rangeend/{end}")
@Produces({MediaTypesArray.xmlType, MediaTypesArray.jsonType, MediaTypesArray.textXmlType, MediaTypesArray.textJsonType})
public JAXBElement<KORequests> getByCloseCodeID(@PathParam("start") String start, @PathParam("end") String end, @Context HttpServletRequest req) {
setDateRangeStart(start);
setDateRangeEnd(end);
populateList();
return createRequests(requests);
}
public JAXBElement<KORequests> createRequests(KORequests value) {
QName _var_QNAME = new QName(KORequests.class.getSimpleName());
return new JAXBElement<KORequests>(_var_QNAME, KORequests.class, value);
}
} //KORequestJax
| UTF-8 | Java | 19,012 | java | KORequestJax.java | Java | [] | null | [] | package tools.print.api.korequest;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;
import tools.print.api.korequest.KORequests;
import tools.print.api.korequest.KORequestFactory;
import tools.print.api.korequest.ObjectFactory;
import tools.print.jaxrs.MediaTypesArray;
import tools.print.jaxrs.Populate;
import tools.print.jaxrs.RespBuilder;
import tools.print.lib.AppTools;
import tools.print.lib.CategoryTools;
import tools.print.rest.PrepareConnection;
@XmlRegistry
@Path("/keyop")
public class KORequestJax extends Populate {
//Global Variables
PrepareConnection pc = new PrepareConnection();
AppTools tools = new AppTools();
final static ObjectFactory factory = new ObjectFactory();
static KORequests requests = null;
protected String korequestid = "";
protected String reqemail = "", reqname = "", devicetype = "", devicename = "", cityValue = "", buildingValue = "", reqstatus = "";
protected String keyopname = "", keyopuserid = "", closecodeid = "", dateRangeStart = "", dateRangeEnd = "";
public String getRequestID() {
return korequestid;
}
public void setRequestID(String value) {
this.korequestid = value;
}
public String getReqEmail() {
return reqemail;
}
public void setReqEmail(String value) {
this.reqemail = value;
}
public String getReqName() {
return reqname;
}
public void setReqName(String value) {
this.reqname = value;
}
public String getDeviceType() {
return devicetype;
}
public void setDeviceType(String value) {
this.devicetype = value;
}
public String getDeviceName() {
return devicename;
}
public void setDeviceName(String value) {
this.devicename = value;
}
public String getCityValue() {
return cityValue;
}
public void setCityValue(String value) {
this.cityValue = value;
}
public String getBuildingValue() {
return buildingValue;
}
public void setBuildingValue(String value) {
this.buildingValue = value;
}
public String getReqStatus() {
return reqstatus;
}
public void setReqStatus(String value) {
this.reqstatus = value;
}
public String getKeyopName() {
return keyopname;
}
public void setKeyopName(String value) {
this.keyopname = value;
}
public String getKeyopUserID() {
return keyopuserid;
}
public void setKeyopUserID(String value) {
this.keyopuserid = value;
}
public String getCloseCodeID() {
return closecodeid;
}
public void setCloseCodeID(String value) {
this.closecodeid = value;
}
public String getDateRangeStart() {
return dateRangeStart;
}
public void setDateRangeStart(String value) {
this.dateRangeStart = value;
}
public String getDateRangeEnd() {
return dateRangeEnd;
}
public void setDateRangeEnd(String value) {
this.dateRangeEnd = value;
}
public void createList(List<Map<String, Object>> columns) {
requests = factory.createKORequests();
List<Map<String, Object>> notesArray;
try {
for (Map<String, Object> i : columns) {
int koRequestID = pc.returnKeyValueInt(i, "KEYOP_REQUESTID");
String reqEmail = pc.returnKeyValue(i, "REQUESTOR_EMAIL");
String reqName = pc.returnKeyValue(i, "REQUESTOR_NAME");
String reqTieline = pc.returnKeyValue(i, "REQUESTOR_TIELINE");
String reqExtPhone = pc.returnKeyValue(i, "REQUESTOR_EXT_PHONE");
String timeSubmitted = pc.returnKeyValue(i, "TIME_SUBMITTED");
int deviceID = pc.returnKeyValueInt(i, "DEVICEID");
String deviceName = pc.returnKeyValue(i, "DEVICE_NAME");
String deviceSerial = pc.returnKeyValue(i, "DEVICE_SERIAL");
String deviceType = pc.returnKeyValue(i, "DEVICE_TYPE");
String tier = pc.returnKeyValue(i, "TIER");
String e2eCategory = pc.returnKeyValue(i, "E2E_CATEGORY");
String city = pc.returnKeyValue(i, "CITY");
int cityid = pc.returnKeyValueInt(i, "CITYID");
String building = pc.returnKeyValue(i, "BUILDING");
int buildingid = pc.returnKeyValueInt(i, "BUILDINGID");
String floor = pc.returnKeyValue(i, "FLOOR");
String room = pc.returnKeyValue(i, "ROOM");
String description = pc.returnKeyValue(i, "DESCRIPTION");
String ccEmail = pc.returnKeyValue(i, "CC_EMAIL");
String reqStatus = pc.returnKeyValue(i, "REQ_STATUS");
String solution = pc.returnKeyValue(i, "SOLUTION");
int keyopUserID = pc.returnKeyValueInt(i, "KEYOP_USERID");
String keyopName = pc.returnKeyValue(i, "KEYOP_NAME");
String timeFinished = pc.returnKeyValue(i, "TIME_FINISHED");
String closedBy = pc.returnKeyValue(i, "CLOSED_BY");
String customerContacted = pc.returnKeyValue(i, "CUSTOMER_CONTACTED");
String keyopTimeStart = pc.returnKeyValue(i, "KEYOP_TIME_START");
String keyopTimeFinish = pc.returnKeyValue(i, "KEYOP_TIME_FINISH");
String ceRefNum = pc.returnKeyValue(i, "CE_REFERRAL_NUM");
String ceRefDate = pc.returnKeyValue(i, "CE_REFERRAL_DATE");
String hdRefNum = pc.returnKeyValue(i, "HD_REFERRAL_NUM");
String hdRefDate = pc.returnKeyValue(i, "HD_REFERRAL_DATE");
String bondReqNum = pc.returnKeyValue(i, "BOND_REQ_NUM");
int closeCodeID = pc.returnKeyValueInt(i, "CLOSE_CODEID");
String keyopFName = pc.returnKeyValue(i, "KEYOP_FNAME");
String keyopLName = pc.returnKeyValue(i, "KEYOP_LNAME");
int vendorID = pc.returnKeyValueInt(i, "VENDORID");
int keyopCompanyID = pc.returnKeyValueInt(i, "KO_COMPANYID");
String keyopCompanyName = pc.returnKeyValue(i, "KO_COMPANY_NAME");
String nArray = "";
notesArray = prepareConnection2(koRequestID);
for (Map<String, Object> x : notesArray) {
nArray += " ::: " + pc.returnKeyValue(x, "DATE_TIME") + ": " + pc.returnKeyValue(x, "ADDED_BY") + " - " + pc.returnKeyValue(x, "NOTE");
}
nArray = nArray.replaceFirst(" ::: ", "");
requests.getKORequest().add(KORequestFactory.KORequestCreateList(factory, koRequestID, reqEmail, reqName, reqTieline, reqExtPhone, timeSubmitted, deviceID, deviceName, deviceSerial, deviceType, tier,
e2eCategory, city, cityid, building, buildingid, floor, room, description, ccEmail, reqStatus, solution, keyopUserID, keyopName, timeFinished,
closedBy, customerContacted, keyopTimeStart, keyopTimeFinish, ceRefNum, ceRefDate, hdRefNum, hdRefDate, bondReqNum, closeCodeID, keyopFName, keyopLName, vendorID, keyopCompanyID,
keyopCompanyName, nArray));
}
} catch (Exception e) {
System.out.println("Error in formatXML.");
e.printStackTrace();
System.out.println(e);
} //for loop
}
/**
* Prepares the SQL query
* @param - None
* @return - List from result set
*/
@SuppressWarnings("unchecked")
public List<Map<String, Object>> prepareConnection() {
List<Map<String, Object>> columns = new ArrayList<Map<String, Object>>();
String numRows = CategoryTools.getCategoryValue1("API-MaxResults", "korequest");
numRows = (numRows.equals("")) ? numRows = "10": numRows;
String sSQL = "SELECT KEYOP_REQUESTID, REQUESTOR_EMAIL, REQUESTOR_NAME, REQUESTOR_TIELINE, REQUESTOR_EXT_PHONE, TIME_SUBMITTED, DEVICEID, DEVICE_NAME, DEVICE_SERIAL, " +
"DEVICE_TYPE, TIER, E2E_CATEGORY, CITY, CITYID, BUILDING, BUILDINGID, FLOOR, ROOM, DESCRIPTION, CC_EMAIL, REQ_STATUS, SOLUTION, KEYOP_USERID, KEYOP_NAME, TIME_FINISHED, " +
"CLOSED_BY, CUSTOMER_CONTACTED, KEYOP_TIME_START, KEYOP_TIME_FINISH, CE_REFERRAL_NUM, CE_REFERRAL_DATE, HD_REFERRAL_NUM, HD_REFERRAL_DATE, BOND_REQ_NUM, CLOSE_CODEID, " +
"KEYOP_FNAME, KEYOP_LNAME, VENDORID, KO_COMPANYID, KO_COMPANY_NAME " +
"FROM GPWS.KEYOP_REQUEST_VIEW";
String sWhere = " WHERE 1=1";
if (korequestid != null && !korequestid.equals("")) {
sWhere += " AND KEYOP_REQUESTID = ?";
}
if (reqemail != null && !reqemail.equals("")) {
sWhere += " AND UPPER(REQUESTOR_EMAIL) LIKE ?";
}
if (reqname != null && !reqname.equals("")) {
sWhere += " AND UPPER(REQUESTOR_NAME) LIKE ?";
}
if (devicetype != null && !devicetype.equals("")) {
sWhere += " AND UPPER(DEVICE_TYPE) LIKE ?";
}
if (devicename != null && !devicename.equals("")) {
sWhere += " AND UPPER(DEVICE_NAME) LIKE ?";
}
if (cityValue != null && !cityValue.equals("")) {
sWhere += " AND UPPER(CITY) LIKE ?";
}
if (buildingValue != null && !buildingValue.equals("")) {
sWhere += " AND UPPER(BUILDING) LIKE ?";
}
if (reqstatus != null && !reqstatus.equals("")) {
sWhere += " AND UPPER(REQ_STATUS) LIKE ?";
}
if (keyopname != null && !keyopname.equals("")) {
sWhere += " AND UPPER(KEYOP_NAME) LIKE ?";
}
if (keyopuserid != null && !keyopuserid.equals("")) {
sWhere += " AND KEYOP_USERID = ?";
}
if (closecodeid != null && !closecodeid.equals("")) {
sWhere += " AND CLOSE_CODEID = ?";
}
if (dateRangeStart != null && !dateRangeStart.equals("") && dateRangeEnd != null && !dateRangeEnd.equals("")) {
sWhere += " AND ( (TIME_SUBMITTED >= ? AND TIME_SUBMITTED <= ?) OR (TIME_FINISHED >= ? AND TIME_FINISHED <= ?) )";
}
String sOrderBy = " ORDER BY KEYOP_REQUESTID FETCH FIRST " + numRows + " ROWS ONLY";
System.out.println("SQL is " + sSQL + sWhere + sOrderBy);
//To initialize the parameters, pass them as a hashmap
// (<hashmap index - integer>, <value to search for>)
int x = 1;
@SuppressWarnings("rawtypes")
HashMap hm = new HashMap();
if (korequestid != null && !korequestid.equals("")) {
hm.put(x, korequestid);
x++;
}
if (reqemail != null && !reqemail.equals("")) {
hm.put(x, "%" + reqemail.toUpperCase() + "%");
x++;
}
if (reqname != null && !reqname.equals("")) {
hm.put(x, "%" + reqname.toUpperCase() + "%");
x++;
}
if (devicetype != null && !devicetype.equals("")) {
hm.put(x, "%" + devicetype.toUpperCase() + "%");
x++;
}
if (devicename != null && !devicename.equals("")) {
hm.put(x, "%" + devicename.toUpperCase() + "%");
x++;
}
if (cityValue != null && !cityValue.equals("")) {
hm.put(x, "%" + cityValue.toUpperCase() + "%");
x++;
}
if (buildingValue != null && !buildingValue.equals("")) {
hm.put(x, "%" + buildingValue.toUpperCase() + "%");
x++;
}
if (reqstatus != null && !reqstatus.equals("")) {
hm.put(x, "%" + reqstatus.toUpperCase() + "%");
x++;
}
if (keyopname != null && !keyopname.equals("")) {
hm.put(x, "%" + keyopname.toUpperCase() + "%");
x++;
}
if (keyopuserid != null && !keyopuserid.equals("")) {
hm.put(x, keyopuserid);
x++;
}
if (closecodeid != null && !closecodeid.equals("")) {
hm.put(x, closecodeid);
x++;
}
if (dateRangeStart != null && !dateRangeStart.equals("") && dateRangeEnd != null && !dateRangeEnd.equals("")) {
hm.put(x, dateRangeStart + "-00.00.00.00");
x++;
hm.put(x, dateRangeEnd + "-00.00.00.00");
x++;
hm.put(x, dateRangeStart + "-00.00.00.00");
x++;
hm.put(x, dateRangeEnd + "-00.00.00.00");
x++;
}
columns = pc.prepareConnection(sSQL + sWhere + sOrderBy, hm);
return columns;
}
/**
* Prepares the SQL query
* @param - None
* @return - List from result set
*/
@SuppressWarnings("unchecked")
public List<Map<String, Object>> prepareConnection2(int id) {
List<Map<String, Object>> columns = new ArrayList<Map<String, Object>>();
String sSQL = "SELECT DATE_TIME, NOTE, ADDED_BY FROM GPWS.KO_REQUEST_NOTES WHERE KEYOP_REQUESTID = ? ORDER BY DATE_TIME";
System.out.println("SQL is " + sSQL);
//To initialize the parameters, pass them as a hashmap
// (<hashmap index - integer>, <value to search for>)
@SuppressWarnings("rawtypes")
HashMap hm = new HashMap();
hm.put(1, id);
columns = pc.prepareConnection(sSQL, hm);
return columns;
}
@GET
@Produces({MediaTypesArray.xmlType, MediaTypesArray.jsonType, MediaTypesArray.textXmlType, MediaTypesArray.textJsonType})
public JAXBElement<KORequests> getRequestwParam(@Context HttpServletRequest req) throws IOException {
setDeviceName(tools.nullStringConverter(req.getParameter("devicename")));
setRequestID(tools.nullStringConverter(req.getParameter("korequestid")));
setReqEmail(tools.nullStringConverter(req.getParameter("reqemail")));
setReqName(tools.nullStringConverter(req.getParameter("reqname")));
setDeviceType(tools.nullStringConverter(req.getParameter("devicetype")));
setDeviceName(tools.nullStringConverter(req.getParameter("devicename")));
setCityValue(tools.nullStringConverter(req.getParameter("city")));
setBuildingValue(tools.nullStringConverter(req.getParameter("building")));
setReqStatus(tools.nullStringConverter(req.getParameter("reqstatus")));
setKeyopName(tools.nullStringConverter(req.getParameter("keyopname")));
setKeyopUserID(tools.nullStringConverter(req.getParameter("keyopuserid")));
setCloseCodeID(tools.nullStringConverter(req.getParameter("closecodeid")));
setDateRangeStart(tools.nullStringConverter(req.getParameter("daterangestart")));
setDateRangeEnd(tools.nullStringConverter(req.getParameter("daterangeend")));
if (korequestid.equals("") && devicename.equals("") && reqemail.equals("") && reqname.equals("") && devicetype.equals("") && cityValue.equals("") && buildingValue.equals("") && reqstatus.equals("")
&& keyopname.equals("") && keyopuserid.equals("") && closecodeid.equals("") && dateRangeStart.equals("") && dateRangeEnd.equals("")) {
RespBuilder.createResponse(412);
} else {
populateList();
}
return createRequests(requests);
}
@GET
@Path("/korequestid/{id}")
@Produces({MediaTypesArray.xmlType, MediaTypesArray.jsonType, MediaTypesArray.textXmlType, MediaTypesArray.textJsonType})
public JAXBElement<KORequests> getKORequestByID(@PathParam("id") String name, @Context HttpServletRequest req) {
setRequestID(name);
populateList();
return createRequests(requests);
}
@GET
@Path("/reqemail/{name}")
@Produces({MediaTypesArray.xmlType, MediaTypesArray.jsonType, MediaTypesArray.textXmlType, MediaTypesArray.textJsonType})
public JAXBElement<KORequests> getByReqEmail(@PathParam("name") String name, @Context HttpServletRequest req) {
setReqEmail(name);
populateList();
return createRequests(requests);
}
@GET
@Path("/reqname/{name}")
@Produces({MediaTypesArray.xmlType, MediaTypesArray.jsonType, MediaTypesArray.textXmlType, MediaTypesArray.textJsonType})
public JAXBElement<KORequests> getByReqName(@PathParam("name") String name, @Context HttpServletRequest req) {
setReqName(name);
populateList();
return createRequests(requests);
}
@GET
@Path("/devicetype/{name}")
@Produces({MediaTypesArray.xmlType, MediaTypesArray.jsonType, MediaTypesArray.textXmlType, MediaTypesArray.textJsonType})
public JAXBElement<KORequests> getByDeviceType(@PathParam("name") String name, @Context HttpServletRequest req) {
setDeviceType(name);
populateList();
return createRequests(requests);
}
@GET
@Path("/devicename/{name}")
@Produces({MediaTypesArray.xmlType, MediaTypesArray.jsonType, MediaTypesArray.textXmlType, MediaTypesArray.textJsonType})
public JAXBElement<KORequests> getByDeviceName(@PathParam("name") String name, @Context HttpServletRequest req) {
setDeviceName(name);
populateList();
return createRequests(requests);
}
@GET
@Path("/city/{name}")
@Produces({MediaTypesArray.xmlType, MediaTypesArray.jsonType, MediaTypesArray.textXmlType, MediaTypesArray.textJsonType})
public JAXBElement<KORequests> getByCity(@PathParam("name") String name, @Context HttpServletRequest req) {
setCityValue(name);
populateList();
return createRequests(requests);
}
@GET
@Path("/building/{name}")
@Produces({MediaTypesArray.xmlType, MediaTypesArray.jsonType, MediaTypesArray.textXmlType, MediaTypesArray.textJsonType})
public JAXBElement<KORequests> getByBuilding(@PathParam("name") String name, @Context HttpServletRequest req) {
setBuildingValue(name);
populateList();
return createRequests(requests);
}
@GET
@Path("/reqstatus/{name}")
@Produces({MediaTypesArray.xmlType, MediaTypesArray.jsonType, MediaTypesArray.textXmlType, MediaTypesArray.textJsonType})
public JAXBElement<KORequests> getByReqStatus(@PathParam("name") String name, @Context HttpServletRequest req) {
setReqStatus(name);
populateList();
return createRequests(requests);
}
@GET
@Path("/keyopname/{name}")
@Produces({MediaTypesArray.xmlType, MediaTypesArray.jsonType, MediaTypesArray.textXmlType, MediaTypesArray.textJsonType})
public JAXBElement<KORequests> getByKeyopName(@PathParam("name") String name, @Context HttpServletRequest req) {
setKeyopName(name);
populateList();
return createRequests(requests);
}
@GET
@Path("/keyopuserid/{id}")
@Produces({MediaTypesArray.xmlType, MediaTypesArray.jsonType, MediaTypesArray.textXmlType, MediaTypesArray.textJsonType})
public JAXBElement<KORequests> getByKeyopUserID(@PathParam("id") String id, @Context HttpServletRequest req) {
setKeyopUserID(id);
populateList();
return createRequests(requests);
}
@GET
@Path("/closecodeid/{id}")
@Produces({MediaTypesArray.xmlType, MediaTypesArray.jsonType, MediaTypesArray.textXmlType, MediaTypesArray.textJsonType})
public JAXBElement<KORequests> getByCloseCodeID(@PathParam("id") String id, @Context HttpServletRequest req) {
setCloseCodeID(id);
populateList();
return createRequests(requests);
}
@GET
@Path("/rangestart/{start}/rangeend/{end}")
@Produces({MediaTypesArray.xmlType, MediaTypesArray.jsonType, MediaTypesArray.textXmlType, MediaTypesArray.textJsonType})
public JAXBElement<KORequests> getByCloseCodeID(@PathParam("start") String start, @PathParam("end") String end, @Context HttpServletRequest req) {
setDateRangeStart(start);
setDateRangeEnd(end);
populateList();
return createRequests(requests);
}
public JAXBElement<KORequests> createRequests(KORequests value) {
QName _var_QNAME = new QName(KORequests.class.getSimpleName());
return new JAXBElement<KORequests>(_var_QNAME, KORequests.class, value);
}
} //KORequestJax
| 19,012 | 0.676152 | 0.673627 | 509 | 36.351669 | 36.188713 | 204 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.284872 | false | false | 3 |
8f4dbb4822106d1f9329d71395d5a349108ad370 | 5,403,068,862,064 | 2e3849c1aa162a3f42e0697e51059914c775b845 | /libraries/LifeToolsMp3/src/ru/johnlife/lifetoolsmp3/engines/SearchHulkShare.java | 2fd4349376d27fd14b378b26236c139ab7bf7267 | [] | no_license | kairon007/UpMobile | https://github.com/kairon007/UpMobile | 4d3cfd540157476cd44f23ef78ebf2e6cede3d46 | 8ed7a23a30c079de990622df8e2af5440651a73d | refs/heads/master | 2020-12-25T16:25:04.873000 | 2015-08-11T12:19:40 | 2015-08-11T12:19:40 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ru.johnlife.lifetoolsmp3.engines;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URLEncoder;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import ru.johnlife.lifetoolsmp3.song.HulkShareSong;
public class SearchHulkShare extends SearchWithPages {
private static final Pattern SONG_TITLE_PATTERN = Pattern.compile("<b>([^<]*).*<a href[^>]*>([^<]*)");
private static String hulkshareBaseUrl = "https://www.hulkshare.com/dl/";
private static String hulkshareSuffix = "/hulkshare.mp3?d=1";
private static String hulkshareSearchUrl = "http://www.hulkshare.com/search.php?q=";
public SearchHulkShare(FinishedParsingSongs dInterface, String songName) {
super(dInterface, songName);
}
@Override
protected Void doInBackground(Void... arg0) {
try {
String duration = "";
String songName = URLEncoder.encode(getSongName(), "UTF-8");
songName = songName.replace("%20", "+");
String link = hulkshareSearchUrl + songName + "&p=" + page + "&per_page=20";
StringBuffer sb = readLink(link);
String[] searchRI = sb.toString().split("<div class=\"searchResultsItem\">");
for (int i = 1; i < searchRI.length; i++) {
try {
String content = searchRI[i];
String str = "<span class=\"vidDuration\">";
int start = content.indexOf(str);
duration = content.substring(start + str.length(), start + str.length() + 5);
String songData = content.substring(content.indexOf("<div class=\"resTP\">"));
songData = songData.substring(0, songData.indexOf("</div>"));
String songURL = songData.substring(songData.indexOf("<a href=\"/"));
songURL = songURL.substring(0, songURL.indexOf("\"><b>"));
songURL = songURL.replace("<a href=\"/", "");
//songURL = "http://www.hulkshare.com/ap-" + songURL+ "/&ref=.mp3";
// songURL = hulkshareBaseUrl + songURL;
// songURL = hulkshareBaseUrl + songURL + hulkshareSuffix;
Matcher m = SONG_TITLE_PATTERN.matcher(songData);
if (m.find()) {
String songTitle = m.group(1);
String songArtist = m.group(2);
if (songURL != "" && songTitle != "") {
HulkShareSong song = new HulkShareSong(songURL);
song.setSongTitle(songTitle);
song.setArtistName(songArtist);
song.setDuration(formatTime(duration));
addSong(song);
}
}
} catch (StringIndexOutOfBoundsException e) {
e.printStackTrace();
} catch (ArrayIndexOutOfBoundsException e) {
e.printStackTrace();
}
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
}
return null;
}
public long formatTime(String duration) {
long durationLong;
int min = Integer.valueOf(duration.substring(0, 2));
int sec = Integer.valueOf(duration.substring(3, 5));
durationLong = (min * 60 * 1000) + (sec * 1000);
return durationLong;
}
}
| UTF-8 | Java | 2,944 | java | SearchHulkShare.java | Java | [] | null | [] | package ru.johnlife.lifetoolsmp3.engines;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URLEncoder;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import ru.johnlife.lifetoolsmp3.song.HulkShareSong;
public class SearchHulkShare extends SearchWithPages {
private static final Pattern SONG_TITLE_PATTERN = Pattern.compile("<b>([^<]*).*<a href[^>]*>([^<]*)");
private static String hulkshareBaseUrl = "https://www.hulkshare.com/dl/";
private static String hulkshareSuffix = "/hulkshare.mp3?d=1";
private static String hulkshareSearchUrl = "http://www.hulkshare.com/search.php?q=";
public SearchHulkShare(FinishedParsingSongs dInterface, String songName) {
super(dInterface, songName);
}
@Override
protected Void doInBackground(Void... arg0) {
try {
String duration = "";
String songName = URLEncoder.encode(getSongName(), "UTF-8");
songName = songName.replace("%20", "+");
String link = hulkshareSearchUrl + songName + "&p=" + page + "&per_page=20";
StringBuffer sb = readLink(link);
String[] searchRI = sb.toString().split("<div class=\"searchResultsItem\">");
for (int i = 1; i < searchRI.length; i++) {
try {
String content = searchRI[i];
String str = "<span class=\"vidDuration\">";
int start = content.indexOf(str);
duration = content.substring(start + str.length(), start + str.length() + 5);
String songData = content.substring(content.indexOf("<div class=\"resTP\">"));
songData = songData.substring(0, songData.indexOf("</div>"));
String songURL = songData.substring(songData.indexOf("<a href=\"/"));
songURL = songURL.substring(0, songURL.indexOf("\"><b>"));
songURL = songURL.replace("<a href=\"/", "");
//songURL = "http://www.hulkshare.com/ap-" + songURL+ "/&ref=.mp3";
// songURL = hulkshareBaseUrl + songURL;
// songURL = hulkshareBaseUrl + songURL + hulkshareSuffix;
Matcher m = SONG_TITLE_PATTERN.matcher(songData);
if (m.find()) {
String songTitle = m.group(1);
String songArtist = m.group(2);
if (songURL != "" && songTitle != "") {
HulkShareSong song = new HulkShareSong(songURL);
song.setSongTitle(songTitle);
song.setArtistName(songArtist);
song.setDuration(formatTime(duration));
addSong(song);
}
}
} catch (StringIndexOutOfBoundsException e) {
e.printStackTrace();
} catch (ArrayIndexOutOfBoundsException e) {
e.printStackTrace();
}
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
}
return null;
}
public long formatTime(String duration) {
long durationLong;
int min = Integer.valueOf(duration.substring(0, 2));
int sec = Integer.valueOf(duration.substring(3, 5));
durationLong = (min * 60 * 1000) + (sec * 1000);
return durationLong;
}
}
| 2,944 | 0.670856 | 0.659647 | 79 | 36.265823 | 25.70953 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.620253 | false | false | 3 |
02509546b9f7fc170def0fdd8e8db4c2b662ffcf | 18,786,186,962,182 | 5e3235edf3de262f4d10b9e9e1fcc3bd13d6b8b1 | /Code Snippet Repository/Log4j/Log4j2299.java | 3eb4c6107cf50579e43bf2f1c46994a7a41c0c00 | [] | no_license | saber13812002/DeepCRM | https://github.com/saber13812002/DeepCRM | 3336a244d4852a364800af3181e03e868cf6f9f5 | be3e5e50e34a042d5ba7259ff5ff75c08ab32bb9 | refs/heads/master | 2023-03-16T00:08:06.473000 | 2018-04-18T05:29:50 | 2018-04-18T05:29:50 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | @Test
public void testFormatLogEventStringBuilderIso8601TimezoneJST() {
final LogEvent event = new MyLogEvent();
final String[] optionsWithTimezone = {ISO8601_FORMAT, "JST"};
final DatePatternConverter converter = DatePatternConverter.newInstance(optionsWithTimezone);
final StringBuilder sb = new StringBuilder();
converter.format(event, sb);
// JST=Japan Standard Time: UTC+9:00
final TimeZone tz = TimeZone.getTimeZone("JST");
final SimpleDateFormat sdf = new SimpleDateFormat(converter.getPattern());
sdf.setTimeZone(tz);
final long adjusted = event.getTimeMillis() + tz.getDSTSavings();
final String expected = sdf.format(new Date(adjusted));
// final String expected = "2011-12-30T18:56:35,987"; // in CET (Central Eastern Time: Amsterdam)
assertEquals(expected, sb.toString());
}
| UTF-8 | Java | 904 | java | Log4j2299.java | Java | [] | null | [] | @Test
public void testFormatLogEventStringBuilderIso8601TimezoneJST() {
final LogEvent event = new MyLogEvent();
final String[] optionsWithTimezone = {ISO8601_FORMAT, "JST"};
final DatePatternConverter converter = DatePatternConverter.newInstance(optionsWithTimezone);
final StringBuilder sb = new StringBuilder();
converter.format(event, sb);
// JST=Japan Standard Time: UTC+9:00
final TimeZone tz = TimeZone.getTimeZone("JST");
final SimpleDateFormat sdf = new SimpleDateFormat(converter.getPattern());
sdf.setTimeZone(tz);
final long adjusted = event.getTimeMillis() + tz.getDSTSavings();
final String expected = sdf.format(new Date(adjusted));
// final String expected = "2011-12-30T18:56:35,987"; // in CET (Central Eastern Time: Amsterdam)
assertEquals(expected, sb.toString());
}
| 904 | 0.68031 | 0.649336 | 17 | 51.941177 | 30.036196 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.941176 | false | false | 3 |
f452281d65fc6a8b45596133f0af10be1bdcd8a4 | 18,442,589,624,100 | c56e92125bff9f0818e466a59efa7a2fe7d48b93 | /src/net/th3shadowbroker/XConomy/Loaders/Imports.java | 4c12cf9981eef27fcecd9ede8be8468ca9fabf33 | [] | no_license | Th3Shadowbroker/XConomy | https://github.com/Th3Shadowbroker/XConomy | aa87ea023c726c04a2bb7194ce017a4e9e717a91 | 75c2561baea199cdbc6810e56eb7406ee18984e4 | refs/heads/master | 2020-04-05T14:36:23.346000 | 2016-09-02T13:14:02 | 2016-09-02T13:14:02 | 59,379,878 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package net.th3shadowbroker.XConomy.Loaders;
import net.th3shadowbroker.XConomy.Import.Essentials_Import;
import net.th3shadowbroker.XConomy.main;
import org.bukkit.Bukkit;
public class Imports
{
private final main XConomy;
//Construction
public Imports( main XConomy )
{
this.XConomy = XConomy;
this.CheckImports();
}
//Check for possible imports
public void CheckImports()
{
//Import essentials data
if ( Bukkit.getPluginManager().isPluginEnabled( "Essentials" ) )
{
Essentials_Import EssImport = new Essentials_Import();
EssImport.OnImport();
}
}
}
| UTF-8 | Java | 769 | java | Imports.java | Java | [] | null | [] | package net.th3shadowbroker.XConomy.Loaders;
import net.th3shadowbroker.XConomy.Import.Essentials_Import;
import net.th3shadowbroker.XConomy.main;
import org.bukkit.Bukkit;
public class Imports
{
private final main XConomy;
//Construction
public Imports( main XConomy )
{
this.XConomy = XConomy;
this.CheckImports();
}
//Check for possible imports
public void CheckImports()
{
//Import essentials data
if ( Bukkit.getPluginManager().isPluginEnabled( "Essentials" ) )
{
Essentials_Import EssImport = new Essentials_Import();
EssImport.OnImport();
}
}
}
| 769 | 0.564369 | 0.560468 | 36 | 19.361111 | 19.100834 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 3 |
4e48993b81a010b289136395f4426ab2f26b9c99 | 31,851,477,489,014 | 2e20f44d7a2b32348af670a19583c811867a55ac | /src/test/java/com/imsweb/staging/entities/StagingSchemaInputTest.java | 50e1adb0a37159c13d8d729ce56a6eb657817713 | [] | no_license | techtronics/staging-client-java | https://github.com/techtronics/staging-client-java | a8fe0c0dac86e73751aa99ca0ffee94aefe91b96 | 2ec3c51c1556e3db8c2ce6788a19d6aed45427a7 | refs/heads/master | 2017-12-24T10:26:48.847000 | 2016-10-07T19:23:20 | 2016-10-07T19:24:01 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.imsweb.staging.entities;
import java.util.Collections;
import java.util.HashSet;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
public class StagingSchemaInputTest {
@Test
public void testEquals() {
StagingSchemaInput input1 = new StagingSchemaInput();
StagingSchemaInput input2 = new StagingSchemaInput();
assertEquals(input1, input2);
input1.setKey("key");
input2.setKey("key");
input1.setName("name");
input2.setName("name");
input1.setMetadata(new HashSet<>(Collections.singletonList("META1")));
input2.setMetadata(new HashSet<>(Collections.singletonList("META1")));
assertEquals(input1, input2);
input2.setMetadata(new HashSet<>(Collections.singletonList("META2")));
assertNotEquals(input1, input2);
}
} | UTF-8 | Java | 907 | java | StagingSchemaInputTest.java | Java | [] | null | [] | package com.imsweb.staging.entities;
import java.util.Collections;
import java.util.HashSet;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
public class StagingSchemaInputTest {
@Test
public void testEquals() {
StagingSchemaInput input1 = new StagingSchemaInput();
StagingSchemaInput input2 = new StagingSchemaInput();
assertEquals(input1, input2);
input1.setKey("key");
input2.setKey("key");
input1.setName("name");
input2.setName("name");
input1.setMetadata(new HashSet<>(Collections.singletonList("META1")));
input2.setMetadata(new HashSet<>(Collections.singletonList("META1")));
assertEquals(input1, input2);
input2.setMetadata(new HashSet<>(Collections.singletonList("META2")));
assertNotEquals(input1, input2);
}
} | 907 | 0.692393 | 0.672547 | 33 | 26.515152 | 24.742456 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.636364 | false | false | 3 |
1dbb0da811db2907d41398282acbb5fb0e406baf | 32,925,219,307,696 | d0bd4f949e38ae242ca3e5216b2c610ba5326776 | /build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/file/FileUtil.java | 1daccfc1664709fd2cacd26c4ad6946cea434209 | [
"Apache-2.0"
] | permissive | apache/cayenne | https://github.com/apache/cayenne | f6844e75807bd1db02e30d7e1ce3fdbb26296fb5 | 983c51cd1f322ccbaa0468afe693adf938c3c1fe | refs/heads/master | 2023-08-31T03:09:20.919000 | 2023-08-23T19:32:01 | 2023-08-23T19:32:01 | 206,350 | 333 | 161 | null | false | 2023-08-09T12:43:35 | 2009-05-21T01:05:37 | 2023-08-01T07:37:31 | 2023-08-09T12:43:34 | 91,472 | 294 | 128 | 38 | 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
*
* https://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.cayenne.test.file;
import java.io.File;
public final class FileUtil {
static final String TEST_DIR_KEY = "cayenne.test.dir";
static final String DEFAULT_TEST_DIR = "target/testrun";
private static final File baseTestDirectory;
static {
String testDirName = System.getProperty(TEST_DIR_KEY);
if (testDirName == null) {
testDirName = DEFAULT_TEST_DIR;
}
baseTestDirectory = new File(testDirName);
// delete old tests
if (baseTestDirectory.exists()) {
if (!FileUtil.delete(testDirName, true)) {
throw new RuntimeException("Error deleting test directory: "
+ testDirName);
}
}
if (!baseTestDirectory.mkdirs()) {
throw new RuntimeException("Error creating test directory: " + testDirName);
}
}
/**
* Returns a test directory that is used as a scratch area.
*/
public static File baseTestDirectory() {
return baseTestDirectory;
}
public static boolean delete(String filePath, boolean recursive) {
File file = new File(filePath);
if (!file.exists()) {
return true;
}
if (!recursive || !file.isDirectory())
return file.delete();
String[] contents = file.list();
// list can be null if directory doesn't have an 'x' permission bit set for the
// user
if (contents != null) {
for (String item : contents) {
if (!delete(filePath + File.separator + item, true)) {
return false;
}
}
}
return file.delete();
}
}
| UTF-8 | Java | 2,681 | java | FileUtil.java | Java | [
{
"context": "leUtil {\n\n static final String TEST_DIR_KEY = \"cayenne.test.dir\";\n static final String DEFAULT_TEST_DIR = \"tar",
"end": 1099,
"score": 0.9984753727912903,
"start": 1083,
"tag": "KEY",
"value": "cayenne.test.dir"
}
] | 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
*
* https://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.cayenne.test.file;
import java.io.File;
public final class FileUtil {
static final String TEST_DIR_KEY = "cayenne.test.dir";
static final String DEFAULT_TEST_DIR = "target/testrun";
private static final File baseTestDirectory;
static {
String testDirName = System.getProperty(TEST_DIR_KEY);
if (testDirName == null) {
testDirName = DEFAULT_TEST_DIR;
}
baseTestDirectory = new File(testDirName);
// delete old tests
if (baseTestDirectory.exists()) {
if (!FileUtil.delete(testDirName, true)) {
throw new RuntimeException("Error deleting test directory: "
+ testDirName);
}
}
if (!baseTestDirectory.mkdirs()) {
throw new RuntimeException("Error creating test directory: " + testDirName);
}
}
/**
* Returns a test directory that is used as a scratch area.
*/
public static File baseTestDirectory() {
return baseTestDirectory;
}
public static boolean delete(String filePath, boolean recursive) {
File file = new File(filePath);
if (!file.exists()) {
return true;
}
if (!recursive || !file.isDirectory())
return file.delete();
String[] contents = file.list();
// list can be null if directory doesn't have an 'x' permission bit set for the
// user
if (contents != null) {
for (String item : contents) {
if (!delete(filePath + File.separator + item, true)) {
return false;
}
}
}
return file.delete();
}
}
| 2,681 | 0.587094 | 0.585602 | 82 | 31.695122 | 25.888453 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.329268 | false | false | 3 |
966649a01ed81164edd531834ae02b4bbf4b2327 | 1,700,807,117,779 | df50360dc3243df730c930b07b444a6016835439 | /src/model/Autor.java | c4509876f98dc6827cc3de5b1b4713a1e9d1d3ec | [] | no_license | lcssvieira/LivrariaVirtual | https://github.com/lcssvieira/LivrariaVirtual | 573ea5799d7eafd8e9a41421f88a25c2945340bb | ff75d9b63db1894f333870b15f55c9d027e924d7 | refs/heads/master | 2021-01-21T13:48:43.282000 | 2016-05-02T02:50:21 | 2016-05-02T02:50:21 | 55,078,983 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package model;
import java.util.Date;
public class Autor {
private long id;
private String nome, localNascimento, localFalecimento, biografia;
private Date dataNascimento, dataFalecimento;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getLocalNascimento() {
return localNascimento;
}
public void setLocalNascimento(String localNascimento) {
this.localNascimento = localNascimento;
}
public String getLocalFalecimento() {
return localFalecimento;
}
public void setLocalFalecimento(String localFalecimento) {
this.localFalecimento = localFalecimento;
}
public String getBiografia() {
return biografia;
}
public void setBiografia(String biografia) {
this.biografia = biografia;
}
public Date getDataNascimento() {
return dataNascimento;
}
public void setDataNascimento(Date dataNascimento) {
this.dataNascimento = dataNascimento;
}
public Date getDataFalecimento() {
return dataFalecimento;
}
public void setDataFalecimento(Date dataFalecimento) {
this.dataFalecimento = dataFalecimento;
}
}
| UTF-8 | Java | 1,196 | java | Autor.java | Java | [] | null | [] | package model;
import java.util.Date;
public class Autor {
private long id;
private String nome, localNascimento, localFalecimento, biografia;
private Date dataNascimento, dataFalecimento;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getLocalNascimento() {
return localNascimento;
}
public void setLocalNascimento(String localNascimento) {
this.localNascimento = localNascimento;
}
public String getLocalFalecimento() {
return localFalecimento;
}
public void setLocalFalecimento(String localFalecimento) {
this.localFalecimento = localFalecimento;
}
public String getBiografia() {
return biografia;
}
public void setBiografia(String biografia) {
this.biografia = biografia;
}
public Date getDataNascimento() {
return dataNascimento;
}
public void setDataNascimento(Date dataNascimento) {
this.dataNascimento = dataNascimento;
}
public Date getDataFalecimento() {
return dataFalecimento;
}
public void setDataFalecimento(Date dataFalecimento) {
this.dataFalecimento = dataFalecimento;
}
}
| 1,196 | 0.754181 | 0.754181 | 52 | 22 | 18.70623 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.596154 | false | false | 3 |
5059f7d140a7c6e6caac6c6d045b106304d69fc1 | 10,711,648,449,253 | e347a9dd298854d05bc319f10a57f458a5f0f56b | /goc-core/src/main/java/es/uji/apps/goc/notifications/MailSender.java | a7379b4931a09fa3ee47fe949e12e63919d15200 | [] | no_license | universitatjaumei/goc | https://github.com/universitatjaumei/goc | 91b49af78420ea5907deb9e1ab7999eb14d8290c | 74f8ae1ad2de2cc178abf3f73400cc5902528421 | refs/heads/master | 2019-07-17T04:08:08.594000 | 2019-03-05T12:05:00 | 2019-03-05T12:05:00 | 69,365,617 | 4 | 1 | null | false | 2017-12-21T17:50:10 | 2016-09-27T14:31:42 | 2017-11-12T19:12:17 | 2017-12-21T12:12:53 | 2,470 | 3 | 1 | 8 | Java | false | null | package es.uji.apps.goc.notifications;
import com.sun.istack.ByteArrayDataSource;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.Base64;
import java.util.Properties;
import javax.activation.DataHandler;
import javax.mail.Address;
import javax.mail.Authenticator;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
@Component
public class MailSender
{
private static Logger log = Logger.getLogger(MailSender.class);
private String smtpHost;
private Boolean smtpStartTLS;
private Boolean smtpAuthRequired;
private Integer smtpPort;
private String smtpUsername;
private String smtpPassword;
private String defaultSender;
@Autowired
public MailSender(
@Value("${uji.smtp.host}") String smtpHost,
@Value("${uji.smtp.starttls.enable}") String smtpStartTLS,
@Value("${uji.smtp.auth}") String smtpAuthRequired,
@Value("${uji.smtp.port}") String smtpPort,
@Value("${uji.smtp.username}") String smtpUsername,
@Value("${uji.smtp.password}") String smtpPassword,
@Value("${uji.smtp.defaultSender}") String defaultSender)
{
this.smtpHost = smtpHost;
this.smtpStartTLS = Boolean.parseBoolean(smtpStartTLS);
this.smtpAuthRequired = Boolean.parseBoolean(smtpAuthRequired);
this.smtpPort = Integer.parseInt(smtpPort);
this.smtpUsername = smtpUsername;
this.smtpPassword = smtpPassword;
this.defaultSender = defaultSender;
}
public void send(Mensaje message) throws CanNotSendException
{
if (message.getDestinos().size() == 0) {
return;
}
try
{
Session session = getMailSession();
Message mimeMessage = new MimeMessage(session);
defineMessageHeaders(mimeMessage);
setSubject(message, mimeMessage);
setRecipients(message, mimeMessage);
setMessageContent(message, mimeMessage);
Transport.send(mimeMessage);
}
catch (Exception e)
{
throw new CanNotSendException(e);
}
}
private Authenticator getAuthenticator()
{
if (smtpUsername == null || smtpPassword == null)
{
return null;
}
return new Authenticator()
{
@Override
protected PasswordAuthentication getPasswordAuthentication()
{
return new PasswordAuthentication(smtpUsername, smtpPassword);
}
};
}
private Properties getEmailProperties()
{
Properties props = new Properties();
props.put("mail.smtp.host", smtpHost);
props.put("mail.smtp.starttls.enable", smtpStartTLS);
props.put("mail.smtp.auth", smtpAuthRequired);
props.put("mail.smtp.port", smtpPort);
props.put("mail.smtp.ssl.trust", "email-smtp.eu-west-1.amazonaws.com");
return props;
}
private Session getMailSession()
{
return Session.getInstance(getEmailProperties(), getAuthenticator());
}
private void defineMessageHeaders(Message message) throws MessagingException
{
message.addHeader("Auto-Submitted", "auto-generated");
}
private void setSubject(Mensaje mensaje, Message message) throws MessagingException
{
message.setSubject(mensaje.getAsunto());
}
private void setRecipients(Mensaje mensaje, Message message) throws MessagingException
{
message.setFrom(new InternetAddress(defaultSender));
if (mensaje.getReplyTo() != null && !mensaje.getReplyTo().isEmpty())
{
message.setReplyTo(new Address[]{getAddress(mensaje.getReplyTo())});
}
for (String destino : mensaje.getDestinos())
{
Message.RecipientType recipientType = Message.RecipientType.TO;
message.addRecipient(recipientType, getAddress(destino));
}
}
private Address getAddress(String address) throws AddressException
{
if (address == null || address.equals(""))
{
return new InternetAddress();
}
return new InternetAddress(address.trim());
}
private void setMessageContent(Mensaje mensaje, Message message) throws MessagingException
{
MimeMultipart multipart = new MimeMultipart();
MimeBodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setContent(mensaje.getCuerpo(), mensaje.getContentType());
multipart.addBodyPart(messageBodyPart);
if(mensaje.getAdjuntos() != null)
{
for (ArchivoAdjunto archivoAdjunto : mensaje.getAdjuntos())
{
messageBodyPart = new MimeBodyPart();
byte[] contentDecoded = Base64.getDecoder().decode(archivoAdjunto.getContent());
ByteArrayDataSource byteArrayDataSource =
new ByteArrayDataSource(contentDecoded, archivoAdjunto.getcontentType());
messageBodyPart.setDataHandler(new DataHandler(byteArrayDataSource));
messageBodyPart.setFileName(archivoAdjunto.getFilename());
multipart.addBodyPart(messageBodyPart);
}
}
message.setContent(multipart);
}
} | UTF-8 | Java | 5,793 | java | MailSender.java | Java | [
{
"context": "er.parseInt(smtpPort);\n this.smtpUsername = smtpUsername;\n this.smtpPassword = smtpPassword;\n ",
"end": 1905,
"score": 0.8099328279495239,
"start": 1893,
"tag": "USERNAME",
"value": "smtpUsername"
},
{
"context": "ername = smtpUsername;\n th... | null | [] | package es.uji.apps.goc.notifications;
import com.sun.istack.ByteArrayDataSource;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.Base64;
import java.util.Properties;
import javax.activation.DataHandler;
import javax.mail.Address;
import javax.mail.Authenticator;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
@Component
public class MailSender
{
private static Logger log = Logger.getLogger(MailSender.class);
private String smtpHost;
private Boolean smtpStartTLS;
private Boolean smtpAuthRequired;
private Integer smtpPort;
private String smtpUsername;
private String smtpPassword;
private String defaultSender;
@Autowired
public MailSender(
@Value("${uji.smtp.host}") String smtpHost,
@Value("${uji.smtp.starttls.enable}") String smtpStartTLS,
@Value("${uji.smtp.auth}") String smtpAuthRequired,
@Value("${uji.smtp.port}") String smtpPort,
@Value("${uji.smtp.username}") String smtpUsername,
@Value("${uji.smtp.password}") String smtpPassword,
@Value("${uji.smtp.defaultSender}") String defaultSender)
{
this.smtpHost = smtpHost;
this.smtpStartTLS = Boolean.parseBoolean(smtpStartTLS);
this.smtpAuthRequired = Boolean.parseBoolean(smtpAuthRequired);
this.smtpPort = Integer.parseInt(smtpPort);
this.smtpUsername = smtpUsername;
this.smtpPassword = <PASSWORD>Password;
this.defaultSender = defaultSender;
}
public void send(Mensaje message) throws CanNotSendException
{
if (message.getDestinos().size() == 0) {
return;
}
try
{
Session session = getMailSession();
Message mimeMessage = new MimeMessage(session);
defineMessageHeaders(mimeMessage);
setSubject(message, mimeMessage);
setRecipients(message, mimeMessage);
setMessageContent(message, mimeMessage);
Transport.send(mimeMessage);
}
catch (Exception e)
{
throw new CanNotSendException(e);
}
}
private Authenticator getAuthenticator()
{
if (smtpUsername == null || smtpPassword == null)
{
return null;
}
return new Authenticator()
{
@Override
protected PasswordAuthentication getPasswordAuthentication()
{
return new PasswordAuthentication(smtpUsername, smtpPassword);
}
};
}
private Properties getEmailProperties()
{
Properties props = new Properties();
props.put("mail.smtp.host", smtpHost);
props.put("mail.smtp.starttls.enable", smtpStartTLS);
props.put("mail.smtp.auth", smtpAuthRequired);
props.put("mail.smtp.port", smtpPort);
props.put("mail.smtp.ssl.trust", "email-smtp.eu-west-1.amazonaws.com");
return props;
}
private Session getMailSession()
{
return Session.getInstance(getEmailProperties(), getAuthenticator());
}
private void defineMessageHeaders(Message message) throws MessagingException
{
message.addHeader("Auto-Submitted", "auto-generated");
}
private void setSubject(Mensaje mensaje, Message message) throws MessagingException
{
message.setSubject(mensaje.getAsunto());
}
private void setRecipients(Mensaje mensaje, Message message) throws MessagingException
{
message.setFrom(new InternetAddress(defaultSender));
if (mensaje.getReplyTo() != null && !mensaje.getReplyTo().isEmpty())
{
message.setReplyTo(new Address[]{getAddress(mensaje.getReplyTo())});
}
for (String destino : mensaje.getDestinos())
{
Message.RecipientType recipientType = Message.RecipientType.TO;
message.addRecipient(recipientType, getAddress(destino));
}
}
private Address getAddress(String address) throws AddressException
{
if (address == null || address.equals(""))
{
return new InternetAddress();
}
return new InternetAddress(address.trim());
}
private void setMessageContent(Mensaje mensaje, Message message) throws MessagingException
{
MimeMultipart multipart = new MimeMultipart();
MimeBodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setContent(mensaje.getCuerpo(), mensaje.getContentType());
multipart.addBodyPart(messageBodyPart);
if(mensaje.getAdjuntos() != null)
{
for (ArchivoAdjunto archivoAdjunto : mensaje.getAdjuntos())
{
messageBodyPart = new MimeBodyPart();
byte[] contentDecoded = Base64.getDecoder().decode(archivoAdjunto.getContent());
ByteArrayDataSource byteArrayDataSource =
new ByteArrayDataSource(contentDecoded, archivoAdjunto.getcontentType());
messageBodyPart.setDataHandler(new DataHandler(byteArrayDataSource));
messageBodyPart.setFileName(archivoAdjunto.getFilename());
multipart.addBodyPart(messageBodyPart);
}
}
message.setContent(multipart);
}
} | 5,799 | 0.657863 | 0.656655 | 178 | 31.550562 | 26.986685 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.573034 | false | false | 3 |
417fd154919faf569d6dc8f4df52ae54dc17c2a8 | 5,514,738,017,925 | cba7f24d33478cd1f12d68e3f9c371eac78e2e91 | /src/main/java/com/guangzhou/college/cms/controller/api/DownloadSchoolController.java | 3ccb8add1e91e7e945e18be839f2c3059ed021d3 | [] | no_license | smartluobo/guangzhou-college | https://github.com/smartluobo/guangzhou-college | a3923c863f5ea9cfb6352a0e28d94d7cf464fd67 | e6ed7100100a34bbf996ec5203fc90701a79357d | refs/heads/master | 2023-02-13T18:40:28.799000 | 2021-01-12T05:59:38 | 2021-01-12T05:59:38 | 296,090,559 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.guangzhou.college.cms.controller.api;
import com.guangzhou.college.cms.service.PlayResultService;
import com.guangzhou.college.cms.service.PlayUserService;
import com.guangzhou.college.cms.service.StudenInfoService;
import com.guangzhou.college.cms.service.TravelResultService;
import com.guangzhou.college.common.ResultInfo;
import com.guangzhou.college.common.ReturnCodeEnum;
import com.guangzhou.college.common.utils.JsonUtil;
import com.guangzhou.college.common.utils.Md5Util;
import com.guangzhou.college.common.utils.ValidateUtils;
import com.guangzhou.college.entity.PlayResult;
import com.guangzhou.college.entity.PlayUser;
import com.guangzhou.college.entity.StudenInfo;
import com.guangzhou.college.entity.TravelResult;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 接口调用Controller
*/
@Slf4j
@Controller
@RequestMapping("/download")
public class DownloadSchoolController {
@Autowired
private StudenInfoService studenInfoService;
@RequestMapping(value="/download64" , method = RequestMethod.GET)
public String download() {
return "redirect:http://cms.eecup.cn:8099/download/64.zip";
}
@RequestMapping(value="/reciveAccount" , method = RequestMethod.GET)
public String reciveAccount(HttpServletRequest request) {
String code = request.getParameter("account");
log.info("api uploadResult call....."+code );
StudenInfo studenInfo = new StudenInfo();
studenInfo.setAccount(code);
studenInfo.setCreateTime(new Date());
studenInfo.setSchool("广州大学");
List<StudenInfo> studenInfos = studenInfoService.selectListByPrimaryKey(studenInfo);
if(studenInfos.size()==0){
studenInfoService.insertSelective(studenInfo);
}
return "redirect:http://cms.eecup.cn:8078/about.html";
}
}
| UTF-8 | Java | 2,164 | java | DownloadSchoolController.java | Java | [] | null | [] | package com.guangzhou.college.cms.controller.api;
import com.guangzhou.college.cms.service.PlayResultService;
import com.guangzhou.college.cms.service.PlayUserService;
import com.guangzhou.college.cms.service.StudenInfoService;
import com.guangzhou.college.cms.service.TravelResultService;
import com.guangzhou.college.common.ResultInfo;
import com.guangzhou.college.common.ReturnCodeEnum;
import com.guangzhou.college.common.utils.JsonUtil;
import com.guangzhou.college.common.utils.Md5Util;
import com.guangzhou.college.common.utils.ValidateUtils;
import com.guangzhou.college.entity.PlayResult;
import com.guangzhou.college.entity.PlayUser;
import com.guangzhou.college.entity.StudenInfo;
import com.guangzhou.college.entity.TravelResult;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 接口调用Controller
*/
@Slf4j
@Controller
@RequestMapping("/download")
public class DownloadSchoolController {
@Autowired
private StudenInfoService studenInfoService;
@RequestMapping(value="/download64" , method = RequestMethod.GET)
public String download() {
return "redirect:http://cms.eecup.cn:8099/download/64.zip";
}
@RequestMapping(value="/reciveAccount" , method = RequestMethod.GET)
public String reciveAccount(HttpServletRequest request) {
String code = request.getParameter("account");
log.info("api uploadResult call....."+code );
StudenInfo studenInfo = new StudenInfo();
studenInfo.setAccount(code);
studenInfo.setCreateTime(new Date());
studenInfo.setSchool("广州大学");
List<StudenInfo> studenInfos = studenInfoService.selectListByPrimaryKey(studenInfo);
if(studenInfos.size()==0){
studenInfoService.insertSelective(studenInfo);
}
return "redirect:http://cms.eecup.cn:8078/about.html";
}
}
| 2,164 | 0.764432 | 0.756052 | 64 | 32.5625 | 24.922928 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5625 | false | false | 3 |
a7d667f41c1a22933d8d5574e15ff855bc70e22d | 5,514,738,019,906 | 0d35ecf068d3d83327ffaf9dd0bc0ef1c9e3c3de | /CustomBehavior/app/src/main/java/com/app/behavior/behavior/helper/ViewOffsetBehavior2.java | 6df9ecf2ce9ec1ae78d944884ea44504fe8b40d9 | [] | no_license | yanglilizhang/NestedScrollDir | https://github.com/yanglilizhang/NestedScrollDir | 081992237a620d9e46ce70c21507de30da4f128b | a2e20a7281bc88dbe0204b72b045141c1291556b | refs/heads/master | 2022-12-04T00:01:28.019000 | 2020-08-21T08:01:21 | 2020-08-21T08:01:21 | 278,277,059 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.app.behavior.behavior.helper;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
public class ViewOffsetBehavior2<V extends View> extends CoordinatorLayout.Behavior<V> {
private ViewOffsetHelper2 viewOffsetHelper;
private int tempTopBottomOffset = 0;
private int tempLeftRightOffset = 0;
public ViewOffsetBehavior2() {
}
@Override
public boolean onLayoutChild(@NonNull CoordinatorLayout parent, @NonNull V child, int layoutDirection) {
layoutChild(parent, child, layoutDirection);
assertViewOffsetHelper(child);
viewOffsetHelper.onViewLayout();
viewOffsetHelper.applyOffsets();
if (tempTopBottomOffset != 0) {
viewOffsetHelper.setTopAndBottomOffset(tempTopBottomOffset);
tempTopBottomOffset = 0;
}
if (tempLeftRightOffset != 0) {
viewOffsetHelper.setLeftAndRightOffset(tempLeftRightOffset);
tempLeftRightOffset = 0;
}
return true;
}
private void assertViewOffsetHelper(V child) {
if (viewOffsetHelper == null) {
viewOffsetHelper = new ViewOffsetHelper2(child);
}
}
protected void layoutChild(CoordinatorLayout parent, V child, int layoutDirection) {
parent.onLayoutChild(child, layoutDirection);
}
public boolean setTopAndBottomOffset(int offset) {
if (viewOffsetHelper != null) {
return viewOffsetHelper.setTopAndBottomOffset(offset);
} else {
tempTopBottomOffset = offset;
}
return false;
}
public boolean setLeftAndRightOffset(int offset) {
if (viewOffsetHelper != null) {
return viewOffsetHelper.setLeftAndRightOffset(offset);
} else {
tempLeftRightOffset = offset;
}
return false;
}
public int getTopAndBottomOffset() {
return viewOffsetHelper != null ? viewOffsetHelper.getTopAndBottomOffset() : 0;
}
public int getLeftAndRightOffset() {
return viewOffsetHelper != null ? viewOffsetHelper.getLeftAndRightOffset() : 0;
}
public void setVerticalOffsetEnabled(boolean verticalOffsetEnabled) {
if (viewOffsetHelper != null) {
viewOffsetHelper.setVerticalOffsetEnabled(verticalOffsetEnabled);
}
}
public boolean isVerticalOffsetEnabled() {
return viewOffsetHelper != null && viewOffsetHelper.isVerticalOffsetEnabled();
}
public void setHorizontalOffsetEnabled(boolean horizontalOffsetEnabled) {
if (viewOffsetHelper != null) {
viewOffsetHelper.setHorizontalOffsetEnabled(horizontalOffsetEnabled);
}
}
public boolean isHorizontalOffsetEnabled() {
return viewOffsetHelper != null && viewOffsetHelper.isHorizontalOffsetEnabled();
}
} | UTF-8 | Java | 2,901 | java | ViewOffsetBehavior2.java | Java | [] | null | [] | package com.app.behavior.behavior.helper;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
public class ViewOffsetBehavior2<V extends View> extends CoordinatorLayout.Behavior<V> {
private ViewOffsetHelper2 viewOffsetHelper;
private int tempTopBottomOffset = 0;
private int tempLeftRightOffset = 0;
public ViewOffsetBehavior2() {
}
@Override
public boolean onLayoutChild(@NonNull CoordinatorLayout parent, @NonNull V child, int layoutDirection) {
layoutChild(parent, child, layoutDirection);
assertViewOffsetHelper(child);
viewOffsetHelper.onViewLayout();
viewOffsetHelper.applyOffsets();
if (tempTopBottomOffset != 0) {
viewOffsetHelper.setTopAndBottomOffset(tempTopBottomOffset);
tempTopBottomOffset = 0;
}
if (tempLeftRightOffset != 0) {
viewOffsetHelper.setLeftAndRightOffset(tempLeftRightOffset);
tempLeftRightOffset = 0;
}
return true;
}
private void assertViewOffsetHelper(V child) {
if (viewOffsetHelper == null) {
viewOffsetHelper = new ViewOffsetHelper2(child);
}
}
protected void layoutChild(CoordinatorLayout parent, V child, int layoutDirection) {
parent.onLayoutChild(child, layoutDirection);
}
public boolean setTopAndBottomOffset(int offset) {
if (viewOffsetHelper != null) {
return viewOffsetHelper.setTopAndBottomOffset(offset);
} else {
tempTopBottomOffset = offset;
}
return false;
}
public boolean setLeftAndRightOffset(int offset) {
if (viewOffsetHelper != null) {
return viewOffsetHelper.setLeftAndRightOffset(offset);
} else {
tempLeftRightOffset = offset;
}
return false;
}
public int getTopAndBottomOffset() {
return viewOffsetHelper != null ? viewOffsetHelper.getTopAndBottomOffset() : 0;
}
public int getLeftAndRightOffset() {
return viewOffsetHelper != null ? viewOffsetHelper.getLeftAndRightOffset() : 0;
}
public void setVerticalOffsetEnabled(boolean verticalOffsetEnabled) {
if (viewOffsetHelper != null) {
viewOffsetHelper.setVerticalOffsetEnabled(verticalOffsetEnabled);
}
}
public boolean isVerticalOffsetEnabled() {
return viewOffsetHelper != null && viewOffsetHelper.isVerticalOffsetEnabled();
}
public void setHorizontalOffsetEnabled(boolean horizontalOffsetEnabled) {
if (viewOffsetHelper != null) {
viewOffsetHelper.setHorizontalOffsetEnabled(horizontalOffsetEnabled);
}
}
public boolean isHorizontalOffsetEnabled() {
return viewOffsetHelper != null && viewOffsetHelper.isHorizontalOffsetEnabled();
}
} | 2,901 | 0.680455 | 0.676319 | 92 | 30.543478 | 28.958145 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.402174 | false | false | 3 |
e8e546428ca7c06093c2c668be5bebf796529a39 | 28,406,913,738,503 | 53cd17335acd46689f82db973d6454187a93ec82 | /Pen.java | 228a439045a7d0d9b548b80fbc2ba0ac5279a2fc | [] | no_license | kdy915/javaStart | https://github.com/kdy915/javaStart | ff55644805d8b4a0bca2b431044f8da93db7ad81 | 6513cc5f5afb4387d11089c941c32cc27e52b10c | refs/heads/master | 2023-08-16T14:06:02.659000 | 2021-10-20T05:00:13 | 2021-10-20T05:00:13 | 419,188,334 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class Pen {
String color = "black"; // member variable, instance variable
double width = 1;
static int temp; //member variable, static variable, class variable
// public Pen() {
// super(); //생략 가능
// } // 기본 생성자, 클래스에 생성자가 없을 경우 컴파일러가 추가해 주는 생성자
// 생성자는 객체의 맴버(변수)를 초기화 하기 위해 사용
public Pen(String color) {
this.color = color; // this.는 매개변수와 맴버변수와 이름이 같아도 구분 할수가 있다.
}
//Overloading 생성자를 중복되서 여러개 생성하는 것
public Pen(double width) {
this.width = width;
}
public Pen(String init_color, double init_width) {
color = init_color;
width = init_width;
}
public Pen(double init_width, String init_color) {
this(init_color,init_width);
// color = init_color;
// width = init_width;
}
void write(String message) { //message도 local variable, parameter variable(매개변수)
int a = 5;
int width = 30;
for(int i=0;i<a;i++) {
System.out.printf("%s색, %f 굵기로 %s를 씁니다 \n",color,this.width,message);
} // 객체의 속성은 행위에 영향을 준다.
}
}
| UTF-8 | Java | 1,299 | java | Pen.java | Java | [] | null | [] |
public class Pen {
String color = "black"; // member variable, instance variable
double width = 1;
static int temp; //member variable, static variable, class variable
// public Pen() {
// super(); //생략 가능
// } // 기본 생성자, 클래스에 생성자가 없을 경우 컴파일러가 추가해 주는 생성자
// 생성자는 객체의 맴버(변수)를 초기화 하기 위해 사용
public Pen(String color) {
this.color = color; // this.는 매개변수와 맴버변수와 이름이 같아도 구분 할수가 있다.
}
//Overloading 생성자를 중복되서 여러개 생성하는 것
public Pen(double width) {
this.width = width;
}
public Pen(String init_color, double init_width) {
color = init_color;
width = init_width;
}
public Pen(double init_width, String init_color) {
this(init_color,init_width);
// color = init_color;
// width = init_width;
}
void write(String message) { //message도 local variable, parameter variable(매개변수)
int a = 5;
int width = 30;
for(int i=0;i<a;i++) {
System.out.printf("%s색, %f 굵기로 %s를 씁니다 \n",color,this.width,message);
} // 객체의 속성은 행위에 영향을 준다.
}
}
| 1,299 | 0.593365 | 0.588626 | 41 | 23.634146 | 22.757208 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.902439 | false | false | 3 |
4b50923ceb497bda7144b4f955edb9edf537df74 | 24,300,924,997,695 | 23ac318b6141f541af43ba85dfde2855033caa7f | /Stacks/src/BracketTesting.java | 179e172b8d0b18e686e2f74764bbcb4485953910 | [] | no_license | uxeyali/DataStructures | https://github.com/uxeyali/DataStructures | df73f068daf52090b4b7a002c8fd0b20e67d61eb | 674f27983b5c7e05175d5b02755d5010146e76ce | refs/heads/master | 2020-03-23T23:12:02.272000 | 2018-07-24T23:07:22 | 2018-07-24T23:07:22 | 142,221,433 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.Scanner;
public class BracketTesting {
static NPSStack <String> curlyBracket = new NPSArrayStack <String>();
static NPSStack <String> squareBracket = new NPSArrayStack <String>();
static NPSStack <String> parenthesis = new NPSArrayStack <String>();
public static void main(String[] args) {
@SuppressWarnings("resource")
Scanner scanner = new Scanner (System.in);
String string = scanner.nextLine();
int dontMatchCurly = 0;
int dontMatchParenthesis = 0;
int dontMatchSquare =0;
for (int i = 0; i < string.length(); i++){
char chara = string.charAt(i);
//case 1 Curly brackets - using ASCII codes 123 for { and 125 for }
if((chara != 123)&& (chara!=125)){
} else {
if(chara == 123){
curlyBracket.push("A");
}
if((chara == 125) && (curlyBracket.isEmpty())){
System.out.println("Incorrect Order of Curly Bracket");
dontMatchCurly++;
}
if((chara == 125) && !(curlyBracket.isEmpty())){
curlyBracket.pop();
}
}
//case 2 Parenthesis - using ASCII codes 40 for ( and 41 for )
if((chara != 40 )&& (chara!=41)){
} else {
if(chara == 40){
parenthesis.push("A");
}
if((chara == 41) && (parenthesis.isEmpty())){
System.out.println("Incorrect Order of Parenthesis");
dontMatchParenthesis++;
}
if((chara == 41) && !(parenthesis.isEmpty())){
parenthesis.pop();
}
}
//case 3 Square Brackets - using ASCII codes 91 for [ and 93 for ]
if((chara != 91 )&& (chara != 93)){
} else {
if(chara == 91){
squareBracket.push("A");
}
if((chara == 93) && (squareBracket.isEmpty())){
System.out.println("Incorrect Order of Square Brackets\n");
dontMatchSquare++;
}
if((chara == 93) && !(squareBracket.isEmpty())){
squareBracket.pop();
}
}
}
if(dontMatchCurly == 0 && (curlyBracket.isEmpty()) ){
System.out.println("Curly Braces match");
} else {
System.out.println("Curly Braces are not matched");
}
if(dontMatchParenthesis == 0 && (parenthesis.isEmpty()) ){
System.out.println("Parenthesis match");
} else {
System.out.println("Parenthesis are not matched");
}
if(dontMatchSquare == 0 && (squareBracket.isEmpty()) ){
System.out.println("Square Brackets match");
} else {
System.out.println("Square Brackets are not matched");
}
}
}
| UTF-8 | Java | 2,484 | java | BracketTesting.java | Java | [] | null | [] | import java.util.Scanner;
public class BracketTesting {
static NPSStack <String> curlyBracket = new NPSArrayStack <String>();
static NPSStack <String> squareBracket = new NPSArrayStack <String>();
static NPSStack <String> parenthesis = new NPSArrayStack <String>();
public static void main(String[] args) {
@SuppressWarnings("resource")
Scanner scanner = new Scanner (System.in);
String string = scanner.nextLine();
int dontMatchCurly = 0;
int dontMatchParenthesis = 0;
int dontMatchSquare =0;
for (int i = 0; i < string.length(); i++){
char chara = string.charAt(i);
//case 1 Curly brackets - using ASCII codes 123 for { and 125 for }
if((chara != 123)&& (chara!=125)){
} else {
if(chara == 123){
curlyBracket.push("A");
}
if((chara == 125) && (curlyBracket.isEmpty())){
System.out.println("Incorrect Order of Curly Bracket");
dontMatchCurly++;
}
if((chara == 125) && !(curlyBracket.isEmpty())){
curlyBracket.pop();
}
}
//case 2 Parenthesis - using ASCII codes 40 for ( and 41 for )
if((chara != 40 )&& (chara!=41)){
} else {
if(chara == 40){
parenthesis.push("A");
}
if((chara == 41) && (parenthesis.isEmpty())){
System.out.println("Incorrect Order of Parenthesis");
dontMatchParenthesis++;
}
if((chara == 41) && !(parenthesis.isEmpty())){
parenthesis.pop();
}
}
//case 3 Square Brackets - using ASCII codes 91 for [ and 93 for ]
if((chara != 91 )&& (chara != 93)){
} else {
if(chara == 91){
squareBracket.push("A");
}
if((chara == 93) && (squareBracket.isEmpty())){
System.out.println("Incorrect Order of Square Brackets\n");
dontMatchSquare++;
}
if((chara == 93) && !(squareBracket.isEmpty())){
squareBracket.pop();
}
}
}
if(dontMatchCurly == 0 && (curlyBracket.isEmpty()) ){
System.out.println("Curly Braces match");
} else {
System.out.println("Curly Braces are not matched");
}
if(dontMatchParenthesis == 0 && (parenthesis.isEmpty()) ){
System.out.println("Parenthesis match");
} else {
System.out.println("Parenthesis are not matched");
}
if(dontMatchSquare == 0 && (squareBracket.isEmpty()) ){
System.out.println("Square Brackets match");
} else {
System.out.println("Square Brackets are not matched");
}
}
}
| 2,484 | 0.584944 | 0.561192 | 112 | 21.178572 | 22.37314 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.196429 | false | false | 3 |
2c4cf4661fcf28a574f452fdb910e3f4dd493faf | 31,456,340,487,779 | 0a0286b69f523cb57dd4947f09c4503032b728fe | /src/test/java/selenium/page/object/NoTrailerVideo.java | 652ce86162a1b01a6f02dfdae1ade848743e4f0a | [] | no_license | yeahay2007/7qiaoWebAutomation | https://github.com/yeahay2007/7qiaoWebAutomation | 53a281ef4ea9d2c61bf382561a074cad741f840a | bcff68ea3e762b58c7057f2d0f8efc3689ad76da | refs/heads/master | 2021-01-11T02:49:14.958000 | 2015-05-15T08:23:10 | 2015-05-15T08:23:10 | 35,662,553 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package selenium.page.object;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.testng.Assert;
import org.testng.annotations.Test;
/*
* This page object is basic on http://192.168.4.10:9090/v/2001212
*/
public class NoTrailerVideo {
WebDriver driver;
WebElement joinCourse;
public WebElement emailInput;
public WebElement passwordInput;
WebElement replyElement;
WebElement loginBtn;
WebElement userName;
public NoTrailerVideo(WebDriver driver) {
this.driver = driver;
}
@Test
public void verifyJoinCourse() {
System.out.println(joinCourse.getText() + " " + "出现");
Assert.assertEquals("加入学习", joinCourse.getText());
}
public WebElement getJoinCourse() {
joinCourse = driver.findElement(By.id("btnStudy"));
return joinCourse;
}
public WebElement getInputEmail() {
// emailInput = driver.findElement(By
// .xpath("//input[@type='text' and @name='email']"));
emailInput = driver.findElement(By.cssSelector("input[type='text'][name='email']"));
return emailInput;
}
public WebElement getInputPassWord() {
passwordInput = driver.findElement(By
.xpath("//input[@type='password' and @name='password']"));
return passwordInput;
}
public WebElement getReply() {
replyElement = driver.findElement(By.xpath("//textarea[@id='commentContent' and @placeholder='请输入内容']"));
return replyElement;
}
public WebElement getLoginBtn(){
loginBtn = driver.findElement(By
.xpath("//a[@class='btn btn-block' and @role='button']"));
return loginBtn;
}
public WebElement getUserName(){
userName = driver.findElement(By.id("comment_userName"));
return userName;
}
}
| UTF-8 | Java | 1,780 | java | NoTrailerVideo.java | Java | [
{
"context": ";\r\n\r\n\r\n/*\r\n * This page object is basic on http://192.168.4.10:9090/v/2001212\r\n */\r\n\r\npublic class NoTrailerVide",
"end": 269,
"score": 0.9977564215660095,
"start": 257,
"tag": "IP_ADDRESS",
"value": "192.168.4.10"
}
] | null | [] | package selenium.page.object;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.testng.Assert;
import org.testng.annotations.Test;
/*
* This page object is basic on http://192.168.4.10:9090/v/2001212
*/
public class NoTrailerVideo {
WebDriver driver;
WebElement joinCourse;
public WebElement emailInput;
public WebElement passwordInput;
WebElement replyElement;
WebElement loginBtn;
WebElement userName;
public NoTrailerVideo(WebDriver driver) {
this.driver = driver;
}
@Test
public void verifyJoinCourse() {
System.out.println(joinCourse.getText() + " " + "出现");
Assert.assertEquals("加入学习", joinCourse.getText());
}
public WebElement getJoinCourse() {
joinCourse = driver.findElement(By.id("btnStudy"));
return joinCourse;
}
public WebElement getInputEmail() {
// emailInput = driver.findElement(By
// .xpath("//input[@type='text' and @name='email']"));
emailInput = driver.findElement(By.cssSelector("input[type='text'][name='email']"));
return emailInput;
}
public WebElement getInputPassWord() {
passwordInput = driver.findElement(By
.xpath("//input[@type='password' and @name='password']"));
return passwordInput;
}
public WebElement getReply() {
replyElement = driver.findElement(By.xpath("//textarea[@id='commentContent' and @placeholder='请输入内容']"));
return replyElement;
}
public WebElement getLoginBtn(){
loginBtn = driver.findElement(By
.xpath("//a[@class='btn btn-block' and @role='button']"));
return loginBtn;
}
public WebElement getUserName(){
userName = driver.findElement(By.id("comment_userName"));
return userName;
}
}
| 1,780 | 0.694539 | 0.683163 | 68 | 23.852942 | 23.159464 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.470588 | false | false | 3 |
e4d643294d34d5fe1246134b610f7673d5f8f4c3 | 8,821,862,878,955 | 25afc9f980bde22db955bbf485e1c20810053223 | /source code/com/mintegral/adapter/interstitial/interstitialadapter/MintegralInterstitialAdapter.java | a2079c3fe0a39b7b48341076f4839c38c50e8ac6 | [] | no_license | NirvanaNimbusa/mintegral_mopub_adapter_android | https://github.com/NirvanaNimbusa/mintegral_mopub_adapter_android | 7e060c4cb4e2b980587272a43ab5fc3731364baf | bf99bba9333ae6943afa0e11a300dee81ef01424 | refs/heads/master | 2022-12-17T01:31:09.578000 | 2020-09-04T14:49:36 | 2020-09-04T14:49:36 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.mintegral.adapter.interstitial.interstitialadapter;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.util.Log;
import com.mintegral.adapter.common.AdapterCommonUtil;
import com.mintegral.adapter.common.AdapterTools;
import com.mintegral.adapter.common.MIntegralSDKManager;
import com.mintegral.msdk.MIntegralConstans;
import com.mintegral.msdk.MIntegralSDK;
import com.mintegral.msdk.out.InterstitialListener;
import com.mintegral.msdk.out.MIntegralSDKFactory;
import com.mintegral.msdk.out.MTGInterstitialHandler;
import com.mopub.mobileads.CustomEventInterstitial;
import com.mopub.mobileads.MoPubErrorCode;
import java.util.HashMap;
import java.util.Map;
/**
* Created by songjunjun on 17/8/31.
*/
public class MintegralInterstitialAdapter extends CustomEventInterstitial implements InterstitialListener {
MTGInterstitialHandler mInterstitialHandler;
CustomEventInterstitialListener mCustomEventInterstitialListener;
private String appid = "";
private String appkey = "";
private String unitId = "";
@Override
protected void loadInterstitial(Context mContext, CustomEventInterstitialListener customEventInterstitialListener, Map<String, Object> localExtras, Map<String, String> serverExtras) {
HashMap<String, Object> hashMap = new HashMap<String, Object>();
mCustomEventInterstitialListener = customEventInterstitialListener;
try {
appid = serverExtras.get("appId");
unitId = serverExtras.get("unitId");
appkey = serverExtras.get("appKey");
AdapterCommonUtil.addChannel();
} catch (Throwable e1) {
e1.printStackTrace();
}
if (!TextUtils.isEmpty(appid) && !TextUtils.isEmpty(appkey) && !TextUtils.isEmpty(unitId)) {
if (!AdapterTools.canCollectPersonalInformation()) {
MIntegralSDKManager.getInstance().getMIntegralSDK().setUserPrivateInfoType(mContext, MIntegralConstans.AUTHORITY_ALL_INFO, MIntegralConstans.IS_SWITCH_OFF);
} else {
MIntegralSDKManager.getInstance().getMIntegralSDK().setUserPrivateInfoType(mContext, MIntegralConstans.AUTHORITY_ALL_INFO, MIntegralConstans.IS_SWITCH_ON);
}
if (mContext instanceof Activity) {
final Context context = ((Activity) mContext).getApplication();
MIntegralSDKManager.getInstance().initialize(context, appkey, appid, false);
} else if (mContext instanceof Application) {
final Context context = mContext;
MIntegralSDKManager.getInstance().initialize(context, appkey, appid, false);
}
AdapterCommonUtil.parseLocalExtras(localExtras, MIntegralSDKManager.getInstance().getMIntegralSDK());
} else {
if (mCustomEventInterstitialListener != null) {
mCustomEventInterstitialListener.onInterstitialFailed(MoPubErrorCode.ADAPTER_CONFIGURATION_ERROR);
}
}
//设置广告位ID 必填
hashMap.put(MIntegralConstans.PROPERTIES_UNIT_ID, unitId);
mInterstitialHandler = new MTGInterstitialHandler(mContext, hashMap);
mInterstitialHandler.setInterstitialListener(this);
mInterstitialHandler.preload();
}
@Override
protected void showInterstitial() {
if (mInterstitialHandler != null) {
mInterstitialHandler.show();
}
}
@Override
protected void onInvalidate() {
Log.e("Mintegral", "onInvalidate");
// mCustomEventInterstitialListener.
}
@Override
public void onInterstitialAdClick() {
if (mCustomEventInterstitialListener != null) {
mCustomEventInterstitialListener.onInterstitialClicked();
mCustomEventInterstitialListener.onLeaveApplication();
}
Log.e("Mintegral", "onInterstitialAdClick");
}
@Override
public void onInterstitialClosed() {
if (mCustomEventInterstitialListener != null) {
mCustomEventInterstitialListener.onInterstitialDismissed();
}
Log.e("Mintegral", "onInterstitialClosed");
}
@Override
public void onInterstitialLoadFail(String s) {
if (mCustomEventInterstitialListener != null) {
mCustomEventInterstitialListener.onInterstitialFailed(MoPubErrorCode.UNSPECIFIED);
}
Log.e("Mintegral", "onInterstitialLoadFail");
}
@Override
public void onInterstitialLoadSuccess() {
if (mCustomEventInterstitialListener != null) {
mCustomEventInterstitialListener.onInterstitialLoaded();
}
Log.e("Mintegral", "onInterstitialLoadSuccess");
}
@Override
public void onInterstitialShowFail(String s) {
Log.e("Mintegral", "onInterstitialShowFail");
}
@Override
public void onInterstitialShowSuccess() {
if (mCustomEventInterstitialListener != null) {
mCustomEventInterstitialListener.onInterstitialShown();
}
Log.e("Mintegral", "onInterstitialShowSuccess");
}
}
| UTF-8 | Java | 5,227 | java | MintegralInterstitialAdapter.java | Java | [
{
"context": ".HashMap;\nimport java.util.Map;\n\n/**\n * Created by songjunjun on 17/8/31.\n */\n\npublic class MintegralInterstiti",
"end": 846,
"score": 0.9936091303825378,
"start": 836,
"tag": "USERNAME",
"value": "songjunjun"
}
] | null | [] | package com.mintegral.adapter.interstitial.interstitialadapter;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.util.Log;
import com.mintegral.adapter.common.AdapterCommonUtil;
import com.mintegral.adapter.common.AdapterTools;
import com.mintegral.adapter.common.MIntegralSDKManager;
import com.mintegral.msdk.MIntegralConstans;
import com.mintegral.msdk.MIntegralSDK;
import com.mintegral.msdk.out.InterstitialListener;
import com.mintegral.msdk.out.MIntegralSDKFactory;
import com.mintegral.msdk.out.MTGInterstitialHandler;
import com.mopub.mobileads.CustomEventInterstitial;
import com.mopub.mobileads.MoPubErrorCode;
import java.util.HashMap;
import java.util.Map;
/**
* Created by songjunjun on 17/8/31.
*/
public class MintegralInterstitialAdapter extends CustomEventInterstitial implements InterstitialListener {
MTGInterstitialHandler mInterstitialHandler;
CustomEventInterstitialListener mCustomEventInterstitialListener;
private String appid = "";
private String appkey = "";
private String unitId = "";
@Override
protected void loadInterstitial(Context mContext, CustomEventInterstitialListener customEventInterstitialListener, Map<String, Object> localExtras, Map<String, String> serverExtras) {
HashMap<String, Object> hashMap = new HashMap<String, Object>();
mCustomEventInterstitialListener = customEventInterstitialListener;
try {
appid = serverExtras.get("appId");
unitId = serverExtras.get("unitId");
appkey = serverExtras.get("appKey");
AdapterCommonUtil.addChannel();
} catch (Throwable e1) {
e1.printStackTrace();
}
if (!TextUtils.isEmpty(appid) && !TextUtils.isEmpty(appkey) && !TextUtils.isEmpty(unitId)) {
if (!AdapterTools.canCollectPersonalInformation()) {
MIntegralSDKManager.getInstance().getMIntegralSDK().setUserPrivateInfoType(mContext, MIntegralConstans.AUTHORITY_ALL_INFO, MIntegralConstans.IS_SWITCH_OFF);
} else {
MIntegralSDKManager.getInstance().getMIntegralSDK().setUserPrivateInfoType(mContext, MIntegralConstans.AUTHORITY_ALL_INFO, MIntegralConstans.IS_SWITCH_ON);
}
if (mContext instanceof Activity) {
final Context context = ((Activity) mContext).getApplication();
MIntegralSDKManager.getInstance().initialize(context, appkey, appid, false);
} else if (mContext instanceof Application) {
final Context context = mContext;
MIntegralSDKManager.getInstance().initialize(context, appkey, appid, false);
}
AdapterCommonUtil.parseLocalExtras(localExtras, MIntegralSDKManager.getInstance().getMIntegralSDK());
} else {
if (mCustomEventInterstitialListener != null) {
mCustomEventInterstitialListener.onInterstitialFailed(MoPubErrorCode.ADAPTER_CONFIGURATION_ERROR);
}
}
//设置广告位ID 必填
hashMap.put(MIntegralConstans.PROPERTIES_UNIT_ID, unitId);
mInterstitialHandler = new MTGInterstitialHandler(mContext, hashMap);
mInterstitialHandler.setInterstitialListener(this);
mInterstitialHandler.preload();
}
@Override
protected void showInterstitial() {
if (mInterstitialHandler != null) {
mInterstitialHandler.show();
}
}
@Override
protected void onInvalidate() {
Log.e("Mintegral", "onInvalidate");
// mCustomEventInterstitialListener.
}
@Override
public void onInterstitialAdClick() {
if (mCustomEventInterstitialListener != null) {
mCustomEventInterstitialListener.onInterstitialClicked();
mCustomEventInterstitialListener.onLeaveApplication();
}
Log.e("Mintegral", "onInterstitialAdClick");
}
@Override
public void onInterstitialClosed() {
if (mCustomEventInterstitialListener != null) {
mCustomEventInterstitialListener.onInterstitialDismissed();
}
Log.e("Mintegral", "onInterstitialClosed");
}
@Override
public void onInterstitialLoadFail(String s) {
if (mCustomEventInterstitialListener != null) {
mCustomEventInterstitialListener.onInterstitialFailed(MoPubErrorCode.UNSPECIFIED);
}
Log.e("Mintegral", "onInterstitialLoadFail");
}
@Override
public void onInterstitialLoadSuccess() {
if (mCustomEventInterstitialListener != null) {
mCustomEventInterstitialListener.onInterstitialLoaded();
}
Log.e("Mintegral", "onInterstitialLoadSuccess");
}
@Override
public void onInterstitialShowFail(String s) {
Log.e("Mintegral", "onInterstitialShowFail");
}
@Override
public void onInterstitialShowSuccess() {
if (mCustomEventInterstitialListener != null) {
mCustomEventInterstitialListener.onInterstitialShown();
}
Log.e("Mintegral", "onInterstitialShowSuccess");
}
}
| 5,227 | 0.698254 | 0.696912 | 140 | 36.235714 | 34.769981 | 187 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.607143 | false | false | 3 |
2f00e81fc7e45473dc3ac0731d3e9256bd839874 | 4,638,564,695,328 | bcaca64cababbec91f48a52101a9ea285b075b44 | /gogishvili/classes/Person.java | 83d4bd82f0234d94f0dd7830329c0794eeccbe5d | [] | no_license | paatagog/SANGU1 | https://github.com/paatagog/SANGU1 | 6975fcfc7a324945262cea234975e08281d5f21d | dcaabc24f52028a8718000e92cc9096e2c567947 | refs/heads/master | 2016-09-06T04:41:07.249000 | 2014-09-26T08:17:16 | 2014-09-26T08:17:16 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package gogishvili.classes;
import java.util.Date;
public class Person {
protected String firstName;
protected String lastName;
protected String personalNumber;
protected Date birthDate;
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getPersonalNumber() {
return personalNumber;
}
public void setPersonalNumber(String personalNumber) {
this.personalNumber = personalNumber;
}
public Date getBirthDate() {
return birthDate;
}
public void setBirthDate(Date birthDate) {
this.birthDate = birthDate;
}
}
| UTF-8 | Java | 768 | java | Person.java | Java | [] | null | [] | package gogishvili.classes;
import java.util.Date;
public class Person {
protected String firstName;
protected String lastName;
protected String personalNumber;
protected Date birthDate;
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getPersonalNumber() {
return personalNumber;
}
public void setPersonalNumber(String personalNumber) {
this.personalNumber = personalNumber;
}
public Date getBirthDate() {
return birthDate;
}
public void setBirthDate(Date birthDate) {
this.birthDate = birthDate;
}
}
| 768 | 0.740885 | 0.740885 | 47 | 15.340425 | 16.116962 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.148936 | false | false | 3 |
127f4439c9dde4dfc34fc94f975a0e918f0dee5f | 6,897,717,478,269 | caa339f3257aafcc4109e28d70058560b992cd2d | /spring-boot-demo-dynamic-datasource/src/main/java/com/halen/dynamic/mapper/UserMapper.java | 55eb7e66cef7f4c917f85593c58ebebb6aa89838 | [] | no_license | jackzoon/spring-boot-demo | https://github.com/jackzoon/spring-boot-demo | db7108d0d5f3c1f08e8b90992946e4316954e0f6 | 886c6d5efead17c3d47f11e52478019672699448 | refs/heads/master | 2023-02-23T03:51:26.961000 | 2021-01-24T06:58:22 | 2021-01-24T06:58:22 | 289,448,215 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.halen.dynamic.mapper;
import com.halen.dynamic.config.MyMapper;
import com.halen.dynamic.model.User;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface UserMapper extends MyMapper<User> {
}
| UTF-8 | Java | 223 | java | UserMapper.java | Java | [] | null | [] | package com.halen.dynamic.mapper;
import com.halen.dynamic.config.MyMapper;
import com.halen.dynamic.model.User;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface UserMapper extends MyMapper<User> {
}
| 223 | 0.811659 | 0.811659 | 9 | 23.777779 | 20.186783 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false | 3 |
4521c5fa206dd864686e8de834194057939fe141 | 11,235,634,480,678 | 2bc4f180e50c9866fe563f755ee45f1428247258 | /src/main/java/frontend/FrontendImpl.java | 1bb5c3ea7f74202fddd46f885accbbeb938d87d7 | [] | no_license | Technopark/GameServerJavaQA | https://github.com/Technopark/GameServerJavaQA | f9e92a735978b310ca08814a28eb65b27819d019 | a30bfb1ba1ce0cdbe73dfe518088e87964bb7989 | refs/heads/master | 2021-01-01T05:53:26.486000 | 2014-03-15T15:23:54 | 2014-03-15T15:23:54 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package frontend;
import base.Address;
import base.Frontend;
import base.MessageSystem;
import base.Msg;
import databaseService.DatabaseServiceImpl;
import gameMechanics.GameMechanicImpl;
import gameMechanics.MsgSetGamerNames;
import gameMechanics.MsgUpdateClicks;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.handler.AbstractHandler;
import resourceSystem.GameSessionResource;
import utils.PageGenerator;
import utils.TimeHelper;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
public class FrontendImpl extends AbstractHandler implements Runnable, Frontend {
private static final String URL_GET_PARAM_NAME = "userName";
private static final String URL_GET_PARAM_ID = "sessionId";
private static final String HELLO = "Hello, gamer.";
private static final String YOUR_ID = " Your id : ";
private static final String TAG = "<h1>";
private static final String FIRST_VISIT = "You came here for the first time";
private static final String LAST_VISIT = "Last visit";
private static final String DATE_TEMPLATE = "dd-MM-yyyy hh:mm:ss";
private static final String TOP_RESULT = "Your best result : ";
private static final String CLICKS = "clicks.";
private static final String WAIT = "Wait authentication.";
private static final String GAME_IS_STARTED = "Game is started";
private static final String TOTAL_RESULT = "Your result";
private static final String ENEMY = "Your enemy with number : ";
private static final String DOING = " doing ";
private final static AtomicInteger sessionIdGenerator = new AtomicInteger();
private final Map<Integer, UserSession> userSessions = new HashMap<>();
private Address address;
private MessageSystem ms;
private Integer userId;
private UserSession userSession;
private GameSessionResource resource;
private boolean isGameProcessed;
private boolean isGameFinished;
public FrontendImpl(MessageSystem ms, GameSessionResource resource) throws IOException {
this.ms = ms;
this.resource = resource;
address = new Address();
ms.addService(this);
}
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
response.setContentType("text/html;charset=utf-8");
response.setStatus(HttpServletResponse.SC_OK);
baseRequest.setHandled(true);
PageGenerator pg = new PageGenerator();
final int sessionId = sessionIdGenerator.incrementAndGet();
pg.refreshHtmlPage(sessionId);
response.getWriter().print(pg.getPage());
final String name = request.getParameter(URL_GET_PARAM_NAME);
final Integer id = request.getParameter(URL_GET_PARAM_ID) != null
? Integer.valueOf(request.getParameter(URL_GET_PARAM_ID))
: null;
UserSession session = userSessions.get(id);
if (name != null && !name.isEmpty() && session == null) {
session = new UserSession(id);
userSession = session;
userSession.setUserName(name);
userSessions.put(userSession.hashCode(), userSession);
}
if (id != null && name != null && !name.isEmpty()) {
UserSession newSession = userSessions.get(Integer.valueOf(id));
userId = newSession.getUserId();
}
if (userId != null) {
PrintWriter writer = response.getWriter();
UserSession us = userSessions.get(Integer.valueOf(request.getParameter(URL_GET_PARAM_ID)));
writer.print(TAG + HELLO + us.getUserName() + YOUR_ID +
+userId + TAG);
if (us.getLastVisit() == null) {
writer.print(FIRST_VISIT);
} else {
Date date = us.getLastVisit().getTime();
writer.print(TAG + LAST_VISIT + TAG + createFormattedDate(date));
writer.print(TAG + TOP_RESULT + us.getBestCountClicks() + CLICKS + TAG);
}
userId = null;
} else {
if (name == null || name.isEmpty() && isGameFinished) {
return;
}
if (!isGameFinished) {
PrintWriter writer = response.getWriter();
writer.print(TAG + WAIT + TAG);
if (session.isInProgress()) {
session.setInProgress(true);
Address address = getAddress();
Address to = ms.getAddressService().getAddress(DatabaseServiceImpl.class);
final int hashCode = userSession.hashCode();
Msg msg = new MsgGetUserId(address, to, name, hashCode);
ms.sendMessage(msg);
}
}
}
if (isAuthenticatedTwoUsers()){
Address addr = getAddress();
Address to = ms.getAddressService().getAddress(GameMechanicImpl.class);
Collection<UserSession> sessions = userSessions.values();
Msg msg = new MsgSetGamerNames(addr, to, sessions);
ms.sendMessage(msg);
}
onStart(request, response);
if (session.getUserId() != null) {
onHandle(request, response);
}
onStop(request, response);
}
private static String createFormattedDate(Date date){
return new SimpleDateFormat(DATE_TEMPLATE).format(date);
}
public void run() {
while (true) {
ms.execForAbonent(this);
TimeHelper.sleep(100);
}
}
public Address getAddress() {
return address;
}
public MessageSystem getMessageSystem() {
return ms;
}
public void updateUserId(int sessionId, int userId, int clickTopResult, Calendar lastVisitDate) {
userSessions.get(sessionId).setUserId(userId);
userSessions.get(sessionId).setLastVisit(lastVisitDate);
userSessions.get(sessionId).setBestCountClicks(clickTopResult);
}
public boolean isAuthenticatedTwoUsers() {
if (isGameProcessed || isGameFinished){
return false;
}
if (userSessions.size() < resource.getCountGamers()) {
return false;
}
for (UserSession userSession : userSessions.values()) {
if (userSession.getUserId() == null) {
return false;
}
}
return true;
}
public void onHandle(HttpServletRequest request, HttpServletResponse response) {
if (isGameFinished){
return;
}
final int clicks = request.getParameter("param") != null
? Integer.valueOf(request.getParameter("param"))
: -1;
final int id = Integer.valueOf(request.getParameter("sessionId"));
UserSession session = userSessions.get(id);
if (clicks > session.getClicks()) {
session.setClicks(clicks);
Address to = ms.getAddressService().getAddress(GameMechanicImpl.class);
final int userId = session.getUserId();
Msg msg = new MsgUpdateClicks(this.address, to, userId, clicks);
ms.sendMessage(msg);
}
}
public void onStop(HttpServletRequest request, HttpServletResponse response) throws IOException {
final int id = Integer.valueOf(request.getParameter("sessionId"));
UserSession session = userSessions.get(id);
if ((isGameProcessed && session.isWinner()) && !isGameFinished){
return;
}
PrintWriter printWriter = response.getWriter();
printWriter.println(TOTAL_RESULT + session.getClicks());
for (UserSession each : userSessions.values()) {
if (each.hashCode() != Integer.valueOf(id)){
printWriter.println(TAG + TAG);
printWriter.println(ENEMY + each.getUserId()
+ " " + each.getUserName() +
DOING + each.getClicks() + CLICKS);
}
}
if (session.getVictoryMsg() != null) {
printWriter.println(TAG + TAG);
printWriter.println(session.getVictoryMsg());
}
}
public void setResult(Integer userId, int count, String victoryMessage) {
if (!isGameProcessed) return;
for (UserSession userSession : userSessions.values()) {
if (userSession.getUserId() == userId) {
userSession.setVictoryMsg(victoryMessage);
userSession.setWinner(true);
}
}
isGameFinished = true;
}
public void onStart(HttpServletRequest request, HttpServletResponse response) throws IOException {
if (isGameFinished){
return;
}
String id = request.getParameter(URL_GET_PARAM_ID);
UserSession session = userSessions.get(String.valueOf(id));
if (isGameProcessed() && !session.isWinner()){
response.getWriter().print(GAME_IS_STARTED);
}else{
return;
}
}
public boolean isGameProcessed() {
return this.isGameProcessed;
}
public void setIsGameProcessed(boolean gameActivity) {
this.isGameProcessed = gameActivity;
}
public Map<Integer, UserSession> getUserSessions() {
return userSessions;
}
} | UTF-8 | Java | 9,859 | java | FrontendImpl.java | Java | [
{
"context": "private static final String URL_GET_PARAM_NAME = \"userName\";\r\n private static final String URL_GET_PARAM_",
"end": 929,
"score": 0.9250271916389465,
"start": 921,
"tag": "USERNAME",
"value": "userName"
},
{
"context": "n = session;\r\n userSession.setU... | null | [] | package frontend;
import base.Address;
import base.Frontend;
import base.MessageSystem;
import base.Msg;
import databaseService.DatabaseServiceImpl;
import gameMechanics.GameMechanicImpl;
import gameMechanics.MsgSetGamerNames;
import gameMechanics.MsgUpdateClicks;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.handler.AbstractHandler;
import resourceSystem.GameSessionResource;
import utils.PageGenerator;
import utils.TimeHelper;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
public class FrontendImpl extends AbstractHandler implements Runnable, Frontend {
private static final String URL_GET_PARAM_NAME = "userName";
private static final String URL_GET_PARAM_ID = "sessionId";
private static final String HELLO = "Hello, gamer.";
private static final String YOUR_ID = " Your id : ";
private static final String TAG = "<h1>";
private static final String FIRST_VISIT = "You came here for the first time";
private static final String LAST_VISIT = "Last visit";
private static final String DATE_TEMPLATE = "dd-MM-yyyy hh:mm:ss";
private static final String TOP_RESULT = "Your best result : ";
private static final String CLICKS = "clicks.";
private static final String WAIT = "Wait authentication.";
private static final String GAME_IS_STARTED = "Game is started";
private static final String TOTAL_RESULT = "Your result";
private static final String ENEMY = "Your enemy with number : ";
private static final String DOING = " doing ";
private final static AtomicInteger sessionIdGenerator = new AtomicInteger();
private final Map<Integer, UserSession> userSessions = new HashMap<>();
private Address address;
private MessageSystem ms;
private Integer userId;
private UserSession userSession;
private GameSessionResource resource;
private boolean isGameProcessed;
private boolean isGameFinished;
public FrontendImpl(MessageSystem ms, GameSessionResource resource) throws IOException {
this.ms = ms;
this.resource = resource;
address = new Address();
ms.addService(this);
}
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
response.setContentType("text/html;charset=utf-8");
response.setStatus(HttpServletResponse.SC_OK);
baseRequest.setHandled(true);
PageGenerator pg = new PageGenerator();
final int sessionId = sessionIdGenerator.incrementAndGet();
pg.refreshHtmlPage(sessionId);
response.getWriter().print(pg.getPage());
final String name = request.getParameter(URL_GET_PARAM_NAME);
final Integer id = request.getParameter(URL_GET_PARAM_ID) != null
? Integer.valueOf(request.getParameter(URL_GET_PARAM_ID))
: null;
UserSession session = userSessions.get(id);
if (name != null && !name.isEmpty() && session == null) {
session = new UserSession(id);
userSession = session;
userSession.setUserName(name);
userSessions.put(userSession.hashCode(), userSession);
}
if (id != null && name != null && !name.isEmpty()) {
UserSession newSession = userSessions.get(Integer.valueOf(id));
userId = newSession.getUserId();
}
if (userId != null) {
PrintWriter writer = response.getWriter();
UserSession us = userSessions.get(Integer.valueOf(request.getParameter(URL_GET_PARAM_ID)));
writer.print(TAG + HELLO + us.getUserName() + YOUR_ID +
+userId + TAG);
if (us.getLastVisit() == null) {
writer.print(FIRST_VISIT);
} else {
Date date = us.getLastVisit().getTime();
writer.print(TAG + LAST_VISIT + TAG + createFormattedDate(date));
writer.print(TAG + TOP_RESULT + us.getBestCountClicks() + CLICKS + TAG);
}
userId = null;
} else {
if (name == null || name.isEmpty() && isGameFinished) {
return;
}
if (!isGameFinished) {
PrintWriter writer = response.getWriter();
writer.print(TAG + WAIT + TAG);
if (session.isInProgress()) {
session.setInProgress(true);
Address address = getAddress();
Address to = ms.getAddressService().getAddress(DatabaseServiceImpl.class);
final int hashCode = userSession.hashCode();
Msg msg = new MsgGetUserId(address, to, name, hashCode);
ms.sendMessage(msg);
}
}
}
if (isAuthenticatedTwoUsers()){
Address addr = getAddress();
Address to = ms.getAddressService().getAddress(GameMechanicImpl.class);
Collection<UserSession> sessions = userSessions.values();
Msg msg = new MsgSetGamerNames(addr, to, sessions);
ms.sendMessage(msg);
}
onStart(request, response);
if (session.getUserId() != null) {
onHandle(request, response);
}
onStop(request, response);
}
private static String createFormattedDate(Date date){
return new SimpleDateFormat(DATE_TEMPLATE).format(date);
}
public void run() {
while (true) {
ms.execForAbonent(this);
TimeHelper.sleep(100);
}
}
public Address getAddress() {
return address;
}
public MessageSystem getMessageSystem() {
return ms;
}
public void updateUserId(int sessionId, int userId, int clickTopResult, Calendar lastVisitDate) {
userSessions.get(sessionId).setUserId(userId);
userSessions.get(sessionId).setLastVisit(lastVisitDate);
userSessions.get(sessionId).setBestCountClicks(clickTopResult);
}
public boolean isAuthenticatedTwoUsers() {
if (isGameProcessed || isGameFinished){
return false;
}
if (userSessions.size() < resource.getCountGamers()) {
return false;
}
for (UserSession userSession : userSessions.values()) {
if (userSession.getUserId() == null) {
return false;
}
}
return true;
}
public void onHandle(HttpServletRequest request, HttpServletResponse response) {
if (isGameFinished){
return;
}
final int clicks = request.getParameter("param") != null
? Integer.valueOf(request.getParameter("param"))
: -1;
final int id = Integer.valueOf(request.getParameter("sessionId"));
UserSession session = userSessions.get(id);
if (clicks > session.getClicks()) {
session.setClicks(clicks);
Address to = ms.getAddressService().getAddress(GameMechanicImpl.class);
final int userId = session.getUserId();
Msg msg = new MsgUpdateClicks(this.address, to, userId, clicks);
ms.sendMessage(msg);
}
}
public void onStop(HttpServletRequest request, HttpServletResponse response) throws IOException {
final int id = Integer.valueOf(request.getParameter("sessionId"));
UserSession session = userSessions.get(id);
if ((isGameProcessed && session.isWinner()) && !isGameFinished){
return;
}
PrintWriter printWriter = response.getWriter();
printWriter.println(TOTAL_RESULT + session.getClicks());
for (UserSession each : userSessions.values()) {
if (each.hashCode() != Integer.valueOf(id)){
printWriter.println(TAG + TAG);
printWriter.println(ENEMY + each.getUserId()
+ " " + each.getUserName() +
DOING + each.getClicks() + CLICKS);
}
}
if (session.getVictoryMsg() != null) {
printWriter.println(TAG + TAG);
printWriter.println(session.getVictoryMsg());
}
}
public void setResult(Integer userId, int count, String victoryMessage) {
if (!isGameProcessed) return;
for (UserSession userSession : userSessions.values()) {
if (userSession.getUserId() == userId) {
userSession.setVictoryMsg(victoryMessage);
userSession.setWinner(true);
}
}
isGameFinished = true;
}
public void onStart(HttpServletRequest request, HttpServletResponse response) throws IOException {
if (isGameFinished){
return;
}
String id = request.getParameter(URL_GET_PARAM_ID);
UserSession session = userSessions.get(String.valueOf(id));
if (isGameProcessed() && !session.isWinner()){
response.getWriter().print(GAME_IS_STARTED);
}else{
return;
}
}
public boolean isGameProcessed() {
return this.isGameProcessed;
}
public void setIsGameProcessed(boolean gameActivity) {
this.isGameProcessed = gameActivity;
}
public Map<Integer, UserSession> getUserSessions() {
return userSessions;
}
} | 9,859 | 0.608682 | 0.608074 | 257 | 36.369648 | 27.301878 | 155 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.649805 | false | false | 3 |
f33438cb05f022b45e60ceda7e895a68adb1d2ca | 5,007,931,909,480 | 17a96984c4855f8a592bac4a8338e86b641a4b31 | /ENdoSnipeCommon/src/main/java/jp/co/acroquest/endosnipe/common/parser/JavelinLogConstants.java | 21fc039e21ea1fe062c58abcbeaf16ec2b5cd832 | [
"MIT"
] | permissive | endosnipe/ENdoSnipe | https://github.com/endosnipe/ENdoSnipe | 06cae2a9136dfee34b8325e8347926460f2c5861 | 3cea8299c8805ba98637fc3d13d6d14a8ccd3f4c | refs/heads/master | 2017-11-28T08:04:58.811000 | 2016-04-29T06:15:10 | 2016-04-29T06:15:10 | 6,604,158 | 9 | 4 | null | false | 2015-12-28T20:12:17 | 2012-11-08T21:48:54 | 2015-09-29T15:40:43 | 2015-12-28T20:12:17 | 304,172 | 59 | 27 | 53 | Java | null | null | /*******************************************************************************
* ENdoSnipe 5.0 - (https://github.com/endosnipe)
*
* The MIT License (MIT)
*
* Copyright (c) 2012 Acroquest Technology Co.,Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
******************************************************************************/
package jp.co.acroquest.endosnipe.common.parser;
/**
* Javelin ログのための定数インターフェースです。<br />
*
* @author y-komori
*/
public interface JavelinLogConstants
{
/**
* 詳細情報取得キー:ThreadMXBean#getCurrentThreadCpuTimeパラメータ
* 現在のスレッドの合計 CPU 時間をナノ秒単位で返します。
*/
String JMXPARAM_THREAD_CURRENT_THREAD_CPU_TIME = "thread.currentThreadCpuTime";
/**
* 詳細情報取得キー:ThreadMXBean#getCurrentThreadCpuTimeパラメータの差分
* 現在のスレッドの合計 CPU 時間の差分をナノ秒単位で返します。
*/
String JMXPARAM_THREAD_CURRENT_THREAD_CPU_TIME_DELTA = "thread.currentThreadCpuTime.delta";
/**
* 詳細情報取得キー:ThreadMXBean#getCurrentThreadUserTimeパラメータ
* 現在のスレッドがユーザモードで実行した CPU 時間 (ナノ秒単位) を返します。
*/
String JMXPARAM_THREAD_CURRENT_THREAD_USER_TIME = "thread.currentThreadUserTime";
/**
* 詳細情報取得キー:ThreadMXBean#getCurrentThreadUserTimeパラメータの差分
* 現在のスレッドがユーザモードで実行した CPU 時間 (ナノ秒単位) の差分を返します。
*/
String JMXPARAM_THREAD_CURRENT_THREAD_USER_TIME_DELTA = "thread.currentThreadUserTime.delta";
/**
* 詳細情報取得キー:ThreadMXBean#getThreadInfo#getBlockedCountパラメータ
* この ThreadInfo に関連するスレッドが、モニターに入るか、再入するのをブロックした合計回数を返します。
*/
String JMXPARAM_THREAD_THREADINFO_BLOCKED_COUNT = "thread.threadInfo.blockedCount";
/**
* 詳細情報取得キー:ThreadMXBean#getThreadInfo#getBlockedCountパラメータの差分
* この ThreadInfo に関連するスレッドが、モニターに入るか、再入するのをブロックした合計回数の差分を返します。
*/
String JMXPARAM_THREAD_THREADINFO_BLOCKED_COUNT_DELTA = "thread.threadInfo.blockedCount.delta";
/**
* 詳細情報取得キー:ThreadMXBean#getThreadInfo#getBlockedTimeパラメータ
* スレッドコンテンション監視が有効になってから、この ThreadInfo に関連するスレッドがモニターに入るか
* 再入するのをブロックしたおよその累積経過時間 (ミリ秒単位) を返します。
*/
String JMXPARAM_THREAD_THREADINFO_BLOCKED_TIME = "thread.threadInfo.blockedTime";
/**
* 詳細情報取得キー:ThreadMXBean#getThreadInfo#getBlockedTimeパラメータの差分
* スレッドコンテンション監視が有効になってから、この ThreadInfo に関連するスレッドがモニターに入るか
* 再入するのをブロックしたおよその累積経過時間 (ミリ秒単位) の差分を返します。
*/
String JMXPARAM_THREAD_THREADINFO_BLOCKED_TIME_DELTA = "thread.threadInfo.blockedTime.delta";
/**
* 詳細情報取得キー:ThreadMXBean#getThreadInfo#getWaitedCountパラメータ
* この ThreadInfo に関連するスレッドが通知を待機した合計回数を返します。
*/
String JMXPARAM_THREAD_THREADINFO_WAITED_COUNT = "thread.threadInfo.waitedCount";
/**
* 詳細情報取得キー:ThreadMXBean#getThreadInfo#getWaitedCountパラメータの差分
* この ThreadInfo に関連するスレッドが通知を待機した合計回数の差分を返します。
*/
String JMXPARAM_THREAD_THREADINFO_WAITED_COUNT_DELTA = "thread.threadInfo.waitedCount.delta";
/**
* 詳細情報取得キー:ThreadMXBean#getThreadInfo#getWaitedTimeパラメータ
* スレッドコンテンション監視が有効になってから、この ThreadInfo に関連するスレッドが通知を待機した
* およその累積経過時間 (ミリ秒単位) を返します。
*/
String JMXPARAM_THREAD_THREADINFO_WAITED_TIME = "thread.threadInfo.waitedTime";
/**
* 詳細情報取得キー:ThreadMXBean#getThreadInfo#getWaitedTimeパラメータの差分
* スレッドコンテンション監視が有効になってから、この ThreadInfo に関連するスレッドが通知を待機した
* およその累積経過時間 (ミリ秒単位) の差分を返します。
*/
String JMXPARAM_THREAD_THREADINFO_WAITED_TIME_DELTA = "thread.threadInfo.waitedTime.delta";
/**
* 詳細情報取得キー:GarbageCollectorMXBean#getCollectionCountパラメータ
*発生したコレクションの合計数を返します。
*/
String JMXPARAM_GARBAGECOLLECTOR_COLLECTION_COUNT = "garbageCollector.collectionCount";
/**
* 詳細情報取得キー:GarbageCollectorMXBean#getCollectionCountパラメータの差分
* 発生したコレクションの合計数を返します。
*/
String JMXPARAM_GARBAGECOLLECTOR_COLLECTION_COUNT_DELTA =
"garbageCollector.collectionCount.delta";
/**
* 詳細情報取得キー:GarbageCollectorMXBean#getCollectionTimeパラメータ
* コレクションのおよその累積経過時間 (ミリ秒単位) を返します。
*/
String JMXPARAM_GARBAGECOLLECTOR_COLLECTION_TIME = "garbageCollector.collectionTime";
/**
* 詳細情報取得キー:GarbageCollectorMXBean#getCollectionTimeパラメータの差分
* コレクションのおよその累積経過時間 (ミリ秒単位) を返します。
*/
String JMXPARAM_GARBAGECOLLECTOR_COLLECTION_TIME_DELTA =
"garbageCollector.collectionTime.delta";
/**
* 詳細情報取得キー:MemoryPoolMXBean#getPeakUsage#getUsageパラメータ
* Java 仮想マシンが起動されてから、またはピークがリセットされてからの、このメモリプールのピークメモリ使用量を返します
*/
String JMXPARAM_MEMORYPOOL_PEAKUSAGE_USAGE = "memoryPool.peakUsage.usage";
/**
* 詳細情報取得キー:MemoryPoolMXBean#getPeakUsage#getUsageパラメータの差分
* Java 仮想マシンが起動されてから、またはピークがリセットされてからの、このメモリプールのピークメモリ使用量を返します
*/
String JMXPARAM_MEMORYPOOL_PEAKUSAGE_USAGE_DELTA = "memoryPool.peakUsage.usage.delta";
/**
* 詳細情報取得キー:MemoryMXBean#getHeapMemoryUsageパラメータ
* メソッド呼び出し時のヒープメモリ使用量を取得します。
*/
String JMXPARAM_MEMORY_HEAPMEMORYUSAGE_START = "memory.heapMemoryUsage.start";
/**
* 詳細情報取得キー:MemoryMXBean#getHeapMemoryUsageパラメータ
* メソッド終了時のヒープメモリ使用量を取得します。
*/
String JMXPARAM_MEMORY_HEAPMEMORYUSAGE_END = "memory.heapMemoryUsage.end";
/**
* 詳細情報取得キー:メソッドのTAT
*/
String EXTRAPARAM_DURATION = "duration";
/**
* 詳細情報取得キー:メソッドの消費時間(子メソッド呼び出し時間を差し引いたメソッド実行時間)
*/
String EXTRAPARAM_ELAPSEDTIME = "elapsedTime";
/**
* 詳細情報取得キー:メソッドのCPU時間(子メソッド呼び出しCPU時間を差し引いたメソッドCPU時間)
*/
String EXTRAPARAM_PURECPUTIME = "pureCpuTimeDelta";
/**
* 詳細情報取得キー:メソッドのWait時間(子メソッド呼び出しWait時間を差し引いたメソッドCPU時間)
*/
String EXTRAPARAM_PUREWAITEDTIME = "pureWaitedTimeDelta";
/**
* 詳細情報取得キー:メソッドのUSER時間(子メソッド呼び出しUSER時間を差し引いたメソッドUSER時間)
*/
String EXTRAPARAM_PUREUSERTIME = "pureUserTimeDelta";
/**
* 詳細情報取得キー:CPUのアイドル時間(実行時間からCPU時間を引いた時間)
*/
String EXTRAPARAM_IDLETIME = "IdleTime";
/**
* 詳細情報取得キー:処理実施中のファイル入力量
*/
String IOPARAM_DISK_INPUT = "file.currentFileReadLength";
/**
* 詳細情報取得キー:処理実施中のファイル出力量
*/
String IOPARAM_DISK_OUTPUT = "file.currentFileWriteLength";
/**
* 詳細情報取得キー:処理実施中のネットワーク入力量
*/
String IOPARAM_NETWORK_INPUT = "net.currentThreadReadLength";
/**
* 詳細情報取得キー:処理実施中のネットワーク出力量
*/
String IOPARAM_NETWORK_OUTPUT = "net.currentThreadWriteLength";
/** 例外生成タグ。*/
String JAVELIN_EXCEPTION = "<<javelin.Exception>>";
/** スタックトレース出力の開始タグ。*/
String JAVELIN_STACKTRACE_START = "<<javelin.StackTrace_START>>";
/** スタックトレース出力の終了タグ。*/
String JAVELIN_STACKTRACE_END = "<<javelin.StackTrace_END>>";
/** フィールド値出力の開始タグ。*/
String JAVELIN_FIELDVALUE_START = "<<javelin.FieldValue_START>>";
/** フィールド値出力の終了タグ。*/
String JAVELIN_FIELDVALUE_END = "<<javelin.FieldValue_END>>";
/** 戻り値出力の開始タグ。*/
String JAVELIN_RETURN_START = "<<javelin.Return_START>>";
/** 戻り値出力の終了タグ。*/
String JAVELIN_RETURN_END = "<<javelin.Return_END>>";
/** 引数出力の開始タグ。*/
String JAVELIN_ARGS_START = "<<javelin.Args_START>>";
/** 引数出力の終了タグ。*/
String JAVELIN_ARGS_END = "<<javelin.Args_END>>";
/** JMXにより取得したVMの状態出力の開始タグ。*/
String JAVELIN_JMXINFO_START = "<<javelin.JMXInfo_START>>";
/** JMXにより取得したVMの状態出力の終了タグ。*/
String JAVELIN_JMXINFO_END = "<<javelin.JMXInfo_END>>";
/** 追加情報出力の開始タグ。*/
String JAVELIN_EXTRAINFO_START = "<<javelin.ExtraInfo_START>>";
/** 追加情報出力の終了タグ。*/
String JAVELIN_EXTRAINFO_END = "<<javelin.ExtraInfo_END>>";
/** イベントパラメータ出力の開始タグ。*/
String JAVELIN_EVENTINFO_START = "<<javelin.EventInfo_START>>";
/** イベントパラメータ出力の終了タグ。*/
String JAVELIN_EVENTINFO_END = "<<javelin.EventInfo_END>>";
/** 動作ログ出力日時のフォーマット。*/
String DATE_PATTERN = "yyyy/MM/dd HH:mm:ss.SSS";
/** イベントの警告レベル:Info */
String EVENT_INFO = "INFO";
/** イベントの警告レベル:Warn */
String EVENT_WARN = "WARN";
/** イベントの警告レベル:Warn */
String EVENT_ERROR = "ERROR";
/** ログ出力時、parentNodeが存在しない場合のデフォルトメソッド名称 */
String DEFAULT_LOGMETHOD = "unknown";
}
| UTF-8 | Java | 12,668 | java | JavelinLogConstants.java | Java | [
{
"context": "*********\r\n * ENdoSnipe 5.0 - (https://github.com/endosnipe)\r\n * \r\n * The MIT License (MIT)\r\n * \r\n * Copyrigh",
"end": 130,
"score": 0.9996388554573059,
"start": 121,
"tag": "USERNAME",
"value": "endosnipe"
},
{
"context": "Javelin ログのための定数インターフェースです。<br />\r\... | null | [] | /*******************************************************************************
* ENdoSnipe 5.0 - (https://github.com/endosnipe)
*
* The MIT License (MIT)
*
* Copyright (c) 2012 Acroquest Technology Co.,Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
******************************************************************************/
package jp.co.acroquest.endosnipe.common.parser;
/**
* Javelin ログのための定数インターフェースです。<br />
*
* @author y-komori
*/
public interface JavelinLogConstants
{
/**
* 詳細情報取得キー:ThreadMXBean#getCurrentThreadCpuTimeパラメータ
* 現在のスレッドの合計 CPU 時間をナノ秒単位で返します。
*/
String JMXPARAM_THREAD_CURRENT_THREAD_CPU_TIME = "thread.currentThreadCpuTime";
/**
* 詳細情報取得キー:ThreadMXBean#getCurrentThreadCpuTimeパラメータの差分
* 現在のスレッドの合計 CPU 時間の差分をナノ秒単位で返します。
*/
String JMXPARAM_THREAD_CURRENT_THREAD_CPU_TIME_DELTA = "thread.currentThreadCpuTime.delta";
/**
* 詳細情報取得キー:ThreadMXBean#getCurrentThreadUserTimeパラメータ
* 現在のスレッドがユーザモードで実行した CPU 時間 (ナノ秒単位) を返します。
*/
String JMXPARAM_THREAD_CURRENT_THREAD_USER_TIME = "thread.currentThreadUserTime";
/**
* 詳細情報取得キー:ThreadMXBean#getCurrentThreadUserTimeパラメータの差分
* 現在のスレッドがユーザモードで実行した CPU 時間 (ナノ秒単位) の差分を返します。
*/
String JMXPARAM_THREAD_CURRENT_THREAD_USER_TIME_DELTA = "thread.currentThreadUserTime.delta";
/**
* 詳細情報取得キー:ThreadMXBean#getThreadInfo#getBlockedCountパラメータ
* この ThreadInfo に関連するスレッドが、モニターに入るか、再入するのをブロックした合計回数を返します。
*/
String JMXPARAM_THREAD_THREADINFO_BLOCKED_COUNT = "thread.threadInfo.blockedCount";
/**
* 詳細情報取得キー:ThreadMXBean#getThreadInfo#getBlockedCountパラメータの差分
* この ThreadInfo に関連するスレッドが、モニターに入るか、再入するのをブロックした合計回数の差分を返します。
*/
String JMXPARAM_THREAD_THREADINFO_BLOCKED_COUNT_DELTA = "thread.threadInfo.blockedCount.delta";
/**
* 詳細情報取得キー:ThreadMXBean#getThreadInfo#getBlockedTimeパラメータ
* スレッドコンテンション監視が有効になってから、この ThreadInfo に関連するスレッドがモニターに入るか
* 再入するのをブロックしたおよその累積経過時間 (ミリ秒単位) を返します。
*/
String JMXPARAM_THREAD_THREADINFO_BLOCKED_TIME = "thread.threadInfo.blockedTime";
/**
* 詳細情報取得キー:ThreadMXBean#getThreadInfo#getBlockedTimeパラメータの差分
* スレッドコンテンション監視が有効になってから、この ThreadInfo に関連するスレッドがモニターに入るか
* 再入するのをブロックしたおよその累積経過時間 (ミリ秒単位) の差分を返します。
*/
String JMXPARAM_THREAD_THREADINFO_BLOCKED_TIME_DELTA = "thread.threadInfo.blockedTime.delta";
/**
* 詳細情報取得キー:ThreadMXBean#getThreadInfo#getWaitedCountパラメータ
* この ThreadInfo に関連するスレッドが通知を待機した合計回数を返します。
*/
String JMXPARAM_THREAD_THREADINFO_WAITED_COUNT = "thread.threadInfo.waitedCount";
/**
* 詳細情報取得キー:ThreadMXBean#getThreadInfo#getWaitedCountパラメータの差分
* この ThreadInfo に関連するスレッドが通知を待機した合計回数の差分を返します。
*/
String JMXPARAM_THREAD_THREADINFO_WAITED_COUNT_DELTA = "thread.threadInfo.waitedCount.delta";
/**
* 詳細情報取得キー:ThreadMXBean#getThreadInfo#getWaitedTimeパラメータ
* スレッドコンテンション監視が有効になってから、この ThreadInfo に関連するスレッドが通知を待機した
* およその累積経過時間 (ミリ秒単位) を返します。
*/
String JMXPARAM_THREAD_THREADINFO_WAITED_TIME = "thread.threadInfo.waitedTime";
/**
* 詳細情報取得キー:ThreadMXBean#getThreadInfo#getWaitedTimeパラメータの差分
* スレッドコンテンション監視が有効になってから、この ThreadInfo に関連するスレッドが通知を待機した
* およその累積経過時間 (ミリ秒単位) の差分を返します。
*/
String JMXPARAM_THREAD_THREADINFO_WAITED_TIME_DELTA = "thread.threadInfo.waitedTime.delta";
/**
* 詳細情報取得キー:GarbageCollectorMXBean#getCollectionCountパラメータ
*発生したコレクションの合計数を返します。
*/
String JMXPARAM_GARBAGECOLLECTOR_COLLECTION_COUNT = "garbageCollector.collectionCount";
/**
* 詳細情報取得キー:GarbageCollectorMXBean#getCollectionCountパラメータの差分
* 発生したコレクションの合計数を返します。
*/
String JMXPARAM_GARBAGECOLLECTOR_COLLECTION_COUNT_DELTA =
"garbageCollector.collectionCount.delta";
/**
* 詳細情報取得キー:GarbageCollectorMXBean#getCollectionTimeパラメータ
* コレクションのおよその累積経過時間 (ミリ秒単位) を返します。
*/
String JMXPARAM_GARBAGECOLLECTOR_COLLECTION_TIME = "garbageCollector.collectionTime";
/**
* 詳細情報取得キー:GarbageCollectorMXBean#getCollectionTimeパラメータの差分
* コレクションのおよその累積経過時間 (ミリ秒単位) を返します。
*/
String JMXPARAM_GARBAGECOLLECTOR_COLLECTION_TIME_DELTA =
"garbageCollector.collectionTime.delta";
/**
* 詳細情報取得キー:MemoryPoolMXBean#getPeakUsage#getUsageパラメータ
* Java 仮想マシンが起動されてから、またはピークがリセットされてからの、このメモリプールのピークメモリ使用量を返します
*/
String JMXPARAM_MEMORYPOOL_PEAKUSAGE_USAGE = "memoryPool.peakUsage.usage";
/**
* 詳細情報取得キー:MemoryPoolMXBean#getPeakUsage#getUsageパラメータの差分
* Java 仮想マシンが起動されてから、またはピークがリセットされてからの、このメモリプールのピークメモリ使用量を返します
*/
String JMXPARAM_MEMORYPOOL_PEAKUSAGE_USAGE_DELTA = "memoryPool.peakUsage.usage.delta";
/**
* 詳細情報取得キー:MemoryMXBean#getHeapMemoryUsageパラメータ
* メソッド呼び出し時のヒープメモリ使用量を取得します。
*/
String JMXPARAM_MEMORY_HEAPMEMORYUSAGE_START = "memory.heapMemoryUsage.start";
/**
* 詳細情報取得キー:MemoryMXBean#getHeapMemoryUsageパラメータ
* メソッド終了時のヒープメモリ使用量を取得します。
*/
String JMXPARAM_MEMORY_HEAPMEMORYUSAGE_END = "memory.heapMemoryUsage.end";
/**
* 詳細情報取得キー:メソッドのTAT
*/
String EXTRAPARAM_DURATION = "duration";
/**
* 詳細情報取得キー:メソッドの消費時間(子メソッド呼び出し時間を差し引いたメソッド実行時間)
*/
String EXTRAPARAM_ELAPSEDTIME = "elapsedTime";
/**
* 詳細情報取得キー:メソッドのCPU時間(子メソッド呼び出しCPU時間を差し引いたメソッドCPU時間)
*/
String EXTRAPARAM_PURECPUTIME = "pureCpuTimeDelta";
/**
* 詳細情報取得キー:メソッドのWait時間(子メソッド呼び出しWait時間を差し引いたメソッドCPU時間)
*/
String EXTRAPARAM_PUREWAITEDTIME = "pureWaitedTimeDelta";
/**
* 詳細情報取得キー:メソッドのUSER時間(子メソッド呼び出しUSER時間を差し引いたメソッドUSER時間)
*/
String EXTRAPARAM_PUREUSERTIME = "pureUserTimeDelta";
/**
* 詳細情報取得キー:CPUのアイドル時間(実行時間からCPU時間を引いた時間)
*/
String EXTRAPARAM_IDLETIME = "IdleTime";
/**
* 詳細情報取得キー:処理実施中のファイル入力量
*/
String IOPARAM_DISK_INPUT = "file.currentFileReadLength";
/**
* 詳細情報取得キー:処理実施中のファイル出力量
*/
String IOPARAM_DISK_OUTPUT = "file.currentFileWriteLength";
/**
* 詳細情報取得キー:処理実施中のネットワーク入力量
*/
String IOPARAM_NETWORK_INPUT = "net.currentThreadReadLength";
/**
* 詳細情報取得キー:処理実施中のネットワーク出力量
*/
String IOPARAM_NETWORK_OUTPUT = "net.currentThreadWriteLength";
/** 例外生成タグ。*/
String JAVELIN_EXCEPTION = "<<javelin.Exception>>";
/** スタックトレース出力の開始タグ。*/
String JAVELIN_STACKTRACE_START = "<<javelin.StackTrace_START>>";
/** スタックトレース出力の終了タグ。*/
String JAVELIN_STACKTRACE_END = "<<javelin.StackTrace_END>>";
/** フィールド値出力の開始タグ。*/
String JAVELIN_FIELDVALUE_START = "<<javelin.FieldValue_START>>";
/** フィールド値出力の終了タグ。*/
String JAVELIN_FIELDVALUE_END = "<<javelin.FieldValue_END>>";
/** 戻り値出力の開始タグ。*/
String JAVELIN_RETURN_START = "<<javelin.Return_START>>";
/** 戻り値出力の終了タグ。*/
String JAVELIN_RETURN_END = "<<javelin.Return_END>>";
/** 引数出力の開始タグ。*/
String JAVELIN_ARGS_START = "<<javelin.Args_START>>";
/** 引数出力の終了タグ。*/
String JAVELIN_ARGS_END = "<<javelin.Args_END>>";
/** JMXにより取得したVMの状態出力の開始タグ。*/
String JAVELIN_JMXINFO_START = "<<javelin.JMXInfo_START>>";
/** JMXにより取得したVMの状態出力の終了タグ。*/
String JAVELIN_JMXINFO_END = "<<javelin.JMXInfo_END>>";
/** 追加情報出力の開始タグ。*/
String JAVELIN_EXTRAINFO_START = "<<javelin.ExtraInfo_START>>";
/** 追加情報出力の終了タグ。*/
String JAVELIN_EXTRAINFO_END = "<<javelin.ExtraInfo_END>>";
/** イベントパラメータ出力の開始タグ。*/
String JAVELIN_EVENTINFO_START = "<<javelin.EventInfo_START>>";
/** イベントパラメータ出力の終了タグ。*/
String JAVELIN_EVENTINFO_END = "<<javelin.EventInfo_END>>";
/** 動作ログ出力日時のフォーマット。*/
String DATE_PATTERN = "yyyy/MM/dd HH:mm:ss.SSS";
/** イベントの警告レベル:Info */
String EVENT_INFO = "INFO";
/** イベントの警告レベル:Warn */
String EVENT_WARN = "WARN";
/** イベントの警告レベル:Warn */
String EVENT_ERROR = "ERROR";
/** ログ出力時、parentNodeが存在しない場合のデフォルトメソッド名称 */
String DEFAULT_LOGMETHOD = "unknown";
}
| 12,668 | 0.670041 | 0.669395 | 271 | 32.265682 | 29.926285 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.273063 | false | false | 3 |
975903fac7fb59975b8472388bcb0d6c0e6132d1 | 20,452,634,308,184 | de9cf31282b2bf1f7f2068b5f91f67f80a7c2e2f | /src/main/java/com/java/ee/task/organizer/exception/TaskValidationException.java | 22308f3ef9188a406a0971eb092c9e9b5f79556b | [] | no_license | kamilklimek/TaskApp | https://github.com/kamilklimek/TaskApp | d7a283de51e414f517ede8b97c2a81d391d13b00 | b29d9646b2d24e0528280e6fb05d3dd927fa347e | refs/heads/master | 2020-04-22T18:25:54.466000 | 2019-02-13T20:17:36 | 2019-02-13T20:17:36 | 170,576,781 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.java.ee.task.organizer.exception;
public class TaskValidationException extends RuntimeException {
public TaskValidationException(String join) {
super(join);
}
}
| UTF-8 | Java | 190 | java | TaskValidationException.java | Java | [] | null | [] | package com.java.ee.task.organizer.exception;
public class TaskValidationException extends RuntimeException {
public TaskValidationException(String join) {
super(join);
}
}
| 190 | 0.752632 | 0.752632 | 7 | 26.142857 | 24.014452 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false | 3 |
4664a3a7c9a04f1997e9ff14d45ef691619b3651 | 32,263,794,352,364 | 254c01c3bf998b9fbbde6acc1e16ac7bf583eef7 | /src/main/java/com/lex4hex/securedShop/dao/CustomerDAO.java | 665f9b80cb40a648bbf704a78769b0d2a3be59d8 | [
"MIT"
] | permissive | Lex4hex/secured-shop | https://github.com/Lex4hex/secured-shop | 824abbeecc0619c25b9e034c117980d6af04033f | faad3cb8dd8850d100ee6f053465e68db43546a7 | refs/heads/dev | 2022-11-27T15:15:39.679000 | 2019-07-26T11:54:51 | 2019-07-26T11:54:51 | 72,477,604 | 4 | 4 | MIT | false | 2022-11-15T23:47:48 | 2016-10-31T21:00:39 | 2020-06-13T17:00:29 | 2022-11-15T23:47:45 | 18,250 | 4 | 1 | 2 | Java | false | false | package com.lex4hex.securedShop.dao;
import com.lex4hex.securedShop.model.Customer;
interface CustomerDAO {
Customer findByName(String name);
boolean checkIfCustomerExists(String name);
}
| UTF-8 | Java | 201 | java | CustomerDAO.java | Java | [] | null | [] | package com.lex4hex.securedShop.dao;
import com.lex4hex.securedShop.model.Customer;
interface CustomerDAO {
Customer findByName(String name);
boolean checkIfCustomerExists(String name);
}
| 201 | 0.781095 | 0.771144 | 11 | 17.272728 | 19.628786 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.363636 | false | false | 3 |
05438487072c095efea34e55d6a64f9aa8916a00 | 3,350,074,523,746 | ad660ae2037e48ebd827e3564550bc051fe81ca8 | /apple-commons/src/main/java/com/appleframework/tools/img/package-info.java | df9de44ede7e065af5aa12e1edacf508ae590d27 | [
"Apache-2.0"
] | permissive | wangscript007/appleframework | https://github.com/wangscript007/appleframework | 931f35e1ba7c9747c80094e9066161c06ab3ba08 | 65c035b4ab1805417f5eed88258d9d82ba6f29a8 | refs/heads/master | 2023-05-05T05:34:57.798000 | 2021-01-20T09:35:40 | 2021-01-20T09:35:40 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* 图像处理相关工具类封装
*
* @author cruise.xu
*
*/
package com.appleframework.tools.img; | UTF-8 | Java | 110 | java | package-info.java | Java | [
{
"context": "/**\n * 图像处理相关工具类封装\n * \n * @author cruise.xu\n *\n */\npackage com.appleframework.tools.img;",
"end": 43,
"score": 0.8619594573974609,
"start": 34,
"tag": "NAME",
"value": "cruise.xu"
}
] | null | [] | /**
* 图像处理相关工具类封装
*
* @author cruise.xu
*
*/
package com.appleframework.tools.img; | 110 | 0.647727 | 0.647727 | 7 | 11.714286 | 12.162169 | 37 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | false | false | 3 |
a1002b651a6f367546db5506f6cc1d82bf1db1fe | 30,150,670,450,787 | 3da39bae1c64bdb9f5540a18ea8e7e97b29ab863 | /src/com/rushdevo/twittaddict/twitter/StatusService.java | 72c3436be15eaf074444218a66a75ba18d562663 | [] | no_license | diminish7/twittaddict_android | https://github.com/diminish7/twittaddict_android | 49521c3a010592525d49995ad395419420d29388 | ea6aaa9c404eb67cee6ab92ec60a01124a05aad6 | refs/heads/master | 2021-01-01T19:15:54.151000 | 2013-09-04T19:19:53 | 2013-09-04T19:19:53 | 2,176,616 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.rushdevo.twittaddict.twitter;
import java.lang.reflect.Type;
import java.util.Collection;
import java.util.List;
import org.apache.http.client.HttpClient;
import android.content.Context;
import com.google.gson.reflect.TypeToken;
import com.rushdevo.twittaddict.Twittaddict;
import com.rushdevo.twittaddict.twitter.model.TwitterStatus;
public class StatusService extends AbstractTwitterService {
private static final String BASE_STATUSES_URL = BASE_URL + "statuses/";
private static final String HOME_TIMELINE_URL = BASE_STATUSES_URL + "home_timeline.json?count=200";
private static final Type TWITTER_STATUS_COLLECTION_TYPE = new TypeToken<Collection<TwitterStatus>>(){}.getType();
public StatusService(Context context, Twittaddict game, Authenticator authenticator) {
super(context, game, authenticator);
}
public StatusService(Context context, Twittaddict game, Authenticator authenticator, HttpClient client) {
super(context, game, authenticator, client);
}
public List<TwitterStatus> getHomeTimeline() {
return getGson().fromJson(getResponseBody(HOME_TIMELINE_URL), TWITTER_STATUS_COLLECTION_TYPE);
}
}
| UTF-8 | Java | 1,147 | java | StatusService.java | Java | [] | null | [] | package com.rushdevo.twittaddict.twitter;
import java.lang.reflect.Type;
import java.util.Collection;
import java.util.List;
import org.apache.http.client.HttpClient;
import android.content.Context;
import com.google.gson.reflect.TypeToken;
import com.rushdevo.twittaddict.Twittaddict;
import com.rushdevo.twittaddict.twitter.model.TwitterStatus;
public class StatusService extends AbstractTwitterService {
private static final String BASE_STATUSES_URL = BASE_URL + "statuses/";
private static final String HOME_TIMELINE_URL = BASE_STATUSES_URL + "home_timeline.json?count=200";
private static final Type TWITTER_STATUS_COLLECTION_TYPE = new TypeToken<Collection<TwitterStatus>>(){}.getType();
public StatusService(Context context, Twittaddict game, Authenticator authenticator) {
super(context, game, authenticator);
}
public StatusService(Context context, Twittaddict game, Authenticator authenticator, HttpClient client) {
super(context, game, authenticator, client);
}
public List<TwitterStatus> getHomeTimeline() {
return getGson().fromJson(getResponseBody(HOME_TIMELINE_URL), TWITTER_STATUS_COLLECTION_TYPE);
}
}
| 1,147 | 0.795118 | 0.792502 | 32 | 34.84375 | 35.59943 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.40625 | false | false | 3 |
b90b60163f214c36df51683e0034af22d25efdb1 | 10,806,137,737,579 | 4c20b18584228c11d8b22dfc43e5caaf796b54bb | /src/main/java/com/wladek/accomodation/domain/enumeration/ItemCondition.java | b5ff8100ac641b24d6518c0f5b870112944ebfd7 | [] | no_license | wladekAiro/Accomodation | https://github.com/wladekAiro/Accomodation | 4672f1f6304ded9f2b3bd167d045a60caf6cc3c0 | ea8a9ad852654c453303f0404e501d06ea377296 | refs/heads/master | 2021-01-16T22:09:40.371000 | 2016-10-07T20:19:28 | 2016-10-07T20:19:28 | 68,714,065 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.wladek.accomodation.domain.enumeration;
/**
* Created by wladek on 9/26/16.
*/
public enum ItemCondition {
GOOD,BAD,LOST,DAMAGED
}
| UTF-8 | Java | 150 | java | ItemCondition.java | Java | [
{
"context": "ccomodation.domain.enumeration;\n\n/**\n * Created by wladek on 9/26/16.\n */\npublic enum ItemCondition {\n G",
"end": 77,
"score": 0.9995736479759216,
"start": 71,
"tag": "USERNAME",
"value": "wladek"
}
] | null | [] | package com.wladek.accomodation.domain.enumeration;
/**
* Created by wladek on 9/26/16.
*/
public enum ItemCondition {
GOOD,BAD,LOST,DAMAGED
}
| 150 | 0.72 | 0.686667 | 8 | 17.75 | 17.59794 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 3 |
28fb833b715429b31fd4af2ada7816270b6f92f6 | 32,993,938,830,366 | 27c54c6e49d0ae6292d7584a7da79c7085b23be3 | /week3/多线程/Demo02_SetAndGetName/MyThread_Name.java | 746bd668d7d58938ffd42a1384be8149cbf04d2e | [] | no_license | yyqstudy/basic-Java | https://github.com/yyqstudy/basic-Java | 877fdfccc2c8ef0d6d7a82cae0910d66867994b9 | e49474240abe2e766ffe270625b2d63a16d4740c | refs/heads/main | 2023-06-21T11:18:32.335000 | 2021-08-11T12:58:53 | 2021-08-11T12:58:53 | 386,893,572 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package week3.多线程.Demo02_SetAndGetName;
public class MyThread_Name extends Thread{
//带参数构造要写的
//要到Thread Class中提供一个带参数构造方法---通过super()去访问父类的带参数构造
public MyThread_Name(){}
public MyThread_Name(String name){
super(name);
}
//-------------------
@Override
public void run(){
for (int i = 0; i < 100; i++) {
System.out.println(getName()+":"+i);
}
}
}
| UTF-8 | Java | 498 | java | MyThread_Name.java | Java | [] | null | [] | package week3.多线程.Demo02_SetAndGetName;
public class MyThread_Name extends Thread{
//带参数构造要写的
//要到Thread Class中提供一个带参数构造方法---通过super()去访问父类的带参数构造
public MyThread_Name(){}
public MyThread_Name(String name){
super(name);
}
//-------------------
@Override
public void run(){
for (int i = 0; i < 100; i++) {
System.out.println(getName()+":"+i);
}
}
}
| 498 | 0.554502 | 0.537915 | 19 | 21.210526 | 17.50362 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.263158 | false | false | 3 |
6a8727774ed72186e9550e303a4c457d8a2e5b42 | 8,229,157,368,399 | e2088e9a289f806cd87da504fc7fdf3b0d73a524 | /Change alphabet case/Main.java | 1682455843092baca3535e3e7f188ff0030e05dd | [] | no_license | bharathibm16/Playground | https://github.com/bharathibm16/Playground | 4c2ddca21e9e8db76c57c1050733152f4ed57569 | 72d0a0b55f0544e11c4b7794747f40d7eb569b4f | refs/heads/master | 2020-06-09T16:06:32.116000 | 2019-08-02T07:04:20 | 2019-08-02T07:04:20 | 193,465,380 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | #include <stdio.h>
int main() {
// Type your code here
char a,x,y;
scanf("%c",&a);
if(a>='a' && a<='z')
{
x=a-32;
printf("%c",x);
}
else if(a>='A'&& a<='Z')
{
y=a+32;
printf("%c",y);}
return 0;
} | UTF-8 | Java | 227 | java | Main.java | Java | [] | null | [] | #include <stdio.h>
int main() {
// Type your code here
char a,x,y;
scanf("%c",&a);
if(a>='a' && a<='z')
{
x=a-32;
printf("%c",x);
}
else if(a>='A'&& a<='Z')
{
y=a+32;
printf("%c",y);}
return 0;
} | 227 | 0.427313 | 0.405286 | 16 | 13.25 | 7.652614 | 26 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.875 | false | false | 3 |
ad77ce476be562db5422725e721185763fdcf481 | 23,991,687,351,588 | 8bbff50611c38ed99ecdc6a27a8b0c964a31db7e | /src/main/java/escambovirtual/model/entity/Log.java | fa4d762b78455164b6a2353e3fca8c008e626b11 | [] | no_license | pedroarvellos/escambo-virtual-application | https://github.com/pedroarvellos/escambo-virtual-application | c00db82068f83ce7ef9238a4335cac9f64cf7549 | 6d20563a3951852ae46bac787f739c41a15ce0bf | refs/heads/master | 2021-09-05T06:18:49.636000 | 2018-01-24T18:30:57 | 2018-01-24T18:30:57 | 114,671,331 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package escambovirtual.model.entity;
import escambovirtual.model.base.BaseEntity;
public class Log extends BaseEntity{
private String evento;
private String dataHora;
private Long idEvento;
private String descricao;
private Long idUsuario;
private String nomeUsuario;
public String getNomeUsuario() {
return nomeUsuario;
}
public void setNomeUsuario(String nomeUsuario) {
this.nomeUsuario = nomeUsuario;
}
public String getEvento() {
return evento;
}
public void setEvento(String evento) {
this.evento = evento;
}
public String getDataHora() {
return dataHora;
}
public void setDataHora(String dataHora) {
this.dataHora = dataHora;
}
public Long getIdEvento() {
return idEvento;
}
public void setIdEvento(Long idEvento) {
this.idEvento = idEvento;
}
public String getDescricao() {
return descricao;
}
public void setDescricao(String descricao) {
this.descricao = descricao;
}
public Long getIdUsuario() {
return idUsuario;
}
public void setIdUsuario(Long idUsuario) {
this.idUsuario = idUsuario;
}
}
| UTF-8 | Java | 1,251 | java | Log.java | Java | [] | null | [] | package escambovirtual.model.entity;
import escambovirtual.model.base.BaseEntity;
public class Log extends BaseEntity{
private String evento;
private String dataHora;
private Long idEvento;
private String descricao;
private Long idUsuario;
private String nomeUsuario;
public String getNomeUsuario() {
return nomeUsuario;
}
public void setNomeUsuario(String nomeUsuario) {
this.nomeUsuario = nomeUsuario;
}
public String getEvento() {
return evento;
}
public void setEvento(String evento) {
this.evento = evento;
}
public String getDataHora() {
return dataHora;
}
public void setDataHora(String dataHora) {
this.dataHora = dataHora;
}
public Long getIdEvento() {
return idEvento;
}
public void setIdEvento(Long idEvento) {
this.idEvento = idEvento;
}
public String getDescricao() {
return descricao;
}
public void setDescricao(String descricao) {
this.descricao = descricao;
}
public Long getIdUsuario() {
return idUsuario;
}
public void setIdUsuario(Long idUsuario) {
this.idUsuario = idUsuario;
}
}
| 1,251 | 0.630695 | 0.630695 | 64 | 18.546875 | 16.587769 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.3125 | false | false | 3 |
f53ef4c9be21d2d5756085046e1c7b5ce7c095b5 | 29,231,547,453,889 | 3417cb10ed81cf26937f8613067006108789ba52 | /(back up) _ 오전/study_a/jj_work/javaProj/src/coll_p/StackBrowserMain.java | f18f43eae3726d93705e13fc2329fb22c9a04cac | [] | no_license | psun2/Korea-IT-Academy | https://github.com/psun2/Korea-IT-Academy | a32c4eadfe4f5f10c3c624ea47253e0bf4640200 | 670642f7618b05e2df8926492a0c2a3eec032463 | refs/heads/master | 2021-03-17T14:36:33.108000 | 2020-12-06T20:40:19 | 2020-12-06T20:40:19 | 246,997,229 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package coll_p;
import java.util.Stack;
class Browser{
String now;
Stack back = new Stack();
Stack next = new Stack();
void goUrl(String url) {
System.out.println("goUrl("+url+")----------");
next.clear();
if(now!=null)
back.push(now);
now=url;
ppp();
}
void goBack() {
System.out.println("goBack----------");
if(back.empty()) {
System.out.println("뒤로 갈 페이지가 없습니다.");
return;
}
next.push(now);
now = (String)back.pop();
ppp();
}
void goNext() {
System.out.println("goNext----------");
if(next.empty()) {
System.out.println("앞으로 갈 페이지가 없습니다.");
return;
}
back.push(now);
now = (String)next.pop();
ppp();
}
void ppp() {
System.out.println("now:"+now);
System.out.println("back:"+back);
System.out.println("next:"+next);
}
}
public class StackBrowserMain {
public static void main(String[] args) {
Browser bw = new Browser();
bw.goUrl("네이버");
bw.goUrl("다음");
bw.goUrl("네이트");
bw.goUrl("줌");
bw.goBack();
bw.goBack();
bw.goBack();
bw.goBack();
bw.goBack();
bw.goNext();
bw.goNext();
bw.goNext();
bw.goNext();
bw.goBack();
bw.goBack();
bw.goUrl("구글");
bw.goNext();
}
}
| UHC | Java | 1,263 | java | StackBrowserMain.java | Java | [] | null | [] | package coll_p;
import java.util.Stack;
class Browser{
String now;
Stack back = new Stack();
Stack next = new Stack();
void goUrl(String url) {
System.out.println("goUrl("+url+")----------");
next.clear();
if(now!=null)
back.push(now);
now=url;
ppp();
}
void goBack() {
System.out.println("goBack----------");
if(back.empty()) {
System.out.println("뒤로 갈 페이지가 없습니다.");
return;
}
next.push(now);
now = (String)back.pop();
ppp();
}
void goNext() {
System.out.println("goNext----------");
if(next.empty()) {
System.out.println("앞으로 갈 페이지가 없습니다.");
return;
}
back.push(now);
now = (String)next.pop();
ppp();
}
void ppp() {
System.out.println("now:"+now);
System.out.println("back:"+back);
System.out.println("next:"+next);
}
}
public class StackBrowserMain {
public static void main(String[] args) {
Browser bw = new Browser();
bw.goUrl("네이버");
bw.goUrl("다음");
bw.goUrl("네이트");
bw.goUrl("줌");
bw.goBack();
bw.goBack();
bw.goBack();
bw.goBack();
bw.goBack();
bw.goNext();
bw.goNext();
bw.goNext();
bw.goNext();
bw.goBack();
bw.goBack();
bw.goUrl("구글");
bw.goNext();
}
}
| 1,263 | 0.564017 | 0.564017 | 75 | 14.933333 | 12.251077 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.146667 | false | false | 3 |
da8b9b42fc09bbc808dd086031a3507797ad3b8d | 24,309,514,932,459 | b6863421d1c13ca1ca3c27f2b23e1f370234f1f9 | /src/main/java/ObjectsRepo/Settings/AdvancedSettings/installation/devices/securitySensors/AddSensorScreen.java | dfecbab16ce874da6eb3fd2aae13ba816185d763 | [] | no_license | alohageck0/AndroidTesting | https://github.com/alohageck0/AndroidTesting | 80991af0bf14052f7792327fd05e485e0a96f5a7 | f470410e68628dd377bdd3aced897af364319d37 | refs/heads/master | 2016-09-17T04:39:20.458000 | 2016-08-31T17:07:10 | 2016-08-31T17:07:10 | 58,184,804 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ObjectsRepo.Settings.AdvancedSettings.installation.devices.securitySensors;
import ServiceClasses.ScreenTemplate;
import io.appium.java_client.TouchAction;
import io.appium.java_client.android.AndroidDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import java.util.List;
public class AddSensorScreen extends ScreenTemplate {
public AddSensorScreen(AndroidDriver driver) {
super(driver);
}
@FindBy(id = "com.qolsys:id/addsensor")
WebElement addButton;
@FindBy(id = "com.qolsys:id/sensor_id")
WebElement sensorIDTextfield;
@FindBy(id = "com.qolsys:id/sensortype")
WebElement sensorTypeCheckbox;
@FindBy(id = "com.qolsys:id/sensor_desc")
WebElement sensorNameCheckbox;
@FindBy(id = "com.qolsys:id/chimetype")
WebElement sensorChimeCheckbox;
@FindBy(id = "com.qolsys:id/grouptype")
WebElement sensorGroupCheckbox;
@FindBy(id = "com.qolsys:id/tts")
WebElement voicePromptsCheckbox;
public WebElement getAddButton() {
return addButton;
}
public WebElement getSensorIDTextfield() {
return sensorIDTextfield;
}
private WebElement getSensorTypeCheckbox() {
return sensorTypeCheckbox;
}
public WebElement getSensorNameCheckbox() {
return sensorNameCheckbox;
}
public WebElement getSensorChimeCheckbox() {
return sensorChimeCheckbox;
}
public WebElement getSensorGroupCheckbox() {
return sensorGroupCheckbox;
}
public WebElement getVoicePromptsCheckbox() {
return voicePromptsCheckbox;
}
public void selectSensorType(String sensorType) {
TouchAction touchAction = new TouchAction(getDriver());
touchAction.tap(getSensorTypeCheckbox()).perform();
selector(sensorType, touchAction);
}
public void selectSensorName(String sensorName) {
TouchAction touchAction = new TouchAction(getDriver());
touchAction.tap(getSensorNameCheckbox()).perform();
selector(sensorName, touchAction);
}
public void selectGroup(String group){
TouchAction touchAction = new TouchAction(getDriver());
touchAction.tap(getSensorGroupCheckbox()).perform();
selector(group, touchAction);
}
private void selector(String item, TouchAction touchAction) {
WebElement element;
try {
element = getDriver().findElementByAndroidUIAutomator("new UiSelector().text(\"" + item + "\")");
touchAction.tap(element).perform();
} catch (org.openqa.selenium.NoSuchElementException e) {
getDriver().scrollToExact(item);
element = getDriver().findElementByAndroidUIAutomator("new UiSelector().text(\"" + item + "\")");
touchAction.tap(element).perform();
}
}
}
| UTF-8 | Java | 2,756 | java | AddSensorScreen.java | Java | [] | null | [] | package ObjectsRepo.Settings.AdvancedSettings.installation.devices.securitySensors;
import ServiceClasses.ScreenTemplate;
import io.appium.java_client.TouchAction;
import io.appium.java_client.android.AndroidDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import java.util.List;
public class AddSensorScreen extends ScreenTemplate {
public AddSensorScreen(AndroidDriver driver) {
super(driver);
}
@FindBy(id = "com.qolsys:id/addsensor")
WebElement addButton;
@FindBy(id = "com.qolsys:id/sensor_id")
WebElement sensorIDTextfield;
@FindBy(id = "com.qolsys:id/sensortype")
WebElement sensorTypeCheckbox;
@FindBy(id = "com.qolsys:id/sensor_desc")
WebElement sensorNameCheckbox;
@FindBy(id = "com.qolsys:id/chimetype")
WebElement sensorChimeCheckbox;
@FindBy(id = "com.qolsys:id/grouptype")
WebElement sensorGroupCheckbox;
@FindBy(id = "com.qolsys:id/tts")
WebElement voicePromptsCheckbox;
public WebElement getAddButton() {
return addButton;
}
public WebElement getSensorIDTextfield() {
return sensorIDTextfield;
}
private WebElement getSensorTypeCheckbox() {
return sensorTypeCheckbox;
}
public WebElement getSensorNameCheckbox() {
return sensorNameCheckbox;
}
public WebElement getSensorChimeCheckbox() {
return sensorChimeCheckbox;
}
public WebElement getSensorGroupCheckbox() {
return sensorGroupCheckbox;
}
public WebElement getVoicePromptsCheckbox() {
return voicePromptsCheckbox;
}
public void selectSensorType(String sensorType) {
TouchAction touchAction = new TouchAction(getDriver());
touchAction.tap(getSensorTypeCheckbox()).perform();
selector(sensorType, touchAction);
}
public void selectSensorName(String sensorName) {
TouchAction touchAction = new TouchAction(getDriver());
touchAction.tap(getSensorNameCheckbox()).perform();
selector(sensorName, touchAction);
}
public void selectGroup(String group){
TouchAction touchAction = new TouchAction(getDriver());
touchAction.tap(getSensorGroupCheckbox()).perform();
selector(group, touchAction);
}
private void selector(String item, TouchAction touchAction) {
WebElement element;
try {
element = getDriver().findElementByAndroidUIAutomator("new UiSelector().text(\"" + item + "\")");
touchAction.tap(element).perform();
} catch (org.openqa.selenium.NoSuchElementException e) {
getDriver().scrollToExact(item);
element = getDriver().findElementByAndroidUIAutomator("new UiSelector().text(\"" + item + "\")");
touchAction.tap(element).perform();
}
}
}
| 2,756 | 0.71299 | 0.71299 | 95 | 28.010527 | 24.615568 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.431579 | false | false | 3 |
7c375c274bb66b9a97f09701af4cd522198a63de | 5,961,414,646,950 | 1efea7999af4c17a3344e5c8345d74a7976442c9 | /20190201/wimetro-cloud/base-common-api/src/main/java/cn/wimetro/service/impl/YlOptionConfigServiceImpl.java | b2c93cbb138ad36aaa59f16f5cf463291da27de8 | [] | no_license | eric218/spring-cloud | https://github.com/eric218/spring-cloud | 50dc7e2511e437091ced404cbb2badc845e9fe3c | d8bce924d851371e5cf00a7e8e8602a37da353ce | refs/heads/master | 2020-04-20T05:50:59.571000 | 2019-03-05T07:58:50 | 2019-03-05T07:58:50 | 168,666,894 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.wimetro.service.impl;
import cn.wimetro.constants.Ylstatic;
import cn.wimetro.entity.YlOptionConfig;
import cn.wimetro.mapper.YlOptionConfigMapper;
import cn.wimetro.pos.ISOF;
import cn.wimetro.service.YlOptionConfigService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* <p>
* 服务实现类
* </p>
*
* @author wangwei
* @since 2019-01-08
*/
@Slf4j
@Service
public class YlOptionConfigServiceImpl extends ServiceImpl<YlOptionConfigMapper, YlOptionConfig> implements YlOptionConfigService {
@Override
public Map load8583Config() {
Map map = new LinkedHashMap();
List<YlOptionConfig> list = this.list(null);
for(YlOptionConfig config : list){
if(("DEV_PRO").equals(config.getCodeCode())){
Ylstatic.DEV_PRO = config.getCodeValue();
map.put("DEV_PRO",config.getCodeValue());
}
if(("gMACK").equals(config.getCodeCode())){
ISOF.gMACK = ISOF.HexStr_Bytes(config.getCodeValue(),0);
map.put("gMACK",config.getCodeValue());
}
if(("gMACK_bak").equals(config.getCodeCode())){
ISOF.gMACK_bak = ISOF.HexStr_Bytes(config.getCodeValue(),0);
map.put("gMACK_bak",config.getCodeValue());
}
if(("gDateTime").equals(config.getCodeCode())){
ISOF.gDateTime = config.getCodeValue();
map.put("gDateTime",config.getCodeValue());
}
if(("gHSMIP").equals(config.getCodeCode())){
ISOF.gHSMIP = config.getCodeValue();
map.put("gHSMIP",config.getCodeValue());
}
if(("gHSMPORT").equals(config.getCodeCode())){
ISOF.gHSMPORT = config.getCodeValue();
map.put("gHSMPORT",config.getCodeValue());
}
if(("gTPDU").equals(config.getCodeCode())){
ISOF.gTPDU = config.getCodeValue();
map.put("gTPDU",config.getCodeValue());
}
if(("gHEAD").equals(config.getCodeCode())){
ISOF.gHEAD = config.getCodeValue();
map.put("gHEAD",config.getCodeValue());
}
if(("gTerminal_no").equals(config.getCodeCode())){
ISOF.gTerminal_no = config.getCodeValue();
map.put("gTerminal_no",config.getCodeValue());
}
if(("gMerct_no").equals(config.getCodeCode())){
ISOF.gMerct_no = config.getCodeValue();
map.put("gMerct_no",config.getCodeValue());
}
if(("gSys_no").equals(config.getCodeCode())){
ISOF.gSys_no = config.getCodeValue();
map.put("gSys_no",config.getCodeValue());
}
if(("gMoney_code").equals(config.getCodeCode())){
ISOF.gMoney_code = config.getCodeValue();
map.put("gMoney_code",config.getCodeValue());
}
if(("PRE_AUTH_OVER_TIME").equals(config.getCodeCode())){
Ylstatic.PRE_AUTH_OVER_TIME = config.getCodeValue();
map.put("PRE_AUTH_OVER_TIME",config.getCodeValue());
}
if(("PRE_AUTH_DEAL_TIME").equals(config.getCodeCode())){
Ylstatic.PRE_AUTH_DEAL_TIME = config.getCodeValue();
map.put("PRE_AUTH_DEAL_TIME",config.getCodeValue());
}
if(("HIGH_PRICE").equals(config.getCodeCode())){
Ylstatic.HIGH_PRICE = config.getCodeValue();
map.put("HIGH_PRICE",config.getCodeValue());
}
}
return map;
}
@Override
public void print8583Config(Map map) {
map.forEach((k, v) -> {
log.info(k+"===="+v);
});
}
@Override
public void update8583Config(Map map){
String gMACK = (String) map.get("gMACK");
String gMACKBak = (String) map.get("gMACK_bak");
String gDateTime = (String) map.get("gDateTime");
update("gMACK",gMACK);
update("gMACK_bak",gMACKBak);
update("gDateTime",gDateTime);
}
private void update(String name,String value){
QueryWrapper<YlOptionConfig> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("CODE_GROUP","8583_LOGIN");
queryWrapper.eq("CODE_CODE",name);
YlOptionConfig ylOptionConfig = this.getOne(queryWrapper);
ylOptionConfig.setCodeValue(value);
ylOptionConfig.updateById();
}
}
| UTF-8 | Java | 4,798 | java | YlOptionConfigServiceImpl.java | Java | [
{
"context": "l.Map;\n\n/**\n * <p>\n * 服务实现类\n * </p>\n *\n * @author wangwei\n * @since 2019-01-08\n */\n@Slf4j\n@Service\npublic c",
"end": 609,
"score": 0.9947214722633362,
"start": 602,
"tag": "USERNAME",
"value": "wangwei"
}
] | null | [] | package cn.wimetro.service.impl;
import cn.wimetro.constants.Ylstatic;
import cn.wimetro.entity.YlOptionConfig;
import cn.wimetro.mapper.YlOptionConfigMapper;
import cn.wimetro.pos.ISOF;
import cn.wimetro.service.YlOptionConfigService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* <p>
* 服务实现类
* </p>
*
* @author wangwei
* @since 2019-01-08
*/
@Slf4j
@Service
public class YlOptionConfigServiceImpl extends ServiceImpl<YlOptionConfigMapper, YlOptionConfig> implements YlOptionConfigService {
@Override
public Map load8583Config() {
Map map = new LinkedHashMap();
List<YlOptionConfig> list = this.list(null);
for(YlOptionConfig config : list){
if(("DEV_PRO").equals(config.getCodeCode())){
Ylstatic.DEV_PRO = config.getCodeValue();
map.put("DEV_PRO",config.getCodeValue());
}
if(("gMACK").equals(config.getCodeCode())){
ISOF.gMACK = ISOF.HexStr_Bytes(config.getCodeValue(),0);
map.put("gMACK",config.getCodeValue());
}
if(("gMACK_bak").equals(config.getCodeCode())){
ISOF.gMACK_bak = ISOF.HexStr_Bytes(config.getCodeValue(),0);
map.put("gMACK_bak",config.getCodeValue());
}
if(("gDateTime").equals(config.getCodeCode())){
ISOF.gDateTime = config.getCodeValue();
map.put("gDateTime",config.getCodeValue());
}
if(("gHSMIP").equals(config.getCodeCode())){
ISOF.gHSMIP = config.getCodeValue();
map.put("gHSMIP",config.getCodeValue());
}
if(("gHSMPORT").equals(config.getCodeCode())){
ISOF.gHSMPORT = config.getCodeValue();
map.put("gHSMPORT",config.getCodeValue());
}
if(("gTPDU").equals(config.getCodeCode())){
ISOF.gTPDU = config.getCodeValue();
map.put("gTPDU",config.getCodeValue());
}
if(("gHEAD").equals(config.getCodeCode())){
ISOF.gHEAD = config.getCodeValue();
map.put("gHEAD",config.getCodeValue());
}
if(("gTerminal_no").equals(config.getCodeCode())){
ISOF.gTerminal_no = config.getCodeValue();
map.put("gTerminal_no",config.getCodeValue());
}
if(("gMerct_no").equals(config.getCodeCode())){
ISOF.gMerct_no = config.getCodeValue();
map.put("gMerct_no",config.getCodeValue());
}
if(("gSys_no").equals(config.getCodeCode())){
ISOF.gSys_no = config.getCodeValue();
map.put("gSys_no",config.getCodeValue());
}
if(("gMoney_code").equals(config.getCodeCode())){
ISOF.gMoney_code = config.getCodeValue();
map.put("gMoney_code",config.getCodeValue());
}
if(("PRE_AUTH_OVER_TIME").equals(config.getCodeCode())){
Ylstatic.PRE_AUTH_OVER_TIME = config.getCodeValue();
map.put("PRE_AUTH_OVER_TIME",config.getCodeValue());
}
if(("PRE_AUTH_DEAL_TIME").equals(config.getCodeCode())){
Ylstatic.PRE_AUTH_DEAL_TIME = config.getCodeValue();
map.put("PRE_AUTH_DEAL_TIME",config.getCodeValue());
}
if(("HIGH_PRICE").equals(config.getCodeCode())){
Ylstatic.HIGH_PRICE = config.getCodeValue();
map.put("HIGH_PRICE",config.getCodeValue());
}
}
return map;
}
@Override
public void print8583Config(Map map) {
map.forEach((k, v) -> {
log.info(k+"===="+v);
});
}
@Override
public void update8583Config(Map map){
String gMACK = (String) map.get("gMACK");
String gMACKBak = (String) map.get("gMACK_bak");
String gDateTime = (String) map.get("gDateTime");
update("gMACK",gMACK);
update("gMACK_bak",gMACKBak);
update("gDateTime",gDateTime);
}
private void update(String name,String value){
QueryWrapper<YlOptionConfig> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("CODE_GROUP","8583_LOGIN");
queryWrapper.eq("CODE_CODE",name);
YlOptionConfig ylOptionConfig = this.getOne(queryWrapper);
ylOptionConfig.setCodeValue(value);
ylOptionConfig.updateById();
}
}
| 4,798 | 0.576859 | 0.570802 | 131 | 35.549618 | 25.376617 | 131 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.656489 | false | false | 3 |
469384a23cff454f705f849ea6bd98d6ee02a263 | 6,597,069,810,585 | 5cc7624a7dd1c2adcccefafb3f416a283226fb54 | /src/5/HttpServletResponse的应用/创建响应正文/AttachmentServlet.java | c4d2f09f625bbf98e39b9c8c92f49f2fd4cf2197 | [] | no_license | Reveur000/JavaWeb---CoreFoundation | https://github.com/Reveur000/JavaWeb---CoreFoundation | d1c7dade69c6c5e5d2ffe285e962d52d71c6059d | 26a30a94797d17b6eb12a747ee6a85efad38263c | refs/heads/master | 2019-01-13T10:12:23.130000 | 2017-07-23T14:06:15 | 2017-07-23T14:06:15 | 95,306,423 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* Created by root on 7/7/17.
* 利用 ServletOutputStream实现 动态文件内容的下载
* 直接将需要输出的字节流,交给ServletOutputStream去write即可。
*/
public class AttachmentServlet extends HttpServlet {
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.setContentType("text/plain");
resp.addHeader("Content-Disposition","attachment;filename=reveur.txt");
ServletOutputStream sos=resp.getOutputStream();
sos.write("this is reveur!".getBytes());//假设这个是动态的字节流。
sos.close();
}
}
| UTF-8 | Java | 905 | java | AttachmentServlet.java | Java | [
{
"context": "se;\nimport java.io.IOException;\n\n/**\n * Created by root on 7/7/17.\n * 利用 ServletOutputStream实现 动态文件内容的下载\n",
"end": 264,
"score": 0.9918328523635864,
"start": 260,
"tag": "USERNAME",
"value": "root"
}
] | null | [] | import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* Created by root on 7/7/17.
* 利用 ServletOutputStream实现 动态文件内容的下载
* 直接将需要输出的字节流,交给ServletOutputStream去write即可。
*/
public class AttachmentServlet extends HttpServlet {
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.setContentType("text/plain");
resp.addHeader("Content-Disposition","attachment;filename=reveur.txt");
ServletOutputStream sos=resp.getOutputStream();
sos.write("this is reveur!".getBytes());//假设这个是动态的字节流。
sos.close();
}
}
| 905 | 0.760684 | 0.7558 | 23 | 34.608696 | 27.616535 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.652174 | false | false | 3 |
91931ae3f33369950e683a62931d5ce1204a1965 | 14,972,255,994,623 | 7b0d06e81ee35a7973c7d9c717b41df96c13765d | /src/jp/kmats/aoj/ITP1/ITP1_5_D.java | 9bfb19ae33d50ebaf5b3419cc647343ef1139e3a | [] | no_license | k-mats/aoj | https://github.com/k-mats/aoj | d871ab64e77be89030dd6007f137585e43a459ec | e5bdebe04159c52e92ae621c7da4e6645c47aede | refs/heads/master | 2021-01-17T10:59:28.667000 | 2016-07-28T17:59:52 | 2016-07-28T17:59:52 | 64,417,135 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package jp.kmats.aoj.ITP1;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.stream.IntStream;
public class ITP1_5_D {
public static void main(String[] args) throws Exception {
try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
int n = Integer.parseInt(br.readLine());
IntStream.range(1, n + 1)
.filter(i -> i % 3 == 0 || String.valueOf(i).contains("3"))
.forEach(i -> System.out.print(" " + i));
System.out.println();
}
}
}
| UTF-8 | Java | 591 | java | ITP1_5_D.java | Java | [] | null | [] | package jp.kmats.aoj.ITP1;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.stream.IntStream;
public class ITP1_5_D {
public static void main(String[] args) throws Exception {
try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
int n = Integer.parseInt(br.readLine());
IntStream.range(1, n + 1)
.filter(i -> i % 3 == 0 || String.valueOf(i).contains("3"))
.forEach(i -> System.out.print(" " + i));
System.out.println();
}
}
}
| 591 | 0.590525 | 0.576988 | 20 | 28.549999 | 26.989767 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 15 |
66d9e1491025c65f3d3969797d532c32ba18ba4e | 21,784,074,127,531 | c61a3c451c395eacc4e8a10c12d4e759b200cd8a | /src/com/sim/Query.java | 12610dd562b16f01ed71e4add5098cf3bb697635 | [] | no_license | hbwzhsh/SampleSearch | https://github.com/hbwzhsh/SampleSearch | e8ec6efc3fc9033af29de3aca953adef0225858a | 2bee5f637f2057461c6dc748f09e12c66c4f9a84 | refs/heads/master | 2021-01-23T23:25:51.131000 | 2015-12-16T08:24:13 | 2015-12-16T08:24:13 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.sim;
import java.util.ArrayList;
import java.util.List;
import org.ansj.domain.Term;
public class Query implements Comparable<Object>{
String query = new String();
String result = new String();
List<Term> querylist = new ArrayList<Term>();
double src;
public String getQuery() {
return query;
}
public void setQuery(String query) {
this.query = query;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
public List<Term> getQuerylist() {
return querylist;
}
public void setQuerylist(List<Term> querylist) {
this.querylist = querylist;
}
public double getSrc() {
return src;
}
public void setSrc(double src) {
this.src = src;
}
@Override
public int compareTo(Object o) {
// TODO Auto-generated method stub
Query q = (Query)o;
if(this.getSrc() > q.getSrc())return -1;
else if(this.getSrc() == q.getSrc())return 0;
return 1;
}
}
| UTF-8 | Java | 949 | java | Query.java | Java | [] | null | [] | package com.sim;
import java.util.ArrayList;
import java.util.List;
import org.ansj.domain.Term;
public class Query implements Comparable<Object>{
String query = new String();
String result = new String();
List<Term> querylist = new ArrayList<Term>();
double src;
public String getQuery() {
return query;
}
public void setQuery(String query) {
this.query = query;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
public List<Term> getQuerylist() {
return querylist;
}
public void setQuerylist(List<Term> querylist) {
this.querylist = querylist;
}
public double getSrc() {
return src;
}
public void setSrc(double src) {
this.src = src;
}
@Override
public int compareTo(Object o) {
// TODO Auto-generated method stub
Query q = (Query)o;
if(this.getSrc() > q.getSrc())return -1;
else if(this.getSrc() == q.getSrc())return 0;
return 1;
}
}
| 949 | 0.6902 | 0.687039 | 44 | 20.568182 | 15.039944 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.590909 | false | false | 15 |
cc7d4d1427f0f74c35e28bbef5638e34b2a03f09 | 17,411,797,428,817 | 4b728ff85bd1faeade2cc1b0290a6dbca67c4254 | /src/main/java/com/grappim/dto/UserDTO.java | 35d2ab0fe0c569874280578b821b88893d393150 | [] | no_license | Grigoriym/java-ee-jsp-test | https://github.com/Grigoriym/java-ee-jsp-test | 87e019f2c9569072975310cc5282905b6be3d7c8 | fbb2a9a9244e0bbcc6ddd67f645a0e2b73e621cb | refs/heads/master | 2018-11-23T01:10:19.974000 | 2018-09-13T12:00:34 | 2018-09-13T12:00:34 | 146,974,143 | 0 | 0 | null | false | 2018-09-13T11:58:02 | 2018-09-01T06:30:04 | 2018-09-10T05:41:37 | 2018-09-13T11:58:02 | 207 | 0 | 0 | 0 | Java | false | null | package com.grappim.dto;
import com.grappim.entity.User;
import java.util.UUID;
import javax.xml.bind.annotation.XmlRootElement;
import lombok.Getter;
import lombok.Setter;
/**
* IDE: IntelliJ IDEA Created by grigo on Sep, 10, 2018 Project: java-ee-jsp-test
*/
@XmlRootElement
public class UserDTO {
@Getter
@Setter
private String userId;
@Getter
@Setter
private String userName;
@Getter
@Setter
private String password;
@Getter
@Setter
private String userEmail;
public UserDTO(User user) {
if (user == null) {
return;
}
userId = user.getUserId();
userName = user.getUserName();
password = user.getPassword();
userEmail = user.getUserEmail();
}
public UserDTO() {
}
}
| UTF-8 | Java | 741 | java | UserDTO.java | Java | [
{
"context": "mbok.Setter;\n\n/**\n * IDE: IntelliJ IDEA Created by grigo on Sep, 10, 2018 Project: java-ee-jsp-test\n */\n\n@",
"end": 217,
"score": 0.8603165149688721,
"start": 212,
"tag": "USERNAME",
"value": "grigo"
},
{
"context": "Id = user.getUserId();\n userName = user.get... | null | [] | package com.grappim.dto;
import com.grappim.entity.User;
import java.util.UUID;
import javax.xml.bind.annotation.XmlRootElement;
import lombok.Getter;
import lombok.Setter;
/**
* IDE: IntelliJ IDEA Created by grigo on Sep, 10, 2018 Project: java-ee-jsp-test
*/
@XmlRootElement
public class UserDTO {
@Getter
@Setter
private String userId;
@Getter
@Setter
private String userName;
@Getter
@Setter
private String password;
@Getter
@Setter
private String userEmail;
public UserDTO(User user) {
if (user == null) {
return;
}
userId = user.getUserId();
userName = user.getUserName();
password = <PASSWORD>();
userEmail = user.getUserEmail();
}
public UserDTO() {
}
}
| 735 | 0.681511 | 0.673414 | 44 | 15.840909 | 15.989973 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.386364 | false | false | 15 |
16fe817cc9622cd0a6d6df8835d560d993aa5ddb | 9,466,107,964,950 | 1122c536511addbf356f067450ed4651e15fd398 | /solr/core/src/java/org/apache/solr/pkg/PackageListeningClassLoader.java | c10af0c2d292ab3905cb111648f0aa57f6a79264 | [
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-unicode",
"ANTLR-PD",
"Classpath-exception-2.0",
"CPL-1.0",
"LGPL-2.0-or-later",
"CC-BY-SA-3.0",
"CDDL-1.0",
"MIT",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-other-copyleft",
"LicenseRef-scancode-unknown-license-referen... | permissive | bruno-roustant/lucene-solr | https://github.com/bruno-roustant/lucene-solr | fe18dde7e21050a387fe82682944ee65a34a9ee1 | cea5a95a385111e4f56c6429330b3452b4d2fc1d | refs/heads/master | 2021-06-09T22:37:52.037000 | 2020-09-02T15:00:50 | 2020-09-02T15:00:50 | 135,414,555 | 0 | 2 | Apache-2.0 | true | 2021-05-27T14:51:18 | 2018-05-30T08:45:06 | 2020-09-02T15:01:02 | 2021-05-27T14:51:18 | 527,263 | 0 | 2 | 1 | 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.solr.pkg;
import org.apache.lucene.analysis.util.ResourceLoaderAware;
import org.apache.solr.common.MapWriter;
import org.apache.solr.common.SolrException;
import org.apache.solr.core.CoreContainer;
import org.apache.solr.core.PluginInfo;
import org.apache.solr.common.cloud.SolrClassLoader;
import org.apache.solr.core.SolrResourceLoader;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
/**
* A {@link SolrClassLoader} that is designed to listen to a set of packages.
* This class registers a listener for each package that is loaded through this.
* If any of those packages are updated, the onReload runnable is run
* */
public class PackageListeningClassLoader implements SolrClassLoader , PackageListeners.Listener {
private final CoreContainer coreContainer;
private final SolrResourceLoader coreResourceLoader;
private final Function<String, String> pkgVersionSupplier;
/** package name and the versions that we are tracking
*/
private Map<String ,PackageAPI.PkgVersion> packageVersions = new HashMap<>(1);
private final Runnable onReload;
public PackageListeningClassLoader(CoreContainer coreContainer,
SolrResourceLoader coreResourceLoader,
Function<String, String> pkgVersionSupplier,
Runnable onReload) {
this.coreContainer = coreContainer;
this.coreResourceLoader = coreResourceLoader;
this.pkgVersionSupplier = pkgVersionSupplier;
this.onReload = () -> {
packageVersions = new HashMap<>();
onReload.run();
};
}
@Override
public <T> T newInstance(String cname, Class<T> expectedType, String... subpackages) {
PluginInfo.ClassName cName = new PluginInfo.ClassName(cname);
if(cName.pkg == null){
return coreResourceLoader.newInstance(cname, expectedType, subpackages);
} else {
PackageLoader.Package.Version version = findPkgVersion(cName);
return applyResourceLoaderAware(version, version.getLoader().newInstance(cName.className, expectedType, subpackages));
}
}
private PackageLoader.Package.Version findPkgVersion(PluginInfo.ClassName cName) {
PackageLoader.Package.Version theVersion = coreContainer.getPackageLoader().getPackage(cName.pkg).getLatest(pkgVersionSupplier.apply(cName.pkg));
packageVersions.put(cName.pkg, theVersion.getPkgVersion());
return theVersion;
}
@Override
public MapWriter getPackageVersion(PluginInfo.ClassName cName) {
if (cName.pkg == null) return null;
PackageAPI.PkgVersion p = packageVersions.get(cName.pkg);
return p == null ? null : p::writeMap;
}
private <T> T applyResourceLoaderAware(PackageLoader.Package.Version version, T obj) {
if (obj instanceof ResourceLoaderAware) {
SolrResourceLoader.assertAwareCompatibility(ResourceLoaderAware.class, obj);
try {
((ResourceLoaderAware) obj).inform(version.getLoader());
return obj;
} catch (IOException e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
}
}
return obj;
}
@Override
@SuppressWarnings({"rawtypes"})
public <T> T newInstance(String cname, Class<T> expectedType, String[] subPackages, Class[] params, Object[] args) {
PluginInfo.ClassName cName = new PluginInfo.ClassName(cname);
if (cName.pkg == null) {
return coreResourceLoader.newInstance(cname, expectedType, subPackages, params, args);
} else {
PackageLoader.Package.Version version = findPkgVersion(cName);
return applyResourceLoaderAware(version, version.getLoader().newInstance(cName.className, expectedType, subPackages, params, args));
}
}
@Override
public <T> Class<? extends T> findClass(String cname, Class<T> expectedType) {
PluginInfo.ClassName cName = new PluginInfo.ClassName(cname);
if (cName.pkg == null) {
return coreResourceLoader.findClass(cname, expectedType);
} else {
PackageLoader.Package.Version version = findPkgVersion(cName);
return version.getLoader().findClass(cName.className, expectedType);
}
}
@Override
public String packageName() {
return null;
}
@Override
public PluginInfo pluginInfo() {
return null;
}
@Override
public void changed(PackageLoader.Package pkg, Ctx ctx) {
PackageAPI.PkgVersion currVer = packageVersions.get(pkg.name);
if (currVer == null) {
//not watching this
return;
}
String latestSupportedVersion = pkgVersionSupplier.apply(pkg.name);
if (latestSupportedVersion == null) {
//no specific version configured. use the latest
latestSupportedVersion = pkg.getLatest().getVersion();
}
if (Objects.equals(currVer.version, latestSupportedVersion)) {
//no need to update
return;
}
ctx.runLater(null, onReload);
}
}
| UTF-8 | Java | 6,127 | java | PackageListeningClassLoader.java | Java | [] | null | [] | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.solr.pkg;
import org.apache.lucene.analysis.util.ResourceLoaderAware;
import org.apache.solr.common.MapWriter;
import org.apache.solr.common.SolrException;
import org.apache.solr.core.CoreContainer;
import org.apache.solr.core.PluginInfo;
import org.apache.solr.common.cloud.SolrClassLoader;
import org.apache.solr.core.SolrResourceLoader;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
/**
* A {@link SolrClassLoader} that is designed to listen to a set of packages.
* This class registers a listener for each package that is loaded through this.
* If any of those packages are updated, the onReload runnable is run
* */
public class PackageListeningClassLoader implements SolrClassLoader , PackageListeners.Listener {
private final CoreContainer coreContainer;
private final SolrResourceLoader coreResourceLoader;
private final Function<String, String> pkgVersionSupplier;
/** package name and the versions that we are tracking
*/
private Map<String ,PackageAPI.PkgVersion> packageVersions = new HashMap<>(1);
private final Runnable onReload;
public PackageListeningClassLoader(CoreContainer coreContainer,
SolrResourceLoader coreResourceLoader,
Function<String, String> pkgVersionSupplier,
Runnable onReload) {
this.coreContainer = coreContainer;
this.coreResourceLoader = coreResourceLoader;
this.pkgVersionSupplier = pkgVersionSupplier;
this.onReload = () -> {
packageVersions = new HashMap<>();
onReload.run();
};
}
@Override
public <T> T newInstance(String cname, Class<T> expectedType, String... subpackages) {
PluginInfo.ClassName cName = new PluginInfo.ClassName(cname);
if(cName.pkg == null){
return coreResourceLoader.newInstance(cname, expectedType, subpackages);
} else {
PackageLoader.Package.Version version = findPkgVersion(cName);
return applyResourceLoaderAware(version, version.getLoader().newInstance(cName.className, expectedType, subpackages));
}
}
private PackageLoader.Package.Version findPkgVersion(PluginInfo.ClassName cName) {
PackageLoader.Package.Version theVersion = coreContainer.getPackageLoader().getPackage(cName.pkg).getLatest(pkgVersionSupplier.apply(cName.pkg));
packageVersions.put(cName.pkg, theVersion.getPkgVersion());
return theVersion;
}
@Override
public MapWriter getPackageVersion(PluginInfo.ClassName cName) {
if (cName.pkg == null) return null;
PackageAPI.PkgVersion p = packageVersions.get(cName.pkg);
return p == null ? null : p::writeMap;
}
private <T> T applyResourceLoaderAware(PackageLoader.Package.Version version, T obj) {
if (obj instanceof ResourceLoaderAware) {
SolrResourceLoader.assertAwareCompatibility(ResourceLoaderAware.class, obj);
try {
((ResourceLoaderAware) obj).inform(version.getLoader());
return obj;
} catch (IOException e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
}
}
return obj;
}
@Override
@SuppressWarnings({"rawtypes"})
public <T> T newInstance(String cname, Class<T> expectedType, String[] subPackages, Class[] params, Object[] args) {
PluginInfo.ClassName cName = new PluginInfo.ClassName(cname);
if (cName.pkg == null) {
return coreResourceLoader.newInstance(cname, expectedType, subPackages, params, args);
} else {
PackageLoader.Package.Version version = findPkgVersion(cName);
return applyResourceLoaderAware(version, version.getLoader().newInstance(cName.className, expectedType, subPackages, params, args));
}
}
@Override
public <T> Class<? extends T> findClass(String cname, Class<T> expectedType) {
PluginInfo.ClassName cName = new PluginInfo.ClassName(cname);
if (cName.pkg == null) {
return coreResourceLoader.findClass(cname, expectedType);
} else {
PackageLoader.Package.Version version = findPkgVersion(cName);
return version.getLoader().findClass(cName.className, expectedType);
}
}
@Override
public String packageName() {
return null;
}
@Override
public PluginInfo pluginInfo() {
return null;
}
@Override
public void changed(PackageLoader.Package pkg, Ctx ctx) {
PackageAPI.PkgVersion currVer = packageVersions.get(pkg.name);
if (currVer == null) {
//not watching this
return;
}
String latestSupportedVersion = pkgVersionSupplier.apply(pkg.name);
if (latestSupportedVersion == null) {
//no specific version configured. use the latest
latestSupportedVersion = pkg.getLatest().getVersion();
}
if (Objects.equals(currVer.version, latestSupportedVersion)) {
//no need to update
return;
}
ctx.runLater(null, onReload);
}
}
| 6,127 | 0.678309 | 0.677493 | 151 | 39.57616 | 33.139568 | 153 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.649007 | false | false | 15 |
dc18aecfd2ed9bc7fd677628dd3381bd14f242b4 | 21,363,167,340,008 | 2648cecc8939dab85bd4e1fe03e35f00806fe6b0 | /src/leetcode/_282_MoveZeros.java | d78e0cd44656a03cc885280ada976961e8453411 | [] | no_license | govijay/java_exercises | https://github.com/govijay/java_exercises | a60c98c5fe62f11d51d47a5b84dc2e7966deff80 | 9ad67bf4b1ff4a4f2ed60d50a645557d7f14f993 | refs/heads/master | 2020-12-06T10:55:03.860000 | 2020-01-08T01:00:59 | 2020-01-08T01:00:59 | 232,445,723 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package leetcode;
import java.util.Arrays;
public class _282_MoveZeros {
static int[] nums = {1,2,0,3,4,0,6};
public static void main(String[] args) {
moveZeros(nums);
System.out.println(Arrays.toString(nums));
}
private static void moveZeros(int[] nums) {
int i = 0;
for (int j = 0; j < nums.length ; j++) {
if(nums[j] != 0){
nums[i] = nums[j];
i++;
}
}
for (; i < nums.length; i++){
nums[i] = 0;
}
}
}
| UTF-8 | Java | 562 | java | _282_MoveZeros.java | Java | [] | null | [] | package leetcode;
import java.util.Arrays;
public class _282_MoveZeros {
static int[] nums = {1,2,0,3,4,0,6};
public static void main(String[] args) {
moveZeros(nums);
System.out.println(Arrays.toString(nums));
}
private static void moveZeros(int[] nums) {
int i = 0;
for (int j = 0; j < nums.length ; j++) {
if(nums[j] != 0){
nums[i] = nums[j];
i++;
}
}
for (; i < nums.length; i++){
nums[i] = 0;
}
}
}
| 562 | 0.450178 | 0.425267 | 35 | 15.057143 | 16.855593 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.542857 | false | false | 15 |
f2ebd8552ad4260fc8cba5e59ce2a59715df60db | 27,917,287,493,589 | ae97d366e7c93544a5c1dc0281a3a06b1d29dbb7 | /target/tomcat/work/Tomcat/localhost/_/org/apache/jsp/WEB_002dINF/front_002dend/jsp/library_jsp.java | c53ca6202c70f48a854b0d5c7ae6b026c08ee5da | [] | no_license | noobbear/bearbear | https://github.com/noobbear/bearbear | 0425142b703303356d97e13ff76cfc3ea45f7ea1 | d6f069fd450155756837e2140c7d5ffa327b8041 | refs/heads/master | 2020-03-27T22:04:44.237000 | 2018-09-03T12:43:07 | 2018-09-03T12:43:07 | 147,202,534 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/7.0.47
* Generated at: 2018-01-11 02:20:55 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp.WEB_002dINF.front_002dend.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class library_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems;
private javax.el.ExpressionFactory _el_expressionfactory;
private org.apache.tomcat.InstanceManager _jsp_instancemanager;
public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
return _jspx_dependants;
}
public void _jspInit() {
_005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
_jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
}
public void _jspDestroy() {
_005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems.release();
}
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException {
final javax.servlet.jsp.PageContext pageContext;
javax.servlet.http.HttpSession session = null;
final javax.servlet.ServletContext application;
final javax.servlet.ServletConfig config;
javax.servlet.jsp.JspWriter out = null;
final java.lang.Object page = this;
javax.servlet.jsp.JspWriter _jspx_out = null;
javax.servlet.jsp.PageContext _jspx_page_context = null;
try {
response.setContentType("text/html; charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("\r\n");
out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\r\n");
out.write("<meta name=\"viewport\"\r\n");
out.write("\tcontent=\"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no\">\r\n");
out.write("<title>题库</title>\r\n");
out.write("<style>\r\n");
out.write("#check-timuleft {\r\n");
out.write("\twidth: 200px;\r\n");
out.write("\tfloat: left;\r\n");
out.write("}\r\n");
out.write("</style>\r\n");
out.write("</head>\r\n");
out.write("<link rel=\"stylesheet\" href=\"/css/bootstrap.css\" />\r\n");
out.write("<link rel=\"stylesheet\" href=\"/css/base.css\" />\r\n");
out.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"/css/style.css\" />\r\n");
out.write("<script src=\"/js/bootstrap.min.js\" type=\"text/javascript\"\r\n");
out.write("\tcharset=\"utf-8\"></script>\r\n");
out.write("<script type=\"text/javascript\" src=\"/js/jquery-1.8.2.min.js\"></script>\r\n");
out.write("\t<body>\r\n");
out.write("\t\t<div id=\"header\"></div>\r\n");
out.write("\t\t<div style=\"margin-top: 60px;height: 745px;\" class=\"container\">\t\t\t\r\n");
out.write("\t\t\t<div class=\"row clearfix\">\r\n");
out.write("\t\t\t\t<div class=\"col-xs-8 column\">\t\t\t\t\r\n");
out.write("\t\t\t\t\t<div id=\"check-timu\">\r\n");
out.write("\t\t\t\t\t\t<input id=\"check-timuleft\" type=\"text\" class=\"form-control\" placeholder=\"输入题目编号或标题\" />\r\n");
out.write("\t\t\t\t\t\t<button type=\"submit\" class=\"btn btn-default\">查询</button>\r\n");
out.write("\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t\t\t\t\t\r\n");
out.write("<!--------------------------------------------------------------------------------------------------------------------------->\r\n");
out.write("<!--------------------------------------------------------------------------------------------------------------------------->\t\r\n");
out.write("<!--------------------------------------------------------------------------------------------------------------------------->\t\r\n");
out.write("\t\t\t\t\t<table class=\"table table-striped\" id=\"timu_table\">\r\n");
out.write("\t\t\t\t\t\t<thead>\r\n");
out.write("\t\t\t\t\t\t\t<tr>\r\n");
out.write("\t\t\t\t\t\t\t\t<th>\r\n");
out.write("\t\t\t\t\t\t\t\t\tPID\r\n");
out.write("\t\t\t\t\t\t\t\t</th>\t\t\t\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t\t\t\t<th>\r\n");
out.write("\t\t\t\t\t\t\t\t\t题目标题\r\n");
out.write("\t\t\t\t\t\t\t\t</th>\r\n");
out.write("\t\t\t\t\t\t\t\t<th>\r\n");
out.write("\t\t\t\t\t\t\t\t\t通过率\r\n");
out.write("\t\t\t\t\t\t\t\t</th>\r\n");
out.write("\t\t\t\t\t\t\t\t<th>\r\n");
out.write("\t\t\t\t\t\t\t\t\t通过/提交\r\n");
out.write("\t\t\t\t\t\t\t\t</th>\r\n");
out.write("\t\t\t\t\t\t\t\t<th>\r\n");
out.write("\t\t\t\t\t\t\t\t\t题目类型\r\n");
out.write("\t\t\t\t\t\t\t\t</th>\r\n");
out.write("\t\t\t\t\t\t\t</tr>\r\n");
out.write("\t\t\t\t\t\t</thead>\r\n");
out.write("\t\t\t\t\t\t<tbody>\r\n");
out.write("\t\t\t\t\t\t\t");
if (_jspx_meth_c_005fforEach_005f0(_jspx_page_context))
return;
out.write("\r\n");
out.write("\t\t\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t\t</tbody>\r\n");
out.write("\t\t\t\t\t</table>\r\n");
out.write("\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t<div id=\"pagetimu\">\r\n");
out.write("\t\t\t\t\t\t<ul class=\"pagination\">\r\n");
out.write("\t\t\t\t\t\t <li>\r\n");
out.write("\t\t\t\t\t\t <a href=\"#\" id=\"Previous\">\r\n");
out.write("\t\t\t\t\t\t <label class=\"glyphicon glyphicon-menu-left\"></label>\r\n");
out.write("\t\t\t\t\t\t </a>\r\n");
out.write("\t\t\t\t\t\t </li>\r\n");
out.write("\t\t\t\t\t\t <li><a href=\"#\">1</a></li>\r\n");
out.write("\t\t\t\t\t\t <li><a href=\"#\">2</a></li>\r\n");
out.write("\t\t\t\t\t\t <li><a href=\"#\">3</a></li>\r\n");
out.write("\t\t\t\t\t\t <li><a href=\"#\">4</a></li>\r\n");
out.write("\t\t\t\t\t\t <li><a href=\"#\">5</a></li>\r\n");
out.write("\t\t\t\t\t\t <li>\r\n");
out.write("\t\t\t\t\t\t <a href=\"#\"id=\"Next\">\r\n");
out.write("\t\t\t\t\t\t <label class=\"glyphicon glyphicon-menu-right\"></label>\r\n");
out.write("\t\t\t\t\t\t </a>\r\n");
out.write("\t\t\t\t\t\t </li>\r\n");
out.write("\t\t\t\t\t\t </ul>\r\n");
out.write("\t\t\t\t\t</div>\t\t\t\t\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t\r\n");
out.write("\t\t\t\t</div>\r\n");
out.write("\t\t\t\t<div class=\"col-xs-4 column\">\r\n");
out.write("\t\t\t\t\t<div class=\"panel-group\" id=\"panel-376353\">\r\n");
out.write("\t\t\t\t\t\t<div class=\"panel panel-default\">\r\n");
out.write("\t\t\t\t\t\t\t<div class=\"panel-heading\">\r\n");
out.write("\t\t\t\t\t\t\t\t<a class=\"panel-title\">全部题型</a>\r\n");
out.write("\t\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t\t<div class=\"panel-collapse collapse in\">\r\n");
out.write("\t\t\t\t\t\t\t\t<div class=\"panel-body\">\r\n");
out.write("\t\t\t\t\t\t\t\t\t<a href=\"/question/index\" id=\"timu\">题目</a>\r\n");
out.write("\t\t\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t\t\t<div class=\"panel-body\">\r\n");
out.write("\t\t\t\t\t\t\t\t\t<a href=\"/answer/getRecords\" id=\"status\">状态</a>\r\n");
out.write("\t\t\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t<div class=\"panel panel-default\">\r\n");
out.write("\t\t\t\t\t\t\t<div class=\"panel-heading\">\r\n");
out.write("\t\t\t\t\t\t\t\t<a class=\"panel-title\">字符串</a>\r\n");
out.write("\t\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t<div class=\"panel panel-default\">\r\n");
out.write("\t\t\t\t\t\t\t<div class=\"panel-heading\">\r\n");
out.write("\t\t\t\t\t\t\t\t<a class=\"panel-title\">数组</a>\r\n");
out.write("\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t<div class=\"panel panel-default\">\r\n");
out.write("\t\t\t\t\t\t\t<div class=\"panel-heading\">\r\n");
out.write("\t\t\t\t\t\t\t\t<a class=\"panel-title\">函数</a>\r\n");
out.write("\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t<div class=\"panel panel-default\">\r\n");
out.write("\t\t\t\t\t\t\t<div class=\"panel-heading\">\r\n");
out.write("\t\t\t\t\t\t\t\t<a class=\"panel-title\">指针</a>\r\n");
out.write("\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t<div class=\"panel panel-default\">\r\n");
out.write("\t\t\t\t\t\t\t<div class=\"panel-heading\">\r\n");
out.write("\t\t\t\t\t\t\t\t<a class=\"panel-title\">排序</a>\r\n");
out.write("\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t<div class=\"panel panel-default\">\r\n");
out.write("\t\t\t\t\t\t\t<div class=\"panel-heading\">\r\n");
out.write("\t\t\t\t\t\t\t\t<a class=\"panel-title\">回溯法</a>\r\n");
out.write("\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t<div class=\"panel panel-default\">\r\n");
out.write("\t\t\t\t\t\t\t<div class=\"panel-heading\">\r\n");
out.write("\t\t\t\t\t\t\t\t<a class=\"panel-title\">穷举法</a>\r\n");
out.write("\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t</div>\r\n");
out.write("\t\t\t</div>\r\n");
out.write("\t\t</div>\r\n");
out.write("\t\t<div id=\"footer\"></div>\r\n");
out.write("\t</body>\r\n");
out.write("\t\r\n");
out.write("\t<script>\r\n");
out.write("\t\t\r\n");
out.write("\t\t\r\n");
out.write("\t\t$(\"#header\").load('/html/header.html',function(data,status,xhr){});\r\n");
out.write("\t\t$(\"#footer\").load('/html/footer.html',function(data,status,xhr){});\r\n");
out.write("\t\t//默认全部关闭\r\n");
out.write("\t\t$(\".panel-body\").each(function(){\r\n");
out.write("\t\t\t$(this).slideUp();\r\n");
out.write("\t\t});\r\n");
out.write("\t\t$(\".panel-heading .panel-title\").each(function(){\r\n");
out.write("\t\t\t$(this).click(function(){\r\n");
out.write("\t\t\t\t//隐藏所有\r\n");
out.write("\t\t\t\t\t$(\".panel-body\").each(function(){\r\n");
out.write("\t\t\t\t\t\t$(this).slideUp();\r\n");
out.write("\t\t\t\t\t});\r\n");
out.write("\t\t\t\t$(this).parent().siblings().children().slideToggle();//自身隐藏或显示\r\n");
out.write("\t\t\t\t\r\n");
out.write("\t\t\t\t\r\n");
out.write("\t\t\t})\r\n");
out.write("\t\t});\t\t\r\n");
out.write("\t\t\t\r\n");
out.write(" $(\"#status_table tr:even\").css(\"background-color\", \"#37e95233\");\r\n");
out.write("\t</script>\r\n");
out.write("\t\r\n");
out.write("</html>");
} catch (java.lang.Throwable t) {
if (!(t instanceof javax.servlet.jsp.SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try { out.clearBuffer(); } catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
private boolean _jspx_meth_c_005fforEach_005f0(javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// c:forEach
org.apache.taglibs.standard.tag.rt.core.ForEachTag _jspx_th_c_005fforEach_005f0 = (org.apache.taglibs.standard.tag.rt.core.ForEachTag) _005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems.get(org.apache.taglibs.standard.tag.rt.core.ForEachTag.class);
_jspx_th_c_005fforEach_005f0.setPageContext(_jspx_page_context);
_jspx_th_c_005fforEach_005f0.setParent(null);
// /WEB-INF/front-end/jsp/library.jsp(59,7) name = items type = javax.el.ValueExpression reqTime = true required = false fragment = false deferredValue = true expectedTypeName = java.lang.Object deferredMethod = false methodSignature = null
_jspx_th_c_005fforEach_005f0.setItems(new org.apache.jasper.el.JspValueExpression("/WEB-INF/front-end/jsp/library.jsp(59,7) '${questions}'",_el_expressionfactory.createValueExpression(_jspx_page_context.getELContext(),"${questions}",java.lang.Object.class)).getValue(_jspx_page_context.getELContext()));
// /WEB-INF/front-end/jsp/library.jsp(59,7) name = var type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_c_005fforEach_005f0.setVar("question");
int[] _jspx_push_body_count_c_005fforEach_005f0 = new int[] { 0 };
try {
int _jspx_eval_c_005fforEach_005f0 = _jspx_th_c_005fforEach_005f0.doStartTag();
if (_jspx_eval_c_005fforEach_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
do {
out.write("\r\n");
out.write("\t\t\t\t\t\t\t<tr>\r\n");
out.write("\t\t\t\t\t\t\t\t<td>\r\n");
out.write("\t\t\t\t\t\t\t\t\t");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${question.questionId}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("\r\n");
out.write("\t\t\t\t\t\t\t\t</td>\r\n");
out.write("\t\t\t\t\t\t\t\t<td>\r\n");
out.write("\t\t\t\t\t\t\t\t\t<a href=\"/answer/index?id=");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${question.questionId}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("\" title=\"");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${question.questionTitle}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write('"');
out.write('>');
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${question.questionTitle}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</a>\r\n");
out.write("\t\t\t\t\t\t\t\t</td>\r\n");
out.write("\t\t\t\t\t\t\t\t<td>\r\n");
out.write("\t\t\t\t\t\t\t\t\t");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${ question.correctTimes}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write('/');
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${question.times }", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("\r\n");
out.write("\t\t\t\t\t\t\t\t</td>\r\n");
out.write("\t\t\t\t\t\t\t\t<td>\r\n");
out.write("\t\t\t\t\t\t\t\t\t");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${ question.correctTimes}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write('/');
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${question.times }", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("\r\n");
out.write("\t\t\t\t\t\t\t\t</td>\r\n");
out.write("\t\t\t\t\t\t\t\t<td>\r\n");
out.write("\t\t\t\t\t\t\t\t\t");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${question.type}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("\r\n");
out.write("\t\t\t\t\t\t\t\t</td>\r\n");
out.write("\t\t\t\t\t\t\t</tr>\t\r\n");
out.write("\t\t\t\t\t\t\t");
int evalDoAfterBody = _jspx_th_c_005fforEach_005f0.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
}
if (_jspx_th_c_005fforEach_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
return true;
}
} catch (java.lang.Throwable _jspx_exception) {
while (_jspx_push_body_count_c_005fforEach_005f0[0]-- > 0)
out = _jspx_page_context.popBody();
_jspx_th_c_005fforEach_005f0.doCatch(_jspx_exception);
} finally {
_jspx_th_c_005fforEach_005f0.doFinally();
_005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems.reuse(_jspx_th_c_005fforEach_005f0);
}
return false;
}
}
| UTF-8 | Java | 18,715 | java | library_jsp.java | Java | [] | null | [] | /*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/7.0.47
* Generated at: 2018-01-11 02:20:55 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp.WEB_002dINF.front_002dend.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class library_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems;
private javax.el.ExpressionFactory _el_expressionfactory;
private org.apache.tomcat.InstanceManager _jsp_instancemanager;
public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
return _jspx_dependants;
}
public void _jspInit() {
_005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
_jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
}
public void _jspDestroy() {
_005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems.release();
}
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException {
final javax.servlet.jsp.PageContext pageContext;
javax.servlet.http.HttpSession session = null;
final javax.servlet.ServletContext application;
final javax.servlet.ServletConfig config;
javax.servlet.jsp.JspWriter out = null;
final java.lang.Object page = this;
javax.servlet.jsp.JspWriter _jspx_out = null;
javax.servlet.jsp.PageContext _jspx_page_context = null;
try {
response.setContentType("text/html; charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("\r\n");
out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\r\n");
out.write("<meta name=\"viewport\"\r\n");
out.write("\tcontent=\"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no\">\r\n");
out.write("<title>题库</title>\r\n");
out.write("<style>\r\n");
out.write("#check-timuleft {\r\n");
out.write("\twidth: 200px;\r\n");
out.write("\tfloat: left;\r\n");
out.write("}\r\n");
out.write("</style>\r\n");
out.write("</head>\r\n");
out.write("<link rel=\"stylesheet\" href=\"/css/bootstrap.css\" />\r\n");
out.write("<link rel=\"stylesheet\" href=\"/css/base.css\" />\r\n");
out.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"/css/style.css\" />\r\n");
out.write("<script src=\"/js/bootstrap.min.js\" type=\"text/javascript\"\r\n");
out.write("\tcharset=\"utf-8\"></script>\r\n");
out.write("<script type=\"text/javascript\" src=\"/js/jquery-1.8.2.min.js\"></script>\r\n");
out.write("\t<body>\r\n");
out.write("\t\t<div id=\"header\"></div>\r\n");
out.write("\t\t<div style=\"margin-top: 60px;height: 745px;\" class=\"container\">\t\t\t\r\n");
out.write("\t\t\t<div class=\"row clearfix\">\r\n");
out.write("\t\t\t\t<div class=\"col-xs-8 column\">\t\t\t\t\r\n");
out.write("\t\t\t\t\t<div id=\"check-timu\">\r\n");
out.write("\t\t\t\t\t\t<input id=\"check-timuleft\" type=\"text\" class=\"form-control\" placeholder=\"输入题目编号或标题\" />\r\n");
out.write("\t\t\t\t\t\t<button type=\"submit\" class=\"btn btn-default\">查询</button>\r\n");
out.write("\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t\t\t\t\t\r\n");
out.write("<!--------------------------------------------------------------------------------------------------------------------------->\r\n");
out.write("<!--------------------------------------------------------------------------------------------------------------------------->\t\r\n");
out.write("<!--------------------------------------------------------------------------------------------------------------------------->\t\r\n");
out.write("\t\t\t\t\t<table class=\"table table-striped\" id=\"timu_table\">\r\n");
out.write("\t\t\t\t\t\t<thead>\r\n");
out.write("\t\t\t\t\t\t\t<tr>\r\n");
out.write("\t\t\t\t\t\t\t\t<th>\r\n");
out.write("\t\t\t\t\t\t\t\t\tPID\r\n");
out.write("\t\t\t\t\t\t\t\t</th>\t\t\t\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t\t\t\t<th>\r\n");
out.write("\t\t\t\t\t\t\t\t\t题目标题\r\n");
out.write("\t\t\t\t\t\t\t\t</th>\r\n");
out.write("\t\t\t\t\t\t\t\t<th>\r\n");
out.write("\t\t\t\t\t\t\t\t\t通过率\r\n");
out.write("\t\t\t\t\t\t\t\t</th>\r\n");
out.write("\t\t\t\t\t\t\t\t<th>\r\n");
out.write("\t\t\t\t\t\t\t\t\t通过/提交\r\n");
out.write("\t\t\t\t\t\t\t\t</th>\r\n");
out.write("\t\t\t\t\t\t\t\t<th>\r\n");
out.write("\t\t\t\t\t\t\t\t\t题目类型\r\n");
out.write("\t\t\t\t\t\t\t\t</th>\r\n");
out.write("\t\t\t\t\t\t\t</tr>\r\n");
out.write("\t\t\t\t\t\t</thead>\r\n");
out.write("\t\t\t\t\t\t<tbody>\r\n");
out.write("\t\t\t\t\t\t\t");
if (_jspx_meth_c_005fforEach_005f0(_jspx_page_context))
return;
out.write("\r\n");
out.write("\t\t\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t\t</tbody>\r\n");
out.write("\t\t\t\t\t</table>\r\n");
out.write("\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t<div id=\"pagetimu\">\r\n");
out.write("\t\t\t\t\t\t<ul class=\"pagination\">\r\n");
out.write("\t\t\t\t\t\t <li>\r\n");
out.write("\t\t\t\t\t\t <a href=\"#\" id=\"Previous\">\r\n");
out.write("\t\t\t\t\t\t <label class=\"glyphicon glyphicon-menu-left\"></label>\r\n");
out.write("\t\t\t\t\t\t </a>\r\n");
out.write("\t\t\t\t\t\t </li>\r\n");
out.write("\t\t\t\t\t\t <li><a href=\"#\">1</a></li>\r\n");
out.write("\t\t\t\t\t\t <li><a href=\"#\">2</a></li>\r\n");
out.write("\t\t\t\t\t\t <li><a href=\"#\">3</a></li>\r\n");
out.write("\t\t\t\t\t\t <li><a href=\"#\">4</a></li>\r\n");
out.write("\t\t\t\t\t\t <li><a href=\"#\">5</a></li>\r\n");
out.write("\t\t\t\t\t\t <li>\r\n");
out.write("\t\t\t\t\t\t <a href=\"#\"id=\"Next\">\r\n");
out.write("\t\t\t\t\t\t <label class=\"glyphicon glyphicon-menu-right\"></label>\r\n");
out.write("\t\t\t\t\t\t </a>\r\n");
out.write("\t\t\t\t\t\t </li>\r\n");
out.write("\t\t\t\t\t\t </ul>\r\n");
out.write("\t\t\t\t\t</div>\t\t\t\t\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t\r\n");
out.write("\t\t\t\t</div>\r\n");
out.write("\t\t\t\t<div class=\"col-xs-4 column\">\r\n");
out.write("\t\t\t\t\t<div class=\"panel-group\" id=\"panel-376353\">\r\n");
out.write("\t\t\t\t\t\t<div class=\"panel panel-default\">\r\n");
out.write("\t\t\t\t\t\t\t<div class=\"panel-heading\">\r\n");
out.write("\t\t\t\t\t\t\t\t<a class=\"panel-title\">全部题型</a>\r\n");
out.write("\t\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t\t<div class=\"panel-collapse collapse in\">\r\n");
out.write("\t\t\t\t\t\t\t\t<div class=\"panel-body\">\r\n");
out.write("\t\t\t\t\t\t\t\t\t<a href=\"/question/index\" id=\"timu\">题目</a>\r\n");
out.write("\t\t\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t\t\t<div class=\"panel-body\">\r\n");
out.write("\t\t\t\t\t\t\t\t\t<a href=\"/answer/getRecords\" id=\"status\">状态</a>\r\n");
out.write("\t\t\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t<div class=\"panel panel-default\">\r\n");
out.write("\t\t\t\t\t\t\t<div class=\"panel-heading\">\r\n");
out.write("\t\t\t\t\t\t\t\t<a class=\"panel-title\">字符串</a>\r\n");
out.write("\t\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t<div class=\"panel panel-default\">\r\n");
out.write("\t\t\t\t\t\t\t<div class=\"panel-heading\">\r\n");
out.write("\t\t\t\t\t\t\t\t<a class=\"panel-title\">数组</a>\r\n");
out.write("\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t<div class=\"panel panel-default\">\r\n");
out.write("\t\t\t\t\t\t\t<div class=\"panel-heading\">\r\n");
out.write("\t\t\t\t\t\t\t\t<a class=\"panel-title\">函数</a>\r\n");
out.write("\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t<div class=\"panel panel-default\">\r\n");
out.write("\t\t\t\t\t\t\t<div class=\"panel-heading\">\r\n");
out.write("\t\t\t\t\t\t\t\t<a class=\"panel-title\">指针</a>\r\n");
out.write("\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t<div class=\"panel panel-default\">\r\n");
out.write("\t\t\t\t\t\t\t<div class=\"panel-heading\">\r\n");
out.write("\t\t\t\t\t\t\t\t<a class=\"panel-title\">排序</a>\r\n");
out.write("\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t<div class=\"panel panel-default\">\r\n");
out.write("\t\t\t\t\t\t\t<div class=\"panel-heading\">\r\n");
out.write("\t\t\t\t\t\t\t\t<a class=\"panel-title\">回溯法</a>\r\n");
out.write("\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t<div class=\"panel panel-default\">\r\n");
out.write("\t\t\t\t\t\t\t<div class=\"panel-heading\">\r\n");
out.write("\t\t\t\t\t\t\t\t<a class=\"panel-title\">穷举法</a>\r\n");
out.write("\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t</div>\r\n");
out.write("\t\t\t</div>\r\n");
out.write("\t\t</div>\r\n");
out.write("\t\t<div id=\"footer\"></div>\r\n");
out.write("\t</body>\r\n");
out.write("\t\r\n");
out.write("\t<script>\r\n");
out.write("\t\t\r\n");
out.write("\t\t\r\n");
out.write("\t\t$(\"#header\").load('/html/header.html',function(data,status,xhr){});\r\n");
out.write("\t\t$(\"#footer\").load('/html/footer.html',function(data,status,xhr){});\r\n");
out.write("\t\t//默认全部关闭\r\n");
out.write("\t\t$(\".panel-body\").each(function(){\r\n");
out.write("\t\t\t$(this).slideUp();\r\n");
out.write("\t\t});\r\n");
out.write("\t\t$(\".panel-heading .panel-title\").each(function(){\r\n");
out.write("\t\t\t$(this).click(function(){\r\n");
out.write("\t\t\t\t//隐藏所有\r\n");
out.write("\t\t\t\t\t$(\".panel-body\").each(function(){\r\n");
out.write("\t\t\t\t\t\t$(this).slideUp();\r\n");
out.write("\t\t\t\t\t});\r\n");
out.write("\t\t\t\t$(this).parent().siblings().children().slideToggle();//自身隐藏或显示\r\n");
out.write("\t\t\t\t\r\n");
out.write("\t\t\t\t\r\n");
out.write("\t\t\t})\r\n");
out.write("\t\t});\t\t\r\n");
out.write("\t\t\t\r\n");
out.write(" $(\"#status_table tr:even\").css(\"background-color\", \"#37e95233\");\r\n");
out.write("\t</script>\r\n");
out.write("\t\r\n");
out.write("</html>");
} catch (java.lang.Throwable t) {
if (!(t instanceof javax.servlet.jsp.SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try { out.clearBuffer(); } catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
private boolean _jspx_meth_c_005fforEach_005f0(javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// c:forEach
org.apache.taglibs.standard.tag.rt.core.ForEachTag _jspx_th_c_005fforEach_005f0 = (org.apache.taglibs.standard.tag.rt.core.ForEachTag) _005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems.get(org.apache.taglibs.standard.tag.rt.core.ForEachTag.class);
_jspx_th_c_005fforEach_005f0.setPageContext(_jspx_page_context);
_jspx_th_c_005fforEach_005f0.setParent(null);
// /WEB-INF/front-end/jsp/library.jsp(59,7) name = items type = javax.el.ValueExpression reqTime = true required = false fragment = false deferredValue = true expectedTypeName = java.lang.Object deferredMethod = false methodSignature = null
_jspx_th_c_005fforEach_005f0.setItems(new org.apache.jasper.el.JspValueExpression("/WEB-INF/front-end/jsp/library.jsp(59,7) '${questions}'",_el_expressionfactory.createValueExpression(_jspx_page_context.getELContext(),"${questions}",java.lang.Object.class)).getValue(_jspx_page_context.getELContext()));
// /WEB-INF/front-end/jsp/library.jsp(59,7) name = var type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_c_005fforEach_005f0.setVar("question");
int[] _jspx_push_body_count_c_005fforEach_005f0 = new int[] { 0 };
try {
int _jspx_eval_c_005fforEach_005f0 = _jspx_th_c_005fforEach_005f0.doStartTag();
if (_jspx_eval_c_005fforEach_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
do {
out.write("\r\n");
out.write("\t\t\t\t\t\t\t<tr>\r\n");
out.write("\t\t\t\t\t\t\t\t<td>\r\n");
out.write("\t\t\t\t\t\t\t\t\t");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${question.questionId}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("\r\n");
out.write("\t\t\t\t\t\t\t\t</td>\r\n");
out.write("\t\t\t\t\t\t\t\t<td>\r\n");
out.write("\t\t\t\t\t\t\t\t\t<a href=\"/answer/index?id=");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${question.questionId}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("\" title=\"");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${question.questionTitle}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write('"');
out.write('>');
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${question.questionTitle}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</a>\r\n");
out.write("\t\t\t\t\t\t\t\t</td>\r\n");
out.write("\t\t\t\t\t\t\t\t<td>\r\n");
out.write("\t\t\t\t\t\t\t\t\t");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${ question.correctTimes}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write('/');
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${question.times }", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("\r\n");
out.write("\t\t\t\t\t\t\t\t</td>\r\n");
out.write("\t\t\t\t\t\t\t\t<td>\r\n");
out.write("\t\t\t\t\t\t\t\t\t");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${ question.correctTimes}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write('/');
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${question.times }", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("\r\n");
out.write("\t\t\t\t\t\t\t\t</td>\r\n");
out.write("\t\t\t\t\t\t\t\t<td>\r\n");
out.write("\t\t\t\t\t\t\t\t\t");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${question.type}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("\r\n");
out.write("\t\t\t\t\t\t\t\t</td>\r\n");
out.write("\t\t\t\t\t\t\t</tr>\t\r\n");
out.write("\t\t\t\t\t\t\t");
int evalDoAfterBody = _jspx_th_c_005fforEach_005f0.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
}
if (_jspx_th_c_005fforEach_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
return true;
}
} catch (java.lang.Throwable _jspx_exception) {
while (_jspx_push_body_count_c_005fforEach_005f0[0]-- > 0)
out = _jspx_page_context.popBody();
_jspx_th_c_005fforEach_005f0.doCatch(_jspx_exception);
} finally {
_jspx_th_c_005fforEach_005f0.doFinally();
_005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems.reuse(_jspx_th_c_005fforEach_005f0);
}
return false;
}
}
| 18,715 | 0.578089 | 0.561292 | 320 | 57.046875 | 45.572891 | 307 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.05625 | false | false | 15 |
f50cb4ce8bb3b655462430931eb15d190de235a2 | 11,682,311,112,757 | b8380ca9fc3dab2eb3661c64909d65b333d6ad1e | /1409/Emp.java | b3d791587c926cd4aa93fcb1d2eaa7ab11cf17be | [] | no_license | karannagpal/core-java | https://github.com/karannagpal/core-java | d3bd25d68bd7bead44ba7b95d9dbe3474221a8c6 | 71b570115e659978667a5c9cf4494d49fd6189e0 | refs/heads/master | 2020-04-15T22:14:28.339000 | 2018-12-29T05:30:29 | 2018-12-29T05:30:29 | 165,065,177 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pkg1409;
/**
*
* @author HP
*/
public class Emp {
int id, bsal;
double hra, da, epf, net;
String name;
public int getId()
{
return id;
}
public void setId(int id)
{
this.id = id;
}
public int getBsal()
{
return bsal;
}
public void setBsal(int bsal)
{
this.bsal = bsal;
}
public double getHra()
{
return hra;
}
public void setHra()
{
this.hra = bsal * 0.09;
}
public double getDa()
{
return da;
}
public void setDa()
{
this.da = bsal * 0.11;
}
public double getEpf()
{
return epf;
}
public void setEpf()
{
this.epf = bsal * 0.1;
}
public double getNet()
{
return net;
}
public void setNet()
{
this.net = bsal + hra + da - epf;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
}
| UTF-8 | Java | 1,060 | java | Emp.java | Java | [
{
"context": "package pkg1409;\n\n/**\n *\n * @author HP\n */\npublic class Emp {\n int id, bsal; \n dou",
"end": 38,
"score": 0.683350145816803,
"start": 36,
"tag": "USERNAME",
"value": "HP"
}
] | null | [] | package pkg1409;
/**
*
* @author HP
*/
public class Emp {
int id, bsal;
double hra, da, epf, net;
String name;
public int getId()
{
return id;
}
public void setId(int id)
{
this.id = id;
}
public int getBsal()
{
return bsal;
}
public void setBsal(int bsal)
{
this.bsal = bsal;
}
public double getHra()
{
return hra;
}
public void setHra()
{
this.hra = bsal * 0.09;
}
public double getDa()
{
return da;
}
public void setDa()
{
this.da = bsal * 0.11;
}
public double getEpf()
{
return epf;
}
public void setEpf()
{
this.epf = bsal * 0.1;
}
public double getNet()
{
return net;
}
public void setNet()
{
this.net = bsal + hra + da - epf;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
}
| 1,060 | 0.45283 | 0.441509 | 84 | 11.619047 | 11.013957 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.261905 | false | false | 15 |
0758fca8c2a3c592e2ccfc51860c4824e8f09007 | 24,051,816,869,771 | 3735fe30773d82ccdd7ff77d41b166b94cecc03b | /exercise-dp/src/factory/Creator.java | a58307bdc4046f48550244317c0f076721e3e711 | [] | no_license | keithmannock/SDP2016 | https://github.com/keithmannock/SDP2016 | 4f0860af2f46eb8ba866f06c5e7eb9812ddc3121 | bb5d9dbeccf4469e7d112368fde0af78d2d9de1c | refs/heads/master | 2017-12-04T06:14:07.994000 | 2016-06-06T13:06:04 | 2016-06-06T13:06:04 | 49,070,340 | 2 | 25 | null | null | null | null | null | null | null | null | null | null | null | null | null | package factory;
public interface Creator {
static Product getProduct() {
return getProduct("");
}
static Product getProduct(String s) {
return new ConcreteProduct(s);
}
}
| UTF-8 | Java | 207 | java | Creator.java | Java | [] | null | [] | package factory;
public interface Creator {
static Product getProduct() {
return getProduct("");
}
static Product getProduct(String s) {
return new ConcreteProduct(s);
}
}
| 207 | 0.628019 | 0.628019 | 12 | 16.25 | 15.621166 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 15 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.