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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
33c5353f293a921bc68da439d24b9905362fa9fa
| 23,922,967,844,806 |
3ca4256b1c6ea70f08fb414af36711a2f9ffca85
|
/User/src/main/java/transaction/service/impl/UserServiceImpl.java
|
7ff17ed4244b7384c914535fb89eef6e414f16be
|
[] |
no_license
|
ChenJie666/TransactionByAt
|
https://github.com/ChenJie666/TransactionByAt
|
8dc1c6f079e33dd27b644e5c16a480ff7bf223c3
|
8a7108d3bea715be3f1aeaa6f761b093e00a5e5a
|
refs/heads/master
| 2023-04-17T13:53:26.202000 | 2021-04-22T08:51:53 | 2021-04-22T08:51:53 | 359,518,865 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package transaction.service.impl;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import transaction.entities.User;
import transaction.mapper.UserMapper;
import transaction.service.UserService;
import java.io.IOException;
import static org.springframework.transaction.interceptor.TransactionAspectSupport.currentTransactionStatus;
/**
* @author CJ
* @date 2021/4/15 10:26
*/
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
@Override
public Boolean decreasePoints(Long userId, Long points) {
// TODO 扣减积分
UpdateWrapper<User> userUpdateWrapper = new UpdateWrapper<>();
userUpdateWrapper.eq("id", userId).setSql("points = points - " + points);
return update(null, userUpdateWrapper);
}
}
|
UTF-8
|
Java
| 1,003 |
java
|
UserServiceImpl.java
|
Java
|
[
{
"context": "Support.currentTransactionStatus;\n\n\n/**\n * @author CJ\n * @date 2021/4/15 10:26\n */\n@Service\npublic clas",
"end": 555,
"score": 0.9996113181114197,
"start": 553,
"tag": "USERNAME",
"value": "CJ"
}
] | null |
[] |
package transaction.service.impl;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import transaction.entities.User;
import transaction.mapper.UserMapper;
import transaction.service.UserService;
import java.io.IOException;
import static org.springframework.transaction.interceptor.TransactionAspectSupport.currentTransactionStatus;
/**
* @author CJ
* @date 2021/4/15 10:26
*/
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
@Override
public Boolean decreasePoints(Long userId, Long points) {
// TODO 扣减积分
UpdateWrapper<User> userUpdateWrapper = new UpdateWrapper<>();
userUpdateWrapper.eq("id", userId).setSql("points = points - " + points);
return update(null, userUpdateWrapper);
}
}
| 1,003 | 0.777889 | 0.766834 | 32 | 30.09375 | 31.143177 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.53125 | false | false |
0
|
70d7e4eda18269349d222b594fd6e25002c59ca7
| 26,731,876,459,447 |
e05c859694a6d7d3f15c5ef95db6c9f4848c8b24
|
/src/main/java/com/sensedia/api/platform/ui/SplashWindow.java
|
ff2b148821800a95ab5cc76042ab547ddecda9c5
|
[] |
no_license
|
ricardotakemura/lab7
|
https://github.com/ricardotakemura/lab7
|
48a14c4569746d00a26b07698a4d676cbdb3f8f3
|
3c477ba458647c811cd381c18e55ae4f0c9b4dff
|
refs/heads/main
| 2023-04-26T00:53:03.463000 | 2021-05-10T21:52:03 | 2021-05-10T21:52:03 | 366,177,531 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.sensedia.api.platform.ui;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
import javax.swing.JWindow;
public class SplashWindow extends JWindow {
private static final int THREE_SECONDS = 3000;
private static final String IMAGE_SPLASH = "/images/splash.jpg";
private static final int HEIGHT = 432;
private static final int WIDTH = 768;
private static final long serialVersionUID = 1L;
private BufferedImage splashImage;
private Dimension screenSize;
private AppFrame appFrame;
public SplashWindow(AppFrame appFrame) {
this.appFrame = appFrame;
screenSize = Toolkit.getDefaultToolkit().getScreenSize();
init();
}
private void init() {
try {
splashImage = ImageIO.read(getClass().getResourceAsStream(IMAGE_SPLASH));
setBounds((int) (screenSize.getWidth() - WIDTH) / 2, (int) (screenSize.getHeight() - HEIGHT) / 2, WIDTH,
HEIGHT);
} catch (Exception e) {
e.printStackTrace();
}
}
public void start() {
try {
setVisible(true);
Thread.sleep(THREE_SECONDS);
} catch (Exception e) {
e.printStackTrace();
} finally {
setVisible(false);
if (appFrame != null) {
appFrame.start();
}
}
}
@Override
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
g2d.drawImage(splashImage, 0, 0, this.getWidth(), this.getHeight(), 0, 0, splashImage.getWidth(),
splashImage.getHeight(), this);
}
}
|
UTF-8
|
Java
| 1,726 |
java
|
SplashWindow.java
|
Java
|
[] | null |
[] |
package com.sensedia.api.platform.ui;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
import javax.swing.JWindow;
public class SplashWindow extends JWindow {
private static final int THREE_SECONDS = 3000;
private static final String IMAGE_SPLASH = "/images/splash.jpg";
private static final int HEIGHT = 432;
private static final int WIDTH = 768;
private static final long serialVersionUID = 1L;
private BufferedImage splashImage;
private Dimension screenSize;
private AppFrame appFrame;
public SplashWindow(AppFrame appFrame) {
this.appFrame = appFrame;
screenSize = Toolkit.getDefaultToolkit().getScreenSize();
init();
}
private void init() {
try {
splashImage = ImageIO.read(getClass().getResourceAsStream(IMAGE_SPLASH));
setBounds((int) (screenSize.getWidth() - WIDTH) / 2, (int) (screenSize.getHeight() - HEIGHT) / 2, WIDTH,
HEIGHT);
} catch (Exception e) {
e.printStackTrace();
}
}
public void start() {
try {
setVisible(true);
Thread.sleep(THREE_SECONDS);
} catch (Exception e) {
e.printStackTrace();
} finally {
setVisible(false);
if (appFrame != null) {
appFrame.start();
}
}
}
@Override
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
g2d.drawImage(splashImage, 0, 0, this.getWidth(), this.getHeight(), 0, 0, splashImage.getWidth(),
splashImage.getHeight(), this);
}
}
| 1,726 | 0.728273 | 0.714368 | 63 | 26.396826 | 25.189152 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.079365 | false | false |
0
|
862ba9e00ebe054c1b50dca43f682d39e07379f3
| 30,528,627,589,575 |
9b0bdb366d19caefa2eccee188b08e5aa12fc632
|
/src/facturacion/JMenuGrupoPruebasTree.java
|
2b7925a6244117f7778baba07a393bae49e842e6
|
[] |
no_license
|
marcosguti/LabSolution
|
https://github.com/marcosguti/LabSolution
|
88003a501eaea2d9dd5233e13317f6780b4b6da4
|
01c1f34602d8e0a1774bf828158c6bf03df2989e
|
refs/heads/master
| 2021-01-01T05:26:50.856000 | 2016-04-11T03:46:58 | 2016-04-11T03:46:58 | 58,064,119 | 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 facturacion;
import controller.GrupoPruebasController;
import controller.PruebaController;
import static facturacion.Interfaz_principal.jDesktopPane1;
import hibernateUtil.BussinessException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
/**
*
* @author marcosguti
*/
public class JMenuGrupoPruebasTree extends JPopupMenu {
private static String prueba;
public JMenuGrupoPruebasTree(String Prueba) {
prueba = Prueba;
JMenuItem jMenuItem2 = new JMenuItem("Eliminar");
JMenuItem jMenuItem3 = new JMenuItem("Agregar Prueba");
JMenuItem jMenuItem = new JMenuItem("Modificar");
jMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItemActionPerformed(evt);
}
});
jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
try {
jMenuItem2ActionPerformed(evt);
} catch (BussinessException ex) {
Logger.getLogger(JMenuGrupoPruebasTree.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem3ActionPerformed(evt);
}
});
if (Interfaz_principal.jMenuItemPruebaNuevaPrueba.isEnabled()) {
this.add(jMenuItem3);
}
this.add(jMenuItem);
this.add(jMenuItem2);
}
private void jMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
Interfaz_GrupoPruebas interfaz_GrupoPruebas = new Interfaz_GrupoPruebas();
jDesktopPane1.add(interfaz_GrupoPruebas);
interfaz_GrupoPruebas.show();
}
private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) throws BussinessException {
int dialogButton = JOptionPane.YES_NO_OPTION;
int respuesta = JOptionPane.showConfirmDialog(null, "Desea Eliminar el elemento Seleccionado", "", dialogButton);
if (respuesta == 0) {
GrupoPruebasController grupoPruebasController = new GrupoPruebasController();
grupoPruebasController.delete(prueba);
Interfaz_principal.jScrollPane1.setViewportView(new TreeInterfazPrincipal());
}
}
private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {
Interfaz_Prueba interfaz_Prueba = new Interfaz_Prueba();
jDesktopPane1.add(interfaz_Prueba);
interfaz_Prueba.show();
}
// JOptionPane.showConfirmDialog (null, "Would You Like to Save your Previous Note First?","Warning",dialogButton);
}
|
UTF-8
|
Java
| 3,178 |
java
|
JMenuGrupoPruebasTree.java
|
Java
|
[
{
"context": "\nimport javax.swing.JPopupMenu;\n\n/**\n *\n * @author marcosguti\n */\npublic class JMenuGrupoPruebasTree extends JP",
"end": 599,
"score": 0.9988033175468445,
"start": 589,
"tag": "USERNAME",
"value": "marcosguti"
}
] | 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 facturacion;
import controller.GrupoPruebasController;
import controller.PruebaController;
import static facturacion.Interfaz_principal.jDesktopPane1;
import hibernateUtil.BussinessException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
/**
*
* @author marcosguti
*/
public class JMenuGrupoPruebasTree extends JPopupMenu {
private static String prueba;
public JMenuGrupoPruebasTree(String Prueba) {
prueba = Prueba;
JMenuItem jMenuItem2 = new JMenuItem("Eliminar");
JMenuItem jMenuItem3 = new JMenuItem("Agregar Prueba");
JMenuItem jMenuItem = new JMenuItem("Modificar");
jMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItemActionPerformed(evt);
}
});
jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
try {
jMenuItem2ActionPerformed(evt);
} catch (BussinessException ex) {
Logger.getLogger(JMenuGrupoPruebasTree.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem3ActionPerformed(evt);
}
});
if (Interfaz_principal.jMenuItemPruebaNuevaPrueba.isEnabled()) {
this.add(jMenuItem3);
}
this.add(jMenuItem);
this.add(jMenuItem2);
}
private void jMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
Interfaz_GrupoPruebas interfaz_GrupoPruebas = new Interfaz_GrupoPruebas();
jDesktopPane1.add(interfaz_GrupoPruebas);
interfaz_GrupoPruebas.show();
}
private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) throws BussinessException {
int dialogButton = JOptionPane.YES_NO_OPTION;
int respuesta = JOptionPane.showConfirmDialog(null, "Desea Eliminar el elemento Seleccionado", "", dialogButton);
if (respuesta == 0) {
GrupoPruebasController grupoPruebasController = new GrupoPruebasController();
grupoPruebasController.delete(prueba);
Interfaz_principal.jScrollPane1.setViewportView(new TreeInterfazPrincipal());
}
}
private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {
Interfaz_Prueba interfaz_Prueba = new Interfaz_Prueba();
jDesktopPane1.add(interfaz_Prueba);
interfaz_Prueba.show();
}
// JOptionPane.showConfirmDialog (null, "Would You Like to Save your Previous Note First?","Warning",dialogButton);
}
| 3,178 | 0.679358 | 0.674638 | 86 | 35.953487 | 31.904985 | 134 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.569767 | false | false |
0
|
eb4fba759815ed1ba1d7ec23ae60b4ce48d88d6a
| 30,528,627,591,434 |
c73e911029cb8ddd703211be503cbc0af4fa56f5
|
/src/java/bean/Stagiaire.java
|
e0b1b03bc6f31272005887e91a351456474f0556
|
[] |
no_license
|
Safaeeljemli/projetPrefecture
|
https://github.com/Safaeeljemli/projetPrefecture
|
94355a9d48f7107402067d94751aa6920ebbe4ec
|
6bdb4c3a1174b5edfbd695028bc14cb9f5299982
|
refs/heads/master
| 2022-01-18T22:13:29.516000 | 2017-06-20T01:01:52 | 2017-06-20T01:01:52 | null | 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 bean;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
/**
*
* @author PC
*/
@Entity
public class Stagiaire implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String nom;
private String prenom;
private String cin;
private String mail;
private String numTel;
private int genre;
@Temporal(javax.persistence.TemporalType.DATE)
private Date dateDebut;
@Temporal(javax.persistence.TemporalType.DATE)
private Date dateFin;
@ManyToOne
private Ecole ecoleStagiaire;
@ManyToOne
private Domaine domaine;
@ManyToOne
private Employee encadrant;
@ManyToOne
private Stage stage;
@ManyToOne
private Departement departement;
public String getNom() {
return nom;
}
public void setNom(String nom) {
this.nom = nom;
}
public String getPrenom() {
return prenom;
}
public void setPrenom(String prenom) {
this.prenom = prenom;
}
public Departement getDepartement() {
return departement;
}
public void setDepartement(Departement departement) {
this.departement = departement;
}
public int getGenre() {
return genre;
}
public void setGenre(int genre) {
this.genre = genre;
}
public String getCin() {
return cin;
}
public void setCin(String cin) {
this.cin = cin;
}
public String getMail() {
return mail;
}
public void setMail(String mail) {
this.mail = mail;
}
public String getNumTel() {
return numTel;
}
public void setNumTel(String numTel) {
this.numTel = numTel;
}
public Date getDateDebut() {
return dateDebut;
}
public void setDateDebut(Date dateDebut) {
this.dateDebut = dateDebut;
}
public Date getDateFin() {
return dateFin;
}
public void setDateFin(Date dateFin) {
this.dateFin = dateFin;
}
public Ecole getEcoleStagiaire() {
return ecoleStagiaire;
}
public void setEcoleStagiaire(Ecole ecoleStagiaire) {
this.ecoleStagiaire = ecoleStagiaire;
}
public Domaine getDomaine() {
return domaine;
}
public void setDomaine(Domaine domaine) {
this.domaine = domaine;
}
public Employee getEncadrant() {
return encadrant;
}
public void setEncadrant(Employee encadrant) {
this.encadrant = encadrant;
}
public Stage getStage() {
return stage;
}
public void setStage(Stage stage) {
this.stage = stage;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Stagiaire)) {
return false;
}
Stagiaire other = (Stagiaire) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return nom;
}
}
|
UTF-8
|
Java
| 4,096 |
java
|
Stagiaire.java
|
Java
|
[
{
"context": "javax.persistence.Temporal;\r\n\r\n/**\r\n *\r\n * @author PC\r\n */\r\n@Entity\r\npublic class Stagiaire implements Se",
"end": 506,
"score": 0.994229793548584,
"start": 504,
"tag": "USERNAME",
"value": "PC"
}
] | 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 bean;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
/**
*
* @author PC
*/
@Entity
public class Stagiaire implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String nom;
private String prenom;
private String cin;
private String mail;
private String numTel;
private int genre;
@Temporal(javax.persistence.TemporalType.DATE)
private Date dateDebut;
@Temporal(javax.persistence.TemporalType.DATE)
private Date dateFin;
@ManyToOne
private Ecole ecoleStagiaire;
@ManyToOne
private Domaine domaine;
@ManyToOne
private Employee encadrant;
@ManyToOne
private Stage stage;
@ManyToOne
private Departement departement;
public String getNom() {
return nom;
}
public void setNom(String nom) {
this.nom = nom;
}
public String getPrenom() {
return prenom;
}
public void setPrenom(String prenom) {
this.prenom = prenom;
}
public Departement getDepartement() {
return departement;
}
public void setDepartement(Departement departement) {
this.departement = departement;
}
public int getGenre() {
return genre;
}
public void setGenre(int genre) {
this.genre = genre;
}
public String getCin() {
return cin;
}
public void setCin(String cin) {
this.cin = cin;
}
public String getMail() {
return mail;
}
public void setMail(String mail) {
this.mail = mail;
}
public String getNumTel() {
return numTel;
}
public void setNumTel(String numTel) {
this.numTel = numTel;
}
public Date getDateDebut() {
return dateDebut;
}
public void setDateDebut(Date dateDebut) {
this.dateDebut = dateDebut;
}
public Date getDateFin() {
return dateFin;
}
public void setDateFin(Date dateFin) {
this.dateFin = dateFin;
}
public Ecole getEcoleStagiaire() {
return ecoleStagiaire;
}
public void setEcoleStagiaire(Ecole ecoleStagiaire) {
this.ecoleStagiaire = ecoleStagiaire;
}
public Domaine getDomaine() {
return domaine;
}
public void setDomaine(Domaine domaine) {
this.domaine = domaine;
}
public Employee getEncadrant() {
return encadrant;
}
public void setEncadrant(Employee encadrant) {
this.encadrant = encadrant;
}
public Stage getStage() {
return stage;
}
public void setStage(Stage stage) {
this.stage = stage;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Stagiaire)) {
return false;
}
Stagiaire other = (Stagiaire) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return nom;
}
}
| 4,096 | 0.586426 | 0.585693 | 187 | 19.903744 | 18.276291 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.347594 | false | false |
0
|
b51d77f534d5461504606f11c19706e258085d19
| 2,353,642,078,929 |
30a85674a40e791a8336f1fe56dae50fea81a1ac
|
/src/main/java/oauthsample/proxy/LocalResource.java
|
d857dd20ca48a37fe80706135098fcc62b96821b
|
[] |
no_license
|
bejayoharen/oauth-experiments
|
https://github.com/bejayoharen/oauth-experiments
|
c00df28b3ed0ce57f126d379dbd465a580a636a5
|
92df0c45af213089d39f4f076de643b9c5a04b4e
|
refs/heads/master
| 2020-04-27T21:25:29.531000 | 2012-08-23T22:47:57 | 2012-08-23T22:47:57 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
*
*/
package oauthsample.proxy;
import java.util.HashMap;
import java.util.Map;
import oauthsample.Utils;
import org.json.JSONObject;
import org.restlet.data.MediaType;
import org.restlet.data.Reference;
import org.restlet.ext.json.JsonRepresentation;
import org.restlet.ext.oauth.OAuthServerResource;
import org.restlet.ext.oauth.OAuthUser;
import org.restlet.representation.Representation;
import org.restlet.representation.StringRepresentation;
import org.restlet.resource.ClientResource;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;
import org.restlet.security.User;
/**
* @author Martin Svensson
*
*/
public class LocalResource extends ServerResource{
@Get("html")
public Representation represent() throws Exception{
OAuthUser u = (OAuthUser) getRequest().getClientInfo().getUser();
String token = u.getAccessToken();
Reference meRef = new Reference("http://www.mellowtech.org:8095/protect/status");
meRef.addQueryParameter(OAuthServerResource.OAUTH_TOKEN, token);
String status = this.getQuery().getFirstValue("status");
if(status != null){
meRef.addQueryParameter("status", status);
}
ClientResource meResource = new ClientResource(getContext(),meRef);
Representation r = meResource.get(MediaType.APPLICATION_JSON);
JsonRepresentation meRepr = new JsonRepresentation(r);
getLogger().info("After Status Retrieval");
if(meResource.getResponse().getStatus().isSuccess()){
Map <String, Object> m = new HashMap <String, Object> ();
JSONObject obj = meRepr.getJsonObject();
getLogger().info(obj.toString(2));
getLogger().info(getContext().toString());
if(obj.has("old")) m.put("old", obj.get("old"));
if(obj.has("status")) m.put("status", obj.get("status"));
m.put("id", obj.get("id"));
meResource.getResponse().release();
meResource.release();
return Utils.generateFM(m, "status.html", getContext());
}
return null;
}
}
|
UTF-8
|
Java
| 2,099 |
java
|
LocalResource.java
|
Java
|
[
{
"context": "port org.restlet.security.User;\r\n\r\n/**\r\n * @author Martin Svensson\r\n *\r\n */\r\npublic class LocalResource extends Serv",
"end": 668,
"score": 0.9996752142906189,
"start": 653,
"tag": "NAME",
"value": "Martin Svensson"
}
] | null |
[] |
/**
*
*/
package oauthsample.proxy;
import java.util.HashMap;
import java.util.Map;
import oauthsample.Utils;
import org.json.JSONObject;
import org.restlet.data.MediaType;
import org.restlet.data.Reference;
import org.restlet.ext.json.JsonRepresentation;
import org.restlet.ext.oauth.OAuthServerResource;
import org.restlet.ext.oauth.OAuthUser;
import org.restlet.representation.Representation;
import org.restlet.representation.StringRepresentation;
import org.restlet.resource.ClientResource;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;
import org.restlet.security.User;
/**
* @author <NAME>
*
*/
public class LocalResource extends ServerResource{
@Get("html")
public Representation represent() throws Exception{
OAuthUser u = (OAuthUser) getRequest().getClientInfo().getUser();
String token = u.getAccessToken();
Reference meRef = new Reference("http://www.mellowtech.org:8095/protect/status");
meRef.addQueryParameter(OAuthServerResource.OAUTH_TOKEN, token);
String status = this.getQuery().getFirstValue("status");
if(status != null){
meRef.addQueryParameter("status", status);
}
ClientResource meResource = new ClientResource(getContext(),meRef);
Representation r = meResource.get(MediaType.APPLICATION_JSON);
JsonRepresentation meRepr = new JsonRepresentation(r);
getLogger().info("After Status Retrieval");
if(meResource.getResponse().getStatus().isSuccess()){
Map <String, Object> m = new HashMap <String, Object> ();
JSONObject obj = meRepr.getJsonObject();
getLogger().info(obj.toString(2));
getLogger().info(getContext().toString());
if(obj.has("old")) m.put("old", obj.get("old"));
if(obj.has("status")) m.put("status", obj.get("status"));
m.put("id", obj.get("id"));
meResource.getResponse().release();
meResource.release();
return Utils.generateFM(m, "status.html", getContext());
}
return null;
}
}
| 2,090 | 0.682706 | 0.680324 | 63 | 31.317461 | 24.117323 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.746032 | false | false |
0
|
1152ef5d44cf909cb8ee48de51af41bc22ecd3a3
| 30,537,217,493,242 |
82daf18e14285f2fa18a1af847794f0fc893fbf1
|
/ElenaSchoolDataAccess/src/co/com/elenaschooldataaccess/persistencia/contract/ICompetenciaDao.java
|
e1d016a5a1b388dd387f8878a4d71b824085ad63
|
[] |
no_license
|
adsalomo/myweb
|
https://github.com/adsalomo/myweb
|
8c3d1755e692f55b26cddf2f08b27beb504f4d8c
|
662ac022e9fb31b7912c7be576fafeb983f0f632
|
refs/heads/master
| 2020-05-21T14:57:50.980000 | 2017-05-01T17:39:06 | 2017-05-01T17:39:06 | 64,700,049 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package co.com.elenaschooldataaccess.persistencia.contract;
import co.com.elenaschoolmodel.model.CompetenciaModel;
import java.util.List;
/**
* Interface que define operaciones crud dao competencia
*
* @author AdrianL
* @version 1.0
* @created 17-ago-2016 08:38:30
*/
public interface ICompetenciaDao {
/**
*
* @param comp
*/
public boolean deleteCompetencia(CompetenciaModel comp);
/**
*
* @param compentencia
*/
public boolean insertCompetencia(CompetenciaModel compentencia);
/**
*
* @return
*/
public List<CompetenciaModel> readCompetencia();
/**
*
* @param comp
*/
public boolean updateCompetencia(CompetenciaModel comp);
}
|
UTF-8
|
Java
| 775 |
java
|
ICompetenciaDao.java
|
Java
|
[
{
"context": "e operaciones crud dao competencia\r\n *\r\n * @author AdrianL\r\n * @version 1.0\r\n * @created 17-ago-2016 08:38:3",
"end": 230,
"score": 0.9985687732696533,
"start": 223,
"tag": "NAME",
"value": "AdrianL"
}
] | null |
[] |
package co.com.elenaschooldataaccess.persistencia.contract;
import co.com.elenaschoolmodel.model.CompetenciaModel;
import java.util.List;
/**
* Interface que define operaciones crud dao competencia
*
* @author AdrianL
* @version 1.0
* @created 17-ago-2016 08:38:30
*/
public interface ICompetenciaDao {
/**
*
* @param comp
*/
public boolean deleteCompetencia(CompetenciaModel comp);
/**
*
* @param compentencia
*/
public boolean insertCompetencia(CompetenciaModel compentencia);
/**
*
* @return
*/
public List<CompetenciaModel> readCompetencia();
/**
*
* @param comp
*/
public boolean updateCompetencia(CompetenciaModel comp);
}
| 775 | 0.619355 | 0.60129 | 39 | 17.871796 | 20.840271 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.179487 | false | false |
0
|
bbbc30dfc1e282428ea90925206cd73fa8f95fd4
| 25,434,796,376,085 |
00c3e1ed02bc9802e195b249de0b7b3cb2ff8844
|
/app/src/main/java/itg8/com/labtestingapp/splash/CategoryModel.java
|
0e57a130176ca6346a0afa3e0747241c935f47bf
|
[] |
no_license
|
AndroidItg8/LabTestingRevised
|
https://github.com/AndroidItg8/LabTestingRevised
|
33c2b7341d51178a4f6742485494e57791840443
|
c01ab2673bea4ecdf82b2f486539ad77a33d2a3c
|
refs/heads/master
| 2020-05-14T14:06:11.901000 | 2019-05-26T20:16:32 | 2019-05-26T20:16:32 | 181,825,872 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package itg8.com.labtestingapp.splash;
import java.util.List;
import itg8.com.labtestingapp.db.tables.MainCategory;
import itg8.com.labtestingapp.db.tables.SubCategory;
import itg8.com.labtestingapp.db.tables.Test;
public class CategoryModel {
List<MainCategory> mainCategories;
List<SubCategory> subCategories;
List<Test> tests;
public List<MainCategory> getMainCategories() {
return mainCategories;
}
public void setMainCategories(List<MainCategory> mainCategories) {
this.mainCategories = mainCategories;
}
public List<SubCategory> getSubCategories() {
return subCategories;
}
public void setSubCategories(List<SubCategory> subCategories) {
this.subCategories = subCategories;
}
public List<Test> getTests() {
return tests;
}
public void setTests(List<Test> tests) {
this.tests = tests;
}
}
|
UTF-8
|
Java
| 913 |
java
|
CategoryModel.java
|
Java
|
[] | null |
[] |
package itg8.com.labtestingapp.splash;
import java.util.List;
import itg8.com.labtestingapp.db.tables.MainCategory;
import itg8.com.labtestingapp.db.tables.SubCategory;
import itg8.com.labtestingapp.db.tables.Test;
public class CategoryModel {
List<MainCategory> mainCategories;
List<SubCategory> subCategories;
List<Test> tests;
public List<MainCategory> getMainCategories() {
return mainCategories;
}
public void setMainCategories(List<MainCategory> mainCategories) {
this.mainCategories = mainCategories;
}
public List<SubCategory> getSubCategories() {
return subCategories;
}
public void setSubCategories(List<SubCategory> subCategories) {
this.subCategories = subCategories;
}
public List<Test> getTests() {
return tests;
}
public void setTests(List<Test> tests) {
this.tests = tests;
}
}
| 913 | 0.702081 | 0.6977 | 39 | 22.410257 | 21.640083 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.358974 | false | false |
0
|
9361c91a5a771b51b5eb36b5b612321da9e6b7b6
| 21,620,865,385,757 |
8d9e350f7c1bfdf14601e40f96eefd2676e002ae
|
/9-Testing/闫煜婷-171098043/HuluWa.java
|
c3715019068c43a231eae1efa303465a4115a39c
|
[] |
no_license
|
LDawns/java20-homework
|
https://github.com/LDawns/java20-homework
|
e6c9a45f2589ba5dd68fefe47fca6f2750ca7ab5
|
67651df88fb2234dc29a221d5360057775ba05e8
|
refs/heads/master
| 2023-05-13T20:02:45.878000 | 2021-06-02T11:38:05 | 2021-06-02T11:38:05 | 294,383,544 | 1 | 0 | null | true | 2020-09-10T10:57:33 | 2020-09-10T10:57:32 | 2020-09-10T08:10:49 | 2020-09-10T08:10:46 | 86 | 0 | 0 | 0 | null | false | false |
package homework9;
import java.util.Random;
enum Gender {
MALE, FEMALE;
public static Gender get(){
Random r = new Random();
return values()[r.nextInt(2)];
}
};
abstract class Creature{
String name;
abstract String getName();
};
public class HuluWa extends Creature implements Comparable<HuluWa>{
private int seniority;
private int pos;
private Gender gender;
HuluWa(int seniority, String name, int pos, Gender gender){
this.seniority = seniority;
this.name = name;
this.pos = pos;
this.gender = gender;
}
public static String genRandomName(){
Random r = new Random();
int namelen = r.nextInt(4) + 1;
String name = "";
for(int i = 0; i < namelen; ++i){
name += (char)(r.nextInt(26) + 'a');
}
return name;
}
public int getSeniority() {
return seniority;
}
public int getPos() {
return pos;
}
public String getName() {return name;}
public Gender getGender() {
return gender;
}
public void setPos(int pos) {
this.pos = pos;
}
public void tellName(){
System.out.print(this.name + " ");
}
@Override
public int compareTo(HuluWa h2){
return name.compareTo(h2.getName());
}
}
|
UTF-8
|
Java
| 1,341 |
java
|
HuluWa.java
|
Java
|
[] | null |
[] |
package homework9;
import java.util.Random;
enum Gender {
MALE, FEMALE;
public static Gender get(){
Random r = new Random();
return values()[r.nextInt(2)];
}
};
abstract class Creature{
String name;
abstract String getName();
};
public class HuluWa extends Creature implements Comparable<HuluWa>{
private int seniority;
private int pos;
private Gender gender;
HuluWa(int seniority, String name, int pos, Gender gender){
this.seniority = seniority;
this.name = name;
this.pos = pos;
this.gender = gender;
}
public static String genRandomName(){
Random r = new Random();
int namelen = r.nextInt(4) + 1;
String name = "";
for(int i = 0; i < namelen; ++i){
name += (char)(r.nextInt(26) + 'a');
}
return name;
}
public int getSeniority() {
return seniority;
}
public int getPos() {
return pos;
}
public String getName() {return name;}
public Gender getGender() {
return gender;
}
public void setPos(int pos) {
this.pos = pos;
}
public void tellName(){
System.out.print(this.name + " ");
}
@Override
public int compareTo(HuluWa h2){
return name.compareTo(h2.getName());
}
}
| 1,341 | 0.566741 | 0.56003 | 67 | 19.02985 | 16.630281 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.507463 | false | false |
0
|
ca3e4cd2fb6f2bafe048cda22126dccb7605cf5f
| 15,401,752,775,024 |
4c7536dc2c2cf5585fa30837cfef65d6cd847d09
|
/java-sample/src/main/java/org/lee/design/visitor/Main.java
|
4ec3f05d26bb11c77ec2b66fe0ad4c56ae00521e
|
[] |
no_license
|
liguofeng29/java-projects
|
https://github.com/liguofeng29/java-projects
|
272af66ee003bb3045794dc67068add02d4745fe
|
1705a60d19ea936e1157974e91fd3f4aa9fe9ba0
|
refs/heads/master
| 2021-09-11T19:22:00.387000 | 2018-04-11T12:01:07 | 2018-04-11T12:01:07 | 85,894,113 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.lee.design.visitor;
public class Main {
public static void main(String[] args) {
Directory rootDir = new Directory("root");
Directory dir1 = new Directory("dir1");
Directory dir2 = new Directory("dir2");
Directory dir3 = new Directory("dir3");
rootDir.add(dir1);
rootDir.add(dir2);
dir2.add(dir3);
dir1.add(new File("file1-1", 10));
dir1.add(new File("file1-2", 20));
dir2.add(new File("file2-1", 30));
dir3.add(new File("file3-1", 100));
System.out.println("サイズ:" + rootDir.getSize());
System.out.println("ディレクトリ構造:");
rootDir.accept(new EntryVisitor());
}
}
|
UTF-8
|
Java
| 749 |
java
|
Main.java
|
Java
|
[] | null |
[] |
package org.lee.design.visitor;
public class Main {
public static void main(String[] args) {
Directory rootDir = new Directory("root");
Directory dir1 = new Directory("dir1");
Directory dir2 = new Directory("dir2");
Directory dir3 = new Directory("dir3");
rootDir.add(dir1);
rootDir.add(dir2);
dir2.add(dir3);
dir1.add(new File("file1-1", 10));
dir1.add(new File("file1-2", 20));
dir2.add(new File("file2-1", 30));
dir3.add(new File("file3-1", 100));
System.out.println("サイズ:" + rootDir.getSize());
System.out.println("ディレクトリ構造:");
rootDir.accept(new EntryVisitor());
}
}
| 749 | 0.5574 | 0.514523 | 25 | 26.92 | 19.788725 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.76 | false | false |
0
|
cecbc55802c02bfd7e244c8e6ba188cd19e37ad5
| 28,827,820,532,102 |
b4f1087db435e5071bab65e463ad3b9c13441d56
|
/HibernateAssesment/StudentDriver.java
|
06995a0220ecba71be3d88a02d4784b99a56676b
|
[] |
no_license
|
jitu0510/assignments
|
https://github.com/jitu0510/assignments
|
2ae7820e800eacb77d532027ed0e309364dfd90f
|
026facd885fbc62a8e9d6c95919e8a55611eeef0
|
refs/heads/master
| 2023-08-12T14:23:51.372000 | 2021-10-05T04:57:58 | 2021-10-05T04:57:58 | 280,638,610 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.hibernate.dao;
import java.util.List;
import java.util.Scanner;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;
import javax.persistence.Query;
import com.hibernate.bean.Employee;
import com.hibernate.bean.Student;
/*
* Author@ Jitu Kumar Mandal
* */
public class StudentDriver {
//to display all the data
public static void displayAll() {
EntityManagerFactory factory=null;
EntityManager manager=null;
try {
factory=Persistence.createEntityManagerFactory("emp1");
manager=factory.createEntityManager();
String findAll="from Student";
Query query=manager.createQuery(findAll);
List<Student> list=query.getResultList();
System.out.println(list);
System.out.println("----------------------------");
for (Student student : list) {
System.out.println(student);
}
}catch(Exception e)
{
//
}finally {
factory.close();
manager.close();
}
}
//To verify an Id
public static boolean verifyId(int id) {
EntityManagerFactory factory=null;
EntityManager manager=null;
Student student=null;
//EntityTransaction transaction=null;
try {
factory=Persistence.createEntityManagerFactory("emp1");
manager=factory.createEntityManager();
student=manager.find(Student.class,id);
//System.out.println(student);
}catch (Exception e) {
//
}finally {
factory.close();
manager.close();
if(student==null)
return false;
else
return true;
}
}
//To Print one student details
public static void printData(int id)
{
EntityManagerFactory factory=null;
EntityManager manager=null;
//EntityTransaction transaction=null;
try {
factory=Persistence.createEntityManagerFactory("emp1");
manager=factory.createEntityManager();
Student student =manager.find(Student.class,id);
System.out.println(student);
}catch (Exception e) {
//
}finally {
factory.close();
manager.close();
}
}
//To set Student name
public static void setName(String name,int id)
{
EntityManagerFactory factory=null;
EntityManager manager=null;
EntityTransaction transaction=null;
try {
factory=Persistence.createEntityManagerFactory("emp1");
manager=factory.createEntityManager();
Student student=manager.find(Student.class, id);
student.setName(name);
transaction=manager.getTransaction();
transaction.begin();
manager.persist(student);
transaction.commit();
//System.out.println(employee.getDesignation());
}catch (Exception e) {
//
}finally {
factory.close();
manager.close();
}
}
//To Set Student phone Number
public static void setPhone(int phoneno,int id)
{
EntityManagerFactory factory=null;
EntityManager manager=null;
EntityTransaction transaction=null;
try {
factory=Persistence.createEntityManagerFactory("emp1");
manager=factory.createEntityManager();
Student student=manager.find(Student.class, id);
student.setPhoneno(phoneno);
transaction=manager.getTransaction();
transaction.begin();
manager.persist(student);
transaction.commit();
//System.out.println(employee.getDesignation());
}catch (Exception e) {
//
}finally {
factory.close();
manager.close();
}
}
//To Set Student Standard
public static void setStandard(String standard,int id)
{
EntityManagerFactory factory=null;
EntityManager manager=null;
EntityTransaction transaction=null;
try {
factory=Persistence.createEntityManagerFactory("emp1");
manager=factory.createEntityManager();
Student student=manager.find(Student.class, id);
student.setStandard(standard);
transaction=manager.getTransaction();
transaction.begin();
manager.persist(student);
transaction.commit();
//System.out.println(employee.getDesignation());
}catch (Exception e) {
//
}finally {
factory.close();
manager.close();
}
}
//To set New Id
public static void setId(int newId,int id)
{
EntityManagerFactory factory=null;
EntityManager manager=null;
EntityTransaction transaction=null;
try {
factory=Persistence.createEntityManagerFactory("emp1");
manager=factory.createEntityManager();
Student student=manager.find(Student.class, id);
String name=student.getName();
String standard=student.getStandard();
int phoneNo=student.getPhoneno();
Student student1 = new Student();
student1.setName(name);
student1.setRollno(newId);
student1.setPhoneno(phoneNo);
student1.setStandard(standard);
transaction=manager.getTransaction();
transaction.begin();
manager.persist(student1);
manager.remove(student);
transaction.commit();
//System.out.println(employee.getDesignation());
}catch (Exception e) {
e.printStackTrace();
}finally {
factory.close();
manager.close();
}
}
//To Delete a Student
public static void deleteStudent(int id)
{
EntityManagerFactory factory=null;
EntityManager manager=null;
EntityTransaction transaction=null;
//Employee employee=new Employee();
try {
factory=Persistence.createEntityManagerFactory("emp1");
manager=factory.createEntityManager();
transaction=manager.getTransaction();
Student student=manager.getReference(Student.class, id);
transaction.begin();
manager.remove(student);
transaction.commit();
}catch(Exception e)
{
//
}
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
boolean exit=false;
do {
System.out.println("Press 1 to see all data");
System.out.println("Press 2 to see any particular data");
System.out.println("Press 3 to update any particular data");
System.out.println("Press 4 to delete data");
System.out.println("Press 0 to Exit");
System.out.println("Select one option: ");
int option = scanner.nextInt();
switch (option) {
case 1:
displayAll();
break;
case 2:
System.out.println("Enter Id to get student information");
int id=scanner.nextInt();
boolean check = verifyId(id);
if(check==true) {
printData(id);
}else {
try {
throw new IdNotFoundException("Entered Id is Invalid");
}catch(Exception e) {
System.out.println(e.getMessage());
}
}
break;
case 3:
System.out.println("Enter Id to update student information");
int id1=scanner.nextInt();
boolean check1=verifyId(id1);
String name=null;
String standard=null;
int newId=0;
int phoneno=0;
if(check1==true) {
System.out.println("Do you want to update name(Y/N)");
char nameOption=scanner.next().charAt(0);
if(nameOption=='Y' || nameOption=='y') {
System.out.println("Enter new name");
name=scanner.next();
setName(name, id1);
}
System.out.println("Do you want to update phone number(Y/N)");
char phoneOption=scanner.next().charAt(0);
if(phoneOption=='Y' || phoneOption=='y') {
System.out.println("Enter new phone number");
phoneno =scanner.nextInt();
setPhone(phoneno,id1);
}
System.out.println("Do you want to update Standard(Y/N)");
char standardOption=scanner.next().charAt(0);
if(standardOption=='Y' || standardOption=='y') {
System.out.println("Enter new standard");
standard=scanner.next();
setStandard(standard,id1);
}
System.out.println("Do you want to update Roll Number(Y/N)");
char idOption=scanner.next().charAt(0);
if(idOption=='Y' || idOption=='y') {
System.out.println("Enter new Id");
newId=scanner.nextInt();
setId(newId,id1);
}
}else {
try {
throw new IdNotFoundException("Entered Id is Invalid");
}catch(Exception e) {
System.out.println(e.getMessage());
}
}
break;
case 4:
System.out.println("Enter Id to delete student information");
int id2=scanner.nextInt();
boolean check2=verifyId(id2);
if(check2==true)
{
deleteStudent(id2);
}else {
try {
throw new IdNotFoundException("Entered Id is Invalid");
}catch(Exception e) {
System.out.println(e.getMessage());
}
}
break;
case 0:
System.out.println("Thank You.....!!!!");
exit=true;
break;
default:
System.out.println("Please select a valid option...!!!");
break;
}
}while(!exit);
}
}
|
UTF-8
|
Java
| 8,654 |
java
|
StudentDriver.java
|
Java
|
[
{
"context": "import com.hibernate.bean.Student;\r\n/*\r\n * Author@ Jitu Kumar Mandal\r\n * */\r\n\r\npublic class StudentDriver {\r\n\r\n//to di",
"end": 396,
"score": 0.9998515248298645,
"start": 379,
"tag": "NAME",
"value": "Jitu Kumar Mandal"
},
{
"context": "ent student1 = new Student();\r\n\t\tstudent1.setName(name);\r\n\t\tstudent1.setRollno(newId);\r\n\t\tstudent1.setPh",
"end": 4537,
"score": 0.9937250018119812,
"start": 4533,
"tag": "NAME",
"value": "name"
}
] | null |
[] |
package com.hibernate.dao;
import java.util.List;
import java.util.Scanner;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;
import javax.persistence.Query;
import com.hibernate.bean.Employee;
import com.hibernate.bean.Student;
/*
* Author@ <NAME>
* */
public class StudentDriver {
//to display all the data
public static void displayAll() {
EntityManagerFactory factory=null;
EntityManager manager=null;
try {
factory=Persistence.createEntityManagerFactory("emp1");
manager=factory.createEntityManager();
String findAll="from Student";
Query query=manager.createQuery(findAll);
List<Student> list=query.getResultList();
System.out.println(list);
System.out.println("----------------------------");
for (Student student : list) {
System.out.println(student);
}
}catch(Exception e)
{
//
}finally {
factory.close();
manager.close();
}
}
//To verify an Id
public static boolean verifyId(int id) {
EntityManagerFactory factory=null;
EntityManager manager=null;
Student student=null;
//EntityTransaction transaction=null;
try {
factory=Persistence.createEntityManagerFactory("emp1");
manager=factory.createEntityManager();
student=manager.find(Student.class,id);
//System.out.println(student);
}catch (Exception e) {
//
}finally {
factory.close();
manager.close();
if(student==null)
return false;
else
return true;
}
}
//To Print one student details
public static void printData(int id)
{
EntityManagerFactory factory=null;
EntityManager manager=null;
//EntityTransaction transaction=null;
try {
factory=Persistence.createEntityManagerFactory("emp1");
manager=factory.createEntityManager();
Student student =manager.find(Student.class,id);
System.out.println(student);
}catch (Exception e) {
//
}finally {
factory.close();
manager.close();
}
}
//To set Student name
public static void setName(String name,int id)
{
EntityManagerFactory factory=null;
EntityManager manager=null;
EntityTransaction transaction=null;
try {
factory=Persistence.createEntityManagerFactory("emp1");
manager=factory.createEntityManager();
Student student=manager.find(Student.class, id);
student.setName(name);
transaction=manager.getTransaction();
transaction.begin();
manager.persist(student);
transaction.commit();
//System.out.println(employee.getDesignation());
}catch (Exception e) {
//
}finally {
factory.close();
manager.close();
}
}
//To Set Student phone Number
public static void setPhone(int phoneno,int id)
{
EntityManagerFactory factory=null;
EntityManager manager=null;
EntityTransaction transaction=null;
try {
factory=Persistence.createEntityManagerFactory("emp1");
manager=factory.createEntityManager();
Student student=manager.find(Student.class, id);
student.setPhoneno(phoneno);
transaction=manager.getTransaction();
transaction.begin();
manager.persist(student);
transaction.commit();
//System.out.println(employee.getDesignation());
}catch (Exception e) {
//
}finally {
factory.close();
manager.close();
}
}
//To Set Student Standard
public static void setStandard(String standard,int id)
{
EntityManagerFactory factory=null;
EntityManager manager=null;
EntityTransaction transaction=null;
try {
factory=Persistence.createEntityManagerFactory("emp1");
manager=factory.createEntityManager();
Student student=manager.find(Student.class, id);
student.setStandard(standard);
transaction=manager.getTransaction();
transaction.begin();
manager.persist(student);
transaction.commit();
//System.out.println(employee.getDesignation());
}catch (Exception e) {
//
}finally {
factory.close();
manager.close();
}
}
//To set New Id
public static void setId(int newId,int id)
{
EntityManagerFactory factory=null;
EntityManager manager=null;
EntityTransaction transaction=null;
try {
factory=Persistence.createEntityManagerFactory("emp1");
manager=factory.createEntityManager();
Student student=manager.find(Student.class, id);
String name=student.getName();
String standard=student.getStandard();
int phoneNo=student.getPhoneno();
Student student1 = new Student();
student1.setName(name);
student1.setRollno(newId);
student1.setPhoneno(phoneNo);
student1.setStandard(standard);
transaction=manager.getTransaction();
transaction.begin();
manager.persist(student1);
manager.remove(student);
transaction.commit();
//System.out.println(employee.getDesignation());
}catch (Exception e) {
e.printStackTrace();
}finally {
factory.close();
manager.close();
}
}
//To Delete a Student
public static void deleteStudent(int id)
{
EntityManagerFactory factory=null;
EntityManager manager=null;
EntityTransaction transaction=null;
//Employee employee=new Employee();
try {
factory=Persistence.createEntityManagerFactory("emp1");
manager=factory.createEntityManager();
transaction=manager.getTransaction();
Student student=manager.getReference(Student.class, id);
transaction.begin();
manager.remove(student);
transaction.commit();
}catch(Exception e)
{
//
}
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
boolean exit=false;
do {
System.out.println("Press 1 to see all data");
System.out.println("Press 2 to see any particular data");
System.out.println("Press 3 to update any particular data");
System.out.println("Press 4 to delete data");
System.out.println("Press 0 to Exit");
System.out.println("Select one option: ");
int option = scanner.nextInt();
switch (option) {
case 1:
displayAll();
break;
case 2:
System.out.println("Enter Id to get student information");
int id=scanner.nextInt();
boolean check = verifyId(id);
if(check==true) {
printData(id);
}else {
try {
throw new IdNotFoundException("Entered Id is Invalid");
}catch(Exception e) {
System.out.println(e.getMessage());
}
}
break;
case 3:
System.out.println("Enter Id to update student information");
int id1=scanner.nextInt();
boolean check1=verifyId(id1);
String name=null;
String standard=null;
int newId=0;
int phoneno=0;
if(check1==true) {
System.out.println("Do you want to update name(Y/N)");
char nameOption=scanner.next().charAt(0);
if(nameOption=='Y' || nameOption=='y') {
System.out.println("Enter new name");
name=scanner.next();
setName(name, id1);
}
System.out.println("Do you want to update phone number(Y/N)");
char phoneOption=scanner.next().charAt(0);
if(phoneOption=='Y' || phoneOption=='y') {
System.out.println("Enter new phone number");
phoneno =scanner.nextInt();
setPhone(phoneno,id1);
}
System.out.println("Do you want to update Standard(Y/N)");
char standardOption=scanner.next().charAt(0);
if(standardOption=='Y' || standardOption=='y') {
System.out.println("Enter new standard");
standard=scanner.next();
setStandard(standard,id1);
}
System.out.println("Do you want to update Roll Number(Y/N)");
char idOption=scanner.next().charAt(0);
if(idOption=='Y' || idOption=='y') {
System.out.println("Enter new Id");
newId=scanner.nextInt();
setId(newId,id1);
}
}else {
try {
throw new IdNotFoundException("Entered Id is Invalid");
}catch(Exception e) {
System.out.println(e.getMessage());
}
}
break;
case 4:
System.out.println("Enter Id to delete student information");
int id2=scanner.nextInt();
boolean check2=verifyId(id2);
if(check2==true)
{
deleteStudent(id2);
}else {
try {
throw new IdNotFoundException("Entered Id is Invalid");
}catch(Exception e) {
System.out.println(e.getMessage());
}
}
break;
case 0:
System.out.println("Thank You.....!!!!");
exit=true;
break;
default:
System.out.println("Please select a valid option...!!!");
break;
}
}while(!exit);
}
}
| 8,643 | 0.660735 | 0.655766 | 343 | 23.23032 | 18.061348 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.845481 | false | false |
0
|
423bf931f3069465202bb380aa61aa914aebd958
| 26,877,905,372,702 |
13005f6f9b834cc36e3e788d403ce3565488c2ad
|
/week-02/day-03/exercise-13/src/Main.java
|
88cae36ad0b60e505c0f0c80829e609bd0e01f25
|
[] |
no_license
|
greenfox-academy/tamasbrandstadter
|
https://github.com/greenfox-academy/tamasbrandstadter
|
007cd787ef996d0428e46616558ea96b019abec2
|
be601e684728ddcb1d3407e752c72b63a09fdb5e
|
refs/heads/master
| 2021-01-22T22:39:29.550000 | 2017-07-10T08:09:09 | 2017-07-10T08:09:09 | 85,564,297 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class Main {
public static void main(String[] args) {
int[][] numbers = new int[4][4];
numbers[0][0] = 1;
numbers[1][1] = 1;
numbers[2][2] = 1;
numbers[3][3] = 1;
for (int i = 0; i <numbers.length ; i++) {
for (int j = 0; j < numbers[i].length; j++) {
System.out.print(numbers[i][j]);
}
System.out.println();
}
}
}
|
UTF-8
|
Java
| 381 |
java
|
Main.java
|
Java
|
[] | null |
[] |
public class Main {
public static void main(String[] args) {
int[][] numbers = new int[4][4];
numbers[0][0] = 1;
numbers[1][1] = 1;
numbers[2][2] = 1;
numbers[3][3] = 1;
for (int i = 0; i <numbers.length ; i++) {
for (int j = 0; j < numbers[i].length; j++) {
System.out.print(numbers[i][j]);
}
System.out.println();
}
}
}
| 381 | 0.496063 | 0.454068 | 17 | 21.470589 | 16.539143 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.647059 | false | false |
0
|
99581f32b7e6a938200ed37d37cdbed520d99af4
| 17,617,955,896,214 |
443928d406ef51efd35020de050decd8151dae9b
|
/asn1-uper/src/test/java/net/gcdc/asn1/uper/UperEncoderTest.java
|
6a7fd4d784f172661a9b234bf3f2f9e515ddff91
|
[
"Apache-2.0"
] |
permissive
|
zyjohn0822/asn1-uper-v2x-se
|
https://github.com/zyjohn0822/asn1-uper-v2x-se
|
ad430889ca9f3d42f2c083810df2a5bc7b18ec22
|
85f9bf98a12a57a04260282a9154f1b988de8dec
|
refs/heads/master
| 2023-04-21T11:44:34.222000 | 2021-05-08T08:23:27 | 2021-05-08T08:23:27 | 365,459,042 | 2 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package net.gcdc.asn1.uper;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
public class UperEncoderTest {
@Test
public void testBin() {
String binString = "00010101"; // Length multiple of 8.
assertEquals(binString, UperEncoder.binaryStringFromBytes(UperEncoder.bytesFromBinaryString(binString)));
}
@Test
public void testHex() {
String hexString = "AABB00FF"; // Length multiple of 2.
assertEquals(hexString, UperEncoder.hexStringFromBytes(UperEncoder.bytesFromHexString((hexString))));
}
@Test(expected = IllegalArgumentException.class)
public void testOddLength() {
String hexString = "AAB";
UperEncoder.bytesFromHexString(hexString);
fail("Expected exception.");
}
}
|
UTF-8
|
Java
| 829 |
java
|
UperEncoderTest.java
|
Java
|
[] | null |
[] |
package net.gcdc.asn1.uper;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
public class UperEncoderTest {
@Test
public void testBin() {
String binString = "00010101"; // Length multiple of 8.
assertEquals(binString, UperEncoder.binaryStringFromBytes(UperEncoder.bytesFromBinaryString(binString)));
}
@Test
public void testHex() {
String hexString = "AABB00FF"; // Length multiple of 2.
assertEquals(hexString, UperEncoder.hexStringFromBytes(UperEncoder.bytesFromHexString((hexString))));
}
@Test(expected = IllegalArgumentException.class)
public void testOddLength() {
String hexString = "AAB";
UperEncoder.bytesFromHexString(hexString);
fail("Expected exception.");
}
}
| 829 | 0.698432 | 0.68275 | 28 | 28.607143 | 30.264711 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.464286 | false | false |
0
|
498ef3058ca71e3e62572bb6aeaef7a76db1000f
| 8,254,927,202,276 |
5a3cf424cad7052849ac2774ef1709b06dbba5c3
|
/src/main/java/com/mkaloshyn/javaio/chapter0304/myApp/repository/GenericRepository.java
|
a00f930546389bf47185e51cdc5543d0cf0d3fa8
|
[] |
no_license
|
MykhailoMike/MKaloshynChapter0304
|
https://github.com/MykhailoMike/MKaloshynChapter0304
|
fdc1fda84b0d2d629babfa5c675dca639270f9ba
|
24dde43afb63d8284a1a8f3e05ec37b8c1690d8e
|
refs/heads/master
| 2021-05-18T03:21:17.089000 | 2020-04-01T11:56:29 | 2020-04-01T11:56:29 | 251,080,640 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package main.java.com.mkaloshyn.javaio.chapter0304.myApp.repository;
import java.util.List;
public interface GenericRepository<T, ID> {
void getById(ID id);
List<T> getAll();
T createReport(String name, String status);
void save(T t);
void update(T t);
void deleteById(ID id);
}
|
UTF-8
|
Java
| 312 |
java
|
GenericRepository.java
|
Java
|
[
{
"context": "package main.java.com.mkaloshyn.javaio.chapter0304.myApp.repository;\n\nimport java",
"end": 31,
"score": 0.6930513978004456,
"start": 22,
"tag": "USERNAME",
"value": "mkaloshyn"
}
] | null |
[] |
package main.java.com.mkaloshyn.javaio.chapter0304.myApp.repository;
import java.util.List;
public interface GenericRepository<T, ID> {
void getById(ID id);
List<T> getAll();
T createReport(String name, String status);
void save(T t);
void update(T t);
void deleteById(ID id);
}
| 312 | 0.682692 | 0.669872 | 19 | 15.421053 | 19.462017 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.526316 | false | false |
0
|
555e8f1357c19e67a195d7aefe836a3c137621d7
| 8,847,632,692,514 |
d809d45f52ba389783edf9258be33b59da724a27
|
/src/ms/zui/checkNumber/checkNumber.java
|
9a0beb6c9da15e98bd48a350fe132ef2fcaf0b9e
|
[] |
no_license
|
litongyu/checkNumberRest
|
https://github.com/litongyu/checkNumberRest
|
636e537f6856cc8962f7612082f0926cf05d27b2
|
944f888459c66a102469537c62ec05ed283dab8a
|
refs/heads/master
| 2021-01-10T08:44:31.612000 | 2016-01-22T07:32:17 | 2016-01-22T07:32:17 | 52,362,629 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ms.zui.checkNumber;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import javax.servlet.http.HttpServletResponse;
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.ws.rs.core.MediaType;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.URI;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.struts2.ServletActionContext;
import com.google.gson.Gson;
@Path("/checkNumber")
public class checkNumber {
private static Map<String, String> map = new HashMap<String, String>();
/**
*
* @param url 应用地址,类似于http://ip:port/msg/
* @param account 账号
* @param pswd 密码
* @param mobile 手机号码,多个号码使用","分割
* @param msg 短信内容
* @param needstatus 是否需要状态报告,需要true,不需要false
* @return 返回值定义参见HTTP协议文档
* @throws Exception
*/
private String send(String url, String account, String pswd, String mobile, String msg,
boolean needstatus, String product, String extno) throws Exception {
HttpClient client = new HttpClient();
GetMethod method = new GetMethod();
try {
URI base = new URI(url, false);
method.setURI(new URI(base, "HttpSendSM", false));
method.setQueryString(new NameValuePair[] {
new NameValuePair("account", account),
new NameValuePair("pswd", pswd),
new NameValuePair("mobile", mobile),
new NameValuePair("needstatus", String.valueOf(needstatus)),
new NameValuePair("msg", msg),
new NameValuePair("product", product),
new NameValuePair("extno", extno),
});
int result = client.executeMethod(method);
if (result == HttpStatus.SC_OK) {
InputStream in = method.getResponseBodyAsStream();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int len = 0;
while ((len = in.read(buffer)) != -1) {
baos.write(buffer, 0, len);
}
return URLDecoder.decode(baos.toString(), "UTF-8");
} else {
throw new Exception("HTTP ERROR Status: " + method.getStatusCode() + ":" + method.getStatusText());
}
} finally {
method.releaseConnection();
}
}
/**
*
* @param url 应用地址,类似于http://ip:port/msg/
* @param account 账号
* @param pswd 密码
* @param mobile 手机号码,多个号码使用","分割
* @param msg 短信内容
* @param needstatus 是否需要状态报告,需要true,不需要false
* @return 返回值定义参见HTTP协议文档
* @throws Exception
*/
private String batchSend(String url, String account, String pswd, String mobile, String msg,
boolean needstatus, String product, String extno) throws Exception {
HttpClient client = new HttpClient();
GetMethod method = new GetMethod();
try {
URI base = new URI(url, false);
method.setURI(new URI(base, "HttpBatchSendSM", false));
method.setQueryString(new NameValuePair[] {
new NameValuePair("account", account),
new NameValuePair("pswd", pswd),
new NameValuePair("mobile", mobile),
new NameValuePair("needstatus", String.valueOf(needstatus)),
new NameValuePair("msg", msg),
new NameValuePair("product", product),
new NameValuePair("extno", extno),
});
int result = client.executeMethod(method);
if (result == HttpStatus.SC_OK) {
InputStream in = method.getResponseBodyAsStream();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int len = 0;
while ((len = in.read(buffer)) != -1) {
baos.write(buffer, 0, len);
}
return URLDecoder.decode(baos.toString(), "UTF-8");
} else {
throw new Exception("HTTP ERROR Status: " + method.getStatusCode() + ":" + method.getStatusText());
}
} finally {
method.releaseConnection();
}
}
/**
* 根据手机号生成验证码,然后发送短信
* @param phoneNumber
* @return
*/
@GET
@Path("/send/{phoneNumber}")
@Produces(MediaType.TEXT_PLAIN)
public String send(@PathParam("phoneNumber") String phoneNumber){
//生成随机数
Random random = new Random();
String result = "";
for(int i = 0; i < 6 ; i++){
result += random.nextInt(10);
}
map.put(phoneNumber, result);
//发送短信
String url = "http://222.73.117.158/msg/";// 应用地址
String account = "Zms888";// 账号
String pswd = "Aa123456";// 密码
String mobile = phoneNumber;// 手机号码,多个号码使用","分割
String msg = "亲爱的用户,您的验证码是" + map.get(phoneNumber) + ",5分钟内有效。";// 短信内容
boolean needstatus = true;// 是否需要状态报告,需要true,不需要false
String product = null;// 产品ID
String extno = null;// 扩展码
try {
String returnString = batchSend(url, account, pswd, mobile, msg, needstatus, product, extno);
System.out.println(returnString);
return "success";
// TODO 处理返回值,参见HTTP协议文档
} catch (Exception e) {
// TODO 处理异常
e.printStackTrace();
return "fail";
}
}
/**
* 校验验证码
* @param phoneNumber
* @param checkNumber
* @return
*/
@GET
@Path("/check/{phoneNumber}/{checkNumber}")
@Produces(MediaType.APPLICATION_JSON)
public String check(@PathParam("phoneNumber")String phoneNumber, @PathParam("checkNumber")String checkNumber, @Context HttpServletResponse response){
response.setHeader("Access-Control-Allow-Origin", "*");
Map<String, String> result = new HashMap<String, String>();
Gson gson = new Gson();
java.lang.reflect.Type type = new com.google.gson.reflect.TypeToken<Map<String, String>>() {
}.getType();
if(map.containsKey(phoneNumber)){
if(map.get(phoneNumber).equals(checkNumber)){
map.remove(phoneNumber);
result.put("result", "success");
return gson.toJson(result, type);
}
}
result.put("result", "fail");
return gson.toJson(result, type);
}
}
|
UTF-8
|
Java
| 6,294 |
java
|
checkNumber.java
|
Java
|
[
{
"context": "p:port/msg/\n\t * @param account 账号\n\t * @param pswd 密码\n\t * @param mobile 手机号码,多个号码使用\",\"分割\n\t * @param msg",
"end": 996,
"score": 0.7406294345855713,
"start": 994,
"tag": "PASSWORD",
"value": "密码"
},
{
"context": "p:port/msg/\n\t * @param account 账号\n\t * @param pswd 密码\n\t * @param mobile 手机号码,多个号码使用\",\"分割\n\t * @param msg",
"end": 2520,
"score": 0.982954740524292,
"start": 2518,
"tag": "PASSWORD",
"value": "密码"
},
{
"context": "/222.73.117.158/msg/\";// 应用地址\n\t\tString account = \"Zms888\";// 账号\n\t\tString pswd = \"Aa123456\";// 密码\n\t\tString ",
"end": 4425,
"score": 0.7430103421211243,
"start": 4419,
"tag": "USERNAME",
"value": "Zms888"
},
{
"context": "\tString account = \"Zms888\";// 账号\n\t\tString pswd = \"Aa123456\";// 密码\n\t\tString mobile = phoneNumber;// 手机号码,多个号码",
"end": 4458,
"score": 0.9934228658676147,
"start": 4450,
"tag": "PASSWORD",
"value": "Aa123456"
}
] | null |
[] |
package ms.zui.checkNumber;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import javax.servlet.http.HttpServletResponse;
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.ws.rs.core.MediaType;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.URI;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.struts2.ServletActionContext;
import com.google.gson.Gson;
@Path("/checkNumber")
public class checkNumber {
private static Map<String, String> map = new HashMap<String, String>();
/**
*
* @param url 应用地址,类似于http://ip:port/msg/
* @param account 账号
* @param pswd 密码
* @param mobile 手机号码,多个号码使用","分割
* @param msg 短信内容
* @param needstatus 是否需要状态报告,需要true,不需要false
* @return 返回值定义参见HTTP协议文档
* @throws Exception
*/
private String send(String url, String account, String pswd, String mobile, String msg,
boolean needstatus, String product, String extno) throws Exception {
HttpClient client = new HttpClient();
GetMethod method = new GetMethod();
try {
URI base = new URI(url, false);
method.setURI(new URI(base, "HttpSendSM", false));
method.setQueryString(new NameValuePair[] {
new NameValuePair("account", account),
new NameValuePair("pswd", pswd),
new NameValuePair("mobile", mobile),
new NameValuePair("needstatus", String.valueOf(needstatus)),
new NameValuePair("msg", msg),
new NameValuePair("product", product),
new NameValuePair("extno", extno),
});
int result = client.executeMethod(method);
if (result == HttpStatus.SC_OK) {
InputStream in = method.getResponseBodyAsStream();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int len = 0;
while ((len = in.read(buffer)) != -1) {
baos.write(buffer, 0, len);
}
return URLDecoder.decode(baos.toString(), "UTF-8");
} else {
throw new Exception("HTTP ERROR Status: " + method.getStatusCode() + ":" + method.getStatusText());
}
} finally {
method.releaseConnection();
}
}
/**
*
* @param url 应用地址,类似于http://ip:port/msg/
* @param account 账号
* @param pswd 密码
* @param mobile 手机号码,多个号码使用","分割
* @param msg 短信内容
* @param needstatus 是否需要状态报告,需要true,不需要false
* @return 返回值定义参见HTTP协议文档
* @throws Exception
*/
private String batchSend(String url, String account, String pswd, String mobile, String msg,
boolean needstatus, String product, String extno) throws Exception {
HttpClient client = new HttpClient();
GetMethod method = new GetMethod();
try {
URI base = new URI(url, false);
method.setURI(new URI(base, "HttpBatchSendSM", false));
method.setQueryString(new NameValuePair[] {
new NameValuePair("account", account),
new NameValuePair("pswd", pswd),
new NameValuePair("mobile", mobile),
new NameValuePair("needstatus", String.valueOf(needstatus)),
new NameValuePair("msg", msg),
new NameValuePair("product", product),
new NameValuePair("extno", extno),
});
int result = client.executeMethod(method);
if (result == HttpStatus.SC_OK) {
InputStream in = method.getResponseBodyAsStream();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int len = 0;
while ((len = in.read(buffer)) != -1) {
baos.write(buffer, 0, len);
}
return URLDecoder.decode(baos.toString(), "UTF-8");
} else {
throw new Exception("HTTP ERROR Status: " + method.getStatusCode() + ":" + method.getStatusText());
}
} finally {
method.releaseConnection();
}
}
/**
* 根据手机号生成验证码,然后发送短信
* @param phoneNumber
* @return
*/
@GET
@Path("/send/{phoneNumber}")
@Produces(MediaType.TEXT_PLAIN)
public String send(@PathParam("phoneNumber") String phoneNumber){
//生成随机数
Random random = new Random();
String result = "";
for(int i = 0; i < 6 ; i++){
result += random.nextInt(10);
}
map.put(phoneNumber, result);
//发送短信
String url = "http://222.73.117.158/msg/";// 应用地址
String account = "Zms888";// 账号
String pswd = "<PASSWORD>";// 密码
String mobile = phoneNumber;// 手机号码,多个号码使用","分割
String msg = "亲爱的用户,您的验证码是" + map.get(phoneNumber) + ",5分钟内有效。";// 短信内容
boolean needstatus = true;// 是否需要状态报告,需要true,不需要false
String product = null;// 产品ID
String extno = null;// 扩展码
try {
String returnString = batchSend(url, account, pswd, mobile, msg, needstatus, product, extno);
System.out.println(returnString);
return "success";
// TODO 处理返回值,参见HTTP协议文档
} catch (Exception e) {
// TODO 处理异常
e.printStackTrace();
return "fail";
}
}
/**
* 校验验证码
* @param phoneNumber
* @param checkNumber
* @return
*/
@GET
@Path("/check/{phoneNumber}/{checkNumber}")
@Produces(MediaType.APPLICATION_JSON)
public String check(@PathParam("phoneNumber")String phoneNumber, @PathParam("checkNumber")String checkNumber, @Context HttpServletResponse response){
response.setHeader("Access-Control-Allow-Origin", "*");
Map<String, String> result = new HashMap<String, String>();
Gson gson = new Gson();
java.lang.reflect.Type type = new com.google.gson.reflect.TypeToken<Map<String, String>>() {
}.getType();
if(map.containsKey(phoneNumber)){
if(map.get(phoneNumber).equals(checkNumber)){
map.remove(phoneNumber);
result.put("result", "success");
return gson.toJson(result, type);
}
}
result.put("result", "fail");
return gson.toJson(result, type);
}
}
| 6,296 | 0.682098 | 0.674923 | 192 | 29.489584 | 23.995007 | 150 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.75 | false | false |
0
|
2ed16b037cfec382611ad7c90befabdce1e0f6e7
| 15,994,458,276,967 |
0b46cd697e7e0892c4093c317e6ef7f6cc8a1d9d
|
/JAVA/Java8Tutorial/src/main/java/com/pl/java8Tutorial/MethodConstructorReferences.java
|
f66e1ba75d679d3121e25ff48a28fc6e7e6e8464
|
[
"Apache-2.0"
] |
permissive
|
13984468001/OwnTechnologyStack
|
https://github.com/13984468001/OwnTechnologyStack
|
10a045871e40808e5504e9a08992319dc2158af6
|
11284a5d24e4c42e07d2602fba81fed0eca7b8d9
|
refs/heads/master
| 2022-05-24T18:03:53.688000 | 2022-05-12T06:37:29 | 2022-05-12T06:37:29 | 200,886,683 | 0 | 0 |
Apache-2.0
| false | 2022-05-06T01:37:52 | 2019-08-06T16:22:29 | 2022-05-06T01:36:36 | 2022-05-06T01:37:51 | 130 | 0 | 0 | 1 |
Java
| false | false |
package com.pl.java8Tutorial;
import com.pl.java8Tutorial.auxiliary.Person;
import com.pl.java8Tutorial.auxiliary.PersonFactory;
import com.pl.java8Tutorial.auxiliary.Something;
/**
* @author LIPIAO
* @Description 方法和构造函数引用
* @date 2019/8/10 16:53
*/
public class MethodConstructorReferences {
public static void main(String[] args) {
FunctionalInterfaces<String, Integer> converter = Integer::valueOf; // 通过静态方法引用来表示
Integer converted = converter.convert("123");
System.out.println(converted.getClass()); //class java.lang.Integer
// Java 8允许您通过::关键字传递方法或构造函数的引用。 上面的示例显示了如何引用静态方法。 但我们也可以引用对象方法:
Something something = new Something();
FunctionalInterfaces<String, String> converter2 = something::startsWith;
String converted2 = converter2.convert("Java");
System.out.println(converted2); // "J"
// 我们只需要使用 Person::new 来获取Person类构造函数的引用,Java编译器会自动根据PersonFactory.create方法的参数类型来选择合适的构造函数。
PersonFactory<Person> personFactory = Person::new;
Person person = personFactory.create("Peter", "Parker");
System.out.println(person.toString());
}
}
|
UTF-8
|
Java
| 1,392 |
java
|
MethodConstructorReferences.java
|
Java
|
[
{
"context": "java8Tutorial.auxiliary.Something;\n\n/**\n * @author LIPIAO\n * @Description 方法和构造函数引用\n * @date 2019/8/10 16:5",
"end": 201,
"score": 0.9979546666145325,
"start": 195,
"tag": "USERNAME",
"value": "LIPIAO"
},
{
"context": "ew;\n Person person = personFactory.create(\"Peter\", \"Parker\");\n System.out.println(person.to",
"end": 1090,
"score": 0.9993630051612854,
"start": 1085,
"tag": "NAME",
"value": "Peter"
},
{
"context": " Person person = personFactory.create(\"Peter\", \"Parker\");\n System.out.println(person.toString());",
"end": 1100,
"score": 0.9995602369308472,
"start": 1094,
"tag": "NAME",
"value": "Parker"
}
] | null |
[] |
package com.pl.java8Tutorial;
import com.pl.java8Tutorial.auxiliary.Person;
import com.pl.java8Tutorial.auxiliary.PersonFactory;
import com.pl.java8Tutorial.auxiliary.Something;
/**
* @author LIPIAO
* @Description 方法和构造函数引用
* @date 2019/8/10 16:53
*/
public class MethodConstructorReferences {
public static void main(String[] args) {
FunctionalInterfaces<String, Integer> converter = Integer::valueOf; // 通过静态方法引用来表示
Integer converted = converter.convert("123");
System.out.println(converted.getClass()); //class java.lang.Integer
// Java 8允许您通过::关键字传递方法或构造函数的引用。 上面的示例显示了如何引用静态方法。 但我们也可以引用对象方法:
Something something = new Something();
FunctionalInterfaces<String, String> converter2 = something::startsWith;
String converted2 = converter2.convert("Java");
System.out.println(converted2); // "J"
// 我们只需要使用 Person::new 来获取Person类构造函数的引用,Java编译器会自动根据PersonFactory.create方法的参数类型来选择合适的构造函数。
PersonFactory<Person> personFactory = Person::new;
Person person = personFactory.create("Peter", "Parker");
System.out.println(person.toString());
}
}
| 1,392 | 0.710345 | 0.690517 | 33 | 34.151516 | 30.131149 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.515152 | false | false |
0
|
34a59684a8a0ff06660b93b5b12db9a465f2c401
| 11,012,296,147,849 |
6d576dcfb7833083dfe020d58980295bd0f12a1c
|
/hhsur_freddy/src/mifarma/ptoventa/centromedico/domain/CmeAtencionMedicaTratamiento.java
|
a1a2c681f2184622192e7a62097be12ce58cf1c2
|
[] |
no_license
|
slither366/PruebaUnir
|
https://github.com/slither366/PruebaUnir
|
463e5e911a19068920be9d8bdf80145e71337db8
|
f2d5fc378f864267190a1cfa20bce3d30bb944af
|
refs/heads/master
| 2020-12-06T10:12:38.540000 | 2020-01-07T23:05:22 | 2020-01-07T23:05:22 | 232,433,312 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package mifarma.ptoventa.centromedico.domain;
import java.util.Date;
/**
* @author ERIOS
* @since 14.09.2016
*/
public class CmeAtencionMedicaTratamiento {
private String cod_grupo_cia = "";
private String cod_cia = "";
private String cod_local = "";
private String num_aten_med = "";
private String num_ped_rec = "";
private Date validez_receta;
private String indicaciones_generales = "";
private String estado = "";
private Date fec_crea;
private String usu_crea = "";
private Date fec_mod;
private String usu_mod = "";
public void setCod_grupo_cia(String cod_grupo_cia) {
this.cod_grupo_cia = cod_grupo_cia;
}
public String getCod_grupo_cia() {
return cod_grupo_cia;
}
public void setCod_cia(String cod_cia) {
this.cod_cia = cod_cia;
}
public String getCod_cia() {
return cod_cia;
}
public void setCod_local(String cod_local) {
this.cod_local = cod_local;
}
public String getCod_local() {
return cod_local;
}
public void setNum_aten_med(String num_aten_med) {
this.num_aten_med = num_aten_med;
}
public String getNum_aten_med() {
return num_aten_med;
}
public void setNum_ped_rec(String num_ped_rec) {
this.num_ped_rec = num_ped_rec;
}
public String getNum_ped_rec() {
return num_ped_rec;
}
public void setValidez_receta(Date validez_receta) {
this.validez_receta = validez_receta;
}
public Date getValidez_receta() {
return validez_receta;
}
public void setIndicaciones_generales(String indicaciones_generales) {
this.indicaciones_generales = indicaciones_generales;
}
public String getIndicaciones_generales() {
return indicaciones_generales;
}
public void setEstado(String estado) {
this.estado = estado;
}
public String getEstado() {
return estado;
}
public void setFec_crea(Date fec_crea) {
this.fec_crea = fec_crea;
}
public Date getFec_crea() {
return fec_crea;
}
public void setUsu_crea(String usu_crea) {
this.usu_crea = usu_crea;
}
public String getUsu_crea() {
return usu_crea;
}
public void setFec_mod(Date fec_mod) {
this.fec_mod = fec_mod;
}
public Date getFec_mod() {
return fec_mod;
}
public void setUsu_mod(String usu_mod) {
this.usu_mod = usu_mod;
}
public String getUsu_mod() {
return usu_mod;
}
}
|
UTF-8
|
Java
| 2,587 |
java
|
CmeAtencionMedicaTratamiento.java
|
Java
|
[
{
"context": "co.domain;\n\nimport java.util.Date;\n\n/**\n * @author ERIOS\n * @since 14.09.2016\n */\npublic class CmeAtencion",
"end": 91,
"score": 0.9858642816543579,
"start": 86,
"tag": "NAME",
"value": "ERIOS"
}
] | null |
[] |
package mifarma.ptoventa.centromedico.domain;
import java.util.Date;
/**
* @author ERIOS
* @since 14.09.2016
*/
public class CmeAtencionMedicaTratamiento {
private String cod_grupo_cia = "";
private String cod_cia = "";
private String cod_local = "";
private String num_aten_med = "";
private String num_ped_rec = "";
private Date validez_receta;
private String indicaciones_generales = "";
private String estado = "";
private Date fec_crea;
private String usu_crea = "";
private Date fec_mod;
private String usu_mod = "";
public void setCod_grupo_cia(String cod_grupo_cia) {
this.cod_grupo_cia = cod_grupo_cia;
}
public String getCod_grupo_cia() {
return cod_grupo_cia;
}
public void setCod_cia(String cod_cia) {
this.cod_cia = cod_cia;
}
public String getCod_cia() {
return cod_cia;
}
public void setCod_local(String cod_local) {
this.cod_local = cod_local;
}
public String getCod_local() {
return cod_local;
}
public void setNum_aten_med(String num_aten_med) {
this.num_aten_med = num_aten_med;
}
public String getNum_aten_med() {
return num_aten_med;
}
public void setNum_ped_rec(String num_ped_rec) {
this.num_ped_rec = num_ped_rec;
}
public String getNum_ped_rec() {
return num_ped_rec;
}
public void setValidez_receta(Date validez_receta) {
this.validez_receta = validez_receta;
}
public Date getValidez_receta() {
return validez_receta;
}
public void setIndicaciones_generales(String indicaciones_generales) {
this.indicaciones_generales = indicaciones_generales;
}
public String getIndicaciones_generales() {
return indicaciones_generales;
}
public void setEstado(String estado) {
this.estado = estado;
}
public String getEstado() {
return estado;
}
public void setFec_crea(Date fec_crea) {
this.fec_crea = fec_crea;
}
public Date getFec_crea() {
return fec_crea;
}
public void setUsu_crea(String usu_crea) {
this.usu_crea = usu_crea;
}
public String getUsu_crea() {
return usu_crea;
}
public void setFec_mod(Date fec_mod) {
this.fec_mod = fec_mod;
}
public Date getFec_mod() {
return fec_mod;
}
public void setUsu_mod(String usu_mod) {
this.usu_mod = usu_mod;
}
public String getUsu_mod() {
return usu_mod;
}
}
| 2,587 | 0.601855 | 0.598763 | 119 | 20.739496 | 18.506624 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.319328 | false | false |
0
|
74e7ac49fbb25f74f0e1fc4c75de651bce4c1334
| 9,577,777,076,364 |
9f6d3b6fbd5c061322cbb34ec251b0b173ebf2ec
|
/rmhub/mivisu-connector-api/src/main/java/rmhub/connector/mivisu/api/service/ParserHelper.java
|
e121c58dc4038cbc280d8b690b220c49d1efabaa
|
[] |
no_license
|
HoangHieuBK/RMHub-BE
|
https://github.com/HoangHieuBK/RMHub-BE
|
618349c64071e095be089f871f40ddb4c741dd90
|
9f4742e57ebf24c5555f1a1b60c9635cb00a6ac1
|
refs/heads/master
| 2023-04-12T19:45:33.063000 | 2020-05-14T04:07:00 | 2020-05-14T04:07:00 | 263,811,534 | 0 | 0 | null | false | 2021-04-26T20:16:33 | 2020-05-14T04:05:51 | 2020-05-14T04:07:53 | 2021-04-26T20:16:32 | 259 | 0 | 0 | 1 |
Java
| false | false |
package rmhub.connector.mivisu.api.service;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
import rmhub.common.exception.RmhubException;
import rmhub.connector.mivisu.api.constant.MivisuApiConstant;
import rmhub.model.mivisu.api.Cfg;
import rmhub.model.mivisu.api.Channel;
import rmhub.model.mivisu.api.ClassMesure;
import rmhub.model.mivisu.api.Contexte;
import rmhub.model.mivisu.api.DateFin;
import rmhub.model.mivisu.api.DateInfo;
import rmhub.model.mivisu.api.DateUpdate;
import rmhub.model.mivisu.api.Id;
import rmhub.model.mivisu.api.InfoBase;
import rmhub.model.mivisu.api.InfoGeneric;
import rmhub.model.mivisu.api.InfoGetIgx;
import rmhub.model.mivisu.api.Libelle;
import rmhub.model.mivisu.api.Mesure;
import rmhub.model.mivisu.api.MesureId;
import rmhub.model.mivisu.api.MesureType;
import rmhub.model.mivisu.api.Nature;
import rmhub.model.mivisu.api.Period;
import rmhub.model.mivisu.api.Pool;
import rmhub.model.mivisu.api.Source;
import rmhub.model.mivisu.api.Sstype;
import rmhub.model.mivisu.api.Titre;
import rmhub.model.mivisu.api.Type;
@Slf4j
public class ParserHelper {
public static InfoGetIgx buildNodeInfoGetIgx(String json) {
// process JSON data
byte[] jsonData = json.getBytes(StandardCharsets.UTF_8);
ObjectMapper objectMapper = new ObjectMapper();
JsonNode rootNode;
try {
rootNode = objectMapper.readTree(jsonData);
} catch (IOException ex) {
log.error("Error when passer json {} ", ex.getMessage());
throw new RmhubException(ex.getMessage(), ex);
}
JsonNode nodeCrval = rootNode.findPath(MivisuApiConstant.NODE_CRVAL);
String val = nodeCrval.asText();
if (!MivisuApiConstant.RESULT_SUCCESS.equals(val)) {
log.warn("Can not build Node InfoGetIgx.");
return null;
}
JsonNode jsonNodeInfoGeneric = rootNode.findPath(MivisuApiConstant.NODE_INFOGENERIC);
List<InfoGeneric> listInfoGeneric = new ArrayList<>();
InfoGetIgx infoGetgx = new InfoGetIgx();
if (jsonNodeInfoGeneric.isArray()) {
for (int i = 0; i < jsonNodeInfoGeneric.size(); i++) {
JsonNode jsonNode = jsonNodeInfoGeneric.get(i);
InfoGeneric infoGeneric = buildNodeInfoGeneric(jsonNode);
listInfoGeneric.add(infoGeneric);
}
} else {
InfoGeneric infoGeneric = buildNodeInfoGeneric(jsonNodeInfoGeneric);
listInfoGeneric.add(infoGeneric);
}
infoGetgx.setInfoGenerics(listInfoGeneric);
return infoGetgx;
}
private static InfoGeneric buildNodeInfoGeneric(JsonNode jsonNode) {
InfoGeneric infoGeneric = new InfoGeneric();
Iterator<Map.Entry<String, JsonNode>> iterator = jsonNode.fields();
while (iterator.hasNext()) {
Map.Entry<String, JsonNode> map = iterator.next();
String key = map.getKey();
JsonNode nodeValue = map.getValue();
switch (key) {
case MivisuApiConstant.NODE_TITRE:
infoGeneric.setTitre(nodeValue.asText());
break;
case MivisuApiConstant.NODE_DATEINFO:
DateInfo dateInfo = createInfoBase(DateInfo.class, nodeValue);
infoGeneric.setDateInfo(dateInfo);
break;
case MivisuApiConstant.NODE_SOURCE:
Source source = createInfoBase(Source.class, nodeValue);
infoGeneric.setSource(source);
break;
case MivisuApiConstant.NODE_CONTEXTE:
Contexte contexte = createInfoBase(Contexte.class, nodeValue);
infoGeneric.setContexte(contexte);
break;
case MivisuApiConstant.NODE_ID:
Id id = createInfoBase(Id.class, nodeValue);
infoGeneric.setId(id);
break;
case MivisuApiConstant.NODE_UPCASE_TITRE:
Titre titre = createInfoBase(Titre.class, nodeValue);
infoGeneric.setObjTitre(titre);
break;
case MivisuApiConstant.NODE_TYPE:
Type type = createInfoBase(Type.class, nodeValue);
infoGeneric.setType(type);
case MivisuApiConstant.NODE_SSTYPE:
Sstype sstype = createInfoBase(Sstype.class, nodeValue);
infoGeneric.setSstype(sstype);
case MivisuApiConstant.NODE_DATEUPDATE:
DateUpdate dateUpdate = createInfoBase(DateUpdate.class, nodeValue);
infoGeneric.setDateUpdate(dateUpdate);
break;
case MivisuApiConstant.NODE_DATEFIN:
DateFin dateFin = createInfoBase(DateFin.class, nodeValue);
infoGeneric.setDateFin(dateFin);
break;
case MivisuApiConstant.NODE_CFG:
Cfg cfg = builNodeCfg(nodeValue);
infoGeneric.setCfg(cfg);
break;
default:
if (log.isDebugEnabled()) {
log.debug("No valid node for building InfoGeneric: {}", key);
}
}
}
return infoGeneric;
}
@SuppressWarnings("deprecation")
private static <T extends InfoBase> T createInfoBase(Class<T> cls, JsonNode nodeValue) {
try {
T myObject = cls.newInstance();
Iterator<Map.Entry<String, JsonNode>> iterator = nodeValue.fields();
while (iterator.hasNext()) {
Map.Entry<String, JsonNode> map = iterator.next();
JsonNode nodeValue1 = map.getValue();
String key = map.getKey();
if (MivisuApiConstant.NODE_TEXT.equals(key)) {
myObject.setValue(nodeValue1.asText());
} else {
myObject.setType(nodeValue1.asText());
}
}
return myObject;
} catch (InstantiationException | IllegalAccessException ex) {
log.error("Error when building NodeClassMesure: {} ", ex.getMessage());
throw new RmhubException(ex.getMessage(), ex);
}
}
private static Cfg builNodeCfg(JsonNode nodeValue) {
Cfg cfg = new Cfg();
Iterator<Map.Entry<String, JsonNode>> iterator = nodeValue.fields();
while (iterator.hasNext()) {
Map.Entry<String, JsonNode> map = iterator.next();
String key = map.getKey();
JsonNode node = map.getValue();
String value = getValueNodeCfg(node);
if (MivisuApiConstant.NODE_LOWCASE_TYPE.equals(key)) {
cfg.setType(value);
} else if (MivisuApiConstant.NODE_ID_INTERNE.equals(key)) {
cfg.setId_interne(value);
} else if (MivisuApiConstant.NODE_EQT_ACTIF.equals(key)) {
cfg.setEqt_actif(value);
} else if (MivisuApiConstant.NODE_DESCRIPTION.equals(key)) {
cfg.setDescription(value);
} else if (MivisuApiConstant.NODE_PROFIL.equals(key)) {
cfg.setProfil(value);
} else if (MivisuApiConstant.NODE_SOUS_TYPE.equals(key)) {
cfg.setSous_type(value);
} else if (MivisuApiConstant.NODE_MESURES.equals(key)) {
Mesure mesure = buildNodeMesure(node);
cfg.setMesure(mesure);
}
}
return cfg;
}
private static String getValueNodeCfg(JsonNode node) {
String value = null;
if (!node.isNull()) {
Iterator<Map.Entry<String, JsonNode>> iterator = node.fields();
if (iterator.hasNext()) {
Map.Entry<String, JsonNode> map = iterator.next();
JsonNode nodeValue = map.getValue();
value = nodeValue.asText();
}
}
return value;
}
private static Mesure buildNodeMesure(JsonNode node) {
Mesure mesure = new Mesure();
Iterator<Map.Entry<String, JsonNode>> iterator = node.fields();
List<Pool> pools = new ArrayList<>();
while (iterator.hasNext()) {
Map.Entry<String, JsonNode> map = iterator.next();
Pool pool = new Pool();
String key = map.getKey();
pool.setValue(key);
List<Channel> channels = new ArrayList<>();
JsonNode nodeValue = map.getValue();
Iterator<Map.Entry<String, JsonNode>> internalIterator = nodeValue.fields();
while (internalIterator.hasNext()) {
Map.Entry<String, JsonNode> map1 = internalIterator.next();
JsonNode nodeValue1 = map1.getValue();
String key1 = map1.getKey();
if (nodeValue1.isTextual()) {
pool.set_text(nodeValue1.asText());
} else {
channels.add(buildNodeChannel(nodeValue1, key1));
}
}
pool.setChannels(channels);
pools.add(pool);
}
mesure.setPools(pools);
return mesure;
}
private static Channel buildNodeChannel(JsonNode node, String key) {
Channel channel = new Channel();
channel.setValue(key);
Iterator<Map.Entry<String, JsonNode>> iterator = node.fields();
List<Nature> natures = new ArrayList<>();
while (iterator.hasNext()) {
Map.Entry<String, JsonNode> map = iterator.next();
String key1 = map.getKey();
JsonNode jsonNode = map.getValue();
if (MivisuApiConstant.NODE_TEXT.equals(key1)) {
channel.set_text(jsonNode.asText());
} else {
natures.add(buildNodeNature(jsonNode, key1));
}
}
channel.setNatures(natures);
return channel;
}
private static Nature buildNodeNature(JsonNode node, String key) {
Nature nature = new Nature();
nature.setValue(key);
List<Period> periods = new ArrayList<>();
Iterator<Map.Entry<String, JsonNode>> iterator = node.fields();
while (iterator.hasNext()) {
Map.Entry<String, JsonNode> map = iterator.next();
String key1 = map.getKey();
JsonNode node1 = map.getValue();
periods.add(buildNodePeriod(node1, key1));
}
nature.setPeriods(periods);
return nature;
}
private static Period buildNodePeriod(JsonNode node, String key) {
Period period = new Period();
period.setValue(key);
Iterator<Map.Entry<String, JsonNode>> iterator = node.fields();
while (iterator.hasNext()) {
Map.Entry<String, JsonNode> map = iterator.next();
String key1 = map.getKey();
JsonNode node1 = map.getValue();
period.setClassMesure(buildNodeClassMesure(node1, key1));
}
return period;
}
private static ClassMesure buildNodeClassMesure(JsonNode root, String rootKey) {
ClassMesure classMesure = new ClassMesure();
classMesure.setValue(rootKey);
Iterator<Map.Entry<String, JsonNode>> parentIterator = root.fields();
while (parentIterator.hasNext()) {
Map.Entry<String, JsonNode> mapParent = parentIterator.next();
String key8 = mapParent.getKey();
JsonNode child = mapParent.getValue();
Iterator<Map.Entry<String, JsonNode>> childIterator = child.fields();
try {
if (childIterator.hasNext()) {
Map.Entry<String, JsonNode> mapChild = childIterator.next();
JsonNode nodeLeaf = mapChild.getValue();
if (MivisuApiConstant.NODE_ID_MESURE.equals(key8)) {
MesureId mesureId = new MesureId();
mesureId.set_text(nodeLeaf.asText());
classMesure.setId_mesure(mesureId);
} else if (MivisuApiConstant.NODE_LOWCASE_TYPE.equals(key8)) {
MesureType mesureType = new MesureType();
mesureType.set_text(nodeLeaf.asText());
classMesure.setMesureType(mesureType);
} else if (MivisuApiConstant.NODE_LIBELLE.equals(key8)) {
Libelle mesureLibelle = new Libelle();
mesureLibelle.set_text(nodeLeaf.asText());
classMesure.setMesureLibelle(mesureLibelle);
}
}
} catch (Exception ex) {
log.error("Error when building node ClassMesure: {} ", ex.getMessage());
throw new RmhubException(ex.getMessage(), ex);
}
}
return classMesure;
}
}
|
UTF-8
|
Java
| 11,665 |
java
|
ParserHelper.java
|
Java
|
[] | null |
[] |
package rmhub.connector.mivisu.api.service;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
import rmhub.common.exception.RmhubException;
import rmhub.connector.mivisu.api.constant.MivisuApiConstant;
import rmhub.model.mivisu.api.Cfg;
import rmhub.model.mivisu.api.Channel;
import rmhub.model.mivisu.api.ClassMesure;
import rmhub.model.mivisu.api.Contexte;
import rmhub.model.mivisu.api.DateFin;
import rmhub.model.mivisu.api.DateInfo;
import rmhub.model.mivisu.api.DateUpdate;
import rmhub.model.mivisu.api.Id;
import rmhub.model.mivisu.api.InfoBase;
import rmhub.model.mivisu.api.InfoGeneric;
import rmhub.model.mivisu.api.InfoGetIgx;
import rmhub.model.mivisu.api.Libelle;
import rmhub.model.mivisu.api.Mesure;
import rmhub.model.mivisu.api.MesureId;
import rmhub.model.mivisu.api.MesureType;
import rmhub.model.mivisu.api.Nature;
import rmhub.model.mivisu.api.Period;
import rmhub.model.mivisu.api.Pool;
import rmhub.model.mivisu.api.Source;
import rmhub.model.mivisu.api.Sstype;
import rmhub.model.mivisu.api.Titre;
import rmhub.model.mivisu.api.Type;
@Slf4j
public class ParserHelper {
public static InfoGetIgx buildNodeInfoGetIgx(String json) {
// process JSON data
byte[] jsonData = json.getBytes(StandardCharsets.UTF_8);
ObjectMapper objectMapper = new ObjectMapper();
JsonNode rootNode;
try {
rootNode = objectMapper.readTree(jsonData);
} catch (IOException ex) {
log.error("Error when passer json {} ", ex.getMessage());
throw new RmhubException(ex.getMessage(), ex);
}
JsonNode nodeCrval = rootNode.findPath(MivisuApiConstant.NODE_CRVAL);
String val = nodeCrval.asText();
if (!MivisuApiConstant.RESULT_SUCCESS.equals(val)) {
log.warn("Can not build Node InfoGetIgx.");
return null;
}
JsonNode jsonNodeInfoGeneric = rootNode.findPath(MivisuApiConstant.NODE_INFOGENERIC);
List<InfoGeneric> listInfoGeneric = new ArrayList<>();
InfoGetIgx infoGetgx = new InfoGetIgx();
if (jsonNodeInfoGeneric.isArray()) {
for (int i = 0; i < jsonNodeInfoGeneric.size(); i++) {
JsonNode jsonNode = jsonNodeInfoGeneric.get(i);
InfoGeneric infoGeneric = buildNodeInfoGeneric(jsonNode);
listInfoGeneric.add(infoGeneric);
}
} else {
InfoGeneric infoGeneric = buildNodeInfoGeneric(jsonNodeInfoGeneric);
listInfoGeneric.add(infoGeneric);
}
infoGetgx.setInfoGenerics(listInfoGeneric);
return infoGetgx;
}
private static InfoGeneric buildNodeInfoGeneric(JsonNode jsonNode) {
InfoGeneric infoGeneric = new InfoGeneric();
Iterator<Map.Entry<String, JsonNode>> iterator = jsonNode.fields();
while (iterator.hasNext()) {
Map.Entry<String, JsonNode> map = iterator.next();
String key = map.getKey();
JsonNode nodeValue = map.getValue();
switch (key) {
case MivisuApiConstant.NODE_TITRE:
infoGeneric.setTitre(nodeValue.asText());
break;
case MivisuApiConstant.NODE_DATEINFO:
DateInfo dateInfo = createInfoBase(DateInfo.class, nodeValue);
infoGeneric.setDateInfo(dateInfo);
break;
case MivisuApiConstant.NODE_SOURCE:
Source source = createInfoBase(Source.class, nodeValue);
infoGeneric.setSource(source);
break;
case MivisuApiConstant.NODE_CONTEXTE:
Contexte contexte = createInfoBase(Contexte.class, nodeValue);
infoGeneric.setContexte(contexte);
break;
case MivisuApiConstant.NODE_ID:
Id id = createInfoBase(Id.class, nodeValue);
infoGeneric.setId(id);
break;
case MivisuApiConstant.NODE_UPCASE_TITRE:
Titre titre = createInfoBase(Titre.class, nodeValue);
infoGeneric.setObjTitre(titre);
break;
case MivisuApiConstant.NODE_TYPE:
Type type = createInfoBase(Type.class, nodeValue);
infoGeneric.setType(type);
case MivisuApiConstant.NODE_SSTYPE:
Sstype sstype = createInfoBase(Sstype.class, nodeValue);
infoGeneric.setSstype(sstype);
case MivisuApiConstant.NODE_DATEUPDATE:
DateUpdate dateUpdate = createInfoBase(DateUpdate.class, nodeValue);
infoGeneric.setDateUpdate(dateUpdate);
break;
case MivisuApiConstant.NODE_DATEFIN:
DateFin dateFin = createInfoBase(DateFin.class, nodeValue);
infoGeneric.setDateFin(dateFin);
break;
case MivisuApiConstant.NODE_CFG:
Cfg cfg = builNodeCfg(nodeValue);
infoGeneric.setCfg(cfg);
break;
default:
if (log.isDebugEnabled()) {
log.debug("No valid node for building InfoGeneric: {}", key);
}
}
}
return infoGeneric;
}
@SuppressWarnings("deprecation")
private static <T extends InfoBase> T createInfoBase(Class<T> cls, JsonNode nodeValue) {
try {
T myObject = cls.newInstance();
Iterator<Map.Entry<String, JsonNode>> iterator = nodeValue.fields();
while (iterator.hasNext()) {
Map.Entry<String, JsonNode> map = iterator.next();
JsonNode nodeValue1 = map.getValue();
String key = map.getKey();
if (MivisuApiConstant.NODE_TEXT.equals(key)) {
myObject.setValue(nodeValue1.asText());
} else {
myObject.setType(nodeValue1.asText());
}
}
return myObject;
} catch (InstantiationException | IllegalAccessException ex) {
log.error("Error when building NodeClassMesure: {} ", ex.getMessage());
throw new RmhubException(ex.getMessage(), ex);
}
}
private static Cfg builNodeCfg(JsonNode nodeValue) {
Cfg cfg = new Cfg();
Iterator<Map.Entry<String, JsonNode>> iterator = nodeValue.fields();
while (iterator.hasNext()) {
Map.Entry<String, JsonNode> map = iterator.next();
String key = map.getKey();
JsonNode node = map.getValue();
String value = getValueNodeCfg(node);
if (MivisuApiConstant.NODE_LOWCASE_TYPE.equals(key)) {
cfg.setType(value);
} else if (MivisuApiConstant.NODE_ID_INTERNE.equals(key)) {
cfg.setId_interne(value);
} else if (MivisuApiConstant.NODE_EQT_ACTIF.equals(key)) {
cfg.setEqt_actif(value);
} else if (MivisuApiConstant.NODE_DESCRIPTION.equals(key)) {
cfg.setDescription(value);
} else if (MivisuApiConstant.NODE_PROFIL.equals(key)) {
cfg.setProfil(value);
} else if (MivisuApiConstant.NODE_SOUS_TYPE.equals(key)) {
cfg.setSous_type(value);
} else if (MivisuApiConstant.NODE_MESURES.equals(key)) {
Mesure mesure = buildNodeMesure(node);
cfg.setMesure(mesure);
}
}
return cfg;
}
private static String getValueNodeCfg(JsonNode node) {
String value = null;
if (!node.isNull()) {
Iterator<Map.Entry<String, JsonNode>> iterator = node.fields();
if (iterator.hasNext()) {
Map.Entry<String, JsonNode> map = iterator.next();
JsonNode nodeValue = map.getValue();
value = nodeValue.asText();
}
}
return value;
}
private static Mesure buildNodeMesure(JsonNode node) {
Mesure mesure = new Mesure();
Iterator<Map.Entry<String, JsonNode>> iterator = node.fields();
List<Pool> pools = new ArrayList<>();
while (iterator.hasNext()) {
Map.Entry<String, JsonNode> map = iterator.next();
Pool pool = new Pool();
String key = map.getKey();
pool.setValue(key);
List<Channel> channels = new ArrayList<>();
JsonNode nodeValue = map.getValue();
Iterator<Map.Entry<String, JsonNode>> internalIterator = nodeValue.fields();
while (internalIterator.hasNext()) {
Map.Entry<String, JsonNode> map1 = internalIterator.next();
JsonNode nodeValue1 = map1.getValue();
String key1 = map1.getKey();
if (nodeValue1.isTextual()) {
pool.set_text(nodeValue1.asText());
} else {
channels.add(buildNodeChannel(nodeValue1, key1));
}
}
pool.setChannels(channels);
pools.add(pool);
}
mesure.setPools(pools);
return mesure;
}
private static Channel buildNodeChannel(JsonNode node, String key) {
Channel channel = new Channel();
channel.setValue(key);
Iterator<Map.Entry<String, JsonNode>> iterator = node.fields();
List<Nature> natures = new ArrayList<>();
while (iterator.hasNext()) {
Map.Entry<String, JsonNode> map = iterator.next();
String key1 = map.getKey();
JsonNode jsonNode = map.getValue();
if (MivisuApiConstant.NODE_TEXT.equals(key1)) {
channel.set_text(jsonNode.asText());
} else {
natures.add(buildNodeNature(jsonNode, key1));
}
}
channel.setNatures(natures);
return channel;
}
private static Nature buildNodeNature(JsonNode node, String key) {
Nature nature = new Nature();
nature.setValue(key);
List<Period> periods = new ArrayList<>();
Iterator<Map.Entry<String, JsonNode>> iterator = node.fields();
while (iterator.hasNext()) {
Map.Entry<String, JsonNode> map = iterator.next();
String key1 = map.getKey();
JsonNode node1 = map.getValue();
periods.add(buildNodePeriod(node1, key1));
}
nature.setPeriods(periods);
return nature;
}
private static Period buildNodePeriod(JsonNode node, String key) {
Period period = new Period();
period.setValue(key);
Iterator<Map.Entry<String, JsonNode>> iterator = node.fields();
while (iterator.hasNext()) {
Map.Entry<String, JsonNode> map = iterator.next();
String key1 = map.getKey();
JsonNode node1 = map.getValue();
period.setClassMesure(buildNodeClassMesure(node1, key1));
}
return period;
}
private static ClassMesure buildNodeClassMesure(JsonNode root, String rootKey) {
ClassMesure classMesure = new ClassMesure();
classMesure.setValue(rootKey);
Iterator<Map.Entry<String, JsonNode>> parentIterator = root.fields();
while (parentIterator.hasNext()) {
Map.Entry<String, JsonNode> mapParent = parentIterator.next();
String key8 = mapParent.getKey();
JsonNode child = mapParent.getValue();
Iterator<Map.Entry<String, JsonNode>> childIterator = child.fields();
try {
if (childIterator.hasNext()) {
Map.Entry<String, JsonNode> mapChild = childIterator.next();
JsonNode nodeLeaf = mapChild.getValue();
if (MivisuApiConstant.NODE_ID_MESURE.equals(key8)) {
MesureId mesureId = new MesureId();
mesureId.set_text(nodeLeaf.asText());
classMesure.setId_mesure(mesureId);
} else if (MivisuApiConstant.NODE_LOWCASE_TYPE.equals(key8)) {
MesureType mesureType = new MesureType();
mesureType.set_text(nodeLeaf.asText());
classMesure.setMesureType(mesureType);
} else if (MivisuApiConstant.NODE_LIBELLE.equals(key8)) {
Libelle mesureLibelle = new Libelle();
mesureLibelle.set_text(nodeLeaf.asText());
classMesure.setMesureLibelle(mesureLibelle);
}
}
} catch (Exception ex) {
log.error("Error when building node ClassMesure: {} ", ex.getMessage());
throw new RmhubException(ex.getMessage(), ex);
}
}
return classMesure;
}
}
| 11,665 | 0.663781 | 0.661037 | 339 | 33.41003 | 23.100525 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.710914 | false | false |
0
|
fbdfb3b96f92172b55046e2ea40781f0b95b9864
| 19,808,389,173,981 |
6b52c88a3fa861cbb1878e85a8206d62bf664798
|
/src/main/java/rac/listeners/MobListeners.java
|
7f2d3a797f7bdfb119d7a5117c10998d04566fbc
|
[] |
no_license
|
Raconteur37/Racpack
|
https://github.com/Raconteur37/Racpack
|
9fa52ab155c3f7f94ad982672f061e446469ed50
|
4e0a44478f5fe9bcb71676810ecd9f435d6df007
|
refs/heads/master
| 2023-06-16T18:02:10.997000 | 2021-07-15T20:59:47 | 2021-07-15T20:59:47 | 386,422,224 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package rac.listeners;
import org.bukkit.Location;
import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
import java.util.List;
public class MobListeners implements Listener {
SwordListener swordListener = new SwordListener();
/*@EventHandler
public void onEntityTarget(EntityTargetLivingEntityEvent event) {
LivingEntity entity = (LivingEntity) event.getEntity();
LivingEntity target = event.getTarget();
if (entity.getCustomName().contains("Death Troop")) {
Location loc = null;
LivingEntity closest = null;
loc = entity.getLocation();
double lowestDistance = Double.MAX_VALUE;
List<Entity> near = entity.getNearbyEntities(20.0, 20.0, 20.0); //gets all living entities within range
for (Entity e : near) {
if (e instanceof LivingEntity) {
double distance = e.getLocation().distance(loc);
if (distance < lowestDistance)
if (e.getUniqueId() != swordListener.getSummonerUUID()) {
e.sendMessage(String.valueOf(swordListener.getSummonerUUID()));
distance = e.getLocation().distance(loc);
lowestDistance = distance;
closest = (LivingEntity) e;
event.setTarget(closest);
}
}
}
}
}*/
}
|
UTF-8
|
Java
| 1,588 |
java
|
MobListeners.java
|
Java
|
[] | null |
[] |
package rac.listeners;
import org.bukkit.Location;
import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
import java.util.List;
public class MobListeners implements Listener {
SwordListener swordListener = new SwordListener();
/*@EventHandler
public void onEntityTarget(EntityTargetLivingEntityEvent event) {
LivingEntity entity = (LivingEntity) event.getEntity();
LivingEntity target = event.getTarget();
if (entity.getCustomName().contains("Death Troop")) {
Location loc = null;
LivingEntity closest = null;
loc = entity.getLocation();
double lowestDistance = Double.MAX_VALUE;
List<Entity> near = entity.getNearbyEntities(20.0, 20.0, 20.0); //gets all living entities within range
for (Entity e : near) {
if (e instanceof LivingEntity) {
double distance = e.getLocation().distance(loc);
if (distance < lowestDistance)
if (e.getUniqueId() != swordListener.getSummonerUUID()) {
e.sendMessage(String.valueOf(swordListener.getSummonerUUID()));
distance = e.getLocation().distance(loc);
lowestDistance = distance;
closest = (LivingEntity) e;
event.setTarget(closest);
}
}
}
}
}*/
}
| 1,588 | 0.581234 | 0.575567 | 43 | 35.930233 | 28.008633 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.534884 | false | false |
0
|
f75de5f85f2c411d3877a907be3b8a21a0886045
| 32,641,751,462,290 |
3967e957857e99643c6027ee4b4dc71b1cad8674
|
/ssm_OAManager/src/com/ssm/OaManager/service/stationery/impl/PurchaseServiceimpl.java
|
a0d5c580b185913e0d9c17524e6e7a5c7d601021
|
[] |
no_license
|
dashan606/OA
|
https://github.com/dashan606/OA
|
4a5ffc7aa31caec5de627f82ccefe807ea8a86ed
|
7b411387158741e189b2311b519f5815f29b0892
|
refs/heads/master
| 2020-03-08T10:43:39.120000 | 2018-05-25T15:47:26 | 2018-05-25T15:47:26 | 128,066,935 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ssm.OaManager.service.stationery.impl;
import java.io.Serializable;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.ssm.OaManager.dao.stationery.PurchaseDao;
import com.ssm.OaManager.entity.stationery.Purchase;
import com.ssm.OaManager.service.stationery.PurchaseService;
import com.ssm.OaManager.utils.PageBean;
@Service
public class PurchaseServiceimpl implements PurchaseService{
@Resource
public PurchaseDao purchaseDao;
public void setPurchaseDao(PurchaseDao purchaseDao) {
this.purchaseDao = purchaseDao;
}
/**带条件分页查询,条件可以为null,既没有条件;返回list对象集合*/
public List<Purchase> findByPage(PageBean<Purchase> pageBean) {
return this.purchaseDao.findByPage(pageBean);
}
/**只查询一个,常用于修改*/
public Purchase findById(Serializable id) {
return this.purchaseDao.findById(id);
}
/**
* 插入,用实体作为参数
* @param entity
*/
public int insert(Purchase entity) {
return this.purchaseDao.insert(entity);
}
/**
* 修改,用实体作为参数
* @param entity
*/
public int update(Purchase entity) {
return this.purchaseDao.update(entity);
}
/**
* 按id删除,删除一条;支持整数型和字符串类型ID
* @param entity
*/
public int deleteById(Serializable id) {
return this.purchaseDao.deleteById(id);
}
/**
* 批量删除;支持整数型和字符串类型ID
* @param entity
*/
public int delete(Serializable[] ids) {
return this.purchaseDao.delete(ids);
}
/**
* 查询全部
* @param entity
*/
public List<Purchase> findAll() {
return this.purchaseDao.findAll();
}
/**
* 查询记录数
* @param entitys
*/
public int findCount(PageBean<Purchase> pageBean) {
return this.purchaseDao.findCount(pageBean);
}
}
|
UTF-8
|
Java
| 1,947 |
java
|
PurchaseServiceimpl.java
|
Java
|
[] | null |
[] |
package com.ssm.OaManager.service.stationery.impl;
import java.io.Serializable;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.ssm.OaManager.dao.stationery.PurchaseDao;
import com.ssm.OaManager.entity.stationery.Purchase;
import com.ssm.OaManager.service.stationery.PurchaseService;
import com.ssm.OaManager.utils.PageBean;
@Service
public class PurchaseServiceimpl implements PurchaseService{
@Resource
public PurchaseDao purchaseDao;
public void setPurchaseDao(PurchaseDao purchaseDao) {
this.purchaseDao = purchaseDao;
}
/**带条件分页查询,条件可以为null,既没有条件;返回list对象集合*/
public List<Purchase> findByPage(PageBean<Purchase> pageBean) {
return this.purchaseDao.findByPage(pageBean);
}
/**只查询一个,常用于修改*/
public Purchase findById(Serializable id) {
return this.purchaseDao.findById(id);
}
/**
* 插入,用实体作为参数
* @param entity
*/
public int insert(Purchase entity) {
return this.purchaseDao.insert(entity);
}
/**
* 修改,用实体作为参数
* @param entity
*/
public int update(Purchase entity) {
return this.purchaseDao.update(entity);
}
/**
* 按id删除,删除一条;支持整数型和字符串类型ID
* @param entity
*/
public int deleteById(Serializable id) {
return this.purchaseDao.deleteById(id);
}
/**
* 批量删除;支持整数型和字符串类型ID
* @param entity
*/
public int delete(Serializable[] ids) {
return this.purchaseDao.delete(ids);
}
/**
* 查询全部
* @param entity
*/
public List<Purchase> findAll() {
return this.purchaseDao.findAll();
}
/**
* 查询记录数
* @param entitys
*/
public int findCount(PageBean<Purchase> pageBean) {
return this.purchaseDao.findCount(pageBean);
}
}
| 1,947 | 0.698221 | 0.698221 | 81 | 19.518518 | 19.483522 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.037037 | false | false |
0
|
5ae922341911baadbd7042ee25169acf03230a72
| 30,777,735,645,317 |
0bfeca8389e38c636977e3987606b0ed9c1551ec
|
/src/main/java/com/andreldm/usb_barcode_reader/server/dialogs/DialogUtils.java
|
a2c401e05f760aa43c2caa5a807437fdddea2702
|
[] |
no_license
|
andreldm/usb-barcode-reader-server
|
https://github.com/andreldm/usb-barcode-reader-server
|
f6332a59e8f04eaf9ec409417971778294bd1e17
|
2be723648149274ef99b37abcc0b34e55c48af1a
|
refs/heads/master
| 2021-01-17T14:26:33.636000 | 2016-08-03T02:07:07 | 2016-08-03T02:07:07 | 53,635,514 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.andreldm.usb_barcode_reader.server.dialogs;
import javafx.event.Event;
import javafx.scene.Node;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.stage.Window;
public class DialogUtils {
public static void dialogAlert(String msg, Event event) {
dialogAlert(msg, event, AlertType.WARNING);
}
public static void dialogAlert(String msg, Event event, AlertType tipo) {
Alert alert = new Alert(tipo);
if (event != null)
alert.initOwner(getWindowFromEvent(event));
alert.setTitle("Atention");
alert.setHeaderText(null);
alert.setContentText(msg);
alert.show();
}
public static void dialogError(String msg, Event event) {
dialogError(msg, getWindowFromEvent(event));
}
public static void dialogError(String msg, Window window) {
Alert alert = new Alert(AlertType.ERROR);
alert.initOwner(window);
alert.setTitle("Error");
alert.setHeaderText(null);
alert.setContentText(msg);
alert.show();
}
public static Window getWindowFromEvent(Event e) {
return ((Node) e.getSource()).getScene().getWindow();
}
}
|
UTF-8
|
Java
| 1,099 |
java
|
DialogUtils.java
|
Java
|
[] | null |
[] |
package com.andreldm.usb_barcode_reader.server.dialogs;
import javafx.event.Event;
import javafx.scene.Node;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.stage.Window;
public class DialogUtils {
public static void dialogAlert(String msg, Event event) {
dialogAlert(msg, event, AlertType.WARNING);
}
public static void dialogAlert(String msg, Event event, AlertType tipo) {
Alert alert = new Alert(tipo);
if (event != null)
alert.initOwner(getWindowFromEvent(event));
alert.setTitle("Atention");
alert.setHeaderText(null);
alert.setContentText(msg);
alert.show();
}
public static void dialogError(String msg, Event event) {
dialogError(msg, getWindowFromEvent(event));
}
public static void dialogError(String msg, Window window) {
Alert alert = new Alert(AlertType.ERROR);
alert.initOwner(window);
alert.setTitle("Error");
alert.setHeaderText(null);
alert.setContentText(msg);
alert.show();
}
public static Window getWindowFromEvent(Event e) {
return ((Node) e.getSource()).getScene().getWindow();
}
}
| 1,099 | 0.745223 | 0.745223 | 40 | 26.475 | 20.943958 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.8 | false | false |
0
|
42563b903b6bbbe871e01b91c4a2b035b519cd6a
| 103,079,287,115 |
7224776e8deb686c912ad1e196e61f93204c1539
|
/SpringBootHelloWorld/src/main/java/com/reg/baseapp/serviceDAO/CategoryServiceDAOImpl.java
|
45175c8176a2a77ed72c90263310dc716454fdaa
|
[] |
no_license
|
SateeshLeburu/SpringBootHelloWorld
|
https://github.com/SateeshLeburu/SpringBootHelloWorld
|
677ffcbac9d7b3062b8e99ab96f36f914e0f23c1
|
9aaf0eb75c71812b72a6929243a2455d4e927333
|
refs/heads/main
| 2023-03-03T21:41:12.065000 | 2021-02-17T03:01:45 | 2021-02-17T03:01:45 | 339,596,675 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.reg.baseapp.serviceDAO;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.reg.baseapp.DAO.ICategoryDAO;
import com.reg.baseapp.entity.CategoryEntity;
@Service
public class CategoryServiceDAOImpl implements ICategoryServiceDAO {
@Autowired
ICategoryDAO iCategoryDAO;
public CategoryEntity addCategory(CategoryEntity catgent) {
return iCategoryDAO.addCategory(catgent);
}
public List<CategoryEntity> getAllCategories() {
return iCategoryDAO.getAllCategories();
}
public CategoryEntity getById(int id) {
return iCategoryDAO.getById(id);
}
public List<CategoryEntity> getByFKid(int id) {
return iCategoryDAO.getByFKid(id);
}
}
|
UTF-8
|
Java
| 760 |
java
|
CategoryServiceDAOImpl.java
|
Java
|
[] | null |
[] |
package com.reg.baseapp.serviceDAO;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.reg.baseapp.DAO.ICategoryDAO;
import com.reg.baseapp.entity.CategoryEntity;
@Service
public class CategoryServiceDAOImpl implements ICategoryServiceDAO {
@Autowired
ICategoryDAO iCategoryDAO;
public CategoryEntity addCategory(CategoryEntity catgent) {
return iCategoryDAO.addCategory(catgent);
}
public List<CategoryEntity> getAllCategories() {
return iCategoryDAO.getAllCategories();
}
public CategoryEntity getById(int id) {
return iCategoryDAO.getById(id);
}
public List<CategoryEntity> getByFKid(int id) {
return iCategoryDAO.getByFKid(id);
}
}
| 760 | 0.798684 | 0.798684 | 34 | 21.352942 | 22.5152 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.911765 | false | false |
0
|
828ff9fd15c2d32be23c570a65a5cc3a412bf55b
| 30,571,577,230,055 |
4a1ebb23ff0b7e35e5ad5d239766eba063020d87
|
/src/co/com/proco/controller/AreaConocimientoController.java
|
785c451b29b7a7cf9ad0b4554b11b2ba55e8e24b
|
[] |
no_license
|
stivencuellar/proco
|
https://github.com/stivencuellar/proco
|
16f68839e58f76e872acdf1ab7f67c7a8d698680
|
8d1708cb21450cc2f098f3bb5a10b277c2d8d22b
|
refs/heads/master
| 2016-09-05T17:41:03.017000 | 2015-09-22T00:30:45 | 2015-09-22T00:30:45 | 41,735,069 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package co.com.proco.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.ModelAndView;
import co.com.proco.maestros.AreaConocimiento;
/**
* Controlador de áreas de conocimiento, clase que nos permite el manejo de eventos de la vista de áreas de conocimiento
* @author SCuellar
*
*/
@Controller
public class AreaConocimientoController {
/**
* Método que permite la navegación entre páginas, es importante resaltar que va a permitir la navegación entre
* las áreas de conocimiento.
* @return
*/
public ModelAndView flujoAreaConocimiento(){
ModelAndView modelAndView = new ModelAndView("nuevaAreaConocimiento", "sesionObj", new AreaConocimiento());
return modelAndView;
}
}
|
ISO-8859-2
|
Java
| 779 |
java
|
AreaConocimientoController.java
|
Java
|
[
{
"context": "s de la vista de áreas de conocimiento\r\n * @author SCuellar\r\n *\r\n */\r\n@Controller\r\npublic class AreaConocimie",
"end": 339,
"score": 0.9156028628349304,
"start": 331,
"tag": "NAME",
"value": "SCuellar"
}
] | null |
[] |
package co.com.proco.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.ModelAndView;
import co.com.proco.maestros.AreaConocimiento;
/**
* Controlador de áreas de conocimiento, clase que nos permite el manejo de eventos de la vista de áreas de conocimiento
* @author SCuellar
*
*/
@Controller
public class AreaConocimientoController {
/**
* Método que permite la navegación entre páginas, es importante resaltar que va a permitir la navegación entre
* las áreas de conocimiento.
* @return
*/
public ModelAndView flujoAreaConocimiento(){
ModelAndView modelAndView = new ModelAndView("nuevaAreaConocimiento", "sesionObj", new AreaConocimiento());
return modelAndView;
}
}
| 779 | 0.75 | 0.75 | 26 | 27.692308 | 35.68211 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.846154 | false | false |
0
|
f95f22a0b22d133f499872c8738295b640043503
| 22,488,448,777,305 |
9a2e2c9d593d062acb3facb6347c9373e1b17d1f
|
/src/main/java/com/java/learning/algorithm/sort/SelectionSort.java
|
91893834197c8986ab8b2997d25d69f9c9b4030a
|
[] |
no_license
|
yymoxiao7/algorithm-learning
|
https://github.com/yymoxiao7/algorithm-learning
|
45c5988f1a24acef95b0f1bcba1fbd5b12320c51
|
6d5f4dc4c96d1bd7130c38b97b84562aaddb16bd
|
refs/heads/main
| 2023-01-30T06:36:58.654000 | 2020-12-15T09:47:48 | 2020-12-15T09:47:48 | 315,293,406 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.java.learning.algorithm.sort;
import org.springframework.stereotype.Component;
/**
* 选择排序
* 首先在未排序序列中找到最小(大)元素,存放到排序序列的起始位置,然后,再从剩余未排序元素中继续寻找最小(大)元素,然后放到已排序序列的末尾。
* 以此类推,直到所有元素均排序完毕。
*/
@Component
public class SelectionSort<T extends Comparable<T>> extends BaseSort<T> implements SortInterface<T> {
@Override
public T[] sort(T[] array, String sortType) {
int length = array.length;
if (length <= 1) {
return array;
}
for (int i = 0; i <length; i++) {
//找到最小或者最大元素的下标
int index = findMinOrMax(array, i, length, sortType);
//把最大或者最小的元素跟最后一个交换
swap(array, i, index);
}
return array;
}
private int findMinOrMax(T[] arr, int start, int end, String sortType) {
if (start - end == 0) {
return start;
}
//最小或者最大的元素
int index = start;
for (int i = start; i < end; i++) {
if (!compare(arr,index, i, sortType)) {
index = i;
}
}
return index;
}
}
|
UTF-8
|
Java
| 1,393 |
java
|
SelectionSort.java
|
Java
|
[] | null |
[] |
package com.java.learning.algorithm.sort;
import org.springframework.stereotype.Component;
/**
* 选择排序
* 首先在未排序序列中找到最小(大)元素,存放到排序序列的起始位置,然后,再从剩余未排序元素中继续寻找最小(大)元素,然后放到已排序序列的末尾。
* 以此类推,直到所有元素均排序完毕。
*/
@Component
public class SelectionSort<T extends Comparable<T>> extends BaseSort<T> implements SortInterface<T> {
@Override
public T[] sort(T[] array, String sortType) {
int length = array.length;
if (length <= 1) {
return array;
}
for (int i = 0; i <length; i++) {
//找到最小或者最大元素的下标
int index = findMinOrMax(array, i, length, sortType);
//把最大或者最小的元素跟最后一个交换
swap(array, i, index);
}
return array;
}
private int findMinOrMax(T[] arr, int start, int end, String sortType) {
if (start - end == 0) {
return start;
}
//最小或者最大的元素
int index = start;
for (int i = start; i < end; i++) {
if (!compare(arr,index, i, sortType)) {
index = i;
}
}
return index;
}
}
| 1,393 | 0.528685 | 0.526037 | 41 | 25.634146 | 23.099737 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.658537 | false | false |
0
|
d54207abe4a8e4441539be425f80e25fdfc5b171
| 21,260,088,119,385 |
7039ad9ae4b267b45d25b417dad01f59bf72ab4e
|
/app/src/main/java/com/fsdstaff/ifwwtttt/WeatherAPI/WeatherApp.java
|
7809245c80f5301256297677227d09c082b9c410
|
[] |
no_license
|
adithyah/PersonalAssistant
|
https://github.com/adithyah/PersonalAssistant
|
991a93e3b0e4413464be99ee5b73c4318a05b387
|
b8cae5f8f07714196f9d4d0841663362d428b2db
|
refs/heads/master
| 2021-01-10T14:50:10.367000 | 2016-02-05T07:09:34 | 2016-02-05T07:09:34 | 48,930,066 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.fsdstaff.ifwwtttt.WeatherAPI;
import android.content.Context;
import android.content.Intent;
import android.widget.LinearLayout;
import com.fsdstaff.ifwwtttt.App;
import com.fsdstaff.ifwwtttt.CreateRuleSpinner;
import com.fsdstaff.ifwwtttt.Rule;
import com.fsdstaff.ifwwtttt.RuleGrammar.IfThen;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.List;
/**
* Created by adithyah on 1/10/16.
*/
public class WeatherApp extends App {
public final static String API_KEY = "&appid=b44be438bcb9635db7770a7bd81ebfcd";
public final static String API_URL = "http://api.openweathermap.org/data/2.5/forecast/daily";
public final static String API_URL_TRAILER = "&mode=xml&units=imperial";
public final static int FORECAST_DAY_MAX = 16;
private WeatherResponse weatherResponse;
private App appSingleton;
private HashMap<String, WeatherFeature> ifFeature;
private HashMap<String, WeatherFeature> thenFeature;
WLIfComponents ifComponents;
WLThenComponents thenComponents;
public WeatherApp(){
name = "Weather";
ifFeature = new HashMap<>();
thenFeature = new HashMap<>();
WeatherFeature ifTemp = new TemperatureFeature(name, IfThen.Type.IF);
WeatherFeature thenTemp = new TemperatureFeature(name, IfThen.Type.THEN);
ifFeature.put(ifTemp.getName(), ifTemp);
thenFeature.put(thenTemp.getName(), thenTemp);
}
@Override
public void addLayoutComponents(IfThen.Type ifThenType, LinearLayout pLayout) {
if(ifThenType == IfThen.Type.IF){
ifComponents = new WLIfComponents(pLayout.getContext(), (List) ifFeature.values());
ifComponents.addLayoutComponents(pLayout);
}
else{
thenComponents = new WLThenComponents(pLayout.getContext(), (List) thenFeature.values());
thenComponents.addLayoutComponents(pLayout);
}
}
@Override
public void scanLayoutComponents(IfThen.Type ifThenType, LinearLayout pLayout, Rule rule){
if(ifThenType == IfThen.Type.IF){
IfThen ifCond = rule.getIfCond();
ifComponents.scanLayoutComponents(pLayout, ifCond.getAppParameters());
ifCond.getBdEventList().addAll(ifComponents.getChosenFeature().getbdEvents());
}
else{
IfThen then = rule.getThen();
thenComponents.scanLayoutComponents(pLayout, then.getAppParameters());
}
}
@Override
public Intent getThenIntent(Context context, IfThen then, Intent bdIntent) {
HashMap<String, String> appParameters = then.getAppParameters();
String location = appParameters.get(ParameterType.LOCATION);
int forecastDay = Integer.parseInt(appParameters.get(ParameterType.FORECAST_DAY));
String fName = appParameters.get(ParameterType.THEN_FEATURE);
String fAction = appParameters.get(ParameterType.THEN_ACTION);
WeatherFeature feature = thenFeature.get(fName);
if(weatherResponse == null){
String urlString = buildUrl(location);
String responseString = downloadUrl(urlString);
weatherResponse = new WeatherResponse(responseString);
}
return feature.getThenIntent(context, fAction, forecastDay, weatherResponse);
}
@Override
public boolean checkIf(Context context, IfThen ifCond, Intent bdIntent) {
HashMap<String, String> appParameters = ifCond.getAppParameters();
String location = appParameters.get(ParameterType.LOCATION);
int forecastDay = Integer.parseInt(appParameters.get(ParameterType.FORECAST_DAY));
String fName = appParameters.get(ParameterType.IF_FEATURE);
String fVal = appParameters.get(ParameterType.IF_VAL);
WeatherFeature feature = ifFeature.get(fName);
if(weatherResponse == null){
String urlString = buildUrl(location);
String responseString = downloadUrl(urlString);
weatherResponse = new WeatherResponse(responseString);
}
return feature.checkIf(context, fVal, forecastDay, weatherResponse);
}
@Override
public App getInstance() {
if(appSingleton == null){
appSingleton = new WeatherApp();
}
return appSingleton;
}
public String buildUrl(String location){
return API_URL + "?q=" + location + API_URL_TRAILER + API_KEY;
}
public String downloadUrl(String urlStr){
String data = "";
InputStream iStream = null;
HttpURLConnection urlConnection = null;
try {
URL url = new URL(urlStr);
urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.connect();
iStream = urlConnection.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(iStream));
StringBuffer sb = new StringBuffer();
String line = "";
while ((line = br.readLine()) != null) {
sb.append(line);
}
data = sb.toString();
br.close();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return data;
}
}
|
UTF-8
|
Java
| 5,489 |
java
|
WeatherApp.java
|
Java
|
[
{
"context": "HashMap;\nimport java.util.List;\n\n/**\n * Created by adithyah on 1/10/16.\n */\npublic class WeatherApp extends A",
"end": 602,
"score": 0.9996163249015808,
"start": 594,
"tag": "USERNAME",
"value": "adithyah"
},
{
"context": "nds App {\n public final static String API_KEY = \"&appid=b44be438bcb9635db7770a7bd81ebfcd\";\n public fina",
"end": 706,
"score": 0.9790308475494385,
"start": 698,
"tag": "KEY",
"value": "\"&appid="
},
{
"context": "\n public final static String API_KEY = \"&appid=b44be438bcb9635db7770a7bd81ebfcd\";\n public final static String API_URL = \"http:",
"end": 738,
"score": 0.9986894726753235,
"start": 706,
"tag": "KEY",
"value": "b44be438bcb9635db7770a7bd81ebfcd"
}
] | null |
[] |
package com.fsdstaff.ifwwtttt.WeatherAPI;
import android.content.Context;
import android.content.Intent;
import android.widget.LinearLayout;
import com.fsdstaff.ifwwtttt.App;
import com.fsdstaff.ifwwtttt.CreateRuleSpinner;
import com.fsdstaff.ifwwtttt.Rule;
import com.fsdstaff.ifwwtttt.RuleGrammar.IfThen;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.List;
/**
* Created by adithyah on 1/10/16.
*/
public class WeatherApp extends App {
public final static String API_KEY = "&appid=<KEY>";
public final static String API_URL = "http://api.openweathermap.org/data/2.5/forecast/daily";
public final static String API_URL_TRAILER = "&mode=xml&units=imperial";
public final static int FORECAST_DAY_MAX = 16;
private WeatherResponse weatherResponse;
private App appSingleton;
private HashMap<String, WeatherFeature> ifFeature;
private HashMap<String, WeatherFeature> thenFeature;
WLIfComponents ifComponents;
WLThenComponents thenComponents;
public WeatherApp(){
name = "Weather";
ifFeature = new HashMap<>();
thenFeature = new HashMap<>();
WeatherFeature ifTemp = new TemperatureFeature(name, IfThen.Type.IF);
WeatherFeature thenTemp = new TemperatureFeature(name, IfThen.Type.THEN);
ifFeature.put(ifTemp.getName(), ifTemp);
thenFeature.put(thenTemp.getName(), thenTemp);
}
@Override
public void addLayoutComponents(IfThen.Type ifThenType, LinearLayout pLayout) {
if(ifThenType == IfThen.Type.IF){
ifComponents = new WLIfComponents(pLayout.getContext(), (List) ifFeature.values());
ifComponents.addLayoutComponents(pLayout);
}
else{
thenComponents = new WLThenComponents(pLayout.getContext(), (List) thenFeature.values());
thenComponents.addLayoutComponents(pLayout);
}
}
@Override
public void scanLayoutComponents(IfThen.Type ifThenType, LinearLayout pLayout, Rule rule){
if(ifThenType == IfThen.Type.IF){
IfThen ifCond = rule.getIfCond();
ifComponents.scanLayoutComponents(pLayout, ifCond.getAppParameters());
ifCond.getBdEventList().addAll(ifComponents.getChosenFeature().getbdEvents());
}
else{
IfThen then = rule.getThen();
thenComponents.scanLayoutComponents(pLayout, then.getAppParameters());
}
}
@Override
public Intent getThenIntent(Context context, IfThen then, Intent bdIntent) {
HashMap<String, String> appParameters = then.getAppParameters();
String location = appParameters.get(ParameterType.LOCATION);
int forecastDay = Integer.parseInt(appParameters.get(ParameterType.FORECAST_DAY));
String fName = appParameters.get(ParameterType.THEN_FEATURE);
String fAction = appParameters.get(ParameterType.THEN_ACTION);
WeatherFeature feature = thenFeature.get(fName);
if(weatherResponse == null){
String urlString = buildUrl(location);
String responseString = downloadUrl(urlString);
weatherResponse = new WeatherResponse(responseString);
}
return feature.getThenIntent(context, fAction, forecastDay, weatherResponse);
}
@Override
public boolean checkIf(Context context, IfThen ifCond, Intent bdIntent) {
HashMap<String, String> appParameters = ifCond.getAppParameters();
String location = appParameters.get(ParameterType.LOCATION);
int forecastDay = Integer.parseInt(appParameters.get(ParameterType.FORECAST_DAY));
String fName = appParameters.get(ParameterType.IF_FEATURE);
String fVal = appParameters.get(ParameterType.IF_VAL);
WeatherFeature feature = ifFeature.get(fName);
if(weatherResponse == null){
String urlString = buildUrl(location);
String responseString = downloadUrl(urlString);
weatherResponse = new WeatherResponse(responseString);
}
return feature.checkIf(context, fVal, forecastDay, weatherResponse);
}
@Override
public App getInstance() {
if(appSingleton == null){
appSingleton = new WeatherApp();
}
return appSingleton;
}
public String buildUrl(String location){
return API_URL + "?q=" + location + API_URL_TRAILER + API_KEY;
}
public String downloadUrl(String urlStr){
String data = "";
InputStream iStream = null;
HttpURLConnection urlConnection = null;
try {
URL url = new URL(urlStr);
urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.connect();
iStream = urlConnection.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(iStream));
StringBuffer sb = new StringBuffer();
String line = "";
while ((line = br.readLine()) != null) {
sb.append(line);
}
data = sb.toString();
br.close();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return data;
}
}
| 5,462 | 0.669156 | 0.664602 | 142 | 37.65493 | 27.509806 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.753521 | false | false |
0
|
dacb2f50c0c3ab26e845135c16b6c60ab495d6be
| 17,592,186,055,054 |
c5acf7cd1c3568899ac0d284250e784dc4ec6b95
|
/app/src/main/java/com/example/userapp/Bienvenido.java
|
1843973b8d2a60be92cb471cc28ae8e4ff6c1fe8
|
[] |
no_license
|
Fernando-Lagunas/UserApp
|
https://github.com/Fernando-Lagunas/UserApp
|
bf246f29385f5aa14468ed7ba2884f9d753714aa
|
483fb906b42326eeaed58d5a90285110e85224d3
|
refs/heads/master
| 2023-01-21T14:57:07.174000 | 2020-12-03T20:51:05 | 2020-12-03T20:51:05 | 318,316,390 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.userapp;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
public class Bienvenido extends AppCompatActivity {
TextView saludo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bienvenido);
String message = getIntent().getStringExtra(MainActivity.mensaje);
saludo = (TextView) findViewById(R.id.tvBienvenido);
saludo.setText("Bienvenid@ "+message+"!");
}
}
|
UTF-8
|
Java
| 582 |
java
|
Bienvenido.java
|
Java
|
[] | null |
[] |
package com.example.userapp;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
public class Bienvenido extends AppCompatActivity {
TextView saludo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bienvenido);
String message = getIntent().getStringExtra(MainActivity.mensaje);
saludo = (TextView) findViewById(R.id.tvBienvenido);
saludo.setText("Bienvenid@ "+message+"!");
}
}
| 582 | 0.725086 | 0.725086 | 23 | 24.26087 | 24.408155 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.434783 | false | false |
0
|
174b460adc1bd5370c78b5c54ca74b8ea4cce045
| 16,758,962,404,596 |
808bbf58e5c02059e5d32da4780a87fde6e8d4ed
|
/repository-module/src/main/java/com/gmail/yauhenizhukovich/app/repository/UserRepository.java
|
bb9bfcc05ad53e44c2ac5bea17d1f7c7c3b5f979
|
[] |
no_license
|
yauhenizhukovich/online_store
|
https://github.com/yauhenizhukovich/online_store
|
0434bf3bdfd605246ada51088c249e44c447312a
|
742724c70891dcb540cce014289701b7b0a3d898
|
refs/heads/develop
| 2022-07-02T19:10:16.749000 | 2020-05-18T09:06:33 | 2020-05-18T09:06:33 | 251,557,940 | 0 | 0 | null | false | 2020-05-18T09:07:28 | 2020-03-31T09:30:56 | 2020-05-18T09:06:36 | 2020-05-18T09:06:34 | 601 | 0 | 0 | 1 |
Java
| false | false |
package com.gmail.yauhenizhukovich.app.repository;
import com.gmail.yauhenizhukovich.app.repository.model.RoleEnumRepository;
import com.gmail.yauhenizhukovich.app.repository.model.User;
public interface UserRepository extends GenericRepository<Long, User> {
User getUserByEmail(String email);
User getUserByUniqueNumber(String uniqueNumber);
Long getCountOfUsersByRole(RoleEnumRepository role);
}
|
UTF-8
|
Java
| 416 |
java
|
UserRepository.java
|
Java
|
[] | null |
[] |
package com.gmail.yauhenizhukovich.app.repository;
import com.gmail.yauhenizhukovich.app.repository.model.RoleEnumRepository;
import com.gmail.yauhenizhukovich.app.repository.model.User;
public interface UserRepository extends GenericRepository<Long, User> {
User getUserByEmail(String email);
User getUserByUniqueNumber(String uniqueNumber);
Long getCountOfUsersByRole(RoleEnumRepository role);
}
| 416 | 0.822115 | 0.822115 | 14 | 28.714285 | 29.711538 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
0
|
2c41b25a1bca7afcc32e35a47d19141933d9de72
| 1,915,555,425,526 |
508bef5e1b024287aba02b55f3f10737b4127fee
|
/texteditor.java
|
fd19e8cc0a46743fba5a7aa7d02aa0b628c37124
|
[] |
no_license
|
sharika-anjum/Placement-Preparation
|
https://github.com/sharika-anjum/Placement-Preparation
|
2749449860ee3c4f1a176bcd5569037eb4850224
|
7e5878d0619f96de3b4836a7fce387f5dcee7819
|
refs/heads/master
| 2023-04-07T01:47:58.398000 | 2021-04-21T11:30:00 | 2021-04-21T11:30:00 | 299,330,936 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.company;
import java.util.Stack;
public class texteditor {
public static void main(String args[]){
String input = "Hello";
String ops = "uuur";
String result = editor(input,ops);
System.out.println(result);
}
public static String editor(String input, String ops){
Stack <Character> undo = new Stack();
Stack <Character> redo = new Stack();
//stroing the entire string in a stack
for(int i=0;i<input.length();i++){
char ch = input.charAt(i);
undo.push(ch);
}
for(int j =0;j<ops.length();j++){
char curr = ops.charAt(j);
if(curr == 'u'){ //undoing
char temp = undo.pop();
redo.push(temp);
}
else{ //redoing
char temp = redo.pop();
undo.push(temp);
}
}
//Now we gotta reverse the string
String result = "";
while(!undo.isEmpty()){
result = undo.pop() + result;
}
return result;
}
//Time complexity - o(n)
//Memory complexity - o(n)
}
|
UTF-8
|
Java
| 1,228 |
java
|
texteditor.java
|
Java
|
[
{
"context": "d main(String args[]){\r\n\r\n String input = \"Hello\";\r\n String ops = \"uuur\";\r\n\r\n String",
"end": 156,
"score": 0.9238017797470093,
"start": 151,
"tag": "NAME",
"value": "Hello"
}
] | null |
[] |
package com.company;
import java.util.Stack;
public class texteditor {
public static void main(String args[]){
String input = "Hello";
String ops = "uuur";
String result = editor(input,ops);
System.out.println(result);
}
public static String editor(String input, String ops){
Stack <Character> undo = new Stack();
Stack <Character> redo = new Stack();
//stroing the entire string in a stack
for(int i=0;i<input.length();i++){
char ch = input.charAt(i);
undo.push(ch);
}
for(int j =0;j<ops.length();j++){
char curr = ops.charAt(j);
if(curr == 'u'){ //undoing
char temp = undo.pop();
redo.push(temp);
}
else{ //redoing
char temp = redo.pop();
undo.push(temp);
}
}
//Now we gotta reverse the string
String result = "";
while(!undo.isEmpty()){
result = undo.pop() + result;
}
return result;
}
//Time complexity - o(n)
//Memory complexity - o(n)
}
| 1,228 | 0.467427 | 0.465798 | 54 | 20.74074 | 17.611217 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false |
0
|
25aeadd6ba8f25a4cf3f39d99c4f0b681937d782
| 8,392,366,107,933 |
89ba2ec92ac2cc7a2fad7fabd4add07fd007e013
|
/app/src/main/java/com/example/javaharkka/Adapter_browse.java
|
1d009ab33ba4e8746662140f9a5326829b1274a6
|
[] |
no_license
|
Tompparella/CiviVPlanner
|
https://github.com/Tompparella/CiviVPlanner
|
52dc2aa3239b80d895dce71a1fb6fba51cbffdc0
|
e29c37cead16e6c496536810810fad034dff4865
|
refs/heads/master
| 2022-06-21T17:49:22.183000 | 2020-05-06T08:45:11 | 2020-05-06T08:45:11 | 251,296,635 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
CiviVPlanner; Android Studio; Tommi Kunnari; Adapter_browse.class;
This adapter manages adding new entry_browse.xml cardviews containing
a Plan's info to a recyclerview. A modified version of Adapter. I know
this could have been done a bit more cleanly, but this works so I'm going
with it for now. I might fix this in the future.
*/
package com.example.javaharkka;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import java.lang.Math;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
public class Adapter_browse extends RecyclerView.Adapter<Adapter_browse.ViewHolder_browse> {
private OnItemClickListener mListener;
private ArrayList<Plan> mEntryList;
public interface OnItemClickListener {
void itemClick(int position);
// void onDeleteClick(int position);
}
public void setOnItemClickListener(OnItemClickListener listener){
mListener = listener;
}
public static class ViewHolder_browse extends RecyclerView.ViewHolder {
TextView planView;
TextView scoreView;
TextView creatorView;
ImageView orientationImage;
ViewHolder_browse(@NonNull View itemView, final OnItemClickListener listener)
{
super(itemView);
planView = itemView.findViewById(R.id.planName);
scoreView = itemView.findViewById(R.id.scoreTxt);
orientationImage = itemView.findViewById(R.id.orientationImg);
creatorView = itemView.findViewById(R.id.creatorTxt);
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) { // Adds a clicklistener to the newly created cardview
if (listener != null){
int position = getAdapterPosition();
if (position != RecyclerView.NO_POSITION){
listener.itemClick(position);
}
}
}
});
/* deleteImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null){
int position = getAdapterPosition();
if (position != RecyclerView.NO_POSITION){
listener.onDeleteClick(position);
}
}
}
}); */
}
}
public Adapter_browse(ArrayList<Plan> entryList) {
mEntryList = entryList;
}
@NonNull
@Override
public ViewHolder_browse onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { // Attaches a Plan's info to a entry_browse.xml layout
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.entry_browse,parent,false);
return new ViewHolder_browse(v, mListener);
}
@Override
public void onBindViewHolder(@NonNull ViewHolder_browse holder, int position) { // Inserts the newly made entry to the desired recyclerview
Plan currentItem = mEntryList.get(position);
holder.planView.setText(currentItem.planName);
switch (currentItem.orientation){
case "Technology":
holder.orientationImage.setImageResource(R.drawable.science_icon);
break;
case "Culture":
holder.orientationImage.setImageResource(R.drawable.culture_icon);
break;
case "Diplomacy":
holder.orientationImage.setImageResource(R.drawable.diplmacy_icon);
break;
case "Conquest":
holder.orientationImage.setImageResource(R.drawable.conquest_icon);
break;
default:
holder.orientationImage.setImageResource(R.drawable.ic_delete);
break;
}
holder.creatorView.setText("By: " + currentItem.creator);
int score = Math.round(currentItem.score);
if (score <= 51){
holder.scoreView.setTextColor(Color.parseColor("#FA6337"));
}
holder.scoreView.setText((score) + "%");
}
@Override
public int getItemCount() {
return mEntryList.size();
}
}
|
UTF-8
|
Java
| 4,496 |
java
|
Adapter_browse.java
|
Java
|
[
{
"context": "/*\nCiviVPlanner; Android Studio; Tommi Kunnari; Adapter_browse.class;\n\nThis adapter manages addi",
"end": 46,
"score": 0.9998847842216492,
"start": 33,
"tag": "NAME",
"value": "Tommi Kunnari"
}
] | null |
[] |
/*
CiviVPlanner; Android Studio; <NAME>; Adapter_browse.class;
This adapter manages adding new entry_browse.xml cardviews containing
a Plan's info to a recyclerview. A modified version of Adapter. I know
this could have been done a bit more cleanly, but this works so I'm going
with it for now. I might fix this in the future.
*/
package com.example.javaharkka;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import java.lang.Math;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
public class Adapter_browse extends RecyclerView.Adapter<Adapter_browse.ViewHolder_browse> {
private OnItemClickListener mListener;
private ArrayList<Plan> mEntryList;
public interface OnItemClickListener {
void itemClick(int position);
// void onDeleteClick(int position);
}
public void setOnItemClickListener(OnItemClickListener listener){
mListener = listener;
}
public static class ViewHolder_browse extends RecyclerView.ViewHolder {
TextView planView;
TextView scoreView;
TextView creatorView;
ImageView orientationImage;
ViewHolder_browse(@NonNull View itemView, final OnItemClickListener listener)
{
super(itemView);
planView = itemView.findViewById(R.id.planName);
scoreView = itemView.findViewById(R.id.scoreTxt);
orientationImage = itemView.findViewById(R.id.orientationImg);
creatorView = itemView.findViewById(R.id.creatorTxt);
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) { // Adds a clicklistener to the newly created cardview
if (listener != null){
int position = getAdapterPosition();
if (position != RecyclerView.NO_POSITION){
listener.itemClick(position);
}
}
}
});
/* deleteImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null){
int position = getAdapterPosition();
if (position != RecyclerView.NO_POSITION){
listener.onDeleteClick(position);
}
}
}
}); */
}
}
public Adapter_browse(ArrayList<Plan> entryList) {
mEntryList = entryList;
}
@NonNull
@Override
public ViewHolder_browse onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { // Attaches a Plan's info to a entry_browse.xml layout
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.entry_browse,parent,false);
return new ViewHolder_browse(v, mListener);
}
@Override
public void onBindViewHolder(@NonNull ViewHolder_browse holder, int position) { // Inserts the newly made entry to the desired recyclerview
Plan currentItem = mEntryList.get(position);
holder.planView.setText(currentItem.planName);
switch (currentItem.orientation){
case "Technology":
holder.orientationImage.setImageResource(R.drawable.science_icon);
break;
case "Culture":
holder.orientationImage.setImageResource(R.drawable.culture_icon);
break;
case "Diplomacy":
holder.orientationImage.setImageResource(R.drawable.diplmacy_icon);
break;
case "Conquest":
holder.orientationImage.setImageResource(R.drawable.conquest_icon);
break;
default:
holder.orientationImage.setImageResource(R.drawable.ic_delete);
break;
}
holder.creatorView.setText("By: " + currentItem.creator);
int score = Math.round(currentItem.score);
if (score <= 51){
holder.scoreView.setTextColor(Color.parseColor("#FA6337"));
}
holder.scoreView.setText((score) + "%");
}
@Override
public int getItemCount() {
return mEntryList.size();
}
}
| 4,489 | 0.617883 | 0.616548 | 122 | 35.852459 | 30.564276 | 154 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.508197 | false | false |
0
|
f6c352326fd7689483bd22e99aba926add0c7806
| 1,133,871,376,432 |
b4c06d6a02885856e882614b9fa81f930e7f6dcd
|
/flink-streaming/src/main/java/com/intsmaze/flink/streaming/window/process/ProcessWindowReduceTemplate.java
|
5c615474bb2f3cb3dd30ba24c068fd48e8cb8e4a
|
[] |
no_license
|
ChiYaoLa/flinkbook
|
https://github.com/ChiYaoLa/flinkbook
|
6d91e85d3cd2aa64d7aec360df6b45c8aa773925
|
9dda17881b7caa7680e034838521f55373b72173
|
refs/heads/master
| 2023-03-25T13:08:49.556000 | 2021-03-25T13:22:03 | 2021-03-25T13:22:03 | 341,820,493 | 0 | 0 | null | false | 2021-03-25T13:22:04 | 2021-02-24T07:49:02 | 2021-02-24T11:54:37 | 2021-03-25T13:22:03 | 477 | 0 | 0 | 0 |
Java
| false | false |
package com.intsmaze.flink.streaming.window.process;
import com.intsmaze.flink.streaming.window.source.SourceForWindow;
import org.apache.flink.api.common.functions.ReduceFunction;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.api.java.tuple.Tuple3;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.functions.windowing.ProcessWindowFunction;
import org.apache.flink.streaming.api.windowing.assigners.TumblingProcessingTimeWindows;
import org.apache.flink.streaming.api.windowing.time.Time;
import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
import org.apache.flink.util.Collector;
import java.util.Iterator;
/**
* github地址: https://github.com/ChiYaoLa
*
* 参阅 出版书籍《深入理解Flink核心设计与实践原理》 随书代码
*
* @auther: xuliang
* @date: 2020/10/15 18:33
*/
public class ProcessWindowReduceTemplate {
/**
* github地址: https://github.com/ChiYaoLa
*
* 参阅 出版书籍《深入理解Flink核心设计与实践原理》 随书代码
*
* @auther: xuliang
* @date: 2020/10/15 18:33
*/
public static void main(String[] args) throws Exception {
final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.setParallelism(1);
DataStream<Tuple3<String, Integer, String>> streamSource = env.addSource(new SourceForWindow(1000));
DataStream<Tuple2<Long, Tuple3<String, Integer, String>>> reduceStream = streamSource
.keyBy(t -> t.f0)
.window(TumblingProcessingTimeWindows.of(Time.seconds(5)))
.reduce(new ReduceFunction<Tuple3<String, Integer, String>>() {
@Override
public Tuple3<String, Integer, String> reduce(Tuple3<String, Integer, String> r1, Tuple3<String, Integer, String> r2) {
return r1.f1 > r2.f1 ? r2 : r1;
}
}, new UserDefinedProcessWindow());
reduceStream.print();
env.execute("ProcessWindowReduceTemplate");
}
/**
* github地址: https://github.com/ChiYaoLa
*
* 参阅 出版书籍《深入理解Flink核心设计与实践原理》 随书代码
*
* @auther: xuliang
* @date: 2020/10/15 18:33
*/
public static class UserDefinedProcessWindow
extends ProcessWindowFunction<Tuple3<String, Integer, String>, Tuple2<Long, Tuple3<String, Integer, String>>, String, TimeWindow> {
/**
* github地址: https://github.com/ChiYaoLa
*
* 参阅 出版书籍《深入理解Flink核心设计与实践原理》 随书代码
*
* @auther: xuliang
* @date: 2020/10/15 18:33
*/
@Override
public void process(String key,
Context context,
Iterable<Tuple3<String, Integer, String>> minReadings,
Collector<Tuple2<Long, Tuple3<String, Integer, String>>> out) {
Iterator<Tuple3<String, Integer, String>> iterator = minReadings.iterator();
if (iterator.hasNext()) {
Tuple3<String, Integer, String> min = iterator.next();
Long start = context.window().getStart();
out.collect(new Tuple2<Long, Tuple3<String, Integer, String>>(start, min));
}
}
}
}
|
UTF-8
|
Java
| 3,558 |
java
|
ProcessWindowReduceTemplate.java
|
Java
|
[
{
"context": "l.Iterator;\n\n\n/**\n * github地址: https://github.com/ChiYaoLa\n * \n * 参阅 出版书籍《深入理解Flink核心设计与实践原理》 随书代码\n *\n * @au",
"end": 826,
"score": 0.9996077418327332,
"start": 818,
"tag": "USERNAME",
"value": "ChiYaoLa"
},
{
"context": " * 参阅 出版书籍《深入理解Flink核心设计与实践原理》 随书代码\n *\n * @auther: xuliang\n * @date: 2020/10/15 18:33\n */\npublic class Proce",
"end": 889,
"score": 0.9996581077575684,
"start": 882,
"tag": "USERNAME",
"value": "xuliang"
},
{
"context": "ate {\n /**\n * github地址: https://github.com/ChiYaoLa\n * \n * 参阅 出版书籍《深入理解Flink核心设计与实践原理》 随书代码\n ",
"end": 1016,
"score": 0.999629557132721,
"start": 1008,
"tag": "USERNAME",
"value": "ChiYaoLa"
},
{
"context": "书籍《深入理解Flink核心设计与实践原理》 随书代码\n *\n * @auther: xuliang\n * @date: 2020/10/15 18:33\n */\n public",
"end": 1095,
"score": 0.9996518492698669,
"start": 1088,
"tag": "USERNAME",
"value": "xuliang"
},
{
"context": " }\n\n\n /**\n * github地址: https://github.com/ChiYaoLa\n * \n * 参阅 出版书籍《深入理解Flink核心设计与实践原理》 随书代码\n ",
"end": 2166,
"score": 0.9996511936187744,
"start": 2158,
"tag": "USERNAME",
"value": "ChiYaoLa"
},
{
"context": "书籍《深入理解Flink核心设计与实践原理》 随书代码\n *\n * @auther: xuliang\n * @date: 2020/10/15 18:33\n */\n public",
"end": 2245,
"score": 0.9996595978736877,
"start": 2238,
"tag": "USERNAME",
"value": "xuliang"
},
{
"context": " /**\n * github地址: https://github.com/ChiYaoLa\n * \n * 参阅 出版书籍《深入理解Flink核心设计与实践原理",
"end": 2538,
"score": 0.9996402859687805,
"start": 2530,
"tag": "USERNAME",
"value": "ChiYaoLa"
},
{
"context": "link核心设计与实践原理》 随书代码\n *\n * @auther: xuliang\n * @date: 2020/10/15 18:33\n */\n ",
"end": 2633,
"score": 0.9996712803840637,
"start": 2626,
"tag": "USERNAME",
"value": "xuliang"
}
] | null |
[] |
package com.intsmaze.flink.streaming.window.process;
import com.intsmaze.flink.streaming.window.source.SourceForWindow;
import org.apache.flink.api.common.functions.ReduceFunction;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.api.java.tuple.Tuple3;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.functions.windowing.ProcessWindowFunction;
import org.apache.flink.streaming.api.windowing.assigners.TumblingProcessingTimeWindows;
import org.apache.flink.streaming.api.windowing.time.Time;
import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
import org.apache.flink.util.Collector;
import java.util.Iterator;
/**
* github地址: https://github.com/ChiYaoLa
*
* 参阅 出版书籍《深入理解Flink核心设计与实践原理》 随书代码
*
* @auther: xuliang
* @date: 2020/10/15 18:33
*/
public class ProcessWindowReduceTemplate {
/**
* github地址: https://github.com/ChiYaoLa
*
* 参阅 出版书籍《深入理解Flink核心设计与实践原理》 随书代码
*
* @auther: xuliang
* @date: 2020/10/15 18:33
*/
public static void main(String[] args) throws Exception {
final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.setParallelism(1);
DataStream<Tuple3<String, Integer, String>> streamSource = env.addSource(new SourceForWindow(1000));
DataStream<Tuple2<Long, Tuple3<String, Integer, String>>> reduceStream = streamSource
.keyBy(t -> t.f0)
.window(TumblingProcessingTimeWindows.of(Time.seconds(5)))
.reduce(new ReduceFunction<Tuple3<String, Integer, String>>() {
@Override
public Tuple3<String, Integer, String> reduce(Tuple3<String, Integer, String> r1, Tuple3<String, Integer, String> r2) {
return r1.f1 > r2.f1 ? r2 : r1;
}
}, new UserDefinedProcessWindow());
reduceStream.print();
env.execute("ProcessWindowReduceTemplate");
}
/**
* github地址: https://github.com/ChiYaoLa
*
* 参阅 出版书籍《深入理解Flink核心设计与实践原理》 随书代码
*
* @auther: xuliang
* @date: 2020/10/15 18:33
*/
public static class UserDefinedProcessWindow
extends ProcessWindowFunction<Tuple3<String, Integer, String>, Tuple2<Long, Tuple3<String, Integer, String>>, String, TimeWindow> {
/**
* github地址: https://github.com/ChiYaoLa
*
* 参阅 出版书籍《深入理解Flink核心设计与实践原理》 随书代码
*
* @auther: xuliang
* @date: 2020/10/15 18:33
*/
@Override
public void process(String key,
Context context,
Iterable<Tuple3<String, Integer, String>> minReadings,
Collector<Tuple2<Long, Tuple3<String, Integer, String>>> out) {
Iterator<Tuple3<String, Integer, String>> iterator = minReadings.iterator();
if (iterator.hasNext()) {
Tuple3<String, Integer, String> min = iterator.next();
Long start = context.window().getStart();
out.collect(new Tuple2<Long, Tuple3<String, Integer, String>>(start, min));
}
}
}
}
| 3,558 | 0.639437 | 0.614901 | 88 | 36.954544 | 32.941723 | 143 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.715909 | false | false |
0
|
b0451c1135896f99bc063b88a0b6077aac39fff9
| 7,636,451,856,919 |
e7aa97a695bb56c554dc0a66fb3a7a4408db44f2
|
/tools/gcc-bridge/src/main/java/org/renjin/gcc/translate/call/GccFunction.java
|
98a112fc79ec52cf26f8ec1aa16d1c4c4ed63aec
|
[] |
no_license
|
GregBowyer/renjin
|
https://github.com/GregBowyer/renjin
|
2eb822880bdd0bfc2eb4dfbf3e5bdfb30a5cdf40
|
a9a51b300bad2c816c03e3f4757807a56d3fe8b1
|
refs/heads/master
| 2016-05-28T23:09:24.677000 | 2013-03-11T11:12:51 | 2013-03-11T11:14:01 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.renjin.gcc.translate.call;
import java.util.List;
import org.renjin.gcc.jimple.JimpleType;
public class GccFunction extends MethodRef {
private String className;
private String methodName;
private JimpleType returnType;
private List<JimpleType> parameterTypes;
public GccFunction(String className, String methodName, JimpleType returnType, List<JimpleType> parameterTypes) {
this.className = className;
this.methodName = methodName;
this.returnType = returnType;
this.parameterTypes = parameterTypes;
}
@Override
public JimpleType getReturnType() {
return returnType;
}
@Override
public List<JimpleType> getParameterTypes() {
return parameterTypes;
}
@Override
public String getDeclaringClass() {
return className;
}
@Override
public String getMethodName() {
return methodName;
}
@Override
public String getClassName() {
return className;
}
}
|
UTF-8
|
Java
| 990 |
java
|
GccFunction.java
|
Java
|
[] | null |
[] |
package org.renjin.gcc.translate.call;
import java.util.List;
import org.renjin.gcc.jimple.JimpleType;
public class GccFunction extends MethodRef {
private String className;
private String methodName;
private JimpleType returnType;
private List<JimpleType> parameterTypes;
public GccFunction(String className, String methodName, JimpleType returnType, List<JimpleType> parameterTypes) {
this.className = className;
this.methodName = methodName;
this.returnType = returnType;
this.parameterTypes = parameterTypes;
}
@Override
public JimpleType getReturnType() {
return returnType;
}
@Override
public List<JimpleType> getParameterTypes() {
return parameterTypes;
}
@Override
public String getDeclaringClass() {
return className;
}
@Override
public String getMethodName() {
return methodName;
}
@Override
public String getClassName() {
return className;
}
}
| 990 | 0.7 | 0.7 | 46 | 19.52174 | 21.12359 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.413043 | false | false |
0
|
136f94c380ee96af9cbc1720a167e966ecbf8747
| 19,215,683,720,561 |
775e540855375308ffc823e56f965e8cfeb85243
|
/src/main/java/com/hyh/shoppingmallmanage/service/SpuService.java
|
5a1477dc9a6fa5f8f2621fb917f72ba87fca596c
|
[] |
no_license
|
Hanyuhuang/shoppingmall-manage
|
https://github.com/Hanyuhuang/shoppingmall-manage
|
9a6cad372ad43820114d25f6f7bbacf5e3650056
|
3e167732b6a840f33fcfb38a9b318fb92f3442f6
|
refs/heads/master
| 2020-04-17T22:26:27.210000 | 2019-01-22T13:04:58 | 2019-01-22T13:04:58 | 166,993,428 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.hyh.shoppingmallmanage.service;
import com.hyh.shoppingmallmanage.entity.Product;
import com.hyh.shoppingmallmanage.entity.ProductImage;
import java.util.List;
public interface SpuService {
void addSpu(Product spu);
void addImages(List<ProductImage> images);
void deleteSpu(Product spu);
void updateSpu(Product spu);
Product getSpu(Product spu);
List<Product> listSpu(Product spu);
}
|
UTF-8
|
Java
| 413 |
java
|
SpuService.java
|
Java
|
[] | null |
[] |
package com.hyh.shoppingmallmanage.service;
import com.hyh.shoppingmallmanage.entity.Product;
import com.hyh.shoppingmallmanage.entity.ProductImage;
import java.util.List;
public interface SpuService {
void addSpu(Product spu);
void addImages(List<ProductImage> images);
void deleteSpu(Product spu);
void updateSpu(Product spu);
Product getSpu(Product spu);
List<Product> listSpu(Product spu);
}
| 413 | 0.784504 | 0.784504 | 23 | 16.956522 | 18.908195 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.695652 | false | false |
0
|
cd913d883c5fc28b2bb0a93125b7dda717333248
| 9,801,115,370,034 |
db386c5b3bdcad10a9bf960351fb1304094cffd8
|
/LearningJDBC/src/main/java/by/moiseenko/service/ProductService.java
|
dc8024e1d7f2d10f54fb67766f1e9c1af0a77c15
|
[] |
no_license
|
SMoiseenko/Learning
|
https://github.com/SMoiseenko/Learning
|
31cc40504d58b3142f18f72fbcccd7ee583b0b38
|
e3634d8e877251bfe9519c91602d607b439854dd
|
refs/heads/master
| 2023-05-10T15:52:00.710000 | 2022-11-18T13:39:05 | 2022-11-18T13:39:05 | 172,510,726 | 0 | 0 | null | false | 2023-05-09T18:10:30 | 2019-02-25T13:25:51 | 2022-01-25T13:54:32 | 2023-05-09T18:10:29 | 9,533 | 0 | 0 | 22 |
Java
| false | false |
package by.moiseenko.service;
import by.moiseenko.model.Product;
import java.util.List;
/**
* Default javadoc
*
* @author moiseenko-s
*/
public interface ProductService {
List<Product> getAllProducts();
long addProductToDB(Product product);
Product findProductById(long id);
void updateProduct(Product product);
void deleteProduct(long Id);
}
|
UTF-8
|
Java
| 364 |
java
|
ProductService.java
|
Java
|
[
{
"context": "a.util.List;\n\n/**\n * Default javadoc\n *\n * @author moiseenko-s\n */\npublic interface ProductService {\n\n List<Pro",
"end": 138,
"score": 0.9995450973510742,
"start": 127,
"tag": "USERNAME",
"value": "moiseenko-s"
}
] | null |
[] |
package by.moiseenko.service;
import by.moiseenko.model.Product;
import java.util.List;
/**
* Default javadoc
*
* @author moiseenko-s
*/
public interface ProductService {
List<Product> getAllProducts();
long addProductToDB(Product product);
Product findProductById(long id);
void updateProduct(Product product);
void deleteProduct(long Id);
}
| 364 | 0.741758 | 0.741758 | 22 | 15.545455 | 15.467642 | 39 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.363636 | false | false |
0
|
f8b2e595e4885904e819414fa035ede1b67b38a8
| 24,326,694,822,197 |
3fb01834fe9d6a3d28ea8f3bbf5dd97641765c3f
|
/src/main/java/me/dags/animation/animation/Animation.java
|
c206fdae74cf9f95bad073b09d9572d01e160789
|
[] |
no_license
|
dags-/a
|
https://github.com/dags-/a
|
ff751e0e06b71474c3fa4308fb48d288469ebf4b
|
896d2a4ffbe2e6db7a7bfc90fd58649cd7da8f26
|
refs/heads/master
| 2021-01-20T02:28:45.336000 | 2017-05-01T21:55:44 | 2017-05-01T21:55:44 | 89,411,291 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package me.dags.animation.animation;
import com.flowpowered.math.vector.Vector3i;
import me.dags.animation.Sequence;
import me.dags.animation.frame.Frame;
import org.spongepowered.api.world.World;
/**
* @author dags <dags@dags.me>
*/
public interface Animation {
Sequence<Frame> getTimeline();
boolean hasFinished();
void reset();
void reverse();
int play(World world, Vector3i position);
}
|
UTF-8
|
Java
| 420 |
java
|
Animation.java
|
Java
|
[
{
"context": "org.spongepowered.api.world.World;\n\n/**\n * @author dags <dags@dags.me>\n */\npublic interface Animation {\n\n",
"end": 218,
"score": 0.999674916267395,
"start": 214,
"tag": "USERNAME",
"value": "dags"
},
{
"context": "ngepowered.api.world.World;\n\n/**\n * @author dags <dags@dags.me>\n */\npublic interface Animation {\n\n Sequence<F",
"end": 232,
"score": 0.9999231696128845,
"start": 220,
"tag": "EMAIL",
"value": "dags@dags.me"
}
] | null |
[] |
package me.dags.animation.animation;
import com.flowpowered.math.vector.Vector3i;
import me.dags.animation.Sequence;
import me.dags.animation.frame.Frame;
import org.spongepowered.api.world.World;
/**
* @author dags <<EMAIL>>
*/
public interface Animation {
Sequence<Frame> getTimeline();
boolean hasFinished();
void reset();
void reverse();
int play(World world, Vector3i position);
}
| 415 | 0.721429 | 0.716667 | 22 | 18.09091 | 17.119658 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
0
|
4aa7ab6c6560125e231748311007394805db6039
| 1,417,339,267,504 |
8f066864c307b355ddb146eb9cd6641c3e313420
|
/plugins/YonaServicesPlugin/src/android/com/yona/plugin/services/BackgroundMode.java
|
0f69b0ec251ac21b109d10a54239297844cfb8df
|
[] |
no_license
|
yonadev/yona-app
|
https://github.com/yonadev/yona-app
|
3c9e5a1e00e12d17afe425a519c5dc620f828678
|
8c7e2219e2c2ccae165c517b17a1ce361c7e3041
|
refs/heads/develop
| 2023-01-13T06:39:19.783000 | 2021-05-31T11:53:25 | 2021-05-31T11:53:25 | 195,173,907 | 0 | 1 | null | false | 2023-01-04T23:22:43 | 2019-07-04T05:24:20 | 2021-05-31T11:53:33 | 2023-01-04T23:22:41 | 19,882 | 0 | 1 | 25 |
Java
| false | false |
package com.yona.plugin.services;
import android.app.Activity;
import android.app.AppOpsManager;
import android.content.Context;
import android.content.ComponentName;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.provider.Settings;
import androidx.core.app.NotificationManagerCompat;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.json.JSONArray;
import org.json.JSONObject;
import org.json.JSONException;
import com.yona.plugin.services.api.receiver.YonaReceiver;
import com.yona.plugin.services.utils.AppUtils;
import com.yona.plugin.services.utils.Logger;
import nu.yona.app.R;
public class BackgroundMode extends CordovaPlugin {
public static final String PREFS = "autostart";
// Plugin namespace
private static final String JS_NAMESPACE = "cordova.plugins.appUsage";
// Flag indicates if the plugin is enabled or disabled
private boolean isDisabled = true;
// Flag indicates if the service is bind
private boolean isBind = false;
// Default settings for the notification
private static JSONObject defaultSettings = new JSONObject();
// Service that keeps the app awake
private AppMonitoringService service;
/**
* Executes the request.
*
* @param action The action to execute.
* @param args The exec() arguments.
* @param callback The callback context used when
* calling back into JavaScript.
*
* @return Returning false results in a "MethodNotFound" error.
*/
@Override
public boolean execute (String action, JSONArray args,
CallbackContext callback) throws JSONException {
Logger.logi(BackgroundMode.class, "Received action: " + action);
if ( action.equalsIgnoreCase("configure") ) {
configure(args.optJSONObject(0), args.optBoolean(1));
return true;
} else if ( action.equalsIgnoreCase("enable") ) {
enableServices();
return true;
} else if ( action.equalsIgnoreCase("disable") ) {
disableServices();
return true;
} else if ( action.equalsIgnoreCase("checkUsageAccess") ) {
this.checkUsageAccess(callback);
return true;
} else if ( action.equalsIgnoreCase("getUsageAccess") ) {
this.getUsageAccess(callback);
return true;
} else if ( action.equalsIgnoreCase("postActivitiesToServer") ) {
this.postActivitiesToServer(callback);
return true;
} else if ( action.equalsIgnoreCase("createNotificationChannel") ) {
this.createNotificationChannel(callback);
return true;
} else if ( action.equalsIgnoreCase("showNotification") ) {
String title = args.optString(0);
String message = args.optString(1);
this.showNotification(callback, title, message);
return true;
}
return false;
}
private void enableServices() {
setEnabled(true);
}
private void disableServices() {
setEnabled(false);
}
private void setEnabled(boolean enabled) {
Context context = cordova.getActivity().getApplicationContext();
int componentState;
isDisabled = !enabled;
if ( enabled ) {
componentState = PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
Logger.logi(BackgroundMode.class, "set Component enabled");
checkForNotificationPermission();
AppUtils.startService(context);
} else {
componentState = PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
AppUtils.stopService(context);
}
// Enable or Disable BootCompletedReceiver
ComponentName yonaReceiver = new ComponentName(context, YonaReceiver.class);
PackageManager pm = context.getPackageManager();
pm.setComponentEnabledSetting(yonaReceiver, componentState, PackageManager.DONT_KILL_APP);
}
private void checkForNotificationPermission()
{
Context context = cordova.getActivity();
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O || (NotificationManagerCompat.from(context.getApplicationContext()).areNotificationsEnabled() && AppUtils.arePersistentNotificationsEnabled(context)))
{
return;
}
Logger.loge(BackgroundMode.class, "Yona cannot monitor app activity because notifications for the Yona application have been disabled. Enable notifications for Yona again in the device settings.");
}
private void checkUsageAccess(CallbackContext callbackContext) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
boolean hasAccess = hasUsageAccess();
callbackContext.success((hasAccess ? "true" : "false"));
}
}
private void getUsageAccess(CallbackContext callbackContext) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (!hasUsageAccess()) {
openPermissionSettings(callbackContext);
} else {
callbackContext.success("true");
}
}
}
private boolean hasUsageAccess() {
try {
Context context = cordova.getActivity().getApplicationContext();
PackageManager pm = context.getPackageManager();
ApplicationInfo applicationInfo = pm.getApplicationInfo(context.getPackageName(), 0);
AppOpsManager appOpsManager = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
int mode = appOpsManager.checkOpNoThrow(AppOpsManager.OPSTR_GET_USAGE_STATS, applicationInfo.uid, applicationInfo.packageName);
return (mode == AppOpsManager.MODE_ALLOWED);
} catch (PackageManager.NameNotFoundException e) {
return false;
}
}
private void postActivitiesToServer(CallbackContext callbackContext) {
Context context = this.cordova.getActivity().getApplicationContext();
AppUtils.sendLogToServer(context, 0);
callbackContext.success("true");
}
private void createNotificationChannel(CallbackContext callbackContext) {
Context context = this.cordova.getActivity().getApplicationContext();
AppUtils.createNotificationChanngel(context);
callbackContext.success("true");
}
private void showNotification(CallbackContext callbackContext, String title, String message) {
Context context = this.cordova.getActivity().getApplicationContext();
AppUtils.showNotification(context, message, title);
callbackContext.success("true");
}
/**
* Launch UsageStatsManager settings
* @return
*/
private void openPermissionSettings(CallbackContext callbackContext){
try {
Context context = this.cordova.getActivity().getApplicationContext();
Intent intent = new Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
callbackContext.success("true");
} catch(Exception e){
e.printStackTrace();
callbackContext.error(e.toString());
}
}
/**
* Update the default settings and configure the notification.
*
* @param settings The settings
* @param update A truthy value means to update the running service.
*/
private void configure(JSONObject settings, boolean update)
{
if (update) {
updateNotification(settings);
} else {
setDefaultSettings(settings);
}
}
/**
* Update the default settings for the notification.
*
* @param settings The new default settings
*/
private void setDefaultSettings(JSONObject settings)
{
defaultSettings = settings;
}
/**
* Returns the settings for the new/updated notification.
*/
static JSONObject getSettings () {
return defaultSettings;
}
/**
* Update the notification.
*
* @param settings The config settings
*/
private void updateNotification(JSONObject settings)
{
if (isBind) {
//service.updateNotification(settings);
}
}
}
|
UTF-8
|
Java
| 8,507 |
java
|
BackgroundMode.java
|
Java
|
[] | null |
[] |
package com.yona.plugin.services;
import android.app.Activity;
import android.app.AppOpsManager;
import android.content.Context;
import android.content.ComponentName;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.provider.Settings;
import androidx.core.app.NotificationManagerCompat;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.json.JSONArray;
import org.json.JSONObject;
import org.json.JSONException;
import com.yona.plugin.services.api.receiver.YonaReceiver;
import com.yona.plugin.services.utils.AppUtils;
import com.yona.plugin.services.utils.Logger;
import nu.yona.app.R;
public class BackgroundMode extends CordovaPlugin {
public static final String PREFS = "autostart";
// Plugin namespace
private static final String JS_NAMESPACE = "cordova.plugins.appUsage";
// Flag indicates if the plugin is enabled or disabled
private boolean isDisabled = true;
// Flag indicates if the service is bind
private boolean isBind = false;
// Default settings for the notification
private static JSONObject defaultSettings = new JSONObject();
// Service that keeps the app awake
private AppMonitoringService service;
/**
* Executes the request.
*
* @param action The action to execute.
* @param args The exec() arguments.
* @param callback The callback context used when
* calling back into JavaScript.
*
* @return Returning false results in a "MethodNotFound" error.
*/
@Override
public boolean execute (String action, JSONArray args,
CallbackContext callback) throws JSONException {
Logger.logi(BackgroundMode.class, "Received action: " + action);
if ( action.equalsIgnoreCase("configure") ) {
configure(args.optJSONObject(0), args.optBoolean(1));
return true;
} else if ( action.equalsIgnoreCase("enable") ) {
enableServices();
return true;
} else if ( action.equalsIgnoreCase("disable") ) {
disableServices();
return true;
} else if ( action.equalsIgnoreCase("checkUsageAccess") ) {
this.checkUsageAccess(callback);
return true;
} else if ( action.equalsIgnoreCase("getUsageAccess") ) {
this.getUsageAccess(callback);
return true;
} else if ( action.equalsIgnoreCase("postActivitiesToServer") ) {
this.postActivitiesToServer(callback);
return true;
} else if ( action.equalsIgnoreCase("createNotificationChannel") ) {
this.createNotificationChannel(callback);
return true;
} else if ( action.equalsIgnoreCase("showNotification") ) {
String title = args.optString(0);
String message = args.optString(1);
this.showNotification(callback, title, message);
return true;
}
return false;
}
private void enableServices() {
setEnabled(true);
}
private void disableServices() {
setEnabled(false);
}
private void setEnabled(boolean enabled) {
Context context = cordova.getActivity().getApplicationContext();
int componentState;
isDisabled = !enabled;
if ( enabled ) {
componentState = PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
Logger.logi(BackgroundMode.class, "set Component enabled");
checkForNotificationPermission();
AppUtils.startService(context);
} else {
componentState = PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
AppUtils.stopService(context);
}
// Enable or Disable BootCompletedReceiver
ComponentName yonaReceiver = new ComponentName(context, YonaReceiver.class);
PackageManager pm = context.getPackageManager();
pm.setComponentEnabledSetting(yonaReceiver, componentState, PackageManager.DONT_KILL_APP);
}
private void checkForNotificationPermission()
{
Context context = cordova.getActivity();
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O || (NotificationManagerCompat.from(context.getApplicationContext()).areNotificationsEnabled() && AppUtils.arePersistentNotificationsEnabled(context)))
{
return;
}
Logger.loge(BackgroundMode.class, "Yona cannot monitor app activity because notifications for the Yona application have been disabled. Enable notifications for Yona again in the device settings.");
}
private void checkUsageAccess(CallbackContext callbackContext) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
boolean hasAccess = hasUsageAccess();
callbackContext.success((hasAccess ? "true" : "false"));
}
}
private void getUsageAccess(CallbackContext callbackContext) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (!hasUsageAccess()) {
openPermissionSettings(callbackContext);
} else {
callbackContext.success("true");
}
}
}
private boolean hasUsageAccess() {
try {
Context context = cordova.getActivity().getApplicationContext();
PackageManager pm = context.getPackageManager();
ApplicationInfo applicationInfo = pm.getApplicationInfo(context.getPackageName(), 0);
AppOpsManager appOpsManager = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
int mode = appOpsManager.checkOpNoThrow(AppOpsManager.OPSTR_GET_USAGE_STATS, applicationInfo.uid, applicationInfo.packageName);
return (mode == AppOpsManager.MODE_ALLOWED);
} catch (PackageManager.NameNotFoundException e) {
return false;
}
}
private void postActivitiesToServer(CallbackContext callbackContext) {
Context context = this.cordova.getActivity().getApplicationContext();
AppUtils.sendLogToServer(context, 0);
callbackContext.success("true");
}
private void createNotificationChannel(CallbackContext callbackContext) {
Context context = this.cordova.getActivity().getApplicationContext();
AppUtils.createNotificationChanngel(context);
callbackContext.success("true");
}
private void showNotification(CallbackContext callbackContext, String title, String message) {
Context context = this.cordova.getActivity().getApplicationContext();
AppUtils.showNotification(context, message, title);
callbackContext.success("true");
}
/**
* Launch UsageStatsManager settings
* @return
*/
private void openPermissionSettings(CallbackContext callbackContext){
try {
Context context = this.cordova.getActivity().getApplicationContext();
Intent intent = new Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
callbackContext.success("true");
} catch(Exception e){
e.printStackTrace();
callbackContext.error(e.toString());
}
}
/**
* Update the default settings and configure the notification.
*
* @param settings The settings
* @param update A truthy value means to update the running service.
*/
private void configure(JSONObject settings, boolean update)
{
if (update) {
updateNotification(settings);
} else {
setDefaultSettings(settings);
}
}
/**
* Update the default settings for the notification.
*
* @param settings The new default settings
*/
private void setDefaultSettings(JSONObject settings)
{
defaultSettings = settings;
}
/**
* Returns the settings for the new/updated notification.
*/
static JSONObject getSettings () {
return defaultSettings;
}
/**
* Update the notification.
*
* @param settings The config settings
*/
private void updateNotification(JSONObject settings)
{
if (isBind) {
//service.updateNotification(settings);
}
}
}
| 8,507 | 0.658869 | 0.658164 | 248 | 33.302418 | 31.252247 | 208 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.475806 | false | false |
0
|
74992fdabfdc58f40e6409bacd3ac084fcf57847
| 3,212,635,539,822 |
153784b39085e8df6ac2866e21b15c1f51726441
|
/smart-energy-system/powerinfrastructureservice/src/main/java/org/rug/wacc2019smartenergy/powerinfrastructureservice/model/HouseholdEnergyActivity.java
|
1b94e3df26e09cf45f81fb17a500c920de90a856
|
[] |
no_license
|
Viserius/smart-energy-system
|
https://github.com/Viserius/smart-energy-system
|
4dedfd6e996956ba5e077956e2de6f03c0c26d28
|
a502df7d3e3d03a153d8b77682732e126e249dee
|
refs/heads/master
| 2022-01-25T06:00:24.427000 | 2019-12-12T18:23:55 | 2019-12-12T18:23:55 | 227,660,424 | 0 | 0 | null | false | 2022-01-15T05:56:01 | 2019-12-12T17:25:56 | 2019-12-12T18:24:11 | 2022-01-15T05:56:01 | 1,133 | 0 | 0 | 4 |
Java
| false | false |
package org.rug.wacc2019smartenergy.powerinfrastructureservice.model;
import com.datastax.driver.core.LocalDate;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.springframework.beans.factory.annotation.Value;
import java.time.Instant;
import java.util.Date;
import java.util.UUID;
public class HouseholdEnergyActivity {
private UUID householdId;
private LocalDate date;
private Instant timestamp;
private double energyUsage;
private double energyProduction;
@Value("${powerprocessing.broadcast_interval_in_seconds}")
private int powerStatisticBroadcastIntervalInSeconds = 30;
@JsonCreator
public HouseholdEnergyActivity(
@JsonProperty("householdId") final UUID householdId,
@JsonProperty("date") final Date date,
@JsonProperty("timestamp") final Long timestamp,
@JsonProperty("energyUsage") final float energyUsage,
@JsonProperty("energyProduction") final float energyProduction) {
this.householdId = householdId;
this.date = LocalDate.fromMillisSinceEpoch(date.getTime());
this.timestamp = Instant.ofEpochMilli(timestamp);
this.energyUsage = energyUsage;
this.energyProduction = energyProduction;
}
public LocalDate getDate() {
return date;
}
public void setDate(LocalDate date) {
this.date = date;
}
public Instant getTimestamp() {
return timestamp;
}
public void setTimestamp(Instant timestamp) {
this.timestamp = timestamp;
}
public UUID getHouseholdId() {
return householdId;
}
public void setHouseholdId(UUID householdId) {
this.householdId = householdId;
}
public double getEnergyUsage() {
return energyUsage / 1000.0 / (60.0 * 60);
}
public void setEnergyUsage(double energyUsage) {
this.energyUsage = energyUsage;
}
public double getEnergyProduction() {
return energyProduction / 1000.0 / (60.0 * 60);
}
public void setEnergyProduction(double energyProduction) {
this.energyProduction = energyProduction;
}
// TODO: In case connectivity is offline, re-broadcast net usage later.
public double getNetEnergyUsage() {
return this.getEnergyUsage() - this.getEnergyProduction();
}
}
|
UTF-8
|
Java
| 2,397 |
java
|
HouseholdEnergyActivity.java
|
Java
|
[] | null |
[] |
package org.rug.wacc2019smartenergy.powerinfrastructureservice.model;
import com.datastax.driver.core.LocalDate;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.springframework.beans.factory.annotation.Value;
import java.time.Instant;
import java.util.Date;
import java.util.UUID;
public class HouseholdEnergyActivity {
private UUID householdId;
private LocalDate date;
private Instant timestamp;
private double energyUsage;
private double energyProduction;
@Value("${powerprocessing.broadcast_interval_in_seconds}")
private int powerStatisticBroadcastIntervalInSeconds = 30;
@JsonCreator
public HouseholdEnergyActivity(
@JsonProperty("householdId") final UUID householdId,
@JsonProperty("date") final Date date,
@JsonProperty("timestamp") final Long timestamp,
@JsonProperty("energyUsage") final float energyUsage,
@JsonProperty("energyProduction") final float energyProduction) {
this.householdId = householdId;
this.date = LocalDate.fromMillisSinceEpoch(date.getTime());
this.timestamp = Instant.ofEpochMilli(timestamp);
this.energyUsage = energyUsage;
this.energyProduction = energyProduction;
}
public LocalDate getDate() {
return date;
}
public void setDate(LocalDate date) {
this.date = date;
}
public Instant getTimestamp() {
return timestamp;
}
public void setTimestamp(Instant timestamp) {
this.timestamp = timestamp;
}
public UUID getHouseholdId() {
return householdId;
}
public void setHouseholdId(UUID householdId) {
this.householdId = householdId;
}
public double getEnergyUsage() {
return energyUsage / 1000.0 / (60.0 * 60);
}
public void setEnergyUsage(double energyUsage) {
this.energyUsage = energyUsage;
}
public double getEnergyProduction() {
return energyProduction / 1000.0 / (60.0 * 60);
}
public void setEnergyProduction(double energyProduction) {
this.energyProduction = energyProduction;
}
// TODO: In case connectivity is offline, re-broadcast net usage later.
public double getNetEnergyUsage() {
return this.getEnergyUsage() - this.getEnergyProduction();
}
}
| 2,397 | 0.691281 | 0.680434 | 84 | 27.535715 | 23.920227 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.416667 | false | false |
0
|
bc604288eca5f1fd7da8c5f02e3f7b3ce7066897
| 3,212,635,541,103 |
afa7d2f0acca3f1f1b699262e12ecdbba716c2ff
|
/src/test/java/com/lsoe/coolreader/CoolRecordTest.java
|
3faff6110c5fd8e8f48db4397bd72fc1e62b1633
|
[
"MIT"
] |
permissive
|
soelynn/CoolReader
|
https://github.com/soelynn/CoolReader
|
d844194dcd1f9eb4e6ab8d5a005ab76960523e0e
|
daa2aaf6534763aa8d4a180b1ad338cad299fb70
|
refs/heads/master
| 2021-01-01T16:59:55.470000 | 2015-06-05T06:46:07 | 2015-06-05T06:46:07 | 33,534,197 | 5 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.lsoe.coolreader;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import com.lsoe.coolreader.exception.ColumnNameNotFoundException;
import com.lsoe.coolreader.test.enums.Country;
public class CoolRecordTest {
@Test(expected = ColumnNameNotFoundException.class)
public void testRecordWithoutColumnPropertiesSpecifiedScenario()
throws Exception {
String[] record = new String[]{"Soe Lynn", "54.5", "true", "188", "MM"};
CoolRecord coolRecord = new CoolRecord(record);
String name = coolRecord.getString(0);
double weight = coolRecord.getDouble(1);
boolean isMale = coolRecord.getBoolean(2);
int height = coolRecord.getInt(3);
Country country = coolRecord.get(4, Country.class);
assertEquals("Soe Lynn", name);
assertEquals(54.5, weight, 0);
assertTrue("Expected isMale to be true.", isMale);
assertEquals(188, height);
assertEquals("Myanmar", country.getCountry());
assertFalse("Column \"name\" is expected to be not exists.",
coolRecord.has("name"));
coolRecord.get("name");
}
@Test
public void testRecordWithColumnPropertiesSpecifiedScenario()
throws Exception {
CoolColumn[] columns = new CoolColumn[]{new CoolColumn("name", 0),
new CoolColumn("weight", 1), new CoolColumn("isMale", 2),
new CoolColumn("height", 3), new CoolColumn("country", 4)};
String[] record = new String[]{"Soe Lynn", "54.5", "true", "188", "MM"};
CoolRecord coolRecord = new CoolRecord(columns, record);
String name = coolRecord.getString("name");
double weight = coolRecord.getDouble("weight");
boolean isMale = coolRecord.getBoolean("isMale");
int height = coolRecord.getInt("height");
Country country = coolRecord.get("country", Country.class);
assertEquals("Soe Lynn", name);
assertEquals(54.5, weight, 0);
assertTrue("Expected isMale to be true.", isMale);
assertEquals(188, height);
assertEquals("Myanmar", country.getCountry());
assertTrue("Column \"name\" is expected to be exists.",
coolRecord.has("name"));
}
}
|
UTF-8
|
Java
| 2,111 |
java
|
CoolRecordTest.java
|
Java
|
[
{
"context": "ws Exception {\n\n\t\tString[] record = new String[]{\"Soe Lynn\", \"54.5\", \"true\", \"188\", \"MM\"};\n\n\t\tCoolRecord coo",
"end": 516,
"score": 0.9998151063919067,
"start": 508,
"tag": "NAME",
"value": "Soe Lynn"
},
{
"context": "oolRecord.get(4, Country.class);\n\n\t\tassertEquals(\"Soe Lynn\", name);\n\t\tassertEquals(54.5, weight, 0);\n\t\tasser",
"end": 845,
"score": 0.9997984170913696,
"start": 837,
"tag": "NAME",
"value": "Soe Lynn"
},
{
"context": "\"country\", 4)};\n\t\tString[] record = new String[]{\"Soe Lynn\", \"54.5\", \"true\", \"188\", \"MM\"};\n\n\t\tCoolRecord coo",
"end": 1472,
"score": 0.999796986579895,
"start": 1464,
"tag": "NAME",
"value": "Soe Lynn"
},
{
"context": "d.get(\"country\", Country.class);\n\n\t\tassertEquals(\"Soe Lynn\", name);\n\t\tassertEquals(54.5, weight, 0);\n\t\tasser",
"end": 1844,
"score": 0.9998615980148315,
"start": 1836,
"tag": "NAME",
"value": "Soe Lynn"
}
] | null |
[] |
package com.lsoe.coolreader;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import com.lsoe.coolreader.exception.ColumnNameNotFoundException;
import com.lsoe.coolreader.test.enums.Country;
public class CoolRecordTest {
@Test(expected = ColumnNameNotFoundException.class)
public void testRecordWithoutColumnPropertiesSpecifiedScenario()
throws Exception {
String[] record = new String[]{"<NAME>", "54.5", "true", "188", "MM"};
CoolRecord coolRecord = new CoolRecord(record);
String name = coolRecord.getString(0);
double weight = coolRecord.getDouble(1);
boolean isMale = coolRecord.getBoolean(2);
int height = coolRecord.getInt(3);
Country country = coolRecord.get(4, Country.class);
assertEquals("<NAME>", name);
assertEquals(54.5, weight, 0);
assertTrue("Expected isMale to be true.", isMale);
assertEquals(188, height);
assertEquals("Myanmar", country.getCountry());
assertFalse("Column \"name\" is expected to be not exists.",
coolRecord.has("name"));
coolRecord.get("name");
}
@Test
public void testRecordWithColumnPropertiesSpecifiedScenario()
throws Exception {
CoolColumn[] columns = new CoolColumn[]{new CoolColumn("name", 0),
new CoolColumn("weight", 1), new CoolColumn("isMale", 2),
new CoolColumn("height", 3), new CoolColumn("country", 4)};
String[] record = new String[]{"<NAME>", "54.5", "true", "188", "MM"};
CoolRecord coolRecord = new CoolRecord(columns, record);
String name = coolRecord.getString("name");
double weight = coolRecord.getDouble("weight");
boolean isMale = coolRecord.getBoolean("isMale");
int height = coolRecord.getInt("height");
Country country = coolRecord.get("country", Country.class);
assertEquals("<NAME>", name);
assertEquals(54.5, weight, 0);
assertTrue("Expected isMale to be true.", isMale);
assertEquals(188, height);
assertEquals("Myanmar", country.getCountry());
assertTrue("Column \"name\" is expected to be exists.",
coolRecord.has("name"));
}
}
| 2,103 | 0.723828 | 0.706774 | 63 | 32.507938 | 23.654842 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.428571 | false | false |
0
|
c1cea313d8c384425bed3a9d2a78fac71dad7f55
| 6,511,170,475,646 |
e06d89306659a8b853aa9e5da362c9d3d8f311a2
|
/travel_background_server/src/main/java/com/bbdservice/sichuan/controller/SearchPersonResourceController.java
|
ca4e0db7a76464f61fa81bbd06710b40d461cb27
|
[] |
no_license
|
wllpeter/travel
|
https://github.com/wllpeter/travel
|
3cd4283b10c0344a8957b82d4fa6bbff97d77596
|
bcde9c0c7444a166f96fa0d46ffbbb924ed8ab94
|
refs/heads/master
| 2019-03-20T20:18:17.733000 | 2018-02-24T07:32:10 | 2018-02-24T07:32:10 | 124,027,804 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.bbdservice.sichuan.controller;
import com.bbdservice.sichuan.entity.SearchPersonResource;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* Created by 陈亚兰 on 2018/1/17.
*/
@Api(description = "搜索-搜索人来源地")
@RequestMapping("/search/person_resource")
@RestController
public class SearchPersonResourceController extends BaseEntityController<SearchPersonResource> {
}
|
UTF-8
|
Java
| 517 |
java
|
SearchPersonResourceController.java
|
Java
|
[
{
"context": "ind.annotation.RestController;\n\n/**\n * Created by 陈亚兰 on 2018/1/17.\n */\n@Api(description = \"搜索-搜索人来源地\")",
"end": 286,
"score": 0.9995697140693665,
"start": 283,
"tag": "NAME",
"value": "陈亚兰"
}
] | null |
[] |
package com.bbdservice.sichuan.controller;
import com.bbdservice.sichuan.entity.SearchPersonResource;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* Created by 陈亚兰 on 2018/1/17.
*/
@Api(description = "搜索-搜索人来源地")
@RequestMapping("/search/person_resource")
@RestController
public class SearchPersonResourceController extends BaseEntityController<SearchPersonResource> {
}
| 517 | 0.822222 | 0.808081 | 15 | 32 | 27.99762 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false |
12
|
f40aa63dc54a27138ecdb14198afb6b78b7520a8
| 24,378,234,414,156 |
d8584572cd330cd4c58cfe549ba45b25968cbd30
|
/src/main/java/com/hlframe/modules/dc/task/HelloWord.java
|
f273fcef0aaa66c462a02b4273922ff4e94f3ff3
|
[] |
no_license
|
LP1991/hldc
|
https://github.com/LP1991/hldc
|
1b0ba81e1b3dbd508ff00207fca8f623f2d53e20
|
5fe95384e53f62abfbe6b7749ff10eb00e84492a
|
refs/heads/master
| 2020-06-01T07:19:12.630000 | 2017-06-14T10:08:39 | 2017-06-14T10:08:41 | 94,066,987 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.hlframe.modules.dc.task;
import java.lang.reflect.Method;
/**
* Created by baiyunpeng on 2016/8/26.
*/
public class HelloWord {
/**
* @param args
*/
public static void main(String[] args) {
try {
Hello h=new Hello();
Object[] argspara=new Object[]{};
Object aa = HelloWord.invokeMethod(h,"helloStrs",argspara);
System.out.println("*******"+aa.toString()+"*******");
HelloWord.invokeMethod(h, "helloStrs",argspara);
argspara=new Object[]{"he"};
HelloWord.invokeMethod(h, "helloStrs",argspara);
argspara=new Object[]{"she",2};
HelloWord.invokeMethod(h, "helloStrs2",argspara);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 反射调用方法
* @param newObj 实例化的一个对象
* @param methodName 对象的方法名
* @param args 参数数组
* @return 返回值
* @throws Exception
*/
public static Object invokeMethod(Object newObj, String methodName, Object[] args)throws Exception {
Class ownerClass = newObj.getClass();
Class[] argsClass = new Class[args.length];
for (int i = 0, j = args.length; i < j; i++) {
argsClass[i] = args[i].getClass();
}
Method method = ownerClass.getMethod(methodName, argsClass);
return method.invoke(newObj, args);
}
}
class Hello{
public String helloStrs(){
//根据不同的方法名称,调用不用的方法
System.out.println("hello1");
return "hello1";
}
public void helloStrs(String a) {
//根据不同的方法名称,调用不用的方法
System.out.println("hello11");
}
public void helloStrs2(String a ,Integer b) throws Exception{
//根据不同的方法名称,调用不用的方法
System.out.println("hello12");
}
}
|
UTF-8
|
Java
| 2,013 |
java
|
HelloWord.java
|
Java
|
[
{
"context": "port java.lang.reflect.Method; \n\n/** \n* Created by baiyunpeng on 2016/8/26. \n*/ \npublic class HelloWord { \n\n ",
"end": 101,
"score": 0.9989851713180542,
"start": 91,
"tag": "USERNAME",
"value": "baiyunpeng"
}
] | null |
[] |
package com.hlframe.modules.dc.task;
import java.lang.reflect.Method;
/**
* Created by baiyunpeng on 2016/8/26.
*/
public class HelloWord {
/**
* @param args
*/
public static void main(String[] args) {
try {
Hello h=new Hello();
Object[] argspara=new Object[]{};
Object aa = HelloWord.invokeMethod(h,"helloStrs",argspara);
System.out.println("*******"+aa.toString()+"*******");
HelloWord.invokeMethod(h, "helloStrs",argspara);
argspara=new Object[]{"he"};
HelloWord.invokeMethod(h, "helloStrs",argspara);
argspara=new Object[]{"she",2};
HelloWord.invokeMethod(h, "helloStrs2",argspara);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 反射调用方法
* @param newObj 实例化的一个对象
* @param methodName 对象的方法名
* @param args 参数数组
* @return 返回值
* @throws Exception
*/
public static Object invokeMethod(Object newObj, String methodName, Object[] args)throws Exception {
Class ownerClass = newObj.getClass();
Class[] argsClass = new Class[args.length];
for (int i = 0, j = args.length; i < j; i++) {
argsClass[i] = args[i].getClass();
}
Method method = ownerClass.getMethod(methodName, argsClass);
return method.invoke(newObj, args);
}
}
class Hello{
public String helloStrs(){
//根据不同的方法名称,调用不用的方法
System.out.println("hello1");
return "hello1";
}
public void helloStrs(String a) {
//根据不同的方法名称,调用不用的方法
System.out.println("hello11");
}
public void helloStrs2(String a ,Integer b) throws Exception{
//根据不同的方法名称,调用不用的方法
System.out.println("hello12");
}
}
| 2,013 | 0.555197 | 0.546042 | 68 | 26.308823 | 23.13023 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.558824 | false | false |
12
|
62287b7ed016d1a7599eb026fa72d3ca527f4b5c
| 5,763,846,160,272 |
36e941cee117a5a1ef8af4fd5358f6a73baddf74
|
/junior/src/main/java/ru/job4j/car_store/package-info.java
|
879002618872815fb95b2cc3d5bf4ce732503247
|
[
"Apache-2.0"
] |
permissive
|
spiridmaks2009/job4j
|
https://github.com/spiridmaks2009/job4j
|
47a3c892d6721f280aa80ec5f0f8f8ca40e65877
|
489df0a582e5b2f6dfb181d5db94720ca7c1f7c8
|
refs/heads/master
| 2020-03-28T13:02:12.225000 | 2019-02-18T18:00:45 | 2019-02-18T18:00:45 | 147,858,144 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ru.job4j.car_store;
|
UTF-8
|
Java
| 27 |
java
|
package-info.java
|
Java
|
[] | null |
[] |
package ru.job4j.car_store;
| 27 | 0.814815 | 0.777778 | 1 | 27 | 0 | 27 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false |
12
|
6d7421347891d4bba98d846824d6075b0da2ec28
| 30,537,217,513,836 |
fbc2d235ee858166157923b4a5c9b26c1d91dc65
|
/src/com/bridgeit/programs/Wildchill.java
|
d58b55147304838f03fcb1fd3431259a61ad7c64
|
[
"MIT"
] |
permissive
|
amt1234/Functional
|
https://github.com/amt1234/Functional
|
350849fe7fec4a285932058ed981dff75e9600b7
|
5e150cfb7835eec0bca2159426ddd63c7560f195
|
refs/heads/master
| 2021-04-27T13:23:58.537000 | 2018-03-05T13:02:51 | 2018-03-05T13:02:51 | 122,440,159 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.bridgeit.programs;
import com.bridgeit.utility.Utility;
/******************************************************************************
* Purpose: Given the temperature t (in Fahrenheit) and the wind speed v (in miles per hour),
* the National Weather Service defines the effective temperature (the wind chill).
* @author Poonam
* @version 1.0
* @since 05-03-2018
*
******************************************************************************/
public class Wildchill {
public static void main(String[] args)
{
double v = 0;
double t = 0;
System.out.println("enter the v "+args[0]);
v=Double.parseDouble(args[0]);
System.out.println("enter the t "+args[1]);
t=Double.parseDouble(args[1]);
Utility utility=new Utility();
utility.windchill(t, v);
}
}
|
UTF-8
|
Java
| 806 |
java
|
Wildchill.java
|
Java
|
[
{
"context": "ective temperature (the wind chill).\n\n * @author Poonam\n * @version 1.0\n * @since 05-03-2018\n *\n ****",
"end": 353,
"score": 0.9983677864074707,
"start": 347,
"tag": "NAME",
"value": "Poonam"
}
] | null |
[] |
package com.bridgeit.programs;
import com.bridgeit.utility.Utility;
/******************************************************************************
* Purpose: Given the temperature t (in Fahrenheit) and the wind speed v (in miles per hour),
* the National Weather Service defines the effective temperature (the wind chill).
* @author Poonam
* @version 1.0
* @since 05-03-2018
*
******************************************************************************/
public class Wildchill {
public static void main(String[] args)
{
double v = 0;
double t = 0;
System.out.println("enter the v "+args[0]);
v=Double.parseDouble(args[0]);
System.out.println("enter the t "+args[1]);
t=Double.parseDouble(args[1]);
Utility utility=new Utility();
utility.windchill(t, v);
}
}
| 806 | 0.547146 | 0.527295 | 30 | 25.866667 | 27.501192 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.066667 | false | false |
12
|
d30d0e8dd0071abd07acede00da7af212978879c
| 13,846,974,567,724 |
2f4d40f5765e6185bfeb4c0f8fb5d4a610a510cb
|
/op-order-service/src/main/java/com/lvtuben/istio/order/mapper/OrderDetailDAOMapper.java
|
5fa0bf0d2f8bc113debe9d95137927d592d14dbc
|
[] |
no_license
|
metadeng/istio-sample
|
https://github.com/metadeng/istio-sample
|
45596e7c43162d609dcacaab40e6633b2a8a060a
|
009dc3b40ed56e2138f6b23c2b3a92b58b26e3ce
|
refs/heads/master
| 2023-01-05T12:35:39.644000 | 2020-09-28T03:14:55 | 2020-09-28T03:14:55 | 298,979,131 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.lvtuben.istio.order.mapper;
import com.lvtuben.istio.order.dao.OrderDetailDAO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface OrderDetailDAOMapper {
int deleteByPrimaryKey(String id);
int insert(OrderDetailDAO record);
OrderDetailDAO selectByPrimaryKey(String id);
int updateByPrimaryKey(OrderDetailDAO record);
}
|
UTF-8
|
Java
| 394 |
java
|
OrderDetailDAOMapper.java
|
Java
|
[] | null |
[] |
package com.lvtuben.istio.order.mapper;
import com.lvtuben.istio.order.dao.OrderDetailDAO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface OrderDetailDAOMapper {
int deleteByPrimaryKey(String id);
int insert(OrderDetailDAO record);
OrderDetailDAO selectByPrimaryKey(String id);
int updateByPrimaryKey(OrderDetailDAO record);
}
| 394 | 0.791878 | 0.791878 | 18 | 20.944445 | 20.95623 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false |
12
|
7b1989140c163078bdb67672130b7c0422c132c6
| 13,846,974,566,115 |
5826db50b5ab2396aa5f963824a9a3c22116324b
|
/FindMax/Algo1_nThreads.java
|
bfe1ccac79017fa8f97d3d61511eb24b42ff1536
|
[] |
no_license
|
ingla/Master
|
https://github.com/ingla/Master
|
517674229b9538cf5fb1741f2f45c40e9281c848
|
77ca1782079967196d6a33fcc6f8be37abe051fc
|
refs/heads/master
| 2020-03-14T16:22:23.361000 | 2018-05-01T10:01:25 | 2018-05-01T10:01:25 | 131,696,969 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.concurrent.*;
class Algo1_nThreads implements FindMax {
CyclicBarrier barrier;
int max = -1;
/**
* Find the maximum element in an array.
* @param a: The array.
* @return: The maximum element.
*/
public int getMax(int[] a) {
max = -1; // Reset max from last call.
int n = a.length;
boolean m[] = new boolean[n];
barrier = new CyclicBarrier(n);
Thread[] workerThreads = new Thread[n];
Thread tmp;
for (int i = 0; i < n; i++) {
tmp = new Thread(new P_i(i, a, m));
tmp.start();
workerThreads[i] = tmp;
}
// Wait for worker threads to finish.
for (int i = 0; i < workerThreads.length; i++) {
try {
workerThreads[i].join();
} catch (InterruptedException e) {
System.out.println("getMax: " + e.toString());
System.exit(0);
}
}
return max;
} // end findMax
/**
* Return a string identifying the algorithm.
*/
public String toString() {
return "Wilkinson's algorithm: n threads";
}
/**
* The calling thread waits by a synchronization barrier.
* @param b: The barrier.
*/
void waitByBarrier(CyclicBarrier b) {
try {
b.await();
} catch (InterruptedException e) {
System.out.println("InterruptedException: " +
e.getMessage());
System.exit(1);
} catch (BrokenBarrierException e) {
System.out.println("BrokenBarrierException: " +
e.getMessage());
System.exit(1);
}
} // end waitByBarrier
/**
* Thread class for P_i where 0 <= i < n.
*/
class P_i implements Runnable {
int i;
int[] a;
int n;
boolean[] m;
P_i(int i, int[] a, boolean[] m) {
this.i = i;
this.a = a;
n = a.length;
this.m = m;
}
public void run() {
m[i] = true;
waitByBarrier(barrier); // Synch
for (int j = 0; j < n; j++) {
if (a[i] < a[j]) {
m[i] = false;
}
}
if (m[i]) {
max = a[i];
}
} // end run
} // end class P_i
} // end class Algo1_nThreads
|
UTF-8
|
Java
| 2,009 |
java
|
Algo1_nThreads.java
|
Java
|
[] | null |
[] |
import java.util.concurrent.*;
class Algo1_nThreads implements FindMax {
CyclicBarrier barrier;
int max = -1;
/**
* Find the maximum element in an array.
* @param a: The array.
* @return: The maximum element.
*/
public int getMax(int[] a) {
max = -1; // Reset max from last call.
int n = a.length;
boolean m[] = new boolean[n];
barrier = new CyclicBarrier(n);
Thread[] workerThreads = new Thread[n];
Thread tmp;
for (int i = 0; i < n; i++) {
tmp = new Thread(new P_i(i, a, m));
tmp.start();
workerThreads[i] = tmp;
}
// Wait for worker threads to finish.
for (int i = 0; i < workerThreads.length; i++) {
try {
workerThreads[i].join();
} catch (InterruptedException e) {
System.out.println("getMax: " + e.toString());
System.exit(0);
}
}
return max;
} // end findMax
/**
* Return a string identifying the algorithm.
*/
public String toString() {
return "Wilkinson's algorithm: n threads";
}
/**
* The calling thread waits by a synchronization barrier.
* @param b: The barrier.
*/
void waitByBarrier(CyclicBarrier b) {
try {
b.await();
} catch (InterruptedException e) {
System.out.println("InterruptedException: " +
e.getMessage());
System.exit(1);
} catch (BrokenBarrierException e) {
System.out.println("BrokenBarrierException: " +
e.getMessage());
System.exit(1);
}
} // end waitByBarrier
/**
* Thread class for P_i where 0 <= i < n.
*/
class P_i implements Runnable {
int i;
int[] a;
int n;
boolean[] m;
P_i(int i, int[] a, boolean[] m) {
this.i = i;
this.a = a;
n = a.length;
this.m = m;
}
public void run() {
m[i] = true;
waitByBarrier(barrier); // Synch
for (int j = 0; j < n; j++) {
if (a[i] < a[j]) {
m[i] = false;
}
}
if (m[i]) {
max = a[i];
}
} // end run
} // end class P_i
} // end class Algo1_nThreads
| 2,009 | 0.555003 | 0.549527 | 94 | 20.372341 | 15.54813 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.180851 | false | false |
12
|
7c39ac1957d3f0f607fc0e91254d8a18a014a59b
| 22,041,772,231,451 |
3e613486cc86bb765698e0eb9cec8d481bd55021
|
/app/src/main/java/com/itridtechnologies/codenamefive/Const/Constants.java
|
a54733278e5a2e03db4efd57ee5f6b726619be31
|
[] |
no_license
|
bsgies/codenamefiveAndroid
|
https://github.com/bsgies/codenamefiveAndroid
|
814520e9378d519bfdd63836aa0b7aee08e32466
|
9efad58cc784272c1b8247104722f24b1cbb6e5f
|
refs/heads/master
| 2023-01-29T21:33:01.679000 | 2020-12-03T19:22:36 | 2020-12-03T19:22:36 | 273,728,218 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.itridtechnologies.codenamefive.Const;
public final class Constants {
public static final String BASE_URL = "http://ec2-18-222-200-202.us-east-2.compute.amazonaws.com:3000/api/v1/";
public static final int ONE_MB_IN_BYTES = 1048576;
public static final int ALLOWED_FILE_SIZE = 5;
}
|
UTF-8
|
Java
| 307 |
java
|
Constants.java
|
Java
|
[] | null |
[] |
package com.itridtechnologies.codenamefive.Const;
public final class Constants {
public static final String BASE_URL = "http://ec2-18-222-200-202.us-east-2.compute.amazonaws.com:3000/api/v1/";
public static final int ONE_MB_IN_BYTES = 1048576;
public static final int ALLOWED_FILE_SIZE = 5;
}
| 307 | 0.739414 | 0.654723 | 8 | 37.375 | 36.68766 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
12
|
efa352c3cdd14f056b8ee55707f1abebee076f8d
| 32,332,513,873,615 |
c81f502c1872ccaa5dffd42d72735c8a7a1688fd
|
/src/main/java/com/example/search_lab/algorithm/text/LandauVishkinAlgorithm.java
|
b22e4923bd4da4dc6491ee0c792415dcd3b5efde
|
[] |
no_license
|
VladislavArzamastsev/oopSearchLab
|
https://github.com/VladislavArzamastsev/oopSearchLab
|
cf0b86a41ba0479c6840fdc065be08fa319987f5
|
6ae01618e33e9d61c9c533ce6bfae578a2bc6c56
|
refs/heads/master
| 2023-04-22T17:36:42.140000 | 2021-04-28T09:18:27 | 2021-04-28T09:18:27 | 362,128,775 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.search_lab.algorithm.text;
import com.example.search_lab.util.Pair;
import org.springframework.stereotype.Component;
import java.util.LinkedList;
import java.util.List;
@Component
public final class LandauVishkinAlgorithm implements MismatchSearch {
@Override
public List<Pair<Integer>> getIndexesOfMatchingSubstrings(int mismatchAmount, String sample, String text) {
int[][] d = new int[sample.length() + 1][text.length() + 1];
for (int i = 1; i <= sample.length(); i++) {
d[i][0] = i;
}
for (int j = 1; j <= text.length(); j++) {
d[0][j] = 0;
}
List<Integer> indexes = new LinkedList<>();
for (int j = 1; j <= text.length(); j++) {
for (int i = 1; i < sample.length() + 1; i++) {
int firstMin = Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1);
int substitutionCost = (sample.charAt(i - 1) == text.charAt(j - 1)) ? 0 : 1;
d[i][j] = Math.min(firstMin, d[i - 1][j - 1] + substitutionCost);
if (i == sample.length() && d[i][j] == mismatchAmount) {
indexes.add(j);
}
}
}
return formResult(indexes);
}
private List<Pair<Integer>> formResult(List<Integer> mismatchIndexes) {
List<Pair<Integer>> out = new LinkedList<>();
if (mismatchIndexes.isEmpty()) {
return out;
}
Integer first = 0;
Integer prevSecond = first;
for (Integer index : mismatchIndexes) {
Pair<Integer> pair;
if (index - prevSecond == 1) {
pair = new Pair<>(first, index);
} else {
pair = new Pair<>(prevSecond, index);
first = prevSecond;
}
prevSecond = index;
out.add(pair);
}
return out;
}
}
|
UTF-8
|
Java
| 1,912 |
java
|
LandauVishkinAlgorithm.java
|
Java
|
[] | null |
[] |
package com.example.search_lab.algorithm.text;
import com.example.search_lab.util.Pair;
import org.springframework.stereotype.Component;
import java.util.LinkedList;
import java.util.List;
@Component
public final class LandauVishkinAlgorithm implements MismatchSearch {
@Override
public List<Pair<Integer>> getIndexesOfMatchingSubstrings(int mismatchAmount, String sample, String text) {
int[][] d = new int[sample.length() + 1][text.length() + 1];
for (int i = 1; i <= sample.length(); i++) {
d[i][0] = i;
}
for (int j = 1; j <= text.length(); j++) {
d[0][j] = 0;
}
List<Integer> indexes = new LinkedList<>();
for (int j = 1; j <= text.length(); j++) {
for (int i = 1; i < sample.length() + 1; i++) {
int firstMin = Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1);
int substitutionCost = (sample.charAt(i - 1) == text.charAt(j - 1)) ? 0 : 1;
d[i][j] = Math.min(firstMin, d[i - 1][j - 1] + substitutionCost);
if (i == sample.length() && d[i][j] == mismatchAmount) {
indexes.add(j);
}
}
}
return formResult(indexes);
}
private List<Pair<Integer>> formResult(List<Integer> mismatchIndexes) {
List<Pair<Integer>> out = new LinkedList<>();
if (mismatchIndexes.isEmpty()) {
return out;
}
Integer first = 0;
Integer prevSecond = first;
for (Integer index : mismatchIndexes) {
Pair<Integer> pair;
if (index - prevSecond == 1) {
pair = new Pair<>(first, index);
} else {
pair = new Pair<>(prevSecond, index);
first = prevSecond;
}
prevSecond = index;
out.add(pair);
}
return out;
}
}
| 1,912 | 0.514644 | 0.503138 | 55 | 33.763638 | 25.885738 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.709091 | false | false |
12
|
3595dc6e0b9867f3e2f8f3e956b2cd912ae448e8
| 31,705,448,642,833 |
b52e79fbd1b869fc096d8358886d902238241209
|
/web/src/main/java/com/itsupportme/associate/web/controller/IndexController.java
|
e3d0884665f8f3f812aad1d5d4083292c92443f3
|
[] |
no_license
|
dima-kiev/associate
|
https://github.com/dima-kiev/associate
|
f2eb9a5751f60c47a711b8967c589c466e820188
|
79808b1455a5c6c3948405c2a093a20248fb5af2
|
refs/heads/master
| 2021-01-22T18:38:33.560000 | 2017-04-13T16:31:18 | 2017-04-13T16:31:18 | 85,100,774 | 0 | 3 | null | false | 2017-04-14T09:04:20 | 2017-03-15T17:19:59 | 2017-03-15T17:19:59 | 2017-04-14T09:04:20 | 80 | 0 | 2 | 0 | null | null | null |
package com.itsupportme.associate.web.controller;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class IndexController {
@Value("${app.base_url}")
private String baseUrl;
@RequestMapping(value = "/")
public String login(Model model) {
model.addAttribute("baseUrl", baseUrl);
return "index";
}
}
|
UTF-8
|
Java
| 518 |
java
|
IndexController.java
|
Java
|
[] | null |
[] |
package com.itsupportme.associate.web.controller;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class IndexController {
@Value("${app.base_url}")
private String baseUrl;
@RequestMapping(value = "/")
public String login(Model model) {
model.addAttribute("baseUrl", baseUrl);
return "index";
}
}
| 518 | 0.739382 | 0.739382 | 21 | 23.666666 | 21.119463 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false |
12
|
a658f06019c0e8190d6cd8f1a51c0ca7e4609f42
| 19,181,323,957,376 |
aea7a3c5b823f7c3fe51bc8272af724b29c54deb
|
/org/openxmlformats/schemas/drawingml/x2006/main/STGeomGuideFormula.java
|
672b76a4b41cedf88a760c4999e9d8bba0716512
|
[
"Apache-2.0"
] |
permissive
|
AlhonGelios/AO
|
https://github.com/AlhonGelios/AO
|
3426d977ab0f3951139f4ae448429aa62550e413
|
3e78fefe875ab102016e1259874886970e3c5c2a
|
refs/heads/master
| 2022-12-28T18:47:06.533000 | 2020-08-12T07:00:49 | 2020-08-12T07:00:49 | 280,398,994 | 0 | 0 |
Apache-2.0
| false | 2020-10-13T23:39:35 | 2020-07-17T10:44:38 | 2020-08-12T07:00:58 | 2020-10-13T23:39:33 | 5,542 | 0 | 0 | 2 |
Java
| false | false |
package org.openxmlformats.schemas.drawingml.x2006.main;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.net.URL;
import javax.xml.stream.XMLStreamReader;
import org.apache.poi.POIXMLTypeLoader;
import org.apache.xmlbeans.SchemaType;
import org.apache.xmlbeans.XmlBeans;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlOptions;
import org.apache.xmlbeans.XmlString;
import org.apache.xmlbeans.xml.stream.XMLInputStream;
import org.apache.xmlbeans.xml.stream.XMLStreamException;
import org.w3c.dom.Node;
public interface STGeomGuideFormula extends XmlString {
SchemaType type = (SchemaType)XmlBeans.typeSystemForClassLoader(STGeomGuideFormula.class.getClassLoader(), "schemaorg_apache_xmlbeans.system.sF1327CCA741569E70F9CA8C9AF9B44B2").resolveHandle("stgeomguideformula4b51type");
public static final class Factory {
public static STGeomGuideFormula newValue(Object var0) {
return (STGeomGuideFormula)STGeomGuideFormula.type.newValue(var0);
}
public static STGeomGuideFormula newInstance() {
return (STGeomGuideFormula)POIXMLTypeLoader.newInstance(STGeomGuideFormula.type, (XmlOptions)null);
}
public static STGeomGuideFormula newInstance(XmlOptions var0) {
return (STGeomGuideFormula)POIXMLTypeLoader.newInstance(STGeomGuideFormula.type, var0);
}
public static STGeomGuideFormula parse(String var0) throws XmlException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, (XmlOptions)null);
}
public static STGeomGuideFormula parse(String var0, XmlOptions var1) throws XmlException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, var1);
}
public static STGeomGuideFormula parse(File var0) throws XmlException, IOException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, (XmlOptions)null);
}
public static STGeomGuideFormula parse(File var0, XmlOptions var1) throws XmlException, IOException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, var1);
}
public static STGeomGuideFormula parse(URL var0) throws XmlException, IOException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, (XmlOptions)null);
}
public static STGeomGuideFormula parse(URL var0, XmlOptions var1) throws XmlException, IOException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, var1);
}
public static STGeomGuideFormula parse(InputStream var0) throws XmlException, IOException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, (XmlOptions)null);
}
public static STGeomGuideFormula parse(InputStream var0, XmlOptions var1) throws XmlException, IOException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, var1);
}
public static STGeomGuideFormula parse(Reader var0) throws XmlException, IOException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, (XmlOptions)null);
}
public static STGeomGuideFormula parse(Reader var0, XmlOptions var1) throws XmlException, IOException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, var1);
}
public static STGeomGuideFormula parse(XMLStreamReader var0) throws XmlException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, (XmlOptions)null);
}
public static STGeomGuideFormula parse(XMLStreamReader var0, XmlOptions var1) throws XmlException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, var1);
}
public static STGeomGuideFormula parse(Node var0) throws XmlException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, (XmlOptions)null);
}
public static STGeomGuideFormula parse(Node var0, XmlOptions var1) throws XmlException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, var1);
}
public static STGeomGuideFormula parse(XMLInputStream var0) throws XmlException, XMLStreamException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, (XmlOptions)null);
}
public static STGeomGuideFormula parse(XMLInputStream var0, XmlOptions var1) throws XmlException, XMLStreamException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, var1);
}
public static XMLInputStream newValidatingXMLInputStream(XMLInputStream var0) throws XmlException, XMLStreamException {
return POIXMLTypeLoader.newValidatingXMLInputStream(var0, STGeomGuideFormula.type, (XmlOptions)null);
}
public static XMLInputStream newValidatingXMLInputStream(XMLInputStream var0, XmlOptions var1) throws XmlException, XMLStreamException {
return POIXMLTypeLoader.newValidatingXMLInputStream(var0, STGeomGuideFormula.type, var1);
}
}
}
|
UTF-8
|
Java
| 5,300 |
java
|
STGeomGuideFormula.java
|
Java
|
[] | null |
[] |
package org.openxmlformats.schemas.drawingml.x2006.main;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.net.URL;
import javax.xml.stream.XMLStreamReader;
import org.apache.poi.POIXMLTypeLoader;
import org.apache.xmlbeans.SchemaType;
import org.apache.xmlbeans.XmlBeans;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlOptions;
import org.apache.xmlbeans.XmlString;
import org.apache.xmlbeans.xml.stream.XMLInputStream;
import org.apache.xmlbeans.xml.stream.XMLStreamException;
import org.w3c.dom.Node;
public interface STGeomGuideFormula extends XmlString {
SchemaType type = (SchemaType)XmlBeans.typeSystemForClassLoader(STGeomGuideFormula.class.getClassLoader(), "schemaorg_apache_xmlbeans.system.sF1327CCA741569E70F9CA8C9AF9B44B2").resolveHandle("stgeomguideformula4b51type");
public static final class Factory {
public static STGeomGuideFormula newValue(Object var0) {
return (STGeomGuideFormula)STGeomGuideFormula.type.newValue(var0);
}
public static STGeomGuideFormula newInstance() {
return (STGeomGuideFormula)POIXMLTypeLoader.newInstance(STGeomGuideFormula.type, (XmlOptions)null);
}
public static STGeomGuideFormula newInstance(XmlOptions var0) {
return (STGeomGuideFormula)POIXMLTypeLoader.newInstance(STGeomGuideFormula.type, var0);
}
public static STGeomGuideFormula parse(String var0) throws XmlException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, (XmlOptions)null);
}
public static STGeomGuideFormula parse(String var0, XmlOptions var1) throws XmlException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, var1);
}
public static STGeomGuideFormula parse(File var0) throws XmlException, IOException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, (XmlOptions)null);
}
public static STGeomGuideFormula parse(File var0, XmlOptions var1) throws XmlException, IOException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, var1);
}
public static STGeomGuideFormula parse(URL var0) throws XmlException, IOException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, (XmlOptions)null);
}
public static STGeomGuideFormula parse(URL var0, XmlOptions var1) throws XmlException, IOException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, var1);
}
public static STGeomGuideFormula parse(InputStream var0) throws XmlException, IOException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, (XmlOptions)null);
}
public static STGeomGuideFormula parse(InputStream var0, XmlOptions var1) throws XmlException, IOException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, var1);
}
public static STGeomGuideFormula parse(Reader var0) throws XmlException, IOException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, (XmlOptions)null);
}
public static STGeomGuideFormula parse(Reader var0, XmlOptions var1) throws XmlException, IOException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, var1);
}
public static STGeomGuideFormula parse(XMLStreamReader var0) throws XmlException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, (XmlOptions)null);
}
public static STGeomGuideFormula parse(XMLStreamReader var0, XmlOptions var1) throws XmlException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, var1);
}
public static STGeomGuideFormula parse(Node var0) throws XmlException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, (XmlOptions)null);
}
public static STGeomGuideFormula parse(Node var0, XmlOptions var1) throws XmlException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, var1);
}
public static STGeomGuideFormula parse(XMLInputStream var0) throws XmlException, XMLStreamException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, (XmlOptions)null);
}
public static STGeomGuideFormula parse(XMLInputStream var0, XmlOptions var1) throws XmlException, XMLStreamException {
return (STGeomGuideFormula)POIXMLTypeLoader.parse(var0, STGeomGuideFormula.type, var1);
}
public static XMLInputStream newValidatingXMLInputStream(XMLInputStream var0) throws XmlException, XMLStreamException {
return POIXMLTypeLoader.newValidatingXMLInputStream(var0, STGeomGuideFormula.type, (XmlOptions)null);
}
public static XMLInputStream newValidatingXMLInputStream(XMLInputStream var0, XmlOptions var1) throws XmlException, XMLStreamException {
return POIXMLTypeLoader.newValidatingXMLInputStream(var0, STGeomGuideFormula.type, var1);
}
}
}
| 5,300 | 0.77 | 0.753962 | 112 | 46.32143 | 47.994831 | 224 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.875 | false | false |
12
|
20d73088d38652ee99a03cd144e7851bb18975d1
| 21,019,569,960,600 |
2df47444cc784d2922042199c9e8d9ae4c146741
|
/app/src/main/java/com/airosoft/task/data/database/cursor/WeatherCursorWrapper.java
|
a216af612ae66d02e503c87c63b26e2d4e561a9d
|
[] |
no_license
|
74airo/test_task
|
https://github.com/74airo/test_task
|
c2ced3dcab98f658acc559d1bfee1e683581ea11
|
00058308fbd9f019b49ef06d0d1d126cb437810e
|
refs/heads/master
| 2020-03-27T08:20:40.758000 | 2018-08-28T01:34:44 | 2018-08-28T01:34:44 | 146,246,091 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.airosoft.task.data.database.cursor;
import android.database.Cursor;
import android.database.CursorWrapper;
import com.airosoft.task.data.database.DbSchema.WeatherTable;
import com.airosoft.task.model.local.ConditionModel;
import com.airosoft.task.model.local.MainDataModel;
import com.airosoft.task.model.local.WeatherModel;
import com.airosoft.task.model.local.WindModel;
public class WeatherCursorWrapper extends CursorWrapper {
public WeatherCursorWrapper(Cursor cursor) {
super(cursor);
}
public WeatherModel getWeather() {
double temp = getDouble(getColumnIndex(WeatherTable.Column.TEMP));
double tempMin = getDouble(getColumnIndex(WeatherTable.Column.TEMP_MIN));
double tempMax = getDouble(getColumnIndex(WeatherTable.Column.TEMP_MAX));
double pressure = getDouble(getColumnIndex(WeatherTable.Column.PRESSURE));
int humidity = getInt(getColumnIndex(WeatherTable.Column.HUMIDITY));
int cloudiness = getInt(getColumnIndex(WeatherTable.Column.CLOUDINESS));
String conditionName = getString(getColumnIndex(WeatherTable.Column.CONDITION_NAME));
String conditionDescr = getString(getColumnIndex(WeatherTable.Column.CONDITION_DESCR));
String conditionIconName = getString(getColumnIndex(WeatherTable.Column.CONDITION_ICON_NAME));
double windSpeed = getDouble(getColumnIndex(WeatherTable.Column.WIND_SPEED));
double windDegree = getDouble(getColumnIndex(WeatherTable.Column.WIND_DEGREE));
long dateRequest = getLong(getColumnIndex(WeatherTable.Column.DATE_REQUEST));
ConditionModel condition = new ConditionModel();
condition.setName(conditionName);
condition.setDescription(conditionDescr);
condition.setIconName(conditionIconName);
WindModel wind = new WindModel();
wind.setSpeed(windSpeed);
wind.setDegree(windDegree);
MainDataModel mainData = new MainDataModel();
mainData.setTemp(temp);
mainData.setTempMin(tempMin);
mainData.setTempMax(tempMax);
mainData.setPressure(pressure);
mainData.setHumidity(humidity);
mainData.setCloudiness(cloudiness);
WeatherModel weather = new WeatherModel();
weather.setDateRequest(dateRequest);
weather.setCondition(condition);
weather.setMainData(mainData);
weather.setWind(wind);
return weather;
}
}
|
UTF-8
|
Java
| 2,439 |
java
|
WeatherCursorWrapper.java
|
Java
|
[] | null |
[] |
package com.airosoft.task.data.database.cursor;
import android.database.Cursor;
import android.database.CursorWrapper;
import com.airosoft.task.data.database.DbSchema.WeatherTable;
import com.airosoft.task.model.local.ConditionModel;
import com.airosoft.task.model.local.MainDataModel;
import com.airosoft.task.model.local.WeatherModel;
import com.airosoft.task.model.local.WindModel;
public class WeatherCursorWrapper extends CursorWrapper {
public WeatherCursorWrapper(Cursor cursor) {
super(cursor);
}
public WeatherModel getWeather() {
double temp = getDouble(getColumnIndex(WeatherTable.Column.TEMP));
double tempMin = getDouble(getColumnIndex(WeatherTable.Column.TEMP_MIN));
double tempMax = getDouble(getColumnIndex(WeatherTable.Column.TEMP_MAX));
double pressure = getDouble(getColumnIndex(WeatherTable.Column.PRESSURE));
int humidity = getInt(getColumnIndex(WeatherTable.Column.HUMIDITY));
int cloudiness = getInt(getColumnIndex(WeatherTable.Column.CLOUDINESS));
String conditionName = getString(getColumnIndex(WeatherTable.Column.CONDITION_NAME));
String conditionDescr = getString(getColumnIndex(WeatherTable.Column.CONDITION_DESCR));
String conditionIconName = getString(getColumnIndex(WeatherTable.Column.CONDITION_ICON_NAME));
double windSpeed = getDouble(getColumnIndex(WeatherTable.Column.WIND_SPEED));
double windDegree = getDouble(getColumnIndex(WeatherTable.Column.WIND_DEGREE));
long dateRequest = getLong(getColumnIndex(WeatherTable.Column.DATE_REQUEST));
ConditionModel condition = new ConditionModel();
condition.setName(conditionName);
condition.setDescription(conditionDescr);
condition.setIconName(conditionIconName);
WindModel wind = new WindModel();
wind.setSpeed(windSpeed);
wind.setDegree(windDegree);
MainDataModel mainData = new MainDataModel();
mainData.setTemp(temp);
mainData.setTempMin(tempMin);
mainData.setTempMax(tempMax);
mainData.setPressure(pressure);
mainData.setHumidity(humidity);
mainData.setCloudiness(cloudiness);
WeatherModel weather = new WeatherModel();
weather.setDateRequest(dateRequest);
weather.setCondition(condition);
weather.setMainData(mainData);
weather.setWind(wind);
return weather;
}
}
| 2,439 | 0.734727 | 0.734727 | 57 | 41.789474 | 28.975328 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.719298 | false | false |
12
|
46a58cbdd60756d3cddd8ccc7425285cf3ba3dfa
| 13,872,744,390,699 |
bf00a6163fd5887d9eb1ff7380afbf8f82cf2067
|
/src/main/java/io/vertace/VertaceHooks.java
|
34c0b3fb2faf03624a9bd0993d8bf345fc1cf6e9
|
[] |
no_license
|
akterstack/vertace
|
https://github.com/akterstack/vertace
|
b385daca18bbc3ec4cf1f90e28fcfe4256ac3a84
|
e7c1cf91d0e656383eddda39b221046a00610e08
|
refs/heads/master
| 2021-06-23T23:39:47.756000 | 2017-08-28T10:11:40 | 2017-08-28T10:11:40 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package io.vertace;
public enum VertaceHooks {
deploy,
undeploy
}
|
UTF-8
|
Java
| 73 |
java
|
VertaceHooks.java
|
Java
|
[] | null |
[] |
package io.vertace;
public enum VertaceHooks {
deploy,
undeploy
}
| 73 | 0.712329 | 0.712329 | 8 | 8.125 | 9.292974 | 26 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false |
12
|
2699c423c964393abe5c41c8037bc7cc2d3c86f0
| 9,337,258,915,954 |
35929d529d80cd0ec605c2d06eff3b327bbf2f8b
|
/Dynamic Programming/Floyd_Warshall_Algorithm.java
|
091de874a6666ec213464afab4698694deee68bd
|
[] |
no_license
|
AkhandMishratruth/GFG_Practice
|
https://github.com/AkhandMishratruth/GFG_Practice
|
2f942eececec79d892027755826161bf5fa5db85
|
e1f8d7448bda252cbe7af1d4a034f2d6d2798524
|
refs/heads/master
| 2021-01-02T09:39:22.612000 | 2017-12-06T06:07:00 | 2017-12-06T06:07:00 | 99,265,782 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.*;
import java.io.*;
public class Floyd_Warshall_Algorithm {
public static void main(String args[]) throws Exception {
PrintWriter p = new PrintWriter(System.out);
Scanner in = new Scanner(System.in);
int n=in.nextInt();
int[][] ar = new int[n][n]
for(int i=0;i<n;i++)
for(int j =0;j<n;j++)
ar[i][j]=in.nextInt();
int[][] dist = ar.clone();
for(int k=0;i<n;k++){
for(int i =0;i<n;i++){
for(int j =0;j<n;j++){
if(dist[i][k]+dist[k][j]<dist[i][j])
dist[i][j]=dist[i][k]+dist[k][j];
}
}
}
p.flush();
p.close();
}
}
|
UTF-8
|
Java
| 746 |
java
|
Floyd_Warshall_Algorithm.java
|
Java
|
[] | null |
[] |
import java.util.*;
import java.io.*;
public class Floyd_Warshall_Algorithm {
public static void main(String args[]) throws Exception {
PrintWriter p = new PrintWriter(System.out);
Scanner in = new Scanner(System.in);
int n=in.nextInt();
int[][] ar = new int[n][n]
for(int i=0;i<n;i++)
for(int j =0;j<n;j++)
ar[i][j]=in.nextInt();
int[][] dist = ar.clone();
for(int k=0;i<n;k++){
for(int i =0;i<n;i++){
for(int j =0;j<n;j++){
if(dist[i][k]+dist[k][j]<dist[i][j])
dist[i][j]=dist[i][k]+dist[k][j];
}
}
}
p.flush();
p.close();
}
}
| 746 | 0.434316 | 0.427614 | 25 | 28.84 | 16.894213 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.8 | false | false |
12
|
8ff91f3b1ff5c1bc822a80270ff2d718917083c8
| 3,006,477,144,931 |
4657fe54ee50a9c3793ba449568493d7c4ef36eb
|
/src/structures/Entity.java
|
e7f37ca93c9f5f664e318ca384201342466c195d
|
[] |
no_license
|
rubenvanassche/Distributed-Systems
|
https://github.com/rubenvanassche/Distributed-Systems
|
930bf3d1dc989e46c7f7f155f5d3f1a02a00b2f3
|
908287c3dd7dddd7475aee7b413775f57febf000
|
refs/heads/master
| 2021-01-16T18:49:26.019000 | 2017-08-19T00:16:21 | 2017-08-19T00:16:21 | 100,120,011 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package structures;
import structures.Entity.Type;
public class Entity {
public enum Type{
CONTROLLER, USER, SENSOR, LIGHT, FRIDGE
}
// Information about this device
public String ipAdress;
public int port;
public int id;
public Type type;
// Get an device which can be send over the avro protocol
public protocols.controller.Device getProtocolDevice(){
protocols.controller.Device device = new protocols.controller.Device();
device.setId(this.id);
device.setIpadress(this.ipAdress);
device.setPort(this.port);
device.setType(this.type.toString());
return device;
}
// Set information about the device via avro protocol
public void getInfoFromProtocolDevice(protocols.controller.Device device){
this.id = device.getId();
this.ipAdress = device.getIpadress().toString();
this.port = device.getPort();
this.type = Type.valueOf(device.getType().toString());
}
// Set information about the device via avro protocol
public void getInfoFromProtocolEntity(protocols.replication.Entity entity){
this.id = entity.getId();
this.ipAdress = entity.getIpadress().toString();
this.port = entity.getPort();
this.type = Type.valueOf(entity.getType().toString());
}
}
|
UTF-8
|
Java
| 1,215 |
java
|
Entity.java
|
Java
|
[] | null |
[] |
package structures;
import structures.Entity.Type;
public class Entity {
public enum Type{
CONTROLLER, USER, SENSOR, LIGHT, FRIDGE
}
// Information about this device
public String ipAdress;
public int port;
public int id;
public Type type;
// Get an device which can be send over the avro protocol
public protocols.controller.Device getProtocolDevice(){
protocols.controller.Device device = new protocols.controller.Device();
device.setId(this.id);
device.setIpadress(this.ipAdress);
device.setPort(this.port);
device.setType(this.type.toString());
return device;
}
// Set information about the device via avro protocol
public void getInfoFromProtocolDevice(protocols.controller.Device device){
this.id = device.getId();
this.ipAdress = device.getIpadress().toString();
this.port = device.getPort();
this.type = Type.valueOf(device.getType().toString());
}
// Set information about the device via avro protocol
public void getInfoFromProtocolEntity(protocols.replication.Entity entity){
this.id = entity.getId();
this.ipAdress = entity.getIpadress().toString();
this.port = entity.getPort();
this.type = Type.valueOf(entity.getType().toString());
}
}
| 1,215 | 0.738272 | 0.738272 | 44 | 26.613636 | 22.973518 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.795455 | false | false |
12
|
a95966861842ebc67a5a1d359157921a4d619b8f
| 12,919,261,671,203 |
f6a233465f0bbc101f2e6de75b2196bbce305002
|
/app/src/main/java/analyzer/MdfAnalyzer.java
|
4d0667124a9db2db65b044d05e3c25dc8816eb3d
|
[] |
no_license
|
stefanjampen/OmnisDeviceAnalyzer
|
https://github.com/stefanjampen/OmnisDeviceAnalyzer
|
d3ca8587c42514ddc93d8f9496635311d370f672
|
dba7c0f56eba70000f82db7f6a770eba4f4e6802
|
refs/heads/master
| 2022-11-06T16:24:09.989000 | 2019-06-17T09:04:08 | 2019-06-17T09:04:08 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package analyzer;
import metrohm.omnis.IOmnisNode;
/**
* Verifiziert ob alle Mdf Files korrekt sind.
*
* @author due/sjam
*/
public class MdfAnalyzer implements IOmnisNodeAnalyzer {
@Override
public String name() {
return "Mdf";
}
@Override
public boolean analyze(IOmnisNode node) {
return true;
}
@Override
public void display(IOmnisNode node, IResultProcessor resultProcessor) {
resultProcessor.title("Not Yet Implemented");
}
}
|
UTF-8
|
Java
| 460 |
java
|
MdfAnalyzer.java
|
Java
|
[
{
"context": "ert ob alle Mdf Files korrekt sind.\n * \n * @author due/sjam\n */\npublic class MdfAnalyzer implements IOmni",
"end": 122,
"score": 0.756446361541748,
"start": 119,
"tag": "USERNAME",
"value": "due"
},
{
"context": "b alle Mdf Files korrekt sind.\n * \n * @author due/sjam\n */\npublic class MdfAnalyzer implements IOmnisNod",
"end": 127,
"score": 0.7984192371368408,
"start": 123,
"tag": "USERNAME",
"value": "sjam"
}
] | null |
[] |
package analyzer;
import metrohm.omnis.IOmnisNode;
/**
* Verifiziert ob alle Mdf Files korrekt sind.
*
* @author due/sjam
*/
public class MdfAnalyzer implements IOmnisNodeAnalyzer {
@Override
public String name() {
return "Mdf";
}
@Override
public boolean analyze(IOmnisNode node) {
return true;
}
@Override
public void display(IOmnisNode node, IResultProcessor resultProcessor) {
resultProcessor.title("Not Yet Implemented");
}
}
| 460 | 0.726087 | 0.726087 | 27 | 16.074074 | 19.767025 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.925926 | false | false |
12
|
e004e4d1dbea940409018b236d6d5fd35edccdd9
| 11,647,951,334,532 |
edbd7f7808cf7d856801bbdfd7a0c539b8e5f8f0
|
/AppactsPlugin/src/com/appacts/plugin/Models/ItemWIthScreen.java
|
fbbb0d7956fb7fab05a5a7296bf30adae187a188
|
[] |
no_license
|
RyanTech/appacts-sdk-android
|
https://github.com/RyanTech/appacts-sdk-android
|
2ddf011101e366d5521c1bdaa61d18b8cade6ee3
|
a622098aa1c00f2f39c10e74aba528bb6412609f
|
refs/heads/master
| 2017-12-03T06:24:34.769000 | 2013-05-26T23:51:26 | 2013-05-26T23:51:26 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.appacts.plugin.Models;
import java.util.Date;
import java.util.UUID;
class ItemWithScreen extends Item {
public final String ScreenName;
public ItemWithScreen(UUID applicationId, String screenName, UUID sessionId, String version) {
super(applicationId, sessionId, version);
this.ScreenName = screenName;
}
public ItemWithScreen(int id, UUID applicationId, String screenName, Date dateCreated, UUID sessionId, String version) {
super(id, applicationId, dateCreated, sessionId, version);
this.ScreenName = screenName;
}
}
|
UTF-8
|
Java
| 608 |
java
|
ItemWIthScreen.java
|
Java
|
[] | null |
[] |
package com.appacts.plugin.Models;
import java.util.Date;
import java.util.UUID;
class ItemWithScreen extends Item {
public final String ScreenName;
public ItemWithScreen(UUID applicationId, String screenName, UUID sessionId, String version) {
super(applicationId, sessionId, version);
this.ScreenName = screenName;
}
public ItemWithScreen(int id, UUID applicationId, String screenName, Date dateCreated, UUID sessionId, String version) {
super(id, applicationId, dateCreated, sessionId, version);
this.ScreenName = screenName;
}
}
| 608 | 0.705592 | 0.705592 | 20 | 29.35 | 33.26601 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.1 | false | false |
12
|
4724312be39312a9097fd4ef11e0831267398246
| 25,881,472,959,660 |
df318527dbf600cab2daa31d79f2c147b43404ad
|
/workspace/conf/src/main/java/net/emof/building/util/mongodb/MongoDBParam.java
|
cf7e5ba6b0777f16eec112366ff22ea4e1447ee4
|
[] |
no_license
|
yimofang/wkx
|
https://github.com/yimofang/wkx
|
c2ddf289881ee13bd5866019a21a26018f60986e
|
bef4842fe14ae013e813eebb73eb0bb86a4d1a05
|
refs/heads/master
| 2020-03-26T11:08:26.305000 | 2018-08-16T01:20:46 | 2018-08-16T01:20:46 | 144,829,774 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package net.emof.building.util.mongodb;
import org.bson.Document;
import com.mongodb.MongoClient;
import com.mongodb.MongoClientOptions;
import com.mongodb.ServerAddress;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
public class MongoDBParam
{
private static MongoClient mongoClient;
private static MongoDatabase mongodb =null;
public static void readConnectParam(String ADBEnv){};
public boolean initConnect()
{
/* TGetConfig dc = TGetConfig.getInstance();
String sURL = dc.getProperties("mongo.url").trim();
String sPort = dc.getProperties("mongo.port").trim();
String sUser = dc.getProperties("mongo.user").trim();
String sPassword = dc.getProperties("mongo.password").trim();
String sMaxConnectins = dc.getProperties("mongo.maxconnection").trim();
String sMinConnectins = dc.getProperties("mongo.minconnection").trim();
String sDataBaseName = dc.getProperties("mongo.dbname").trim();
*/
String sURL ="127.0.0.1";//192.168.1.220
String sPort ="27017";
String sDataBaseName ="conf";
String sMaxConnectins="5";
String sMinConnectins="1";
int iMinConnections=2,iMaxConnections=5;
if (sMaxConnectins==null) sMaxConnectins="";
if (sMinConnectins==null) sMinConnectins="";
if(sMaxConnectins.length()>0)
{
try
{
iMaxConnections = Integer.parseInt(sMaxConnectins);
} catch (Exception e) {
}
}
if(sMinConnectins.length()>0)
{
try
{
iMinConnections = Integer.parseInt(sMinConnectins);
} catch (Exception e) {
}
}
MongoClientOptions.Builder builder = new MongoClientOptions.Builder();
builder.minConnectionsPerHost(iMinConnections);
builder.connectionsPerHost(iMaxConnections);
mongoClient= new MongoClient(new ServerAddress(sURL,Integer.parseInt(sPort)),builder.build());
if(mongoClient==null) return false;
mongodb= mongoClient.getDatabase(sDataBaseName);
if(mongodb==null) return false;
return true;
}
public MongoCollection<Document> getCollection(String ACollName) {
if (mongodb==null)
if(!initConnect()) return null;;
return mongodb.getCollection(ACollName);
}
public void closeMongoClient() {
if (mongoClient != null) {
mongoClient.close();
mongodb=null;
}
System.out.println("CloseMongoClient successfully");
}
}
|
UTF-8
|
Java
| 2,677 |
java
|
MongoDBParam.java
|
Java
|
[
{
"context": "es(\"mongo.dbname\").trim();\r\n\t\t*/\r\n\t\tString sURL =\"127.0.0.1\";//192.168.1.220\r\n\t\tString sPort =\"27017\";\r\n\t\tStr",
"end": 1012,
"score": 0.9997562766075134,
"start": 1003,
"tag": "IP_ADDRESS",
"value": "127.0.0.1"
},
{
"context": "ame\").trim();\r\n\t\t*/\r\n\t\tString sURL =\"127.0.0.1\";//192.168.1.220\r\n\t\tString sPort =\"27017\";\r\n\t\tString sDataBaseName",
"end": 1029,
"score": 0.9997522830963135,
"start": 1016,
"tag": "IP_ADDRESS",
"value": "192.168.1.220"
}
] | null |
[] |
package net.emof.building.util.mongodb;
import org.bson.Document;
import com.mongodb.MongoClient;
import com.mongodb.MongoClientOptions;
import com.mongodb.ServerAddress;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
public class MongoDBParam
{
private static MongoClient mongoClient;
private static MongoDatabase mongodb =null;
public static void readConnectParam(String ADBEnv){};
public boolean initConnect()
{
/* TGetConfig dc = TGetConfig.getInstance();
String sURL = dc.getProperties("mongo.url").trim();
String sPort = dc.getProperties("mongo.port").trim();
String sUser = dc.getProperties("mongo.user").trim();
String sPassword = dc.getProperties("mongo.password").trim();
String sMaxConnectins = dc.getProperties("mongo.maxconnection").trim();
String sMinConnectins = dc.getProperties("mongo.minconnection").trim();
String sDataBaseName = dc.getProperties("mongo.dbname").trim();
*/
String sURL ="127.0.0.1";//192.168.1.220
String sPort ="27017";
String sDataBaseName ="conf";
String sMaxConnectins="5";
String sMinConnectins="1";
int iMinConnections=2,iMaxConnections=5;
if (sMaxConnectins==null) sMaxConnectins="";
if (sMinConnectins==null) sMinConnectins="";
if(sMaxConnectins.length()>0)
{
try
{
iMaxConnections = Integer.parseInt(sMaxConnectins);
} catch (Exception e) {
}
}
if(sMinConnectins.length()>0)
{
try
{
iMinConnections = Integer.parseInt(sMinConnectins);
} catch (Exception e) {
}
}
MongoClientOptions.Builder builder = new MongoClientOptions.Builder();
builder.minConnectionsPerHost(iMinConnections);
builder.connectionsPerHost(iMaxConnections);
mongoClient= new MongoClient(new ServerAddress(sURL,Integer.parseInt(sPort)),builder.build());
if(mongoClient==null) return false;
mongodb= mongoClient.getDatabase(sDataBaseName);
if(mongodb==null) return false;
return true;
}
public MongoCollection<Document> getCollection(String ACollName) {
if (mongodb==null)
if(!initConnect()) return null;;
return mongodb.getCollection(ACollName);
}
public void closeMongoClient() {
if (mongoClient != null) {
mongoClient.close();
mongodb=null;
}
System.out.println("CloseMongoClient successfully");
}
}
| 2,677 | 0.628689 | 0.618603 | 87 | 28.770115 | 23.125196 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.356322 | false | false |
12
|
c4223ae1ddd4f487c02a021cf461aaaef2566a07
| 37,735,582,691,466 |
7e4dedfe9a2f72dd085b0ee167e76eb9bd429952
|
/web80-93-cube-shop/cube-shop-search-web/src/main/java/com/phoenix/search/controller/SearchController.java
|
8d3bd8c49da3c3aa8762b4663a799e2c2c820430
|
[] |
no_license
|
xeon-ye/darkhorse32-java-web
|
https://github.com/xeon-ye/darkhorse32-java-web
|
13b60c153a04016b13a9e169a5078546ecbf6f33
|
65d1c007df784d4cca18a858b4f2fa7ab4de2858
|
refs/heads/master
| 2023-07-22T02:27:14.643000 | 2021-08-20T18:24:36 | 2021-08-20T18:24:36 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.phoenix.search.controller;
import com.phoenix.common.pojo.SearchResult;
import com.phoenix.search.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* 商品搜索controller
*/
@Controller
@RequestMapping("search")
public class SearchController {
@Autowired
private SearchService searchService;
@Value("${SEARCH_RESULT_ROWS}")
private Integer SEARCH_RESULT_ROWS;
@Value("${ITEM_ADDRESS}")
private String ITEM_ADDRESS;
@Value("${PORTAL_ADDRESS}")
private String PORTAL_ADDRESS;
@Value("${SSO_ADDRESS}")
private String SSO_ADDRESS;
@RequestMapping("item")
public String searchItem(String keyword, @RequestParam(name = "page",defaultValue = "1") Integer page, Model model){
SearchResult searchResult = searchService.searchItem(keyword, page, SEARCH_RESULT_ROWS);
//把结果传递给页面
model.addAttribute("query",keyword);
model.addAttribute("totalPages",searchResult.getTotalPages());
model.addAttribute("page",page);
model.addAttribute("recordCount",searchResult.getRecordCount());
model.addAttribute("itemList",searchResult.getItemList());
model.addAttribute("itemAddress",ITEM_ADDRESS);
model.addAttribute("portalAddress",PORTAL_ADDRESS);
model.addAttribute("ssoAddress",SSO_ADDRESS);
model.addAttribute("registerAddress",SSO_ADDRESS+"/user/register/page");
//异常测试
//int a=1/0;
//返回逻辑视图
return "search";
}
}
|
UTF-8
|
Java
| 1,840 |
java
|
SearchController.java
|
Java
|
[] | null |
[] |
package com.phoenix.search.controller;
import com.phoenix.common.pojo.SearchResult;
import com.phoenix.search.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* 商品搜索controller
*/
@Controller
@RequestMapping("search")
public class SearchController {
@Autowired
private SearchService searchService;
@Value("${SEARCH_RESULT_ROWS}")
private Integer SEARCH_RESULT_ROWS;
@Value("${ITEM_ADDRESS}")
private String ITEM_ADDRESS;
@Value("${PORTAL_ADDRESS}")
private String PORTAL_ADDRESS;
@Value("${SSO_ADDRESS}")
private String SSO_ADDRESS;
@RequestMapping("item")
public String searchItem(String keyword, @RequestParam(name = "page",defaultValue = "1") Integer page, Model model){
SearchResult searchResult = searchService.searchItem(keyword, page, SEARCH_RESULT_ROWS);
//把结果传递给页面
model.addAttribute("query",keyword);
model.addAttribute("totalPages",searchResult.getTotalPages());
model.addAttribute("page",page);
model.addAttribute("recordCount",searchResult.getRecordCount());
model.addAttribute("itemList",searchResult.getItemList());
model.addAttribute("itemAddress",ITEM_ADDRESS);
model.addAttribute("portalAddress",PORTAL_ADDRESS);
model.addAttribute("ssoAddress",SSO_ADDRESS);
model.addAttribute("registerAddress",SSO_ADDRESS+"/user/register/page");
//异常测试
//int a=1/0;
//返回逻辑视图
return "search";
}
}
| 1,840 | 0.718263 | 0.716592 | 56 | 31.071428 | 27.407543 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.714286 | false | false |
12
|
369622cef62b1e664ac98f2710ee0b2dbd83ea91
| 35,631,048,728,653 |
2d4b9f932796d8f4d4fd3291ca744cb85be5c284
|
/src/main/java/UserNew.java
|
934a0c618ef2db74a0692373a3f3be1aabc35bda
|
[] |
no_license
|
corentinnormand/adventofcode-2018
|
https://github.com/corentinnormand/adventofcode-2018
|
21f7274f502d6e33e5a9610a15d2aec8f899d639
|
6e492398f483afa67935a930bb7e297855b85d1c
|
refs/heads/master
| 2020-04-10T09:35:35.851000 | 2018-12-08T13:24:54 | 2018-12-08T13:24:54 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class UserNew implements Comparable<UserNew> {
private String name;
public UserNew(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public int compareTo(UserNew o) {
return 0;
}
@Override
public String toString() {
return "UserNew{" + "name='" + name + '\'' + '}';
}
}
|
UTF-8
|
Java
| 397 |
java
|
UserNew.java
|
Java
|
[] | null |
[] |
public class UserNew implements Comparable<UserNew> {
private String name;
public UserNew(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public int compareTo(UserNew o) {
return 0;
}
@Override
public String toString() {
return "UserNew{" + "name='" + name + '\'' + '}';
}
}
| 397 | 0.642317 | 0.639798 | 26 | 14.269231 | 15.815177 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.115385 | false | false |
12
|
633c4edc6b71b7d9f0e875b57ccc17569192913c
| 35,631,048,729,414 |
59aba5456f494cb591c84425c9d5861c756767e4
|
/SpringMVC/src/main/java/com/hooper/model/Admin.java
|
d531c60f6fc5c52737c2ede2152d0418835c5ad1
|
[] |
no_license
|
TheHooper/SpringMVCSample
|
https://github.com/TheHooper/SpringMVCSample
|
17fbf0b5dce293f530b3456196b150d283fe5a40
|
8263f15ff9280ab024b315f59d1177e34db3bc94
|
refs/heads/master
| 2020-06-14T00:26:30.455000 | 2017-01-05T15:40:55 | 2017-01-05T15:40:55 | 75,539,098 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.hooper.model;
import javax.persistence.*;
public class Admin {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String name;
private String password;
@Column(name = "randomSalt")
private String randomsalt;
private String avatar;
private Long ctime;
private Long utime;
private Boolean deleted;
@Column(name = "lastLoginTime")
private Long lastlogintime;
@Column(name = "lastLoginIp")
private Long lastloginip;
/**
* @return id
*/
public Integer getId() {
return id;
}
/**
* @param id
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return name
*/
public String getName() {
return name;
}
/**
* @param name
*/
public void setName(String name) {
this.name = name;
}
/**
* @return password
*/
public String getPassword() {
return password;
}
/**
* @param password
*/
public void setPassword(String password) {
this.password = password;
}
/**
* @return randomSalt
*/
public String getRandomsalt() {
return randomsalt;
}
/**
* @param randomsalt
*/
public void setRandomsalt(String randomsalt) {
this.randomsalt = randomsalt;
}
/**
* @return avatar
*/
public String getAvatar() {
return avatar;
}
/**
* @param avatar
*/
public void setAvatar(String avatar) {
this.avatar = avatar;
}
/**
* @return ctime
*/
public Long getCtime() {
return ctime;
}
/**
* @param ctime
*/
public void setCtime(Long ctime) {
this.ctime = ctime;
}
/**
* @return utime
*/
public Long getUtime() {
return utime;
}
/**
* @param utime
*/
public void setUtime(Long utime) {
this.utime = utime;
}
/**
* @return deleted
*/
public Boolean getDeleted() {
return deleted;
}
/**
* @param deleted
*/
public void setDeleted(Boolean deleted) {
this.deleted = deleted;
}
/**
* @return lastLoginTime
*/
public Long getLastlogintime() {
return lastlogintime;
}
/**
* @param lastlogintime
*/
public void setLastlogintime(Long lastlogintime) {
this.lastlogintime = lastlogintime;
}
/**
* @return lastLoginIp
*/
public Long getLastloginip() {
return lastloginip;
}
/**
* @param lastloginip
*/
public void setLastloginip(Long lastloginip) {
this.lastloginip = lastloginip;
}
}
|
UTF-8
|
Java
| 2,775 |
java
|
Admin.java
|
Java
|
[] | null |
[] |
package com.hooper.model;
import javax.persistence.*;
public class Admin {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String name;
private String password;
@Column(name = "randomSalt")
private String randomsalt;
private String avatar;
private Long ctime;
private Long utime;
private Boolean deleted;
@Column(name = "lastLoginTime")
private Long lastlogintime;
@Column(name = "lastLoginIp")
private Long lastloginip;
/**
* @return id
*/
public Integer getId() {
return id;
}
/**
* @param id
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return name
*/
public String getName() {
return name;
}
/**
* @param name
*/
public void setName(String name) {
this.name = name;
}
/**
* @return password
*/
public String getPassword() {
return password;
}
/**
* @param password
*/
public void setPassword(String password) {
this.password = password;
}
/**
* @return randomSalt
*/
public String getRandomsalt() {
return randomsalt;
}
/**
* @param randomsalt
*/
public void setRandomsalt(String randomsalt) {
this.randomsalt = randomsalt;
}
/**
* @return avatar
*/
public String getAvatar() {
return avatar;
}
/**
* @param avatar
*/
public void setAvatar(String avatar) {
this.avatar = avatar;
}
/**
* @return ctime
*/
public Long getCtime() {
return ctime;
}
/**
* @param ctime
*/
public void setCtime(Long ctime) {
this.ctime = ctime;
}
/**
* @return utime
*/
public Long getUtime() {
return utime;
}
/**
* @param utime
*/
public void setUtime(Long utime) {
this.utime = utime;
}
/**
* @return deleted
*/
public Boolean getDeleted() {
return deleted;
}
/**
* @param deleted
*/
public void setDeleted(Boolean deleted) {
this.deleted = deleted;
}
/**
* @return lastLoginTime
*/
public Long getLastlogintime() {
return lastlogintime;
}
/**
* @param lastlogintime
*/
public void setLastlogintime(Long lastlogintime) {
this.lastlogintime = lastlogintime;
}
/**
* @return lastLoginIp
*/
public Long getLastloginip() {
return lastloginip;
}
/**
* @param lastloginip
*/
public void setLastloginip(Long lastloginip) {
this.lastloginip = lastloginip;
}
}
| 2,775 | 0.52973 | 0.52973 | 170 | 15.329412 | 13.787367 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.188235 | false | false |
12
|
22f17f98b1f9a95a0577a885e2dbe46edc00e6db
| 39,633,958,233,777 |
4e8042a4ae0ad56b23c384bf4eaa6b83b1410d65
|
/src/com/leetcode/simple/同构字符串205.java
|
5014a8df06e938b8ef071b31f212c67a15b2aa05
|
[] |
no_license
|
JasonLiuJinC/leetcodeSample
|
https://github.com/JasonLiuJinC/leetcodeSample
|
92e8e5c568e625169c9257ebee7129f0cef83152
|
a5acac71e301bf11b0a797daebde9985d0c85341
|
refs/heads/master
| 2023-02-14T14:00:12.510000 | 2020-12-27T09:02:15 | 2020-12-27T09:02:15 | 324,700,859 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.leetcode.simple;
import java.util.HashMap;
import java.util.Map;
/**
* 给定两个字符串s和t,判断它们是否是同构的。
* <p>
* 如果s中的字符可以被替换得到t,那么这两个字符串是同构的。
* <p>
* 所有出现的字符都必须用另一个字符替换,同时保留字符的顺序。两个字符不能映射到同一个字符上,但字符可以映射自己本身。
* <p>
* 示例 1:
* <p>
* 输入: s = "egg", t = "add"
* 输出: true
* 示例 2:
* <p>
* 输入: s = "foo", t = "bar"
* 输出: false
* 示例 3:
* <p>
* 输入: s = "paper", t = "title"
* 输出: true
* 说明:
* 你可以假设s和 t 具有相同的长度。
*/
public class 同构字符串205 {
public static boolean isIsomorphic(String s, String t) {
if (s.length() != t.length()) return false;
Map<Character, Character> hashMap = new HashMap();
for (int i = 0; i < s.length(); i++) {
if (!hashMap.containsKey(s.charAt(i))) {
if(hashMap.containsValue(t.charAt(i)))return false;
hashMap.put(s.charAt(i),t.charAt(i));
}else {
if(hashMap.get(s.charAt(i))!=t.charAt(i)) return false;
}
}
return true;
}
public static void main(String[] args) {
boolean isomorphic = isIsomorphic("abc", "cba");
System.out.println("isomorphic = " + isomorphic);
}
}
|
UTF-8
|
Java
| 1,446 |
java
|
同构字符串205.java
|
Java
|
[] | null |
[] |
package com.leetcode.simple;
import java.util.HashMap;
import java.util.Map;
/**
* 给定两个字符串s和t,判断它们是否是同构的。
* <p>
* 如果s中的字符可以被替换得到t,那么这两个字符串是同构的。
* <p>
* 所有出现的字符都必须用另一个字符替换,同时保留字符的顺序。两个字符不能映射到同一个字符上,但字符可以映射自己本身。
* <p>
* 示例 1:
* <p>
* 输入: s = "egg", t = "add"
* 输出: true
* 示例 2:
* <p>
* 输入: s = "foo", t = "bar"
* 输出: false
* 示例 3:
* <p>
* 输入: s = "paper", t = "title"
* 输出: true
* 说明:
* 你可以假设s和 t 具有相同的长度。
*/
public class 同构字符串205 {
public static boolean isIsomorphic(String s, String t) {
if (s.length() != t.length()) return false;
Map<Character, Character> hashMap = new HashMap();
for (int i = 0; i < s.length(); i++) {
if (!hashMap.containsKey(s.charAt(i))) {
if(hashMap.containsValue(t.charAt(i)))return false;
hashMap.put(s.charAt(i),t.charAt(i));
}else {
if(hashMap.get(s.charAt(i))!=t.charAt(i)) return false;
}
}
return true;
}
public static void main(String[] args) {
boolean isomorphic = isIsomorphic("abc", "cba");
System.out.println("isomorphic = " + isomorphic);
}
}
| 1,446 | 0.553448 | 0.547414 | 48 | 23.166666 | 21.184048 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.416667 | false | false |
12
|
f7b146060bbc07de680114e5039275b078351310
| 34,892,314,374,730 |
c773727618753a69650dfa56fea7bc32512148b1
|
/src/main/java/com/sqkb/ioc/factory/BeanDefinition.java
|
c1e8e1bef0dfa9a363e07212b26fad4d32f4f243
|
[] |
no_license
|
Tairy/io
|
https://github.com/Tairy/io
|
a69c220686f346123443d99833a6bb9cfb75def3
|
c6bcab930d531d6b0b50a66d46152c1d2d98afea
|
refs/heads/master
| 2023-01-31T16:58:52.513000 | 2020-12-11T13:06:11 | 2020-12-11T13:06:11 | 206,775,085 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.sqkb.ioc.factory;
import com.sqkb.ioc.PropertyValues;
/**
* package: com.sqkb.ioc.factory
*
* @author <tairy> gengrui@qury.org
* @date 2020/12/11 下午8:34
* <p>
* 对 bean 的一个封装
*/
public class BeanDefinition {
private Object bean;
private Class beanClass;
private String className;
private PropertyValues propertyValues = new PropertyValues();
public Object getBean() {
return this.bean;
}
public void setBean(Object bean) {
this.bean = bean;
}
public Class getBeanClass() {
return beanClass;
}
public void setClassName(String className) {
this.className = className;
try {
this.beanClass = Class.forName(className);
} catch (Exception e) {
e.printStackTrace();
}
}
public PropertyValues getPropertyValues() {
return propertyValues;
}
public void setPropertyValues(PropertyValues propertyValues) {
this.propertyValues = propertyValues;
}
}
|
UTF-8
|
Java
| 1,044 |
java
|
BeanDefinition.java
|
Java
|
[
{
"context": "*\n * package: com.sqkb.ioc.factory\n *\n * @author <tairy> gengrui@qury.org\n * @date 2020/12/11 下午8:34\n * <",
"end": 125,
"score": 0.9993125200271606,
"start": 120,
"tag": "USERNAME",
"value": "tairy"
},
{
"context": "ackage: com.sqkb.ioc.factory\n *\n * @author <tairy> gengrui@qury.org\n * @date 2020/12/11 下午8:34\n * <p>\n * 对 bean 的一个封装",
"end": 143,
"score": 0.9999262094497681,
"start": 127,
"tag": "EMAIL",
"value": "gengrui@qury.org"
}
] | null |
[] |
package com.sqkb.ioc.factory;
import com.sqkb.ioc.PropertyValues;
/**
* package: com.sqkb.ioc.factory
*
* @author <tairy> <EMAIL>
* @date 2020/12/11 下午8:34
* <p>
* 对 bean 的一个封装
*/
public class BeanDefinition {
private Object bean;
private Class beanClass;
private String className;
private PropertyValues propertyValues = new PropertyValues();
public Object getBean() {
return this.bean;
}
public void setBean(Object bean) {
this.bean = bean;
}
public Class getBeanClass() {
return beanClass;
}
public void setClassName(String className) {
this.className = className;
try {
this.beanClass = Class.forName(className);
} catch (Exception e) {
e.printStackTrace();
}
}
public PropertyValues getPropertyValues() {
return propertyValues;
}
public void setPropertyValues(PropertyValues propertyValues) {
this.propertyValues = propertyValues;
}
}
| 1,035 | 0.631323 | 0.620623 | 52 | 18.788462 | 18.477987 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.269231 | false | false |
12
|
7151c9211e861d5ade9725ce722d1d1ce3434a49
| 34,832,184,825,070 |
ca50cdc6944c8f999553e7c7288fb061225c8edb
|
/GenericFunProject/GenericFunProject/src/Test.java
|
7c2893bd5a5fea34bfea511f2427e675b5c5a420
|
[] |
no_license
|
Lawzii/School-Notes-for-C-and-Java
|
https://github.com/Lawzii/School-Notes-for-C-and-Java
|
90f90348e45443b295c7d4640a9c4b743b9fcce4
|
6df433e65676b80ee0395c8ae3e3145112f8c358
|
refs/heads/master
| 2020-03-15T17:33:41.917000 | 2019-06-11T23:53:00 | 2019-06-11T23:53:00 | 132,264,398 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.ArrayList;
public class Test {
public static void main(String[] args) {
Animal animal = new Animal();
Bear bear = new Bear();
Car car = new Car();
GenericFun gf = new GenericFun();
String answer = gf.playGenerics(animal);
System.out.println(answer);
answer = gf.playGenerics(bear);
System.out.println(answer);
//answer = gf.playGenerics(car); <--- gives and error because it has been limited and isn't in the animal inheritance tree
ArrayList<Integer> myIntList = new ArrayList<Integer>();
ArrayList<Double> myDoubleList = new ArrayList<Double>();
ArrayList<String> myStringList = new ArrayList<String>();
for (int i = 0; i < 5 ; i++){
myIntList.add(i);
}
for (int i = 0; i < 5 ; i++){
myDoubleList.add(i * 3.2);
}
myStringList.add("Va");
myStringList.add("le");
myStringList.add("nc");
myStringList.add("ia");
gf.useWildcard(myIntList);
gf.useWildcard(myDoubleList);
//gf.useWildcard(myStringList); <-- error because it does not extend Number data type
}
}
|
UTF-8
|
Java
| 1,039 |
java
|
Test.java
|
Java
|
[] | null |
[] |
import java.util.ArrayList;
public class Test {
public static void main(String[] args) {
Animal animal = new Animal();
Bear bear = new Bear();
Car car = new Car();
GenericFun gf = new GenericFun();
String answer = gf.playGenerics(animal);
System.out.println(answer);
answer = gf.playGenerics(bear);
System.out.println(answer);
//answer = gf.playGenerics(car); <--- gives and error because it has been limited and isn't in the animal inheritance tree
ArrayList<Integer> myIntList = new ArrayList<Integer>();
ArrayList<Double> myDoubleList = new ArrayList<Double>();
ArrayList<String> myStringList = new ArrayList<String>();
for (int i = 0; i < 5 ; i++){
myIntList.add(i);
}
for (int i = 0; i < 5 ; i++){
myDoubleList.add(i * 3.2);
}
myStringList.add("Va");
myStringList.add("le");
myStringList.add("nc");
myStringList.add("ia");
gf.useWildcard(myIntList);
gf.useWildcard(myDoubleList);
//gf.useWildcard(myStringList); <-- error because it does not extend Number data type
}
}
| 1,039 | 0.674687 | 0.668912 | 44 | 22.613636 | 25.419405 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.727273 | false | false |
12
|
7c73821845b934a56b76c22d93ee59a73ee1e1fa
| 19,662,360,315,333 |
6795cbfb0c2177e2f1c28369fd1fcfde23693a63
|
/app/src/main/java/com/cardyapp/Utils/PictureSourceChooser.java
|
26954798ffc441638287cd2150f80f253be1cc8e
|
[] |
no_license
|
tomukesh5/Cardy_Remote
|
https://github.com/tomukesh5/Cardy_Remote
|
c7d7fed19c903b5b533d2ff89f33c1f54617ffd0
|
22985bcb3f8628870534a2f1c697882f2e9e4156
|
refs/heads/master
| 2021-09-09T21:11:00.899000 | 2018-03-19T18:04:55 | 2018-03-19T18:04:55 | 113,941,331 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.cardyapp.Utils;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import com.cardyapp.R;
public class PictureSourceChooser {
public interface OnCameraSource {
public void onCameraSelected();
}
public interface OnGallerySource {
public void onGallerySelected();
}
private Context context;
private OnCameraSource onCameraSource;
private OnGallerySource onGallerySource;
private BottomSheetDialog bottomSheetDialog;
public PictureSourceChooser(Context context, OnCameraSource onCameraSource, OnGallerySource onGallerySource) {
this.context = context;
this.setOnCameraSource(onCameraSource);
this.setOnGallerySource(onGallerySource);
}
public void show() {
bottomSheetDialog = new BottomSheetDialog(context, R.style.BottomSheetDialog);
View v = LayoutInflater.from(context).inflate(R.layout.profile_pic_chooser, null);
TextView camera = (TextView) v.findViewById(R.id.cameraTextButton);
camera.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
bottomSheetDialog.dismiss();
handleCameraSource();
}
});
TextView gallery = (TextView) v.findViewById(R.id.galleryTextButton);
gallery.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
bottomSheetDialog.dismiss();
handleGallerySource();
}
});
bottomSheetDialog.contentView(v).show();
}
public void handleCameraSource() {
if (null != onCameraSource)
onCameraSource.onCameraSelected();
}
public void handleGallerySource() {
if (null != onGallerySource)
onGallerySource.onGallerySelected();
}
/**
* Interface Setter Methods
*/
public void setOnCameraSource(OnCameraSource onCameraSource) {
this.onCameraSource = onCameraSource;
}
public void setOnGallerySource(OnGallerySource onGallerySource) {
this.onGallerySource = onGallerySource;
}
}
|
UTF-8
|
Java
| 2,251 |
java
|
PictureSourceChooser.java
|
Java
|
[] | null |
[] |
package com.cardyapp.Utils;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import com.cardyapp.R;
public class PictureSourceChooser {
public interface OnCameraSource {
public void onCameraSelected();
}
public interface OnGallerySource {
public void onGallerySelected();
}
private Context context;
private OnCameraSource onCameraSource;
private OnGallerySource onGallerySource;
private BottomSheetDialog bottomSheetDialog;
public PictureSourceChooser(Context context, OnCameraSource onCameraSource, OnGallerySource onGallerySource) {
this.context = context;
this.setOnCameraSource(onCameraSource);
this.setOnGallerySource(onGallerySource);
}
public void show() {
bottomSheetDialog = new BottomSheetDialog(context, R.style.BottomSheetDialog);
View v = LayoutInflater.from(context).inflate(R.layout.profile_pic_chooser, null);
TextView camera = (TextView) v.findViewById(R.id.cameraTextButton);
camera.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
bottomSheetDialog.dismiss();
handleCameraSource();
}
});
TextView gallery = (TextView) v.findViewById(R.id.galleryTextButton);
gallery.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
bottomSheetDialog.dismiss();
handleGallerySource();
}
});
bottomSheetDialog.contentView(v).show();
}
public void handleCameraSource() {
if (null != onCameraSource)
onCameraSource.onCameraSelected();
}
public void handleGallerySource() {
if (null != onGallerySource)
onGallerySource.onGallerySelected();
}
/**
* Interface Setter Methods
*/
public void setOnCameraSource(OnCameraSource onCameraSource) {
this.onCameraSource = onCameraSource;
}
public void setOnGallerySource(OnGallerySource onGallerySource) {
this.onGallerySource = onGallerySource;
}
}
| 2,251 | 0.666371 | 0.666371 | 74 | 29.432432 | 25.245861 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.459459 | false | false |
12
|
f2eccf64e5b629d7111901cd34d664c41cc4287c
| 13,675,175,879,379 |
90b6f7a5b91cbe203facbc008e4e8a9f8ba3eadb
|
/refuerzoTema5Bucles/numConsecutivos.java
|
54d8198e0da8dadb6d4070e522e98513cc874905
|
[] |
no_license
|
DavidPerezPardo/Ejercicios-java
|
https://github.com/DavidPerezPardo/Ejercicios-java
|
aea2d544ecfd1120029eafa259b90551a4d4ec8c
|
5a6e895f952148b42ef228537678d59cf4081f51
|
refs/heads/master
| 2020-03-30T12:11:11.649000 | 2019-07-11T00:10:34 | 2019-07-11T00:10:34 | 151,212,510 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.Scanner;
public class numConsecutivos {
public static void main(String[] args) {
/*muestra por pantalla los numeros enteros consecutivos desde el 1 hasta
* el indicado por el usuario*/
Scanner s = new Scanner(System.in);
System.out.println("se visualizarán numeros enteros consecutivos por pantalla desde 1 en adelante");
System.out.println("Introduzca la cantidad de numeros a mostrar");
long numIntro = s.nextLong();
for(long i=1; i<=numIntro; i++) {
System.out.print(i+",");
}
}
}
|
UTF-8
|
Java
| 550 |
java
|
numConsecutivos.java
|
Java
|
[] | null |
[] |
import java.util.Scanner;
public class numConsecutivos {
public static void main(String[] args) {
/*muestra por pantalla los numeros enteros consecutivos desde el 1 hasta
* el indicado por el usuario*/
Scanner s = new Scanner(System.in);
System.out.println("se visualizarán numeros enteros consecutivos por pantalla desde 1 en adelante");
System.out.println("Introduzca la cantidad de numeros a mostrar");
long numIntro = s.nextLong();
for(long i=1; i<=numIntro; i++) {
System.out.print(i+",");
}
}
}
| 550 | 0.684882 | 0.679417 | 17 | 30.294117 | 28.325346 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.058824 | false | false |
12
|
35d654e3212c60ff6007c214b1767f83188d378b
| 13,675,175,875,976 |
f20405aff69b968c2f515520afbc0e9078dc5f83
|
/corelibrary/src/main/java/br/agr/terras/corelibrary/infraestructure/resources/animation/FadeAnimation.java
|
7346685420c6f1f2aa882fae39a4386566ca4a8d
|
[
"MIT"
] |
permissive
|
kereko/GestaoBovina
|
https://github.com/kereko/GestaoBovina
|
9f98e67a0c9dc1fa01aa06c52a3290aa2896d27c
|
e41ff8b77b433a6ddd8115610f7427f74c3631b4
|
refs/heads/master
| 2023-06-03T02:16:05.789000 | 2019-04-24T06:50:40 | 2019-04-24T06:50:40 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package br.agr.terras.corelibrary.infraestructure.resources.animation;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.Transformation;
/**
* Created by edson on 28/03/16.
*/
public class FadeAnimation extends Animation{
public static final int FADE_IN = 33;
public static final int FADE_OUT = 99;
private int modo;
private View content;
public FadeAnimation(View content, int modo) {
this.content = content;
this.modo = modo;
}
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
if(modo == FADE_IN){
content.setAlpha(interpolatedTime);
}
if(modo == FADE_OUT){
content.setAlpha(1 - interpolatedTime);
}
}
@Override
public boolean willChangeBounds() {
return true;
}
}
|
UTF-8
|
Java
| 897 |
java
|
FadeAnimation.java
|
Java
|
[
{
"context": ".view.animation.Transformation;\n\n/**\n * Created by edson on 28/03/16.\n */\npublic class FadeAnimation exten",
"end": 209,
"score": 0.9989069700241089,
"start": 204,
"tag": "USERNAME",
"value": "edson"
}
] | null |
[] |
package br.agr.terras.corelibrary.infraestructure.resources.animation;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.Transformation;
/**
* Created by edson on 28/03/16.
*/
public class FadeAnimation extends Animation{
public static final int FADE_IN = 33;
public static final int FADE_OUT = 99;
private int modo;
private View content;
public FadeAnimation(View content, int modo) {
this.content = content;
this.modo = modo;
}
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
if(modo == FADE_IN){
content.setAlpha(interpolatedTime);
}
if(modo == FADE_OUT){
content.setAlpha(1 - interpolatedTime);
}
}
@Override
public boolean willChangeBounds() {
return true;
}
}
| 897 | 0.654404 | 0.64214 | 39 | 22 | 21.249434 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.384615 | false | false |
12
|
a6f19f8b8dc5503accda8c1812443c9ca0abfa73
| 8,366,596,334,347 |
65a27204eb2495a6b9cf3047b7ea6bcbb94eebc6
|
/src/main/java/collectors/HouseholdStats.java
|
b0636bb98bb661a965f24731d538e94aecaff947
|
[
"MIT"
] |
permissive
|
AdelaHaoyuYe/spatial-housing-model
|
https://github.com/AdelaHaoyuYe/spatial-housing-model
|
842b679fdc0cdcf912daff8730a51c641e51717c
|
1f42b3333487045b333b431714b40235f6c4976c
|
refs/heads/master
| 2020-03-23T22:12:45.456000 | 2018-05-02T19:33:38 | 2018-05-02T19:33:38 | 142,160,966 | 0 | 0 |
MIT
| true | 2018-07-24T13:16:18 | 2018-07-24T13:16:18 | 2018-07-20T12:24:10 | 2018-05-03T13:55:20 | 22,884 | 0 | 0 | 0 | null | false | null |
package collectors;
import housing.Model;
import housing.Region;
import java.util.ArrayList;
/**************************************************************************************************
* Class to aggregate all regional household statistics
*
* @author daniel, Adrian Carro
*
*************************************************************************************************/
public class HouseholdStats extends CollectorBase {
private static final long serialVersionUID = -402486195880710795L;
//------------------//
//----- Fields -----//
//------------------//
// General fields
private ArrayList<Region> geography;
// Fields for counting numbers of the different types of households and household conditions
private int nBTL; // Number of buy-to-let (BTL) households, i.e., households with the BTL gene (includes both active and inactive)
private int nActiveBTL; // Number of BTL households with, at least, one BTL property
private int nBTLOwnerOccupier; // Number of BTL households owning their home but without any BTL property
private int nBTLHomeless; // Number of homeless BTL households
private int nBTLBankruptcies; // Number of BTL households going bankrupt in a given time step
private int nNonBTLOwnerOccupier; // Number of non-BTL households owning their home
private int nRenting; // Number of (by definition, non-BTL) households renting their home
private int nNonBTLHomeless; // Number of homeless non-BTL households
private int nNonBTLBankruptcies; // Number of non-BTL households going bankrupt in a given time step
// Fields for summing annualised total incomes
private double activeBTLAnnualisedTotalIncome;
private double ownerOccupierAnnualisedTotalIncome;
private double rentingAnnualisedTotalIncome;
private double homelessAnnualisedTotalIncome;
// Other fields
private double sumStockYield; // Sum of stock gross rental yields of all currently occupied rental properties
//------------------------//
//----- Constructors -----//
//------------------------//
/**
* Initialises the national household statistics collector
*
* @param geography Reference to the whole geography of regions
*/
public HouseholdStats(ArrayList<Region> geography) {
setActive(true);
this.geography = geography;
}
//-------------------//
//----- Methods -----//
//-------------------//
/**
* Sets initial values for all relevant variables to enforce a controlled first measure for statistics
*/
public void init() {
nBTL = 0;
nActiveBTL = 0;
nBTLOwnerOccupier = 0;
nBTLHomeless = 0;
nBTLBankruptcies = 0;
nNonBTLOwnerOccupier = 0;
nRenting = 0;
nNonBTLHomeless = 0;
nNonBTLBankruptcies = 0;
activeBTLAnnualisedTotalIncome = 0.0;
ownerOccupierAnnualisedTotalIncome = 0.0;
rentingAnnualisedTotalIncome = 0.0;
homelessAnnualisedTotalIncome = 0.0;
sumStockYield = 0.0;
}
/**
* Collects current values, apart from updating those to be computed, for all relevant variables from the regional
* household statistics objects
*/
public void collectRegionalRecords() {
// Re-initiate to zero variables to sum over regions
nBTL = 0;
nActiveBTL = 0;
nBTLOwnerOccupier = 0;
nBTLHomeless = 0;
nBTLBankruptcies = 0;
nNonBTLOwnerOccupier = 0;
nRenting = 0;
nNonBTLHomeless = 0;
nNonBTLBankruptcies = 0;
activeBTLAnnualisedTotalIncome = 0.0;
ownerOccupierAnnualisedTotalIncome = 0.0;
rentingAnnualisedTotalIncome = 0.0;
homelessAnnualisedTotalIncome = 0.0;
sumStockYield = 0.0;
// Run through regions summing
for (Region region : geography) {
nBTL += region.regionalHouseholdStats.getnBTL();
nActiveBTL += region.regionalHouseholdStats.getnActiveBTL();
nBTLOwnerOccupier += region.regionalHouseholdStats.getnBTLOwnerOccupier();
nBTLHomeless += region.regionalHouseholdStats.getnBTLHomeless();
nBTLBankruptcies += region.regionalHouseholdStats.getnBTLBankruptcies();
nNonBTLOwnerOccupier += region.regionalHouseholdStats.getnNonBTLOwnerOccupier();
nRenting += region.regionalHouseholdStats.getnRenting();
nNonBTLHomeless += region.regionalHouseholdStats.getnNonBTLHomeless();
nNonBTLBankruptcies += region.regionalHouseholdStats.getnNonBTLBankruptcies();
activeBTLAnnualisedTotalIncome += region.regionalHouseholdStats.getActiveBTLAnnualisedTotalIncome();
ownerOccupierAnnualisedTotalIncome += region.regionalHouseholdStats.getOwnerOccupierAnnualisedTotalIncome();
rentingAnnualisedTotalIncome += region.regionalHouseholdStats.getRentingAnnualisedTotalIncome();
homelessAnnualisedTotalIncome += region.regionalHouseholdStats.getHomelessAnnualisedTotalIncome();
sumStockYield += region.regionalHouseholdStats.getSumStockYield();
}
}
//----- Getter/setter methods -----//
// Getters for numbers of households variables
int getnBTL() { return nBTL; }
int getnActiveBTL() { return nActiveBTL; }
int getnBTLOwnerOccupier() { return nBTLOwnerOccupier; }
int getnBTLHomeless() { return nBTLHomeless; }
int getnBTLBankruptcies() { return nBTLBankruptcies; }
int getnNonBTLOwnerOccupier() { return nNonBTLOwnerOccupier; }
int getnRenting() { return nRenting; }
int getnNonBTLHomeless() { return nNonBTLHomeless; }
int getnNonBTLBankruptcies() { return nNonBTLBankruptcies; }
int getnOwnerOccupier() { return nBTLOwnerOccupier + nNonBTLOwnerOccupier; }
int getnHomeless() { return nBTLHomeless + nNonBTLHomeless; }
int getnNonOwner() { return nRenting + getnHomeless(); }
// Getters for annualised income variables
double getActiveBTLAnnualisedTotalIncome() { return activeBTLAnnualisedTotalIncome; }
double getOwnerOccupierAnnualisedTotalIncome() { return ownerOccupierAnnualisedTotalIncome; }
double getRentingAnnualisedTotalIncome() { return rentingAnnualisedTotalIncome; }
double getHomelessAnnualisedTotalIncome() { return homelessAnnualisedTotalIncome; }
double getNonOwnerAnnualisedTotalIncome() {
return rentingAnnualisedTotalIncome + homelessAnnualisedTotalIncome;
}
// Getters for yield variables
double getSumStockYield() { return sumStockYield; }
double getAvStockYield() {
if(nRenting > 0) {
return sumStockYield/nRenting;
} else {
return 0.0;
}
}
// Getters for other variables...
// ... number of empty houses
int getnEmptyHouses() {
return Model.construction.getHousingStock() + nBTLHomeless + nNonBTLHomeless
- Model.demographics.getTotalPopulation();
}
// ... proportion of housing stock owned by buy-to-let investors (all rental properties, plus all empty houses not
// owned by the construction sector)
double getBTLStockFraction() {
return ((double)(getnEmptyHouses() - Model.housingMarketStats.getnUnsoldNewBuild()
+ nRenting))/Model.construction.getHousingStock();
}
// // Array with ages of all households
// public double [] getAgeDistribution() {
// double [] result = new double[region.households.size()];
// int i = 0;
// for(Household h : region.households) {
// result[i] = h.getAge();
// ++i;
// }
// return(result);
// }
//
// // Array with ages of renters and households in social housing
// public double [] getNonOwnerAges() {
// double [] result = new double[getnNonOwner()];
// int i = 0;
// for(Household h : region.households) {
// if(!h.isHomeowner() && i < getnNonOwner()) {
// result[i++] = h.getAge();
// }
// }
// while(i < getnNonOwner()) {
// result[i++] = 0.0;
// }
// return(result);
// }
//
// // Array with ages of owner-occupiers
// public double [] getOwnerOccupierAges() {
// double [] result = new double[getnNonOwner()];
// int i = 0;
// for(Household h : region.households) {
// if(!h.isHomeowner() && i < getnNonOwner()) {
// result[i] = h.getAge();
// ++i;
// }
// }
// while(i < getnNonOwner()) {
// result[i++] = 0.0;
// }
// return(result);
// }
//
// // Distribution of the number of properties owned by BTL investors
// public double [] getBTLNProperties() {
// if(isActive() && nBTL > 0) {
// double [] result = new double[(int)nBTL];
// int i = 0;
// for(Household h : region.households) {
// if(h.behaviour.isPropertyInvestor() && i<nBTL) {
// result[i] = h.nInvestmentProperties();
// ++i;
// }
// }
// return(result);
// }
// return null;
// }
//
// public double [] getLogIncomes() {
// double [] result = new double[region.households.size()];
// int i = 0;
// for(Household h : region.households) {
// result[i++] = Math.log(h.annualEmploymentIncome());
// }
// return(result);
// }
//
// public double [] getLogBankBalances() {
// double [] result = new double[region.households.size()];
// int i = 0;
// for(Household h : region.households) {
// result[i++] = Math.log(Math.max(0.0, h.getBankBalance()));
// }
// return(result);
// }
}
|
UTF-8
|
Java
| 10,044 |
java
|
HouseholdStats.java
|
Java
|
[
{
"context": "te all regional household statistics\n *\n * @author daniel, Adrian Carro\n *\n ****************************",
"end": 269,
"score": 0.9782768487930298,
"start": 266,
"tag": "NAME",
"value": "dan"
},
{
"context": "ll regional household statistics\n *\n * @author daniel, Adrian Carro\n *\n *******************************",
"end": 272,
"score": 0.537546694278717,
"start": 269,
"tag": "USERNAME",
"value": "iel"
},
{
"context": "egional household statistics\n *\n * @author daniel, Adrian Carro\n *\n *********************************************",
"end": 286,
"score": 0.9998584985733032,
"start": 274,
"tag": "NAME",
"value": "Adrian Carro"
}
] | null |
[] |
package collectors;
import housing.Model;
import housing.Region;
import java.util.ArrayList;
/**************************************************************************************************
* Class to aggregate all regional household statistics
*
* @author daniel, <NAME>
*
*************************************************************************************************/
public class HouseholdStats extends CollectorBase {
private static final long serialVersionUID = -402486195880710795L;
//------------------//
//----- Fields -----//
//------------------//
// General fields
private ArrayList<Region> geography;
// Fields for counting numbers of the different types of households and household conditions
private int nBTL; // Number of buy-to-let (BTL) households, i.e., households with the BTL gene (includes both active and inactive)
private int nActiveBTL; // Number of BTL households with, at least, one BTL property
private int nBTLOwnerOccupier; // Number of BTL households owning their home but without any BTL property
private int nBTLHomeless; // Number of homeless BTL households
private int nBTLBankruptcies; // Number of BTL households going bankrupt in a given time step
private int nNonBTLOwnerOccupier; // Number of non-BTL households owning their home
private int nRenting; // Number of (by definition, non-BTL) households renting their home
private int nNonBTLHomeless; // Number of homeless non-BTL households
private int nNonBTLBankruptcies; // Number of non-BTL households going bankrupt in a given time step
// Fields for summing annualised total incomes
private double activeBTLAnnualisedTotalIncome;
private double ownerOccupierAnnualisedTotalIncome;
private double rentingAnnualisedTotalIncome;
private double homelessAnnualisedTotalIncome;
// Other fields
private double sumStockYield; // Sum of stock gross rental yields of all currently occupied rental properties
//------------------------//
//----- Constructors -----//
//------------------------//
/**
* Initialises the national household statistics collector
*
* @param geography Reference to the whole geography of regions
*/
public HouseholdStats(ArrayList<Region> geography) {
setActive(true);
this.geography = geography;
}
//-------------------//
//----- Methods -----//
//-------------------//
/**
* Sets initial values for all relevant variables to enforce a controlled first measure for statistics
*/
public void init() {
nBTL = 0;
nActiveBTL = 0;
nBTLOwnerOccupier = 0;
nBTLHomeless = 0;
nBTLBankruptcies = 0;
nNonBTLOwnerOccupier = 0;
nRenting = 0;
nNonBTLHomeless = 0;
nNonBTLBankruptcies = 0;
activeBTLAnnualisedTotalIncome = 0.0;
ownerOccupierAnnualisedTotalIncome = 0.0;
rentingAnnualisedTotalIncome = 0.0;
homelessAnnualisedTotalIncome = 0.0;
sumStockYield = 0.0;
}
/**
* Collects current values, apart from updating those to be computed, for all relevant variables from the regional
* household statistics objects
*/
public void collectRegionalRecords() {
// Re-initiate to zero variables to sum over regions
nBTL = 0;
nActiveBTL = 0;
nBTLOwnerOccupier = 0;
nBTLHomeless = 0;
nBTLBankruptcies = 0;
nNonBTLOwnerOccupier = 0;
nRenting = 0;
nNonBTLHomeless = 0;
nNonBTLBankruptcies = 0;
activeBTLAnnualisedTotalIncome = 0.0;
ownerOccupierAnnualisedTotalIncome = 0.0;
rentingAnnualisedTotalIncome = 0.0;
homelessAnnualisedTotalIncome = 0.0;
sumStockYield = 0.0;
// Run through regions summing
for (Region region : geography) {
nBTL += region.regionalHouseholdStats.getnBTL();
nActiveBTL += region.regionalHouseholdStats.getnActiveBTL();
nBTLOwnerOccupier += region.regionalHouseholdStats.getnBTLOwnerOccupier();
nBTLHomeless += region.regionalHouseholdStats.getnBTLHomeless();
nBTLBankruptcies += region.regionalHouseholdStats.getnBTLBankruptcies();
nNonBTLOwnerOccupier += region.regionalHouseholdStats.getnNonBTLOwnerOccupier();
nRenting += region.regionalHouseholdStats.getnRenting();
nNonBTLHomeless += region.regionalHouseholdStats.getnNonBTLHomeless();
nNonBTLBankruptcies += region.regionalHouseholdStats.getnNonBTLBankruptcies();
activeBTLAnnualisedTotalIncome += region.regionalHouseholdStats.getActiveBTLAnnualisedTotalIncome();
ownerOccupierAnnualisedTotalIncome += region.regionalHouseholdStats.getOwnerOccupierAnnualisedTotalIncome();
rentingAnnualisedTotalIncome += region.regionalHouseholdStats.getRentingAnnualisedTotalIncome();
homelessAnnualisedTotalIncome += region.regionalHouseholdStats.getHomelessAnnualisedTotalIncome();
sumStockYield += region.regionalHouseholdStats.getSumStockYield();
}
}
//----- Getter/setter methods -----//
// Getters for numbers of households variables
int getnBTL() { return nBTL; }
int getnActiveBTL() { return nActiveBTL; }
int getnBTLOwnerOccupier() { return nBTLOwnerOccupier; }
int getnBTLHomeless() { return nBTLHomeless; }
int getnBTLBankruptcies() { return nBTLBankruptcies; }
int getnNonBTLOwnerOccupier() { return nNonBTLOwnerOccupier; }
int getnRenting() { return nRenting; }
int getnNonBTLHomeless() { return nNonBTLHomeless; }
int getnNonBTLBankruptcies() { return nNonBTLBankruptcies; }
int getnOwnerOccupier() { return nBTLOwnerOccupier + nNonBTLOwnerOccupier; }
int getnHomeless() { return nBTLHomeless + nNonBTLHomeless; }
int getnNonOwner() { return nRenting + getnHomeless(); }
// Getters for annualised income variables
double getActiveBTLAnnualisedTotalIncome() { return activeBTLAnnualisedTotalIncome; }
double getOwnerOccupierAnnualisedTotalIncome() { return ownerOccupierAnnualisedTotalIncome; }
double getRentingAnnualisedTotalIncome() { return rentingAnnualisedTotalIncome; }
double getHomelessAnnualisedTotalIncome() { return homelessAnnualisedTotalIncome; }
double getNonOwnerAnnualisedTotalIncome() {
return rentingAnnualisedTotalIncome + homelessAnnualisedTotalIncome;
}
// Getters for yield variables
double getSumStockYield() { return sumStockYield; }
double getAvStockYield() {
if(nRenting > 0) {
return sumStockYield/nRenting;
} else {
return 0.0;
}
}
// Getters for other variables...
// ... number of empty houses
int getnEmptyHouses() {
return Model.construction.getHousingStock() + nBTLHomeless + nNonBTLHomeless
- Model.demographics.getTotalPopulation();
}
// ... proportion of housing stock owned by buy-to-let investors (all rental properties, plus all empty houses not
// owned by the construction sector)
double getBTLStockFraction() {
return ((double)(getnEmptyHouses() - Model.housingMarketStats.getnUnsoldNewBuild()
+ nRenting))/Model.construction.getHousingStock();
}
// // Array with ages of all households
// public double [] getAgeDistribution() {
// double [] result = new double[region.households.size()];
// int i = 0;
// for(Household h : region.households) {
// result[i] = h.getAge();
// ++i;
// }
// return(result);
// }
//
// // Array with ages of renters and households in social housing
// public double [] getNonOwnerAges() {
// double [] result = new double[getnNonOwner()];
// int i = 0;
// for(Household h : region.households) {
// if(!h.isHomeowner() && i < getnNonOwner()) {
// result[i++] = h.getAge();
// }
// }
// while(i < getnNonOwner()) {
// result[i++] = 0.0;
// }
// return(result);
// }
//
// // Array with ages of owner-occupiers
// public double [] getOwnerOccupierAges() {
// double [] result = new double[getnNonOwner()];
// int i = 0;
// for(Household h : region.households) {
// if(!h.isHomeowner() && i < getnNonOwner()) {
// result[i] = h.getAge();
// ++i;
// }
// }
// while(i < getnNonOwner()) {
// result[i++] = 0.0;
// }
// return(result);
// }
//
// // Distribution of the number of properties owned by BTL investors
// public double [] getBTLNProperties() {
// if(isActive() && nBTL > 0) {
// double [] result = new double[(int)nBTL];
// int i = 0;
// for(Household h : region.households) {
// if(h.behaviour.isPropertyInvestor() && i<nBTL) {
// result[i] = h.nInvestmentProperties();
// ++i;
// }
// }
// return(result);
// }
// return null;
// }
//
// public double [] getLogIncomes() {
// double [] result = new double[region.households.size()];
// int i = 0;
// for(Household h : region.households) {
// result[i++] = Math.log(h.annualEmploymentIncome());
// }
// return(result);
// }
//
// public double [] getLogBankBalances() {
// double [] result = new double[region.households.size()];
// int i = 0;
// for(Household h : region.households) {
// result[i++] = Math.log(Math.max(0.0, h.getBankBalance()));
// }
// return(result);
// }
}
| 10,038 | 0.603445 | 0.596276 | 244 | 40.163933 | 31.735552 | 150 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.516393 | false | false |
12
|
a02d189b58863c19d74bf70150e4ea2589db686a
| 2,147,483,713,311 |
e32a1294a35c73b42488190371b34461177ce099
|
/plugins/src/main/java/org/hci/updb/cache_paths/CommonAncestorParser.java
|
f6dd91569518a960ebc4b33625b6dd2972be520e
|
[] |
no_license
|
glemmon/UPDB
|
https://github.com/glemmon/UPDB
|
8b611b9d3b680742ee4b4f4cc559882ff388d7e7
|
3fc6fd003689caf529d60ac1a5477404ba38f909
|
refs/heads/master
| 2016-09-14T16:59:30.199000 | 2016-08-01T05:46:11 | 2016-08-01T05:46:11 | 36,949,376 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.hci.updb.cache_paths;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Map;
import org.hci.updb.utility.collection.OrderedLongPair;
import com.google.common.collect.Maps;
//Too many files to parse all at once. A parser for each file.
//Also Parses "Least common ancestor" file
public class CommonAncestorParser {
//private static final int expected_size = 228908919;//All paths
//private static final String default_dir = "node_pair_scores";
private final Map<OrderedLongPair, Long[]> common_ancestors;
private void parse_file(final Path in) {
CommonAncestorStream.stream(in).forEach(pair->common_ancestors.put(
pair.first(),
pair.other()
));
}
public CommonAncestorParser(final Path in){
common_ancestors = Maps.newHashMap();
parse_file(in);
}
public CommonAncestorParser(final String in){
this(Paths.get(in));
}
public Long[] get_ancestors(final OrderedLongPair descendants) {
return common_ancestors.getOrDefault(descendants, new Long[0]);
}
public Long[] get_ancestors(final Long c1, final Long c2){
return get_ancestors(OrderedLongPair.of(c1,c2));
}
public Map<OrderedLongPair, Long[]> get_all_ancestors(){
return common_ancestors;
}
}
|
UTF-8
|
Java
| 1,231 |
java
|
CommonAncestorParser.java
|
Java
|
[] | null |
[] |
package org.hci.updb.cache_paths;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Map;
import org.hci.updb.utility.collection.OrderedLongPair;
import com.google.common.collect.Maps;
//Too many files to parse all at once. A parser for each file.
//Also Parses "Least common ancestor" file
public class CommonAncestorParser {
//private static final int expected_size = 228908919;//All paths
//private static final String default_dir = "node_pair_scores";
private final Map<OrderedLongPair, Long[]> common_ancestors;
private void parse_file(final Path in) {
CommonAncestorStream.stream(in).forEach(pair->common_ancestors.put(
pair.first(),
pair.other()
));
}
public CommonAncestorParser(final Path in){
common_ancestors = Maps.newHashMap();
parse_file(in);
}
public CommonAncestorParser(final String in){
this(Paths.get(in));
}
public Long[] get_ancestors(final OrderedLongPair descendants) {
return common_ancestors.getOrDefault(descendants, new Long[0]);
}
public Long[] get_ancestors(final Long c1, final Long c2){
return get_ancestors(OrderedLongPair.of(c1,c2));
}
public Map<OrderedLongPair, Long[]> get_all_ancestors(){
return common_ancestors;
}
}
| 1,231 | 0.740861 | 0.729488 | 46 | 25.76087 | 24.435528 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.413043 | false | false |
12
|
c23c915c36d18da58525b9c5957559547b73432a
| 4,535,485,473,094 |
b1354e38805fd31ad94ac351df345e0188a12c09
|
/DataLab_StudentFiles/DataLab_Code/Test.java
|
cb2896cb9f18e27fa9dd82719a574960cbd10216
|
[] |
no_license
|
riajain02/opensourcedemo
|
https://github.com/riajain02/opensourcedemo
|
428b41a64ff06bdcd72c91e04444495afe75ebd5
|
8ecc044b7d15d077e513643787b53784ff041f05
|
refs/heads/master
| 2023-04-11T21:30:15.095000 | 2021-05-01T21:32:47 | 2021-05-01T21:32:47 | 333,837,578 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import core.data.*;
import java.util.ArrayList;
public class Test {
private String[] names;
private int[] years;
private double[] ladderScores;
private double[] GDPs;
private double[] socialSupports;
private double[] lifeExps;
private double[] freedoms;
private double[] generosities;
private double[] corruptions;
private ArrayList<Country> countries;
public static void main(String[] args) {
DataSource ds = DataSource.connect("../world-happiness-report.csv");
ds.load();
//ds.printUsageString();
Test t = new Test();
t.readData(ds);
t.addToArray();
t.analyzeData();
}
public void readData(DataSource ds)
{
// names
names = ds.fetchStringArray("Country name");
// years
years = ds.fetchIntArray("year");
// ladder scores
ladderScores = ds.fetchDoubleArray("Life Ladder");
// GDPs
GDPs = ds.fetchDoubleArray("Log GDP per capita");
// social support scores
socialSupports = ds.fetchDoubleArray("Social support");
// life expectancies
lifeExps = ds.fetchDoubleArray("Healthy life expectancy at birth");
// freedom scores
freedoms = ds.fetchDoubleArray("Freedom to make life choices");
// generosity scores
generosities = ds.fetchDoubleArray("Generosity");
// corruption scores
corruptions = ds.fetchDoubleArray("Perceptions of corruption");
}
public void addToArray()
{
countries = new ArrayList<Country>();
for (int i = 0; i < names.length; i++)
{
countries.add(i,new Country(names[i], years[i], ladderScores[i], GDPs[i], socialSupports[i], lifeExps[i], freedoms[i], generosities[i], corruptions[i]));
}
}
public void analyzeData()
{
double max;
Country cMax;
// ladder scores
max = Double.MIN_VALUE;
cMax = countries.get(0);
for (Country c : countries) {if (c.getLadderScore() > max) {max = c.getLadderScore(); cMax = c;}}
System.out.println("\n\nThe country with the highest ladder score is " + cMax.getName() + " (" + cMax.getYear() + ").");
// GDPs
max = Double.MIN_VALUE;
cMax = countries.get(0);
for (Country c : countries) {if (c.getGDP() > max) {max = c.getGDP(); cMax = c;}}
System.out.println("The country with the highest log GDP per capita is " + cMax.getName() + " (" + cMax.getYear() + ").");
// social support scores
max = Double.MIN_VALUE;
cMax = countries.get(0);
for (Country c : countries) {if (c.getSocialSupport() > max) {max = c.getSocialSupport(); cMax = c;}}
System.out.println("The country with the best social support is " + cMax.getName() + " (" + cMax.getYear() + ").");
// life expectancies
max = Double.MIN_VALUE;
cMax = countries.get(0);
for (Country c : countries) {if (c.getLifeExp() > max) {max = c.getLifeExp(); cMax = c;}}
System.out.println("The country with the highest life expectancy is " + cMax.getName() + " (" + cMax.getYear() + ").");
// freedom scores
max = Double.MIN_VALUE;
cMax = countries.get(0);
for (Country c : countries) {if (c.getFreedom() > max) {max = c.getFreedom(); cMax = c;}}
System.out.println("The country with most freedom is " + cMax.getName() + " (" + cMax.getYear() + ").");
// generosity scores
max = Double.MIN_VALUE;
cMax = countries.get(0);
for (Country c : countries) {if (c.getGenerosity() > max) {max = c.getGenerosity(); cMax = c;}}
System.out.println("The country with the most generosity is " + cMax.getName() + " (" + cMax.getYear() + ").");
// corruption scores
max = Double.MAX_VALUE;
cMax = countries.get(0);
for (Country c : countries) {if (c.getCorruption() < max) {max = c.getCorruption(); cMax = c;}}
System.out.println("The country with least corruption is " + cMax.getName() + " (" + cMax.getYear() + ").");
// total
max = Double.MIN_VALUE;
cMax = countries.get(0);
for (Country c : countries) {if (c.getTotal() > max) {max = c.getTotal(); cMax = c;}}
System.out.println("\nThe overall happiest country in the world since 2005 was " + cMax.getName() + " in " + cMax.getYear() + ".\n\n");
}
}
|
UTF-8
|
Java
| 4,509 |
java
|
Test.java
|
Java
|
[] | null |
[] |
import core.data.*;
import java.util.ArrayList;
public class Test {
private String[] names;
private int[] years;
private double[] ladderScores;
private double[] GDPs;
private double[] socialSupports;
private double[] lifeExps;
private double[] freedoms;
private double[] generosities;
private double[] corruptions;
private ArrayList<Country> countries;
public static void main(String[] args) {
DataSource ds = DataSource.connect("../world-happiness-report.csv");
ds.load();
//ds.printUsageString();
Test t = new Test();
t.readData(ds);
t.addToArray();
t.analyzeData();
}
public void readData(DataSource ds)
{
// names
names = ds.fetchStringArray("Country name");
// years
years = ds.fetchIntArray("year");
// ladder scores
ladderScores = ds.fetchDoubleArray("Life Ladder");
// GDPs
GDPs = ds.fetchDoubleArray("Log GDP per capita");
// social support scores
socialSupports = ds.fetchDoubleArray("Social support");
// life expectancies
lifeExps = ds.fetchDoubleArray("Healthy life expectancy at birth");
// freedom scores
freedoms = ds.fetchDoubleArray("Freedom to make life choices");
// generosity scores
generosities = ds.fetchDoubleArray("Generosity");
// corruption scores
corruptions = ds.fetchDoubleArray("Perceptions of corruption");
}
public void addToArray()
{
countries = new ArrayList<Country>();
for (int i = 0; i < names.length; i++)
{
countries.add(i,new Country(names[i], years[i], ladderScores[i], GDPs[i], socialSupports[i], lifeExps[i], freedoms[i], generosities[i], corruptions[i]));
}
}
public void analyzeData()
{
double max;
Country cMax;
// ladder scores
max = Double.MIN_VALUE;
cMax = countries.get(0);
for (Country c : countries) {if (c.getLadderScore() > max) {max = c.getLadderScore(); cMax = c;}}
System.out.println("\n\nThe country with the highest ladder score is " + cMax.getName() + " (" + cMax.getYear() + ").");
// GDPs
max = Double.MIN_VALUE;
cMax = countries.get(0);
for (Country c : countries) {if (c.getGDP() > max) {max = c.getGDP(); cMax = c;}}
System.out.println("The country with the highest log GDP per capita is " + cMax.getName() + " (" + cMax.getYear() + ").");
// social support scores
max = Double.MIN_VALUE;
cMax = countries.get(0);
for (Country c : countries) {if (c.getSocialSupport() > max) {max = c.getSocialSupport(); cMax = c;}}
System.out.println("The country with the best social support is " + cMax.getName() + " (" + cMax.getYear() + ").");
// life expectancies
max = Double.MIN_VALUE;
cMax = countries.get(0);
for (Country c : countries) {if (c.getLifeExp() > max) {max = c.getLifeExp(); cMax = c;}}
System.out.println("The country with the highest life expectancy is " + cMax.getName() + " (" + cMax.getYear() + ").");
// freedom scores
max = Double.MIN_VALUE;
cMax = countries.get(0);
for (Country c : countries) {if (c.getFreedom() > max) {max = c.getFreedom(); cMax = c;}}
System.out.println("The country with most freedom is " + cMax.getName() + " (" + cMax.getYear() + ").");
// generosity scores
max = Double.MIN_VALUE;
cMax = countries.get(0);
for (Country c : countries) {if (c.getGenerosity() > max) {max = c.getGenerosity(); cMax = c;}}
System.out.println("The country with the most generosity is " + cMax.getName() + " (" + cMax.getYear() + ").");
// corruption scores
max = Double.MAX_VALUE;
cMax = countries.get(0);
for (Country c : countries) {if (c.getCorruption() < max) {max = c.getCorruption(); cMax = c;}}
System.out.println("The country with least corruption is " + cMax.getName() + " (" + cMax.getYear() + ").");
// total
max = Double.MIN_VALUE;
cMax = countries.get(0);
for (Country c : countries) {if (c.getTotal() > max) {max = c.getTotal(); cMax = c;}}
System.out.println("\nThe overall happiest country in the world since 2005 was " + cMax.getName() + " in " + cMax.getYear() + ".\n\n");
}
}
| 4,509 | 0.576181 | 0.573298 | 110 | 40 | 36.723537 | 165 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.754545 | false | false |
12
|
2bd976698b525ae0fcb0b0b3db2574b27f1508e9
| 19,335,942,776,880 |
30814f322f8a1f942b23aea64282054857a2a667
|
/lab1_test/private_tests/lab1/repeat.java
|
2362283f26a10c57484fe0018082bdd3ec63dd3c
|
[] |
no_license
|
malusamayo/MinijavaLab
|
https://github.com/malusamayo/MinijavaLab
|
8b26bebb5f81d47d42f1e2c928d2aa2eff63b2b9
|
54107cc72d8151087e02a9b9e5a498414b5a8591
|
refs/heads/master
| 2022-10-05T15:59:24.724000 | 2020-06-12T03:59:37 | 2020-06-12T03:59:37 | 245,592,708 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
class Main {
public static void main(String[] a){
int p;
int q;
System.out.println(1);
}
}
class N
{
int x;
public int doit()
{
int a;
N m;
int[] arr;
a = this.doit();
arr = new int[5];
System.out.println(arr.length);
System.out.println(arr[6]);
m = new N();
// if(true) {
// int s;
// int a; // javac会报重复定义错,然而这种情况似乎在minijava词法分析阶段就不允许
// s = 1;
// }
return 1;
}
}
class M extends N
{
public int doitt(int x)
{
M m;
N n;
int N;
n = new N();
n = new M();
System.out.println(N);
return 0;
}
}
class P extends M
{
public int doittt(int x)
{
M m;
N n;
int N;
n = new P(); // 子类的子类也可以赋值给父类
return 0;
}
}
|
UTF-8
|
Java
| 970 |
java
|
repeat.java
|
Java
|
[] | null |
[] |
class Main {
public static void main(String[] a){
int p;
int q;
System.out.println(1);
}
}
class N
{
int x;
public int doit()
{
int a;
N m;
int[] arr;
a = this.doit();
arr = new int[5];
System.out.println(arr.length);
System.out.println(arr[6]);
m = new N();
// if(true) {
// int s;
// int a; // javac会报重复定义错,然而这种情况似乎在minijava词法分析阶段就不允许
// s = 1;
// }
return 1;
}
}
class M extends N
{
public int doitt(int x)
{
M m;
N n;
int N;
n = new N();
n = new M();
System.out.println(N);
return 0;
}
}
class P extends M
{
public int doittt(int x)
{
M m;
N n;
int N;
n = new P(); // 子类的子类也可以赋值给父类
return 0;
}
}
| 970 | 0.41236 | 0.404494 | 56 | 14.910714 | 12.521805 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
12
|
b5ad0ab03121ec28512389bfe5285f023b980e16
| 17,695,265,284,922 |
080173631a570e7d032a1d500c54d21df6356a5a
|
/FBPM/PM-JCK/fcs-pm-biz/src/main/java/com/born/fcs/pm/biz/service/council/CouncilSummaryChangeProcessServiceImpl.java
|
021fbc8a9a86cb439f053f4539028a0e08eca7e7
|
[] |
no_license
|
cckmit/fcs
|
https://github.com/cckmit/fcs
|
d3d577284859b517f3ecc0519b25e2a8add64ca2
|
6ea55733a4aeade931149ee02bc9d3867301d047
|
refs/heads/master
| 2022-04-28T12:09:00.393000 | 2018-02-08T03:55:32 | 2018-02-08T03:55:32 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.born.fcs.pm.biz.service.council;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallback;
import rop.thirdparty.com.google.common.collect.Lists;
import com.born.fcs.am.ws.enums.AssetStatusEnum;
import com.born.fcs.am.ws.order.pledgeasset.AssetRelationProjectBindOrder;
import com.born.fcs.am.ws.order.pledgeasset.AssetStatusOrder;
import com.born.fcs.am.ws.service.pledgeasset.PledgeAssetService;
import com.born.fcs.pm.biz.exception.ExceptionFactory;
import com.born.fcs.pm.biz.exception.FcsPmBizException;
import com.born.fcs.pm.biz.service.base.BaseAutowiredDomainService;
import com.born.fcs.pm.dal.dataobject.FCouncilSummaryProjectDO;
import com.born.fcs.pm.dal.dataobject.ProjectCreditConditionDO;
import com.born.fcs.pm.dal.dataobject.ProjectDO;
import com.born.fcs.pm.util.MoneyUtil;
import com.born.fcs.pm.util.StringUtil;
import com.born.fcs.pm.ws.enums.BooleanEnum;
import com.born.fcs.pm.ws.enums.CreditConditionTypeEnum;
import com.born.fcs.pm.ws.enums.base.FcsResultEnum;
import com.born.fcs.pm.ws.info.common.ProjectInfo;
import com.born.fcs.pm.ws.info.council.FCouncilSummaryProjectCreditConditionInfo;
import com.born.fcs.pm.ws.info.council.FCouncilSummaryProjectGuarantorInfo;
import com.born.fcs.pm.ws.info.council.FCouncilSummaryProjectPledgeAssetInfo;
import com.born.fcs.pm.ws.info.formchange.FormChangeApplyInfo;
import com.born.fcs.pm.ws.info.formchange.FormChangeRecordInfo;
import com.born.fcs.pm.ws.order.formchange.FormCheckCanChangeOrder;
import com.born.fcs.pm.ws.result.base.FcsBaseResult;
import com.born.fcs.pm.ws.service.common.ProjectService;
import com.born.fcs.pm.ws.service.contract.ProjectContractService;
import com.born.fcs.pm.ws.service.council.CouncilSummaryService;
import com.born.fcs.pm.ws.service.formchange.FormChangeProcessService;
import com.yjf.common.lang.beans.cglib.BeanCopier;
/**
* 项目批复签报后处理
*
* @author wuzj
*/
@Service("councilSummaryChangeProcessService")
public class CouncilSummaryChangeProcessServiceImpl extends BaseAutowiredDomainService implements
FormChangeProcessService {
@Autowired
CouncilSummaryService councilSummaryService;
@Autowired
ProjectService projectService;
@Autowired
ProjectContractService projectContractService;
@Autowired
PledgeAssetService pledgeAssetServiceClient;
@Override
public FcsBaseResult checkCanChange(FormCheckCanChangeOrder checkOrder) {
FcsBaseResult result = createResult();
try {
ProjectInfo project = checkOrder.getProject();
if (project == null && StringUtil.isNotEmpty(checkOrder.getProjectCode())) {
project = projectService.queryByCode(checkOrder.getProjectCode(), false);
}
if (project == null) {
throw ExceptionFactory.newFcsException(FcsResultEnum.HAVE_NOT_DATA, "项目不存在");
}
if (project.getIsApproval() != BooleanEnum.IS) {
throw ExceptionFactory.newFcsException(FcsResultEnum.DO_ACTION_STATUS_ERROR,
"项目未通过,批复不存在");
}
if (project.getIsApprovalDel() == BooleanEnum.IS) {
throw ExceptionFactory.newFcsException(FcsResultEnum.DO_ACTION_STATUS_ERROR,
"批复已作废");
}
// if (StringUtil.isNotBlank(project.getContractNo())) {
// throw ExceptionFactory.newFcsException(FcsResultEnum.DO_ACTION_STATUS_ERROR,
// "合同已签订,不能进行签报");
// }
//
result.setSuccess(true);
result.setMessage("可以签报");
} catch (FcsPmBizException be) {
result.setSuccess(false);
result.setFcsResultEnum(be.getResultCode());
result.setMessage(be.getErrorMsg());
} catch (Exception e) {
result.setSuccess(false);
result.setMessage("检查批复是否可签报出错");
logger.error("检查批复是否可签报出错:{}", e);
}
return result;
}
@Override
public FcsBaseResult processChange(final FormChangeApplyInfo applyInfo,
final FormChangeRecordInfo record) {
return transactionTemplate.execute(new TransactionCallback<FcsBaseResult>() {
@Override
public FcsBaseResult doInTransaction(TransactionStatus status) {
FcsBaseResult result = createResult();
try {
ProjectDO projectDO = projectDAO.findByProjectCode(applyInfo.getProjectCode());
FCouncilSummaryProjectDO summaryProject = FCouncilSummaryProjectDAO
.findById(projectDO.getSpId());
projectDO.setIsMaximumAmount(summaryProject.getIsMaximumAmount() == null ? BooleanEnum.NO
.code() : summaryProject.getIsMaximumAmount());
//部分信息同步到project
projectDO.setAmount(summaryProject.getAmount());
projectDO.setTimeLimit(summaryProject.getTimeLimit());
if (summaryProject.getTimeUnit() != null)
projectDO.setTimeUnit(summaryProject.getTimeUnit());
projectDAO.update(projectDO);
//XXX 同步授信条件
syncCreditCondition(summaryProject.getSpId(), projectDO);
result.setSuccess(true);
} catch (Exception e) {
logger.error("项目批复签报后处理失败");
result.setSuccess(false);
result.setMessage("项目批复签报后处理失败");
if (status != null)
status.setRollbackOnly();
}
return result;
}
});
}
/**
* 同步授信条件
* @param spId
* @param project
*/
private void syncCreditCondition(long spId, ProjectDO project) {
// XXX 写入授信前提条件
projectCreditConditionDAO.deleteByProjectCode(project.getProjectCode());
FCouncilSummaryProjectCreditConditionInfo ccInfo = councilSummaryService
.queryCreditConditionBySpId(spId, false);
//同步关联信息到资产
List<AssetStatusOrder> listOrder = Lists.newArrayList();
if (ccInfo.getPledges() != null) {
for (FCouncilSummaryProjectPledgeAssetInfo pledge : ccInfo.getPledges()) {
ProjectCreditConditionDO ccd = new ProjectCreditConditionDO();
ccd.setAssetId(pledge.getAssetsId());
ccd.setProjectCode(project.getProjectCode());
ccd.setIsConfirm(BooleanEnum.NO.code());
ccd.setItemId(pledge.getId());
ccd.setType(CreditConditionTypeEnum.PLEDGE.code());
ccd.setStatus("NOT_APPLY");
ccd.setReleaseStatus("WAITING");
StringBuffer sbf = new StringBuffer();
sbf.append("资产类型:").append(pledge.getAssetType()).append("; 权利人:")
.append(pledge.getOwnershipName()).append("; 抵押顺位:")
.append(StringUtil.equals(pledge.getSynPosition(), "FIRST") ? "第一顺位" : "第二顺位")
.append("; 是否后置抵押:")
.append(StringUtil.equals(pledge.getSynPosition(), "YES") ? "是" : "否")
.append("已抵债金额:").append(MoneyUtil.formatWithUnit(pledge.getDebtedAmount()));
ccd.setItemDesc(sbf.toString());
projectCreditConditionDAO.insert(ccd);
//构建资产项目关联的Order
AssetStatusOrder as = new AssetStatusOrder();
as.setAssetId(pledge.getAssetsId());
as.setStatus(AssetStatusEnum.QUASI_PLEDGE);
listOrder.add(as);
}
}
if (ccInfo.getMortgages() != null) {
for (FCouncilSummaryProjectPledgeAssetInfo mortgage : ccInfo.getMortgages()) {
ProjectCreditConditionDO ccd = new ProjectCreditConditionDO();
ccd.setAssetId(mortgage.getAssetsId());
ccd.setProjectCode(project.getProjectCode());
ccd.setIsConfirm(BooleanEnum.NO.code());
ccd.setItemId(mortgage.getId());
ccd.setType(CreditConditionTypeEnum.MORTGAGE.code());
ccd.setStatus("NOT_APPLY");
ccd.setReleaseStatus("WAITING");
StringBuffer sbf = new StringBuffer();
sbf.append("资产类型:")
.append(mortgage.getAssetType())
.append("; 权利人:")
.append(mortgage.getOwnershipName())
.append("; 质押顺位:")
.append(StringUtil.equals(mortgage.getSynPosition(), "FIRST") ? "第一顺位" : "第二顺位")
.append("; 是否后置抵押:")
.append(StringUtil.equals(mortgage.getSynPosition(), "YES") ? "是" : "否")
.append("已抵债金额:").append(MoneyUtil.formatWithUnit(mortgage.getDebtedAmount()));
ccd.setItemDesc(sbf.toString());
projectCreditConditionDAO.insert(ccd);
//构建资产项目关联的Order
AssetStatusOrder as = new AssetStatusOrder();
as.setAssetId(mortgage.getAssetsId());
as.setStatus(AssetStatusEnum.QUASI_MORTGAGE);
listOrder.add(as);
}
}
if (ccInfo.getGuarantors() != null) {
for (FCouncilSummaryProjectGuarantorInfo guarantor : ccInfo.getGuarantors()) {
ProjectCreditConditionDO ccd = new ProjectCreditConditionDO();
ccd.setProjectCode(project.getProjectCode());
ccd.setIsConfirm(BooleanEnum.NO.code());
ccd.setItemId(guarantor.getId());
ccd.setType(CreditConditionTypeEnum.GUARANTOR.code());
ccd.setStatus("NOT_APPLY");
ccd.setReleaseStatus("WAITING");
StringBuffer sbf = new StringBuffer();
sbf.append("保证人:")
.append(guarantor.getGuarantor())
.append(";保证类型:")
.append(
guarantor.getGuarantorType() == null ? "无" : guarantor.getGuarantorType()
.message()).append("; 保证额度:")
.append(guarantor.getGuaranteeAmount().toStandardString()).append("元")
.append("; 担保方式:").append(guarantor.getGuaranteeWay());
ccd.setItemDesc(sbf.toString());
projectCreditConditionDAO.insert(ccd);
}
}
try {
///XXX 同步资产项目关系
AssetRelationProjectBindOrder bindOrder = new AssetRelationProjectBindOrder();
BeanCopier.staticCopy(project, bindOrder);
bindOrder.setDelOld(true);
bindOrder.setAssetList(listOrder);
logger.info("同步资产项目关系 {} ", bindOrder);
pledgeAssetServiceClient.assetRelationProject(bindOrder);
} catch (Exception e) {
logger.error("同步资产项目关系出错 {} ", e);
}
}
}
|
UTF-8
|
Java
| 9,978 |
java
|
CouncilSummaryChangeProcessServiceImpl.java
|
Java
|
[
{
"context": "cglib.BeanCopier;\n\n/**\n * 项目批复签报后处理\n * \n * @author wuzj\n */\n@Service(\"councilSummaryChangeProcessService\"",
"end": 2087,
"score": 0.999563992023468,
"start": 2083,
"tag": "USERNAME",
"value": "wuzj"
}
] | null |
[] |
package com.born.fcs.pm.biz.service.council;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallback;
import rop.thirdparty.com.google.common.collect.Lists;
import com.born.fcs.am.ws.enums.AssetStatusEnum;
import com.born.fcs.am.ws.order.pledgeasset.AssetRelationProjectBindOrder;
import com.born.fcs.am.ws.order.pledgeasset.AssetStatusOrder;
import com.born.fcs.am.ws.service.pledgeasset.PledgeAssetService;
import com.born.fcs.pm.biz.exception.ExceptionFactory;
import com.born.fcs.pm.biz.exception.FcsPmBizException;
import com.born.fcs.pm.biz.service.base.BaseAutowiredDomainService;
import com.born.fcs.pm.dal.dataobject.FCouncilSummaryProjectDO;
import com.born.fcs.pm.dal.dataobject.ProjectCreditConditionDO;
import com.born.fcs.pm.dal.dataobject.ProjectDO;
import com.born.fcs.pm.util.MoneyUtil;
import com.born.fcs.pm.util.StringUtil;
import com.born.fcs.pm.ws.enums.BooleanEnum;
import com.born.fcs.pm.ws.enums.CreditConditionTypeEnum;
import com.born.fcs.pm.ws.enums.base.FcsResultEnum;
import com.born.fcs.pm.ws.info.common.ProjectInfo;
import com.born.fcs.pm.ws.info.council.FCouncilSummaryProjectCreditConditionInfo;
import com.born.fcs.pm.ws.info.council.FCouncilSummaryProjectGuarantorInfo;
import com.born.fcs.pm.ws.info.council.FCouncilSummaryProjectPledgeAssetInfo;
import com.born.fcs.pm.ws.info.formchange.FormChangeApplyInfo;
import com.born.fcs.pm.ws.info.formchange.FormChangeRecordInfo;
import com.born.fcs.pm.ws.order.formchange.FormCheckCanChangeOrder;
import com.born.fcs.pm.ws.result.base.FcsBaseResult;
import com.born.fcs.pm.ws.service.common.ProjectService;
import com.born.fcs.pm.ws.service.contract.ProjectContractService;
import com.born.fcs.pm.ws.service.council.CouncilSummaryService;
import com.born.fcs.pm.ws.service.formchange.FormChangeProcessService;
import com.yjf.common.lang.beans.cglib.BeanCopier;
/**
* 项目批复签报后处理
*
* @author wuzj
*/
@Service("councilSummaryChangeProcessService")
public class CouncilSummaryChangeProcessServiceImpl extends BaseAutowiredDomainService implements
FormChangeProcessService {
@Autowired
CouncilSummaryService councilSummaryService;
@Autowired
ProjectService projectService;
@Autowired
ProjectContractService projectContractService;
@Autowired
PledgeAssetService pledgeAssetServiceClient;
@Override
public FcsBaseResult checkCanChange(FormCheckCanChangeOrder checkOrder) {
FcsBaseResult result = createResult();
try {
ProjectInfo project = checkOrder.getProject();
if (project == null && StringUtil.isNotEmpty(checkOrder.getProjectCode())) {
project = projectService.queryByCode(checkOrder.getProjectCode(), false);
}
if (project == null) {
throw ExceptionFactory.newFcsException(FcsResultEnum.HAVE_NOT_DATA, "项目不存在");
}
if (project.getIsApproval() != BooleanEnum.IS) {
throw ExceptionFactory.newFcsException(FcsResultEnum.DO_ACTION_STATUS_ERROR,
"项目未通过,批复不存在");
}
if (project.getIsApprovalDel() == BooleanEnum.IS) {
throw ExceptionFactory.newFcsException(FcsResultEnum.DO_ACTION_STATUS_ERROR,
"批复已作废");
}
// if (StringUtil.isNotBlank(project.getContractNo())) {
// throw ExceptionFactory.newFcsException(FcsResultEnum.DO_ACTION_STATUS_ERROR,
// "合同已签订,不能进行签报");
// }
//
result.setSuccess(true);
result.setMessage("可以签报");
} catch (FcsPmBizException be) {
result.setSuccess(false);
result.setFcsResultEnum(be.getResultCode());
result.setMessage(be.getErrorMsg());
} catch (Exception e) {
result.setSuccess(false);
result.setMessage("检查批复是否可签报出错");
logger.error("检查批复是否可签报出错:{}", e);
}
return result;
}
@Override
public FcsBaseResult processChange(final FormChangeApplyInfo applyInfo,
final FormChangeRecordInfo record) {
return transactionTemplate.execute(new TransactionCallback<FcsBaseResult>() {
@Override
public FcsBaseResult doInTransaction(TransactionStatus status) {
FcsBaseResult result = createResult();
try {
ProjectDO projectDO = projectDAO.findByProjectCode(applyInfo.getProjectCode());
FCouncilSummaryProjectDO summaryProject = FCouncilSummaryProjectDAO
.findById(projectDO.getSpId());
projectDO.setIsMaximumAmount(summaryProject.getIsMaximumAmount() == null ? BooleanEnum.NO
.code() : summaryProject.getIsMaximumAmount());
//部分信息同步到project
projectDO.setAmount(summaryProject.getAmount());
projectDO.setTimeLimit(summaryProject.getTimeLimit());
if (summaryProject.getTimeUnit() != null)
projectDO.setTimeUnit(summaryProject.getTimeUnit());
projectDAO.update(projectDO);
//XXX 同步授信条件
syncCreditCondition(summaryProject.getSpId(), projectDO);
result.setSuccess(true);
} catch (Exception e) {
logger.error("项目批复签报后处理失败");
result.setSuccess(false);
result.setMessage("项目批复签报后处理失败");
if (status != null)
status.setRollbackOnly();
}
return result;
}
});
}
/**
* 同步授信条件
* @param spId
* @param project
*/
private void syncCreditCondition(long spId, ProjectDO project) {
// XXX 写入授信前提条件
projectCreditConditionDAO.deleteByProjectCode(project.getProjectCode());
FCouncilSummaryProjectCreditConditionInfo ccInfo = councilSummaryService
.queryCreditConditionBySpId(spId, false);
//同步关联信息到资产
List<AssetStatusOrder> listOrder = Lists.newArrayList();
if (ccInfo.getPledges() != null) {
for (FCouncilSummaryProjectPledgeAssetInfo pledge : ccInfo.getPledges()) {
ProjectCreditConditionDO ccd = new ProjectCreditConditionDO();
ccd.setAssetId(pledge.getAssetsId());
ccd.setProjectCode(project.getProjectCode());
ccd.setIsConfirm(BooleanEnum.NO.code());
ccd.setItemId(pledge.getId());
ccd.setType(CreditConditionTypeEnum.PLEDGE.code());
ccd.setStatus("NOT_APPLY");
ccd.setReleaseStatus("WAITING");
StringBuffer sbf = new StringBuffer();
sbf.append("资产类型:").append(pledge.getAssetType()).append("; 权利人:")
.append(pledge.getOwnershipName()).append("; 抵押顺位:")
.append(StringUtil.equals(pledge.getSynPosition(), "FIRST") ? "第一顺位" : "第二顺位")
.append("; 是否后置抵押:")
.append(StringUtil.equals(pledge.getSynPosition(), "YES") ? "是" : "否")
.append("已抵债金额:").append(MoneyUtil.formatWithUnit(pledge.getDebtedAmount()));
ccd.setItemDesc(sbf.toString());
projectCreditConditionDAO.insert(ccd);
//构建资产项目关联的Order
AssetStatusOrder as = new AssetStatusOrder();
as.setAssetId(pledge.getAssetsId());
as.setStatus(AssetStatusEnum.QUASI_PLEDGE);
listOrder.add(as);
}
}
if (ccInfo.getMortgages() != null) {
for (FCouncilSummaryProjectPledgeAssetInfo mortgage : ccInfo.getMortgages()) {
ProjectCreditConditionDO ccd = new ProjectCreditConditionDO();
ccd.setAssetId(mortgage.getAssetsId());
ccd.setProjectCode(project.getProjectCode());
ccd.setIsConfirm(BooleanEnum.NO.code());
ccd.setItemId(mortgage.getId());
ccd.setType(CreditConditionTypeEnum.MORTGAGE.code());
ccd.setStatus("NOT_APPLY");
ccd.setReleaseStatus("WAITING");
StringBuffer sbf = new StringBuffer();
sbf.append("资产类型:")
.append(mortgage.getAssetType())
.append("; 权利人:")
.append(mortgage.getOwnershipName())
.append("; 质押顺位:")
.append(StringUtil.equals(mortgage.getSynPosition(), "FIRST") ? "第一顺位" : "第二顺位")
.append("; 是否后置抵押:")
.append(StringUtil.equals(mortgage.getSynPosition(), "YES") ? "是" : "否")
.append("已抵债金额:").append(MoneyUtil.formatWithUnit(mortgage.getDebtedAmount()));
ccd.setItemDesc(sbf.toString());
projectCreditConditionDAO.insert(ccd);
//构建资产项目关联的Order
AssetStatusOrder as = new AssetStatusOrder();
as.setAssetId(mortgage.getAssetsId());
as.setStatus(AssetStatusEnum.QUASI_MORTGAGE);
listOrder.add(as);
}
}
if (ccInfo.getGuarantors() != null) {
for (FCouncilSummaryProjectGuarantorInfo guarantor : ccInfo.getGuarantors()) {
ProjectCreditConditionDO ccd = new ProjectCreditConditionDO();
ccd.setProjectCode(project.getProjectCode());
ccd.setIsConfirm(BooleanEnum.NO.code());
ccd.setItemId(guarantor.getId());
ccd.setType(CreditConditionTypeEnum.GUARANTOR.code());
ccd.setStatus("NOT_APPLY");
ccd.setReleaseStatus("WAITING");
StringBuffer sbf = new StringBuffer();
sbf.append("保证人:")
.append(guarantor.getGuarantor())
.append(";保证类型:")
.append(
guarantor.getGuarantorType() == null ? "无" : guarantor.getGuarantorType()
.message()).append("; 保证额度:")
.append(guarantor.getGuaranteeAmount().toStandardString()).append("元")
.append("; 担保方式:").append(guarantor.getGuaranteeWay());
ccd.setItemDesc(sbf.toString());
projectCreditConditionDAO.insert(ccd);
}
}
try {
///XXX 同步资产项目关系
AssetRelationProjectBindOrder bindOrder = new AssetRelationProjectBindOrder();
BeanCopier.staticCopy(project, bindOrder);
bindOrder.setDelOld(true);
bindOrder.setAssetList(listOrder);
logger.info("同步资产项目关系 {} ", bindOrder);
pledgeAssetServiceClient.assetRelationProject(bindOrder);
} catch (Exception e) {
logger.error("同步资产项目关系出错 {} ", e);
}
}
}
| 9,978 | 0.732881 | 0.732881 | 259 | 35.424709 | 25.933184 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.440155 | false | false |
12
|
92a85ce1f8a6d1e434630c4a55e84b2765a4f0c8
| 7,894,149,910,013 |
79d531960f5d2bcad1fe9362b888dc16fe3bf682
|
/java设计模式-刘伟-notes-code/src/Structral/Bridge/PNGImage.java
|
eeea055c61cc50401082690a3dafe67d64ae203e
|
[] |
no_license
|
an-anonumous/design-pattern
|
https://github.com/an-anonumous/design-pattern
|
c7571f3c88c6fa8295004455eb9d2aaf935e1684
|
081432d93f5822b8ae25fc7af455f1f74db89eb4
|
refs/heads/master
| 2021-03-17T04:35:36.097000 | 2020-03-16T14:35:16 | 2020-03-16T14:35:16 | 246,960,146 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package Structral.Bridge;
public class PNGImage extends Image {
@Override
public void parseAndShowImage() {
System.out.println("將PNG文件" + fileName + "装换为矩阵");
imageImp.dispaly(new Matrix());
}
}
|
UTF-8
|
Java
| 240 |
java
|
PNGImage.java
|
Java
|
[] | null |
[] |
package Structral.Bridge;
public class PNGImage extends Image {
@Override
public void parseAndShowImage() {
System.out.println("將PNG文件" + fileName + "装换为矩阵");
imageImp.dispaly(new Matrix());
}
}
| 240 | 0.65625 | 0.65625 | 9 | 23.888889 | 19.168518 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false |
12
|
82b18fdf29b840eaed38b42662ce008e809f47a4
| 29,180,007,825,159 |
a78fe6dc30d70bafa4d5ac0ac4d539c6bc51af8c
|
/sources/bo/app/dx.java
|
69d1ac5c978997163abba850e98a8d84aea3b176
|
[] |
no_license
|
bellmit/Medscape-decompile
|
https://github.com/bellmit/Medscape-decompile
|
d78dd1e0764274e8b73be59a668da8bcfa11ec95
|
26bbd3e603de315b31afcc64fe3f2503dc3de854
|
refs/heads/master
| 2023-03-06T04:12:59.075000 | 2021-02-15T08:46:11 | 2021-02-15T08:46:11 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package bo.app;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import com.appboy.Constants;
import com.appboy.models.AppboyGeofence;
import com.appboy.receivers.AppboyActionReceiver;
import com.appboy.support.AppboyLogger;
import com.appboy.support.StringUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.json.JSONException;
import org.json.JSONObject;
public final class dx {
private static final String a = AppboyLogger.getAppboyLogTag(dx.class);
public static PendingIntent a(Context context) {
return PendingIntent.getBroadcast(context, 0, new Intent(Constants.APPBOY_ACTION_RECEIVER_GEOFENCE_UPDATE_INTENT_ACTION).setClass(context, AppboyActionReceiver.class), 134217728);
}
public static PendingIntent b(Context context) {
return PendingIntent.getBroadcast(context, 0, new Intent(Constants.APPBOY_ACTION_RECEIVER_GEOFENCE_LOCATION_UPDATE_INTENT_ACTION).setClass(context, AppboyActionReceiver.class), 134217728);
}
public static boolean a(dq dqVar) {
if (!dqVar.a()) {
AppboyLogger.i(a, "Geofences implicitly disabled via server configuration.");
return false;
} else if (dqVar.b()) {
AppboyLogger.i(a, "Geofences enabled in server configuration.");
return true;
} else {
AppboyLogger.i(a, "Geofences explicitly disabled via server configuration.");
return false;
}
}
public static int b(dq dqVar) {
if (dqVar.e() > 0) {
return dqVar.e();
}
return 20;
}
public static List<AppboyGeofence> a(SharedPreferences sharedPreferences) {
ArrayList arrayList = new ArrayList();
Map<String, ?> all = sharedPreferences.getAll();
if (all == null || all.size() == 0) {
AppboyLogger.d(a, "Did not find stored geofences.");
return arrayList;
}
Set<String> keySet = all.keySet();
if (keySet == null || keySet.size() == 0) {
AppboyLogger.w(a, "Failed to find stored geofence keys.");
return arrayList;
}
for (String next : keySet) {
String string = sharedPreferences.getString(next, (String) null);
try {
if (StringUtils.isNullOrBlank(string)) {
String str = a;
AppboyLogger.w(str, "Received null or blank serialized geofence string for geofence id " + next + " from shared preferences. Not parsing.");
} else {
arrayList.add(new AppboyGeofence(new JSONObject(string)));
}
} catch (JSONException e) {
String str2 = a;
AppboyLogger.e(str2, "Encountered Json exception while parsing stored geofence: " + string, e);
} catch (Exception e2) {
String str3 = a;
AppboyLogger.e(str3, "Encountered unexpected exception while parsing stored geofence: " + string, e2);
}
}
return arrayList;
}
}
|
UTF-8
|
Java
| 3,196 |
java
|
dx.java
|
Java
|
[] | null |
[] |
package bo.app;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import com.appboy.Constants;
import com.appboy.models.AppboyGeofence;
import com.appboy.receivers.AppboyActionReceiver;
import com.appboy.support.AppboyLogger;
import com.appboy.support.StringUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.json.JSONException;
import org.json.JSONObject;
public final class dx {
private static final String a = AppboyLogger.getAppboyLogTag(dx.class);
public static PendingIntent a(Context context) {
return PendingIntent.getBroadcast(context, 0, new Intent(Constants.APPBOY_ACTION_RECEIVER_GEOFENCE_UPDATE_INTENT_ACTION).setClass(context, AppboyActionReceiver.class), 134217728);
}
public static PendingIntent b(Context context) {
return PendingIntent.getBroadcast(context, 0, new Intent(Constants.APPBOY_ACTION_RECEIVER_GEOFENCE_LOCATION_UPDATE_INTENT_ACTION).setClass(context, AppboyActionReceiver.class), 134217728);
}
public static boolean a(dq dqVar) {
if (!dqVar.a()) {
AppboyLogger.i(a, "Geofences implicitly disabled via server configuration.");
return false;
} else if (dqVar.b()) {
AppboyLogger.i(a, "Geofences enabled in server configuration.");
return true;
} else {
AppboyLogger.i(a, "Geofences explicitly disabled via server configuration.");
return false;
}
}
public static int b(dq dqVar) {
if (dqVar.e() > 0) {
return dqVar.e();
}
return 20;
}
public static List<AppboyGeofence> a(SharedPreferences sharedPreferences) {
ArrayList arrayList = new ArrayList();
Map<String, ?> all = sharedPreferences.getAll();
if (all == null || all.size() == 0) {
AppboyLogger.d(a, "Did not find stored geofences.");
return arrayList;
}
Set<String> keySet = all.keySet();
if (keySet == null || keySet.size() == 0) {
AppboyLogger.w(a, "Failed to find stored geofence keys.");
return arrayList;
}
for (String next : keySet) {
String string = sharedPreferences.getString(next, (String) null);
try {
if (StringUtils.isNullOrBlank(string)) {
String str = a;
AppboyLogger.w(str, "Received null or blank serialized geofence string for geofence id " + next + " from shared preferences. Not parsing.");
} else {
arrayList.add(new AppboyGeofence(new JSONObject(string)));
}
} catch (JSONException e) {
String str2 = a;
AppboyLogger.e(str2, "Encountered Json exception while parsing stored geofence: " + string, e);
} catch (Exception e2) {
String str3 = a;
AppboyLogger.e(str3, "Encountered unexpected exception while parsing stored geofence: " + string, e2);
}
}
return arrayList;
}
}
| 3,196 | 0.630476 | 0.620776 | 81 | 38.456791 | 38.039307 | 196 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.82716 | false | false |
12
|
eaf33fe8a689ced518c7445976b46d9b44fc74af
| 32,109,175,548,812 |
8aa30add7a8a4f7bbb351af11438caf93d3290ce
|
/src/lk/ijse/hibernate/bo/BOTypes.java
|
10dbda604fa9a8e0e96c42c994a9d11592bb757e
|
[] |
no_license
|
MasterBrian99/Hibernate-ThogaKade
|
https://github.com/MasterBrian99/Hibernate-ThogaKade
|
add4406617ada6450d459605ef561bab7b782478
|
ff80778eebc29f299b1c03c06b63e87b922a222e
|
refs/heads/main
| 2023-02-25T07:42:00.813000 | 2021-01-26T07:36:42 | 2021-01-26T07:36:42 | 332,026,676 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package lk.ijse.hibernate.bo;
public enum BOTypes {
CUSTOMER,ITEM,ORDER
}
|
UTF-8
|
Java
| 79 |
java
|
BOTypes.java
|
Java
|
[] | null |
[] |
package lk.ijse.hibernate.bo;
public enum BOTypes {
CUSTOMER,ITEM,ORDER
}
| 79 | 0.734177 | 0.734177 | 5 | 14.8 | 11.973304 | 29 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false |
12
|
b45fdf7fb8e7f22cf18491ef1b885ce532549e4f
| 5,540,507,859,109 |
2d5e38e0df435963479ce9c712b0928e669fb631
|
/src/com/uestc/Indoorguider/more/MoreActivity.java
|
c670a8b0fc77b4c28007333318c617c0573b4457
|
[] |
no_license
|
fwensen/IG
|
https://github.com/fwensen/IG
|
c93c60858b42c6f3bd45da83d34a719a05953938
|
afed16b7d7629b0b368ce2ac57875371329e1e16
|
refs/heads/master
| 2020-12-25T11:15:40.182000 | 2016-07-27T02:16:50 | 2016-07-27T02:16:50 | 58,381,785 | 1 | 0 | null | true | 2016-05-09T14:11:52 | 2016-05-09T14:11:52 | 2016-01-18T12:34:59 | 2016-05-09T14:07:06 | 24,304 | 0 | 0 | 0 | null | null | null |
package com.uestc.Indoorguider.more;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.uestc.Indoorguider.IndoorGuiderApplication;
import com.uestc.Indoorguider.IndoorGuiderManager;
import com.uestc.Indoorguider.R;
import com.uestc.Indoorguider.history.HistoryActivity;
import com.uestc.Indoorguider.login.LoginActivity;
import com.uestc.Indoorguider.map.MapActivity;
import com.uestc.Indoorguider.util.ClientAgent;
public class MoreActivity extends Activity implements OnClickListener{
private LinearLayout history_lay, logout_lay,help_lay = null;
private RelativeLayout layout_have_login = null;
private LinearLayout layout_no_login = null;
private ImageView image21,back_icon;
private TextView setIP;
public static String userName;
public static String userImg;
private IndoorGuiderManager IGManager;
SharedPreferences mPrefrences;
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_more);
TextView title = (TextView) findViewById(R.id.title_text);
title.setText("更多");
mPrefrences = PreferenceManager.getDefaultSharedPreferences(this);
IGManager = IndoorGuiderManager.getInstance();
layout_have_login = (RelativeLayout) findViewById(R.id.have_login_layout);
layout_no_login = (LinearLayout) findViewById(R.id.no_login_layout);
layout_no_login.setOnClickListener(this);
help_lay = (LinearLayout) findViewById(R.id.help_lay);
help_lay.setOnClickListener(this);
history_lay = (LinearLayout) findViewById(R.id.history_lay);
history_lay.setOnClickListener(this);
back_icon = (ImageView) findViewById(R.id.back_icon);
back_icon.setOnClickListener(this);
//setIP = (TextView) findViewById(R.id.setip);
//setIP.setOnClickListener(this);
//动态变化view组件
android.view.ViewGroup.LayoutParams params1 = layout_have_login.getLayoutParams();
params1.height =(int) (MapActivity.windowWidth*0.26) ;
layout_have_login.setLayoutParams(params1);
layout_have_login.setOnClickListener(this);
android.view.ViewGroup.LayoutParams params2 = layout_no_login.getLayoutParams();
params2.height =(int) (MapActivity.windowWidth*0.26) ;
layout_no_login.setLayoutParams(params2);
//用户头像
int userImgWidth = (int) (MapActivity.windowWidth*0.2);
ImageView img2 = (ImageView) findViewById(R.id.have_log_img);
ImageView img = (ImageView) findViewById(R.id.no_log_img);
img2.setLayoutParams(new RelativeLayout.LayoutParams(userImgWidth,userImgWidth));
img.setLayoutParams(new LinearLayout.LayoutParams(userImgWidth,userImgWidth));
//历史条
android.view.ViewGroup.LayoutParams params4 = history_lay.getLayoutParams();
params4.height =(int) (MapActivity.windowWidth*0.14) ;
history_lay.setLayoutParams(params4);
ImageView historyimg = (ImageView) findViewById(R.id.history_img);
android.view.ViewGroup.LayoutParams params5 = historyimg.getLayoutParams();
params5.width = params5.height =(int) (MapActivity.windowWidth*0.1) ;
historyimg.setLayoutParams(params5);
mPrefrences.registerOnSharedPreferenceChangeListener(new OnSharedPreferenceChangeListener(){
@Override
public void onSharedPreferenceChanged(
SharedPreferences sharedPreferences, String key) {
// TODO Auto-generated method stub
initLoginBar();
}
});
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent i;
//不需要登录的功能
switch(v.getId())
{
case R.id.help_lay:
i = new Intent(this, APPHelpActivity.class);
startActivity(i);
return;
case R.id.notice_lay:
return;
case R.id.no_login_layout:
i = new Intent(this, LoginActivity.class);
startActivity(i);
return;
case R.id.have_login_layout:
i = new Intent(this, MyActivity.class);
startActivity(i);
return;
case R.id.back_icon:
i = new Intent(this, MapActivity.class);
this.finish();
startActivity(i);
return;
case R.id.setip:
EditText ip = (EditText) findViewById(R.id.myip);
ClientAgent.ip = ip.getText().toString();
}
//for test**************************
if(IndoorGuiderApplication.getInstance().getAlreadyLogin())
if(mPrefrences.getBoolean("HaveLogin", false))
{
Toast.makeText(this, "请先登录!", Toast.LENGTH_SHORT).show();
//跳转到登录页面
i = new Intent(this, LoginActivity.class);
startActivity(i);
return;
}
//登录后才能使用的功能
switch(v.getId())
{
case R.id.history_lay:
i = new Intent(this, HistoryActivity.class);
//this.finish();
startActivity(i);
break;
}
}
@Override
public void onResume()
{
super.onResume();
initLoginBar();
}
private void initLoginBar()
{
if(IGManager.getAlreadyLogin())
{
layout_have_login.setVisibility(View.VISIBLE);
layout_no_login.setVisibility(View.GONE);
TextView name = (TextView) findViewById(R.id.login_username);
userName = IGManager.getUsername();
name.setText(userName);
TextView score = (TextView) findViewById(R.id.login_score);
// int s = IGManager.getScore();
// score.setText(0);
}
else
{
layout_have_login.setVisibility(View.GONE);
layout_no_login.setVisibility(View.VISIBLE);
}
}
//********************设置IP的菜单******************************
final int SETTING_IP = 0x111;
@Override
public boolean onCreateOptionsMenu(Menu menu) {
menu.add(0, SETTING_IP, 0, "设置IP");
//Toast.makeText(this, "click menu key", Toast.LENGTH_SHORT).show();
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem mi) {
//View view = LayoutInflater.from(this).inflate(R.layout.activity_my, null);
//setIP = (TextView) view.findViewById(R.id.setip);
final EditText text;
switch(mi.getItemId()) {
case SETTING_IP:
Builder dialog = new AlertDialog.Builder(MoreActivity.this);
dialog.setTitle("设置IP");
dialog.setView(
text = new EditText(this){
} );
dialog.setPositiveButton("确定", new DialogInterface.OnClickListener(){
@Override
public void onClick(DialogInterface dialog, int which) {
String IP= text.getText().toString();
if(isIP(IP)) {
ClientAgent.ip = IP;
Toast.makeText(MoreActivity.this, "手动设置IP成功", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(MoreActivity.this, "不是合法的IP", Toast.LENGTH_LONG).show();
}
}
});
dialog.setNegativeButton("取消", null);
dialog.create().show();
break;
}
return true;
}
//判断是否是一个IP
public static boolean isIP(String IP){
boolean b = false;
//IP = trimSpaces(IP);
if(IP.matches("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}")){
String s[] = IP.split("\\.");
if(Integer.parseInt(s[0])<255 && Integer.parseInt(s[1])<255 && Integer.parseInt(s[2])<255
&& Integer.parseInt(s[3])<255)
b = true;
}
return b;
}
//**************手动设置IP*************************
}
|
GB18030
|
Java
| 7,928 |
java
|
MoreActivity.java
|
Java
|
[
{
"context": "on;\n\tprivate TextView setIP;\n\tpublic static String userName;\n\tpublic static String userImg;\n\tprivate IndoorGu",
"end": 1389,
"score": 0.9329873919487,
"start": 1381,
"tag": "USERNAME",
"value": "userName"
}
] | null |
[] |
package com.uestc.Indoorguider.more;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.uestc.Indoorguider.IndoorGuiderApplication;
import com.uestc.Indoorguider.IndoorGuiderManager;
import com.uestc.Indoorguider.R;
import com.uestc.Indoorguider.history.HistoryActivity;
import com.uestc.Indoorguider.login.LoginActivity;
import com.uestc.Indoorguider.map.MapActivity;
import com.uestc.Indoorguider.util.ClientAgent;
public class MoreActivity extends Activity implements OnClickListener{
private LinearLayout history_lay, logout_lay,help_lay = null;
private RelativeLayout layout_have_login = null;
private LinearLayout layout_no_login = null;
private ImageView image21,back_icon;
private TextView setIP;
public static String userName;
public static String userImg;
private IndoorGuiderManager IGManager;
SharedPreferences mPrefrences;
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_more);
TextView title = (TextView) findViewById(R.id.title_text);
title.setText("更多");
mPrefrences = PreferenceManager.getDefaultSharedPreferences(this);
IGManager = IndoorGuiderManager.getInstance();
layout_have_login = (RelativeLayout) findViewById(R.id.have_login_layout);
layout_no_login = (LinearLayout) findViewById(R.id.no_login_layout);
layout_no_login.setOnClickListener(this);
help_lay = (LinearLayout) findViewById(R.id.help_lay);
help_lay.setOnClickListener(this);
history_lay = (LinearLayout) findViewById(R.id.history_lay);
history_lay.setOnClickListener(this);
back_icon = (ImageView) findViewById(R.id.back_icon);
back_icon.setOnClickListener(this);
//setIP = (TextView) findViewById(R.id.setip);
//setIP.setOnClickListener(this);
//动态变化view组件
android.view.ViewGroup.LayoutParams params1 = layout_have_login.getLayoutParams();
params1.height =(int) (MapActivity.windowWidth*0.26) ;
layout_have_login.setLayoutParams(params1);
layout_have_login.setOnClickListener(this);
android.view.ViewGroup.LayoutParams params2 = layout_no_login.getLayoutParams();
params2.height =(int) (MapActivity.windowWidth*0.26) ;
layout_no_login.setLayoutParams(params2);
//用户头像
int userImgWidth = (int) (MapActivity.windowWidth*0.2);
ImageView img2 = (ImageView) findViewById(R.id.have_log_img);
ImageView img = (ImageView) findViewById(R.id.no_log_img);
img2.setLayoutParams(new RelativeLayout.LayoutParams(userImgWidth,userImgWidth));
img.setLayoutParams(new LinearLayout.LayoutParams(userImgWidth,userImgWidth));
//历史条
android.view.ViewGroup.LayoutParams params4 = history_lay.getLayoutParams();
params4.height =(int) (MapActivity.windowWidth*0.14) ;
history_lay.setLayoutParams(params4);
ImageView historyimg = (ImageView) findViewById(R.id.history_img);
android.view.ViewGroup.LayoutParams params5 = historyimg.getLayoutParams();
params5.width = params5.height =(int) (MapActivity.windowWidth*0.1) ;
historyimg.setLayoutParams(params5);
mPrefrences.registerOnSharedPreferenceChangeListener(new OnSharedPreferenceChangeListener(){
@Override
public void onSharedPreferenceChanged(
SharedPreferences sharedPreferences, String key) {
// TODO Auto-generated method stub
initLoginBar();
}
});
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent i;
//不需要登录的功能
switch(v.getId())
{
case R.id.help_lay:
i = new Intent(this, APPHelpActivity.class);
startActivity(i);
return;
case R.id.notice_lay:
return;
case R.id.no_login_layout:
i = new Intent(this, LoginActivity.class);
startActivity(i);
return;
case R.id.have_login_layout:
i = new Intent(this, MyActivity.class);
startActivity(i);
return;
case R.id.back_icon:
i = new Intent(this, MapActivity.class);
this.finish();
startActivity(i);
return;
case R.id.setip:
EditText ip = (EditText) findViewById(R.id.myip);
ClientAgent.ip = ip.getText().toString();
}
//for test**************************
if(IndoorGuiderApplication.getInstance().getAlreadyLogin())
if(mPrefrences.getBoolean("HaveLogin", false))
{
Toast.makeText(this, "请先登录!", Toast.LENGTH_SHORT).show();
//跳转到登录页面
i = new Intent(this, LoginActivity.class);
startActivity(i);
return;
}
//登录后才能使用的功能
switch(v.getId())
{
case R.id.history_lay:
i = new Intent(this, HistoryActivity.class);
//this.finish();
startActivity(i);
break;
}
}
@Override
public void onResume()
{
super.onResume();
initLoginBar();
}
private void initLoginBar()
{
if(IGManager.getAlreadyLogin())
{
layout_have_login.setVisibility(View.VISIBLE);
layout_no_login.setVisibility(View.GONE);
TextView name = (TextView) findViewById(R.id.login_username);
userName = IGManager.getUsername();
name.setText(userName);
TextView score = (TextView) findViewById(R.id.login_score);
// int s = IGManager.getScore();
// score.setText(0);
}
else
{
layout_have_login.setVisibility(View.GONE);
layout_no_login.setVisibility(View.VISIBLE);
}
}
//********************设置IP的菜单******************************
final int SETTING_IP = 0x111;
@Override
public boolean onCreateOptionsMenu(Menu menu) {
menu.add(0, SETTING_IP, 0, "设置IP");
//Toast.makeText(this, "click menu key", Toast.LENGTH_SHORT).show();
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem mi) {
//View view = LayoutInflater.from(this).inflate(R.layout.activity_my, null);
//setIP = (TextView) view.findViewById(R.id.setip);
final EditText text;
switch(mi.getItemId()) {
case SETTING_IP:
Builder dialog = new AlertDialog.Builder(MoreActivity.this);
dialog.setTitle("设置IP");
dialog.setView(
text = new EditText(this){
} );
dialog.setPositiveButton("确定", new DialogInterface.OnClickListener(){
@Override
public void onClick(DialogInterface dialog, int which) {
String IP= text.getText().toString();
if(isIP(IP)) {
ClientAgent.ip = IP;
Toast.makeText(MoreActivity.this, "手动设置IP成功", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(MoreActivity.this, "不是合法的IP", Toast.LENGTH_LONG).show();
}
}
});
dialog.setNegativeButton("取消", null);
dialog.create().show();
break;
}
return true;
}
//判断是否是一个IP
public static boolean isIP(String IP){
boolean b = false;
//IP = trimSpaces(IP);
if(IP.matches("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}")){
String s[] = IP.split("\\.");
if(Integer.parseInt(s[0])<255 && Integer.parseInt(s[1])<255 && Integer.parseInt(s[2])<255
&& Integer.parseInt(s[3])<255)
b = true;
}
return b;
}
//**************手动设置IP*************************
}
| 7,928 | 0.686148 | 0.678296 | 235 | 32.042553 | 23.774971 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.651064 | false | false |
12
|
bb8b66d74357b70055889d142a31dca47bf67fc9
| 6,725,918,819,445 |
0ed74bfe48552bdbd7448a1952918cb5c1abd1d4
|
/java8/src/main/java/com/net/mytimer/TimeScheduler.java
|
d354bee34a516e02a91def0ee7981d5dfe2f7478
|
[] |
no_license
|
GreedyPirate/Spring-Cloud-Stack
|
https://github.com/GreedyPirate/Spring-Cloud-Stack
|
d9bbdec636778feac2b4595f5fa9d3e80cfa43c6
|
eb435185908dbd22dff77615078f7216b015ac32
|
refs/heads/master
| 2022-09-17T21:24:36.882000 | 2020-08-18T06:41:52 | 2020-08-18T06:41:52 | 127,503,850 | 1 | 0 | null | false | 2022-09-01T23:10:39 | 2018-03-31T06:00:39 | 2020-08-18T06:42:04 | 2022-09-01T23:10:37 | 15,549 | 1 | 0 | 9 |
Java
| false | false |
package com.net.mytimer;
import java.util.concurrent.DelayQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class TimeScheduler {
private TimeWheel timeWheel;
private DelayQueue<TaskList> queue = new DelayQueue<>();
private ExecutorService workPool = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2);
private static final int DEFAULT_WHEEL_SIZE = 60;
public TimeScheduler() {
timeWheel = new TimeWheel();
}
}
|
UTF-8
|
Java
| 525 |
java
|
TimeScheduler.java
|
Java
|
[] | null |
[] |
package com.net.mytimer;
import java.util.concurrent.DelayQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class TimeScheduler {
private TimeWheel timeWheel;
private DelayQueue<TaskList> queue = new DelayQueue<>();
private ExecutorService workPool = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2);
private static final int DEFAULT_WHEEL_SIZE = 60;
public TimeScheduler() {
timeWheel = new TimeWheel();
}
}
| 525 | 0.744762 | 0.739048 | 21 | 24 | 28.585711 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false |
12
|
aa85a74a0eccdedc91cecbc3b425aa955c4ba947
| 25,744,034,014,360 |
a6a2a9875a9a6dec852b78a5bb3164ed87653389
|
/src/test/java/com/jarvis/_8/SolutionTest.java
|
daae867d6d6670f77a2ce4e366cfdeb8bfb34647
|
[] |
no_license
|
smarticeberg/leetcode
|
https://github.com/smarticeberg/leetcode
|
de3ca1e9b51df22caa47a369392ae24329b1aff6
|
941fdadd261c17ecefcfd91b0438e6f27aba44ad
|
refs/heads/master
| 2021-07-08T03:26:27.592000 | 2019-09-24T09:09:52 | 2019-09-24T09:09:52 | 199,420,348 | 0 | 0 | null | false | 2020-10-13T14:57:03 | 2019-07-29T09:20:02 | 2019-09-24T09:10:01 | 2020-10-13T14:57:02 | 202 | 0 | 0 | 1 |
Java
| false | false |
package com.jarvis._8;
import org.junit.Test;
import com.jarvis._8.Solution;
public class SolutionTest {
@Test
public void testSolution1() {
System.out.println(new Solution().myAtoi("-00123a66"));
}
}
|
UTF-8
|
Java
| 210 |
java
|
SolutionTest.java
|
Java
|
[] | null |
[] |
package com.jarvis._8;
import org.junit.Test;
import com.jarvis._8.Solution;
public class SolutionTest {
@Test
public void testSolution1() {
System.out.println(new Solution().myAtoi("-00123a66"));
}
}
| 210 | 0.714286 | 0.666667 | 13 | 15.153846 | 17.100815 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.692308 | false | false |
12
|
3ccff773f50e8d1d28c5f0c3acb1fc619910f629
| 6,519,760,419,008 |
3f33f457136e6b6f8942ac1c8bcdf7448c4b640f
|
/Core/src/main/java/core/model/base/humanity/IGenericPerson.java
|
76ac82eb918502b1d5d85353fdadce2dcee6321d
|
[] |
no_license
|
Vallendir/StudentTool
|
https://github.com/Vallendir/StudentTool
|
f14afa2b843216dae207e3ed80bea29790b89b41
|
aaf8e412bba9af17fbecf29b0e53557e39c23e57
|
refs/heads/master
| 2021-01-19T10:20:57.284000 | 2018-08-27T00:03:23 | 2018-08-27T00:03:23 | 76,605,545 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package core.model.base.humanity;
import core.humanity.details.PersonalDetails;
import core.model.base.IGenericModel;
/***
* Basic interface for all human types.
*
* @author Mateusz Mucha
*
* @param <BaseModel>
* - this is a basic model type represent some human
* @param <ModelDetails>
* - this is a specific details object type
*/
public interface IGenericPerson<BaseModel extends Person, ModelDetails extends PersonalDetails>
extends IGenericModel<ModelDetails> {
/***
* Method to gets human type.
*
* @return base model type
*/
BaseModel getModel();
/***
* Method to sets basic model type of human type.
*
* @param model
* - specific human type
*/
void setModel(BaseModel model);
}
|
UTF-8
|
Java
| 757 |
java
|
IGenericPerson.java
|
Java
|
[
{
"context": "asic interface for all human types.\n * \n * @author Mateusz Mucha\n *\n * @param <BaseModel>\n * - this is ",
"end": 193,
"score": 0.9998682141304016,
"start": 180,
"tag": "NAME",
"value": "Mateusz Mucha"
}
] | null |
[] |
package core.model.base.humanity;
import core.humanity.details.PersonalDetails;
import core.model.base.IGenericModel;
/***
* Basic interface for all human types.
*
* @author <NAME>
*
* @param <BaseModel>
* - this is a basic model type represent some human
* @param <ModelDetails>
* - this is a specific details object type
*/
public interface IGenericPerson<BaseModel extends Person, ModelDetails extends PersonalDetails>
extends IGenericModel<ModelDetails> {
/***
* Method to gets human type.
*
* @return base model type
*/
BaseModel getModel();
/***
* Method to sets basic model type of human type.
*
* @param model
* - specific human type
*/
void setModel(BaseModel model);
}
| 750 | 0.678996 | 0.678996 | 32 | 22.6875 | 22.289904 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.65625 | false | false |
12
|
77ee86e91e94ca6a15bd073df1c21050c0abb3b6
| 20,298,015,499,401 |
488e05604d1a0afaf0430d65844359a0bffc83a6
|
/12/AsciiFigureInstanceofTester.java
|
278780640947d11451e55a2d5a3d0fe28c6776e7
|
[] |
no_license
|
Tattsum/java
|
https://github.com/Tattsum/java
|
eaedd835e3ac3519d32a4fa47ff5770e106c0169
|
b877bd159be23559eed452a43a47687ad7927668
|
refs/heads/master
| 2020-06-18T09:13:42.008000 | 2017-08-03T14:04:58 | 2017-08-03T14:04:58 | 94,164,679 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
class AsciiFigureInstanceofTester {
public static void main(String args[]) {
AsciiFigure tri = new AsciiTriangle(5);
AsciiFigure rect = new AsciiRectangle(10, 5);
AsciiFigure sq = new AsciiSquare(3);
if (tri instanceof AsciiFigure) {
System.out.println("tri instanceof AsciiFigure は true");
} else {
System.out.println("tri instanceof AsciiFigure は false");
}
if (tri instanceof AsciiTriangle) {
System.out.println("tri instanceof AsciiTriangle は true");
} else {
System.out.println("tri instanceof AsciiTriangle は false");
}
if (tri instanceof AsciiRectangle) {
System.out.println("tri instanceof AsciiRectangle は true");
} else {
System.out.println("tri instanceof AsciiRectangle は false");
}
if (tri instanceof AsciiSquare) {
System.out.println("tri instanceof AsciiSquare は true");
} else {
System.out.println("tri instanceof AsciiSquare は false");
}
if (rect instanceof AsciiFigure) {
System.out.println("rect instanceof AsciiFigure は true");
} else {
System.out.println("rect instanceof AsciiFigure は false");
}
if (rect instanceof AsciiTriangle) {
System.out.println("rect instanceof AsciiTriangle は true");
} else {
System.out.println("rect instanceof AsciiTriangle は false");
}
if (rect instanceof AsciiRectangle) {
System.out.println("rect instanceof AsciiRectangle は true");
} else {
System.out.println("rect instanceof AsciiRectangle は false");
}
if (rect instanceof AsciiSquare) {
System.out.println("rect instanceof AsciiSquare は true");
} else {
System.out.println("rect instanceof AsciiSquare は false");
}
if (sq instanceof AsciiFigure) {
System.out.println("sq instanceof AsciiFigure は true");
} else {
System.out.println("sq instanceof AsciiFigure は false");
}
if (sq instanceof AsciiTriangle) {
System.out.println("sq instanceof AsciiTriangle は true");
} else {
System.out.println("sq instanceof AsciiTriangle は false");
}
if (sq instanceof AsciiRectangle) {
System.out.println("sq instanceof AsciiRectangle は true");
} else {
System.out.println("sq instanceof AsciiRectangle は false");
}
if (sq instanceof AsciiSquare) {
System.out.println("sq instanceof AsciiSquare は true");
} else {
System.out.println("sq instanceof AsciiSquare は false");
}
}
}
|
UTF-8
|
Java
| 2,402 |
java
|
AsciiFigureInstanceofTester.java
|
Java
|
[] | null |
[] |
class AsciiFigureInstanceofTester {
public static void main(String args[]) {
AsciiFigure tri = new AsciiTriangle(5);
AsciiFigure rect = new AsciiRectangle(10, 5);
AsciiFigure sq = new AsciiSquare(3);
if (tri instanceof AsciiFigure) {
System.out.println("tri instanceof AsciiFigure は true");
} else {
System.out.println("tri instanceof AsciiFigure は false");
}
if (tri instanceof AsciiTriangle) {
System.out.println("tri instanceof AsciiTriangle は true");
} else {
System.out.println("tri instanceof AsciiTriangle は false");
}
if (tri instanceof AsciiRectangle) {
System.out.println("tri instanceof AsciiRectangle は true");
} else {
System.out.println("tri instanceof AsciiRectangle は false");
}
if (tri instanceof AsciiSquare) {
System.out.println("tri instanceof AsciiSquare は true");
} else {
System.out.println("tri instanceof AsciiSquare は false");
}
if (rect instanceof AsciiFigure) {
System.out.println("rect instanceof AsciiFigure は true");
} else {
System.out.println("rect instanceof AsciiFigure は false");
}
if (rect instanceof AsciiTriangle) {
System.out.println("rect instanceof AsciiTriangle は true");
} else {
System.out.println("rect instanceof AsciiTriangle は false");
}
if (rect instanceof AsciiRectangle) {
System.out.println("rect instanceof AsciiRectangle は true");
} else {
System.out.println("rect instanceof AsciiRectangle は false");
}
if (rect instanceof AsciiSquare) {
System.out.println("rect instanceof AsciiSquare は true");
} else {
System.out.println("rect instanceof AsciiSquare は false");
}
if (sq instanceof AsciiFigure) {
System.out.println("sq instanceof AsciiFigure は true");
} else {
System.out.println("sq instanceof AsciiFigure は false");
}
if (sq instanceof AsciiTriangle) {
System.out.println("sq instanceof AsciiTriangle は true");
} else {
System.out.println("sq instanceof AsciiTriangle は false");
}
if (sq instanceof AsciiRectangle) {
System.out.println("sq instanceof AsciiRectangle は true");
} else {
System.out.println("sq instanceof AsciiRectangle は false");
}
if (sq instanceof AsciiSquare) {
System.out.println("sq instanceof AsciiSquare は true");
} else {
System.out.println("sq instanceof AsciiSquare は false");
}
}
}
| 2,402 | 0.702209 | 0.700085 | 81 | 28.012346 | 26.113472 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.123457 | false | false |
12
|
534a0129ec5db06099a1fdaa8338355a290f2c27
| 29,892,972,414,448 |
a9d4faebdbf53f8b2ef742a41cef6bc6b026c0a0
|
/src/main/java/com/kreckin/herobrine/actions/CreateRingOfTorches.java
|
065cc8653166ead5654ddb2cf84adeec49d99ff4
|
[
"CC0-1.0"
] |
permissive
|
whatskreckin/Herobrine
|
https://github.com/whatskreckin/Herobrine
|
7e91b8bd8e68e8476333d285fd8e950295856a04
|
b567fa311cc4e0470832b8efb221df0acb61a573
|
refs/heads/master
| 2015-08-05T08:38:22.852000 | 2013-09-24T13:43:03 | 2013-09-24T13:43:03 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.kreckin.herobrine.actions;
import com.kreckin.herobrine.api.Action;
import com.kreckin.herobrine.api.Structure;
import org.bukkit.entity.Player;
public class CreateRingOfTorches extends Action {
public CreateRingOfTorches() {
super(true);
}
@Override
public String callAction(Player player, Object[] metadata) {
if (!Structure.loadStructure("/com/kreckin/herobrine/structures/RingOfTorches.yml").createStructure(player.getLocation())) {
return "Failed, could not find a proper location!";
}
return ("Location: " + player.getLocation().getBlockX() + ", " + player.getLocation().getBlockY() + ", " + player.getLocation().getBlockZ());
}
}
|
UTF-8
|
Java
| 721 |
java
|
CreateRingOfTorches.java
|
Java
|
[] | null |
[] |
package com.kreckin.herobrine.actions;
import com.kreckin.herobrine.api.Action;
import com.kreckin.herobrine.api.Structure;
import org.bukkit.entity.Player;
public class CreateRingOfTorches extends Action {
public CreateRingOfTorches() {
super(true);
}
@Override
public String callAction(Player player, Object[] metadata) {
if (!Structure.loadStructure("/com/kreckin/herobrine/structures/RingOfTorches.yml").createStructure(player.getLocation())) {
return "Failed, could not find a proper location!";
}
return ("Location: " + player.getLocation().getBlockX() + ", " + player.getLocation().getBlockY() + ", " + player.getLocation().getBlockZ());
}
}
| 721 | 0.687933 | 0.687933 | 20 | 35.049999 | 40.811119 | 149 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.55 | false | false |
12
|
d414c72baf21cab493e4c02c1a158c88f303bd24
| 15,908,558,907,261 |
5728f50a394b62394587b0b255a57dcf4d13d20d
|
/src/java/org/jsimpledb/cli/cmd/LoadCommand.java
|
3f259cdf74a8f8e3e510c0c9f75c251a7ec448e2
|
[
"Apache-2.0"
] |
permissive
|
mayoricodevault/jsimpledb
|
https://github.com/mayoricodevault/jsimpledb
|
3d905744c7a5e55c1fe530dd6d91c99c4c730f1e
|
9ee8301a6cda92a2d85ec1b0d94cfde6a78e5e38
|
refs/heads/master
| 2021-06-13T06:30:51.209000 | 2015-05-08T15:56:55 | 2015-05-08T15:56:55 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* Copyright (C) 2014 Archie L. Cobbs. All rights reserved.
*
* $Id$
*/
package org.jsimpledb.cli.cmd;
import com.google.common.collect.Lists;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Map;
import java.util.regex.Matcher;
import org.jsimpledb.cli.CliSession;
import org.jsimpledb.parse.ParseContext;
import org.jsimpledb.parse.ParseException;
import org.jsimpledb.parse.ParseSession;
import org.jsimpledb.parse.Parser;
import org.jsimpledb.parse.util.ParseCastFunction;
import org.jsimpledb.parse.util.StripPrefixFunction;
import org.jsimpledb.util.XMLObjectSerializer;
import jline.console.completer.FileNameCompleter;
@Command
public class LoadCommand extends AbstractCommand {
public LoadCommand() {
super("load file.xml:file");
}
@Override
public String getHelpSummary() {
return "Imports objects from an XML file created previously via `save'";
}
@Override
protected Parser<?> getParser(String typeName) {
return "file".equals(typeName) ? new FileParser() : super.getParser(typeName);
}
@Override
public CliSession.Action getAction(CliSession session, ParseContext ctx, boolean complete, Map<String, Object> params) {
final File file = (File)params.get("file.xml");
// Return import action
return new CliSession.Action() {
@Override
public void run(CliSession session) throws Exception {
final BufferedInputStream input = new BufferedInputStream(new FileInputStream(file));
final int count;
try {
count = new XMLObjectSerializer(session.getTransaction()).read(input);
} finally {
try {
input.close();
} catch (IOException e) {
// ignore
}
}
session.getWriter().println("Read " + count + " objects from `" + file + "'");
}
};
}
// FileParser
private class FileParser implements Parser<File> {
@Override
public File parse(ParseSession session, ParseContext ctx, boolean complete) {
// Get filename
final Matcher matcher = ctx.tryPattern("[^\\s;]*");
if (matcher == null)
throw new ParseException(ctx);
final String path = matcher.group();
// Check file
final File file = new File(path);
if (!file.exists() || file.isDirectory() || !file.canRead()) {
final ArrayList<CharSequence> list = new ArrayList<>();
final int index = new FileNameCompleter().complete(path, path.length(), list);
throw new ParseException(ctx, "can't read file `" + file + "'").addCompletions(
Lists.transform(Lists.transform(list, new ParseCastFunction<String>(String.class)),
new StripPrefixFunction(path.substring(index))));
}
// Done
return file;
}
}
}
|
UTF-8
|
Java
| 3,190 |
java
|
LoadCommand.java
|
Java
|
[
{
"context": "\n/*\n * Copyright (C) 2014 Archie L. Cobbs. All rights reserved.\n *\n * $Id$\n */\n\npackage org",
"end": 41,
"score": 0.9998578429222107,
"start": 26,
"tag": "NAME",
"value": "Archie L. Cobbs"
}
] | null |
[] |
/*
* Copyright (C) 2014 <NAME>. All rights reserved.
*
* $Id$
*/
package org.jsimpledb.cli.cmd;
import com.google.common.collect.Lists;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Map;
import java.util.regex.Matcher;
import org.jsimpledb.cli.CliSession;
import org.jsimpledb.parse.ParseContext;
import org.jsimpledb.parse.ParseException;
import org.jsimpledb.parse.ParseSession;
import org.jsimpledb.parse.Parser;
import org.jsimpledb.parse.util.ParseCastFunction;
import org.jsimpledb.parse.util.StripPrefixFunction;
import org.jsimpledb.util.XMLObjectSerializer;
import jline.console.completer.FileNameCompleter;
@Command
public class LoadCommand extends AbstractCommand {
public LoadCommand() {
super("load file.xml:file");
}
@Override
public String getHelpSummary() {
return "Imports objects from an XML file created previously via `save'";
}
@Override
protected Parser<?> getParser(String typeName) {
return "file".equals(typeName) ? new FileParser() : super.getParser(typeName);
}
@Override
public CliSession.Action getAction(CliSession session, ParseContext ctx, boolean complete, Map<String, Object> params) {
final File file = (File)params.get("file.xml");
// Return import action
return new CliSession.Action() {
@Override
public void run(CliSession session) throws Exception {
final BufferedInputStream input = new BufferedInputStream(new FileInputStream(file));
final int count;
try {
count = new XMLObjectSerializer(session.getTransaction()).read(input);
} finally {
try {
input.close();
} catch (IOException e) {
// ignore
}
}
session.getWriter().println("Read " + count + " objects from `" + file + "'");
}
};
}
// FileParser
private class FileParser implements Parser<File> {
@Override
public File parse(ParseSession session, ParseContext ctx, boolean complete) {
// Get filename
final Matcher matcher = ctx.tryPattern("[^\\s;]*");
if (matcher == null)
throw new ParseException(ctx);
final String path = matcher.group();
// Check file
final File file = new File(path);
if (!file.exists() || file.isDirectory() || !file.canRead()) {
final ArrayList<CharSequence> list = new ArrayList<>();
final int index = new FileNameCompleter().complete(path, path.length(), list);
throw new ParseException(ctx, "can't read file `" + file + "'").addCompletions(
Lists.transform(Lists.transform(list, new ParseCastFunction<String>(String.class)),
new StripPrefixFunction(path.substring(index))));
}
// Done
return file;
}
}
}
| 3,181 | 0.610345 | 0.609091 | 98 | 31.530613 | 29.150631 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.530612 | false | false |
12
|
f127e3b1c0172140045441e90a370889b62cc2ad
| 28,467,043,278,292 |
fa1cc97fbe0d95efd79f2d1408c801a7d94b1a40
|
/Endeca/Assembler/src/Java/atg/projects/store/assembler/cartridge/CrossCartridgeItemsLookup.java
|
4d42224e38579c019e1e0bf4fdb10d42648726b0
|
[] |
no_license
|
mskuratov/atg
|
https://github.com/mskuratov/atg
|
faf94b9cc5c975677039f27ce793be944e8f9f88
|
5d1a55f21676fa90632304a52df0e85cf697a5e3
|
refs/heads/master
| 2021-01-10T19:26:02.790000 | 2014-02-28T17:15:18 | 2014-02-28T17:15:18 | 17,215,799 | 3 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*<ORACLECOPYRIGHT>
* Copyright (C) 1994-2013 Oracle and/or its affiliates. All rights reserved.
* Oracle and Java are registered trademarks of Oracle and/or its affiliates.
* Other names may be trademarks of their respective owners.
* UNIX is a registered trademark of The Open Group.
*
* This software and related documentation are provided under a license agreement
* containing restrictions on use and disclosure and are protected by intellectual property laws.
* Except as expressly permitted in your license agreement or allowed by law, you may not use, copy,
* reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish,
* or display any part, in any form, or by any means. Reverse engineering, disassembly,
* or decompilation of this software, unless required by law for interoperability, is prohibited.
*
* The information contained herein is subject to change without notice and is not warranted to be error-free.
* If you find any errors, please report them to us in writing.
*
* U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data delivered to U.S.
* Government customers are "commercial computer software" or "commercial technical data" pursuant to the applicable
* Federal Acquisition Regulation and agency-specific supplemental regulations.
* As such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and
* license terms set forth in the applicable Government contract, and, to the extent applicable by the terms of the
* Government contract, the additional rights set forth in FAR 52.227-19, Commercial Computer Software License
* (December 2007). Oracle America, Inc., 500 Oracle Parkway, Redwood City, CA 94065.
*
* This software or hardware is developed for general use in a variety of information management applications.
* It is not developed or intended for use in any inherently dangerous applications, including applications that
* may create a risk of personal injury. If you use this software or hardware in dangerous applications,
* then you shall be responsible to take all appropriate fail-safe, backup, redundancy,
* and other measures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any
* damages caused by use of this software or hardware in dangerous applications.
*
* This software or hardware and documentation may provide access to or information on content,
* products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and
* expressly disclaim all warranties of any kind with respect to third-party content, products, and services.
* Oracle Corporation and its affiliates will not be responsible for any loss, costs,
* or damages incurred due to your access to or use of third-party content, products, or services.
</ORACLECOPYRIGHT>*/
package atg.projects.store.assembler.cartridge;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import atg.core.util.StringUtils;
import atg.repository.RepositoryItem;
import com.endeca.infront.assembler.ContentItem;
import com.endeca.infront.cartridge.model.Record;
/**
* <p>
* This is the subclass of <code>ContentItemTreeIterator</code> that iterates through the content item tree looking
* for the items displayed in different kind of cartridges. The main purpose of this class is to put
* all displayed items into one bucket so that other component can check it to avoid duplicates in the cartridges.
* </p>
* <p>
* The class looks for displayed items only in the cartridges with types configured in the
* <code>typeToPropertyNameMap</code>. The <code>typeToPropertyNameMap</code> contains mapping between cartridge
* type and property name where the displayed items are stored. Items are expected to be RepositoryItems or
* Endeca Record objects. If detected items are RepositoryItems the repository ID is stored into the storage.
* If items are Endeca Records, then the ID of item is retrieved from the property configured in the
* <code>itemIdKey</code> property.
* </p>
* <p>
* The <code>ContentItemTreeIterator</code> also performs caching of content items with IDs configured in the
* <code>contentItemsToCache</code> list. The cached content items can be used in cases where displayed items are
* not part of content item but retrieved in the renderer code.
* </p>
*
* @author Natallia Paulouskaya
* @version $Id: //hosting-blueprint/B2CBlueprint/version/10.2/Endeca/Assembler/src/atg/projects/store/assembler/cartridge/CrossCartridgeItemsLookup.java#3 $$Change: 788278 $
* @updated $DateTime: 2013/02/05 00:41:33 $$Author: jsiddaga $
*/
public class CrossCartridgeItemsLookup extends ContentItemTreeIterator {
//-------------------------------------------
/** Class version string. */
protected static final String CLASS_VERSION =
"$Id: //hosting-blueprint/B2CBlueprint/version/10.2/Endeca/Assembler/src/atg/projects/store/assembler/cartridge/CrossCartridgeItemsLookup.java#3 $$Change: 788278 $";
//----------------------------------------------------------------------------
// PROPERTIES
//----------------------------------------------------------------------------
//-----------------------------------------------------
// property: displayedItems
//-----------------------------------------------------
List<String> mDisplayedItems = new ArrayList<String>();
/**
* @return The list of displayed items.
*/
public List<String> getDisplayedItems() {
return mDisplayedItems;
}
/**
* @param pDisplayedItems - The list of displayed items to set.
*/
public void setDisplayedItems(List<String> pDisplayedItems) {
mDisplayedItems = pDisplayedItems;
}
//-----------------------------------------------
// property: typeToPropertyNameMap
//-----------------------------------------------
Map<String,String> mTypeToPropertyNameMap = null;
/**
* @return the mapping between cartridge types and property names where the items we are looking for stored.
*/
public Map<String, String> getTypeToPropertyNameMap() {
return mTypeToPropertyNameMap;
}
/**
* @param pTypeToPropertyNameMap - The mapping between cartridge types and property names where the items we
* are looking for stored.
*/
public void setTypeToPropertyNameMap(Map<String, String> pTypeToPropertyNameMap) {
mTypeToPropertyNameMap = pTypeToPropertyNameMap;
}
//---------------------------------------
// property: contentItemsToCache
//---------------------------------------
List<String> mContentItemsToCache = null;
/**
* @return the array of content item types which should be cached during content item tree iteration.
*/
public List<String> getContentItemsToCache() {
return mContentItemsToCache;
}
/**
* @param pContentItemsToCache - The array of content item types which should be cached during content
* item tree iteration.
*/
public void setContentItemsToCache(List<String> pContentItemsToCache) {
mContentItemsToCache = pContentItemsToCache;
}
//------------------------------------------------
// property: contentItemsCache
//------------------------------------------------
Map<String,List<ContentItem>> mContentItemsCache = new HashMap<String, List<ContentItem>>();
/**
* @return the mapping between cartridge types and list of content items assembled for this request.
*/
public Map<String,List<ContentItem>> getContentItemsCache() {
return mContentItemsCache;
}
/**
* @param pContentItemsCache - The mapping between cartridge types and list of content items
* assembled for this request.
*/
public void setContentItemsCache( Map<String,List<ContentItem>> pContentItemsCache) {
mContentItemsCache = pContentItemsCache;
}
//-----------------------
// property: itemIdKey
//-----------------------
String mItemIdKey = null;
/**
* @return the content item key where the item's ID stored.
*/
public String getItemIdKey() {
return mItemIdKey;
}
/**
* @param pItemIdKey - The content item key where the item's ID stored.
*/
public void setItemIdKey(String pItemIdKey) {
mItemIdKey = pItemIdKey;
}
//----------------------------------------------------------------------------
// METHODS
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
/**
* <p>
* The implementation of content item process method. This method checks
* whether the passed in content item has one of the types configured in
* <code>typeToPropertyNameMap</code> and if so, retrieves items from the
* property mapped to the corresponding cartridge type.
* </p>
* <p>
* Item IDs are stored in the <code>displayedItems</code> list. If the retrieved
* items are RepositoryItems, the ID is taken from the repositoryId property. In
* the case when the retrieved items are Endeca records, the IDs are taken from
* the property configured in the <code>itemIdKey</code>.
* </p>
*
* @param pContentItem The configuration item.
*/
@Override
public void process(ContentItem pContentItem) {
// The type of current content item.
String type = pContentItem.getType();
// Check whether we need to cache this content item.
if (getContentItemsToCache() != null && getContentItemsToCache().contains(type)) {
// Cache content item.
List<ContentItem> contentItemList = getContentItemsCache().get(type);
if (contentItemList == null){
contentItemList = new ArrayList<ContentItem>();
getContentItemsCache().put(type, contentItemList);
}
contentItemList.add(pContentItem);
}
// Check whether the content item is of configured type. If not just skip processing.
if (getTypeToPropertyNameMap() != null && getTypeToPropertyNameMap().containsKey(type)){
// The content item type is in the configure typeToPropertyNameMap mapping.
// Retrieve items displayed by the cartridge from the configured property.
String propertyName = getTypeToPropertyNameMap().get(type);
if (!StringUtils.isEmpty(propertyName)) {
Object items = pContentItem.get(propertyName);
if (items != null) {
if (items instanceof String) {
getDisplayedItems().add((String)items);
return;
}
if (items instanceof RepositoryItem) {
getDisplayedItems().add(((RepositoryItem)items).getRepositoryId());
return;
}
if (items instanceof Record) {
getDisplayedItems().add(((Record)items).getAttributes().get(getItemIdKey()).toString());
return;
}
if (items instanceof List) {
for(Object item : (List<?>)items) {
if (item instanceof String) {
getDisplayedItems().add((String)item);
continue;
}
if (item instanceof RepositoryItem) {
getDisplayedItems().add(((RepositoryItem)item).getRepositoryId());
continue;
}
if (item instanceof Record) {
getDisplayedItems().add(((Record)item).getAttributes().get(getItemIdKey()).toString());
continue;
}
}
}
}
}
}
}
}
|
UTF-8
|
Java
| 11,802 |
java
|
CrossCartridgeItemsLookup.java
|
Java
|
[
{
"context": "ieved in the renderer code.\n * </p>\n * \n * @author Natallia Paulouskaya\n * @version $Id: //hosting-blueprint/B2CBlueprint",
"end": 4567,
"score": 0.999894380569458,
"start": 4547,
"tag": "NAME",
"value": "Natallia Paulouskaya"
},
{
"context": " @updated $DateTime: 2013/02/05 00:41:33 $$Author: jsiddaga $\n */\npublic class CrossCartridgeItemsLookup exte",
"end": 4804,
"score": 0.9996498227119446,
"start": 4796,
"tag": "USERNAME",
"value": "jsiddaga"
}
] | null |
[] |
/*<ORACLECOPYRIGHT>
* Copyright (C) 1994-2013 Oracle and/or its affiliates. All rights reserved.
* Oracle and Java are registered trademarks of Oracle and/or its affiliates.
* Other names may be trademarks of their respective owners.
* UNIX is a registered trademark of The Open Group.
*
* This software and related documentation are provided under a license agreement
* containing restrictions on use and disclosure and are protected by intellectual property laws.
* Except as expressly permitted in your license agreement or allowed by law, you may not use, copy,
* reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish,
* or display any part, in any form, or by any means. Reverse engineering, disassembly,
* or decompilation of this software, unless required by law for interoperability, is prohibited.
*
* The information contained herein is subject to change without notice and is not warranted to be error-free.
* If you find any errors, please report them to us in writing.
*
* U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data delivered to U.S.
* Government customers are "commercial computer software" or "commercial technical data" pursuant to the applicable
* Federal Acquisition Regulation and agency-specific supplemental regulations.
* As such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and
* license terms set forth in the applicable Government contract, and, to the extent applicable by the terms of the
* Government contract, the additional rights set forth in FAR 52.227-19, Commercial Computer Software License
* (December 2007). Oracle America, Inc., 500 Oracle Parkway, Redwood City, CA 94065.
*
* This software or hardware is developed for general use in a variety of information management applications.
* It is not developed or intended for use in any inherently dangerous applications, including applications that
* may create a risk of personal injury. If you use this software or hardware in dangerous applications,
* then you shall be responsible to take all appropriate fail-safe, backup, redundancy,
* and other measures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any
* damages caused by use of this software or hardware in dangerous applications.
*
* This software or hardware and documentation may provide access to or information on content,
* products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and
* expressly disclaim all warranties of any kind with respect to third-party content, products, and services.
* Oracle Corporation and its affiliates will not be responsible for any loss, costs,
* or damages incurred due to your access to or use of third-party content, products, or services.
</ORACLECOPYRIGHT>*/
package atg.projects.store.assembler.cartridge;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import atg.core.util.StringUtils;
import atg.repository.RepositoryItem;
import com.endeca.infront.assembler.ContentItem;
import com.endeca.infront.cartridge.model.Record;
/**
* <p>
* This is the subclass of <code>ContentItemTreeIterator</code> that iterates through the content item tree looking
* for the items displayed in different kind of cartridges. The main purpose of this class is to put
* all displayed items into one bucket so that other component can check it to avoid duplicates in the cartridges.
* </p>
* <p>
* The class looks for displayed items only in the cartridges with types configured in the
* <code>typeToPropertyNameMap</code>. The <code>typeToPropertyNameMap</code> contains mapping between cartridge
* type and property name where the displayed items are stored. Items are expected to be RepositoryItems or
* Endeca Record objects. If detected items are RepositoryItems the repository ID is stored into the storage.
* If items are Endeca Records, then the ID of item is retrieved from the property configured in the
* <code>itemIdKey</code> property.
* </p>
* <p>
* The <code>ContentItemTreeIterator</code> also performs caching of content items with IDs configured in the
* <code>contentItemsToCache</code> list. The cached content items can be used in cases where displayed items are
* not part of content item but retrieved in the renderer code.
* </p>
*
* @author <NAME>
* @version $Id: //hosting-blueprint/B2CBlueprint/version/10.2/Endeca/Assembler/src/atg/projects/store/assembler/cartridge/CrossCartridgeItemsLookup.java#3 $$Change: 788278 $
* @updated $DateTime: 2013/02/05 00:41:33 $$Author: jsiddaga $
*/
public class CrossCartridgeItemsLookup extends ContentItemTreeIterator {
//-------------------------------------------
/** Class version string. */
protected static final String CLASS_VERSION =
"$Id: //hosting-blueprint/B2CBlueprint/version/10.2/Endeca/Assembler/src/atg/projects/store/assembler/cartridge/CrossCartridgeItemsLookup.java#3 $$Change: 788278 $";
//----------------------------------------------------------------------------
// PROPERTIES
//----------------------------------------------------------------------------
//-----------------------------------------------------
// property: displayedItems
//-----------------------------------------------------
List<String> mDisplayedItems = new ArrayList<String>();
/**
* @return The list of displayed items.
*/
public List<String> getDisplayedItems() {
return mDisplayedItems;
}
/**
* @param pDisplayedItems - The list of displayed items to set.
*/
public void setDisplayedItems(List<String> pDisplayedItems) {
mDisplayedItems = pDisplayedItems;
}
//-----------------------------------------------
// property: typeToPropertyNameMap
//-----------------------------------------------
Map<String,String> mTypeToPropertyNameMap = null;
/**
* @return the mapping between cartridge types and property names where the items we are looking for stored.
*/
public Map<String, String> getTypeToPropertyNameMap() {
return mTypeToPropertyNameMap;
}
/**
* @param pTypeToPropertyNameMap - The mapping between cartridge types and property names where the items we
* are looking for stored.
*/
public void setTypeToPropertyNameMap(Map<String, String> pTypeToPropertyNameMap) {
mTypeToPropertyNameMap = pTypeToPropertyNameMap;
}
//---------------------------------------
// property: contentItemsToCache
//---------------------------------------
List<String> mContentItemsToCache = null;
/**
* @return the array of content item types which should be cached during content item tree iteration.
*/
public List<String> getContentItemsToCache() {
return mContentItemsToCache;
}
/**
* @param pContentItemsToCache - The array of content item types which should be cached during content
* item tree iteration.
*/
public void setContentItemsToCache(List<String> pContentItemsToCache) {
mContentItemsToCache = pContentItemsToCache;
}
//------------------------------------------------
// property: contentItemsCache
//------------------------------------------------
Map<String,List<ContentItem>> mContentItemsCache = new HashMap<String, List<ContentItem>>();
/**
* @return the mapping between cartridge types and list of content items assembled for this request.
*/
public Map<String,List<ContentItem>> getContentItemsCache() {
return mContentItemsCache;
}
/**
* @param pContentItemsCache - The mapping between cartridge types and list of content items
* assembled for this request.
*/
public void setContentItemsCache( Map<String,List<ContentItem>> pContentItemsCache) {
mContentItemsCache = pContentItemsCache;
}
//-----------------------
// property: itemIdKey
//-----------------------
String mItemIdKey = null;
/**
* @return the content item key where the item's ID stored.
*/
public String getItemIdKey() {
return mItemIdKey;
}
/**
* @param pItemIdKey - The content item key where the item's ID stored.
*/
public void setItemIdKey(String pItemIdKey) {
mItemIdKey = pItemIdKey;
}
//----------------------------------------------------------------------------
// METHODS
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
/**
* <p>
* The implementation of content item process method. This method checks
* whether the passed in content item has one of the types configured in
* <code>typeToPropertyNameMap</code> and if so, retrieves items from the
* property mapped to the corresponding cartridge type.
* </p>
* <p>
* Item IDs are stored in the <code>displayedItems</code> list. If the retrieved
* items are RepositoryItems, the ID is taken from the repositoryId property. In
* the case when the retrieved items are Endeca records, the IDs are taken from
* the property configured in the <code>itemIdKey</code>.
* </p>
*
* @param pContentItem The configuration item.
*/
@Override
public void process(ContentItem pContentItem) {
// The type of current content item.
String type = pContentItem.getType();
// Check whether we need to cache this content item.
if (getContentItemsToCache() != null && getContentItemsToCache().contains(type)) {
// Cache content item.
List<ContentItem> contentItemList = getContentItemsCache().get(type);
if (contentItemList == null){
contentItemList = new ArrayList<ContentItem>();
getContentItemsCache().put(type, contentItemList);
}
contentItemList.add(pContentItem);
}
// Check whether the content item is of configured type. If not just skip processing.
if (getTypeToPropertyNameMap() != null && getTypeToPropertyNameMap().containsKey(type)){
// The content item type is in the configure typeToPropertyNameMap mapping.
// Retrieve items displayed by the cartridge from the configured property.
String propertyName = getTypeToPropertyNameMap().get(type);
if (!StringUtils.isEmpty(propertyName)) {
Object items = pContentItem.get(propertyName);
if (items != null) {
if (items instanceof String) {
getDisplayedItems().add((String)items);
return;
}
if (items instanceof RepositoryItem) {
getDisplayedItems().add(((RepositoryItem)items).getRepositoryId());
return;
}
if (items instanceof Record) {
getDisplayedItems().add(((Record)items).getAttributes().get(getItemIdKey()).toString());
return;
}
if (items instanceof List) {
for(Object item : (List<?>)items) {
if (item instanceof String) {
getDisplayedItems().add((String)item);
continue;
}
if (item instanceof RepositoryItem) {
getDisplayedItems().add(((RepositoryItem)item).getRepositoryId());
continue;
}
if (item instanceof Record) {
getDisplayedItems().add(((Record)item).getAttributes().get(getItemIdKey()).toString());
continue;
}
}
}
}
}
}
}
}
| 11,788 | 0.649212 | 0.643874 | 269 | 42.873608 | 38.722618 | 174 | false | false | 0 | 0 | 0 | 0 | 87 | 0.014743 | 0.390335 | false | false |
12
|
d87d3e85d0de153adbe96bf75f5747bdb4a5c4db
| 9,698,036,196,428 |
294dc7a336ad3b7d90cb0536492e03eb75ce091b
|
/app/src/main/java/com/example/wanandroid_myy/fragments/LoginFragment.java
|
b7bfe6e1c59f2a5bd677f1c1edefd24cbad847bc
|
[] |
no_license
|
myy1128/wanAndroid_myy
|
https://github.com/myy1128/wanAndroid_myy
|
2e6cb214e6c876720e31a66faae1f8d9b4514271
|
70670f7551a70490f0b3c26eab67841ed4315d6d
|
refs/heads/master
| 2020-07-01T04:39:43.342000 | 2019-08-07T12:59:42 | 2019-08-07T12:59:42 | 201,050,861 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.wanandroid_myy.fragments;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import com.example.wanandroid_myy.R;
/**
* A simple {@link Fragment} subclass.
*/
public class LoginFragment extends Fragment implements View.OnClickListener {
private View view;
/**
* 用户名
*/
private EditText et_username;
/**
* 密码
*/
private EditText et_password;
/**
* 登录
*/
private Button btn_login;
/**
* 没有账号?前去注册
*/
private TextView tv_sign_up;
private FragmentManager manager;
public static LoginFragment newInstance() {
LoginFragment fragment = new LoginFragment();
//在此处传递参数,可在fragment恢复时使用;避免在构造函数中传参,fragment恢复时不调用非默认构造函数
// Bundle args = new Bundle();
// fragment.setArguments(args);
return fragment;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View inflate = inflater.inflate(R.layout.fragment_login, container, false);
initView(inflate);
return inflate;
}
private void initView(View inflate) {
et_username = (EditText) inflate.findViewById(R.id.et_username);
et_password = (EditText) inflate.findViewById(R.id.et_password);
btn_login = (Button) inflate.findViewById(R.id.btn_login);
tv_sign_up = (TextView) inflate.findViewById(R.id.tv_sign_up);
btn_login.setOnClickListener(this);
tv_sign_up.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
default:
break;
case R.id.btn_login:
break;
case R.id.tv_sign_up:
RegisterFragment registerFragment = new RegisterFragment();
manager = getActivity().getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
transaction.replace(R.id.login_frame_layout, registerFragment);
transaction.commit();
break;
}
}
}
|
UTF-8
|
Java
| 2,654 |
java
|
LoginFragment.java
|
Java
|
[] | null |
[] |
package com.example.wanandroid_myy.fragments;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import com.example.wanandroid_myy.R;
/**
* A simple {@link Fragment} subclass.
*/
public class LoginFragment extends Fragment implements View.OnClickListener {
private View view;
/**
* 用户名
*/
private EditText et_username;
/**
* 密码
*/
private EditText et_password;
/**
* 登录
*/
private Button btn_login;
/**
* 没有账号?前去注册
*/
private TextView tv_sign_up;
private FragmentManager manager;
public static LoginFragment newInstance() {
LoginFragment fragment = new LoginFragment();
//在此处传递参数,可在fragment恢复时使用;避免在构造函数中传参,fragment恢复时不调用非默认构造函数
// Bundle args = new Bundle();
// fragment.setArguments(args);
return fragment;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View inflate = inflater.inflate(R.layout.fragment_login, container, false);
initView(inflate);
return inflate;
}
private void initView(View inflate) {
et_username = (EditText) inflate.findViewById(R.id.et_username);
et_password = (EditText) inflate.findViewById(R.id.et_password);
btn_login = (Button) inflate.findViewById(R.id.btn_login);
tv_sign_up = (TextView) inflate.findViewById(R.id.tv_sign_up);
btn_login.setOnClickListener(this);
tv_sign_up.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
default:
break;
case R.id.btn_login:
break;
case R.id.tv_sign_up:
RegisterFragment registerFragment = new RegisterFragment();
manager = getActivity().getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
transaction.replace(R.id.login_frame_layout, registerFragment);
transaction.commit();
break;
}
}
}
| 2,654 | 0.642801 | 0.641227 | 86 | 28.55814 | 23.696043 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.523256 | false | false |
12
|
c32d524dd155c16e21d2415c5e1abaa3d5f9f049
| 16,913,581,264,161 |
4a48caaae2421d762c2550e5fc64e6f9fb6722d7
|
/src/shapes/ShapeDrawer.java
|
7e73336f23172cf9773e9288419f19265e865ed3
|
[
"Unlicense"
] |
permissive
|
kevinendres/shape-drawer
|
https://github.com/kevinendres/shape-drawer
|
1eed33525b29ada6ff9a9c61a9feef0761db2c12
|
acf7decdb18f1f5221767beb5158b4935f6f6f08
|
refs/heads/main
| 2023-06-08T13:47:40.969000 | 2021-06-25T00:36:09 | 2021-06-25T00:36:09 | 356,679,239 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package shapes;
import java.awt.Color;
import java.awt.Graphics2D;
import shapes.interfaces.IShape;
import view.interfaces.PaintCanvasBase;
public class ShapeDrawer {
public static PaintCanvasBase paintCanvas;
private static void clearCanvas() {
Graphics2D g2d = paintCanvas.getGraphics2D();
g2d.setColor(Color.WHITE);
g2d.fillRect(0,0,2560,1600);
}
public static void drawAllShapes() {
clearCanvas();
for (IShape shape : ShapeList.shapeList) {
shape.draw(paintCanvas);
}
}
}
|
UTF-8
|
Java
| 520 |
java
|
ShapeDrawer.java
|
Java
|
[] | null |
[] |
package shapes;
import java.awt.Color;
import java.awt.Graphics2D;
import shapes.interfaces.IShape;
import view.interfaces.PaintCanvasBase;
public class ShapeDrawer {
public static PaintCanvasBase paintCanvas;
private static void clearCanvas() {
Graphics2D g2d = paintCanvas.getGraphics2D();
g2d.setColor(Color.WHITE);
g2d.fillRect(0,0,2560,1600);
}
public static void drawAllShapes() {
clearCanvas();
for (IShape shape : ShapeList.shapeList) {
shape.draw(paintCanvas);
}
}
}
| 520 | 0.723077 | 0.692308 | 23 | 21.608696 | 16.651777 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.608696 | false | false |
12
|
9cb6a5c8ace63309d14d30b4441b537046e84a66
| 15,891,379,048,322 |
0aa5bdabd63eeca259e8d32f00b4642b8e059800
|
/src/test/java/com/capgemini/controller/VehicleControllerTest.java
|
d6fcbe5fc0cbd327c1776be342ecb18b4af67ee1
|
[] |
no_license
|
darcicon/vrs-spring
|
https://github.com/darcicon/vrs-spring
|
11f6cce0635f36e4824448bb740112690737c347
|
da9bee19270bf1c526445d3930e0dfe3991395a9
|
refs/heads/main
| 2023-05-31T21:13:09.723000 | 2021-06-18T06:09:03 | 2021-06-18T06:09:03 | 378,051,479 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.capgemini.controller;
import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.jupiter.api.Assertions.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import com.capgemini.entities.Vehicle;
import com.capgemini.entities.VehicleBrand;
import com.capgemini.repository.VehicleBrandRepository;
import com.capgemini.repository.VehicleRepository;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@WebMvcTest(VehicleController.class)
class VehicleControllerTest {
@Autowired
private MockMvc mockMvc;
@MockBean
VehicleRepository vehicleRepository;
@MockBean
VehicleBrandRepository vehicleBrandRepository;
@Test
void testsearchVehicleByName() throws Exception {
VehicleBrand vb = new VehicleBrand();
vb.setBrand_id(1);
vb.setBrand_name("Maruti");
vb.setDeleted(false);
Vehicle vehicle = new Vehicle();
vehicle.setVehiclePlateNumber("BR1234");
vehicle.setVehicleName("swift");
vehicle.setVehicleType("sports");
vehicle.setVehicleColor("red");
vehicle.setVehicleLocation("patna");
vehicle.setNumberOfSeats(4);
vehicle.setDailyPrice(1500);
vehicle.setAvailable(true);
vehicle.setDeleted(false);
vehicle.setVehicleBrand(vb);
mockMvc.perform(get("/api/vehicle/search/name/{vehicleName}", "swift"))
.andExpect(MockMvcResultMatchers.status().isOk());
}
@Test
void testSearchVehicleByType() throws Exception {
VehicleBrand vb = new VehicleBrand();
vb.setBrand_id(1);
vb.setBrand_name("Maruti");
vb.setDeleted(false);
Vehicle vehicle = new Vehicle();
vehicle.setVehiclePlateNumber("BR1234");
vehicle.setVehicleName("swift");
vehicle.setVehicleType("sports");
vehicle.setVehicleColor("red");
vehicle.setVehicleLocation("patna");
vehicle.setNumberOfSeats(4);
vehicle.setDailyPrice(1500);
vehicle.setAvailable(true);
vehicle.setDeleted(false);
vehicle.setVehicleBrand(vb);
mockMvc.perform(get("/api/vehicle/search/type/{vehicleType}", "sports"))
.andExpect(MockMvcResultMatchers.status().isOk());
}
@Test
void testSearchVehicleByLocation() throws Exception {
VehicleBrand vb = new VehicleBrand();
vb.setBrand_id(1);
vb.setBrand_name("Maruti");
vb.setDeleted(false);
Vehicle vehicle = new Vehicle();
vehicle.setVehiclePlateNumber("BR1234");
vehicle.setVehicleName("swift");
vehicle.setVehicleType("sports");
vehicle.setVehicleColor("red");
vehicle.setVehicleLocation("patna");
vehicle.setNumberOfSeats(4);
vehicle.setDailyPrice(1500);
vehicle.setAvailable(true);
vehicle.setDeleted(false);
vehicle.setVehicleBrand(vb);
mockMvc.perform(get("/api/vehicle/search/location/{vehicleLocation}", "patna"))
.andExpect(MockMvcResultMatchers.status().isOk());
}
@Test
void testSearchVehicleBySeatCapacity() throws Exception {
VehicleBrand vb = new VehicleBrand();
vb.setBrand_id(1);
vb.setBrand_name("Maruti");
vb.setDeleted(false);
Vehicle vehicle = new Vehicle();
vehicle.setVehiclePlateNumber("BR1234");
vehicle.setVehicleName("swift");
vehicle.setVehicleType("sports");
vehicle.setVehicleColor("red");
vehicle.setVehicleLocation("patna");
vehicle.setNumberOfSeats(4);
vehicle.setDailyPrice(1500);
vehicle.setAvailable(true);
vehicle.setDeleted(false);
vehicle.setVehicleBrand(vb);
mockMvc.perform(get("/api/vehicle/search/seatCapacity/{numberOfSeats}", 4))
.andExpect(MockMvcResultMatchers.status().isOk());
}
@Test
void testSearchVehicle() throws Exception {
VehicleBrand vb = new VehicleBrand();
vb.setBrand_id(1);
vb.setBrand_name("Maruti");
vb.setDeleted(false);
Vehicle vehicle = new Vehicle();
vehicle.setVehiclePlateNumber("BR1234");
vehicle.setVehicleName("swift");
vehicle.setVehicleType("sports");
vehicle.setVehicleColor("red");
vehicle.setVehicleLocation("patna");
vehicle.setNumberOfSeats(4);
vehicle.setDailyPrice(1500);
vehicle.setAvailable(true);
vehicle.setDeleted(false);
vehicle.setVehicleBrand(vb);
mockMvc.perform(get("/api/vehicle/search/type/{vehicleType}/name/{vehicleName}", "sports", "swift"))
.andExpect(MockMvcResultMatchers.status().isOk());
}
@Test
void testSeacrhVehicleV1() throws Exception {
VehicleBrand vb = new VehicleBrand();
vb.setBrand_id(1);
vb.setBrand_name("Maruti");
vb.setDeleted(false);
Vehicle vehicle = new Vehicle();
vehicle.setVehiclePlateNumber("BR1234");
vehicle.setVehicleName("swift");
vehicle.setVehicleType("sports");
vehicle.setVehicleColor("red");
vehicle.setVehicleLocation("patna");
vehicle.setNumberOfSeats(4);
vehicle.setDailyPrice(1500);
vehicle.setAvailable(true);
vehicle.setDeleted(false);
vehicle.setVehicleBrand(vb);
mockMvc.perform(get("/api/vehicle/search/type/{vehicleType}/name/{vehicleName}/color/{vehicleColor}", "sports",
"swift", "red")).andExpect(MockMvcResultMatchers.status().isOk());
}
@Test
void testSearchAllVehicle() throws Exception {
VehicleBrand vb = new VehicleBrand();
vb.setBrand_id(1);
vb.setBrand_name("Maruti");
vb.setDeleted(false);
Vehicle vehicle = new Vehicle();
vehicle.setVehiclePlateNumber("BR1234");
vehicle.setVehicleName("swift");
vehicle.setVehicleType("sports");
vehicle.setVehicleColor("red");
vehicle.setVehicleLocation("patna");
vehicle.setNumberOfSeats(4);
vehicle.setDailyPrice(1500);
vehicle.setAvailable(true);
vehicle.setDeleted(false);
vehicle.setVehicleBrand(vb);
mockMvc.perform(get("/api/vehicle/search/allVehicles")).andExpect(MockMvcResultMatchers.status().isOk());
}
}
|
UTF-8
|
Java
| 6,082 |
java
|
VehicleControllerTest.java
|
Java
|
[
{
"context": "Brand();\n\t\tvb.setBrand_id(1);\n\t\tvb.setBrand_name(\"Maruti\");\n\t\tvb.setDeleted(false);\n\t\tVehicle vehicle = ne",
"end": 2064,
"score": 0.9855707287788391,
"start": 2058,
"tag": "NAME",
"value": "Maruti"
},
{
"context": "Brand();\n\t\tvb.setBrand_id(1);\n\t\tvb.setBrand_name(\"Maruti\");\n\t\tvb.setDeleted(false);\n\t\tVehicle vehicle = ne",
"end": 2750,
"score": 0.9774269461631775,
"start": 2744,
"tag": "NAME",
"value": "Maruti"
},
{
"context": "Brand();\n\t\tvb.setBrand_id(1);\n\t\tvb.setBrand_name(\"Maruti\");\n\t\tvb.setDeleted(false);\n\t\tVehicle vehicle = ne",
"end": 3447,
"score": 0.9626269340515137,
"start": 3441,
"tag": "NAME",
"value": "Maruti"
}
] | null |
[] |
package com.capgemini.controller;
import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.jupiter.api.Assertions.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import com.capgemini.entities.Vehicle;
import com.capgemini.entities.VehicleBrand;
import com.capgemini.repository.VehicleBrandRepository;
import com.capgemini.repository.VehicleRepository;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@WebMvcTest(VehicleController.class)
class VehicleControllerTest {
@Autowired
private MockMvc mockMvc;
@MockBean
VehicleRepository vehicleRepository;
@MockBean
VehicleBrandRepository vehicleBrandRepository;
@Test
void testsearchVehicleByName() throws Exception {
VehicleBrand vb = new VehicleBrand();
vb.setBrand_id(1);
vb.setBrand_name("Maruti");
vb.setDeleted(false);
Vehicle vehicle = new Vehicle();
vehicle.setVehiclePlateNumber("BR1234");
vehicle.setVehicleName("swift");
vehicle.setVehicleType("sports");
vehicle.setVehicleColor("red");
vehicle.setVehicleLocation("patna");
vehicle.setNumberOfSeats(4);
vehicle.setDailyPrice(1500);
vehicle.setAvailable(true);
vehicle.setDeleted(false);
vehicle.setVehicleBrand(vb);
mockMvc.perform(get("/api/vehicle/search/name/{vehicleName}", "swift"))
.andExpect(MockMvcResultMatchers.status().isOk());
}
@Test
void testSearchVehicleByType() throws Exception {
VehicleBrand vb = new VehicleBrand();
vb.setBrand_id(1);
vb.setBrand_name("Maruti");
vb.setDeleted(false);
Vehicle vehicle = new Vehicle();
vehicle.setVehiclePlateNumber("BR1234");
vehicle.setVehicleName("swift");
vehicle.setVehicleType("sports");
vehicle.setVehicleColor("red");
vehicle.setVehicleLocation("patna");
vehicle.setNumberOfSeats(4);
vehicle.setDailyPrice(1500);
vehicle.setAvailable(true);
vehicle.setDeleted(false);
vehicle.setVehicleBrand(vb);
mockMvc.perform(get("/api/vehicle/search/type/{vehicleType}", "sports"))
.andExpect(MockMvcResultMatchers.status().isOk());
}
@Test
void testSearchVehicleByLocation() throws Exception {
VehicleBrand vb = new VehicleBrand();
vb.setBrand_id(1);
vb.setBrand_name("Maruti");
vb.setDeleted(false);
Vehicle vehicle = new Vehicle();
vehicle.setVehiclePlateNumber("BR1234");
vehicle.setVehicleName("swift");
vehicle.setVehicleType("sports");
vehicle.setVehicleColor("red");
vehicle.setVehicleLocation("patna");
vehicle.setNumberOfSeats(4);
vehicle.setDailyPrice(1500);
vehicle.setAvailable(true);
vehicle.setDeleted(false);
vehicle.setVehicleBrand(vb);
mockMvc.perform(get("/api/vehicle/search/location/{vehicleLocation}", "patna"))
.andExpect(MockMvcResultMatchers.status().isOk());
}
@Test
void testSearchVehicleBySeatCapacity() throws Exception {
VehicleBrand vb = new VehicleBrand();
vb.setBrand_id(1);
vb.setBrand_name("Maruti");
vb.setDeleted(false);
Vehicle vehicle = new Vehicle();
vehicle.setVehiclePlateNumber("BR1234");
vehicle.setVehicleName("swift");
vehicle.setVehicleType("sports");
vehicle.setVehicleColor("red");
vehicle.setVehicleLocation("patna");
vehicle.setNumberOfSeats(4);
vehicle.setDailyPrice(1500);
vehicle.setAvailable(true);
vehicle.setDeleted(false);
vehicle.setVehicleBrand(vb);
mockMvc.perform(get("/api/vehicle/search/seatCapacity/{numberOfSeats}", 4))
.andExpect(MockMvcResultMatchers.status().isOk());
}
@Test
void testSearchVehicle() throws Exception {
VehicleBrand vb = new VehicleBrand();
vb.setBrand_id(1);
vb.setBrand_name("Maruti");
vb.setDeleted(false);
Vehicle vehicle = new Vehicle();
vehicle.setVehiclePlateNumber("BR1234");
vehicle.setVehicleName("swift");
vehicle.setVehicleType("sports");
vehicle.setVehicleColor("red");
vehicle.setVehicleLocation("patna");
vehicle.setNumberOfSeats(4);
vehicle.setDailyPrice(1500);
vehicle.setAvailable(true);
vehicle.setDeleted(false);
vehicle.setVehicleBrand(vb);
mockMvc.perform(get("/api/vehicle/search/type/{vehicleType}/name/{vehicleName}", "sports", "swift"))
.andExpect(MockMvcResultMatchers.status().isOk());
}
@Test
void testSeacrhVehicleV1() throws Exception {
VehicleBrand vb = new VehicleBrand();
vb.setBrand_id(1);
vb.setBrand_name("Maruti");
vb.setDeleted(false);
Vehicle vehicle = new Vehicle();
vehicle.setVehiclePlateNumber("BR1234");
vehicle.setVehicleName("swift");
vehicle.setVehicleType("sports");
vehicle.setVehicleColor("red");
vehicle.setVehicleLocation("patna");
vehicle.setNumberOfSeats(4);
vehicle.setDailyPrice(1500);
vehicle.setAvailable(true);
vehicle.setDeleted(false);
vehicle.setVehicleBrand(vb);
mockMvc.perform(get("/api/vehicle/search/type/{vehicleType}/name/{vehicleName}/color/{vehicleColor}", "sports",
"swift", "red")).andExpect(MockMvcResultMatchers.status().isOk());
}
@Test
void testSearchAllVehicle() throws Exception {
VehicleBrand vb = new VehicleBrand();
vb.setBrand_id(1);
vb.setBrand_name("Maruti");
vb.setDeleted(false);
Vehicle vehicle = new Vehicle();
vehicle.setVehiclePlateNumber("BR1234");
vehicle.setVehicleName("swift");
vehicle.setVehicleType("sports");
vehicle.setVehicleColor("red");
vehicle.setVehicleLocation("patna");
vehicle.setNumberOfSeats(4);
vehicle.setDailyPrice(1500);
vehicle.setAvailable(true);
vehicle.setDeleted(false);
vehicle.setVehicleBrand(vb);
mockMvc.perform(get("/api/vehicle/search/allVehicles")).andExpect(MockMvcResultMatchers.status().isOk());
}
}
| 6,082 | 0.762249 | 0.750411 | 185 | 31.875675 | 21.063114 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.254054 | false | false |
12
|
fac721408052879fd5f6e2b48b076cc70989159d
| 35,613,868,824,396 |
46cd1dfd32c054e01d8926d624a68aea29d11b80
|
/src/bench/Client.java
|
a594f42f15246996c388cc11b35515c6ba71bcac
|
[
"Apache-2.0"
] |
permissive
|
dhentchel/bench
|
https://github.com/dhentchel/bench
|
80d6985ee39cb9940665e2699de655f31b5d62fa
|
6290ff43c1dccaf5206bc261b5f88b1aeeede829
|
refs/heads/master
| 2021-01-23T12:18:01.945000 | 2014-02-21T15:24:22 | 2014-02-21T15:24:22 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/* Client.java - Copyright (c) 2014, David Paul Hentchel
*
* 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 bench;
import bench.TestContext.TestStats;
/**
* Run test threads to model individual SQL client connections.
* This module manages the actual transaction logic and txn performance counters.
* @author dhentchel
*
*/
public class Client implements Runnable {
private static final long MAX_ERROR_COUNT = 3;
TestContext _ctx;
DatabaseManager _dbmgr;
Session _session;
Long _clientID;
ClientManager _manager;
public Client( TestContext ctx, long clientID, ClientManager manager ) {
_ctx = ctx;
_clientID = clientID;
if (manager == null)
_manager = new SimpleClientManager();
else
_manager = manager;
_dbmgr = new DatabaseManager(_ctx);
_session = new Session(_dbmgr, _clientID);
_manager.setState(_clientID, ClientState.NEW);
}
public TestStats getStats() { return new TestStats(_session); }
/**
* Perform initial schema creation and database load.
*/
public void load ( ) {
_manager.setState(_clientID, ClientState.LOADING);
Script loadScript = Script.launchScript(_ctx.getString("scriptclass"), _ctx.getString("loadscriptfile"), _clientID, _ctx.getString("loadscriptvars"));
boolean processing = true;
while (processing) {
try {
String line = loadScript.nextLine();
if (line == null)
processing = false;
else
processing = _session.execute(line);
} catch (Exception e) {
processing = false;
throw new RuntimeException("Script Fatal", e);
}
}
if (TestContext.isVerbose)
System.err.println(getStats().show());
System.err.println("Client: load complete.");
}
/**
* Benchmark driver for each client thread.
* Threads used the shared runFlag to synchronize start and stop. The client repeatedly invokes a
* prepared statement for a table INSERT, committing after each insert. Each client thread generates
* unique random data for the contents of the insert, and tracks successful and failed transactions.
*/
public void run() {
Script runScript = Script.launchScript(_ctx.getString("scriptclass"), _ctx.getString("runscriptfile"), _clientID, _ctx.getString("runscriptvars"));
_manager.setState(_clientID, ClientState.READY);
while (true) {
synchronized(_manager) {
try { _manager.wait(1000); }
catch (InterruptedException e) { ; }
}
if (_manager.running())
break;
}
long fatalCount = 0;
Exception finalException = null;
boolean sessionIsActive = true;
try {
_manager.setState(_clientID, ClientState.RUNNING);
while (sessionIsActive && _manager.running() && fatalCount < MAX_ERROR_COUNT) {
try {
String line = runScript.nextLine();
if (line == null)
sessionIsActive = false;
else
sessionIsActive = _session.execute(line);
} catch (Exception e) {
fatalCount++;
finalException = e;
e.printStackTrace(System.err);
}
}
} catch (Exception e) {
System.err.println("\n**** Fatal Error"+e.getMessage());
finalException = e;
e.printStackTrace();
} finally {
_session.endSession();
sessionIsActive = false;
if (finalException != null) {
_manager.setState(_clientID, ClientState.ABORTED);
throw new RuntimeException("Client: Fatal exception limit exceeded.", finalException);
} else {
_manager.setState(_clientID, ClientState.DONE);
}
}
if (TestContext.isVerbose)
if (TestContext.isVerbose) System.err.println(String.format("Client %d finished.", _clientID));
}
/**
* @param args
*/
public static void main(String[] args) {
TestContext context = new TestContext();
context.put("loadscriptfile", "test/Client_test_script.gen");
context.put("loadscriptvars", "none");
context.parse(args);
Client client = new Client(context, 0, null);
client.load();
}
/**
* The client state is set by the client thread to communicate its state to the ClientManager.
* Client states have the following general meanings:
* <ol><li>NONE - optional empty state before the client is instantiated</li>
* <li>NEW - Client has instantiated itself, including a successful database connection</li>
* <li>LOADING - Client is in the process of loading the database</li>
* <li>READY - Client thread is ready to begin a test run</li>
* <li>RUNNING - Test run is in progress</li>
* <li>ABORTED - Client has aborted and will clean up</li>
* <li>DONE - Test run or abort processing is finished the the client thread can be destroyed</li>
* </ol>
* @author dhentchel
*
*/
public enum ClientState {
NONE,
NEW,
LOADING,
READY,
RUNNING,
ABORTED,
DONE;
}
/**
* Communicate the Client's state to a driver program.
* Pass an instance of this to the constructor if you want the client to update you regarding state changes.
* The implementor is responsible for ensuring thread safety.
*/
public static interface ClientManager {
public boolean running();
public void setState ( long clientID, ClientState state);
}
public static class SimpleClientManager implements ClientManager {
private ClientState _state = ClientState.NEW;
@Override
public boolean running() {
if (_state == ClientState.RUNNING)
return true;
else
return false;
}
@Override
public void setState(long clientID, ClientState state) {
_state = state;
}
}
}
|
UTF-8
|
Java
| 5,886 |
java
|
Client.java
|
Java
|
[
{
"context": "/* Client.java - Copyright (c) 2014, David Paul Hentchel\n *\n * Licensed under the Apache License, Version ",
"end": 56,
"score": 0.9998900294303894,
"start": 37,
"tag": "NAME",
"value": "David Paul Hentchel"
},
{
"context": "ion logic and txn performance counters.\n * @author dhentchel\n *\n */\npublic class Client implements Runnable {\n",
"end": 842,
"score": 0.9994783401489258,
"start": 833,
"tag": "USERNAME",
"value": "dhentchel"
},
{
"context": "thread can be destroyed</li>\n\t * </ol>\n\t * @author dhentchel\n\t *\n\t */\n\tpublic enum ClientState {\n\t\tNONE,\n\t\tNEW",
"end": 5059,
"score": 0.997536301612854,
"start": 5050,
"tag": "USERNAME",
"value": "dhentchel"
}
] | null |
[] |
/* Client.java - Copyright (c) 2014, <NAME>
*
* 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 bench;
import bench.TestContext.TestStats;
/**
* Run test threads to model individual SQL client connections.
* This module manages the actual transaction logic and txn performance counters.
* @author dhentchel
*
*/
public class Client implements Runnable {
private static final long MAX_ERROR_COUNT = 3;
TestContext _ctx;
DatabaseManager _dbmgr;
Session _session;
Long _clientID;
ClientManager _manager;
public Client( TestContext ctx, long clientID, ClientManager manager ) {
_ctx = ctx;
_clientID = clientID;
if (manager == null)
_manager = new SimpleClientManager();
else
_manager = manager;
_dbmgr = new DatabaseManager(_ctx);
_session = new Session(_dbmgr, _clientID);
_manager.setState(_clientID, ClientState.NEW);
}
public TestStats getStats() { return new TestStats(_session); }
/**
* Perform initial schema creation and database load.
*/
public void load ( ) {
_manager.setState(_clientID, ClientState.LOADING);
Script loadScript = Script.launchScript(_ctx.getString("scriptclass"), _ctx.getString("loadscriptfile"), _clientID, _ctx.getString("loadscriptvars"));
boolean processing = true;
while (processing) {
try {
String line = loadScript.nextLine();
if (line == null)
processing = false;
else
processing = _session.execute(line);
} catch (Exception e) {
processing = false;
throw new RuntimeException("Script Fatal", e);
}
}
if (TestContext.isVerbose)
System.err.println(getStats().show());
System.err.println("Client: load complete.");
}
/**
* Benchmark driver for each client thread.
* Threads used the shared runFlag to synchronize start and stop. The client repeatedly invokes a
* prepared statement for a table INSERT, committing after each insert. Each client thread generates
* unique random data for the contents of the insert, and tracks successful and failed transactions.
*/
public void run() {
Script runScript = Script.launchScript(_ctx.getString("scriptclass"), _ctx.getString("runscriptfile"), _clientID, _ctx.getString("runscriptvars"));
_manager.setState(_clientID, ClientState.READY);
while (true) {
synchronized(_manager) {
try { _manager.wait(1000); }
catch (InterruptedException e) { ; }
}
if (_manager.running())
break;
}
long fatalCount = 0;
Exception finalException = null;
boolean sessionIsActive = true;
try {
_manager.setState(_clientID, ClientState.RUNNING);
while (sessionIsActive && _manager.running() && fatalCount < MAX_ERROR_COUNT) {
try {
String line = runScript.nextLine();
if (line == null)
sessionIsActive = false;
else
sessionIsActive = _session.execute(line);
} catch (Exception e) {
fatalCount++;
finalException = e;
e.printStackTrace(System.err);
}
}
} catch (Exception e) {
System.err.println("\n**** Fatal Error"+e.getMessage());
finalException = e;
e.printStackTrace();
} finally {
_session.endSession();
sessionIsActive = false;
if (finalException != null) {
_manager.setState(_clientID, ClientState.ABORTED);
throw new RuntimeException("Client: Fatal exception limit exceeded.", finalException);
} else {
_manager.setState(_clientID, ClientState.DONE);
}
}
if (TestContext.isVerbose)
if (TestContext.isVerbose) System.err.println(String.format("Client %d finished.", _clientID));
}
/**
* @param args
*/
public static void main(String[] args) {
TestContext context = new TestContext();
context.put("loadscriptfile", "test/Client_test_script.gen");
context.put("loadscriptvars", "none");
context.parse(args);
Client client = new Client(context, 0, null);
client.load();
}
/**
* The client state is set by the client thread to communicate its state to the ClientManager.
* Client states have the following general meanings:
* <ol><li>NONE - optional empty state before the client is instantiated</li>
* <li>NEW - Client has instantiated itself, including a successful database connection</li>
* <li>LOADING - Client is in the process of loading the database</li>
* <li>READY - Client thread is ready to begin a test run</li>
* <li>RUNNING - Test run is in progress</li>
* <li>ABORTED - Client has aborted and will clean up</li>
* <li>DONE - Test run or abort processing is finished the the client thread can be destroyed</li>
* </ol>
* @author dhentchel
*
*/
public enum ClientState {
NONE,
NEW,
LOADING,
READY,
RUNNING,
ABORTED,
DONE;
}
/**
* Communicate the Client's state to a driver program.
* Pass an instance of this to the constructor if you want the client to update you regarding state changes.
* The implementor is responsible for ensuring thread safety.
*/
public static interface ClientManager {
public boolean running();
public void setState ( long clientID, ClientState state);
}
public static class SimpleClientManager implements ClientManager {
private ClientState _state = ClientState.NEW;
@Override
public boolean running() {
if (_state == ClientState.RUNNING)
return true;
else
return false;
}
@Override
public void setState(long clientID, ClientState state) {
_state = state;
}
}
}
| 5,873 | 0.696398 | 0.69385 | 185 | 30.816216 | 31.418514 | 152 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.45946 | false | false |
12
|
c665479efa3aca75e68c09f467fc45efbbb3f00c
| 34,943,853,921,639 |
8288ae869388abfafd240110d9439d9314d58d4f
|
/Aula11/ocp/Teste.java
|
033c4670e5b038ee3fe842f1ef733d3206b742e1
|
[] |
no_license
|
elielrj/ADSII
|
https://github.com/elielrj/ADSII
|
0b3cd6e3db8e4a8acdccda22523b2120d829bb18
|
6e22b385b117d34e2bb7a92ee015a0f3243795ab
|
refs/heads/main
| 2023-05-30T17:37:35.834000 | 2021-06-11T21:08:14 | 2021-06-11T21:08:14 | 376,141,669 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ADSII.Aula11.ocp;
public class Teste {
public static void main(String[] args) {
Pedido pedido = new Pedido();
System.out.println(pedido.total());
pedido.definirDesconto(new Natal());
System.out.println(pedido.total());
}
}
|
UTF-8
|
Java
| 279 |
java
|
Teste.java
|
Java
|
[] | null |
[] |
package ADSII.Aula11.ocp;
public class Teste {
public static void main(String[] args) {
Pedido pedido = new Pedido();
System.out.println(pedido.total());
pedido.definirDesconto(new Natal());
System.out.println(pedido.total());
}
}
| 279 | 0.612903 | 0.605735 | 17 | 15.411765 | 18.711617 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.294118 | false | false |
12
|
5a3e4fa426b1a1f25634e475d7f0594f36e93aa0
| 13,391,708,068,343 |
301a28ac7ee197475f2e819d6c98a84f4439bc37
|
/src/test/java/reddit/pages/RedditHomePage.java
|
17901c070b5c532739ccc343eb69ee33238245d7
|
[
"MIT"
] |
permissive
|
dev-maheshwar-p/redditproj
|
https://github.com/dev-maheshwar-p/redditproj
|
865cfd1f093b5471029744d7584cff4876b6b113
|
655597d2a76bcc8dd9a2b8b445917f4d39df2a68
|
refs/heads/master
| 2020-05-17T14:09:28.143000 | 2019-04-28T09:51:43 | 2019-04-28T09:51:43 | 183,755,728 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package reddit.pages;
import net.serenitybdd.core.pages.WebElementFacadeImpl;
import net.thucydides.core.annotations.DefaultUrl;
import net.thucydides.core.pages.PageObject;
import org.apache.commons.lang3.RandomUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import framework.utils.java.JavaUtils;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
@DefaultUrl("https://www.reddit.com/")
public class RedditHomePage extends PageObject {
Logger logger = LogManager.getLogger(this.getClass());
@Autowired
Environment environment;
@FindBy(xpath = "//button[@aria-label='Start typing to filter your communities or use up and down to select.']")
private WebElement filterCommunitiesButton;
@FindBy(xpath = "//div[contains(@class,'scroller') and not(contains(*,'promoted'))]//child::*[@data-click-id='body']/div/span/a")
private List<WebElement> listOfSubRedditsThatAreNotPromotions;
@FindBy( xpath = "//div[@role='textbox']")
private WebElement commentBox;
@FindBy(id="USER_DROPDOWN_ID")
private WebElement userDropDownMenu;
@FindBy(xpath = "//div[text()='Log Out']")
private WebElement logoutButton;
@FindBy(xpath = "//button[text()='comment']")
private WebElement submitCommentButton;
@FindBy(xpath = "//div[@data-redditstyle='true']//button[contains(@data-click-id,'upvote')]")
private WebElement upvoteButton;
@FindBy(xpath = "//div[@data-redditstyle='true']//button[contains(@data-click-id,'downvote')]")
private WebElement downvoteButton;
private static final String expectedCommunity = "//div[text()='my communities']/following-sibling::a/span";
public void clickOnFilterSubscriptionButton() {
waitFor(ExpectedConditions.elementToBeClickable(filterCommunitiesButton));
element(filterCommunitiesButton).click();
}
public void verifySubscribedReddit() {
WebElementFacadeImpl expectedCommunityElement = element(expectedCommunity + "[contains(text(),'science')]");
assertThat("The expected reddit is not present in the subscriptions",expectedCommunityElement.isPresent());
}
public void clickOnAnyOfSubscribedReddits(){
waitFor(ExpectedConditions.visibilityOfAllElements(listOfSubRedditsThatAreNotPromotions));
WebElement randomSubReddit = listOfSubRedditsThatAreNotPromotions.get(RandomUtils.nextInt(0, 5));
waitFor(ExpectedConditions.elementToBeClickable(randomSubReddit));
element(randomSubReddit).click();
}
public void enterStandardCommentInCommentsSection(){
JavaUtils ju = new JavaUtils();
String currentDateAndTime = ju.getCurrentDateAndTime("dd MMM YYYY K:ma");
element(commentBox).sendKeys(currentDateAndTime + " AnonymousF AnonymousL");
}
public void clickLogOut() {
waitFor(ExpectedConditions.elementToBeClickable(logoutButton));
element(logoutButton).click();
getDriver().manage().deleteAllCookies();
switchToPage(RedditLandingPage.class);
}
public void clickLogOutMenu() {
waitFor(ExpectedConditions.elementToBeClickable(userDropDownMenu));
element(userDropDownMenu).click();
}
public void clickOnSubmitCommentButton() {
waitFor(ExpectedConditions.elementToBeClickable(submitCommentButton));
element(submitCommentButton).click();
}
public void upVotePost() {
waitFor(ExpectedConditions.elementToBeClickable(upvoteButton));
element(upvoteButton).click();
}
public void downVotePost() {
waitFor(ExpectedConditions.elementToBeClickable(downvoteButton));
element(downvoteButton).click();
}
}
|
UTF-8
|
Java
| 3,733 |
java
|
RedditHomePage.java
|
Java
|
[] | null |
[] |
package reddit.pages;
import net.serenitybdd.core.pages.WebElementFacadeImpl;
import net.thucydides.core.annotations.DefaultUrl;
import net.thucydides.core.pages.PageObject;
import org.apache.commons.lang3.RandomUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import framework.utils.java.JavaUtils;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
@DefaultUrl("https://www.reddit.com/")
public class RedditHomePage extends PageObject {
Logger logger = LogManager.getLogger(this.getClass());
@Autowired
Environment environment;
@FindBy(xpath = "//button[@aria-label='Start typing to filter your communities or use up and down to select.']")
private WebElement filterCommunitiesButton;
@FindBy(xpath = "//div[contains(@class,'scroller') and not(contains(*,'promoted'))]//child::*[@data-click-id='body']/div/span/a")
private List<WebElement> listOfSubRedditsThatAreNotPromotions;
@FindBy( xpath = "//div[@role='textbox']")
private WebElement commentBox;
@FindBy(id="USER_DROPDOWN_ID")
private WebElement userDropDownMenu;
@FindBy(xpath = "//div[text()='Log Out']")
private WebElement logoutButton;
@FindBy(xpath = "//button[text()='comment']")
private WebElement submitCommentButton;
@FindBy(xpath = "//div[@data-redditstyle='true']//button[contains(@data-click-id,'upvote')]")
private WebElement upvoteButton;
@FindBy(xpath = "//div[@data-redditstyle='true']//button[contains(@data-click-id,'downvote')]")
private WebElement downvoteButton;
private static final String expectedCommunity = "//div[text()='my communities']/following-sibling::a/span";
public void clickOnFilterSubscriptionButton() {
waitFor(ExpectedConditions.elementToBeClickable(filterCommunitiesButton));
element(filterCommunitiesButton).click();
}
public void verifySubscribedReddit() {
WebElementFacadeImpl expectedCommunityElement = element(expectedCommunity + "[contains(text(),'science')]");
assertThat("The expected reddit is not present in the subscriptions",expectedCommunityElement.isPresent());
}
public void clickOnAnyOfSubscribedReddits(){
waitFor(ExpectedConditions.visibilityOfAllElements(listOfSubRedditsThatAreNotPromotions));
WebElement randomSubReddit = listOfSubRedditsThatAreNotPromotions.get(RandomUtils.nextInt(0, 5));
waitFor(ExpectedConditions.elementToBeClickable(randomSubReddit));
element(randomSubReddit).click();
}
public void enterStandardCommentInCommentsSection(){
JavaUtils ju = new JavaUtils();
String currentDateAndTime = ju.getCurrentDateAndTime("dd MMM YYYY K:ma");
element(commentBox).sendKeys(currentDateAndTime + " AnonymousF AnonymousL");
}
public void clickLogOut() {
waitFor(ExpectedConditions.elementToBeClickable(logoutButton));
element(logoutButton).click();
getDriver().manage().deleteAllCookies();
switchToPage(RedditLandingPage.class);
}
public void clickLogOutMenu() {
waitFor(ExpectedConditions.elementToBeClickable(userDropDownMenu));
element(userDropDownMenu).click();
}
public void clickOnSubmitCommentButton() {
waitFor(ExpectedConditions.elementToBeClickable(submitCommentButton));
element(submitCommentButton).click();
}
public void upVotePost() {
waitFor(ExpectedConditions.elementToBeClickable(upvoteButton));
element(upvoteButton).click();
}
public void downVotePost() {
waitFor(ExpectedConditions.elementToBeClickable(downvoteButton));
element(downvoteButton).click();
}
}
| 3,733 | 0.785427 | 0.784088 | 107 | 33.887852 | 31.945435 | 130 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.308411 | false | false |
12
|
275679d12820cbbab8260a89b3a8b84bf367587f
| 32,186,484,940,362 |
4d6103f3abc6ea76e5133f93e0cab891a05ac1db
|
/src/Main.java
|
c13b5a56c32f90a4e1643cf6fb620248df180963
|
[] |
no_license
|
lukeeee/BloggProjekt
|
https://github.com/lukeeee/BloggProjekt
|
d09418d2e20aea2eda979e365ae15bb77008aed8
|
82f0078d2c6caf054ff3cf89edda0d11fbf9ecdd
|
refs/heads/master
| 2020-05-17T15:35:48.159000 | 2013-04-08T08:34:46 | 2013-04-08T08:34:46 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.Date;
import com.ibm.icu.text.DateFormat;
import com.ibm.icu.text.SimpleDateFormat;
import blog.Post;
import blog.Blogg;
import blog.Category;
import blog.Author;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Blogg blogg = new Blogg();
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Date date = new Date();
Post post = new Post();
post.author.SetValues("Bernt", "Schnieder", "13", "Man", "Germany", "berra_tysken@live.de");
post.category.SetValues("okänd");
post.SetValues("Nytt", "Fuck You", date);
blogg.AddToList(post);
post = new Post();
post.author.SetValues("Greger", "Stenson", "36", "Man", "Sweden", "Greger2345@live.se");
post.category.SetValues("okänd");
post.SetValues("Ny", "Håll tyst Bernt", date);
blogg.AddToList(post);
post = new Post();
post.author.SetValues("Jürgen", "Schnieder", "47", "Man", "Germany", "dasjürgen@live.de");
post.category.SetValues("okänd");
post.SetValues("Ny", "Nu ska du gå och lägga dig bernt och inte vara ute och skriva massa skit på svenska bloggar du ska få smaka på pappas skärp", date);
blogg.AddToList(post);
for(int i = 0; i < blogg.GetListSize(); i++){
System.out.println(blogg.GetFromList(i).GetBloggPost());
System.out.println("\r\n");
}
}
}
|
ISO-8859-1
|
Java
| 1,392 |
java
|
Main.java
|
Java
|
[
{
"context": "\tPost post = new Post();\n\t\tpost.author.SetValues(\"Bernt\", \"Schnieder\", \"13\", \"Man\", \"Germany\", \"berra_tys",
"end": 499,
"score": 0.999567985534668,
"start": 494,
"tag": "NAME",
"value": "Bernt"
},
{
"context": "t = new Post();\n\t\tpost.author.SetValues(\"Bernt\", \"Schnieder\", \"13\", \"Man\", \"Germany\", \"berra_tysken@live.de\")",
"end": 512,
"score": 0.9998228549957275,
"start": 503,
"tag": "NAME",
"value": "Schnieder"
},
{
"context": "es(\"Bernt\", \"Schnieder\", \"13\", \"Man\", \"Germany\", \"berra_tysken@live.de\");\n\t\tpost.category.SetValues(\"okänd\");\n\t\tpost.Set",
"end": 560,
"score": 0.9999337196350098,
"start": 540,
"tag": "EMAIL",
"value": "berra_tysken@live.de"
},
{
"context": "\n\t\t\n\t\tpost = new Post();\n\t\tpost.author.SetValues(\"Greger\", \"Stenson\", \"36\", \"Man\", \"Sweden\", \"Greger2345@l",
"end": 724,
"score": 0.9997406005859375,
"start": 718,
"tag": "NAME",
"value": "Greger"
},
{
"context": " = new Post();\n\t\tpost.author.SetValues(\"Greger\", \"Stenson\", \"36\", \"Man\", \"Sweden\", \"Greger2345@live.se\");\n\t",
"end": 735,
"score": 0.9998260140419006,
"start": 728,
"tag": "NAME",
"value": "Stenson"
},
{
"context": "lues(\"Greger\", \"Stenson\", \"36\", \"Man\", \"Sweden\", \"Greger2345@live.se\");\n\t\tpost.category.SetValues(\"okänd\");\n\t\tpost.Set",
"end": 780,
"score": 0.9999345541000366,
"start": 762,
"tag": "EMAIL",
"value": "Greger2345@live.se"
},
{
"context": "\n\t\t\n\t\tpost = new Post();\n\t\tpost.author.SetValues(\"Jürgen\", \"Schnieder\", \"47\", \"Man\", \"Germany\", \"dasjürgen",
"end": 949,
"score": 0.9998445510864258,
"start": 943,
"tag": "NAME",
"value": "Jürgen"
},
{
"context": " = new Post();\n\t\tpost.author.SetValues(\"Jürgen\", \"Schnieder\", \"47\", \"Man\", \"Germany\", \"dasjürgen@live.de\");\n\t",
"end": 962,
"score": 0.9998452067375183,
"start": 953,
"tag": "NAME",
"value": "Schnieder"
},
{
"context": "SetValues(\"Jürgen\", \"Schnieder\", \"47\", \"Man\", \"Germany\", \"dasjürgen@live.de\");\n\t\tpost.category.SetValues",
"end": 986,
"score": 0.5372750163078308,
"start": 982,
"tag": "NAME",
"value": "many"
},
{
"context": "s(\"Jürgen\", \"Schnieder\", \"47\", \"Man\", \"Germany\", \"dasjürgen@live.de\");\n\t\tpost.category.SetValues(\"okänd\");\n\t\tpost.Set",
"end": 1007,
"score": 0.999934732913971,
"start": 990,
"tag": "EMAIL",
"value": "dasjürgen@live.de"
}
] | null |
[] |
import java.util.Date;
import com.ibm.icu.text.DateFormat;
import com.ibm.icu.text.SimpleDateFormat;
import blog.Post;
import blog.Blogg;
import blog.Category;
import blog.Author;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Blogg blogg = new Blogg();
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Date date = new Date();
Post post = new Post();
post.author.SetValues("Bernt", "Schnieder", "13", "Man", "Germany", "<EMAIL>");
post.category.SetValues("okänd");
post.SetValues("Nytt", "Fuck You", date);
blogg.AddToList(post);
post = new Post();
post.author.SetValues("Greger", "Stenson", "36", "Man", "Sweden", "<EMAIL>");
post.category.SetValues("okänd");
post.SetValues("Ny", "Håll tyst Bernt", date);
blogg.AddToList(post);
post = new Post();
post.author.SetValues("Jürgen", "Schnieder", "47", "Man", "Germany", "<EMAIL>");
post.category.SetValues("okänd");
post.SetValues("Ny", "Nu ska du gå och lägga dig bernt och inte vara ute och skriva massa skit på svenska bloggar du ska få smaka på pappas skärp", date);
blogg.AddToList(post);
for(int i = 0; i < blogg.GetListSize(); i++){
System.out.println(blogg.GetFromList(i).GetBloggPost());
System.out.println("\r\n");
}
}
}
| 1,357 | 0.673188 | 0.665217 | 47 | 28.382978 | 30.663273 | 156 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.446809 | false | false |
12
|
dd8dea9f813fb9a8bb85d26b23bff4b8d4555655
| 1,537,598,354,648 |
053274f00b3ada8073bdbfb075b641e52fdcd92a
|
/WebData/src/webScraper/stores/MegoStores.java
|
eb643faa671a3eca2fa81153f6ebd57e64fa5a8e
|
[] |
no_license
|
llazda/piens-un-maize-webscraper
|
https://github.com/llazda/piens-un-maize-webscraper
|
16e9df894794d7c457ae4edf4775cf20a0995586
|
e813f2a37385da55207a337fd1c58c90a2c2fab8
|
refs/heads/master
| 2021-01-19T05:50:37.384000 | 2017-09-10T21:01:47 | 2017-09-10T21:01:47 | 100,586,364 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package webScraper.stores;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Class to collect list of Mego stores from webpage.
*
* @author Jānis Lazda
*/
public class MegoStores {
private String homeURL = "http://www.mego.lv/kontakti";
private List<StoreData> storeList;
/**
* Constructor of MegoStores. Inicializes storeList and calls collectData()
*/
public MegoStores() {
storeList = new ArrayList<>();
try {
collectData();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Method which reads webpage source and populates storeList with store
* names and addresses
*/
public void collectData() throws Exception {
URL url = new URL(homeURL);
String storeName = "";
String storeAddress = "";
String inputLine;
Matcher matcher;
Pattern namePattern = Pattern.compile("(?<=<h3>)(.+?)(?=</h3>)");
Pattern addressPattern = Pattern.compile("(?<=<div>)(.+?)(?=</div>)");
BufferedReader in = new BufferedReader(new InputStreamReader(
url.openStream(), "UTF8"));
while ((inputLine = in.readLine()) != null) {
if ((inputLine.replaceAll("\\s", ""))
.equals("<pstyle=\"margin:0cm;margin-bottom:.0001pt\"> </p>")) {
while ((inputLine = in.readLine()) != null) {
matcher = namePattern.matcher(inputLine);
if (matcher.find()) {
storeName = matcher.group();
}
matcher = addressPattern.matcher(inputLine);
if (matcher.find()) {
storeAddress = matcher.group();
storeList.add(new StoreData("Mego \"" + storeName
+ "\"", storeAddress));
}
}
break;
}
}
in.close();
}
/**
* Method to pass collected data
*
* @return list of StoreData
*/
public List<StoreData> getStores() {
return storeList;
}
}
|
UTF-8
|
Java
| 1,907 |
java
|
MegoStores.java
|
Java
|
[
{
"context": "t list of Mego stores from webpage.\n * \n * @author Jānis Lazda\n */\n\npublic class MegoStores {\n\n\tprivate String h",
"end": 314,
"score": 0.9998779296875,
"start": 303,
"tag": "NAME",
"value": "Jānis Lazda"
}
] | null |
[] |
package webScraper.stores;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Class to collect list of Mego stores from webpage.
*
* @author <NAME>
*/
public class MegoStores {
private String homeURL = "http://www.mego.lv/kontakti";
private List<StoreData> storeList;
/**
* Constructor of MegoStores. Inicializes storeList and calls collectData()
*/
public MegoStores() {
storeList = new ArrayList<>();
try {
collectData();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Method which reads webpage source and populates storeList with store
* names and addresses
*/
public void collectData() throws Exception {
URL url = new URL(homeURL);
String storeName = "";
String storeAddress = "";
String inputLine;
Matcher matcher;
Pattern namePattern = Pattern.compile("(?<=<h3>)(.+?)(?=</h3>)");
Pattern addressPattern = Pattern.compile("(?<=<div>)(.+?)(?=</div>)");
BufferedReader in = new BufferedReader(new InputStreamReader(
url.openStream(), "UTF8"));
while ((inputLine = in.readLine()) != null) {
if ((inputLine.replaceAll("\\s", ""))
.equals("<pstyle=\"margin:0cm;margin-bottom:.0001pt\"> </p>")) {
while ((inputLine = in.readLine()) != null) {
matcher = namePattern.matcher(inputLine);
if (matcher.find()) {
storeName = matcher.group();
}
matcher = addressPattern.matcher(inputLine);
if (matcher.find()) {
storeAddress = matcher.group();
storeList.add(new StoreData("Mego \"" + storeName
+ "\"", storeAddress));
}
}
break;
}
}
in.close();
}
/**
* Method to pass collected data
*
* @return list of StoreData
*/
public List<StoreData> getStores() {
return storeList;
}
}
| 1,901 | 0.646905 | 0.642707 | 77 | 23.753246 | 20.783457 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.272727 | false | false |
12
|
9a99aee40285dcb47eb1131394bf1f2e8ca73a86
| 30,185,030,190,812 |
08123dd3016ca9560282a312f8643d94df43ccff
|
/src/com/yuan/stock/entry/ImportCsvDataStartup.java
|
7f1515e10ec3a6958a60b38748862e6f0cd3f1e8
|
[] |
no_license
|
fomeiherz/stock_data
|
https://github.com/fomeiherz/stock_data
|
a0f1090c2b2c8deec07c7bbe4ebccbe167c95de1
|
7919d4500a961b4959a6770ddb272f0b2e981cf6
|
refs/heads/master
| 2016-09-21T10:32:40.136000 | 2016-08-26T12:47:08 | 2016-08-26T12:47:08 | 66,098,553 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.yuan.stock.entry;
import com.yuan.stock.collection.AssignTaskThread;
/**
* Created by Twins on 2016/4/28.
*/
public class ImportCsvDataStartup {
public static void main(String[] args) {
AssignTaskThread assignTaskThread = new AssignTaskThread();
assignTaskThread.setFlag(3);
assignTaskThread.start();
}
}
|
UTF-8
|
Java
| 355 |
java
|
ImportCsvDataStartup.java
|
Java
|
[
{
"context": "ck.collection.AssignTaskThread;\n\n/**\n * Created by Twins on 2016/4/28.\n */\npublic class ImportCsvDataStart",
"end": 106,
"score": 0.9498478770256042,
"start": 101,
"tag": "USERNAME",
"value": "Twins"
}
] | null |
[] |
package com.yuan.stock.entry;
import com.yuan.stock.collection.AssignTaskThread;
/**
* Created by Twins on 2016/4/28.
*/
public class ImportCsvDataStartup {
public static void main(String[] args) {
AssignTaskThread assignTaskThread = new AssignTaskThread();
assignTaskThread.setFlag(3);
assignTaskThread.start();
}
}
| 355 | 0.698592 | 0.676056 | 16 | 21.1875 | 21.398653 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.3125 | false | false |
12
|
ca80665020d42b722fd617521acfd9b290499de6
| 32,315,333,973,784 |
a9f3dd9722687682e65d98cd69190f1af4a3e5d5
|
/Android/sdk/src/main/java/com/lynx/ui/swiper/PagerRecyclerBin.java
|
cdece449517f5a0a4d314a8758ca8a579e3da3f6
|
[
"MIT"
] |
permissive
|
codeteenager/lynx-native
|
https://github.com/codeteenager/lynx-native
|
20cc4a02c474c84e8cd9a242c000c1520412dd19
|
149b895b03f05fb34ab6fa3b66e739d2e5d6f35b
|
refs/heads/master
| 2020-03-19T03:05:38.414000 | 2018-05-30T06:49:09 | 2018-05-30T06:49:09 | 135,694,315 | 1 | 0 | null | true | 2018-06-01T09:00:30 | 2018-06-01T09:00:30 | 2018-06-01T01:10:08 | 2018-05-30T06:50:35 | 45,594 | 0 | 0 | 0 | null | false | null |
// Copyright 2017 The Lynx Authors. All rights reserved.
package com.lynx.ui.swiper;
import android.util.SparseArray;
import com.lynx.core.impl.RenderObjectImpl;
import com.lynx.ui.LynxUI;
import java.util.ArrayList;
import java.util.List;
public class PagerRecyclerBin {
private SparseArray<List<LynxUI>> mRecycledUIBin;
private boolean enableRecycle = false;
public PagerRecyclerBin() {
mRecycledUIBin = new SparseArray<>();
}
/**
* 获取被回收的view,可以进行重复使用
* @param type
* @return
*/
public LynxUI getRecycledUI(int type) {
List<LynxUI> list = mRecycledUIBin.get(type);
if (list != null && list.size() > 0) {
return list.remove(0);
}
return null;
}
public void recycleUI(RenderObjectImpl impl) {
if (!enableRecycle) {
return;
}
LynxUI ui = impl.getUI();
if (ui == null) {
return;
}
for (int i = 0; i < impl.getChildCount(); i++) {
ui.removeChild(impl.getChildAt(i));
recycleUI(impl.getChildAt(i));
}
// firstly get view's type
int type = impl.getRenderObjectType();
// unbind data from view
ui.unbindData();
// add the view to pool
List<LynxUI> list = mRecycledUIBin.get(type);
if (list == null) {
list = new ArrayList<>();
mRecycledUIBin.put(type, list);
}
list.add(ui);
mRecycledUIBin.put(type, list);
}
public void enableRecycle(boolean enable) {
enableRecycle = enable;
}
public void clear() {
mRecycledUIBin.clear();
}
}
|
UTF-8
|
Java
| 1,721 |
java
|
PagerRecyclerBin.java
|
Java
|
[] | null |
[] |
// Copyright 2017 The Lynx Authors. All rights reserved.
package com.lynx.ui.swiper;
import android.util.SparseArray;
import com.lynx.core.impl.RenderObjectImpl;
import com.lynx.ui.LynxUI;
import java.util.ArrayList;
import java.util.List;
public class PagerRecyclerBin {
private SparseArray<List<LynxUI>> mRecycledUIBin;
private boolean enableRecycle = false;
public PagerRecyclerBin() {
mRecycledUIBin = new SparseArray<>();
}
/**
* 获取被回收的view,可以进行重复使用
* @param type
* @return
*/
public LynxUI getRecycledUI(int type) {
List<LynxUI> list = mRecycledUIBin.get(type);
if (list != null && list.size() > 0) {
return list.remove(0);
}
return null;
}
public void recycleUI(RenderObjectImpl impl) {
if (!enableRecycle) {
return;
}
LynxUI ui = impl.getUI();
if (ui == null) {
return;
}
for (int i = 0; i < impl.getChildCount(); i++) {
ui.removeChild(impl.getChildAt(i));
recycleUI(impl.getChildAt(i));
}
// firstly get view's type
int type = impl.getRenderObjectType();
// unbind data from view
ui.unbindData();
// add the view to pool
List<LynxUI> list = mRecycledUIBin.get(type);
if (list == null) {
list = new ArrayList<>();
mRecycledUIBin.put(type, list);
}
list.add(ui);
mRecycledUIBin.put(type, list);
}
public void enableRecycle(boolean enable) {
enableRecycle = enable;
}
public void clear() {
mRecycledUIBin.clear();
}
}
| 1,721 | 0.569403 | 0.565269 | 78 | 20.705128 | 18.277145 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.397436 | false | false |
12
|
adf575906c467b820583db93749ceb40354c9b28
| 9,526,237,477,344 |
ba48d737c291f9bde71b0f479ce5c132ec66420d
|
/src/main/java/com/jiuyan/commons/remote/server/MonitorThriftEventHandler.java
|
fbee431be07637b568c52dfc6e61cf96f74cd9ee
|
[] |
no_license
|
LaughXP/jmultithrift
|
https://github.com/LaughXP/jmultithrift
|
62f6bfb9ca8233f2c14ea12376e3d407e788da1d
|
62ada57506625b5dc6f9406e505c20e0a08f190b
|
refs/heads/master
| 2020-12-29T00:01:17.286000 | 2015-07-18T07:03:59 | 2015-07-18T07:03:59 | 37,477,951 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
*
*/
package com.jiuyan.commons.remote.server;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ArrayBlockingQueue;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.server.ServerContext;
import org.apache.thrift.server.TServerEventHandler;
import org.apache.thrift.transport.TTransport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.jiuyan.commons.remote.util.CollectionsUtil;
/**
* @Title: MonitorThriftEventHandler.java
* @Package com.jiuyan.commons.thrift.server
* @Description:
* @author xiaoyu
* @date 2015年4月3日 下午7:55:14
*/
public class MonitorThriftEventHandler implements TServerEventHandler {
private static Logger logger = LoggerFactory.getLogger(MonitorThriftEventHandler. class );
private final Map<String, MonitorThriftContext> contexts = new HashMap<String, MonitorThriftContext>();
@Override
public void preServe() {
}
@Override
public ServerContext createContext(TProtocol input, TProtocol output) {
MonitorThriftContext context = null;
String method = null;
try {
method = input.readMessageBegin().name;
} catch (TException e) {
logger.error(e.getMessage());
e.printStackTrace();
}
if (method != null) {
MonitorThriftContext exists = contexts.get(method);
if (exists == null) {
synchronized (contexts) {
exists = contexts.get(method);
if (exists == null) { // double check
context = new MonitorThriftContext(method, System.currentTimeMillis());
contexts.put(method, context);
} else {
context = exists;
}
}
} else {
context = exists;
}
}
return context;
}
@Override
public void deleteContext(ServerContext serverContext, TProtocol input, TProtocol output) {
}
public void processContext(ServerContext serverContext, String methodName, long lantency, TTransport inputTransport, TTransport outputTransport) {
if (CollectionsUtil.dataMap.get(methodName) == null) {
CollectionsUtil.dataMap.put(methodName, new ArrayBlockingQueue<String>(10));
}
ArrayBlockingQueue<String> methodQpsQueue = CollectionsUtil.dataMap.get(methodName);
MonitorThriftContext context = (MonitorThriftContext)serverContext;
context.incrementAndReset(methodQpsQueue , lantency);
}
@Override
public void processContext(ServerContext serverContext, TTransport inputTransport, TTransport outputTransport) {
}
}
|
UTF-8
|
Java
| 2,455 |
java
|
MonitorThriftEventHandler.java
|
Java
|
[
{
"context": ".commons.thrift.server\n * @Description:\n * @author xiaoyu\n * @date 2015年4月3日 下午7:55:14\n */\npublic class Mon",
"end": 620,
"score": 0.9808213114738464,
"start": 614,
"tag": "USERNAME",
"value": "xiaoyu"
}
] | null |
[] |
/**
*
*/
package com.jiuyan.commons.remote.server;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ArrayBlockingQueue;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.server.ServerContext;
import org.apache.thrift.server.TServerEventHandler;
import org.apache.thrift.transport.TTransport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.jiuyan.commons.remote.util.CollectionsUtil;
/**
* @Title: MonitorThriftEventHandler.java
* @Package com.jiuyan.commons.thrift.server
* @Description:
* @author xiaoyu
* @date 2015年4月3日 下午7:55:14
*/
public class MonitorThriftEventHandler implements TServerEventHandler {
private static Logger logger = LoggerFactory.getLogger(MonitorThriftEventHandler. class );
private final Map<String, MonitorThriftContext> contexts = new HashMap<String, MonitorThriftContext>();
@Override
public void preServe() {
}
@Override
public ServerContext createContext(TProtocol input, TProtocol output) {
MonitorThriftContext context = null;
String method = null;
try {
method = input.readMessageBegin().name;
} catch (TException e) {
logger.error(e.getMessage());
e.printStackTrace();
}
if (method != null) {
MonitorThriftContext exists = contexts.get(method);
if (exists == null) {
synchronized (contexts) {
exists = contexts.get(method);
if (exists == null) { // double check
context = new MonitorThriftContext(method, System.currentTimeMillis());
contexts.put(method, context);
} else {
context = exists;
}
}
} else {
context = exists;
}
}
return context;
}
@Override
public void deleteContext(ServerContext serverContext, TProtocol input, TProtocol output) {
}
public void processContext(ServerContext serverContext, String methodName, long lantency, TTransport inputTransport, TTransport outputTransport) {
if (CollectionsUtil.dataMap.get(methodName) == null) {
CollectionsUtil.dataMap.put(methodName, new ArrayBlockingQueue<String>(10));
}
ArrayBlockingQueue<String> methodQpsQueue = CollectionsUtil.dataMap.get(methodName);
MonitorThriftContext context = (MonitorThriftContext)serverContext;
context.incrementAndReset(methodQpsQueue , lantency);
}
@Override
public void processContext(ServerContext serverContext, TTransport inputTransport, TTransport outputTransport) {
}
}
| 2,455 | 0.752556 | 0.746421 | 84 | 28.107143 | 30.643114 | 147 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.928571 | false | false |
12
|
ca4c74b755aa4140eff147e5d3ed7b68e071bf75
| 17,884,243,875,741 |
f2ab2faf29a310152056a2378974aff4591611e9
|
/src/test/java/com/gcs/app/GaliCricketScoreboardTest.java
|
af3bd5ff0f5a0ff2a1bce2b106d90787d2b9dff5
|
[] |
no_license
|
rkpatra201/gali-cricket-scoring
|
https://github.com/rkpatra201/gali-cricket-scoring
|
19ff99e434b896b2ac60213c385730b6b59fdae7
|
4ae4bb41394884d807ebd0f003a30762c17d8ab0
|
refs/heads/master
| 2023-09-04T06:24:53.348000 | 2023-08-30T04:05:55 | 2023-08-30T04:05:55 | 105,996,790 | 0 | 0 | null | false | 2017-10-06T18:12:52 | 2017-10-06T11:23:32 | 2017-10-06T11:33:12 | 2017-10-06T18:12:52 | 786 | 0 | 0 | 0 |
Java
| null | null |
package com.gcs.app;
import java.util.Arrays;
import org.junit.Assert;
import org.junit.Test;
public class GaliCricketScoreboardTest {
@Test
public void testCalculateScore() {
GaliCricketScoreboard gcs = new GaliCricketScoreboard();
Character[] input1 = { '1', '0', '0', '6', 'W' };
int finalScore1 = 3;
Assert.assertEquals(finalScore1, gcs.calculateScore(Arrays.asList(input1)));
Character[] input2 = { '1', '0', '0', '0', 'W' };
int finalScore2 = -3;
Assert.assertEquals(finalScore2, gcs.calculateScore(Arrays.asList(input2)));
Character[] input3 = { '0', '0', '0' };
int finalScore3 = -2;
Assert.assertEquals(finalScore3, gcs.calculateScore(Arrays.asList(input3)));
Character[] input4 = { 'W', 'W', 'W', 'W' };
int finalScore4 = -8;
Assert.assertEquals(finalScore4, gcs.calculateScore(Arrays.asList(input4)));
// test case from the doc
Character[] input5 = { '1', '1', '0', 'W', '1' };
int finalScore5 = 1;
Assert.assertEquals(finalScore5, gcs.calculateScore(Arrays.asList(input5)));
// test case from the doc
Character[] input6 = { '1', '0', '0', 'W' };
int finalScore6 = -3;
Assert.assertEquals(finalScore6, gcs.calculateScore(Arrays.asList(input6)));
}
}
|
UTF-8
|
Java
| 1,218 |
java
|
GaliCricketScoreboardTest.java
|
Java
|
[] | null |
[] |
package com.gcs.app;
import java.util.Arrays;
import org.junit.Assert;
import org.junit.Test;
public class GaliCricketScoreboardTest {
@Test
public void testCalculateScore() {
GaliCricketScoreboard gcs = new GaliCricketScoreboard();
Character[] input1 = { '1', '0', '0', '6', 'W' };
int finalScore1 = 3;
Assert.assertEquals(finalScore1, gcs.calculateScore(Arrays.asList(input1)));
Character[] input2 = { '1', '0', '0', '0', 'W' };
int finalScore2 = -3;
Assert.assertEquals(finalScore2, gcs.calculateScore(Arrays.asList(input2)));
Character[] input3 = { '0', '0', '0' };
int finalScore3 = -2;
Assert.assertEquals(finalScore3, gcs.calculateScore(Arrays.asList(input3)));
Character[] input4 = { 'W', 'W', 'W', 'W' };
int finalScore4 = -8;
Assert.assertEquals(finalScore4, gcs.calculateScore(Arrays.asList(input4)));
// test case from the doc
Character[] input5 = { '1', '1', '0', 'W', '1' };
int finalScore5 = 1;
Assert.assertEquals(finalScore5, gcs.calculateScore(Arrays.asList(input5)));
// test case from the doc
Character[] input6 = { '1', '0', '0', 'W' };
int finalScore6 = -3;
Assert.assertEquals(finalScore6, gcs.calculateScore(Arrays.asList(input6)));
}
}
| 1,218 | 0.669951 | 0.630542 | 42 | 28 | 26.77063 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.238095 | false | false |
12
|
6c775c105811ba16c6aa238fc0d477841df82103
| 31,525,060,021,080 |
d779bd0b4b157a1123b2d02b8838f5da86281b86
|
/spark/src/main/java/ua/com/smartjava/WordService.java
|
05f4f50f2cabf604c63a6bf10b6bd569eb94d9f6
|
[
"Apache-2.0"
] |
permissive
|
tsypuk/sandbox
|
https://github.com/tsypuk/sandbox
|
64bd4afbaef60518a1fd96dd0cdae43c639138d5
|
15ab3868c666249ad6357704fb31e3afcff4e806
|
refs/heads/master
| 2020-01-19T21:16:03.083000 | 2018-01-01T20:39:27 | 2018-01-01T20:39:27 | 94,214,373 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ua.com.smartjava;
import org.apache.spark.api.java.JavaRDD;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import scala.Serializable;
import scala.Tuple2;
public class WordService implements Serializable {
public List<String> topX(JavaRDD<String> lines, int x) {
return lines.map(String::toLowerCase)
.flatMap(this::getWords)
.mapToPair(word -> new Tuple2<>(word, 1))
.reduceByKey((key1, key2) -> key1 + key2)
.mapToPair(Tuple2::swap)
.sortByKey(false)
.map(Tuple2::_2)
.take(x);
}
public Iterator<String> getWords(String word){
return Arrays.asList(word.split(" ")).iterator();
}
}
|
UTF-8
|
Java
| 769 |
java
|
WordService.java
|
Java
|
[] | null |
[] |
package ua.com.smartjava;
import org.apache.spark.api.java.JavaRDD;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import scala.Serializable;
import scala.Tuple2;
public class WordService implements Serializable {
public List<String> topX(JavaRDD<String> lines, int x) {
return lines.map(String::toLowerCase)
.flatMap(this::getWords)
.mapToPair(word -> new Tuple2<>(word, 1))
.reduceByKey((key1, key2) -> key1 + key2)
.mapToPair(Tuple2::swap)
.sortByKey(false)
.map(Tuple2::_2)
.take(x);
}
public Iterator<String> getWords(String word){
return Arrays.asList(word.split(" ")).iterator();
}
}
| 769 | 0.605982 | 0.592978 | 28 | 26.464285 | 20.588627 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false |
12
|
e8ab3bf11725e97355c220adac615400dea48dac
| 18,554,258,762,303 |
60c2dfb80a9feeb84f4390c119f11570038634c7
|
/src/test/java/week07d02/UserImplTest.java
|
d9aae01754f0392deff38a780fecce555560aadd
|
[] |
no_license
|
gyritter/training-solutions
|
https://github.com/gyritter/training-solutions
|
21146781b760aca2022da141169942529a0d62e4
|
f4dd0bd797a54e461bab18448194d4c1893ec9ec
|
refs/heads/master
| 2023-03-13T02:53:54.957000 | 2021-03-07T18:40:18 | 2021-03-07T18:40:18 | 308,083,365 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package week07d02;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class UserImplTest {
@Test
public void userImplTest(){
UserImpl userIml= new UserImpl("Baba", "Nagy","Réka");
assertEquals("Nagy Réka", userIml.getFullName());
}
}
|
UTF-8
|
Java
| 322 |
java
|
UserImplTest.java
|
Java
|
[
{
"context": "lTest(){\n\n UserImpl userIml= new UserImpl(\"Baba\", \"Nagy\",\"Réka\");\n assertEquals(\"Nagy Réka",
"end": 235,
"score": 0.9994032979011536,
"start": 231,
"tag": "NAME",
"value": "Baba"
},
{
"context": "\n\n UserImpl userIml= new UserImpl(\"Baba\", \"Nagy\",\"Réka\");\n assertEquals(\"Nagy Réka\", userI",
"end": 243,
"score": 0.9998792409896851,
"start": 239,
"tag": "NAME",
"value": "Nagy"
},
{
"context": " UserImpl userIml= new UserImpl(\"Baba\", \"Nagy\",\"Réka\");\n assertEquals(\"Nagy Réka\", userIml.getF",
"end": 250,
"score": 0.9998509287834167,
"start": 246,
"tag": "NAME",
"value": "Réka"
},
{
"context": "mpl(\"Baba\", \"Nagy\",\"Réka\");\n assertEquals(\"Nagy Réka\", userIml.getFullName());\n }\n}\n",
"end": 285,
"score": 0.9998872876167297,
"start": 276,
"tag": "NAME",
"value": "Nagy Réka"
}
] | null |
[] |
package week07d02;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class UserImplTest {
@Test
public void userImplTest(){
UserImpl userIml= new UserImpl("Baba", "Nagy","Réka");
assertEquals("<NAME>", userIml.getFullName());
}
}
| 318 | 0.690625 | 0.678125 | 16 | 19 | 22.630178 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
12
|
8c911790d4d29d0ebf169d6b3467b449c2375956
| 22,582,938,074,377 |
961157dfd1a7d1e290bb66653ca15518b536fa9c
|
/src/java/model/Vehiculo.java
|
bdad29c414713b91422e9d925d3850fba4f6f33d
|
[] |
no_license
|
AMRPSOFT/GEORUTAS
|
https://github.com/AMRPSOFT/GEORUTAS
|
213cd4e14e4295eaa1ca34256beaa2c95fbaa8de
|
adb8d65bf3fd9184035ccada8c7d223913330ecc
|
refs/heads/master
| 2020-05-04T00:04:25.294000 | 2014-08-13T17:40:50 | 2014-08-13T17:40:50 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package model;
// Generated 6/06/2014 11:50:31 AM by Hibernate Tools 3.6.0
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
/**
* Vehiculo generated by hbm2java
*/
@Entity
@Table(name="vehiculo"
,catalog="georutas"
, uniqueConstraints = {@UniqueConstraint(columnNames="IdConductor"), @UniqueConstraint(columnNames="IdRuta")}
)
public class Vehiculo implements java.io.Serializable {
private int idvehiculo;
private Conductor conductor;
private Recorrido recorrido;
private int nroRuta;
private String placa;
private String color;
private Set recorridos = new HashSet(0);
public Vehiculo() {
this.idvehiculo = 0;
this.conductor = new Conductor();
this.recorrido = new Recorrido();
}
public Vehiculo(int idvehiculo, Conductor conductor, Recorrido recorrido, int nroRuta, String placa, String color) {
this.idvehiculo = idvehiculo;
this.conductor = conductor;
this.recorrido = recorrido;
this.nroRuta = nroRuta;
this.placa = placa;
this.color = color;
}
public Vehiculo(int idvehiculo, Conductor conductor, Recorrido recorrido, int nroRuta, String placa, String color, Set recorridos) {
this.idvehiculo = idvehiculo;
this.conductor = conductor;
this.recorrido = recorrido;
this.nroRuta = nroRuta;
this.placa = placa;
this.color = color;
this.recorridos = recorridos;
}
@Id
@Column(name="idvehiculo", unique=true, nullable=false)
public int getIdvehiculo() {
return this.idvehiculo;
}
public void setIdvehiculo(int idvehiculo) {
this.idvehiculo = idvehiculo;
}
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="IdConductor", unique=true, nullable=false)
public Conductor getConductor() {
return this.conductor;
}
public void setConductor(Conductor conductor) {
this.conductor = conductor;
}
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="IdRecorrido", unique=true, nullable=false)
public Recorrido getRecorrido() {
return recorrido;
}
public void setRecorrido(Recorrido recorrido) {
this.recorrido = recorrido;
}
@Column(name="NroRuta", nullable=false)
public int getNroRuta() {
return this.nroRuta;
}
public void setNroRuta(int nroRuta) {
this.nroRuta = nroRuta;
}
@Column(name="Placa", nullable=false, length=10)
public String getPlaca() {
return this.placa;
}
public void setPlaca(String placa) {
this.placa = placa;
}
@Column(name="Color", nullable=false, length=25)
public String getColor() {
return this.color;
}
public void setColor(String color) {
this.color = color;
}
@OneToMany(fetch=FetchType.LAZY, mappedBy="vehiculo")
public Set getRecorridos() {
return this.recorridos;
}
public void setRecorridos(Set recorridos) {
this.recorridos = recorridos;
}
}
|
UTF-8
|
Java
| 3,419 |
java
|
Vehiculo.java
|
Java
|
[] | null |
[] |
package model;
// Generated 6/06/2014 11:50:31 AM by Hibernate Tools 3.6.0
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
/**
* Vehiculo generated by hbm2java
*/
@Entity
@Table(name="vehiculo"
,catalog="georutas"
, uniqueConstraints = {@UniqueConstraint(columnNames="IdConductor"), @UniqueConstraint(columnNames="IdRuta")}
)
public class Vehiculo implements java.io.Serializable {
private int idvehiculo;
private Conductor conductor;
private Recorrido recorrido;
private int nroRuta;
private String placa;
private String color;
private Set recorridos = new HashSet(0);
public Vehiculo() {
this.idvehiculo = 0;
this.conductor = new Conductor();
this.recorrido = new Recorrido();
}
public Vehiculo(int idvehiculo, Conductor conductor, Recorrido recorrido, int nroRuta, String placa, String color) {
this.idvehiculo = idvehiculo;
this.conductor = conductor;
this.recorrido = recorrido;
this.nroRuta = nroRuta;
this.placa = placa;
this.color = color;
}
public Vehiculo(int idvehiculo, Conductor conductor, Recorrido recorrido, int nroRuta, String placa, String color, Set recorridos) {
this.idvehiculo = idvehiculo;
this.conductor = conductor;
this.recorrido = recorrido;
this.nroRuta = nroRuta;
this.placa = placa;
this.color = color;
this.recorridos = recorridos;
}
@Id
@Column(name="idvehiculo", unique=true, nullable=false)
public int getIdvehiculo() {
return this.idvehiculo;
}
public void setIdvehiculo(int idvehiculo) {
this.idvehiculo = idvehiculo;
}
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="IdConductor", unique=true, nullable=false)
public Conductor getConductor() {
return this.conductor;
}
public void setConductor(Conductor conductor) {
this.conductor = conductor;
}
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="IdRecorrido", unique=true, nullable=false)
public Recorrido getRecorrido() {
return recorrido;
}
public void setRecorrido(Recorrido recorrido) {
this.recorrido = recorrido;
}
@Column(name="NroRuta", nullable=false)
public int getNroRuta() {
return this.nroRuta;
}
public void setNroRuta(int nroRuta) {
this.nroRuta = nroRuta;
}
@Column(name="Placa", nullable=false, length=10)
public String getPlaca() {
return this.placa;
}
public void setPlaca(String placa) {
this.placa = placa;
}
@Column(name="Color", nullable=false, length=25)
public String getColor() {
return this.color;
}
public void setColor(String color) {
this.color = color;
}
@OneToMany(fetch=FetchType.LAZY, mappedBy="vehiculo")
public Set getRecorridos() {
return this.recorridos;
}
public void setRecorridos(Set recorridos) {
this.recorridos = recorridos;
}
}
| 3,419 | 0.65721 | 0.650483 | 135 | 24.311111 | 23.073303 | 136 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.562963 | false | false |
12
|
d2552ac02451821fc46b709410329214695e874e
| 11,433,202,961,093 |
6b9fb1b367cd032fa9095bab6337162478749428
|
/UniPlugin-JVerification-Android/HBuilder-HelloUniApp/app/src/main/java/com/android/HelloH5/wxapi/WXEntryActivity.java
|
827b06f16dfc2acec24d61bd2e9e055491724f82
|
[
"MIT",
"Apache-2.0"
] |
permissive
|
jpush/jverification-hbuilder-plugin
|
https://github.com/jpush/jverification-hbuilder-plugin
|
8a4235d7e45f640486735cc2a1adf4c7c6844ef9
|
e3eeb36051f871736d514e5b680046570f1a55ae
|
refs/heads/jg
| 2023-08-05T04:38:35.083000 | 2023-08-03T02:06:15 | 2023-08-03T02:06:15 | 232,708,353 | 28 | 36 |
Apache-2.0
| false | 2021-07-22T10:28:04 | 2020-01-09T02:52:41 | 2021-07-22T10:10:56 | 2021-07-22T10:28:04 | 255,181 | 23 | 28 | 1 |
JavaScript
| false | false |
package com.android.HelloH5.wxapi;
import io.dcloud.feature.oauth.weixin.AbsWXCallbackActivity;
public class WXEntryActivity extends AbsWXCallbackActivity{
}
|
UTF-8
|
Java
| 166 |
java
|
WXEntryActivity.java
|
Java
|
[] | null |
[] |
package com.android.HelloH5.wxapi;
import io.dcloud.feature.oauth.weixin.AbsWXCallbackActivity;
public class WXEntryActivity extends AbsWXCallbackActivity{
}
| 166 | 0.819277 | 0.813253 | 6 | 25.833334 | 26.934591 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
12
|
10689fa213a03d3da0e0a0c9b42c95fc754d451f
| 19,387,482,440,335 |
a8652be1fbf1d14e144d65b32bdf5b3be7e147d0
|
/WorldAR_Java/src/main/java/com/huawei/hiardemo/area/bean/DataListTree.java
|
8755ca7513e4a4907f7163d698039c2751400919
|
[] |
no_license
|
SVADemoAPP/HW_AR_DIS_DEMO
|
https://github.com/SVADemoAPP/HW_AR_DIS_DEMO
|
37097439b566e5f462e1cdea231a27eacf46e272
|
34500ebbeef987279a985fa55b05ecf16353ce6b
|
refs/heads/master
| 2020-06-22T10:43:21.371000 | 2019-07-19T05:03:10 | 2019-07-19T05:03:10 | 197,700,980 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.huawei.hiardemo.area.bean;
import java.util.List;
public class DataListTree<K, V> {
private K mGroupItem;
private List<V> mSubItem;
public DataListTree(K groupItem, List<V> subItem) {
mGroupItem = groupItem;
mSubItem = subItem;
}
public K getGroupItem() {
return mGroupItem;
}
public List<V> getSubItem() {
return mSubItem;
}
}
|
UTF-8
|
Java
| 409 |
java
|
DataListTree.java
|
Java
|
[] | null |
[] |
package com.huawei.hiardemo.area.bean;
import java.util.List;
public class DataListTree<K, V> {
private K mGroupItem;
private List<V> mSubItem;
public DataListTree(K groupItem, List<V> subItem) {
mGroupItem = groupItem;
mSubItem = subItem;
}
public K getGroupItem() {
return mGroupItem;
}
public List<V> getSubItem() {
return mSubItem;
}
}
| 409 | 0.628362 | 0.628362 | 21 | 18.476191 | 15.867364 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.47619 | false | false |
12
|
dd09eb03e0c4800b3773288c693bd8a4b60abaac
| 16,097,537,438,418 |
f91bc2b19b67581dbe167a03b7d38128fd758137
|
/Manejo-de-Archivos/ClaseArchivo/Archivo.java
|
e270bae6c4157fd29e3b930fa0c3ff60bd8d59be
|
[] |
no_license
|
Gabrielgr01/Java-Codigo-Reutilizable
|
https://github.com/Gabrielgr01/Java-Codigo-Reutilizable
|
3fb9b8a0ba212bb2627a44f888492348b9cdadb1
|
9d02445d521eabce5be20c2e4665a1433204d69d
|
refs/heads/main
| 2023-06-24T15:16:22.336000 | 2021-07-20T17:50:33 | 2021-07-20T17:50:33 | 367,952,064 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;
import java.io.FileNotFoundException;
/**
* File methods:
* canRead() -> Tests wheather file is readable or not
* canWrite() -> Tests wheather file is writable or not
* createNewFile() -> Creates an empty file
* delete() -> Deletes a file
* exists() -> Tests wheather file exists or not
* getName() -> Returns the name of the file
* getAbsolutePath() -> Returns the absolute pathname of the file
* Length() -> Returns the size of the file in bytes
* List() -> Returns the array of the file in the directory
* Mkdir() -> Creates a directory
*/
public class Archivo
{
/**
* Crea un archivo en al direccion especificada como parametro
* @param filePath = directorio del archivo (incuido el nombre)
*/
public void createFile (String filePath){
try{
File newFile = new File(filePath);
if(newFile.createNewFile()){
System.out.println("File created: "+newFile.getName());
} else {
System.out.println("File already exists.");
}
} catch (IOException e) {
System.out.println("An error occurred.");
e.printStackTrace();
}
}
/**
* Crea un archivo en al direccion especificada como parametro
* @param filePath = directorio del archivo (incuido el nombre)
*/
public void fileInformation(String filePath){
File myFile = new File(filePath);
if (myFile.exists()) {
System.out.println("File name: "+myFile.getName());
System.out.println("Absolute path: "+ myFile.getAbsolutePath());
System.out.println("Writeable: "+myFile.canWrite());
System.out.println("Readable: "+myFile.canRead());
System.out.println("File size in bytes: "+myFile.length());
} else {
System.out.println("File does not exists");
}
}
/**
* Agrega o reescribe un mensaje en un archivo
* @param msg = mensaje a escribir
* @param filePath = directorio del archivo (incuido el nombre)
* @param append = 'true' para agregar contenido al final del txt, 'false' para reescribir el contenido del txt
*/
public void writeToFile(String msg, String filePath, boolean append){
try{
FileWriter myWriter = new FileWriter(filePath, append);
myWriter.write(msg);
myWriter.close();
System.out.println("Successfully wrote to the file.");
} catch(IOException e) {
System.out.println("An error occurred.");
e.printStackTrace();
}
}
/**
* Lee el contenido del archivo especificado
* @param filePath = directorio del archivo (incuido el nombre)
*/
public String readFromFile(String filePath){
String fileData = "";
try{
File myFile = new File(filePath);
Scanner myReader = new Scanner(myFile);
while (myReader.hasNextLine()){
String data = myReader.nextLine();
fileData += data+"\n";
}
myReader.close();
} catch(FileNotFoundException e) {
System.out.println("An error occurred.");
e.printStackTrace();
}
return fileData;
}
/**
* Lee la linea especificada del archivo
* @param index = indice de la linea a leer
* @param filePath = directorio del archivo (incuido el nombre)
*/
public String readLine(int index, String filePath){
String lineData = "";
try{
File myFile = new File(filePath);
Scanner myReader = new Scanner(myFile);
for(int i = 0; i < index; i++){
myReader.nextLine();
}
lineData = myReader.nextLine();
myReader.close();
} catch(FileNotFoundException e) {
System.out.println("An error occurred.");
e.printStackTrace();
}
return lineData;
}
/**
* Elimina el archivo especificado
* @param filePath = directorio del archivo (incuido el nombre)
*/
public void deleteFile(String filePath){
File myFile = new File(filePath);
if (myFile.exists()) {
myFile.delete();
System.out.println("File successfully deleted.");
} else {
System.out.println("File does not exists");
}
}
/**
* Para probar los métodos:
**/
// public static void main (String a[]){
// String path = "ArchivoPrueba.txt";
// Archivo archivo = new Archivo();
// String fileData = "";
// //archivo.deleteFile(path);
// archivo.createFile(path);
// archivo.fileInformation(path);
// fileData = archivo.readFromFile(path);
// System.out.println(fileData);
// archivo.writeToFile("Hola mundo!", path, true);
// archivo.writeToFile("\n", path, true);
// archivo.fileInformation(path);
// fileData = archivo.readFromFile(path);
// System.out.println(fileData);
// }
}
|
UTF-8
|
Java
| 5,255 |
java
|
Archivo.java
|
Java
|
[] | null |
[] |
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;
import java.io.FileNotFoundException;
/**
* File methods:
* canRead() -> Tests wheather file is readable or not
* canWrite() -> Tests wheather file is writable or not
* createNewFile() -> Creates an empty file
* delete() -> Deletes a file
* exists() -> Tests wheather file exists or not
* getName() -> Returns the name of the file
* getAbsolutePath() -> Returns the absolute pathname of the file
* Length() -> Returns the size of the file in bytes
* List() -> Returns the array of the file in the directory
* Mkdir() -> Creates a directory
*/
public class Archivo
{
/**
* Crea un archivo en al direccion especificada como parametro
* @param filePath = directorio del archivo (incuido el nombre)
*/
public void createFile (String filePath){
try{
File newFile = new File(filePath);
if(newFile.createNewFile()){
System.out.println("File created: "+newFile.getName());
} else {
System.out.println("File already exists.");
}
} catch (IOException e) {
System.out.println("An error occurred.");
e.printStackTrace();
}
}
/**
* Crea un archivo en al direccion especificada como parametro
* @param filePath = directorio del archivo (incuido el nombre)
*/
public void fileInformation(String filePath){
File myFile = new File(filePath);
if (myFile.exists()) {
System.out.println("File name: "+myFile.getName());
System.out.println("Absolute path: "+ myFile.getAbsolutePath());
System.out.println("Writeable: "+myFile.canWrite());
System.out.println("Readable: "+myFile.canRead());
System.out.println("File size in bytes: "+myFile.length());
} else {
System.out.println("File does not exists");
}
}
/**
* Agrega o reescribe un mensaje en un archivo
* @param msg = mensaje a escribir
* @param filePath = directorio del archivo (incuido el nombre)
* @param append = 'true' para agregar contenido al final del txt, 'false' para reescribir el contenido del txt
*/
public void writeToFile(String msg, String filePath, boolean append){
try{
FileWriter myWriter = new FileWriter(filePath, append);
myWriter.write(msg);
myWriter.close();
System.out.println("Successfully wrote to the file.");
} catch(IOException e) {
System.out.println("An error occurred.");
e.printStackTrace();
}
}
/**
* Lee el contenido del archivo especificado
* @param filePath = directorio del archivo (incuido el nombre)
*/
public String readFromFile(String filePath){
String fileData = "";
try{
File myFile = new File(filePath);
Scanner myReader = new Scanner(myFile);
while (myReader.hasNextLine()){
String data = myReader.nextLine();
fileData += data+"\n";
}
myReader.close();
} catch(FileNotFoundException e) {
System.out.println("An error occurred.");
e.printStackTrace();
}
return fileData;
}
/**
* Lee la linea especificada del archivo
* @param index = indice de la linea a leer
* @param filePath = directorio del archivo (incuido el nombre)
*/
public String readLine(int index, String filePath){
String lineData = "";
try{
File myFile = new File(filePath);
Scanner myReader = new Scanner(myFile);
for(int i = 0; i < index; i++){
myReader.nextLine();
}
lineData = myReader.nextLine();
myReader.close();
} catch(FileNotFoundException e) {
System.out.println("An error occurred.");
e.printStackTrace();
}
return lineData;
}
/**
* Elimina el archivo especificado
* @param filePath = directorio del archivo (incuido el nombre)
*/
public void deleteFile(String filePath){
File myFile = new File(filePath);
if (myFile.exists()) {
myFile.delete();
System.out.println("File successfully deleted.");
} else {
System.out.println("File does not exists");
}
}
/**
* Para probar los métodos:
**/
// public static void main (String a[]){
// String path = "ArchivoPrueba.txt";
// Archivo archivo = new Archivo();
// String fileData = "";
// //archivo.deleteFile(path);
// archivo.createFile(path);
// archivo.fileInformation(path);
// fileData = archivo.readFromFile(path);
// System.out.println(fileData);
// archivo.writeToFile("Hola mundo!", path, true);
// archivo.writeToFile("\n", path, true);
// archivo.fileInformation(path);
// fileData = archivo.readFromFile(path);
// System.out.println(fileData);
// }
}
| 5,255 | 0.574229 | 0.574039 | 155 | 32.896774 | 22.328392 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.445161 | false | false |
12
|
08ea8ba5eb7c3de69218388087a494ed2ad4dc3e
| 17,729,625,040,252 |
27fba7f05a3788948d01311f1156b6fd77486c2f
|
/src/main/java/com/revature/services/CacheService.java
|
994156143ce76e559067d429522d2022f6ae7426
|
[] |
no_license
|
jaenwawe/hibernatePractice
|
https://github.com/jaenwawe/hibernatePractice
|
30cb6fcd2b7700816a25420b4c54d58d85748740
|
6d1f93d57f04619e830a64d2d3ed147ddffe35f3
|
refs/heads/master
| 2022-12-01T17:01:19.194000 | 2019-08-10T20:07:21 | 2019-08-10T20:07:21 | 201,675,752 | 0 | 0 | null | false | 2022-11-24T09:51:36 | 2019-08-10T19:46:20 | 2019-08-10T20:07:33 | 2022-11-24T09:51:33 | 12 | 0 | 0 | 2 |
Java
| false | false |
package com.revature.services;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import com.revature.entities.Professor;
public class CacheService {
SessionFactory sessionFactory;
public CacheService(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
/**
* L1 Cache - (Level 1 Cache)
* The basic cache built into Hibernate. The L1 cache is associated
* with the Session object and caches data within the scope of a Session.
* This data is cached for the lifecycle of the Session object for which
* it originated.
*
* This is essential hibernate behavior. It cannot be disabled, and there
* is no way to use Hibernate without it.
*/
public void testingTheL1Cache() {
Professor professora = null;
try(Session session = sessionFactory.openSession()) {
professora = session.get(Professor.class, 5);
Professor professorb = session.get(Professor.class, 5);
Professor professorc = session.load(Professor.class, 5);
Professor professord = session.get(Professor.class, 5);
System.out.println(professora != null);
System.out.println(professorb != null);
System.out.println(professorc != null);
System.out.println(professord != null);
// System.out.println(professora.equals(professorb));
System.out.println(professora == professorc);
}
try(Session session = sessionFactory.openSession()) {
Professor newProfessor = session.get(Professor.class, 5);
System.out.println(professora == newProfessor);
}
}
}
|
UTF-8
|
Java
| 1,526 |
java
|
CacheService.java
|
Java
|
[] | null |
[] |
package com.revature.services;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import com.revature.entities.Professor;
public class CacheService {
SessionFactory sessionFactory;
public CacheService(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
/**
* L1 Cache - (Level 1 Cache)
* The basic cache built into Hibernate. The L1 cache is associated
* with the Session object and caches data within the scope of a Session.
* This data is cached for the lifecycle of the Session object for which
* it originated.
*
* This is essential hibernate behavior. It cannot be disabled, and there
* is no way to use Hibernate without it.
*/
public void testingTheL1Cache() {
Professor professora = null;
try(Session session = sessionFactory.openSession()) {
professora = session.get(Professor.class, 5);
Professor professorb = session.get(Professor.class, 5);
Professor professorc = session.load(Professor.class, 5);
Professor professord = session.get(Professor.class, 5);
System.out.println(professora != null);
System.out.println(professorb != null);
System.out.println(professorc != null);
System.out.println(professord != null);
// System.out.println(professora.equals(professorb));
System.out.println(professora == professorc);
}
try(Session session = sessionFactory.openSession()) {
Professor newProfessor = session.get(Professor.class, 5);
System.out.println(professora == newProfessor);
}
}
}
| 1,526 | 0.730668 | 0.724771 | 49 | 30.142857 | 24.450701 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.040816 | false | false |
12
|
3548cb98a9f203488674e547c71e60dcd6c63893
| 33,217,277,095,948 |
e047870136e1958ce80dad88fa931304ada49a1b
|
/eu.cessar.ct.runtime.ecuc/src/eu/cessar/ct/runtime/ecuc/internal/sea/util/SeaActiveConfigurationManager.java
|
a334a11f842060297a19418a5669ad39bef26c48
|
[] |
no_license
|
ONagaty/SEA-ModellAR
|
https://github.com/ONagaty/SEA-ModellAR
|
f4994a628459a20b9be7af95d41d5e0ff8a21f77
|
a0f6bdbb072503ea584d72f872f29a20ea98ade5
|
refs/heads/main
| 2023-06-04T07:07:02.900000 | 2021-06-19T20:54:47 | 2021-06-19T20:54:47 | 376,735,297 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* <copyright>
*
* Copyright (c) Continental Engineering Services and others.<br/>
* http://www.conti-engineering.com All rights reserved.
*
* File created by uidl6870<br/>
* Feb 3, 2014 11:15:42 AM
*
* </copyright>
*/
package eu.cessar.ct.runtime.ecuc.internal.sea.util;
import org.eclipse.emf.ecore.resource.Resource;
import eu.cessar.ct.sdk.sea.ISEAConfig;
import gautosar.gecucdescription.GModuleConfiguration;
/**
* Keeps track of the global active configuration per {@link ISEAConfig} and the temporary active one.
*
* @author uidl6870
*
* %created_by: uidl6870 %
*
* %date_created: Tue Feb 4 18:08:00 2014 %
*
* %version: 1 %
*/
public final class SeaActiveConfigurationManager
{
/** the singleton */
public static final SeaActiveConfigurationManager INSTANCE = new SeaActiveConfigurationManager();
private Resource temporaryActiveResource;
private final ThreadLocal<ActiveConfigurationCache> activeConfigurationCacheThreadLocal = new ThreadLocal<ActiveConfigurationCache>()
{
@Override
protected ActiveConfigurationCache initialValue()
{
return new ActiveConfigurationCache();
}
};
/**
* @param seaConfig
* @return the global active configuration for the given SEA configuration wrapper, could be <code>null</code>
*/
public GModuleConfiguration getGlobalActiveConfiguration(ISEAConfig seaConfig)
{
return activeConfigurationCacheThreadLocal.get().getActiveConfiguration(seaConfig);
}
/**
* Sets the active configuration of <code>seaConfig</code> to <code>activeConfiguration</code>
*
* @param seaConfig
* @param activeConfiguration
* the active configuration to be set, could be <code>null</code>
*/
public void setGlobalActiveConfiguration(ISEAConfig seaConfig, GModuleConfiguration activeConfiguration)
{
activeConfigurationCacheThreadLocal.get().setActiveConfiguration(seaConfig, activeConfiguration);
}
/**
* Sets the new temporary resource. It is called within setter/create methods implementation that accept an
* additional parameter for specifying the active configuration/container.
*
* @param tempActiveResource
* the new temporary resource, could be <code>null</code>
*/
public void setTemporaryActiveResource(Resource tempActiveResource)
{
temporaryActiveResource = tempActiveResource;
}
/**
* Returns the temporary active resource
*
* @return the temporary active resource
*/
public Resource getTemporaryActiveResource()
{
return temporaryActiveResource;
}
/**
* Returns the current temporary active resource if configured, otherwise returns the global active resource for the
* specified <code>seaConfig</code>.
*
* @param seaConfig
* the {@link ISEAConfig} for which the active resource is requested
* @return the active resource to be used, could be <code>null</code>
*/
public Resource getActualActiveResource(ISEAConfig seaConfig)
{
if (temporaryActiveResource != null)
{
return temporaryActiveResource;
}
else
{
GModuleConfiguration globalActiveConfiguration = getGlobalActiveConfiguration(seaConfig);
if (globalActiveConfiguration != null)
{
return globalActiveConfiguration.eResource();
}
}
return null;
}
}
|
UTF-8
|
Java
| 3,258 |
java
|
SeaActiveConfigurationManager.java
|
Java
|
[
{
"context": "ng.com All rights reserved.\n * \n * File created by uidl6870<br/>\n * Feb 3, 2014 11:15:42 AM\n * \n * </copyrigh",
"end": 178,
"score": 0.9996657967567444,
"start": 170,
"tag": "USERNAME",
"value": "uidl6870"
},
{
"context": "nfig} and the temporary active one.\n * \n * @author uidl6870\n * \n * %created_by: uidl6870 %\n * \n * ",
"end": 564,
"score": 0.9996395111083984,
"start": 556,
"tag": "USERNAME",
"value": "uidl6870"
},
{
"context": "* \n * @author uidl6870\n * \n * %created_by: uidl6870 %\n * \n * %date_created: Tue Feb 4 18:08:0",
"end": 601,
"score": 0.9994248747825623,
"start": 593,
"tag": "USERNAME",
"value": "uidl6870"
}
] | null |
[] |
/**
* <copyright>
*
* Copyright (c) Continental Engineering Services and others.<br/>
* http://www.conti-engineering.com All rights reserved.
*
* File created by uidl6870<br/>
* Feb 3, 2014 11:15:42 AM
*
* </copyright>
*/
package eu.cessar.ct.runtime.ecuc.internal.sea.util;
import org.eclipse.emf.ecore.resource.Resource;
import eu.cessar.ct.sdk.sea.ISEAConfig;
import gautosar.gecucdescription.GModuleConfiguration;
/**
* Keeps track of the global active configuration per {@link ISEAConfig} and the temporary active one.
*
* @author uidl6870
*
* %created_by: uidl6870 %
*
* %date_created: Tue Feb 4 18:08:00 2014 %
*
* %version: 1 %
*/
public final class SeaActiveConfigurationManager
{
/** the singleton */
public static final SeaActiveConfigurationManager INSTANCE = new SeaActiveConfigurationManager();
private Resource temporaryActiveResource;
private final ThreadLocal<ActiveConfigurationCache> activeConfigurationCacheThreadLocal = new ThreadLocal<ActiveConfigurationCache>()
{
@Override
protected ActiveConfigurationCache initialValue()
{
return new ActiveConfigurationCache();
}
};
/**
* @param seaConfig
* @return the global active configuration for the given SEA configuration wrapper, could be <code>null</code>
*/
public GModuleConfiguration getGlobalActiveConfiguration(ISEAConfig seaConfig)
{
return activeConfigurationCacheThreadLocal.get().getActiveConfiguration(seaConfig);
}
/**
* Sets the active configuration of <code>seaConfig</code> to <code>activeConfiguration</code>
*
* @param seaConfig
* @param activeConfiguration
* the active configuration to be set, could be <code>null</code>
*/
public void setGlobalActiveConfiguration(ISEAConfig seaConfig, GModuleConfiguration activeConfiguration)
{
activeConfigurationCacheThreadLocal.get().setActiveConfiguration(seaConfig, activeConfiguration);
}
/**
* Sets the new temporary resource. It is called within setter/create methods implementation that accept an
* additional parameter for specifying the active configuration/container.
*
* @param tempActiveResource
* the new temporary resource, could be <code>null</code>
*/
public void setTemporaryActiveResource(Resource tempActiveResource)
{
temporaryActiveResource = tempActiveResource;
}
/**
* Returns the temporary active resource
*
* @return the temporary active resource
*/
public Resource getTemporaryActiveResource()
{
return temporaryActiveResource;
}
/**
* Returns the current temporary active resource if configured, otherwise returns the global active resource for the
* specified <code>seaConfig</code>.
*
* @param seaConfig
* the {@link ISEAConfig} for which the active resource is requested
* @return the active resource to be used, could be <code>null</code>
*/
public Resource getActualActiveResource(ISEAConfig seaConfig)
{
if (temporaryActiveResource != null)
{
return temporaryActiveResource;
}
else
{
GModuleConfiguration globalActiveConfiguration = getGlobalActiveConfiguration(seaConfig);
if (globalActiveConfiguration != null)
{
return globalActiveConfiguration.eResource();
}
}
return null;
}
}
| 3,258 | 0.742173 | 0.73143 | 114 | 27.578947 | 33.505142 | 134 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.122807 | false | false |
12
|
70f6c42180a4cc33ccf05045998e91c2303a4e8b
| 120,259,117,920 |
ae02d11f7579153760bebe50eab2e09bcc6d0e99
|
/src/JavaStartZadania/Zad26_Lottery.java
|
6df6fd4fd2aabf1f5d9f68b3ec504d22b4613804
|
[] |
no_license
|
kt1313/JavaStartZadania
|
https://github.com/kt1313/JavaStartZadania
|
881a90b2cd5ddbcd0a7ce6edc1c33e306b477605
|
ef6a3f00f3806012e4c0f20d0708cf1b8ca6bf3b
|
refs/heads/master
| 2023-01-04T16:08:47.692000 | 2020-10-31T03:38:36 | 2020-10-31T03:38:36 | 295,332,316 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package JavaStartZadania;
import java.io.*;
import java.util.*;
import java.util.stream.Collectors;
public class Zad26_Lottery {
static List<String> numbersAsStringsArray = new ArrayList<>();
static List<Integer> numbersArray = new ArrayList<>();
static List<String> megaballAsStringArray = new ArrayList<>();
static List<Integer> megaballArray = new ArrayList<>();
static SortedSet<Map.Entry<Integer, Integer>> sortedset = new TreeSet<Map.Entry<Integer, Integer>>(
new Comparator<Map.Entry<Integer, Integer>>() {
@Override
public int compare(Map.Entry<Integer, Integer> e2,
Map.Entry<Integer, Integer> e1) {
return e1.getValue().compareTo(e2.getValue());
}
});
public static void main(String[] args) {
final String fileName = "C:\\Users\\Dell\\IdeaProjects\\JavaStartZadania\\src\\Lottery.csv";
try (Scanner sc = new Scanner(new File(fileName))) {
sc.nextLine();
while (sc.hasNextLine()) {
//trpochę koślawo
//czyta plik dopoki nie napotka pustej linii
//dzieli zczytana linie na czesci i wstawia je odpowiednio do tablicy numerow i megaball
String line = sc.nextLine();
String[] splittedLine = line.split(",");
int posOfNumbers = 1;
//System.out.println(splittedLine[posOfNumbers]);
numbersAsStringsArray.add(splittedLine[posOfNumbers]);
System.out.println(splittedLine[posOfNumbers + 1]);
megaballAsStringArray.add(splittedLine[posOfNumbers + 1]);
}
//zamienia na Integery
numbersArray = splitAndChangeStringArrayToInteger(numbersAsStringsArray);
megaballArray = splitAndChangeStringArrayToInteger(megaballAsStringArray);
convertToHashTree(numbersArray);
System.out.println("tablica numerow malejaco: "+ sortedset.stream().limit(10).collect(Collectors.toList()));
convertToHashTree(megaballArray);
System.out.println("tablica megaballi malejaco"+sortedset.stream().limit(3).collect(Collectors.toList()));
} catch (
FileNotFoundException e) {
System.err.println("Brak pliku " + fileName);
}
}
static ArrayList<Integer> splitAndChangeStringArrayToInteger(List<String> stringArray) {
int iterationLimit = 5;
if (stringArray.equals(megaballAsStringArray)) {
iterationLimit = 1;
}
ArrayList<Integer> numbersArray = new ArrayList<>();
Integer[] singleNumbers;
for (String s : stringArray
) {
singleNumbers = new Integer[iterationLimit];
for (int i = 0; i < iterationLimit; i++) {
String[] line = s.split(" ");
singleNumbers[i] = (Integer.parseInt(line[i]));
//tu tworzy numbersArray
numbersArray.add(singleNumbers[i]);
}
}
return numbersArray;
}
private static void convertToHashTree(List<Integer> integerArray) {
SortedMap<Integer, Integer> numbersTreeMap = new TreeMap<Integer, Integer>();
if (integerArray.equals(megaballArray)) {
numbersTreeMap.clear();
sortedset.clear();
}
for (Integer number : integerArray
) {
int v = Collections.frequency(integerArray, number);
if (numbersTreeMap != null && !numbersTreeMap.containsKey(number)) {
numbersTreeMap.put(number, v);
}else if(numbersTreeMap == null){numbersTreeMap.put(number, v);
}
}
sortedset.addAll(numbersTreeMap.entrySet());
}
}
// Można by tutaj wykorzystać także bardziej współczesne podejście w oparciu o strumienie.
// W takim przypadku moglibyśmy wykorzystać BufferedReadera.
// List<Result> readResultsFromFile(String fileName) throws IOException {
// List<Result> results = new ArrayList<>();
// var fileReader = new FileReader(fileName);
// var bufferedReader = new BufferedReader(fileReader);
// bufferedReader.readLine(); //pomijamy nagłówek pliku
// return bufferedReader.lines()
// .map(Result::fromCsv)
// .collect(Collectors.toList());
// }
|
UTF-8
|
Java
| 4,468 |
java
|
Zad26_Lottery.java
|
Java
|
[
{
"context": "gs) {\n final String fileName = \"C:\\\\Users\\\\Dell\\\\IdeaProjects\\\\JavaStartZadania\\\\src\\\\Lottery.csv",
"end": 906,
"score": 0.9958032369613647,
"start": 902,
"tag": "NAME",
"value": "Dell"
}
] | null |
[] |
package JavaStartZadania;
import java.io.*;
import java.util.*;
import java.util.stream.Collectors;
public class Zad26_Lottery {
static List<String> numbersAsStringsArray = new ArrayList<>();
static List<Integer> numbersArray = new ArrayList<>();
static List<String> megaballAsStringArray = new ArrayList<>();
static List<Integer> megaballArray = new ArrayList<>();
static SortedSet<Map.Entry<Integer, Integer>> sortedset = new TreeSet<Map.Entry<Integer, Integer>>(
new Comparator<Map.Entry<Integer, Integer>>() {
@Override
public int compare(Map.Entry<Integer, Integer> e2,
Map.Entry<Integer, Integer> e1) {
return e1.getValue().compareTo(e2.getValue());
}
});
public static void main(String[] args) {
final String fileName = "C:\\Users\\Dell\\IdeaProjects\\JavaStartZadania\\src\\Lottery.csv";
try (Scanner sc = new Scanner(new File(fileName))) {
sc.nextLine();
while (sc.hasNextLine()) {
//trpochę koślawo
//czyta plik dopoki nie napotka pustej linii
//dzieli zczytana linie na czesci i wstawia je odpowiednio do tablicy numerow i megaball
String line = sc.nextLine();
String[] splittedLine = line.split(",");
int posOfNumbers = 1;
//System.out.println(splittedLine[posOfNumbers]);
numbersAsStringsArray.add(splittedLine[posOfNumbers]);
System.out.println(splittedLine[posOfNumbers + 1]);
megaballAsStringArray.add(splittedLine[posOfNumbers + 1]);
}
//zamienia na Integery
numbersArray = splitAndChangeStringArrayToInteger(numbersAsStringsArray);
megaballArray = splitAndChangeStringArrayToInteger(megaballAsStringArray);
convertToHashTree(numbersArray);
System.out.println("tablica numerow malejaco: "+ sortedset.stream().limit(10).collect(Collectors.toList()));
convertToHashTree(megaballArray);
System.out.println("tablica megaballi malejaco"+sortedset.stream().limit(3).collect(Collectors.toList()));
} catch (
FileNotFoundException e) {
System.err.println("Brak pliku " + fileName);
}
}
static ArrayList<Integer> splitAndChangeStringArrayToInteger(List<String> stringArray) {
int iterationLimit = 5;
if (stringArray.equals(megaballAsStringArray)) {
iterationLimit = 1;
}
ArrayList<Integer> numbersArray = new ArrayList<>();
Integer[] singleNumbers;
for (String s : stringArray
) {
singleNumbers = new Integer[iterationLimit];
for (int i = 0; i < iterationLimit; i++) {
String[] line = s.split(" ");
singleNumbers[i] = (Integer.parseInt(line[i]));
//tu tworzy numbersArray
numbersArray.add(singleNumbers[i]);
}
}
return numbersArray;
}
private static void convertToHashTree(List<Integer> integerArray) {
SortedMap<Integer, Integer> numbersTreeMap = new TreeMap<Integer, Integer>();
if (integerArray.equals(megaballArray)) {
numbersTreeMap.clear();
sortedset.clear();
}
for (Integer number : integerArray
) {
int v = Collections.frequency(integerArray, number);
if (numbersTreeMap != null && !numbersTreeMap.containsKey(number)) {
numbersTreeMap.put(number, v);
}else if(numbersTreeMap == null){numbersTreeMap.put(number, v);
}
}
sortedset.addAll(numbersTreeMap.entrySet());
}
}
// Można by tutaj wykorzystać także bardziej współczesne podejście w oparciu o strumienie.
// W takim przypadku moglibyśmy wykorzystać BufferedReadera.
// List<Result> readResultsFromFile(String fileName) throws IOException {
// List<Result> results = new ArrayList<>();
// var fileReader = new FileReader(fileName);
// var bufferedReader = new BufferedReader(fileReader);
// bufferedReader.readLine(); //pomijamy nagłówek pliku
// return bufferedReader.lines()
// .map(Result::fromCsv)
// .collect(Collectors.toList());
// }
| 4,468 | 0.604578 | 0.601212 | 104 | 41.817307 | 29.885283 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.586538 | false | false |
12
|
cd523f6fbc34f0cacb7244c1ffce3a6475cecf84
| 11,106,785,442,948 |
b95297f8aa41b604c178072142d39774be9ecae3
|
/src/main/java/com/sucukagaci/Driver.java
|
73610e06cee28fc155ee4d16876332c2a0ccb6e8
|
[] |
no_license
|
sucukAgaci/SucukAgaciBackend
|
https://github.com/sucukAgaci/SucukAgaciBackend
|
f6ce5fde9d3ae873c421edd39c937d15bdd18611
|
351ae85eeaa9c5f153eadb340e5817accc0a022d
|
refs/heads/master
| 2020-03-13T17:13:56.035000 | 2018-04-26T22:56:24 | 2018-04-26T22:56:24 | 131,213,497 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.sucukagaci;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
*
* @author umurgogebakan
*/
public class Driver implements Serializable {
private User usr;
private List<Vehicle> vehicles = new ArrayList<>();
public Driver(User usr) {
this.usr = usr;
}
public Driver() {
}
public User getUsr() {
return usr;
}
public void setUsr(User usr) {
this.usr = usr;
}
public List<Vehicle> getVehicles() {
ArrayList<Vehicle> x = new ArrayList<>();
x.addAll(vehicles);
return x;
}
public void setVehicles(List<Vehicle> vehicles) {
this.vehicles.addAll(vehicles);
}
@Override
public int hashCode() {
int hash = 3;
hash = 29 * hash + Objects.hashCode(this.usr);
hash = 29 * hash + Objects.hashCode(this.vehicles);
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Driver other = (Driver) obj;
if (!Objects.equals(this.usr, other.usr)) {
return false;
}
if (!Objects.equals(this.vehicles, other.vehicles)) {
return false;
}
return true;
}
@Override
public String toString() {
return "Driver{" + "usr=" + usr + ", vehicles=" + vehicles + '}';
}
}
|
UTF-8
|
Java
| 1,798 |
java
|
Driver.java
|
Java
|
[
{
"context": "List;\nimport java.util.Objects;\n\n/**\n *\n * @author umurgogebakan\n */\npublic class Driver implements Serializable {",
"end": 348,
"score": 0.9994028806686401,
"start": 335,
"tag": "USERNAME",
"value": "umurgogebakan"
}
] | null |
[] |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.sucukagaci;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
*
* @author umurgogebakan
*/
public class Driver implements Serializable {
private User usr;
private List<Vehicle> vehicles = new ArrayList<>();
public Driver(User usr) {
this.usr = usr;
}
public Driver() {
}
public User getUsr() {
return usr;
}
public void setUsr(User usr) {
this.usr = usr;
}
public List<Vehicle> getVehicles() {
ArrayList<Vehicle> x = new ArrayList<>();
x.addAll(vehicles);
return x;
}
public void setVehicles(List<Vehicle> vehicles) {
this.vehicles.addAll(vehicles);
}
@Override
public int hashCode() {
int hash = 3;
hash = 29 * hash + Objects.hashCode(this.usr);
hash = 29 * hash + Objects.hashCode(this.vehicles);
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Driver other = (Driver) obj;
if (!Objects.equals(this.usr, other.usr)) {
return false;
}
if (!Objects.equals(this.vehicles, other.vehicles)) {
return false;
}
return true;
}
@Override
public String toString() {
return "Driver{" + "usr=" + usr + ", vehicles=" + vehicles + '}';
}
}
| 1,798 | 0.558954 | 0.556174 | 82 | 20.926828 | 19.095894 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.390244 | false | false |
12
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.