blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 131 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6280eb9e1462ae4a597fc7eefb0b69693b8347ca | aca36ea88be798ede3e9f9c96daf94e8d5a2269b | /app/src/main/java/com/liangjing/greendao3/dao/StudentDao.java | 7d4121f44b140a3d3b62a6690220965f7106bd4d | [] | no_license | weileng11/GreenDao3Test-master | 12e9d84f415e7362fbd97043d5301ef8ef322ba8 | 62d41dce3abb90d24919ccbfb11402f9140921e4 | refs/heads/master | 2021-01-22T23:57:57.719270 | 2017-09-05T03:37:41 | 2017-09-05T03:37:41 | 102,430,160 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,407 | java | package com.liangjing.greendao3.dao;
import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;
import com.liangjing.greendao3.entity.Student;
import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;
import org.greenrobot.greendao.internal.DaoConfig;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table "STUDENT".
*/
public class StudentDao extends AbstractDao<Student, Long> {
public static final String TABLENAME = "STUDENT";
/**
* Properties of entity Student.<br/>
* Can be used for QueryBuilder and for referencing column names.
*/
public static class Properties {
public final static Property Id = new Property(0, Long.class, "id", true, "_id");
public final static Property Name = new Property(1, String.class, "name", false, "NAME");
public final static Property Age = new Property(2, String.class, "age", false, "AGE");
public final static Property Number = new Property(3, String.class, "number", false, "NUMBER");
public final static Property Score = new Property(4, String.class, "score", false, "SCORE");
}
public StudentDao(DaoConfig config) {
super(config);
}
public StudentDao(DaoConfig config, DaoSession daoSession) {
super(config, daoSession);
}
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
String constraint = ifNotExists? "IF NOT EXISTS ": "";
db.execSQL("CREATE TABLE " + constraint + "\"STUDENT\" (" + //
"\"_id\" INTEGER PRIMARY KEY ," + // 0: id
"\"NAME\" TEXT," + // 1: name
"\"AGE\" TEXT," + // 2: age
"\"NUMBER\" TEXT," + // 3: number
"\"SCORE\" TEXT);"); // 4: score
}
/** Drops the underlying database table. */
public static void dropTable(Database db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"STUDENT\"";
db.execSQL(sql);
}
@Override
protected final void bindValues(DatabaseStatement stmt, Student entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
String name = entity.getName();
if (name != null) {
stmt.bindString(2, name);
}
String age = entity.getAge();
if (age != null) {
stmt.bindString(3, age);
}
String number = entity.getNumber();
if (number != null) {
stmt.bindString(4, number);
}
String score = entity.getScore();
if (score != null) {
stmt.bindString(5, score);
}
}
@Override
protected final void bindValues(SQLiteStatement stmt, Student entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
String name = entity.getName();
if (name != null) {
stmt.bindString(2, name);
}
String age = entity.getAge();
if (age != null) {
stmt.bindString(3, age);
}
String number = entity.getNumber();
if (number != null) {
stmt.bindString(4, number);
}
String score = entity.getScore();
if (score != null) {
stmt.bindString(5, score);
}
}
@Override
public Long readKey(Cursor cursor, int offset) {
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
}
@Override
public Student readEntity(Cursor cursor, int offset) {
Student entity = new Student( //
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // name
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // age
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // number
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4) // score
);
return entity;
}
@Override
public void readEntity(Cursor cursor, Student entity, int offset) {
entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
entity.setName(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
entity.setAge(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
entity.setNumber(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
entity.setScore(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
}
@Override
protected final Long updateKeyAfterInsert(Student entity, long rowId) {
entity.setId(rowId);
return rowId;
}
@Override
public Long getKey(Student entity) {
if(entity != null) {
return entity.getId();
} else {
return null;
}
}
@Override
public boolean hasKey(Student entity) {
return entity.getId() != null;
}
@Override
protected final boolean isEntityUpdateable() {
return true;
}
}
| [
"275762645@qq.com"
] | 275762645@qq.com |
4063b74cb0f4cfcd3a4fb6fb7fa2d1c37a0a2045 | 49aafc8e02a2ed6e13f1cf630b8ebc0273b601d1 | /src/produto/model/Produto.java | 0c73475b35ba5d64fa86ea6ba0e3b96f514bcc44 | [] | no_license | jpsouza31/Comanda-Virtual | ed39c875e627a6e235a461022dd4bd06225d1015 | b8871a8572ca7d48e51b6069f6f29114bbeeb4cb | refs/heads/master | 2022-12-23T23:18:33.414926 | 2020-09-25T17:25:18 | 2020-09-25T17:25:18 | 188,311,747 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,187 | java | package produto.model;
import produto.dao.ProdutoDAO;
import java.util.List;
public class Produto {
private Integer id;
private String nome;
private Float preco;
private Integer desconto;
public void save(){
try {
ProdutoDAO.save(this);
System.out.println("Produto '"+ this.getNome() +"' inserido com sucesso!");
} catch (Exception e) {
e.printStackTrace();
}
}
public void update(){
try {
ProdutoDAO.updateProduto(this);
System.out.println("Produto '"+ this.getNome() +"' atualizado com sucesso!");
} catch (Exception e) {
e.printStackTrace();
}
}
public static void deleteById(Integer id){
try {
ProdutoDAO.removeById(Produto.findById(id).getId());
System.out.println("Produto excluido com sucesso!");
} catch (Exception e) {
e.printStackTrace();
}
}
public static Produto findById(Integer id){
return ProdutoDAO.getById(id);
}
public static void listarProdutos(){
List<Produto> produtos = ProdutoDAO.getProdutos();
if(produtos.isEmpty()){
System.out.println("Nenhum produto cadastrado!");
}else{
System.out.println("ID Nome Preco Desconto");
for(Produto produto: produtos){
System.out.println(produto.getId() +
" " + produto.getNome() + " " +
produto.getPreco() + " " + produto.getDesconto());
}
}
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public Float getPreco() {
return preco;
}
public void setPreco(Float preco) {
this.preco = preco;
}
public Integer getDesconto() {
return desconto;
}
public void setDesconto(Integer desconto) {
this.desconto = desconto;
}
}
| [
"jpsouza31@yahoo.com.br"
] | jpsouza31@yahoo.com.br |
5a996a4898a3e356f7d8a9ec5060415cfdb89a3a | 168f53cfdd6c9194c115d64eb6ad219089e95c88 | /util/src/main/java/cl/util/file/sorter/FileSorterUtils.java | ff014f38c0b34555ac3a3bdeec176303334c7581 | [
"MIT"
] | permissive | vmazheru/codeless | f90a94d2b908b077209ce32a75945b794b7e155e | 1eb0f998b4b8065760acc490992c1f88d8b808c2 | refs/heads/master | 2021-05-01T14:03:42.567697 | 2018-01-22T19:38:19 | 2018-01-22T19:38:19 | 55,106,765 | 1 | 0 | null | 2018-01-20T17:23:53 | 2016-03-31T00:15:29 | Java | UTF-8 | Java | false | false | 468 | java | package cl.util.file.sorter;
import static cl.core.decorator.exception.ExceptionDecorators.*;
import java.io.File;
import java.util.function.BiConsumer;
import cl.core.util.FileUtils;
class FileSorterUtils {
static void withTempFile(File original, BiConsumer<File, File> f) {
File sortedFile = uncheck(() -> File.createTempFile("tmp", "_sorted"));
f.accept(original, sortedFile);
FileUtils.moveFile(sortedFile, original);
}
}
| [
"v_mazheru@yahoo.com"
] | v_mazheru@yahoo.com |
08d1c33eec7306ed30327d75c05429a8f18b0aa9 | 0bb0ec8b68ba9de7bd5e6cfd2540f50e7acdfcab | /Tutorial 07/tutorial-07/src/main/java/com/apap/tu07/service/FlightServiceImpl.java | ea2755831c7679c66dcc82e7117a568d89942299 | [] | no_license | agungtrsn/tutorial-07 | 584ffc04799ff7cc7b97e9a129b4b8f8cb18ada0 | 154885490f82664d899597d686638849d5522119 | refs/heads/master | 2021-05-17T02:39:46.370976 | 2020-03-27T16:15:43 | 2020-03-27T16:15:43 | 250,580,229 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,477 | java | package com.apap.tu07.service;
import java.util.Optional;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.apap.tu07.model.FlightModel;
import com.apap.tu07.repository.FlightDb;
/**
* FlightServiceImpl
*/
@Service
@Transactional
public class FlightServiceImpl implements FlightService {
@Autowired
private FlightDb flightDb;
@Override
public FlightModel addFlight(FlightModel flight) {
return flightDb.save(flight);
}
@Override
public void deleteByFlightNumber(String flightNumber) {
flightDb.deleteByFlightNumber(flightNumber);
}
@Override
public Optional<FlightModel> getFlightDetailByFlightNumber(String flightNumber) {
return flightDb.findByFlightNumber(flightNumber);
}
@Override
public List<FlightModel> getAllFlight() {
return flightDb.findAll();
}
@Override
public Optional<FlightModel> getFlightById(long id) {
return flightDb.findById(id);
}
@Override
public void deleteFlight(FlightModel flight) {
flightDb.delete(flight);
}
@Override
public void updateFlight(long flightId, FlightModel newFlight) {
FlightModel flight = this.getFlightById(flightId).get();
flight.setDestination(newFlight.getDestination());
flight.setOrigin(newFlight.getOrigin());
flight.setTime(newFlight.getTime());
}
}
| [
"agungtresna@yahoo.com"
] | agungtresna@yahoo.com |
34ca18dec1bf76031e13406c20cbc14a35fa2a18 | 280c457794b9198f217b5871e448e8368e67c22f | /zookeeper-monitor/src/main/java/com/flynn/zk/tab/ServerTab.java | 39d3eb7d67b952557393773015fbfdd32e0d40a4 | [] | no_license | chesterfyh/zookeeper-monitor | 91f1419d1d744cbe871c995212014ff302ecf2b9 | 494db3da282afe9dc35dc0155a0f2774f17de513 | refs/heads/master | 2021-07-13T12:09:44.238188 | 2019-09-29T04:53:48 | 2019-09-29T04:53:48 | 211,593,156 | 0 | 0 | null | 2020-10-13T16:22:17 | 2019-09-29T02:52:03 | Java | UTF-8 | Java | false | false | 2,311 | java | package com.flynn.zk.tab;
import java.awt.BorderLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.IOException;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import com.flynn.zk.AppWin;
/**
* 服务器选择卡
* @author flynn.fan
*
*/
public class ServerTab extends JPanel {
private static final long serialVersionUID = 2585010211027719716L;
private JTextField address;
public ServerTab() {
super(new BorderLayout());
JPanel inJPanel = new JPanel(null);
this.add(inJPanel,BorderLayout.CENTER);
JLabel jLabel = new JLabel("连接地址");
jLabel.setBounds(20, 0, 80, 30);
inJPanel.add(jLabel);
address = new JTextField();
address.setBounds(100, 0, 400, 30);
inJPanel.add(address);
JButton addButton = new JButton("添加");
addButton.setBounds(500, 0, 80, 30);
inJPanel.add(addButton);
JButton updateButton = new JButton("更新");
updateButton.setBounds(580, 0, 80, 30);
inJPanel.add(updateButton);
JButton delButton = new JButton("删除");
delButton.setBounds(660, 0, 80, 30);
inJPanel.add(delButton);
addButton.addMouseListener(new MouseAdapter() {
/**
* {@inheritDoc}
*/
public void mouseReleased(MouseEvent e) {
try {
AppWin.getInstance().getServerListManger().put(address.getText());
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
updateButton.addMouseListener(new MouseAdapter() {
/**
* {@inheritDoc}
*/
public void mouseReleased(MouseEvent e) {
try {
AppWin.getInstance().getServerListManger().update(address.getText());
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
delButton.addMouseListener(new MouseAdapter() {
/**
* {@inheritDoc}
*/
public void mouseReleased(MouseEvent e) {
try {
AppWin.getInstance().getServerListManger().delete(address.getText());
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
}
public JTextField getAddress() {
return address;
}
}
| [
"chesteryh@sina.com"
] | chesteryh@sina.com |
6028a7cf36d7dd9bbf0ad22944fc5cd66606f6ba | 3c9b215a1f476de346d564fcc1ded5f652301964 | /src/java/cms/model/IngredienteHasProdutoPK.java | b76cf3ddddb58d75b5db29a092843d09d6bd8569 | [] | no_license | ProjetosDAWII/CardAPPio | 9d19024d952dc89f90b09c80d53b2e4b020d71ba | 03233ae13a68372209afc2f7461649e278011c86 | refs/heads/master | 2020-03-28T22:05:37.584211 | 2018-12-04T00:55:19 | 2018-12-04T00:55:19 | 149,204,476 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,270 | java | /*
* 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 cms.model;
import model.*;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;
/**
*
* @author tatuapu
*/
@Embeddable
public class IngredienteHasProdutoPK implements Serializable {
@Basic(optional = false)
@NotNull
@Column(name = "produto_idProduto")
private int produtoidProduto;
@Basic(optional = false)
@NotNull
@Column(name = "estoque_idEstoque")
private int estoqueidEstoque;
public IngredienteHasProdutoPK() {
}
public IngredienteHasProdutoPK(int produtoidProduto, int estoqueidEstoque) {
this.produtoidProduto = produtoidProduto;
this.estoqueidEstoque = estoqueidEstoque;
}
public int getProdutoidProduto() {
return produtoidProduto;
}
public void setProdutoidProduto(int produtoidProduto) {
this.produtoidProduto = produtoidProduto;
}
public int getEstoqueidEstoque() {
return estoqueidEstoque;
}
public void setEstoqueidEstoque(int estoqueidEstoque) {
this.estoqueidEstoque = estoqueidEstoque;
}
@Override
public int hashCode() {
int hash = 0;
hash += (int) produtoidProduto;
hash += (int) estoqueidEstoque;
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 IngredienteHasProdutoPK)) {
return false;
}
IngredienteHasProdutoPK other = (IngredienteHasProdutoPK) object;
if (this.produtoidProduto != other.produtoidProduto) {
return false;
}
if (this.estoqueidEstoque != other.estoqueidEstoque) {
return false;
}
return true;
}
@Override
public String toString() {
return "model.IngredienteHasProdutoPK[ produtoidProduto=" + produtoidProduto + ", estoqueidEstoque=" + estoqueidEstoque + " ]";
}
}
| [
"hullopes@hotmail.com"
] | hullopes@hotmail.com |
5cfac5f253f91323959aa81bc765d0700a44b186 | cc312b8656c5b2886cd9f49b0ebf6d6d96878be2 | /POS-JavaFX-Domain/src/main/java/com/pos/domain/T_HeadStruk.java | 582cb75e08205368af571358454ff95f2f713746 | [] | no_license | javadev-reza/javafx-spring-boot | c21d2e7fe610c0dc64e390dec816a544c41e1738 | b13145f4256ee0398e5ea454764659989927119c | refs/heads/master | 2021-01-25T11:57:44.300916 | 2017-06-10T17:38:46 | 2017-06-10T17:38:46 | 93,953,872 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,118 | java | package com.pos.domain;
import com.pos.library.BaseTransaction;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(name="T_HeadStruk")
public class T_HeadStruk extends BaseTransaction{
@ManyToOne
@JoinColumn(name="detailStrukFk")
private T_DetailStruk detailStruk;
@Column(name="detailStrukFk", nullable=false, insertable=false, updatable=false)
private String detailStrukId;
@Column(name="tglStruk", nullable=false)
private Date tglStruk;
@ManyToOne
@JoinColumn(name="detailOrderFk")
private T_DetailOrder detailOrder;
@Column(name="detailOrderFk", nullable=false, insertable=false, updatable=false)
private String detailOrderId;
@ManyToOne
@JoinColumn(name="mejaFk")
private M_Meja meja;
@Column(name="mejaFk", nullable=false, insertable=false, updatable=false)
private Integer mejaId;
@Column(name="totalBayar", nullable=false)
private Double totalBayar;
@Column(name="totalDiskon", nullable=false)
private Double totalDiskon;
@Column(name="jmlBayar", nullable=false)
private Double jmlBayar;
@Column(name="jmlKembali", nullable=false)
private Double jmlKembali;
@ManyToOne
@JoinColumn(name="pegawaiFk")
private M_Pegawai pegawai;
@Column(name="pegawaiFk", nullable=false, insertable=false, updatable=false)
private Integer pegawaiId;
/**
* @return the detailStruk
*/
public T_DetailStruk getDetailStruk() {
return detailStruk;
}
/**
* @param detailStruk the detailStruk to set
*/
public void setDetailStruk(T_DetailStruk detailStruk) {
this.detailStruk = detailStruk;
}
/**
* @return the detailStrukId
*/
public String getDetailStrukId() {
return detailStrukId;
}
/**
* @param detailStrukId the detailStrukId to set
*/
public void setDetailStrukId(String detailStrukId) {
this.detailStrukId = detailStrukId;
}
/**
* @return the tglStruk
*/
public Date getTglStruk() {
return tglStruk;
}
/**
* @param tglStruk the tglStruk to set
*/
public void setTglStruk(Date tglStruk) {
this.tglStruk = tglStruk;
}
/**
* @return the detailOrder
*/
public T_DetailOrder getDetailOrder() {
return detailOrder;
}
/**
* @param detailOrder the detailOrder to set
*/
public void setDetailOrder(T_DetailOrder detailOrder) {
this.detailOrder = detailOrder;
}
/**
* @return the detailOrderId
*/
public String getDetailOrderId() {
return detailOrderId;
}
/**
* @param detailOrderId the detailOrderId to set
*/
public void setDetailOrderId(String detailOrderId) {
this.detailOrderId = detailOrderId;
}
/**
* @return the meja
*/
public M_Meja getMeja() {
return meja;
}
/**
* @param meja the meja to set
*/
public void setMeja(M_Meja meja) {
this.meja = meja;
}
/**
* @return the mejaId
*/
public Integer getMejaId() {
return mejaId;
}
/**
* @param mejaId the mejaId to set
*/
public void setMejaId(Integer mejaId) {
this.mejaId = mejaId;
}
/**
* @return the totalBayar
*/
public Double getTotalBayar() {
return totalBayar;
}
/**
* @param totalBayar the totalBayar to set
*/
public void setTotalBayar(Double totalBayar) {
this.totalBayar = totalBayar;
}
/**
* @return the totalDiskon
*/
public Double getTotalDiskon() {
return totalDiskon;
}
/**
* @param totalDiskon the totalDiskon to set
*/
public void setTotalDiskon(Double totalDiskon) {
this.totalDiskon = totalDiskon;
}
/**
* @return the jmlBayar
*/
public Double getJmlBayar() {
return jmlBayar;
}
/**
* @param jmlBayar the jmlBayar to set
*/
public void setJmlBayar(Double jmlBayar) {
this.jmlBayar = jmlBayar;
}
/**
* @return the jmlKembali
*/
public Double getJmlKembali() {
return jmlKembali;
}
/**
* @param jmlKembali the jmlKembali to set
*/
public void setJmlKembali(Double jmlKembali) {
this.jmlKembali = jmlKembali;
}
/**
* @return the pegawai
*/
public M_Pegawai getPegawai() {
return pegawai;
}
/**
* @param pegawai the pegawai to set
*/
public void setPegawai(M_Pegawai pegawai) {
this.pegawai = pegawai;
}
/**
* @return the pegawaiId
*/
public Integer getPegawaiId() {
return pegawaiId;
}
/**
* @param pegawaiId the pegawaiId to set
*/
public void setPegawaiId(Integer pegawaiId) {
this.pegawaiId = pegawaiId;
}
}
| [
"javadevreza@gmail.com"
] | javadevreza@gmail.com |
0fa40a852486fd672c196accdca31816b7a73d1c | 9b294c3bf262770e9bac252b018f4b6e9412e3ee | /camerazadas/source/apk/com.sonyericsson.android.camera/src-cfr-nocode/android/support/v4/view/ScaleGestureDetectorCompatKitKat.java | fc3e411e1735b67499931ed8704c9ca5c91cc25c | [] | no_license | h265/camera | 2c00f767002fd7dbb64ef4dc15ff667e493cd937 | 77b986a60f99c3909638a746c0ef62cca38e4235 | refs/heads/master | 2020-12-30T22:09:17.331958 | 2015-08-25T01:22:25 | 2015-08-25T01:22:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 297 | java | /*
* Decompiled with CFR 0_100.
*/
package android.support.v4.view;
class ScaleGestureDetectorCompatKitKat {
private ScaleGestureDetectorCompatKitKat();
public static boolean isQuickScaleEnabled(Object var0);
public static void setQuickScaleEnabled(Object var0, boolean var1);
}
| [
"jmrm@ua.pt"
] | jmrm@ua.pt |
5c60eb3f3ff4c0c9615c664b8d8a69a6efb2983e | 0608262ab6d758a5c468ed12b3f4d8ecf459817f | /src/main/java/org/nuist/rpc/remoting/model/RemotingResponse.java | 6e0096d52e8f83a5ac50548f1444cc56659d1db0 | [] | no_license | xiazhixiang/raft-kv | 84312837556e8e36de6324030e79b3f2d2e9ca87 | 700140c15274653ebe7a202218d3a6ac0a18c317 | refs/heads/master | 2022-12-10T23:13:43.323476 | 2020-09-08T07:09:43 | 2020-09-08T07:09:43 | 291,208,898 | 14 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,443 | java | package org.nuist.rpc.remoting.model;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.nuist.rpc.remoting.InvokeCallback;
/**
*
*
* @description 请求返回的对象包装类
* 11:08:43
* @
*/
public class RemotingResponse {
// 远程端返回的结果集
private volatile RemotingTransporter remotingTransporter;
// 该请求抛出的异常,如果存在的话
private volatile Throwable cause;
// 发送端是否发送成功
private volatile boolean sendRequestOK = true;
// 请求的opaque
private final long opaque;
// 默认的回调函数
private final InvokeCallback invokeCallback;
// 请求的默认超时时间
private final long timeoutMillis;
private final long beginTimestamp = System.currentTimeMillis();
private final CountDownLatch countDownLatch = new CountDownLatch(1);
public RemotingResponse(long opaque, long timeoutMillis, InvokeCallback invokeCallback) {
this.invokeCallback = invokeCallback;
this.opaque = opaque;
this.timeoutMillis = timeoutMillis;
}
public void executeInvokeCallback() {
if (invokeCallback != null) {
invokeCallback.operationComplete(this);
}
}
public boolean isSendRequestOK() {
return sendRequestOK;
}
public void setSendRequestOK(boolean sendRequestOK) {
this.sendRequestOK = sendRequestOK;
}
public long getOpaque() {
return opaque;
}
public RemotingTransporter getRemotingTransporter() {
return remotingTransporter;
}
public void setRemotingTransporter(RemotingTransporter remotingTransporter) {
this.remotingTransporter = remotingTransporter;
}
public Throwable getCause() {
return cause;
}
public void setCause(Throwable cause) {
this.cause = cause;
}
public long getTimeoutMillis() {
return timeoutMillis;
}
public long getBeginTimestamp() {
return beginTimestamp;
}
public RemotingTransporter waitResponse() throws InterruptedException{
this.countDownLatch.await(this.timeoutMillis, TimeUnit.MILLISECONDS);
return this.remotingTransporter;
}
/**
* 当远程端返回结果的时候,TCP的长连接的上层载体channel 的handler会将其放入与requestId
* 对应的Response中去
* @param remotingTransporter
*/
public void putResponse(final RemotingTransporter remotingTransporter){
this.remotingTransporter = remotingTransporter;
//接收到对应的消息之后需要countDown
this.countDownLatch.countDown();
}
}
| [
"1217937285@qq.com"
] | 1217937285@qq.com |
69679c062131bd5bebc1020c5b0475299ed471d6 | b1ab8e24c37da8eaf1f3a48626007dd011264a09 | /src/main/java/com/morningstar/covidworkerincentiveapi/disbursementtransaction/disbursemoney/MoneyDisbursementService.java | 7d83a1b5804dc69a69761fb9c83d995fe46c1327 | [] | no_license | fajarkarim/covid-incentive-worker-api | f27f04cba5277d77432a3d13d1b12df3873aed22 | a8aded9a5ad12b0596d888ca7762e0df47348477 | refs/heads/master | 2023-01-06T07:44:42.314273 | 2020-11-09T06:13:55 | 2020-11-09T06:13:55 | 307,255,059 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,006 | java | package com.morningstar.covidworkerincentiveapi.disbursementtransaction.disbursemoney;
import com.morningstar.covidworkerincentiveapi.disbursementtransaction.validateworkersdata.WorkersDataValidatedEvt;
import org.axonframework.commandhandling.gateway.CommandGateway;
import org.axonframework.eventhandling.EventHandler;
import org.springframework.stereotype.Service;
@Service
public class MoneyDisbursementService {
private CommandGateway commandGateway;
public MoneyDisbursementService(CommandGateway commandGateway) {
this.commandGateway = commandGateway;
}
@EventHandler
public void handle(WorkersDataValidatedEvt workersDataValidatedEvt) {
// TODO: call bank api to disburse money
final DisburseMoneyCmd disburseMoneyCmd = new DisburseMoneyCmd(
workersDataValidatedEvt.getTransactionId(),
workersDataValidatedEvt.getWorkerDataList());
// continue to next process
commandGateway.send(disburseMoneyCmd);
}
}
| [
"fajar.karim@btpn.com"
] | fajar.karim@btpn.com |
1342c3a7d364cee561baadc258fa6938d16187f0 | 48631c3851b15fbc20e61e29b82480b64eec2885 | /javase/src/main/java/com/prosayj/springboot/javase/base/day14_class/code/classes/Person.java | 3fce9cbb91b4902380c9e3880290858619af7fe0 | [
"Apache-2.0"
] | permissive | ProSayJ/springbootstudy | 56cb7f80502888d2c564d7a4bda23dd0650750f7 | 04b5ce563b9e6163ab6d6217292d7dd266e105c3 | refs/heads/master | 2022-12-25T10:42:49.047945 | 2021-04-09T15:20:12 | 2021-04-09T15:20:12 | 147,488,466 | 0 | 0 | Apache-2.0 | 2022-12-16T03:22:22 | 2018-09-05T08:52:00 | Java | UTF-8 | Java | false | false | 259 | java | package com.prosayj.springboot.javase.base.day14_class.code.classes;
public class Person {
private String name = "张三";
public void eat(){
System.out.println(name+ " 在吃饭");
}
public void run(){
System.out.println(name+" 在跑步");
}
}
| [
"yangjian@bubi.cn"
] | yangjian@bubi.cn |
7d582de5484d391ece214e0f1e818ab0b56ec9c9 | c04575ddf3506f3b9da2213c3f2257c6173af56a | /AppOwnner/src/com/appowner/bean/EmailUtility12.java | 35063c84e24eae87afc0831a968942971e324d62 | [] | no_license | dualapp/appowner | 47beb9283cd590db0a9bc15b9c019e81532eeb12 | 4a0b5596b33bf674e4d00dd4a7cef9e5026f9429 | refs/heads/master | 2020-05-20T11:38:40.906430 | 2015-06-26T07:31:01 | 2015-06-26T07:31:01 | 38,095,008 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,480 | java | package com.appowner.bean;
import java.util.Date;
import java.util.Properties;
import javax.mail.Authenticator;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
/**
* A utility class for sending e-mail messages
* @author www.codejava.net
*
*/
public class EmailUtility12 {
public static void sendEmail(String host, String port,
final String userName, final String password, String toAddress,
String subject, String message) throws AddressException,
MessagingException {
// sets SMTP server properties
Properties properties = new Properties();
properties.put("mail.smtp.host", host);
properties.put("mail.smtp.port", port);
properties.put("mail.smtp.auth", "true");
properties.put("mail.smtp.starttls.enable", "true");
System.out.println(toAddress+"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
// creates a new session with an authenticator
Authenticator auth = new Authenticator() {
public PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(userName, password);
}
};
Session session = Session.getInstance(properties, auth);
// creates a new e-mail message
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(userName));
msg.setRecipients( Message.RecipientType.TO,InternetAddress.parse(toAddress));
msg.setSubject(subject);
msg.setSentDate(new Date());
msg.setText(message);
msg.setContent("<html>\n" +
"<fieldset style="+"width:70%"+" "+"height:80%" +"border-top:1px #2270ab solid"+">"+
"<legend style="+" align="+"left"+">"+"Latest Poll"+"</legend>"+
"<table width="+600+" bgcolor="+"white"+">"+
"<tr>"+
"<td style="+"width:350px;"+"color:#333300;"+" margin-left:15%;"+">"+""
+ "<h4> – – –"+" " + " "+""+message+""+"</h4>"+"</td>" +"</tr>"+
"<tr>"+
"<td style="+"width:350px;"+"color:#333300;"+" margin-left:15%;"+">"+""
+ "<h4> – – –"+"To Vote This Poll Please Click This Below Link:"
+ " </td>" +"</tr>"+
"<tr>"+
"<td width="+30+">"+
"<a href="+"http://www.appowners.com/"+">"+"Vote Poll"+"</a>" +
" </td>" +"</tr>"+
"<tr>"+
"<td style="+"width:350px;"+"color:#333300;"+" margin-left:15%;"+">"+""
+ "<h4> – – –"+"Note:This is auto generated so please not reply this email"
+ " </td>" +"</tr>"+
"</table>"+
"<hr/>"+
"<tbody>"+"<table>"+
"</body>\n" +
"</fieldset>"+
"</html>", "text/html");
// sends the e-mail
Transport.send(msg);
}
}
| [
"priya.das080@gmail.com"
] | priya.das080@gmail.com |
b6663add3f0d7ebc6da3f477c456336fcf7e045f | cb0a1b0ac15f5c827b33bd764a5329aaa5070ff9 | /xdroid/src/main/java/com/ro/xdroid/media/image/loader/glide/GlideModelConfig.java | 72569707b05f4ddadd95e68f107d695dfce08d92 | [] | no_license | liuhui2013/TuanFan | fd338bda696793a6a9449a746454a09e0f8c24f3 | 1180a188808717d96b15f704b13929a9c8d6ffdb | refs/heads/master | 2021-08-31T17:21:03.242805 | 2017-12-22T06:15:20 | 2017-12-22T06:15:20 | 115,073,210 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,189 | java | package com.ro.xdroid.media.image.loader.glide;
import android.content.Context;
import com.bumptech.glide.Glide;
import com.bumptech.glide.GlideBuilder;
import com.bumptech.glide.Registry;
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.integration.okhttp3.OkHttpUrlLoader;
import com.bumptech.glide.load.engine.cache.LruResourceCache;
import com.bumptech.glide.load.model.GlideUrl;
import com.bumptech.glide.module.AppGlideModule;
import java.io.InputStream;
/**
* Created by roffee on 2017/8/7 09:27.
* Contact with 460545614@qq.com
*/
@GlideModule
public class GlideModelConfig extends AppGlideModule {
@Override
public void applyOptions(Context context, GlideBuilder builder) {
//重新设置内存限制
builder.setMemoryCache(new LruResourceCache(100*1024*1024));
}
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
// super.registerComponents(context, glide, registry);
registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory());
}
@Override
public boolean isManifestParsingEnabled() {
return false;
}
}
| [
"1272784979@qq.com"
] | 1272784979@qq.com |
4367e148c71da5edaf9dcc7d4c0e8eaf845b5a2b | d2fee82e83285cfc7eb6f3dda478454a619d4d71 | /com.studyolle/src/main/java/com/studyolle/mail/ConsoleEmailService.java | 326b2570bbdf830e796c048be948c7da60fd72e0 | [] | no_license | KoYoungSung/inflearn-WebApplication-Dev | 6b13376b81c53eb0658b700514590558e01e31be | cd1ae7e5afca040b5128448c37facd828f6914af | refs/heads/main | 2023-01-24T12:37:35.391247 | 2020-11-25T15:55:56 | 2020-11-25T15:55:56 | 312,774,335 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 404 | java | package com.studyolle.mail;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
@Slf4j
@Profile("local")
@Component
public class ConsoleEmailService implements EmailService {
@Override
public void sendEmail(EmailMessage emailMessage) {
log.info("send email : {}", emailMessage.getMessage());
}
}
| [
"ko"
] | ko |
eef3e738e8969f4b3279073a5258364cb077a198 | 74acea1b7f2a3a509b9ead48f186c9349bf55cc8 | /webapps/www/java/com/enjoyf/webapps/joyme/webpage/controller/joymeapp/gameclient/json/GameClientJsonMiyouController.java | 57fe5cb3a99e94819d6c6c1e39b8367dc9ff66ce | [] | no_license | liu67224657/besl-platform | 6cd2bfcc7320a4039e61b114173d5f350345f799 | 68c126bea36c289526e0cc62b9d5ce6284353d11 | refs/heads/master | 2022-04-16T02:23:40.178907 | 2020-04-17T09:00:01 | 2020-04-17T09:00:01 | 109,520,110 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 26,191 | java | package com.enjoyf.webapps.joyme.webpage.controller.joymeapp.gameclient.json;
import com.enjoyf.platform.service.ActStatus;
import com.enjoyf.platform.service.ValidStatus;
import com.enjoyf.platform.service.comment.*;
import com.enjoyf.platform.service.event.EventDispatchServiceSngl;
import com.enjoyf.platform.service.event.system.UserCenterSumIncreaseEvent;
import com.enjoyf.platform.service.joymeapp.JoymeAppServiceSngl;
import com.enjoyf.platform.service.joymeapp.anime.AnimeTagField;
import com.enjoyf.platform.service.joymeapp.gameclient.ArchiveContentType;
import com.enjoyf.platform.service.joymeapp.gameclient.ArchiveRelationType;
import com.enjoyf.platform.service.joymeapp.gameclient.TagDedearchives;
import com.enjoyf.platform.service.joymeapp.gameclient.TagDedearchivesFiled;
import com.enjoyf.platform.service.oauth.AuthApp;
import com.enjoyf.platform.service.oauth.OAuthServiceSngl;
import com.enjoyf.platform.service.timeline.SocialTimeLineDomain;
import com.enjoyf.platform.service.timeline.SocialTimeLineItem;
import com.enjoyf.platform.service.timeline.TimeLineServiceSngl;
import com.enjoyf.platform.service.usercenter.ModifyTimeJson;
import com.enjoyf.platform.service.usercenter.Profile;
import com.enjoyf.platform.service.usercenter.UserCenterServiceSngl;
import com.enjoyf.platform.util.*;
import com.enjoyf.platform.util.http.URLUtils;
import com.enjoyf.platform.util.sql.*;
import com.enjoyf.platform.webapps.common.*;
import com.enjoyf.platform.webapps.common.encode.JsonBinder;
import com.enjoyf.platform.webapps.common.wordfilter.ContextFilterUtils;
import com.enjoyf.webapps.joyme.dto.comment.MainReplyDTO;
import com.enjoyf.webapps.joyme.weblogic.comment.CommentWebLogic;
import com.enjoyf.webapps.joyme.weblogic.joymeapp.socialclient.SocialClientWebLogic;
import com.enjoyf.webapps.joyme.webpage.controller.joymeapp.gameclient.AbstractGameClientBaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* @Auther: <a mailto="ericliu@straff.joyme.com">ericliu</a>
* Create time: 15/6/30
* Description:
*/
@Controller
@RequestMapping("/joymeapp/gameclient/json/miyou")
public class GameClientJsonMiyouController extends AbstractGameClientBaseController {
@Resource(name = "commentWebLogic")
private CommentWebLogic commentWebLogic;
@Resource(name = "socialClientWebLogic")
private SocialClientWebLogic socialClientWebLogic;
@RequestMapping("/like")
@ResponseBody
public String like(HttpServletRequest request, HttpServletResponse response) {
return "";
}
@RequestMapping("/unlike")
@ResponseBody
public String unlike(HttpServletRequest request, HttpServletResponse response) {
return "";
}
@RequestMapping("/comment")
@ResponseBody
public String comment(HttpServletRequest request, HttpServletResponse response) {
JsonBinder binder = JsonBinder.buildNormalBinder();
ResultObjectMsg resultObjectMsg = new ResultObjectMsg(ResultCodeConstants.SUCCESS.getCode());
binder.setDateFormat("yyyy-MM-dd");
String contentId = request.getParameter("cid");
String uidParam = HTTPUtil.getParam(request, "uid");
String text = request.getParameter("text");
String appkey = HTTPUtil.getParam(request, "appkey");
try {
long uid = Long.parseLong(uidParam);
AuthApp authApp = OAuthServiceSngl.get().getApp(appkey);
if (StringUtil.isEmpty(text)) {
return ResultCodeConstants.COMMENT_PARAM_BODY_NULL.getJsonString();
}
Profile profile = UserCenterServiceSngl.get().getProfileByUid(uid);
if (profile == null) {
return ResultCodeConstants.USERCENTER_PROFILE_NOT_EXISTS.getJsonString();
}
//禁言
CommentForbid forbid = CommentServiceSngl.get().getCommentForbidByCache(profile.getProfileId());
if (forbid != null) {
return ResultCodeConstants.COMMENT_PROFILE_FORBID.getJsonString();
}
ReplyBody replyBody = ReplyBody.parse(commentWebLogic.postreply(text));
if (replyBody == null || StringUtil.isEmpty(replyBody.getText())) {
return ResultCodeConstants.COMMENT_PARAM_BODY_NULL.getJsonString();
}
CommentBean commentBean = CommentServiceSngl.get().getCommentBeanById(contentId);
if (commentBean == null) {
return ResultCodeConstants.COMMENT_BEAN_NULL.getJsonString();
}
Set<String> simpleKeyword = ContextFilterUtils.getSimpleEditorBlackList(replyBody.getText());
Set<String> postKeyword = ContextFilterUtils.getPostContainBlackList(replyBody.getText());
if (!CollectionUtil.isEmpty(simpleKeyword) || !CollectionUtil.isEmpty(postKeyword)) {
resultObjectMsg.setRs(ResultCodeConstants.COMMENT_REPLY_BODY_TEXT_ILLEGE.getCode());
resultObjectMsg.setMsg(ResultCodeConstants.COMMENT_REPLY_BODY_TEXT_ILLEGE.getMsg());
Set<String> keyword = new HashSet<String>();
keyword.addAll(simpleKeyword);
keyword.addAll(postKeyword);
resultObjectMsg.setResult(keyword);
return binder.toJson(resultObjectMsg);
}
CommentReply reply = new CommentReply();
reply.setCommentId(commentBean.getCommentId());
reply.setSubKey(commentBean.getUniqueKey());
reply.setReplyUno(profile.getUno());
reply.setReplyProfileId(profile.getProfileId());
reply.setReplyProfileKey(authApp.getProfileKey());
reply.setAgreeSum(0);
reply.setDisagreeSum(0);
reply.setSubReplySum(0);
reply.setBody(replyBody);
reply.setCreateTime(new Date());
reply.setCreateIp(getIp(request));
reply.setRemoveStatus(ActStatus.UNACT);
reply.setTotalRows(0);
reply.setDomain(CommentDomain.GAMECLIENT_MIYOU);
reply = CommentServiceSngl.get().createCommentReply(reply, commentBean.getTotalRows());
if (!profile.getProfileId().equals(commentBean.getUri())) {
UserCenterSumIncreaseEvent ucsiEvent = new UserCenterSumIncreaseEvent();
ucsiEvent.setProfileId(commentBean.getUri());
ModifyTimeJson json = new ModifyTimeJson();
json.setMiyouModifyTime(System.currentTimeMillis());
ucsiEvent.setModifyTimeJson(json);
EventDispatchServiceSngl.get().dispatch(ucsiEvent);
}
JoymeAppServiceSngl.get().modifyAnimeTag(commentBean.getGroupId(), new QueryExpress().add(QueryCriterions.eq(AnimeTagField.TAG_ID, commentBean.getGroupId())),
new UpdateExpress().increase(AnimeTagField.FAVORITE_NUM, 1l));
socialClientWebLogic.sendWanbaMessage(commentBean, reply);
return ResultCodeConstants.SUCCESS.getJsonString();
} catch (Exception e) {
return ResultCodeConstants.SYSTEM_ERROR.getJsonString();
}
}
@RequestMapping("/miyoulist")
@ResponseBody
public String miYouList(HttpServletRequest request, HttpServletResponse response,
@RequestParam(value = "pnum", required = false, defaultValue = "1") Integer page,
@RequestParam(value = "count", required = false, defaultValue = "10") Integer count,
@RequestParam(value = "uid", required = false) String uid
) {
ResultObjectPageMsg resultMsg = new ResultObjectPageMsg(ResultPageMsg.CODE_S);
Pagination pagination = new Pagination(count * page, page, count);
QueryExpress queryExpress = new QueryExpress()
.add(QueryCriterions.eq(TagDedearchivesFiled.TAGID, TAGID))
.add(QueryCriterions.eq(TagDedearchivesFiled.ARCHIVE_CONTENT_TYPE, ArchiveContentType.MIYOU_COMMENT.getCode()))
.add(QueryCriterions.eq(TagDedearchivesFiled.ARCHIVE_RELATION_TYPE, ArchiveRelationType.TAG_RELATION.getCode()))
.add(QueryCriterions.eq(TagDedearchivesFiled.REMOVE_STATUS, ValidStatus.VALID.getCode()))
.add(QuerySort.add(TagDedearchivesFiled.DISPLAY_ORDER, QuerySortOrder.ASC));
try {
PageRows<TagDedearchives> tagPageRows = JoymeAppServiceSngl.get().queryTagDedearchivesByPage(true, TAGID, 0, queryExpress, pagination);
if (tagPageRows != null && !CollectionUtil.isEmpty(tagPageRows.getRows())) {
Set<String> tagSet = new HashSet<String>();
for (TagDedearchives tag : tagPageRows.getRows()) {
tagSet.add(tag.getDede_archives_id());
}
Map<String, CommentBean> commentBeanMap = CommentServiceSngl.get().queryCommentBeanByIds(tagSet);
if (commentBeanMap != null) {
List<CommentBean> miyouList = new ArrayList<CommentBean>(commentBeanMap.values());
Set<String> commentIdSet = new HashSet<String>();
Set<String> historySet = new HashSet<String>();
Set<String> profileSet = new HashSet<String>();
for (CommentBean commentBean : miyouList) {
commentBean.setPic(URLUtils.getJoymeDnUrl(commentBean.getPic()));
profileSet.add(commentBean.getUri());
historySet.add(commentBean.getCommentId());
if (commentBean.getCommentSum() > 0) {
commentIdSet.add(commentBean.getCommentId());
}
}
List<CommentBean> returnList = new ArrayList<CommentBean>();
for (TagDedearchives tagDedearchives : tagPageRows.getRows()) {
for (CommentBean commentBean : miyouList) {
commentBean.setDescription(replaceHtmlText(commentBean.getDescription()));
commentBean.setPic(URLUtils.getJoymeDnUrl(commentBean.getPic()));
if (tagDedearchives.getDede_archives_id().equals(commentBean.getCommentId())) {
returnList.add(commentBean);
}
}
}
//查询帖子点赞数最多的评论
Map<String, CommentReply> map = CommentServiceSngl.get().queryHotReplyCacheByAgreeSum(commentIdSet);
if (map != null) {
for (CommentReply commentReply : map.values()) {
profileSet.add(commentReply.getReplyProfileId());
}
}
List<CommentHistory> commentHistories = null;
if (!CollectionUtil.isEmpty(historySet)) {
commentHistories = CommentServiceSngl.get().queryCommentHistory(new QueryExpress().add(QueryCriterions.eq(CommentHistoryField.PROFILE_ID, uid))
.add(QueryCriterions.eq(CommentHistoryField.DOMAIN, CommentDomain.GAMECLIENT_MIYOU.getCode()))
.add(QueryCriterions.in(CommentHistoryField.OBJECT_ID, historySet.toArray())));
}
Map<String, Profile> profilesMap = UserCenterServiceSngl.get().queryProfiles(profileSet);
Map<String, Object> mapMessage = new HashMap<String, Object>();
mapMessage.put("miyoulist", returnList);
mapMessage.put("hotReply", map == null ? "" : map.values());
mapMessage.put("profiles", profilesMap == null ? "" : profilesMap.values());
mapMessage.put("commentHistories", commentHistories);
mapMessage.put("page", tagPageRows.getPage());
resultMsg.setResult(mapMessage);
resultMsg.setPage(new JsonPagination(tagPageRows.getPage()));
}
}
return JsonBinder.buildNormalBinder().toJson(resultMsg);
} catch (Exception e) {
return ResultCodeConstants.SYSTEM_ERROR.getJsonString();
}
}
@RequestMapping("/mymiyoulist")
@ResponseBody
public String mymiYouList(HttpServletRequest request, HttpServletResponse response,
@RequestParam(value = "pnum", required = false, defaultValue = "1") Integer page,
@RequestParam(value = "count", required = false, defaultValue = "10") Integer count,
@RequestParam(value = "uid", required = false) String uid
) {
ResultObjectPageMsg resultMsg = new ResultObjectPageMsg(ResultPageMsg.CODE_S);
try {
Pagination pagination = new Pagination(count * page, page, count);
//存放点赞数最多的评论ID
Set<String> commentIdSet = new HashSet<String>();
//存放我回复过的帖子ID
Set<String> historySet = new HashSet<String>();
//取用户头像信息ID
Set<String> profileSet = new HashSet<String>();
Profile profile = UserCenterServiceSngl.get().getProfileByUid(Long.parseLong(uid));
PageRows<SocialTimeLineItem> timeLinePageRows = TimeLineServiceSngl.get().querySocialTimeLineItemList(SocialTimeLineDomain.MY_MIYOU, profile.getProfileId(), pagination);
if (timeLinePageRows != null && !CollectionUtil.isEmpty(timeLinePageRows.getRows())) {
Set<String> lineSet = new HashSet<String>();
for (SocialTimeLineItem timeline : timeLinePageRows.getRows()) {
lineSet.add(timeline.getDirectId());
}
Map<String, CommentBean> commentBeanMap = CommentServiceSngl.get().queryCommentBeanByIds(lineSet);
if (commentBeanMap != null) {
List<CommentBean> mymiyouList = new ArrayList<CommentBean>(commentBeanMap.values());
for (CommentBean commentBean : mymiyouList) {
profileSet.add(commentBean.getUri());
historySet.add(commentBean.getCommentId());
if (commentBean.getCommentSum() > 0) {
commentIdSet.add(commentBean.getCommentId());
}
}
//重新排序
Collections.sort(mymiyouList, new Comparator() {
public int compare(Object o1, Object o2) {
if (((CommentBean) o1).getCreateTime().getTime() < ((CommentBean) o2).getCreateTime().getTime()) {
return 1;
}
return -1;
}
});
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar today = Calendar.getInstance();
today.add(Calendar.DATE, 0);
Calendar today2 = Calendar.getInstance();
today2.add(Calendar.DATE, -1);
Calendar today3 = Calendar.getInstance();
today3.add(Calendar.DATE, -2);
String todayString = sdf.format(today.getTime());
String today2String = sdf.format(today2.getTime());
String today3String = sdf.format(today3.getTime());
List<CommentBean> todayList = new ArrayList<CommentBean>();
List<CommentBean> yesterdayList = new ArrayList<CommentBean>();
List<CommentBean> dayList = new ArrayList<CommentBean>();
List<CommentBean> moredayList = new ArrayList<CommentBean>();
String postTime = "";
for (CommentBean commentBean : mymiyouList) {
commentBean.setDescription(replaceHtmlText(commentBean.getDescription()));
postTime = sdf.format(commentBean.getCreateTime());
if (postTime.contains(todayString)) {
todayList.add(commentBean);
} else if (postTime.contains(today2String)) {
yesterdayList.add(commentBean);
} else if (postTime.contains(today3String)) {
dayList.add(commentBean);
} else {
moredayList.add(commentBean);
}
}
Map<String, Object> mapMessage = new HashMap<String, Object>();
mapMessage.put("todayList", todayList);
mapMessage.put("yesterdayList", yesterdayList);
mapMessage.put("dayList", dayList);
mapMessage.put("moredayList", moredayList);
mapMessage.put("mymiyouList", mymiyouList);
mapMessage.put("mymiyoupage", timeLinePageRows.getPage());
//查询帖子点赞数最多的评论
Map<String, CommentReply> map = CommentServiceSngl.get().queryHotReplyCacheByAgreeSum(commentIdSet);
if (map != null) {
for (CommentReply commentReply : map.values()) {
profileSet.add(commentReply.getReplyProfileId());
}
}
//查询用户点过赞的
List<CommentHistory> commentHistories = null;
//查询用户点过赞的
if (!CollectionUtil.isEmpty(historySet)) {
commentHistories = CommentServiceSngl.get().queryCommentHistory(new QueryExpress().add(QueryCriterions.eq(CommentHistoryField.PROFILE_ID, uid))
.add(QueryCriterions.eq(CommentHistoryField.DOMAIN, CommentDomain.GAMECLIENT_MIYOU.getCode()))
.add(QueryCriterions.in(CommentHistoryField.OBJECT_ID, historySet.toArray())));
}
Map<String, Profile> profilesMap = UserCenterServiceSngl.get().queryProfiles(profileSet);
mapMessage.put("hotReply", map == null ? "" : map.values());
mapMessage.put("profiles", profilesMap == null ? "" : profilesMap.values());
mapMessage.put("commentHistories", commentHistories);
resultMsg.setResult(mapMessage);
resultMsg.setPage(new JsonPagination(timeLinePageRows.getPage()));
}
}
return JsonBinder.buildNormalBinder().toJson(resultMsg);
} catch (Exception e) {
return ResultCodeConstants.SYSTEM_ERROR.getJsonString();
}
}
@RequestMapping("/replylist")
@ResponseBody
public String replyList(HttpServletRequest request, HttpServletResponse response,
@RequestParam(value = "pnum", required = false, defaultValue = "1") Integer page,
@RequestParam(value = "count", required = false, defaultValue = "10") Integer count,
@RequestParam(value = "cid", required = false) String commentId,
@RequestParam(value = "uid", required = false) String uid
) {
ResultObjectPageMsg resultMsg = new ResultObjectPageMsg(ResultPageMsg.CODE_S);
try {
CommentBean commentBean = CommentServiceSngl.get().getCommentBeanById(commentId);
if (commentBean == null) {
}
PageRows<MainReplyDTO> mainReplyRows = commentWebLogic.queryMainReplyDTO(commentBean, page, count, true);
Set<String> historySet = new HashSet<String>();
if (mainReplyRows != null && !CollectionUtil.isEmpty(mainReplyRows.getRows())) {
for (MainReplyDTO mainReplyDTO : mainReplyRows.getRows()) {
historySet.add(String.valueOf(mainReplyDTO.getReply().getReply().getRid()));
}
}
//查询用户点过赞的
List<CommentHistory> commentHistories = null;
//查询用户点过赞的
if (!CollectionUtil.isEmpty(historySet)) {
commentHistories = CommentServiceSngl.get().queryCommentHistory(new QueryExpress().add(QueryCriterions.eq(CommentHistoryField.PROFILE_ID, uid))
.add(QueryCriterions.eq(CommentHistoryField.DOMAIN, CommentDomain.GAMECLIENT_MIYOU.getCode()))
.add(QueryCriterions.in(CommentHistoryField.OBJECT_ID, historySet.toArray())));
}
Map<String, Object> mapMessage = new HashMap<String, Object>();
mapMessage.put("replylist", mainReplyRows.getRows());
mapMessage.put("commentHistories", commentHistories);
resultMsg.setResult(mapMessage);
resultMsg.setPage(new JsonPagination(mainReplyRows.getPage()));
return JsonBinder.buildNormalBinder().toJson(resultMsg);
} catch (Exception e) {
return ResultCodeConstants.SYSTEM_ERROR.getJsonString();
}
}
@RequestMapping("/agree")
@ResponseBody
public String agree(HttpServletRequest request, HttpServletResponse response) {
JsonBinder binder = JsonBinder.buildNormalBinder();
binder.setDateFormat("yyyy-MM-dd");
String contentId = request.getParameter("cid");
String uidParam = HTTPUtil.getParam(request, "uid");
String rid = HTTPUtil.getParam(request, "rid");
try {
if (uidParam == null) {
return ResultCodeConstants.USERCENTER_PROFILE_NOT_EXISTS.getJsonString();
}
CommentBean commentBean = CommentServiceSngl.get().getCommentBeanById(contentId);
if (commentBean == null) {
return ResultCodeConstants.COMMENT_BEAN_NULL.getJsonString();
}
if (StringUtil.isEmpty(rid)) {
CommentHistory commentHistory = CommentServiceSngl.get().getCommentHistoryByCache(uidParam, contentId, CommentHistoryType.AGREE, CommentDomain.GAMECLIENT_MIYOU);
if (commentHistory != null) {
return ResultCodeConstants.COMMENT_HAS_AGREE.getJsonString();
}
UpdateExpress updateExpress = new UpdateExpress();
updateExpress.increase(CommentBeanField.SCORE_COMMENT_SUM, 1);
updateExpress.increase(CommentBeanField.FOUR_USER_SUM, 1);
boolean bool = CommentServiceSngl.get().modifyCommentBeanById(contentId, updateExpress);
if (bool) {
commentHistory = new CommentHistory();
commentHistory.setProfileId(uidParam);
commentHistory.setObjectId(contentId);
commentHistory.setHistoryType(CommentHistoryType.AGREE);
commentHistory.setDomain(CommentDomain.GAMECLIENT_MIYOU);
commentHistory.setActionIp(getIp(request));
commentHistory.setActionDate(new Date());
commentHistory.setActionTimes(1);
commentHistory.setCommentId(contentId);
CommentServiceSngl.get().createCommentHistory(commentHistory, commentBean, null);
} else {
return ResultCodeConstants.COMMENT_BEAN_NULL.getJsonString();
}
} else {
CommentHistory commentHistory = CommentServiceSngl.get().getCommentHistoryByCache(uidParam, String.valueOf(rid), CommentHistoryType.AGREE, CommentDomain.GAMECLIENT_MIYOU);
if (commentHistory != null) {
return ResultCodeConstants.COMMENT_HAS_AGREE.getJsonString();
}
UpdateExpress updateReplyExpress = new UpdateExpress();
updateReplyExpress.increase(CommentReplyField.AGREE_SUM, 1);
updateReplyExpress.increase(CommentReplyField.REPLY_AGREE_SUM, 1);
boolean bool = CommentServiceSngl.get().modifyCommentReplyById(contentId, Long.parseLong(rid), updateReplyExpress);
if (bool) {
commentHistory = new CommentHistory();
commentHistory.setProfileId(uidParam);
commentHistory.setObjectId(String.valueOf(rid));
commentHistory.setHistoryType(CommentHistoryType.AGREE);
commentHistory.setDomain(CommentDomain.GAMECLIENT_MIYOU);
commentHistory.setActionIp(getIp(request));
commentHistory.setActionDate(new Date());
commentHistory.setActionTimes(1);
CommentServiceSngl.get().createCommentHistory(commentHistory, commentBean, null);
}
}
return ResultCodeConstants.SUCCESS.getJsonString();
} catch (Exception e) {
return ResultCodeConstants.SYSTEM_ERROR.getJsonString();
}
}
@RequestMapping("/shorten")
@ResponseBody
public String shorten(HttpServletRequest request, HttpServletResponse response) {
JsonBinder binder = JsonBinder.buildNormalBinder();
binder.setDateFormat("yyyy-MM-dd");
ResultObjectPageMsg resultMsg = new ResultObjectPageMsg(ResultPageMsg.CODE_S);
String url = request.getParameter("url");
url = ShortUrlUtils.getSinaURL(url);
resultMsg.setResult(url);
return JsonBinder.buildNormalBinder().toJson(resultMsg);
}
}
| [
"ericliu@staff.joyme.com"
] | ericliu@staff.joyme.com |
8eb90ad3bb6c828ee0bddd2f2d58c4b052c301af | 107b42ac3dfd36414f4e4f5b809e741e46f09800 | /Framework/src/test/java/com/learnautomation/testcases/ConfigTC.java | 1625a3d575e18af905747b978b129b3190896b39 | [] | no_license | yadav782/SeleniumFramework | 2844be690395a4359bc693b690744c08870e8aa2 | 7846909f452347490c8a2a910f186ae9a639c0a9 | refs/heads/master | 2020-04-22T10:54:39.404042 | 2019-02-14T15:18:47 | 2019-02-14T15:18:47 | 170,321,708 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 714 | java | package com.learnautomation.testcases;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Properties;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
import com.aventstack.extentreports.externalconfig.model.Config;
public class ConfigTC {
@Test
public void testConfig() throws Exception {
File src = new File("./Configuration/Config.properties");
FileInputStream fis = new FileInputStream(src);
Properties pro = new Properties();
pro.load(fis);
String ChromePath = pro.getProperty("ChromeDriver");
System.out.println(ChromePath);
}
}
| [
"41895580+yadav782@users.noreply.github.com"
] | 41895580+yadav782@users.noreply.github.com |
bfc15171c183e95d38ca953da0489135dedcd006 | 0b0f848e200254441feb3446a41824d00d8021e0 | /gmail.hollysharu.0227/src/CollectionsTest.java | 988c0a342c3b9ab646db1af12b257542d4116bee | [] | no_license | hollymun/0227 | d6107a0f6575d8c7dcc90bad2bbc1d512fa47270 | dca562f4b0520bc18c494e967297ff5c5889f852 | refs/heads/master | 2020-04-25T21:29:25.903664 | 2019-02-28T09:24:47 | 2019-02-28T09:24:47 | 173,081,235 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 859 | java | import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class CollectionsTest {
public static void main(String[] args) {
//Collections 클래스의 static 메소드를 이용하면
//List, Set, Map에 작업을 수행할 수 있음
//reverse, shuffle, unmodifyableList 등의 메소드가 있음
List<String> list=new ArrayList<String>();
list.add("커크");
list.add("스팍");
list.add("우후라");
list.add("본즈");
Collections.reverse(list);
System.out.printf("%s\n", list);
//데이터를 섞어주는 함수 호출
Collections.shuffle(list);
System.out.printf("%s\n", list);
//읽기전용의 리스트 만들기 - 데이터 수정하려고 하면 예외 발생
List<String> readOnlyList=Collections.unmodifiableList(list);
readOnlyList.add("스코티");
}
}
| [
"Moon@localhost"
] | Moon@localhost |
dedddd4816607f02e84de08055988991ec1495fa | 4aacb06f9e4b31c95ea381f15bddad6b2854a3ca | /lesson1/Wall.java | 05acee5373ccfedd59d90ffe1fd5cf2b8b67bba8 | [] | no_license | batonskii/Course2 | c7a4265f901c9f72287ba8000ba8ac4a7c0a38c2 | fa51aa2deffcd0835a38324309d77ef018569776 | refs/heads/master | 2022-12-01T06:55:38.270154 | 2020-08-12T19:36:16 | 2020-08-12T19:36:16 | 282,652,773 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,808 | java | package ru.geekbrains.lesson1;
public abstract class Wall extends Obstacle {
private final int height;
public Wall(String name, int height) {
super(name);
this.height = height;
}
public int getHeight() {
return height;
}
@Override
protected boolean moving(Human human) {
System.out.println("The wall " + super.getName() + "heigth: " + this.height);
human.jump();
if (getHeight() <= human.getJumpLimit()) {
System.out.println("Человек успешно перепрыгнул через стену");
return true;
} else {
System.out.println("Человекне смог перепрыгнуть через стену");
return false;
}
}
@Override
protected boolean moving(Robot robot) {
System.out.println("The wall " + super.getName() + "heigth: " + this.height);
robot.jump();
if (getHeight() <= robot.getJumpLimit()) {
System.out.println("Робот успешно перепрыгнул через стену");
return true;
} else {
System.out.println("Робот смог перепрыгнуть через стену");
return false;
}
}
@Override
protected boolean moving(Cat cat) {
System.out.println("The wall " + super.getName() + "heigth: " + this.height);
cat.jump();
if (getHeight() <= cat.getJumpLimit()) {
System.out.println("Кот успешно перепрыгнул через стену");
return true;
} else {
System.out.println("Кот смог перепрыгнуть через стену");
return false;
}
}
}
| [
"edemshtork@yandex.ru"
] | edemshtork@yandex.ru |
e784cc7801b640c7bf176a0ce78a7a5162f70353 | e6ee040697b6e192f9d00e37ab1b6ac270a00a2c | /src/main/java/com/mugen/riot/model/match/Rune.java | e80de5463998f633a47140517fa6598635238fc3 | [] | no_license | MugenTwo/RiotGamesApiClient | f02d70079133f7db3bf8ca6ab8983eaa2aead3c8 | 46577649cbe196a3be5b2a9f9cef40a892d835d5 | refs/heads/master | 2021-06-19T08:42:00.061143 | 2021-04-19T18:27:56 | 2021-04-19T18:27:56 | 204,779,245 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 170 | java | package com.mugen.riot.model.match;
import lombok.Builder;
import lombok.Value;
@Builder(toBuilder = true)
@Value
public class Rune {
int runeId;
int rank;
}
| [
"johncarlo.purihin@gmail.com"
] | johncarlo.purihin@gmail.com |
67527315cf378e1d6213d6105508b89e634fbcb8 | eccb88f097ead30429b79dd2c6ebd6f88f5d4871 | /src/main/java/com/epam/amoi/employee/EmployeeService.java | b2e55f0df4d729d9ec9a5eaf8e19c235a7fc0029 | [] | no_license | MoarDm/exampleConsoleApp | 798ead2290be9b79d56001f914cc05837c1d8f79 | 428db15dd57cff03950ae859cc71eb41988d7720 | refs/heads/master | 2023-03-09T13:00:48.644530 | 2021-02-24T16:29:33 | 2021-02-24T16:29:33 | 341,953,720 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,614 | java | package com.epam.amoi.employee;
import com.epam.amoi.employee.dao.EmployeeDao;
import com.epam.amoi.employee.dao.ProjectDao;
import com.epam.amoi.employee.dao.SkillsDao;
import com.epam.amoi.employee.model.Employee;
import com.epam.amoi.employee.model.EmployeeInput;
import com.epam.amoi.employee.model.Project;
import com.epam.amoi.employee.model.Technology;
import lombok.AllArgsConstructor;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
import java.util.Objects;
import java.util.Set;
@AllArgsConstructor
public class EmployeeService {
private final EmployeeDao employeeDao;
private final ProjectDao projectDao;
private final SkillsDao skillsDao;
public EmployeeService(final Connection connection) {
employeeDao = new EmployeeDao(connection);
projectDao = new ProjectDao(connection);
skillsDao = new SkillsDao(connection);
}
public Integer create(final EmployeeInput employeeInput) {
Objects.requireNonNull(employeeInput);
try {
final Project project = projectDao.insertNonExistedProject(employeeInput.getProject());
skillsDao.insertNonExistedSkills(employeeInput);
final Set<Technology> techSet = skillsDao.findTechnologiesByName(employeeInput.getTechnology());
return employeeDao.create(employeeInput, project, techSet);
} catch (final SQLException e) {
throw new RuntimeException(e);
}
}
public List<Employee> select(final int limit, final int offset) {
return employeeDao.selectPage(limit, offset);
}
}
| [
"artem_moiseenko@epam.com"
] | artem_moiseenko@epam.com |
22c6d427733ba6a3323777bfdbf01b3e69d2500e | b15803e9aaa1ca3dd3714182092626da1c96bb3a | /src/test/java/com/reserva/noblesse/web/rest/UserJWTControllerIT.java | 0ac1d70901a424569c587a70566b14cc49e77d30 | [] | no_license | gustavocaraciolo/reserva-noblesse | 16bef538b26d377378270274dc920c50f297214b | 5ce7eb11f080750cff28a9b3616dc244473bac7c | refs/heads/main | 2023-05-31T23:52:04.945439 | 2021-07-06T17:39:04 | 2021-07-06T17:39:04 | 382,347,150 | 0 | 1 | null | 2021-07-06T17:05:01 | 2021-07-02T12:58:58 | Java | UTF-8 | Java | false | false | 3,986 | java | package com.reserva.noblesse.web.rest;
import static org.hamcrest.Matchers.emptyString;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.nullValue;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import com.reserva.noblesse.IntegrationTest;
import com.reserva.noblesse.domain.User;
import com.reserva.noblesse.repository.UserRepository;
import com.reserva.noblesse.web.rest.vm.LoginVM;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.http.MediaType;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.transaction.annotation.Transactional;
/**
* Integration tests for the {@link UserJWTController} REST controller.
*/
@AutoConfigureMockMvc
@IntegrationTest
class UserJWTControllerIT {
@Autowired
private UserRepository userRepository;
@Autowired
private PasswordEncoder passwordEncoder;
@Autowired
private MockMvc mockMvc;
@Test
@Transactional
void testAuthorize() throws Exception {
User user = new User();
user.setLogin("user-jwt-controller");
user.setEmail("user-jwt-controller@example.com");
user.setActivated(true);
user.setPassword(passwordEncoder.encode("test"));
userRepository.saveAndFlush(user);
LoginVM login = new LoginVM();
login.setUsername("user-jwt-controller");
login.setPassword("test");
mockMvc
.perform(post("/api/authenticate").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(login)))
.andExpect(status().isOk())
.andExpect(jsonPath("$.id_token").isString())
.andExpect(jsonPath("$.id_token").isNotEmpty())
.andExpect(header().string("Authorization", not(nullValue())))
.andExpect(header().string("Authorization", not(is(emptyString()))));
}
@Test
@Transactional
void testAuthorizeWithRememberMe() throws Exception {
User user = new User();
user.setLogin("user-jwt-controller-remember-me");
user.setEmail("user-jwt-controller-remember-me@example.com");
user.setActivated(true);
user.setPassword(passwordEncoder.encode("test"));
userRepository.saveAndFlush(user);
LoginVM login = new LoginVM();
login.setUsername("user-jwt-controller-remember-me");
login.setPassword("test");
login.setRememberMe(true);
mockMvc
.perform(post("/api/authenticate").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(login)))
.andExpect(status().isOk())
.andExpect(jsonPath("$.id_token").isString())
.andExpect(jsonPath("$.id_token").isNotEmpty())
.andExpect(header().string("Authorization", not(nullValue())))
.andExpect(header().string("Authorization", not(is(emptyString()))));
}
@Test
void testAuthorizeFails() throws Exception {
LoginVM login = new LoginVM();
login.setUsername("wrong-user");
login.setPassword("wrong password");
mockMvc
.perform(post("/api/authenticate").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(login)))
.andExpect(status().isUnauthorized())
.andExpect(jsonPath("$.id_token").doesNotExist())
.andExpect(header().doesNotExist("Authorization"));
}
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
4787eb246270bafc8889a90dacf3c41cab1285d3 | 97abe314f90c47105d0a5a987c86c8a5eee8ace2 | /carbidev/com.nokia.tools.variant.compare_1.0.0.v20090225_01-11/src/com/nokia/tools/variant/compare/cmodel/provider/EModelRootItemProvider.java | 2d9b97ebf8147647d8ace19e1d79670bb0b414be | [] | no_license | SymbianSource/oss.FCL.sftools.depl.swconfigapps.configtools | f668c9cd73dafd83d11beb9f86252674d2776cd2 | dcab5fbd53cf585e079505ef618936fd8a322b47 | refs/heads/master | 2020-12-24T12:00:19.067971 | 2010-06-02T07:50:41 | 2010-06-02T07:50:41 | 73,007,522 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,507 | java | /*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - Initial contribution
*
* Contributors:
*
* Description: This file is part of com.nokia.tools.variant.compare component.
*/
package com.nokia.tools.variant.compare.cmodel.provider;
import java.util.Collection;
import java.util.List;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemColorProvider;
import org.eclipse.emf.edit.provider.IItemFontProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITableItemColorProvider;
import org.eclipse.emf.edit.provider.ITableItemFontProvider;
import org.eclipse.emf.edit.provider.ITableItemLabelProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
import org.eclipse.emf.edit.provider.ItemProviderAdapter;
import org.eclipse.emf.edit.provider.ViewerNotification;
import com.nokia.tools.variant.compare.CompareModelPlugin;
import com.nokia.tools.variant.compare.cmodel.ECompareModelFactory;
import com.nokia.tools.variant.compare.cmodel.ECompareModelPackage;
import com.nokia.tools.variant.compare.cmodel.EModelRoot;
/**
* This is the item provider adapter for a {@link com.nokia.tools.variant.compare.cmodel.EModelRoot} object.
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public class EModelRootItemProvider extends ItemProviderAdapter implements
IEditingDomainItemProvider, IStructuredItemContentProvider,
ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource,
ITableItemLabelProvider, ITableItemColorProvider,
ITableItemFontProvider, IItemColorProvider, IItemFontProvider {
/**
* This constructs an instance from a factory and a notifier. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public EModelRootItemProvider(AdapterFactory adapterFactory) {
super(adapterFactory);
}
/**
* This returns the property descriptors for the adapted class. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);
}
return itemPropertyDescriptors;
}
/**
* This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
* {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
* {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public Collection<? extends EStructuralFeature> getChildrenFeatures(
Object object) {
if (childrenFeatures == null) {
super.getChildrenFeatures(object);
childrenFeatures.add(ECompareModelPackage.Literals.EGROUP_CONTAINER__GROUPS);
}
return childrenFeatures;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
protected EStructuralFeature getChildFeature(Object object, Object child) {
// Check the type of the specified child object and return the proper feature to use for
// adding (see {@link AddCommand}) it as a child.
return super.getChildFeature(object, child);
}
@Override
public String getColumnText(Object object, int columnIndex) {
if (columnIndex == 0) {
return getText(object);
}
return super.getColumnText(object, columnIndex);
}
/**
* This returns EModelRoot.gif. <!-- begin-user-doc --> <!-- end-user-doc
* -->
*
* @generated
*/
@Override
public Object getImage(Object object) {
return overlayImage(object, getResourceLocator().getImage("full/obj16/EModelRoot"));
}
@Override
public Object getColumnImage(Object object, int columnIndex) {
if (columnIndex == 0) {
return getImage(object);
}
return super.getColumnImage(object, columnIndex);
}
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc
* --> <!-- end-user-doc -->
* @generated
*/
@Override
public String getText(Object object) {
return getString("_UI_EModelRoot_type");
}
/**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc --> <!--
* end-user-doc -->
* @generated
*/
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
switch (notification.getFeatureID(EModelRoot.class)) {
case ECompareModelPackage.EMODEL_ROOT__GROUPS:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
return;
}
super.notifyChanged(notification);
}
/**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s
* describing the children that can be created under this object. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
protected void collectNewChildDescriptors(
Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);
newChildDescriptors.add
(createChildParameter
(ECompareModelPackage.Literals.EGROUP_CONTAINER__GROUPS,
ECompareModelFactory.eINSTANCE.createEDiffGroup()));
}
/**
* Return the resource locator for this item provider's resources. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public ResourceLocator getResourceLocator() {
return CompareModelPlugin.INSTANCE;
}
}
| [
"none@none"
] | none@none |
d8c6e4e26a2c0e7e950c6b68cee5fcae60ae3458 | 9097a389b685f44267f4a71f7a3ec821cb64a262 | /src/main/java/ua/epam/spring/hometask/DAO/AbstractDAO.java | df1059c569bd3d4e8f68310cacbd362a050620a5 | [] | no_license | ahancharou/SpringCoreHomeTask | 088561536bbb86d6e2f733f4307829d17425df9c | 8f0bfe75c6a4869ce823d93a74e1a009e0aada1d | refs/heads/master | 2021-01-19T05:30:52.239092 | 2016-07-02T11:12:05 | 2016-07-02T11:12:05 | 60,990,864 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 302 | java | package ua.epam.spring.hometask.DAO;
import ua.epam.spring.hometask.domain.DomainObject;
import java.util.Collection;
public interface AbstractDAO<T extends DomainObject> {
public T getById(Long id);
public T save(T t);
public void remove(T t);
public Collection<T> getAll();
}
| [
"Hancharou Alex"
] | Hancharou Alex |
549593c944d36b1c0e117372a0702e319d2cad49 | 0089055286eb8663169b010733a603b94841bed7 | /querydsl-jpa/src/test/java/com/mysema/query/jpa/UniqueResultsTest.java | d8fc8bb97fef76e320947e3b500245899829d1f5 | [] | no_license | Centonni/querydsl | 993806d8d0a6913fd7a6726fb7874552a76cec79 | 0b8828a10451061b34b84dab012db184b48a2a62 | refs/heads/master | 2021-01-18T06:22:59.947426 | 2014-08-16T20:50:21 | 2014-08-16T20:50:21 | 22,810,660 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,881 | java | /*
* Copyright 2011, Mysema Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mysema.query.jpa;
import static com.mysema.query.jpa.domain.QCat.cat;
import static org.junit.Assert.assertEquals;
import org.hibernate.Session;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import com.mysema.query.jpa.domain.Cat;
import com.mysema.query.jpa.hibernate.HibernateQuery;
import com.mysema.testutil.HibernateTestRunner;
@Ignore
@RunWith(HibernateTestRunner.class)
public class UniqueResultsTest {
private Session session;
@Test
public void test() {
session.save(new Cat("Bob1", 1));
session.save(new Cat("Bob2", 2));
session.save(new Cat("Bob3", 3));
assertEquals(Integer.valueOf(1), query().from(cat).orderBy(cat.name.asc()).offset(0).limit(1).uniqueResult(cat.id));
assertEquals(Integer.valueOf(2), query().from(cat).orderBy(cat.name.asc()).offset(1).limit(1).uniqueResult(cat.id));
assertEquals(Integer.valueOf(3), query().from(cat).orderBy(cat.name.asc()).offset(2).limit(1).uniqueResult(cat.id));
assertEquals(Long.valueOf(3), query().from(cat).uniqueResult(cat.count()));
}
private HibernateQuery query() {
return new HibernateQuery(session);
}
public void setSession(Session session) {
this.session = session;
}
}
| [
"timo.westkamper@mysema.com"
] | timo.westkamper@mysema.com |
2c2000fa132e703a0f67157a9e9d9d83205930a6 | 0c1508af2aff165f286314f6ea4cb286b9b6d474 | /cloud-common/src/test/java/com/kame/cloud/AppTest.java | 7b145bb164222939078b209bdedfdbc0859cfa66 | [] | no_license | koloum/cloud | 5ccfe317d8b68ad78bdc39ed4404ae22da540ea0 | ddbe97c90e87bb78b2941f3405debfe663b718c3 | refs/heads/master | 2020-09-22T03:14:55.951635 | 2016-09-01T16:07:44 | 2016-09-01T16:07:44 | 67,110,966 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 642 | java | package com.kame.cloud;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}
| [
"koloum@163.com"
] | koloum@163.com |
a49b5577871be05f7aa995771650e6ef420d9573 | 2c40a543d7405f48ae97bbaa830e583d063a024e | /src/Lab4/Factory/Main.java | a93386141dbcb2a73c975f9d6e7046f37096246c | [] | no_license | OanaCC9/AtelierulDigital2020 | 931685e0a406ddcce61a9d92ff55889c1bc3f393 | 72a75b07aaf97f31f726ba1ec8e6af4fcb070064 | refs/heads/master | 2022-06-28T11:27:55.502635 | 2020-05-11T18:20:22 | 2020-05-11T18:20:22 | 255,405,186 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 46 | java | package Lab4.Factory;
public class Main {
}
| [
"Oana@Chiriac.com"
] | Oana@Chiriac.com |
357e47dfc193176a847721e643c4c0d63f965d7e | 0ae1e98f99eed0eee07a6459b33eca34983cf5f3 | /app/src/main/java/com/jm/newvista/ui/adapter/OrderHistoryRecyclerViewAdapter.java | 16fec192aa54578805e2cc2bf497b1a3135858ec | [
"MIT"
] | permissive | RanjitPati/NewVista-for-Customer | 6a228faee6313bdf49ca5232c060f94e0bd37268 | 3558d7b3d590dbc33527df88c1fd291d45d68dfb | refs/heads/master | 2021-09-17T03:31:31.200642 | 2018-06-27T09:27:20 | 2018-06-27T09:27:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,838 | java | package com.jm.newvista.ui.adapter;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityOptionsCompat;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.google.gson.GsonBuilder;
import com.jm.newvista.R;
import com.jm.newvista.bean.CustomerOrderEntity;
import com.jm.newvista.bean.MovieEntity;
import com.jm.newvista.ui.activity.MovieActivity;
import com.jm.newvista.ui.activity.TicketDetailActivity;
import com.jm.newvista.util.NetworkUtil;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import static com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade;
/**
* Created by Johnny on 3/31/2018.
*/
public class OrderHistoryRecyclerViewAdapter
extends RecyclerView.Adapter<OrderHistoryRecyclerViewAdapter.MyViewHolder> {
private Context context;
private List<CustomerOrderEntity> customerOrders;
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
if (context == null) {
context = parent.getContext();
}
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_order_history, parent, false);
return new MyViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull final MyViewHolder holder, final int position) {
if (customerOrders != null) {
final CustomerOrderEntity orderEntity = customerOrders.get(position);
holder.theaterName.setText(orderEntity.getTheaterName());
holder.movieTitle.setText(orderEntity.getMovieTitle());
Date date = orderEntity.getShowtime();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("h:mm:ss aa MMM d, yyyy", Locale.ENGLISH);
String dateStr = simpleDateFormat.format(date);
holder.showtime.setText(dateStr);
holder.auditoriumName.setText(orderEntity.getAuditoriumName());
holder.seatLocation.setText(orderEntity.getSeatLocation());
holder.seatLocation.setText(orderEntity.getSeatLocation());
StringBuffer orderStatusStr = new StringBuffer();
if (orderEntity.getIsPaid()) orderStatusStr.append("Paid | ");
else orderStatusStr.append("Unpaid | ");
if (orderEntity.getIsUsed()) orderStatusStr.append("Used");
else orderStatusStr.append("Unused");
holder.orderStatus.setText(orderStatusStr);
holder.cardView.setOnClickListener(v -> {
Intent intent = new Intent(context, TicketDetailActivity.class);
intent.putExtra("orderEntity", new GsonBuilder().disableHtmlEscaping().create().toJson(orderEntity));
context.startActivity(intent);
});
Glide.with(context).load(NetworkUtil.GET_MOVIE_POSTER_URL + orderEntity.getMovieTitle())
.transition(withCrossFade()).into(holder.poster);
}
}
@Override
public int getItemCount() {
return customerOrders == null ? 0 : customerOrders.size();
}
@Override
public int getItemViewType(int position) {
return position;
}
class MyViewHolder extends RecyclerView.ViewHolder implements View.OnTouchListener {
CardView cardView;
TextView theaterName;
ImageView poster;
TextView movieTitle;
TextView showtime;
TextView auditoriumName;
TextView seatLocation;
TextView orderStatus;
public MyViewHolder(View itemView) {
super(itemView);
cardView = itemView.findViewById(R.id.cardView);
theaterName = itemView.findViewById(R.id.theaterName);
poster = itemView.findViewById(R.id.poster);
movieTitle = itemView.findViewById(R.id.movieTitle);
showtime = itemView.findViewById(R.id.showtime);
auditoriumName = itemView.findViewById(R.id.auditoriumName);
seatLocation = itemView.findViewById(R.id.seatLocation);
orderStatus = itemView.findViewById(R.id.orderStatus);
cardView.setOnTouchListener(this);
}
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
ObjectAnimator upAnim = ObjectAnimator.ofFloat(v, "translationZ", 8);
upAnim.setDuration(50);
upAnim.setInterpolator(new DecelerateInterpolator());
upAnim.start();
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
ObjectAnimator downAnim = ObjectAnimator.ofFloat(v, "translationZ", 0);
downAnim.setDuration(50);
downAnim.setInterpolator(new AccelerateInterpolator());
downAnim.start();
break;
}
return false;
}
}
public List<CustomerOrderEntity> getCustomerOrders() {
return customerOrders;
}
public void setCustomerOrders(List<CustomerOrderEntity> customerOrders) {
this.customerOrders = customerOrders;
}
}
| [
"johnnysviva@outlook.com"
] | johnnysviva@outlook.com |
63edf311a00960dbd02d254afe6b8b56a7d5bea2 | e67aa88dba5cc9d297f21b12cf16a380635b0826 | /pharmaSoft/src/main/java/fr/mmm/pharmaSoft/views/ProduitFenetre.java | e0a5a8fd27ab18ba0edc91d9a856a2ff08af179f | [] | no_license | khalifandiaye/pharmasoft | 637d1f718a68eb36754c1ff5052371a5ab55035a | 5ce60b7c10be58bd66ef262ef22432094965f681 | refs/heads/master | 2021-01-01T08:21:03.408678 | 2015-03-11T21:45:48 | 2015-03-11T21:45:48 | 39,524,592 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,346 | java | package fr.mmm.pharmaSoft.views;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.border.TitledBorder;
import net.java.dev.designgridlayout.DesignGridLayout;
import org.apache.commons.validator.GenericValidator;
import fr.mmm.pharmaSoft.commun.ImagePanel;
import fr.mmm.pharmaSoft.commun.LoadProperties;
import fr.mmm.pharmaSoft.dao.MedicamentDao;
import fr.mmm.pharmaSoft.dao.TypeMedicamentDao;
import fr.mmm.pharmaSoft.dto.ComboBoxDTO;
import fr.mmm.pharmaSoft.entity.Medicament;
import fr.mmm.pharmaSoft.entity.TypeMedicament;
public class ProduitFenetre extends JFrame implements ActionListener{
/**
*
*/
private static final long serialVersionUID = 1L;
private JTextField txtNomMedicament;
private JTextField txtPrix;
private JTextField txtCodeCIP;
private JTextField txtCodeACL;
private JComboBox comboTypeMedicament;
private JTextArea txtDescription;
private TypeMedicamentDao typeMedicamentDao= new TypeMedicamentDao();
private MedicamentDao medicamentDao=new MedicamentDao();
private Integer id;
private JTextField txtDosage;
private JTextField txtPosologie;
private JTextField txtPrincipe;
private JTextField txtExpiant;
private JComboBox comboListe;
private JComboBox comboCategorie;
private JComboBox comboModeAdministration;
private JComboBox comboModeConservation;
private JComboBox comboFormeMedicament;
/**
* Create the application.
*/
public ProduitFenetre() {
initialize();
}
/**
* Create the application.
*/
public ProduitFenetre(Integer id) {
this.setId(id);
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
/*getContentPane().setBackground(new Color(0, 250, 154));
setBounds(100, 100,800, 600);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
getContentPane().setLayout(null);
JPanel panel = new JPanel();
panel.setBackground(Color.WHITE);
getContentPane().add(panel);
panel.setBounds(225, 11, 300, 30);
//panel_1.setSize(420, 420);
//panel.setLayout(null);
JLabel lblcreaMedic = new JLabel("Création d'un médicament");
lblcreaMedic.setFont(new Font("Times New Roman", Font.BOLD | Font.ITALIC, 17));
panel.add(lblcreaMedic);
JPanel panel_1 = new JPanel();
panel_1.setBackground(Color.WHITE);
getContentPane().add(panel_1);
panel_1.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Cr\u00E9ation / Modification de M\u00E9dicament", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
//panel_1.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
panel_1.setBounds(27, 64, 660, 335);
//panel_1.setSize(420, 420);
panel_1.setLayout(null);
JLabel lblNomDuMdicament = new JLabel(LoadProperties.getProperty("medicament.label.nom"));
lblNomDuMdicament.setBounds(43, 50, 125, 14);
panel_1.add(lblNomDuMdicament);
txtNomMedicament = new JTextField();
txtNomMedicament.setBounds(263, 50, 150, 20);
panel_1.add(txtNomMedicament);
txtNomMedicament.setColumns(10);
JLabel lblPrix = new JLabel(LoadProperties.getProperty("medicament.label.prix"));
lblPrix.setBounds(43, 200, 125, 14);
panel_1.add(lblPrix);
txtPrix = new JTextField();
txtPrix.setBounds(263, 200, 150, 20);
panel_1.add(txtPrix);
txtPrix.setColumns(10);
JLabel lblTypeDeMdicament = new JLabel(LoadProperties.getProperty("medicament.label.typeMedicament"));
lblTypeDeMdicament.setBounds(43, 100, 125, 14);
panel_1.add(lblTypeDeMdicament);
List<TypeMedicament> list=this.typeMedicamentDao.findAll();
List<ComboBoxDTO> listCombo=new ArrayList<ComboBoxDTO>();
for (TypeMedicament typeMedicament : list) {
listCombo.add(new ComboBoxDTO(typeMedicament.getLibelle(), typeMedicament.getNoTypeMedicament()));
}
comboTypeMedicament = new JComboBox();
if(listCombo !=null && !listCombo.isEmpty()){
comboTypeMedicament = new JComboBox(listCombo.toArray(new ComboBoxDTO[]{}));
}
comboTypeMedicament.setBounds(263, 100, 150, 20);
panel_1.add(comboTypeMedicament);
JLabel lblCode = new JLabel(LoadProperties.getProperty("medicament.label.codeMedicament"));
lblCode.setBounds(43, 150, 125, 14);
panel_1.add(lblCode);
txtCode = new JTextField();
txtCode.setBounds(263, 150, 150, 20);
panel_1.add(txtCode);
txtCode.setColumns(10);
JLabel lblDescription = new JLabel(LoadProperties.getProperty("medicament.label.descriptionMedicament"));
lblDescription.setBounds(43, 250, 125, 14);
panel_1.add(lblDescription);
txtDescription = new JTextArea();
txtDescription.setRows(8);
txtDescription.setText("décrire ");
txtDescription.setBounds(263, 250, 321, 68);
txtDescription.setBorder(BorderFactory.createLineBorder(null));
panel_1.add(txtDescription);
//Cas Modification
if(this.getId()!=null) {
Medicament med= this.medicamentDao.findByPk(this.getId());
txtNomMedicament.setText(med.getLibelle());
txtDescription.setText(med.getDescription());
txtPrix.setText(med.getPrix().toString());
txtCode.setText(med.getCode());
if(med.getType()!=null){
comboTypeMedicament.setEditable(true);
comboTypeMedicament.setSelectedItem(new ComboBoxDTO(med.getType().getLibelle(), med.getType().getNoTypeMedicament()));
}
}
JButton btnEnregistrer = new JButton("Enregistrer");
btnEnregistrer.setBackground(Color.WHITE);
btnEnregistrer.setBounds(27, 420, 112, 23);
btnEnregistrer.setActionCommand("creer");
btnEnregistrer.addActionListener(this);
getContentPane().add(btnEnregistrer);
System.out.println(LoadProperties.getProperty("medicament.label.nom"));*/
setSize(1200, 720);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel pnlWest=new ImagePanel(new ImageIcon("images/logo-pharmacie.jpg").getImage());
JPanel pnlEast=new ImagePanel(new ImageIcon("images/logo-pharmacie.jpg").getImage());
JPanel pnlSouth=new JPanel();
JPanel pnlNorth=new ImagePanel(new ImageIcon("images/pharmacienne3.jpg").getImage());
JLabel lblcreaMedic = new JLabel("Création d'un médicament");
lblcreaMedic.setFont(new Font("Times New Roman", Font.BOLD | Font.ITALIC, 17));
// pnlNorth.setLayout(new BorderLayout());
// pnlNorth.add(new ImagePanel(new ImageIcon("images/pharmacienne1.jpg").getImage()), BorderLayout.WEST);
// pnlNorth.add(new ImagePanel(new ImageIcon("images/pharmacienne2.jpg").getImage()), BorderLayout.EAST);
pnlNorth.add(lblcreaMedic, BorderLayout.CENTER);
this.setLayout(new BorderLayout());
//On ajoute le bouton au content pane de la JFrame
//Au centre
//Au nord
this.getContentPane().add(pnlNorth, BorderLayout.NORTH);
//Au sud
this.getContentPane().add(pnlSouth, BorderLayout.SOUTH);
//À l'ouest
this.getContentPane().add(pnlWest, BorderLayout.WEST);
//À l'est
this.getContentPane().add(pnlEast, BorderLayout.EAST);
JPanel pnlcentral=new JPanel();
pnlcentral.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Cr\u00E9ation / Modification de M\u00E9dicament", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
DesignGridLayout layout = new DesignGridLayout(pnlcentral);
JLabel lblNomDuMdicament = new JLabel(LoadProperties.getProperty("medicament.label.nom"));
lblNomDuMdicament.setSize(new Dimension(125, 15));
txtNomMedicament = new JTextField();
txtNomMedicament.setMaximumSize(new Dimension(225, 25));
JLabel lblPrix = new JLabel(LoadProperties.getProperty("medicament.label.prix"));
lblPrix.setMaximumSize(new Dimension(160, 25));
txtPrix = new JTextField();
txtPrix.setMaximumSize(new Dimension(160, 25));
JLabel lblTypeDeMdicament = new JLabel(LoadProperties.getProperty("medicament.label.typeMedicament"));
List<TypeMedicament> list=this.typeMedicamentDao.findAll();
List<ComboBoxDTO> listCombo=new ArrayList<ComboBoxDTO>();
for (TypeMedicament typeMedicament : list) {
listCombo.add(new ComboBoxDTO(typeMedicament.getLibelle(), typeMedicament.getNoTypeMedicament()));
}
comboTypeMedicament = new JComboBox();
if(listCombo !=null && !listCombo.isEmpty()){
comboTypeMedicament = new JComboBox(listCombo.toArray(new ComboBoxDTO[]{}));
}
JLabel lblCodeCIP = new JLabel(LoadProperties.getProperty("medicament.label.codeCIP"));
txtCodeCIP = new JTextField();
JLabel lblCodeACL = new JLabel(LoadProperties.getProperty("medicament.label.codeACL"));
txtCodeACL = new JTextField();
JLabel lblDosage = new JLabel(LoadProperties.getProperty("medicament.label.dosage"));
txtDosage = new JTextField();
JLabel lblPosologie = new JLabel(LoadProperties.getProperty("medicament.label.posologie"));
txtPosologie = new JTextField();
JLabel lblPrincipe = new JLabel(LoadProperties.getProperty("medicament.label.principe"));
txtPrincipe = new JTextField();
JLabel lblExpiant = new JLabel(LoadProperties.getProperty("medicament.label.expiant"));
txtExpiant = new JTextField();
JLabel lblListe = new JLabel(LoadProperties.getProperty("medicament.label.liste"));
comboListe = new JComboBox();
if(listCombo !=null && !listCombo.isEmpty()){
comboListe = new JComboBox(listCombo.toArray(new ComboBoxDTO[]{}));
}
JLabel lblCategorie = new JLabel(LoadProperties.getProperty("medicament.label.categorie"));
comboCategorie = new JComboBox();
if(listCombo !=null && !listCombo.isEmpty()){
comboCategorie = new JComboBox(listCombo.toArray(new ComboBoxDTO[]{}));
}
JLabel lblModeAdministration = new JLabel(LoadProperties.getProperty("medicament.label.modeAdministration"));
comboModeAdministration = new JComboBox();
if(listCombo !=null && !listCombo.isEmpty()){
comboModeAdministration = new JComboBox(listCombo.toArray(new ComboBoxDTO[]{}));
}
JLabel lblModeConservation = new JLabel(LoadProperties.getProperty("medicament.label.modeConservation"));
comboModeConservation = new JComboBox();
if(listCombo !=null && !listCombo.isEmpty()){
comboModeConservation = new JComboBox(listCombo.toArray(new ComboBoxDTO[]{}));
}
JLabel lblFormeMedicament = new JLabel(LoadProperties.getProperty("medicament.label.formeMedicament"));
comboFormeMedicament = new JComboBox();
if(listCombo !=null && !listCombo.isEmpty()){
comboFormeMedicament = new JComboBox(listCombo.toArray(new ComboBoxDTO[]{}));
}
JLabel lblDescription = new JLabel(LoadProperties.getProperty("medicament.label.descriptionMedicament"));
txtDescription = new JTextArea();
txtDescription.setRows(8);
txtDescription.setText("décrire ");
txtDescription.setBorder(BorderFactory.createLineBorder(null));
JButton btnEnregistrer = new JButton("Enregistrer");
btnEnregistrer.setBackground(Color.WHITE);
btnEnregistrer.setActionCommand("creer");
btnEnregistrer.addActionListener(this);
layout.row().grid().empty();
layout.row().grid().add(lblNomDuMdicament).add(txtNomMedicament,3).empty();
layout.row().grid().add(lblTypeDeMdicament).add(comboTypeMedicament, 3).empty();
layout.row().grid().add(lblCodeACL).add(txtCodeACL).empty().add(lblCodeCIP).add(txtCodeCIP);
layout.row().grid().add(lblDosage).add(txtDosage).empty().add(lblPosologie).add(txtPosologie);
layout.row().grid().add(lblPrincipe).add(txtPrincipe).empty().add(lblExpiant).add(txtExpiant);
layout.row().grid().add(lblListe).add(comboListe).empty().add(lblCategorie).add(comboCategorie);
layout.row().grid().add(lblModeAdministration).add(comboModeAdministration).empty().add(lblModeConservation).add(comboModeConservation);
layout.row().grid().add(lblPrix).add(txtPrix).empty().add(lblFormeMedicament).add(comboFormeMedicament);
layout.row().grid().add(lblDescription).add(txtDescription, 3).empty();
layout.row().grid().empty();
layout.row().right().add(btnEnregistrer);
this.getContentPane().add(pnlcentral, BorderLayout.CENTER);
pnlSouth.setLayout(new BorderLayout());
pnlSouth.add(new ImagePanel(new ImageIcon("images/logo-pharmacie2.jpg").getImage()), BorderLayout.WEST);
pnlSouth.add(new ImagePanel(new ImageIcon("images/logo-pharmacie2.jpg").getImage()), BorderLayout.EAST);
}
public void actionPerformed(ActionEvent e) {
if(e.getActionCommand().equals("creer")) {
Medicament medicament = new Medicament();
if(!GenericValidator.isBlankOrNull(txtPrix.getText()) && GenericValidator.isDouble( txtPrix.getText())) {
medicament.setPrix(Double.parseDouble(txtPrix.getText()));
}
if(comboTypeMedicament!=null && comboTypeMedicament.getSelectedItem()!=null){
ComboBoxDTO combo= (ComboBoxDTO) comboTypeMedicament.getSelectedItem();
TypeMedicament type=new TypeMedicament();
type.setNoTypeMedicament(combo.getValue());
medicament.setType(type);
}
if(!GenericValidator.isBlankOrNull(txtNomMedicament.getText())){
medicament.setLibelle(txtNomMedicament.getText());
}
if(!GenericValidator.isBlankOrNull(txtCodeCIP.getText())){
medicament.setCode(txtCodeCIP.getText());
}
if(!GenericValidator.isBlankOrNull(txtDescription.getText())){
medicament.setDescription(txtDescription.getText());
}
medicament=this.medicamentDao.create(medicament);
} else if(e.getActionCommand().equals("modifier")){
if(this.getId()!=null) {
Medicament medicament =this.medicamentDao.findByPk(this.getId());
if(!GenericValidator.isBlankOrNull(txtPrix.getText()) && GenericValidator.isDouble( txtPrix.getText())) {
medicament.setPrix(Double.parseDouble(txtPrix.getText()));
}
ComboBoxDTO combo= (ComboBoxDTO) comboTypeMedicament.getSelectedItem();
TypeMedicament type=new TypeMedicament();
type.setNoTypeMedicament(combo.getValue());
medicament.setType(type);
if(!GenericValidator.isBlankOrNull(txtNomMedicament.getText())){
medicament.setLibelle(txtNomMedicament.getText());
}
if(!GenericValidator.isBlankOrNull(txtCodeCIP.getText())){
medicament.setCode(txtCodeCIP.getText());
}
if(!GenericValidator.isBlankOrNull(txtDescription.getText())){
medicament.setDescription(txtDescription.getText());
}
medicament=this.medicamentDao.update(medicament);
}
}
new ListeMedicamentFenetre().setVisible(true);
this.dispose();
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
}
| [
"moustaphamb@11cddf64-6fb3-b167-68fa-693e53c0ab82"
] | moustaphamb@11cddf64-6fb3-b167-68fa-693e53c0ab82 |
31cfc91d2bb2d18225012d3501732795b4862f66 | e53e1bece2f46c0acf3fc1d7e4664846b278c3ac | /LearnJava_New/src/learnVariables/StaticVariable.java | ce8561cfb422a7a7fcd7ec5b51fc2c71bba9c11f | [] | no_license | sojiqa/Selenium_framework | efcc860cfcaf468a9368c88d6fc82778f46b038b | a7db1bd09fd6ca95fbbbeaeb0e08a257f3d69895 | refs/heads/master | 2023-05-31T07:09:42.859430 | 2021-07-05T16:19:20 | 2021-07-05T16:19:20 | 383,195,057 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 361 | java | package learnVariables;
public class StaticVariable {
static int count =10;
public void incr() {
count++;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
StaticVariable obj1= new StaticVariable ();
StaticVariable obj2= new StaticVariable ();
obj1.incr();
System.out.println(obj1.count);
System.out.println(obj2.count);
}
}
| [
"soji.olu3@gmail.com"
] | soji.olu3@gmail.com |
60aa2d69db95be1326821f1ab28bd16ec03515b5 | 84865d5553879817557c090f3d4396243390ba4f | /src/main/java/com/get/edgepay/fms/facade/FMSFacadeImpl.java | 999cb3b48fc6eb612aaad37e981ba31d7bee24a0 | [] | no_license | palashcrs/FMS | 8521dea8a5987dab099327e6986607adad35d234 | ca9347e7ffc0d3073acb354652d0dc414d82f76e | refs/heads/master | 2021-05-07T15:18:47.599406 | 2017-11-23T10:52:51 | 2017-11-23T10:52:51 | 109,932,897 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,653 | java | package com.get.edgepay.fms.facade;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.get.edgepay.fms.constant.FMSCacheConstant;
import com.get.edgepay.fms.dao.FMSRulePostgresDao;
import com.get.edgepay.fms.dao.FMSRuleTypePostgresDao;
import com.get.edgepay.fms.dao.FMSTxnPostgresDao;
import com.get.edgepay.fms.dto.FMSRuleCacheDto;
import com.get.edgepay.fms.dto.FMSRuleTypeCacheDto;
import com.get.edgepay.fms.model.FMSRule;
import com.get.edgepay.fms.model.FMSRuleType;
import com.get.edgepay.fms.model.FMSTransaction;
import com.get.edgepay.fms.util.CacheUtil;
import com.get.edgepay.fms.util.FMSUtil;
@Component
public class FMSFacadeImpl implements FMSFacade {
private static final Logger log = LoggerFactory.getLogger(FMSFacadeImpl.class);
private static final String ALL_RULETYPES = FMSCacheConstant.ALL_RULETYPES.name();
private static final String PUB_RULES = FMSCacheConstant.PUB_RULES.name();
private static final String PRI_RULES = FMSCacheConstant.PRI_RULES.name();
@Autowired
private CacheUtil cacheUtil;
@Autowired
private FMSRuleTypePostgresDao fmsRuleTypePostgresDao;
@Autowired
private FMSRulePostgresDao fmsRulePostgresDao;
@Autowired
private FMSTxnPostgresDao fmsTxnPostgresDao;
// ***************************RULE*****************
@Override
public int saveRule(List<FMSRule> fmsRules) throws Exception {
int response = saveRuleInDB(fmsRules);
if (response > 0) {
removePubRulesFromCache();
removePriRulesFromCache();
List<FMSRule> pubRules = getPubRulesFromDB();
List<FMSRule> priRules = getPriRulesFromDB();
savePubRuleInCache(pubRules);
savePriRuleInCache(priRules);
}
return response;
}
@Override
public int saveRuleInDB(List<FMSRule> fmsRules) throws Exception {
int response = fmsRulePostgresDao.insert(fmsRules);
return response;
}
@Override
public void savePubRuleInCache(List<FMSRule> fmsPubRules) {
cacheUtil.addToCache(PUB_RULES, PUB_RULES, fmsPubRules);
}
@Override
public void savePriRuleInCache(List<FMSRule> fmsPriRules) {
cacheUtil.addToCache(PRI_RULES, PRI_RULES, fmsPriRules);
}
@Override
public List<FMSRule> getPubRulesFromCache() {
List<FMSRule> pubRules = (List<FMSRule>) cacheUtil.getFromCache(PUB_RULES, PUB_RULES, FMSRuleCacheDto.class);
return pubRules;
}
@Override
public List<FMSRule> getPubRulesFromDB() throws Exception {
List<FMSRule> pubRules = fmsRulePostgresDao.getPubRules();
return pubRules;
}
@Override
public List<FMSRule> getPriRulesFromCache() {
List<FMSRule> priRules = (List<FMSRule>) cacheUtil.getFromCache(PRI_RULES, PRI_RULES, FMSRuleCacheDto.class);
return priRules;
}
@Override
public List<FMSRule> getPriRulesFromDB() throws Exception {
List<FMSRule> priRules = fmsRulePostgresDao.getPriRules();
return priRules;
}
@Override
public void removePubRulesFromCache() {
cacheUtil.removeFromCache(PUB_RULES, FMSRuleCacheDto.class);
}
@Override
public void removePriRulesFromCache() {
cacheUtil.removeFromCache(PRI_RULES, FMSRuleCacheDto.class);
}
@Override
public List<FMSRule> getAllRules() throws Exception {
List<FMSRule> fmsAllRules = null;
List<FMSRule> fmsPubRules = null;
List<FMSRule> fmsPriRules = null;
ExecutorService execotorService = Executors.newFixedThreadPool(2);
if (!execotorService.isShutdown()) {
Future<List<FMSRule>> future = execotorService.submit(new Callable<List<FMSRule>>() {
@Override
public List<FMSRule> call() throws Exception {
List<FMSRule> pubRules = getPubRulesFromCache();
return pubRules;
}
});
fmsPubRules = future.get();
}
if (!execotorService.isShutdown()) {
Future<List<FMSRule>> future = execotorService.submit(new Callable<List<FMSRule>>() {
@Override
public List<FMSRule> call() throws Exception {
List<FMSRule> priRules = getPriRulesFromCache();
return priRules;
}
});
fmsPriRules = future.get();
}
execotorService.shutdown();
if (execotorService.isShutdown()) {
fmsAllRules = FMSUtil.getInstance().mergeLists(fmsPubRules, fmsPriRules);
}
return fmsAllRules;
}
// ***************************RULETYPE*****************
@Override
public int saveRuleType(FMSRuleType fmsRuleType) throws Exception {
int response = saveRuleTypeInDB(fmsRuleType);
if (response > 0) {
removeRuleTypesFromCache();
List<FMSRuleType> allRuleTypeList = fetchAllRuleTypesFromDB();
saveRuleTypeInCache(allRuleTypeList);
}
return response;
}
@Override
public int saveRuleTypeInDB(FMSRuleType fmsRuleType) throws Exception {
int response = fmsRuleTypePostgresDao.insert(fmsRuleType);
return response;
}
@Override
public void saveRuleTypeInCache(List<FMSRuleType> allRuleTypeList) {
cacheUtil.addToCache(ALL_RULETYPES, ALL_RULETYPES, allRuleTypeList);
}
@Override
public List<FMSRuleType> fetchAllRuleTypesFromCache() {
List<FMSRuleType> allRuleTypeList = (List<FMSRuleType>) cacheUtil.getFromCache(ALL_RULETYPES, ALL_RULETYPES, FMSRuleTypeCacheDto.class);
return allRuleTypeList;
}
@Override
public List<FMSRuleType> fetchAllRuleTypesFromDB() throws Exception {
List<FMSRuleType> allRuleTypeList = fmsRuleTypePostgresDao.getAll();
return allRuleTypeList;
}
@Override
public void removeRuleTypesFromCache() {
cacheUtil.removeFromCache(ALL_RULETYPES, FMSRuleTypeCacheDto.class);
}
// ***************************TRANSACTION*****************
@Override
public List<Object> saveOrUpdateFMSTxn(FMSTransaction fmsTransaction) throws Exception {
List<Object> response = saveOrUpdateFMSTxnInDB(fmsTransaction);
//TODO: Cache update.
return response;
}
@Override
public List<Object> saveOrUpdateFMSTxnInDB(FMSTransaction fmsTransaction) throws Exception {
List<Object> response = fmsTxnPostgresDao.upsert(fmsTransaction);
return response;
}
@Override
public void saveOrUpdateFMSTxnInCache(FMSTransaction fmsTransaction) {
// TODO Auto-generated method stub
}
@Override
public List<FMSTransaction> fetchAllFMSTransactionsFromDB() throws Exception {
// TODO Auto-generated method stub
return null;
}
@Override
public List<FMSTransaction> fetchAllFMSTransactionsFromCache() {
// TODO Auto-generated method stub
return null;
}
@Override
public void removeFMSTransactionsFromCache() {
// TODO Auto-generated method stub
}
}
| [
"palashc@rssoftware.co.in"
] | palashc@rssoftware.co.in |
05942e8a2c412a92a5cb8ec885ea63a3d66bda50 | 078699ce665261621344075b1af4db54b389ec6c | /src/DatabaseHelper.java | bc2ab1eb9b1e19538a1445bd148a309bd986d1cd | [] | no_license | shofahi/AntiTowerDefense | 7b307ab5bdc3ecc92cd28171a095de8f6f76d885 | 77ce32008e017fe8dfe4b063b916c9715200056f | refs/heads/master | 2020-06-29T02:49:09.863875 | 2017-01-19T16:49:50 | 2017-01-19T16:49:50 | 74,454,834 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 757 | java | /**
* Classname: DatabaseHelper.java
* Version info 1.0
* Copyright notice: Samuel Bylund Felixon
* Date: 17/12/2017
* Course: Applikationsutveckling i Java
*/
import java.sql.SQLException;
/**
* Helper class for checking SQL exceptions.
*/
public class DatabaseHelper {
/**
* Empty constructor since it's a helper class
*/
public DatabaseHelper() {
//empty constructor -- helper class
}
/**
* Method to determin if the SQLException thrown was
* due to a table being created when there already was a table.
* @param e The caught exception
* @return Boolean
*/
public static boolean tableAlreadyExists(SQLException e) {
return e.getSQLState().equals("X0Y32");
}
}
| [
"dv11sfd@cs.umu.se"
] | dv11sfd@cs.umu.se |
4fd5ce4ae13ac230717f57885860012beb03b2fc | e3e7e67d97287f4896cfd9d424b6a7672f53b59d | /MyTravel/daoexamplegenerator/src/main/java/com/example/ExampleDaoGenerator.java | 36a7a99f17fa2bde12b34d5fde63339530b13ec0 | [] | no_license | veryjimmy/android_FinalProject | 291a0ceb129279c4887db04e83d80816d48422a9 | a03e77da694899917aeba65fc71946978dea684e | refs/heads/master | 2020-03-22T19:57:54.200610 | 2018-07-19T13:29:29 | 2018-07-19T13:29:29 | 140,564,188 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 59 | java | package com.example;
public class ExampleDaoGenerator {
}
| [
"q0u04bj3@q0u04bj3de-MacBook-Pro.local"
] | q0u04bj3@q0u04bj3de-MacBook-Pro.local |
d75b08b62b47bb157bf9d716b8c921f4c4f7b8cd | ff404f9f2eed7703a0ae9fda498b781efd6100b2 | /eclipse2/Deadlock/quz/Even.java | 06547ce09bcbd4edd7190b9c7b8224c9abe254ca | [] | no_license | gersonlobos2/X_WorkCode | a3788a3dd326b5741f12a6de1d12ad14491a2682 | a39ac8571672e37425e73e639f669924607f9218 | refs/heads/master | 2021-01-19T05:08:28.125569 | 2014-03-08T02:15:47 | 2014-03-08T02:15:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 633 | java | class Counts{
int counts = 2;
public int getCounts(){
return counts;
}
public void setCounts(int counts){
this.counts += counts;
}
}
public class Even extends Thread{
Counts counts;
public Even( Counts counts){
this.counts = counts;
}
public void run(){
try{
for(int i= 0;i<=10;i++)
{
int MxCounts;
synchronized(counts){
MxCounts = counts.getCounts();
Thread.sleep(125);
counts.setCounts(2);
System.out.print(MxCounts +",");
}
}
}catch (InterruptedException m){}
}
} | [
"gerson.lobos@whitestratus.com"
] | gerson.lobos@whitestratus.com |
0a2b5e6ed7afd25903e27238451a89b515c5cbf0 | 3e3d68af04ff43af38c8e77bcb92e760a5f983af | /src/main/java/voting/strategies/HonestScore.java | 128978b3aab3e9083c2209eea281c86162bec408 | [] | no_license | jvluso/VotingSimulator | 8b8e76154512e749bca7ddc25d78b005938eaa59 | a0bcd8a9fd270b86c6606a8997fabff1c7c8eea5 | refs/heads/master | 2021-01-21T19:01:57.945742 | 2017-06-23T23:19:06 | 2017-06-23T23:19:06 | 92,109,147 | 0 | 0 | null | 2017-06-23T23:19:07 | 2017-05-22T23:44:16 | Java | UTF-8 | Java | false | false | 1,183 | java | package voting.strategies;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import voting.population.Person;
import voting.population.Population;
import voting.voting.IdeaComparator;
public class HonestScore implements Strategy<Map<Person,Float>> {
public HonestScore(){
}
@Override
public String name() {
return "Honest Score";
}
@Override
public Ballot<Map<Person,Float>> vote(Person voter, Population candidates) {
List<Person> preference = new ArrayList<Person>(candidates.getPeople());
IdeaComparator comp = new IdeaComparator(voter.getOpinions());
float max = voter.dist(Collections.max(preference,comp).getOpinions());
float min = voter.dist(Collections.min(preference,comp).getOpinions());
Map<Person,Float> vote = new HashMap<Person,Float>();
for(Person c:preference){
vote.put(c, 1-(voter.dist(c.getOpinions())-min)/(max-min));
}
return new Ballot<Map<Person,Float>>(vote);
}
@Override
public Ballot<Map<Person, Float>> vote(Person voter, Population candidates,
List<Ballot<Map<Person, Float>>> information) {
return vote(voter,candidates);
}
}
| [
"jmacaluso@actiance.com"
] | jmacaluso@actiance.com |
1e6425574a7b89dec618b78fa44af28c904b8d34 | e2ef2b296e12f1ec79e3e661faf26cc3844f2c11 | /Android App/iTalker/app/src/main/java/net/fengyun/italker/italker/frags/assist/PermissionsFragment.java | 44deceaeadcff5c9967db1495e94bc2169e1d1ff | [] | no_license | arattlebush/fengyun | 6759cefa37327fe8a98c88b43a2e4f7065910fa3 | 456b3bbb3012bea8d4bb3c3130d30fb25710b8e5 | refs/heads/master | 2020-05-15T23:23:55.945694 | 2019-05-16T08:21:49 | 2019-05-16T08:21:49 | 182,551,171 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,646 | java | package net.fengyun.italker.italker.frags.assist;
import android.Manifest;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomSheetDialogFragment;
import android.support.v4.app.FragmentManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import net.fengyun.italker.common.app.Application;
import net.fengyun.italker.italker.R;
import net.fengyun.italker.italker.frags.media.GalleryFragment;
import java.util.List;
import pub.devrel.easypermissions.AfterPermissionGranted;
import pub.devrel.easypermissions.AppSettingsDialog;
import pub.devrel.easypermissions.EasyPermissions;
/**
* @author fengyun
* 权限弹出框
*/
public class PermissionsFragment extends BottomSheetDialogFragment
implements EasyPermissions.PermissionCallbacks{
//权限回调的标示
private static final int RC = 0x100;
public PermissionsFragment() {
// Required empty public constructor
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
//复用即可
return new GalleryFragment.TransStatusBottomSheetDialog(getContext());
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// 获取布局中的控件
View root = inflater.inflate(R.layout.fragment_permissions, container, false);
root.findViewById(R.id.btn_submit)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//点击时进行申请权限
requestPermission();
}
});
return root;
}
/**
* 刷新我们的布局中的图片状态
*
* @param root
*/
private void refreshState(View root) {
if (root == null) {
return;
}
Context context = getContext();
//网络权限
root.findViewById(R.id.im_state_permission_network)
.setVisibility(haveNetwork(context) ? View.VISIBLE : View.GONE);
//读取权限
root.findViewById(R.id.im_state_permission_read)
.setVisibility(haveReadPerm(context) ? View.VISIBLE : View.GONE);
//写入权限
root.findViewById(R.id.im_state_permission_write)
.setVisibility(haveWhitePerm(context) ? View.VISIBLE : View.GONE);
//录音权限
root.findViewById(R.id.im_state_permission_record_audio)
.setVisibility(haveRecordAduioPerm(context) ? View.VISIBLE : View.GONE);
}
@Override
public void onResume() {
super.onResume();
//界面显示的时候刷新一下
refreshState(getView());
}
/**
* 获取是否有网络权限
*
* @param context 上下文
* @return true代表有这个权限
*/
private static boolean haveNetwork(Context context) {
//准备检查我们的网络权限
String[] perms = new String[]{
Manifest.permission.INTERNET,
Manifest.permission.ACCESS_NETWORK_STATE,
Manifest.permission.ACCESS_WIFI_STATE
};
return EasyPermissions.hasPermissions(context, perms);
}
/**
* 获取是否有外部存储权限
*
* @param context 上下文
* @return true代表有这个权限
*/
private static boolean haveReadPerm(Context context) {
//准备检查我们的读取权限
String[] perms = new String[]{
Manifest.permission.READ_EXTERNAL_STORAGE
};
return EasyPermissions.hasPermissions(context, perms);
}
/**
* 获取是否有写入权限
*
* @param context 上下文
* @return true代表有这个权限
*/
private static boolean haveWhitePerm(Context context) {
//准备检查我们的写入权限
String[] perms = new String[]{
Manifest.permission.WRITE_EXTERNAL_STORAGE
};
return EasyPermissions.hasPermissions(context, perms);
}
/**
* 获取是否有录音权限
*
* @param context 上下文
* @return true代表有这个权限
*/
private static boolean haveRecordAduioPerm(Context context) {
//准备检查我们的录音权限
String[] perms = new String[]{
Manifest.permission.RECORD_AUDIO
};
return EasyPermissions.hasPermissions(context, perms);
}
/**
* 私有的show方法
* @param manager fragment管理器
*/
private static void show(FragmentManager manager) {
//调用BottomSheetDialogFragment以及准备好的显示方法
new PermissionsFragment()
.show(manager, PermissionsFragment.class.getName());
}
/**
* 检查是否有所有权限
* @param context 上下文
* @param manager fragment管理器
* @return True是有所有权限,false代表没有所有权限
*/
public static boolean haveAll(Context context, FragmentManager manager) {
boolean haveAll = haveNetwork(context) && haveReadPerm(context) && haveWhitePerm(context) && haveRecordAduioPerm(context);
if (!haveAll) {
show(manager);
}
return haveAll;
}
/**
* 申请权限的方法
*/
@AfterPermissionGranted(RC)
private void requestPermission(){
String[] perms = new String[]{
Manifest.permission.INTERNET,
Manifest.permission.ACCESS_NETWORK_STATE,
Manifest.permission.ACCESS_WIFI_STATE,
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_PHONE_STATE,
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.RECORD_AUDIO
};
if(EasyPermissions.hasPermissions(getContext(), perms)){
Application.showToast(R.string.label_permission_ok);
//Fragment中调用getView得到跟布局 前提是在onCreate之后
refreshState(getView());
}else{
//请求数据
EasyPermissions.requestPermissions(this,getString(
R.string.title_assist_permissions),RC,perms);
}
}
@Override
public void onPermissionsGranted(int requestCode, List<String> perms) {
}
@Override
public void onPermissionsDenied(int requestCode, List<String> perms) {
//如果权限有没有申请成功的权限存在,则弹出弹出框,用户点击后去到设置界面打开权限
if(EasyPermissions.somePermissionPermanentlyDenied(this,perms)){
new AppSettingsDialog
.Builder(this)
.build()
.show();
}
}
/**
* 权限申请格式后回调的方法,把这个方法吧对应的权限申请状态交给EasyPermissons框架
*/
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
//传递对应的参数,并且告知接受权限的处理者是我自己
EasyPermissions.onRequestPermissionsResult
(requestCode,permissions,grantResults,this);
}
}
| [
"717673607@qq.com"
] | 717673607@qq.com |
d79857522397e48f244ef3c31ec5bc43de1e3564 | 63fb08f3b3294b76cbabd994d4209c70ec2bb765 | /apple-data-hbase2x/src/main/java/com/appleframework/data/hbase/client/rowkey/handler/BytesRowKeyHandler.java | 72b0f7ca1e10cba4942fdb9b34438cbf77f9220b | [
"Apache-2.0"
] | permissive | xushaomin/apple-data | 57732f434e18ecf8bf744ca6a5d59f50a55a0968 | e6012779d277d8528cf988c64986e1d1f93e2066 | refs/heads/master | 2022-12-22T17:39:50.339652 | 2019-08-24T08:21:49 | 2019-08-24T08:21:49 | 32,147,622 | 2 | 17 | Apache-2.0 | 2022-12-16T03:35:33 | 2015-03-13T09:37:17 | Java | UTF-8 | Java | false | false | 331 | java | package com.appleframework.data.hbase.client.rowkey.handler;
import com.appleframework.data.hbase.client.rowkey.BytesRowKey;
/**
* @author xinzhi
*/
public class BytesRowKeyHandler implements RowKeyHandler {
@Override
public BytesRowKey convert(byte[] row) {
return new BytesRowKey(row);
}
}
| [
"xushaomin@foxmail.com"
] | xushaomin@foxmail.com |
ec1fb76f6310adf4ac25f97dd1cfdf9d771863e3 | a5b4d253f109734688b1cc822ec09b61123c59ea | /maya-client-process/src/com/infobox/client/clientConnectionRunnable.java | fec8a782981abd79532a524c50eb1f41d648f071 | [] | no_license | elmaciy/infobox | 52c889fa017accf4caee4f0d5ea35f8e9aada553 | 3bc971bc3e0e87aa9aee3144a5e514be2965f4fe | refs/heads/master | 2023-07-23T10:13:56.140283 | 2018-11-19T16:36:01 | 2018-11-19T16:36:01 | 156,026,780 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,703 | java | package com.infobox.client;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
public class clientConnectionRunnable implements Runnable {
clientProxyDriver cp=null;
protected Socket clientSocket = null;
String server_proxy_host="";
int server_proxy_port=0;
Socket ProxyserverSocket =null;
byte[] buf_from_client=null;
byte[] buf_from_server=null;
int BUFFER_SIZE=4096*10;
Cipher cipher_encoder =null;
Cipher cipher_decoder =null;
public clientConnectionRunnable(
clientProxyDriver cp,
Socket clientSocket,
String server_proxy_host,
int server_proxy_port,
int BUFFER_SIZE
) {
this.cp=cp;
this.clientSocket = clientSocket;
this.server_proxy_host=server_proxy_host;
this.server_proxy_port=server_proxy_port;
this.BUFFER_SIZE=BUFFER_SIZE;
buf_from_client=new byte[this.BUFFER_SIZE];
buf_from_server=new byte[this.BUFFER_SIZE];
}
//----------------------------------------------------------------
public void run() {
if (!initCiphers()) return;
DataInputStream from_client = null;
DataOutputStream to_client = null;
DataInputStream from_server = null;
DataOutputStream to_server = null;
//---------------------------------
boolean socket_ok=false;
try {
System.out.println("Connecting to "+server_proxy_host+":"+server_proxy_port+"...");
ProxyserverSocket = new Socket(server_proxy_host, server_proxy_port);
ProxyserverSocket.setKeepAlive(true);
ProxyserverSocket.setSendBufferSize(BUFFER_SIZE);
ProxyserverSocket.setReceiveBufferSize(BUFFER_SIZE);
System.out.println("Connected to "+server_proxy_host+":"+server_proxy_port+"...");
from_server=new DataInputStream(new BufferedInputStream(ProxyserverSocket.getInputStream()));
to_server=new DataOutputStream(new BufferedOutputStream(ProxyserverSocket.getOutputStream()));
socket_ok=true;
} catch (UnknownHostException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
//---------------------------------
boolean client_disconnect=false;
boolean server_disconnect=false;
if (socket_ok)
try {
from_client = new DataInputStream(new BufferedInputStream(clientSocket.getInputStream()));
to_client = new DataOutputStream(new BufferedOutputStream(clientSocket.getOutputStream()));
int read_size=0;
int available_from_client_size=0;
int read_from_client_size=0;
int block_size_for_client=0;
int available_from_server_size=0;
int read_from_server_size=0;
int block_size_for_server=0;
//long sleep_time=1;
boolean break_loop=false;
long last_client_read_ts=System.currentTimeMillis();
long last_check_client_ts=System.currentTimeMillis();
// int changed_read_size=0;
while(!break_loop) {
if (client_disconnect || server_disconnect) break;
//Check coming stream from client and
//if available, send it to server directly
available_from_client_size=from_client.available();
if (available_from_client_size>0) {
block_size_for_client=available_from_client_size;
if(available_from_client_size>BUFFER_SIZE)
block_size_for_client=BUFFER_SIZE;
read_from_client_size=0;
while(true) {
read_size=from_client.read(buf_from_client, 0, block_size_for_client);
last_client_read_ts=System.currentTimeMillis();
if (read_size==-1) {
System.out.println("Client read error...");
client_disconnect=true;
break;
}
/*
changed_read_size=cp.checkPackage(buf_from_client,read_size, cp.FROM_CLIENT,
from_server, to_server,
from_client, to_client,
null, null);
*/
cp.mydebug("Original bytes from client : "+read_size);
cp.printByteArray(buf_from_client, read_size);
byte[] encodedbuf=proxyLib.ecryptByteArray(cipher_encoder, buf_from_client, read_size);
int encoded_len=encodedbuf.length;
cp.mydebug("Encoded bytes from client : "+encoded_len);
cp.printByteArray(encodedbuf, encoded_len);
//cp.printByteArray(encodedbuf);
to_server.write(buf_from_client, 0, read_size);
//to_server.write(encodedbuf, 0, encoded_len);
to_server.flush();
cp.mydebug("written successfullly.");
read_from_client_size+= Math.abs(read_size) ;
if (read_from_client_size>=available_from_client_size) {
to_server.flush();
break;
}
}
}
//Check coming stream from server
available_from_server_size=from_server.available();
if (available_from_server_size>0) {
block_size_for_server=available_from_server_size;
if(available_from_server_size>BUFFER_SIZE)
block_size_for_server=BUFFER_SIZE;
read_from_server_size=0;
while(true) {
read_size=from_server.read(buf_from_server, 0, block_size_for_server);
if (read_size==-1) {
cp.mylog("Server read error...");
server_disconnect=true;
break;
}
/*
changed_read_size=cp.checkPackage(buf_from_server,read_size, cp.FROM_SERVER,
from_server, to_server,
from_client, to_client,
cipher_decoder, cp.public_key_byte_arr);
*/
to_client.write(buf_from_server, 0, read_size);
//to_client.flush();
read_from_server_size+=read_size;
if (read_from_server_size>=available_from_server_size) {
to_client.flush();
break;
}
}
}
else Thread.sleep(1);
} //while !break
} catch(Exception e) {
e.printStackTrace();
}
System.out.println("Closing client ...");
try{to_client.close();} catch(Exception e) {}
try{from_client.close();} catch(Exception e) {}
try{from_server.close();} catch(Exception e) {}
try{to_server.close();} catch(Exception e) {}
try{clientSocket.close();} catch(Exception e) {}
try{ProxyserverSocket.close();} catch(Exception e) {}
System.out.println("Bye...");
}
//----------------------------------------------------------------
boolean initCiphers() {
try {
cp.mylog("initializing encoder cipher... ");
cipher_encoder = Cipher.getInstance(proxyLib.cipher_method);
SecretKeySpec secretKey1 = new SecretKeySpec(cp.public_key_byte_arr, proxyLib.AES);
cipher_encoder.init(Cipher.ENCRYPT_MODE, secretKey1, proxyLib.ivspec);
cp.mylog("initializing decoder cipher... ");
cipher_decoder = Cipher.getInstance(proxyLib.cipher_method);
SecretKeySpec secretKey2 = new SecretKeySpec(cp.public_key_byte_arr, proxyLib.AES);
cipher_decoder.init(Cipher.DECRYPT_MODE, secretKey2, proxyLib.ivspec);
cp.mylog("ciphers initialized. ");
return true;
} catch(Exception e) {
e.printStackTrace();
cp.mylog("ciphers is NOT initialized... ");
return false;
}
}
}
| [
"Asus@YELMACI-WORK-PC"
] | Asus@YELMACI-WORK-PC |
58ab655e9d7d4a0f5778b8b2475651156e6555d4 | ab0039386f57ac01eb29b77d6bbf92b4b7f90544 | /src/main/java/ru/job4j/cache/DirFileCache.java | cf21086ec8739d25f5787b90d92ca5f88d69c0c5 | [] | no_license | kva-devops/job4j_design | 9aafdb59f898626a1eaeda089e80ed8cedc62866 | b9cc51b8930ff97818409eb77b8724283e742941 | refs/heads/master | 2023-06-25T05:28:37.306935 | 2021-07-26T09:03:51 | 2021-07-26T09:03:51 | 366,704,891 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 765 | java | package ru.job4j.cache;
import java.lang.ref.SoftReference;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Objects;
public class DirFileCache extends AbstractCache<String, String> {
private final String cachingDir;
public DirFileCache(String cachingDir) {
this.cachingDir = cachingDir;
}
@Override
protected String load(String key) {
Path dirFile;
String result;
dirFile = Path.of(cachingDir + "/" + key);
try {
result = Files.readString(dirFile);
cache.put(key, new SoftReference<>(result));
return result;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
} | [
"kva.devops@gmail.com"
] | kva.devops@gmail.com |
5b002d5988493e63afa8cd8b8055197e744ffc55 | 6bfa3ee632de6a3650d38c3565293fc29423a280 | /MapLocation/app/src/main/java/com/example/nghia/maplocation/MainActivity.java | cfdf86b58294f378392bdb08d7f9c09904d88fa5 | [] | no_license | nvnghia2212/MobileApplication-JavaAndroid | 6b1affff6fd6e304a3cf26c48f4cb5b7843104d3 | e00eee330d361d7cd78adc7678936830fff4c2d0 | refs/heads/master | 2023-03-24T16:07:46.054596 | 2021-03-03T06:35:49 | 2021-03-03T06:35:49 | 343,992,180 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 34,660 | java | package com.example.nghia.maplocation;
import android.Manifest;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.FragmentManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.location.Address;
import android.location.Geocoder;
import android.location.Location;
import android.location.LocationManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.AuthFailureError;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.example.nghia.maplocation.map.ServiceAPI;
import com.example.nghia.maplocation.map.direction.DirectionRoot;
import com.github.clans.fab.FloatingActionButton;
import com.github.clans.fab.FloatingActionMenu;
import com.google.android.gms.auth.api.signin.GoogleSignIn;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInClient;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.SignInButton;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.FusedLocationProviderClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.maps.model.PolylineOptions;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.maps.android.PolyUtil;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class MainActivity extends Activity implements
OnMapReadyCallback,
GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener,
GoogleMap.OnMarkerClickListener,
View.OnClickListener{
String urlInsertUpdate = "http://192.168.2.19:8080/androidwebservice/updateorinsertuser.php";
String urlSelectFriend = "http://192.168.56.1:8080/androidwebservice/selectfriend.php";
static String urlSelectMemberDating = "http://192.168.56.1:8080/androidwebservice/selectmemberdating.php";
String urlDating = "http://192.168.56.1:8080/androidwebservice/selectdating.php";
//GG Sign-in
public static GoogleSignInClient mGoogleSignInClient;
int RC_SIGN_IN = 277;
ImageView imgLogout;
ImageView imgMove;
ImageView imgStop;
ImageView imgTimeDating;
ImageView imgDirect;
static ImageView imgFriendMarker;
static ImageView imgNotFriendMarker;
String email,displayNameUser,givenNameUser,familyNameUser;
TextView txtName;
private static GoogleMap googleMap;
private GoogleApiClient apiClient;
private LocationRequest locationRequest;
private Location currentLocation;
// Vẽ tuyến đường
private static List<LatLng> decodedPath;
private static String polylines;
private static Retrofit retrofit;
private static final int GPS_PERMISSION_REQUEST_CODE = 1;
//Floating Action Menu
FloatingActionMenu floatingFriendMenu,floatingMapMenu;
FloatingActionButton floatingSearchFriend,floatingRequestFriend,floatingFriend,floatingSearchMap,floatingDirection,floatingChatGroup;
FragmentManager fragmentManager = getFragmentManager();
android.app.FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
//auto update
private Handler mHandler = new Handler();
//intent dating
String nameAddress,dateAddress,dateTimeAdd,userAdd;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initRetrofit();
MapFragment mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
// GG Sign-in
//yêu cầu ng dùng cung cấp thông tin cơ bản
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.build();
//tạo một đối tượng GoogleSignInClient
mGoogleSignInClient = GoogleSignIn.getClient(this, gso);
//tạo nút signin và gán sự kiện setOnclick
SignInButton signInButton = findViewById(R.id.sign_in_button);
signInButton.setSize(SignInButton.SIZE_STANDARD);
findViewById(R.id.sign_in_button).setOnClickListener(this);
//nút logout
imgLogout = findViewById(R.id.imgLogout);
findViewById(R.id.imgLogout).setOnClickListener(this);
txtName = findViewById(R.id.txtName);
imgMove = findViewById(R.id.imgMove);
findViewById(R.id.imgMove).setOnClickListener(this);
imgStop = findViewById(R.id.imgStop);
findViewById(R.id.imgStop).setOnClickListener(this);
imgFriendMarker = findViewById(R.id.imgFriendMarker);
findViewById(R.id.imgFriendMarker).setOnClickListener(this);
imgNotFriendMarker = findViewById(R.id.imgNotFriendMarker);
findViewById(R.id.imgNotFriendMarker).setOnClickListener(this);
imgTimeDating = findViewById(R.id.imgTimeDating);
findViewById(R.id.imgTimeDating).setOnClickListener(this);
imgDirect = findViewById(R.id.imgDirect);
//Floating Action Menu
floatingFriendMenu = findViewById(R.id.floatingFriendMenu);
floatingMapMenu = findViewById(R.id.floatingMapMenu);
floatingSearchFriend = findViewById(R.id.floatingSearchFriend);
findViewById(R.id.floatingSearchFriend).setOnClickListener(this);
floatingRequestFriend = findViewById(R.id.floatingRequestFriend);
findViewById(R.id.floatingRequestFriend).setOnClickListener(this);
floatingFriend = findViewById(R.id.floatingFriend);
findViewById(R.id.floatingFriend).setOnClickListener(this);
floatingSearchMap = findViewById(R.id.floatingSearchMap);
findViewById(R.id.floatingSearchMap).setOnClickListener(this);
floatingDirection = findViewById(R.id.floatingDirection);
findViewById(R.id.floatingDirection).setOnClickListener(this);
floatingChatGroup = findViewById(R.id.floatingChatGroup);
findViewById(R.id.floatingChatGroup).setOnClickListener(this);
}
private void initRetrofit(){
retrofit = new Retrofit.Builder()
.baseUrl("https://maps.googleapis.com/maps/api/")
.addConverterFactory(GsonConverterFactory.create())
.build();
}
private void buildApiClient(){
apiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.build();
apiClient.connect();
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
switch (requestCode){
case GPS_PERMISSION_REQUEST_CODE:
if (grantResults.length > 0 && grantResults [0] == PackageManager.PERMISSION_GRANTED){
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) ==
PackageManager.PERMISSION_GRANTED){
if (apiClient == null){
buildApiClient();
}
googleMap.setMyLocationEnabled(true);
}else {
// Toast.makeText(getApplicationContext(),"Error",Toast.LENGTH_SHORT).show();
}
}
break;
}
}
@Override
public void onMapReady(final GoogleMap googleMap) {
this.googleMap = googleMap;
this.googleMap.setOnMarkerClickListener(this);
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED ) {
buildApiClient();
this.googleMap.setMyLocationEnabled(true);
}else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){
requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, GPS_PERMISSION_REQUEST_CODE);
}
}
}
private void clickMyLocation(){
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED){
final FusedLocationProviderClient mF = LocationServices.getFusedLocationProviderClient(this);
mF.getLastLocation().addOnSuccessListener(this, new OnSuccessListener<Location>() {
@Override
public void onSuccess(Location location) {
if (location != null) {
currentLocation = location;
LatLng myLocation = new LatLng(currentLocation.getLatitude(),currentLocation.getLongitude());
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(myLocation, 17));
}
}
});
}
}
// Lấy vị trí
private void getLocation (){
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED){
final FusedLocationProviderClient mF = LocationServices.getFusedLocationProviderClient(this);
mF.getLastLocation().addOnSuccessListener(this, new OnSuccessListener<Location>() {
@Override
public void onSuccess(Location location) {
if (location != null) {
currentLocation = location;
LatLng myLocation = new LatLng(currentLocation.getLatitude(),currentLocation.getLongitude());
if (txtName.getText().toString().equals("")){
SignIn();
}else {
ReadJSONInsertUpdate(1);
}
}
}
});
}
}
// Vẽ tuyến đường
public static void getDirection(LatLng origin, LatLng destination){
//Chưa test xóa đc vì chưa đăng kí đc api <==================================== Chưa Test Đc
// if (polylines != null){
// decodedPath.remove(polylines);
// }
ServiceAPI serviceAPI = retrofit.create(ServiceAPI.class);
String originAddress = String.valueOf(origin.latitude) + "," + String.valueOf(origin.longitude);
String destinationAddress = String.valueOf(destination.latitude) + "," + String.valueOf(destination.longitude);
Call<DirectionRoot> call = serviceAPI.getDirection(originAddress,destinationAddress);
call.enqueue(new Callback<DirectionRoot>() {
@Override
public void onResponse(Call<DirectionRoot> call, Response<DirectionRoot> response) {
DirectionRoot directionRoot = response.body();
// String polylines = directionRoot.getRoutes().get(0).getOverview_polyline().getPoints();
polylines = directionRoot.getRoutes().get(0).getOverview_polyline().getPoints();
// List<LatLng> decodedPath = PolyUtil.decode(polylines);
decodedPath = PolyUtil.decode(polylines);
googleMap.addPolyline(new PolylineOptions().addAll(decodedPath));
decodedPath.remove(polylines);
}
@Override
public void onFailure(Call<DirectionRoot> call, Throwable t) {
}
});
}
@Override
public void onConnected(@Nullable Bundle bundle) {
locationRequest = new LocationRequest();
locationRequest.setInterval(1000);
locationRequest.setFastestInterval(1000);
locationRequest.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY);
// locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
getLocation();
clickMyLocation();
}
@Override
public void onConnectionSuspended(int i) {
}
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
}
// Click Marker
@Override
public boolean onMarkerClick(final Marker marker) {
imgDirect.setVisibility(View.GONE);
imgDirect.setVisibility(View.VISIBLE);
imgDirect.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LatLng currLatLng = new LatLng(currentLocation.getLatitude(),currentLocation.getLongitude());
getDirection(currLatLng, marker.getPosition());
imgDirect.setVisibility(View.GONE);
}
});
return false;
}
//Add Maker
public static void AddMarker(Double latitude, Double longitude ,String title, String snippet) {
googleMap.clear();
imgFriendMarker.setVisibility(View.VISIBLE);
imgNotFriendMarker.setVisibility(View.GONE);
LatLng Location = new LatLng(latitude,longitude);
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(Location, 17));
googleMap.addMarker(new MarkerOptions()
.title(title)
.snippet(snippet)
.position(Location)).showInfoWindow();
}
// ON Click
@Override
public void onClick(View v) {
Intent intent = null;
switch (v.getId()) {
case R.id.imgTimeDating:
intent = new Intent(MainActivity.this, DatingActivity.class);
intent.putExtra("emailuser", email);
startActivity(intent);
break;
case R.id.imgFriendMarker:
ReadJSONSelectAllFriend(urlSelectFriend);
imgFriendMarker.setVisibility(View.GONE);
imgNotFriendMarker.setVisibility(View.VISIBLE);
imgDirect.setVisibility(View.GONE);
break;
case R.id.imgNotFriendMarker:
googleMap.clear();
imgFriendMarker.setVisibility(View.VISIBLE);
imgNotFriendMarker.setVisibility(View.GONE);
imgDirect.setVisibility(View.GONE);
break;
case R.id.imgMove:
AlertDialog.Builder dialogMove = new AlertDialog.Builder(this);
dialogMove.setMessage("Bạn muốn bật chế độ di chuyển");
dialogMove.setPositiveButton("Có", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
autoClickMyLocation();
imgMove.setVisibility(View.GONE);
imgStop.setVisibility(View.VISIBLE);
imgDirect.setVisibility(View.GONE);
}
});
dialogMove.setNegativeButton("Không", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
dialogMove.show();
break;
case R.id.imgStop:
AlertDialog.Builder dialogStop = new AlertDialog.Builder(this);
dialogStop.setMessage("Bạn muốn ngừng chế độ di chuyển");
dialogStop.setPositiveButton("Có", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
mHandler.removeCallbacks(autoZoom);
imgMove.setVisibility(View.VISIBLE);
imgStop.setVisibility(View.GONE);
imgDirect.setVisibility(View.GONE);
}
});
dialogStop.setNegativeButton("Không", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
dialogStop.show();
break;
case R.id.imgLogout:
mHandler.removeCallbacks(autoUpload);
mHandler.removeCallbacks(autoZoom);
SignOut();
SignIn();
break;
case R.id.floatingSearchFriend:
// Toast.makeText(MainActivity.this,email,Toast.LENGTH_SHORT).show();
intent = new Intent(MainActivity.this, SearchActivity.class);
intent.putExtra("emailuser", email);
startActivity(intent);
break;
case R.id.floatingRequestFriend:
// Toast.makeText(MainActivity.this,email,Toast.LENGTH_SHORT).show();
intent = new Intent(MainActivity.this, RequestFriendActivity.class);
intent.putExtra("emailuser", email);
startActivity(intent);
break;
case R.id.floatingFriend:
// Toast.makeText(MainActivity.this,email,Toast.LENGTH_SHORT).show();
intent = new Intent(MainActivity.this, FriendActivity.class);
intent.putExtra("emailuser", email);
startActivity(intent);
break;
case R.id.floatingChatGroup:
// Toast.makeText(MainActivity.this,email,Toast.LENGTH_SHORT).show();
intent = new Intent(MainActivity.this, GroupActivity.class);
intent.putExtra("emailuser", email);
startActivity(intent);
break;
case R.id.floatingSearchMap:
imgDirect.setVisibility(View.GONE);
fragmentTransaction = fragmentManager.beginTransaction();
FragmentDescriotionMap fragmentDescriptionMap = (FragmentDescriotionMap) getFragmentManager().findFragmentByTag("FragmentDescriptionMap");
if (fragmentDescriptionMap != null)
{
fragmentTransaction.remove(fragmentDescriptionMap);
}
fragmentManager.popBackStack();
fragmentTransaction.add(R.id.framConten,new FragmentSearchMap(),"FragmentSearchMap");
fragmentTransaction.addToBackStack("");
fragmentTransaction.commit();
break;
case R.id.floatingDirection:
imgDirect.setVisibility(View.GONE);
fragmentTransaction = fragmentManager.beginTransaction();
FragmentSearchMap fragmentSearchMap = (FragmentSearchMap) getFragmentManager().findFragmentByTag("FragmentSearchMap");
if (fragmentSearchMap != null)
{
fragmentTransaction.remove(fragmentSearchMap);
}
fragmentManager.popBackStack();
fragmentTransaction.add(R.id.framConten,new FragmentDescriotionMap(),"FragmentDescriptionMap");
fragmentTransaction.addToBackStack("");
fragmentTransaction.commit();
break;
}
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RC_SIGN_IN) {
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
handleSignInResult(task);
}
}
private void handleSignInResult(Task<GoogleSignInAccount> completedTask) {
try {
GoogleSignInAccount account = completedTask.getResult(ApiException.class);
email = account.getEmail();
familyNameUser = account.getFamilyName();
givenNameUser = account.getGivenName();
displayNameUser = account.getDisplayName();
autoUp();
txtName.setText(displayNameUser);
txtName.setVisibility(View.VISIBLE);
findViewById(R.id.sign_in_button).setVisibility(View.GONE);
imgLogout.setVisibility(View.VISIBLE);
AlertDialog.Builder dialogStop = new AlertDialog.Builder(this);
dialogStop.setMessage("Nhắc Nhở :\nBạn nên kiểm tra danh sách những điểm hẹn thường xuyên để không quên thời gian !");
dialogStop.setPositiveButton("Đồng Ý", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
dialogStop.show();
} catch (ApiException e) {
}
}
//Funtion GG signIn
private void SignIn() {
Intent signInIntent = mGoogleSignInClient.getSignInIntent();
startActivityForResult(signInIntent, RC_SIGN_IN);
}
//Funtion GG signOut
private void SignOut() {
MainActivity.mGoogleSignInClient.signOut()
.addOnCompleteListener(this, new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
// Toast.makeText(MainActivity.this,email,Toast.LENGTH_SHORT).show();
ReadJSONInsertUpdate(0);
findViewById(R.id.sign_in_button).setVisibility(View.VISIBLE);
imgLogout.setVisibility(View.GONE);
txtName.setVisibility(View.GONE);
}
});
}
// Upload Đăng Nhập
private void ReadJSONInsertUpdate (final int x){
RequestQueue requestQueue = Volley.newRequestQueue(this);
StringRequest stringRequest = new StringRequest(Request.Method.POST, urlInsertUpdate,
new com.android.volley.Response.Listener<String>() {
@Override
public void onResponse(String response) {
if (response.trim().equals("updatesuccess")){
// Toast.makeText(MainActivity.this, "updatesuccess", Toast.LENGTH_SHORT).show();
}else if (response.trim().equals("updateerror")){
// Toast.makeText(MainActivity.this, "updateerror", Toast.LENGTH_SHORT).show();
}else if (response.trim().equals("addsuccess")){
// Toast.makeText(MainActivity.this, "addsuccess", Toast.LENGTH_SHORT).show();
}else if (response.trim().equals("adderror")) {
// Toast.makeText(MainActivity.this, "adderror", Toast.LENGTH_SHORT).show();
}
// Toast.makeText(MainActivity.this, response.toString(), Toast.LENGTH_SHORT).show();
}
}, new com.android.volley.Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
// Toast.makeText(MainActivity.this, error.toString(), Toast.LENGTH_SHORT).show();
Log.d("AAA","Loi ! \n"+error.toString());
}
}
){
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String,String> params = new HashMap<>();
params.put("emailUser",email);
params.put("givennameUser",familyNameUser);
params.put("nameUser",givenNameUser);
params.put("latitudeUser", String.valueOf(currentLocation.getLatitude()));
params.put("longitudeUser",String.valueOf(currentLocation.getLongitude()));
params.put("onloffUser", String.valueOf(x));
return params;
}
};
stringRequest.setRetryPolicy(
new DefaultRetryPolicy(
0,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
requestQueue.add(stringRequest);
}
private void autoUp (){
mHandler.removeCallbacks(autoUpload);
mHandler.postDelayed(autoUpload, 1000);
}
private Runnable autoUpload = new Runnable() {
public void run() {
getLocation();
mHandler.postDelayed(autoUpload, 2000);
}
};
private void autoClickMyLocation (){
mHandler.removeCallbacks(autoZoom);
mHandler.postDelayed(autoZoom, 1000);
}
private Runnable autoZoom = new Runnable() {
public void run() {
clickMyLocation();
mHandler.postDelayed(autoZoom, 2000);
}
};
private void ReadJSONSelectAllFriend (String url){
RequestQueue requestQueue = Volley.newRequestQueue(this);
StringRequest stringRequest = new StringRequest(Request.Method.POST, url,
new com.android.volley.Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONArray jsonArray = new JSONArray(response);
// Toast.makeText(FriendActivity.this, jsonArray.toString(), Toast.LENGTH_SHORT).show();
Log.d("BBB","Loi ! \n"+jsonArray.toString());
for (int i = 0 ; i<= jsonArray.length(); i++) {
JSONObject object = jsonArray.getJSONObject(i);
int idJson = object.getInt("ID");
String emailJson = object.getString("Email");
String giveNameJson = object.getString("GivenName");
String nameJson = object.getString("Name");
Double latitudeJson = object.getDouble("Latitude");
Double longitudeNJson = object.getDouble("Longitude");
int onlOffJson = object.getInt("OnlOff");
if (onlOffJson == 1){
// AddMarker(latitudeJson,longitudeNJson,giveNameJson +" "+nameJson,emailJson);
LatLng Location = new LatLng(latitudeJson,longitudeNJson);
googleMap.addMarker(new MarkerOptions()
.title(giveNameJson +" "+nameJson)
.snippet(emailJson)
.position(Location)
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_VIOLET)))
.showInfoWindow();
}
}
} catch (JSONException e) {
e.printStackTrace();
}
// Toast.makeText(MainActivity.this, response.toString(), Toast.LENGTH_SHORT).show();
// Log.d("AAA","Loi ! \n"+response.toString());
}
}, new com.android.volley.Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(MainActivity.this, error.toString(), Toast.LENGTH_SHORT).show();
}
}
){
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String,String> params = new HashMap<>();
params.put("emailUser",email);
return params;
}
// Cho phép StringRequest nhận JsonArray
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String,String> headers = new HashMap<>();
headers.put("Accept","application/json");
return headers;
}
};
stringRequest.setRetryPolicy(
new DefaultRetryPolicy(
0,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
requestQueue.add(stringRequest);
}
public static void ReadJSONSelectMemberDating(final Context context,final String nameAddress, final String dateAddress, final String dateTimeAdd, final String userAdd){
RequestQueue requestQueue = Volley.newRequestQueue(context.getApplicationContext());
StringRequest stringRequest = new StringRequest(Request.Method.POST, urlSelectMemberDating,
new com.android.volley.Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONArray jsonArray = new JSONArray(response);
Log.d("BBB","Loi ! \n"+jsonArray.toString());
for (int i = 0 ; i<= jsonArray.length(); i++) {
JSONObject object = jsonArray.getJSONObject(i);
int idJson = object.getInt("ID");
String emailJson = object.getString("Email");
String giveNameJson = object.getString("GivenName");
String nameJson = object.getString("Name");
Double latitudeJson = object.getDouble("Latitude");
Double longitudeNJson = object.getDouble("Longitude");
int onlOffJson = object.getInt("OnlOff");
if (onlOffJson == 1){
LatLng Location = new LatLng(latitudeJson,longitudeNJson);
googleMap.addMarker(new MarkerOptions()
.title(giveNameJson +" "+nameJson)
.snippet(emailJson)
.position(Location)
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_YELLOW)));
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new com.android.volley.Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(context, error.toString(), Toast.LENGTH_SHORT).show();
}
}
){
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String,String> params = new HashMap<>();
params.put("nameAddress",nameAddress);
params.put("dateAddress",dateAddress);
params.put("dateTimeAdd",dateTimeAdd);
params.put("userAdd",userAdd);
return params;
}
// Cho phép StringRequest nhận JsonArray
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String,String> headers = new HashMap<>();
headers.put("Accept","application/json");
return headers;
}
};
stringRequest.setRetryPolicy(
new DefaultRetryPolicy(
0,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
requestQueue.add(stringRequest);
}
//Nút quay lại
@Override
public void onBackPressed() {
if (getFragmentManager().getBackStackEntryCount()>0)
{
getFragmentManager().popBackStack();
}else {
super.onBackPressed();
}
}
@Override
protected void onDestroy() {
ReadJSONInsertUpdate(0);
mHandler.removeCallbacks(autoUpload);
mHandler.removeCallbacks(autoZoom);
super.onDestroy();
}
}
| [
"nvnghia2212@gmail.com"
] | nvnghia2212@gmail.com |
dc559e0021e7b2f90564adfe7b3488ed38e772e1 | 308adbb2a1da609ba5bd17d0eae6d4b241fafbfb | /Oblig_2_H2016/test/MyLinkedListTest/MyLinkedListStringTest.java | 1f6ff37adae2d35987db457b22be8681edd8c0bb | [] | no_license | CryzWiz/Oblig2_H2016 | 5577369d7dbdc92671b9d706aaec54d537ad4c1c | dd14067d91fe1716c9c2d0f00eff5ccb700695af | refs/heads/master | 2021-01-12T13:39:35.797232 | 2016-11-04T20:47:20 | 2016-11-04T20:47:20 | 70,059,267 | 0 | 0 | null | null | null | null | ISO-8859-15 | Java | false | false | 2,222 | java | package MyLinkedListTest;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import MylinkedList.MyLinkedList;
public class MyLinkedListStringTest {
// Testing with Strings
private MyLinkedList mylinkedlist;
private String[] stringArray = {"Bjarne","Åse","Vidar","Øystein","Åse","Stian"};
@Before
public void initialize(){
mylinkedlist = new MyLinkedList();
for(int i = 0; i < stringArray.length; i++){
mylinkedlist.add(new String(stringArray[i]));
}
}
@Test // Checking get method
public void checkIfGetReturnsCorrectElement() {
assertEquals(stringArray[2], mylinkedlist.get(2));
assertEquals(stringArray[4], mylinkedlist.get(4));
}
@Test(expected=NullPointerException.class) // Checking if asking for a non-existent index will give exception
public void testGetWithToBigIndex() {
assertEquals("The list size is not that big", mylinkedlist.get(99));
}
@Test // Checking contains method
public void checkIfWeCanFindElements(){
assertEquals(true, mylinkedlist.contains("Åse"));
assertTrue(mylinkedlist.contains(new String("Stian")));
}
@Test // Checking contains method
public void checkIfNonExistingElementsReturnFalse() {
assertFalse(mylinkedlist.contains(new String("Kjartan")));
}
@Test // Checking lastIndexOf method
public void CheckIfWeGetCorrectLastIndexOfRecuringElement(){
assertEquals(4, mylinkedlist.lastIndexOf("Åse"));
}
@Test // Checking lastIndexOf method
public void checkIfWeGetCorrectIndexForSingleElements(){
assertEquals(3, mylinkedlist.lastIndexOf("Øystein"));
}
@Test // Checking lastIndexOf method
public void checkIfWeGetCorrectValueBackForIndexOfNonExsistingElement() {
assertEquals(-1, mylinkedlist.lastIndexOf(""));
}
@Test // Checking set method, get() and getLast()
public void SettingNewContentAndCheckThatWeFindItAfterwards(){
String insert = new String("Inserted");
String inserted = new String("This is inserted");
assertEquals("Inserted", mylinkedlist.set(0,insert));
mylinkedlist.set(5,inserted);
assertEquals(inserted, mylinkedlist.get(5));
assertEquals(inserted, mylinkedlist.getLast());
}
}
| [
"allan.arnesen@gmail.com"
] | allan.arnesen@gmail.com |
0bac4d435548b32078804b4ffa978da59f98abad | d6227ae6e44aa136abf8c60555d45bb4277f6091 | /Bensa/src/Bensa.java | b4a30d75bea5a539b2d5028d2a3edabd74ea3e7a | [] | no_license | f1nl0wt3ch/java-basics | 9153ed01fe99e9609672f261e7c3a13035ac6398 | 1d33a25423e030cd1d38cb82d7c010bb64d4ea5e | refs/heads/master | 2023-02-06T16:19:34.738305 | 2020-12-29T20:17:53 | 2020-12-29T20:17:53 | null | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 1,226 | java | import java.text.DecimalFormat;
import java.util.Scanner;
public class Bensa
{
/*
Tee ohjelma Bensa, joka laskee, paljonko maksaa kilometrin ajaminen. KŠyttŠjŠltŠ pyydetŠŠn tankattu mŠŠrŠ litroina (desimaaliluku),
ajetut kilometrit (kokonaisluku) sekŠ bensan litrahinta (desimaaliluku). Ohjelma laskee ja nŠyttŠŠ kilometrihinnan.
Muotoile vastaus kahdella desimaalilla.
Ajetun kilometrin hinta lasketaan: tankkaus / ajetut * litrahinta
Esimerkkitulostus
Anna tankattu mŠŠrŠ: 54,0
Anna ajetut kilometrit: 790
Anna litrahinta: 1,690
Ajo per kilometri maksaa 0,12
*/
public static void main(String[] args)
{
// kavion esittely
Scanner input = new Scanner(System.in);
DecimalFormat des = new DecimalFormat("0.00");
// muuttujien esittely
double tankkaus, ajetut, litrahinta, ajo;
// pyytaminen
System.out.print("Anna tankattu mŠŠrŠ: ");
tankkaus=input.nextDouble();
System.out.print("Anna ajetut kilometrit: ");
ajetut=input.nextDouble();
System.out.print("Anna litrahinta: ");
litrahinta=input.nextDouble();
// laskenta
ajo = tankkaus / ajetut*litrahinta;
// tulostaminen
System.out.print("Ajo per kilometri maksaa "+des.format(ajo));
}
}
| [
"babyface1m75@yahoo.com.vn"
] | babyface1m75@yahoo.com.vn |
b9c6f54ae64f82864ea5bca8cd01ae90ca87869c | 95e85c5c9e38ccf6148527d14b7342666e2c3824 | /Actividad Semana 8/centrolavado/src/Vista/Servicios_frame.java | 0dcef9b2943e9f3be907be2547b92fc56f4eeb0c | [] | no_license | misari309/Actividades-Programaci-n-2 | 7cea4b94904e4243d2e87c8ddb75c28bea7babe2 | 10e209a4f76cc41382d87e0e80bf19d3000ccf09 | refs/heads/main | 2023-09-03T15:12:59.112095 | 2021-10-24T14:45:05 | 2021-10-24T14:45:05 | 409,271,199 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,259 | java | /*
* 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 Vista;
/**
*
* @author camil
*/
public class Servicios_frame extends javax.swing.JFrame {
/**
* Creates new form Servicios_frame
*/
public Servicios_frame() {
initComponents();
setTitle("Servicios");
setResizable(false);
setLocationRelativeTo(this);
setSize(601, 557);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
txtLinea = new javax.swing.JTextField();
txtMarca = new javax.swing.JTextField();
btnAceptarPeticion = new javax.swing.JButton();
jLabel6 = new javax.swing.JLabel();
txtAgnio = new javax.swing.JTextField();
jLabel7 = new javax.swing.JLabel();
txtCodigo = new javax.swing.JTextField();
comboBoxTipo = new javax.swing.JComboBox<>();
comboBox_servicio = new javax.swing.JComboBox<>();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
getContentPane().setLayout(null);
jLabel1.setFont(new java.awt.Font("Yu Gothic", 0, 24)); // NOI18N
jLabel1.setText("Servicios");
getContentPane().add(jLabel1);
jLabel1.setBounds(230, 40, 98, 40);
jLabel2.setFont(new java.awt.Font("Yu Gothic", 0, 14)); // NOI18N
jLabel2.setText("Línea:");
getContentPane().add(jLabel2);
jLabel2.setBounds(70, 240, 66, 24);
jLabel3.setFont(new java.awt.Font("Yu Gothic", 0, 14)); // NOI18N
jLabel3.setText("Agregar información del auto:");
getContentPane().add(jLabel3);
jLabel3.setBounds(57, 141, 193, 24);
jLabel4.setFont(new java.awt.Font("Yu Gothic", 0, 14)); // NOI18N
jLabel4.setText("Marca:");
getContentPane().add(jLabel4);
jLabel4.setBounds(64, 185, 66, 24);
jLabel5.setFont(new java.awt.Font("Yu Gothic", 0, 14)); // NOI18N
jLabel5.setText("Tipo:");
getContentPane().add(jLabel5);
jLabel5.setBounds(70, 390, 66, 24);
txtLinea.setFont(new java.awt.Font("Yu Gothic", 0, 14)); // NOI18N
txtLinea.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtLineaActionPerformed(evt);
}
});
getContentPane().add(txtLinea);
txtLinea.setBounds(150, 240, 108, 30);
txtMarca.setFont(new java.awt.Font("Yu Gothic", 0, 14)); // NOI18N
txtMarca.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtMarcaActionPerformed(evt);
}
});
getContentPane().add(txtMarca);
txtMarca.setBounds(150, 180, 108, 30);
btnAceptarPeticion.setFont(new java.awt.Font("Yu Gothic", 0, 14)); // NOI18N
btnAceptarPeticion.setText("Aceptar");
btnAceptarPeticion.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnAceptarPeticionActionPerformed(evt);
}
});
getContentPane().add(btnAceptarPeticion);
btnAceptarPeticion.setBounds(310, 390, 140, 32);
jLabel6.setFont(new java.awt.Font("Yu Gothic", 0, 14)); // NOI18N
jLabel6.setText("Año;");
getContentPane().add(jLabel6);
jLabel6.setBounds(70, 290, 66, 24);
txtAgnio.setFont(new java.awt.Font("Yu Gothic", 0, 14)); // NOI18N
txtAgnio.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtAgnioActionPerformed(evt);
}
});
getContentPane().add(txtAgnio);
txtAgnio.setBounds(150, 290, 108, 30);
jLabel7.setFont(new java.awt.Font("Yu Gothic", 0, 14)); // NOI18N
jLabel7.setText("Codigo:");
getContentPane().add(jLabel7);
jLabel7.setBounds(70, 340, 66, 24);
txtCodigo.setFont(new java.awt.Font("Yu Gothic", 0, 14)); // NOI18N
txtCodigo.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtCodigoActionPerformed(evt);
}
});
getContentPane().add(txtCodigo);
txtCodigo.setBounds(150, 340, 108, 30);
comboBoxTipo.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Auto", "Camioneta" }));
getContentPane().add(comboBoxTipo);
comboBoxTipo.setBounds(150, 390, 110, 26);
comboBox_servicio.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Lavado básico", "Lavado especial", "Desinfección básica", "Desinfección avanzada", "Combo 1", "Combo 2", "Combo 3" }));
getContentPane().add(comboBox_servicio);
comboBox_servicio.setBounds(310, 180, 190, 26);
pack();
}// </editor-fold>//GEN-END:initComponents
private void txtLineaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtLineaActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txtLineaActionPerformed
private void txtMarcaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtMarcaActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txtMarcaActionPerformed
private void txtAgnioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtAgnioActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txtAgnioActionPerformed
private void txtCodigoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtCodigoActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txtCodigoActionPerformed
private void btnAceptarPeticionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAceptarPeticionActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_btnAceptarPeticionActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Servicios_frame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Servicios_frame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Servicios_frame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Servicios_frame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Servicios_frame().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
public javax.swing.JButton btnAceptarPeticion;
public javax.swing.JComboBox<String> comboBoxTipo;
public javax.swing.JComboBox<String> comboBox_servicio;
public javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
public javax.swing.JTextField txtAgnio;
public javax.swing.JTextField txtCodigo;
public javax.swing.JTextField txtLinea;
public javax.swing.JTextField txtMarca;
// End of variables declaration//GEN-END:variables
}
| [
"misari309@gmail.com"
] | misari309@gmail.com |
6c27af0529f4b2d6bb8c909c2d8ab435042f26b2 | dd376bea3bfbce367c36eb4fee1bedba7931f586 | /src/main/java/com/jiyinhui/exam/service/UserService.java | b94926ebcc56a45fd6ccbe5d1a9207384a1e3771 | [] | no_license | luckykaisen/exam_system | 281414b3eff3d6061165dda5d5c7713af5623af6 | 21a47a870844e1da9b8c3d20c3ed32e2d10450a7 | refs/heads/master | 2020-03-18T12:27:09.754444 | 2018-05-24T14:32:08 | 2018-05-24T14:32:08 | 134,727,158 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 948 | java | package com.jiyinhui.exam.service;
import com.jiyinhui.exam.entity.User;
import com.jiyinhui.exam.mapper.UserMapper;
import com.jiyinhui.exam.service.api.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
public class UserService implements IUserService {
@Autowired
private UserMapper userMapper;
@Override
public User getUserByMobileAndPassword(User user) {
return userMapper.getUserByMobileAndPassword(user);
}
@Override
public User getUserByMobile(String email) {
return userMapper.getUserByMobile(email);
}
@Override
@Transactional
public void insertUser(User user) {
userMapper.insertUser(user);
}
@Override
@Transactional
public void updateUser(User user) {
userMapper.updateUser(user);
}
}
| [
"374362311@qq.com"
] | 374362311@qq.com |
2fa3f4e0c30403491ddb79d2492f0b7bd549dc49 | ccb7ec5f05cfccc3f9e228116356c9aef4abd188 | /app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgHistoryAllDone.java | 1a839f5553248074002e8c837874c313233a705c | [] | no_license | DavMedek/AndroidAPS | a70b3525b9a698e76e7b7f3a7810cef9070fe7c6 | 163ccf2d0a687824792dbe566d580bc05ed86560 | refs/heads/master | 2021-01-19T11:58:22.330554 | 2016-09-19T13:09:35 | 2016-09-19T13:09:35 | 69,698,161 | 1 | 0 | null | 2016-09-30T20:03:06 | 2016-09-30T20:03:04 | null | UTF-8 | Java | false | false | 617 | java | package info.nightscout.androidaps.plugins.DanaR.comm;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.Config;
public class MsgHistoryAllDone extends MessageBase {
private static Logger log = LoggerFactory.getLogger(MsgHistoryAllDone.class);
public static boolean received = false;
public MsgHistoryAllDone() {
SetCommand(0x41F1);
received = false;
}
@Override
public void handleMessage(byte[] bytes) {
received = true;
if (Config.logDanaMessageDetail)
log.debug("History all done received");
}
}
| [
"m.kozak@sysop.cz"
] | m.kozak@sysop.cz |
750b82062f7b1d37345286b07ee8632041d446b4 | ca10110d0736b96e64ea233b6b7e5fb75c5dffa9 | /LC155_MinStack.java | 4a115b10a67648ca7a2f9a4b44b38f0d7fc0bc74 | [] | no_license | sunny-sunwoo/leetcode-solutions | e4b25946675cc3dcc2d391c2d084f9182bfa4f26 | 2db8a7daf9fbaa29e8b77240e5c81a00cacbd489 | refs/heads/master | 2020-06-13T08:34:51.216275 | 2019-08-24T04:28:30 | 2019-08-24T04:28:30 | 194,602,170 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,796 | java | package leetcode_study;
/**
* Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.
push(x) -- Push element x onto stack.
pop() -- Removes the element on top of the stack.
top() -- Get the top element.
getMin() -- Retrieve the minimum element in the stack.
* @author Sunny Park
*
*/
public class LC155_MinStack {
private static class Node {
int val;
Node next;
Node prevMin;
Node(int val) {
this.val = val;
}
}
Node stack;
Node min;
LC155_MinStack() {
stack = null;
min = null;
}
public void push(int x) {
Node newNode = new Node(x);
if (stack == null) {
stack = newNode;
min = stack;
} else {
newNode.next = stack;
stack = newNode;
}
if (stack.val < min.val) {
stack.prevMin = min;
min = stack;
}
}
public void pop() {
Node toPop = stack;
if (toPop.prevMin != null) {
min = toPop.prevMin;
}
stack = stack.next;
toPop = null;
}
public int top() {
return stack.val;
}
public int getMin() {
return min.val;
}
public static void main(String[] args) {
LC155_MinStack minStack = new LC155_MinStack();
minStack.push(3);
System.out.println(minStack.getMin());
minStack.push(2);
System.out.println(minStack.getMin());
minStack.push(1);
System.out.println(minStack.getMin());
minStack.push(3);
System.out.println(minStack.getMin());
minStack.pop();
minStack.pop();
System.out.println(minStack.getMin());
}
}
| [
"sunny.sunwoo.park@gmail.com"
] | sunny.sunwoo.park@gmail.com |
73fc79b55108abbb67198134b3c5727a934db581 | 158c10a32d85a1f833264edaeba536d97ef5b029 | /Exercises/WeekThree/Short Form Qs/Question 1/Q1.java | 5b46f1edd0324c529bc77a557c8bfd9142c58c97 | [] | no_license | annabeljump/SDP2016 | e03650e5e6c76a9b58d0187af84f2cd9af39f1e7 | 83c2b2a9975f19bbc902aabce3fd907941ac127a | refs/heads/master | 2021-01-10T13:54:54.877686 | 2016-04-10T21:45:37 | 2016-04-10T21:45:37 | 50,606,388 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 580 | java | /**
* Question: Write down 3 differences between
* abstract classes and interfaces in Java 8
* Provide examples to illustrate answer.
*
* Answer below:
* @author Annabel Jump
*/
/**
* Difference 1:
* Abstract classes can declare fields that are neither static nor final,
* Interfaces cannot.
*/
/**
* Difference 2:
* Abstract classes can declare fields as public, private, protected -
* Interface fields are always public (and static and final).
*/
/**
* Difference 3:
* Only one abstract class can be extended -
* Multiple interfaces can be implemented.
*/
| [
"ajump02@dcs.bbk.ac.uk"
] | ajump02@dcs.bbk.ac.uk |
666f8dd85c21133f83fc94793901bf6e50974f80 | 1b10a83e6d02ea7545548558e3d953386c39182c | /app/src/main/java/com/codepath/apps/restclienttemplate/models/User.java | 8cd96c9d616fa7f5bcc66439be2c770eec273b23 | [
"MIT",
"Apache-2.0"
] | permissive | andersontan1998/SimpleTweet | 2238aa2e8705b182bb7dc4b36c1569f9179d17c6 | 79c703135544eabb8c061108a09731efdeb8c2d7 | refs/heads/main | 2023-03-13T08:56:08.940863 | 2021-02-28T21:39:31 | 2021-02-28T21:39:31 | 342,381,400 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,255 | java | package com.codepath.apps.restclienttemplate.models;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.PrimaryKey;
import org.json.JSONException;
import org.json.JSONObject;
import org.parceler.Parcel;
import java.util.ArrayList;
import java.util.List;
@Parcel
@Entity
public class User {
@ColumnInfo
@PrimaryKey
public long id;
@ColumnInfo
public String name;
@ColumnInfo
public String screenName;
@ColumnInfo
public String profileImageUrl;
//empty constructor needed by the Parceler Library
public User() {}
public static User fromJson(JSONObject jsonObject) throws JSONException {
User user = new User();
user.id = jsonObject.getLong("id");
user.name = jsonObject.getString("name");
user.screenName = jsonObject.getString("screen_name");
user.profileImageUrl = jsonObject.getString("profile_image_url_https");
return user;
}
public static List<User> fromJsonTweetArray(List<Tweet> tweetsFromNetwork) {
List<User> users = new ArrayList<>();
for (int i = 0; i < tweetsFromNetwork.size(); i++) {
users.add(tweetsFromNetwork.get(i).user);
}
return users;
}
}
| [
"andersontan1998@yahoo.com"
] | andersontan1998@yahoo.com |
87c0090ff0e2b40ca3f4b2b72ce682b3518b1b94 | d1bd1246f161b77efb418a9c24ee544d59fd1d20 | /java/Hornet/src/org/javenstudio/hornet/search/scorer/BooleanScorer.java | d91e35d6ec54678064ee9b0a2cf72d066d26ecd8 | [] | no_license | navychen2003/javen | f9a94b2e69443291d4b5c3db5a0fc0d1206d2d4a | a3c2312bc24356b1c58b1664543364bfc80e816d | refs/heads/master | 2021-01-20T12:12:46.040953 | 2015-03-03T06:14:46 | 2015-03-03T06:14:46 | 30,912,222 | 0 | 1 | null | 2023-03-20T11:55:50 | 2015-02-17T10:24:28 | Java | UTF-8 | Java | false | false | 10,814 | java | package org.javenstudio.hornet.search.scorer;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.javenstudio.common.indexdb.IAtomicReaderRef;
import org.javenstudio.common.indexdb.IBooleanClause;
import org.javenstudio.common.indexdb.IBooleanWeight;
import org.javenstudio.common.indexdb.ICollector;
import org.javenstudio.common.indexdb.IScorer;
import org.javenstudio.common.indexdb.IWeight;
import org.javenstudio.common.indexdb.search.Collector;
import org.javenstudio.common.indexdb.search.Scorer;
/**
* Description from Doug Cutting (excerpted from
* LUCENE-1483):
*
* BooleanScorer uses an array to score windows of
* 2K docs. So it scores docs 0-2K first, then docs 2K-4K,
* etc. For each window it iterates through all query terms
* and accumulates a score in table[doc%2K]. It also stores
* in the table a bitmask representing which terms
* contributed to the score. Non-zero scores are chained in
* a linked list. At the end of scoring each window it then
* iterates through the linked list and, if the bitmask
* matches the boolean constraints, collects a hit. For
* boolean queries with lots of frequent terms this can be
* much faster, since it does not need to update a priority
* queue for each posting, instead performing constant-time
* operations per posting. The only downside is that it
* results in hits being delivered out-of-order within the
* window, which means it cannot be nested within other
* scorers. But it works well as a top-level scorer.
*
* The new BooleanScorer2 implementation instead works by
* merging priority queues of postings, albeit with some
* clever tricks. For example, a pure conjunction (all terms
* required) does not require a priority queue. Instead it
* sorts the posting streams at the start, then repeatedly
* skips the first to to the last. If the first ever equals
* the last, then there's a hit. When some terms are
* required and some terms are optional, the conjunction can
* be evaluated first, then the optional terms can all skip
* to the match and be added to the score. Thus the
* conjunction can reduce the number of priority queue
* updates for the optional terms.
*/
public final class BooleanScorer extends Scorer {
private static final class BooleanScorerCollector extends Collector {
private BucketTable mBucketTable;
private int mMask;
private IScorer mScorer;
public BooleanScorerCollector(int mask, BucketTable bucketTable) {
mMask = mask;
mBucketTable = bucketTable;
}
@Override
public void collect(final int doc) throws IOException {
final BucketTable table = mBucketTable;
final int i = doc & BucketTable.MASK;
final Bucket bucket = table.mBuckets[i];
if (bucket.mDoc != doc) { // invalid bucket
bucket.mDoc = doc; // set doc
bucket.mScore = mScorer.getScore(); // initialize score
bucket.mBits = mMask; // initialize mask
bucket.mCoord = 1; // initialize coord
bucket.mNext = table.mFirst; // push onto valid list
table.mFirst = bucket;
} else { // valid bucket
bucket.mScore += mScorer.getScore(); // increment score
bucket.mBits |= mMask; // add bits in mask
bucket.mCoord ++; // increment coord
}
}
@Override
public void setNextReader(IAtomicReaderRef context) {
// not needed by this implementation
}
@Override
public void setScorer(IScorer scorer) throws IOException {
mScorer = scorer;
}
@Override
public boolean acceptsDocsOutOfOrder() {
return true;
}
}
// An internal class which is used in score(Collector, int) for setting the
// current score. This is required since Collector exposes a setScorer method
// and implementations that need the score will call scorer.score().
// Therefore the only methods that are implemented are score() and doc().
private static final class BucketScorer extends Scorer {
private float mScore;
private int mDoc = NO_MORE_DOCS;
private int mFreq;
public BucketScorer(IWeight weight) { super(weight); }
@Override
public int advance(int target) throws IOException { return NO_MORE_DOCS; }
@Override
public int getDocID() { return mDoc; }
@Override
public float getFreq() { return mFreq; }
@Override
public int nextDoc() throws IOException { return NO_MORE_DOCS; }
@Override
public float getScore() throws IOException { return mScore; }
}
static final class Bucket {
private int mDoc = -1; // tells if bucket is valid
private float mScore; // incremental score
// TODO: break out bool anyProhibited, int
// numRequiredMatched; then we can remove 32 limit on
// required clauses
private int mBits; // used for bool constraints
private int mCoord; // count of terms in score
private Bucket mNext; // next valid bucket
}
/** A simple hash table of document scores within a range. */
static final class BucketTable {
public static final int SIZE = 1 << 11;
public static final int MASK = SIZE - 1;
private final Bucket[] mBuckets = new Bucket[SIZE];
private Bucket mFirst = null; // head of valid list
public BucketTable() {
// Pre-fill to save the lazy init when collecting
// each sub:
for (int idx=0; idx < SIZE; idx++) {
mBuckets[idx] = new Bucket();
}
}
public Collector newCollector(int mask) {
return new BooleanScorerCollector(mask, this);
}
public int size() { return SIZE; }
}
static final class SubScorer {
public IScorer mScorer;
// TODO: re-enable this if BQ ever sends us required clauses
//public boolean required = false;
public boolean mProhibited;
public Collector mCollector;
public SubScorer mNext;
public SubScorer(IScorer scorer, boolean required, boolean prohibited,
Collector collector, SubScorer next) throws IOException {
if (required)
throw new IllegalArgumentException("this scorer cannot handle required=true");
mScorer = scorer;
// TODO: re-enable this if BQ ever sends us required clauses
//this.required = required;
mProhibited = prohibited;
mCollector = collector;
mNext = next;
}
}
private SubScorer mScorers = null;
private BucketTable mBucketTable = new BucketTable();
private final float[] mCoordFactors;
// TODO: re-enable this if BQ ever sends us required clauses
//private int requiredMask = 0;
private final int mMinNrShouldMatch;
private int mEnd;
private Bucket mCurrent;
// Any time a prohibited clause matches we set bit 0:
private static final int PROHIBITED_MASK = 1;
public BooleanScorer(IBooleanWeight weight, boolean disableCoord, int minNrShouldMatch,
List<IScorer> optionalScorers, List<IScorer> prohibitedScorers, int maxCoord)
throws IOException {
super(weight);
mMinNrShouldMatch = minNrShouldMatch;
if (optionalScorers != null && optionalScorers.size() > 0) {
for (IScorer scorer : optionalScorers) {
if (scorer.nextDoc() != NO_MORE_DOCS) {
mScorers = new SubScorer(scorer, false, false,
mBucketTable.newCollector(0), mScorers);
}
}
}
if (prohibitedScorers != null && prohibitedScorers.size() > 0) {
for (IScorer scorer : prohibitedScorers) {
if (scorer.nextDoc() != NO_MORE_DOCS) {
mScorers = new SubScorer(scorer, false, true,
mBucketTable.newCollector(PROHIBITED_MASK), mScorers);
}
}
}
mCoordFactors = new float[optionalScorers.size() + 1];
for (int i = 0; i < mCoordFactors.length; i++) {
mCoordFactors[i] = disableCoord ? 1.0f : weight.coord(i, maxCoord);
}
}
// firstDocID is ignored since nextDoc() initializes 'current'
@Override
public boolean score(ICollector collector, int max, int firstDocID) throws IOException {
// Make sure it's only BooleanScorer that calls us:
assert firstDocID == -1;
boolean more;
Bucket tmp;
BucketScorer bs = new BucketScorer(mWeight);
// The internal loop will set the score and doc before calling collect.
collector.setScorer(bs);
do {
mBucketTable.mFirst = null;
while (mCurrent != null) { // more queued
// check prohibited & required
if ((mCurrent.mBits & PROHIBITED_MASK) == 0) {
// TODO: re-enable this if BQ ever sends us required clauses
//&& (current.bits & requiredMask) == requiredMask) {
// TODO: can we remove this?
if (mCurrent.mDoc >= max){
tmp = mCurrent;
mCurrent = mCurrent.mNext;
tmp.mNext = mBucketTable.mFirst;
mBucketTable.mFirst = tmp;
continue;
}
if (mCurrent.mCoord >= mMinNrShouldMatch) {
bs.mScore = mCurrent.mScore * mCoordFactors[mCurrent.mCoord];
bs.mDoc = mCurrent.mDoc;
bs.mFreq = mCurrent.mCoord;
collector.collect(mCurrent.mDoc);
}
}
mCurrent = mCurrent.mNext; // pop the queue
}
if (mBucketTable.mFirst != null){
mCurrent = mBucketTable.mFirst;
mBucketTable.mFirst = mCurrent.mNext;
return true;
}
// refill the queue
more = false;
mEnd += BucketTable.SIZE;
for (SubScorer sub = mScorers; sub != null; sub = sub.mNext) {
int subScorerDocID = sub.mScorer.getDocID();
if (subScorerDocID != NO_MORE_DOCS) {
more |= sub.mScorer.score(sub.mCollector, mEnd, subScorerDocID);
}
}
mCurrent = mBucketTable.mFirst;
} while (mCurrent != null || more);
return false;
}
@Override
public int advance(int target) throws IOException {
throw new UnsupportedOperationException();
}
@Override
public int getDocID() {
throw new UnsupportedOperationException();
}
@Override
public int nextDoc() throws IOException {
throw new UnsupportedOperationException();
}
@Override
public float getScore() {
throw new UnsupportedOperationException();
}
@Override
public void score(ICollector collector) throws IOException {
score(collector, Integer.MAX_VALUE, -1);
}
@Override
public String toString() {
StringBuilder buffer = new StringBuilder();
buffer.append("boolean(");
for (SubScorer sub = mScorers; sub != null; sub = sub.mNext) {
buffer.append(sub.mScorer.toString());
buffer.append(" ");
}
buffer.append(")");
return buffer.toString();
}
@Override
public Collection<IChild> getChildren() {
List<IChild> children = new ArrayList<IChild>();
for (SubScorer sub = mScorers; sub != null; sub = sub.mNext) {
children.add(new ChildScorer((Scorer)sub.mScorer, sub.mProhibited ?
IBooleanClause.Occur.MUST_NOT.toString() : IBooleanClause.Occur.SHOULD.toString()));
}
return children;
}
}
| [
"navychen2003@hotmail.com"
] | navychen2003@hotmail.com |
a8bbfb8b01267c447a6ef3522e2efe3627d935bd | 7d679ab1fadb04f95efa4d322600010e22257209 | /app/src/main/java/se/arctosoft/vatcalculator/ui/adapter/VatAdapter.java | 8bf814c0a58f6c924e93e2d336810befe006ef3b | [] | no_license | hej2010/VAT-Calculator | d1ccec6046515bc8e436953c93792305460fc6be | 637ee94a20076a6c252762f7f6ff2f6758d0af5b | refs/heads/master | 2023-08-31T19:17:40.947439 | 2023-08-18T17:33:01 | 2023-08-18T17:33:01 | 254,616,465 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,080 | java | package se.arctosoft.vatcalculator.ui.adapter;
import android.content.Context;
import android.content.res.Resources;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import java.util.List;
import se.arctosoft.vatcalculator.R;
import se.arctosoft.vatcalculator.ui.data.CountryVAT;
public class VatAdapter extends ArrayAdapter<CountryVAT> {
private Context context;
private List<CountryVAT> statuses;
public Resources res;
private LayoutInflater inflater;
public VatAdapter(Context context, int textViewResourceId, List<CountryVAT> statuses, Resources resLocal) {
super(context, textViewResourceId, statuses);
this.context = context;
this.statuses = statuses;
this.res = resLocal;
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public int getCount() {
return statuses.size() + 1;
}
@Override
public View getDropDownView(int position, View convertView, @NonNull ViewGroup parent) {
return getCustomView(position, parent);
}
@Override
@NonNull
public View getView(int position, View convertView, @NonNull ViewGroup parent) {
return getCustomView(position, parent);
}
private View getCustomView(int position, ViewGroup parent) {
View row = inflater.inflate(R.layout.spinner_item, parent, false);
ImageView imgFlag = row.findViewById(R.id.imgFlag);
TextView txtName = row.findViewById(R.id.txtName);
if (position == 0) {
txtName.setText(context.getString(R.string.spinner_default_text));
imgFlag.setImageDrawable(null);
} else {
CountryVAT country = statuses.get(position - 1);
txtName.setText(country.getCountryName());
imgFlag.setImageResource(country.getDrawableID());
}
return row;
}
}
| [
"rikard128@pm.me"
] | rikard128@pm.me |
3e407570a08e57ea00f081015979cc50adaa041b | ea149dffb2f306e1cebf8d03a3cf0786586b6d90 | /websocket/src/main/java/hst/peter/websocket/Greeting.java | 0389f2d9531a628cc6264c067ba80805c406ec7c | [] | no_license | peter-hst/spring-guides | d951e838e491fd942f98fa97f176ff655b80332c | 07ddf2aa4eae92f77e2f4d30d77b7ef5dd329d50 | refs/heads/master | 2022-06-22T23:13:34.423107 | 2019-12-06T07:51:36 | 2019-12-06T07:51:36 | 224,093,595 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 257 | java | package hst.peter.websocket;
public class Greeting {
private String content;
public Greeting() {
}
public Greeting(String content) {
this.content = content;
}
public String getContent() {
return content;
}
} | [
"h_st@live.cn"
] | h_st@live.cn |
8457bfcc0eb852012c3c337b7905d4d6b9c71767 | 644f8caa6fc5f58d3477bb84b97577440acb0e35 | /Shopr/src/main/java/com/example/Shopr/domain/BookNonFiction.java | bfa6073aafbd9a10da38f73cd5aa98f69c4b58ae | [] | no_license | Oli4C/Shopr | efc0a36a43f96d354af9bea4ffc43e8a9a5b1b1a | 699243160c58943fce1df8fbd3cd404d5b1c9f29 | refs/heads/master | 2023-06-12T13:14:06.415064 | 2021-07-07T07:21:05 | 2021-07-07T07:21:05 | 383,709,758 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 994 | java | package com.example.Shopr.domain;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.persistence.*;
@EqualsAndHashCode(callSuper = true)
@DiscriminatorValue(value = "BOOK_NON_FICTION")
@Data
@Entity
//@AllArgsConstructor
public class BookNonFiction extends Book{
@Enumerated(EnumType.STRING)
@Column(name = "subject")
private Subject subject;
// @Column(name = "book_genre")
// private BookGenre bookGenre;
// @Column(name = "description")
// private String description;
public BookNonFiction(){
}
@Builder
public BookNonFiction(Long id, String title, Double price, String supplierId, String author, String isbn, int pages, Subject subject, BookGenre bookGenre, String description) {
super(id, title, price, supplierId, author, isbn, pages);
this.subject = subject;
// this.bookGenre = bookGenre;
// this.description = description;
}
}
| [
"olivier.carez@yahoo.com"
] | olivier.carez@yahoo.com |
7b6739d0b2b8f9bc3c6e8e9f934c106c66eb26b0 | caffece0cdae8b88dc10129137977e742b2cbf9d | /java/estudos/util/NotificationDecoder.java | f19141b3d87b4e8a746f5d53eff8498089773563 | [] | no_license | BonnerAthos/Framework_Template_Angular1 | ecfa5aaffdd61d2c43ed4b8b566ef80aec425a3e | 9adbe7700be43e29d6426907a65f075f5d81b22b | refs/heads/master | 2021-04-15T09:31:52.260416 | 2018-03-25T00:51:04 | 2018-03-25T00:51:04 | 126,645,923 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,253 | java | package estudos.util;
import java.io.StringReader;
import javax.json.Json;
import javax.json.JsonObject;
import javax.websocket.DecodeException;
import javax.websocket.Decoder;
import javax.websocket.EndpointConfig;
public class NotificationDecoder implements Decoder.Text<Notification>{
@Override
public void destroy() {
// TODO Auto-generated method stub
}
@Override
public void init(EndpointConfig arg0) {
// TODO Auto-generated method stub
}
@Override
public Notification decode(String jsonNotification) throws DecodeException {
JsonObject jsonObject = Json.createReader(new StringReader(jsonNotification)).readObject();
Notification notification = new Notification();
notification.setTipo(jsonObject.getString("tipo"));
notification.setIdUsuario(Long.parseLong(jsonObject.getString("idUsuario")));
notification.setLabel(jsonObject.getString("label"));
notification.setText(jsonObject.getString("text"));
return notification;
}
@Override
public boolean willDecode(String jsonNotification) {
try {
// Check if incoming message is valid JSON
Json.createReader(new StringReader(jsonNotification)).readObject();
return true;
} catch (Exception e) {
return false;
}
}
} | [
"athosbonner2011@gmail.com"
] | athosbonner2011@gmail.com |
10bfe20a6937a1ccdcc8f14ff302d8d914a7597e | 3f7ced2b6bdb6a8635facbbad5a079392b40dd3a | /uuf-core/src/main/java/org/wso2/carbon/uuf/spi/UUFAppRegistry.java | 5fd32c2d38f0675f2b02678ed45b96e3b26f51c7 | [
"Apache-2.0"
] | permissive | NatashaWso2/carbon-uuf | d4a0c344b67cbbf81c57c542402e025d491ffe31 | 47944d7a8c19b446f0fb94ecbf6f8cbbc3e24ac2 | refs/heads/master | 2021-01-18T12:16:53.160761 | 2016-06-27T12:35:27 | 2016-06-27T12:35:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 891 | java | /*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.uuf.spi;
import org.wso2.carbon.uuf.core.App;
import java.util.Optional;
public interface UUFAppRegistry {
App add(App app);
Optional<App> get(String context);
Optional<App> remove(String appName);
}
| [
"info.rasika@gmail.com"
] | info.rasika@gmail.com |
4223147df1648feec317074231b4744812fb62b4 | b4f544b8046390fdd45989f49d6b8fc58916c0ad | /compilador/Instrução.java | 281317d6c654d8008c664ba78526e047038e53f5 | [] | no_license | MarceloSilvarolla/Batalha-de-Robos | 531dab5cec9028bbe652a5a36b30657e888ee8e8 | 141cfac5dbe4b5b6cbeb96ad168fb38c7e4a4029 | refs/heads/master | 2023-01-19T20:15:33.344426 | 2020-11-24T19:15:15 | 2020-11-24T19:15:15 | 315,727,292 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,547 | java | // Instrução genérica, não faz nada.
class Instrução {
Empilhável val;
Instrução(Empilhável v) {val = v;}
Instrução() {val = null;}
int Exec(Computador C) {return 1;} // retorna o incremento do ip
String Show() {
String res = "\t\t\tnew " + this.toString().replaceFirst("@.+","");
if (val != null)
res += "(new " + val.toString().replaceFirst("@.+","").replace("ç","c") + "("+val.Show() + ")),";
else
res += "(),";
return res;
}
}
// Empilha uma Cadeia com a descrição do Empilhável
class Mostra extends Instrução {
int Exec(Computador C) {
Pilha p = C.p;
p.push(new Cadeia(p.pop().Show()));
return 1;
}
}
class PDVZ extends Instrução {
}
class PGCR extends Instrução {
}
class DPCR extends Instrução {
}
class MVRB extends Instrução {
}
class PTR extends Instrução {
}
class VBA extends Instrução {
}
class VCR extends Instrução {
}
class NCR extends Instrução {
}
class VRB extends Instrução {
}
class SHIFT extends Instrução {
}
////////////////////////////////////
// Instruções aritméticas
class ADD extends Instrução {
int Exec(Computador C) {
Pilha p = C.p;
Empilhável e1 = p.pop();
Empilhável e2 = p.pop();
Inteiro n1,n2;
if (e1 instanceof Inteiro && e2 instanceof Inteiro) {
n1 = (Inteiro)e1;
n2 = (Inteiro)e2;
}
else n1 = n2 = new Inteiro(0);
p.push(new Inteiro(n1.val() + n2.val()));
return 1;
}
}
class MUL extends Instrução {
int Exec(Computador C) {
Pilha p = C.p;
Empilhável e1 = p.pop();
Empilhável e2 = p.pop();
Inteiro n1,n2;
if (e1 instanceof Inteiro && e2 instanceof Inteiro) {
n1 = (Inteiro)e1;
n2 = (Inteiro)e2;
}
else n1 = n2 = new Inteiro(0);
p.push(new Inteiro(n1.val() * n2.val()));
return 1;
}
}
class SUB extends Instrução {
int Exec(Computador C) {
Pilha p = C.p;
Empilhável e1 = p.pop();
Empilhável e2 = p.pop();
Inteiro n1,n2;
if (e1 instanceof Inteiro && e2 instanceof Inteiro) {
n1 = (Inteiro)e1;
n2 = (Inteiro)e2;
}
else n1 = n2 = new Inteiro(0);
p.push(new Inteiro(n2.val() - n1.val()));
return 1;
}
}
class DIV extends Instrução {
int Exec(Computador C) {
Pilha p = C.p;
Empilhável e1 = p.pop();
Empilhável e2 = p.pop();
Inteiro n1,n2;
if (e1 instanceof Inteiro && e2 instanceof Inteiro) {
n1 = (Inteiro)e1;
n2 = (Inteiro)e2;
}
else n1 = n2 = new Inteiro(1);
p.push(new Inteiro(n1.val()/n2.val()));
return 1;
}
}
////////////////////////////////////////////////////////////////////////
// Lógicas
class GT extends Instrução {
int Exec(Computador C) {
Pilha p = C.p;
Empilhável e2 = p.pop();
Empilhável e1 = p.pop();
Inteiro n1,n2;
if (e1 instanceof Inteiro && e2 instanceof Inteiro) {
n1 = (Inteiro)e1;
n2 = (Inteiro)e2;
}
else n1 = n2 = new Inteiro(0);
p.push(new Inteiro(n1.val() > n2.val()? 1:0));
return 1;
}
}
class LT extends Instrução {
int Exec(Computador C) {
Pilha p = C.p;
Empilhável e2 = p.pop();
Empilhável e1 = p.pop();
Inteiro n1,n2;
if (e1 instanceof Inteiro && e2 instanceof Inteiro) {
n1 = (Inteiro)e1;
n2 = (Inteiro)e2;
}
else n1 = n2 = new Inteiro(0);
p.push(new Inteiro(n1.val() < n2.val()?1:0));
return 1;
}
}
class EQ extends Instrução {
int Exec(Computador C) {
Pilha p = C.p;
Empilhável e2 = p.pop();
Empilhável e1 = p.pop();
Inteiro n1,n2;
if (e1 instanceof Inteiro && e2 instanceof Inteiro) {
n1 = (Inteiro)e1;
n2 = (Inteiro)e2;
}
else n1 = n2 = new Inteiro(0);
p.push(new Inteiro(n1.val() == n2.val()? 1:0));
return 1;
}
}
class GE extends Instrução {
int Exec(Computador C) {
Pilha p = C.p;
Empilhável e2 = p.pop();
Empilhável e1 = p.pop();
Inteiro n1,n2;
if (e1 instanceof Inteiro && e2 instanceof Inteiro) {
n1 = (Inteiro)e1;
n2 = (Inteiro)e2;
}
else n1 = n2 = new Inteiro(0);
p.push(new Inteiro(n1.val() >= n2.val()? 1:0));
return 1;
}
}
class LE extends Instrução {
int Exec(Computador C) {
Pilha p = C.p;
Empilhável e2 = p.pop();
Empilhável e1 = p.pop();
Inteiro n1,n2;
if (e1 instanceof Inteiro && e2 instanceof Inteiro) {
n1 = (Inteiro)e1;
n2 = (Inteiro)e2;
}
else n1 = n2 = new Inteiro(0);
p.push(new Inteiro(n1.val() <= n2.val()? 1:0));
return 1;
}
}
class NE extends Instrução {
int Exec(Computador C) {
Pilha p = C.p;
Empilhável e2 = p.pop();
Empilhável e1 = p.pop();
Inteiro n1,n2;
if (e1 instanceof Inteiro && e2 instanceof Inteiro) {
n1 = (Inteiro)e1;
n2 = (Inteiro)e2;
}
else n1 = n2 = new Inteiro(0);
p.push(new Inteiro(n1.val() != n2.val()? 1:0));
return 1;
}
}
///////////////////////////////////
// Manipulação da pilha
class PUSH extends Instrução {
PUSH(Empilhável x) {super(x);}
int Exec(Computador C) {
Pilha p = C.p;
p.push(val);
return 1;
}
String Show() {
String res = "\t\t\tnew " + this.toString().replaceFirst("@.+","");
if (val != null)
if (val instanceof Cadeia)
res += "(new " + val.toString().replaceFirst("@.+","") + "("+val.Show().replace("\n","\\n") + ")),";
else
res += "(new " + val.toString().replaceFirst("@.+","").replace("ç","c") + "("+val.Show() + ")),";
else
res += "(),";
return res;
}
}
// Empilha uma variável
class PUSHV extends Instrução {
PUSHV(Empilhável x) {super(x);}
int Exec(Computador C) {
Pilha p = C.p;
p.push(C.mem[((Endereço)val).val()]);
return 1;
}
// String Show() {
// String res = "\t\t\tnew ADR";
// if (val != null)
// res += "(new " + val.toString().replaceFirst("@.+","").replace("ç","c") + "("+val.Show() + ")),";
// else
// res += "(),";
// res += "\n\t\t\tnew RCL(),";
// return res;
// }
}
// Atualiza uma variável
class SETV extends Instrução {
SETV(Empilhável x) {super(x);}
int Exec(Computador C) {
Pilha p = C.p;
int v = ((Endereço)val).val();
C.mem[v] = p.pop();
return 1;
}
// String Show() {
// String res = "\t\t\tnew ADR";
// if (val != null)
// res += "(new " + val.toString().replaceFirst("@.+","").replace("ç","c") + "("+val.Show() + ")),";
// else
// res += "(),";
// res += "\n\t\t\tnew STO(),";
// return res;
// }
}
// Empilha uma variável local
class PUSHLV extends Instrução {
PUSHLV(Empilhável x) {super(x);}
int Exec(Computador C) {
Pilha p = C.p;
int end = ((Endereço)val).val();
Frame f = C.frame;
Empilhável pp = f.get(end);
p.push(pp);
return 1;
}
}
// Atualiza uma variável local
class SETLV extends Instrução {
SETLV(Empilhável x) {super(x);}
int Exec(Computador C) {
Pilha p = C.p;
int v = ((Endereço)val).val();
Frame f = C.frame;
Empilhável pp = p.pop();
f.set(pp,v);
return 1;
}
}
// troca os dois elementos do topo
class SWAP extends Instrução {
int Exec(Computador C) {
Pilha p = C.p;
Empilhável e1 = p.pop();
Empilhável e2 = p.pop();
p.push(e1);
p.push(e2);
return 1;
}
}
class POP extends Instrução {
int Exec(Computador C) {
Pilha p = C.p;
p.pop();
return 1;
}
}
class DUP extends Instrução {
int Exec(Computador C) {
Pilha p = C.p;
Empilhável dd = p.pop();
p.push(dd);
p.push(dd);
return 1;
}
}
////////////////////////////////////
// Controle de fluxo
class JIF extends Instrução {
JIF(Empilhável x) {super(x);}
JIF(int n) {super(new Endereço(n));}
int Exec(Computador C) {
Pilha p = C.p;
Endereço end = (Endereço) val;
Empilhável e1 = p.pop();
Inteiro n1;
if (e1 instanceof Inteiro) {
n1 = (Inteiro)e1;
}
else n1 = new Inteiro(0);
if (n1.val() == 0)
return end.val();
else return 1;
}
String Show() {
String res = "\t\t\tnew " + this.toString().replaceFirst("@.+","");
if (val != null)
res += "(new DesvioRelativo("+val.Show() + ")),";
else
res += "(),";
return res;
}
}
class JMP extends Instrução {
JMP (Empilhável x) {super(x);}
JMP (int x) {super(new Endereço(x));}
int Exec(Computador C) {
return ((Endereço) val).val();
}
String Show() {
String res = "\t\t\tnew " + this.toString().replaceFirst("@.+","");
if (val != null)
res += "(new DesvioRelativo("+val.Show() + ")),";
else
res += "(),";
return res;
}
}
class RET extends Instrução {
int Exec(Computador C) {
Pilha p = C.p;
Empilhável r = p.pop();
Endereço retorno = (Endereço) p.pop();
p.push(r);
return retorno.val();
}
}
class PRN extends Instrução {
int Exec(Computador C) {
Pilha p = C.p;
Empilhável x = p.pop();
if (x instanceof Cadeia)
System.out.print(((Cadeia) x).v);
else if (x instanceof Inteiro)
System.out.print(((Inteiro) x).val());
else if (x instanceof Real)
System.out.print(((Real) x).val());
else if (x instanceof Endereço)
System.out.print(((Endereço) x).val());
return 1;
}
}
class CALL extends Instrução {
CALL (Empilhável x) {super(x);}
int Exec(Computador C) {
Pilha p = C.p;
int ip = C.ip;
Instrução[] Prog = C.Prog;
Endereço e = (Endereço)Prog[ip].val;
p.push(new Endereço(ip+1));
C.roda(e.val());
return 1;
}
// String Show() {
// String res = "\t\t\tnew " + this.toString().replaceFirst("@.+","");
// if (val != null)
// res += "(new " + val.toString().replaceFirst("@.+","").replace("ç","c") + "("+ (Integer.parseInt(val.Show())+1) + ")),"; // adicionamos um por causa do PUSH na posição zero do programa
// else
// res += "(),";
// return res;
// }
}
class ENTRA extends Instrução {
int Exec(Computador C) {
C.Contexto.push(C.frame);
C.frame=new Frame();
return 1;
}
}
| [
"marcelo.silvarolla@gmail.com"
] | marcelo.silvarolla@gmail.com |
7889c0aeefba3f0de10d34a4cb18804c217bb1e7 | fc37a5810c6af7bcd9ba524fc2dc58f70ebd03f8 | /RubbishClassification/app/src/main/java/com/example/rubbishclassification/zxing/view/ViewfinderView.java | 92ba009f131d79534010afa7c31ff71bce3caaef | [] | no_license | spzhongwin/fctgAndroid | 8168139ea51604a326f418aeddd675daa3f1004d | 608f47eadd08e2b2fdacad5c154f9cc6758a6e41 | refs/heads/master | 2020-04-17T05:02:27.020805 | 2019-05-14T05:07:40 | 2019-05-14T05:07:40 | 166,259,018 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,140 | java |
package com.example.rubbishclassification.zxing.view;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.View;
import android.view.animation.DecelerateInterpolator;
import com.example.rubbishclassification.R;
import com.example.rubbishclassification.zxing.bean.ZxingConfig;
import com.example.rubbishclassification.zxing.camera.CameraManager;
import com.google.zxing.ResultPoint;
import java.util.ArrayList;
import java.util.List;
public final class ViewfinderView extends View {
/*界面刷新间隔时间*/
private static final long ANIMATION_DELAY = 80L;
private static final int CURRENT_POINT_OPACITY = 0xA0;
private static final int MAX_RESULT_POINTS = 20;
private static final int POINT_SIZE = 6;
private CameraManager cameraManager;
private Paint paint, scanLinePaint, reactPaint, frameLinePaint;
private Bitmap resultBitmap;
private int maskColor; // 取景框外的背景颜色
private int resultColor;// result Bitmap的颜色
private int resultPointColor; // 特征点的颜色
private int reactColor;//四个角的颜色
private int scanLineColor;//扫描线的颜色
private int frameLineColor = -1;//边框线的颜色
private List<ResultPoint> possibleResultPoints;
private List<ResultPoint> lastPossibleResultPoints;
// 扫描线移动的y
private int scanLineTop;
private ZxingConfig config;
private ValueAnimator valueAnimator;
private Rect frame;
public ViewfinderView(Context context) {
this(context, null);
}
public ViewfinderView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public void setZxingConfig(ZxingConfig config) {
this.config = config;
reactColor = ContextCompat.getColor(getContext(), config.getReactColor());
if (config.getFrameLineColor() != -1) {
frameLineColor = ContextCompat.getColor(getContext(), config.getFrameLineColor());
}
scanLineColor = ContextCompat.getColor(getContext(), config.getScanLineColor());
initPaint();
}
public ViewfinderView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
maskColor = ContextCompat.getColor(getContext(), R.color.viewfinder_mask);
resultColor = ContextCompat.getColor(getContext(), R.color.result_view);
resultPointColor = ContextCompat.getColor(getContext(), R.color.possible_result_points);
possibleResultPoints = new ArrayList<ResultPoint>(10);
lastPossibleResultPoints = null;
}
private void initPaint() {
paint = new Paint(Paint.ANTI_ALIAS_FLAG);
/*四个角的画笔*/
reactPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
reactPaint.setColor(reactColor);
reactPaint.setStyle(Paint.Style.FILL);
reactPaint.setStrokeWidth(2);
/*边框线画笔*/
if (frameLineColor != -1) {
frameLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
frameLinePaint.setColor(ContextCompat.getColor(getContext(), config.getFrameLineColor()));
frameLinePaint.setStrokeWidth(2);
frameLinePaint.setStyle(Paint.Style.STROKE);
}
/*扫描线画笔*/
scanLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
scanLinePaint.setStrokeWidth(2);
scanLinePaint.setStyle(Paint.Style.FILL);
scanLinePaint.setDither(true);
scanLinePaint.setColor(scanLineColor);
}
private void initAnimator() {
if (valueAnimator == null) {
valueAnimator = ValueAnimator.ofInt(frame.top, frame.bottom);
valueAnimator.setDuration(3000);
valueAnimator.setInterpolator(new DecelerateInterpolator());
valueAnimator.setRepeatMode(ValueAnimator.RESTART);
valueAnimator.setRepeatCount(ValueAnimator.INFINITE);
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
scanLineTop = (int) animation.getAnimatedValue();
invalidate();
}
});
valueAnimator.start();
}
}
public void setCameraManager(CameraManager cameraManager) {
this.cameraManager = cameraManager;
}
@SuppressLint("DrawAllocation")
@Override
public void onDraw(Canvas canvas) {
if (cameraManager == null) {
return;
}
// frame为取景框
frame = cameraManager.getFramingRect();
Rect previewFrame = cameraManager.getFramingRectInPreview();
if (frame == null || previewFrame == null) {
return;
}
initAnimator();
int width = canvas.getWidth();
int height = canvas.getHeight();
/*绘制遮罩*/
//drawMaskView(canvas, frame, width, height);
/*绘制取景框边框*/
drawFrameBounds(canvas, frame);
if (resultBitmap != null) {
// Draw the opaque result bitmap over the scanning rectangle
// 如果有二维码结果的Bitmap,在扫取景框内绘制不透明的result Bitmap
paint.setAlpha(CURRENT_POINT_OPACITY);
canvas.drawBitmap(resultBitmap, null, frame, paint);
} else {
/*绘制扫描线*/
drawScanLight(canvas, frame);
/*绘制闪动的点*/
// drawPoint(canvas, frame, previewFrame);
}
}
private void drawPoint(Canvas canvas, Rect frame, Rect previewFrame) {
float scaleX = frame.width() / (float) previewFrame.width();
float scaleY = frame.height() / (float) previewFrame.height();
// 绘制扫描线周围的特征点
List<ResultPoint> currentPossible = possibleResultPoints;
List<ResultPoint> currentLast = lastPossibleResultPoints;
int frameLeft = frame.left;
int frameTop = frame.top;
if (currentPossible.isEmpty()) {
lastPossibleResultPoints = null;
} else {
possibleResultPoints = new ArrayList<ResultPoint>(5);
lastPossibleResultPoints = currentPossible;
paint.setAlpha(CURRENT_POINT_OPACITY);
paint.setColor(resultPointColor);
synchronized (currentPossible) {
for (ResultPoint point : currentPossible) {
canvas.drawCircle(frameLeft
+ (int) (point.getX() * scaleX), frameTop
+ (int) (point.getY() * scaleY), POINT_SIZE,
paint);
}
}
}
if (currentLast != null) {
paint.setAlpha(CURRENT_POINT_OPACITY / 2);
paint.setColor(resultPointColor);
synchronized (currentLast) {
float radius = POINT_SIZE / 2.0f;
for (ResultPoint point : currentLast) {
canvas.drawCircle(frameLeft
+ (int) (point.getX() * scaleX), frameTop
+ (int) (point.getY() * scaleY), radius, paint);
}
}
}
// Request another update at the animation interval, but only
// repaint the laser line,
// not the entire viewfinder mask.
postInvalidateDelayed(ANIMATION_DELAY, frame.left - POINT_SIZE,
frame.top - POINT_SIZE, frame.right + POINT_SIZE,
frame.bottom + POINT_SIZE);
}
private void drawMaskView(Canvas canvas, Rect frame, int width, int height) {
// Draw the exterior (i.e. outside the framing rect) darkened
// 绘制取景框外的暗灰色的表面,分四个矩形绘制
paint.setColor(resultBitmap != null ? resultColor : maskColor);
/*上面的框*/
canvas.drawRect(0, 0, width, frame.top, paint);
/*绘制左边的框*/
canvas.drawRect(0, frame.top, frame.left, frame.bottom + 1, paint);
/*绘制右边的框*/
canvas.drawRect(frame.right + 1, frame.top, width, frame.bottom + 1,
paint);
/*绘制下面的框*/
canvas.drawRect(0, frame.bottom + 1, width, height, paint);
}
/**
* 绘制取景框边框
*
* @param canvas
* @param frame
*/
private void drawFrameBounds(Canvas canvas, Rect frame) {
/*扫描框的边框线*/
if (frameLineColor != -1) {
canvas.drawRect(frame, frameLinePaint);
}
/*四个角的长度和宽度*/
int width = frame.width();
int corLength = (int) (width * 0.07);
int corWidth = (int) (corLength * 0.2);
corWidth = corWidth > 15 ? 15 : corWidth;
/*角在线外*/
// 左上角
canvas.drawRect( 0, 0, 50,10, reactPaint);
canvas.drawRect(0,10,10,50,reactPaint);
// 右上角
canvas.drawRect(width-50, 0, width,10, reactPaint);
canvas.drawRect(width-10,10,width,50, reactPaint);
// 左下角
canvas.drawRect(0,width-50,10,width, reactPaint);
canvas.drawRect(10,width-10,50,width, reactPaint);
// 右下角
canvas.drawRect(width-50,width-10,width,width,reactPaint);
canvas.drawRect(width-10,width-50,width,width-10, reactPaint);
}
/**
* 绘制移动扫描线
*
* @param canvas
* @param frame
*/
private void drawScanLight(Canvas canvas, Rect frame) {
canvas.drawLine(frame.left, scanLineTop, frame.right, scanLineTop, scanLinePaint);
}
public void drawViewfinder() {
Bitmap resultBitmap = this.resultBitmap;
this.resultBitmap = null;
if (resultBitmap != null) {
resultBitmap.recycle();
}
invalidate();
}
/**
* Draw a bitmap with the result points highlighted instead of the live
* scanning display.
*
* @param barcode An image of the decoded barcode.
*/
public void drawResultBitmap(Bitmap barcode) {
resultBitmap = barcode;
invalidate();
}
public void addPossibleResultPoint(ResultPoint point) {
List<ResultPoint> points = possibleResultPoints;
synchronized (points) {
points.add(point);
int size = points.size();
if (size > MAX_RESULT_POINTS) {
// trim it
points.subList(0, size - MAX_RESULT_POINTS / 2).clear();
}
}
}
private int dp2px(int dp) {
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, getResources().getDisplayMetrics());
}
}
| [
"songpeixinyouxiang@163.com"
] | songpeixinyouxiang@163.com |
eb8d441871f56410d4877b096ebaa83d24b51971 | 4507508fdff3f2c3abe62cd6d53158bb21b6cd51 | /src/net/sf/odinms/net/channel/handler/ScriptedItemHandler.java | 1cec98a7ee0cd915a78d8b1d8f36acbc48c0cf7a | [] | no_license | queryDuan/MapleSrc | ddc2e1ae174cdde8de9f97a119d8abdfd69dd042 | f7232511666e3fd513bfb26388c12b44c21b4195 | refs/heads/master | 2020-05-02T20:52:53.322933 | 2016-11-06T01:12:49 | 2016-11-06T01:12:49 | 178,204,448 | 2 | 0 | null | 2019-03-28T13:01:03 | 2019-03-28T13:01:02 | null | UTF-8 | Java | false | false | 2,117 | java | /*
This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
Matthias Butz <matze@odinms.de>
Jan Christian Meyer <vimes@odinms.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License version 3
as published by the Free Software Foundation. You may not use, modify
or distribute this program under any other version of the
GNU Affero General Public License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.sf.odinms.net.channel.handler;
import net.sf.odinms.client.IItem;
import net.sf.odinms.client.MapleClient;
import net.sf.odinms.net.AbstractMaplePacketHandler;
import net.sf.odinms.scripting.npc.NPCScriptManager;
import net.sf.odinms.server.MapleItemInformationProvider;
import net.sf.odinms.tools.data.input.SeekableLittleEndianAccessor;
/**
*
* @author Jay Estrella
*/
public class ScriptedItemHandler extends AbstractMaplePacketHandler {
@Override
public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
slea.readInt(); // trash stamp (thx rmzero)
byte itemSlot = (byte)slea.readShort(); // item sl0t (thx rmzero)
int itemId = slea.readInt(); // itemId
int npcId = ii.getScriptedItemNpc(itemId);
IItem item = c.getPlayer().getInventory(ii.getInventoryType(itemId)).getItem(itemSlot);
if (item == null || item.getItemId() != itemId || item.getQuantity() <= 0 || npcId == 0) {
return;
}
NPCScriptManager.getInstance().start(c, npcId);
}
} | [
"haohui.chh@alibaba-inc.com"
] | haohui.chh@alibaba-inc.com |
1c82eeb81376a84a96878bad666a40ebd0e87b1e | 91e938f564929e679843dfbbbdb3cd85c17b5ec0 | /MyApplication3/app/src/main/java/com/example/myapplication/MainActivity.java | cd9c57fcbe11c891bd7f6a288e015a829c2cd57b | [] | no_license | anastasiaduplina/my_projects | 37bec4caaecf84bb7200bd3f89d4c2653872bd64 | ffde5dc7ef9f01a2d977eed1a12ae04f46fc1281 | refs/heads/main | 2023-05-08T04:31:01.999065 | 2021-06-01T20:22:33 | 2021-06-01T20:22:33 | 372,956,979 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,984 | java | package com.example.myapplication;
import androidx.appcompat.app.AppCompatActivity;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.RadioGroup;
import android.widget.Spinner;
import com.google.android.material.internal.ViewOverlayImpl;
public class MainActivity extends AppCompatActivity implements View.OnClickListener, RadioGroup.OnCheckedChangeListener,AdapterView.OnItemSelectedListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MyView myView= findViewById(R.id.panel);
RadioGroup shapes = findViewById(R.id.rg2);
Spinner color= findViewById(R.id.colours);
class Listener implements View.OnClickListener, RadioGroup.OnCheckedChangeListener {
@Override
public void onClick(View v) {
myView.undo();
}
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
Log.i( "changeChecked",checkedId + "");
switch(checkedId){
case R.id.rect:myView.setTypeShape(MyView.TYPE_RECT); break;
case R.id.circle:myView.setTypeShape(MyView.TYPE_CIRCLE); break;
case R.id.triangle:myView.setTypeShape(MyView.TYPE_TRIANGLE); break;
}
}
}
//RadioGroup.OnCheckedChangeListener;
String[] colors= getResources().getStringArray(R.array.coloursnum);
class Spinner extends Activity implements AdapterView.OnItemSelectedListener {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
myView.color=colors[position];
Log.i( "changeColor",colors[position] + "");
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
}
Listener listener = new Listener();
Spinner spinner= new Spinner();
Button undoBtn=findViewById(R.id.undo);
undoBtn.setOnClickListener(listener);
shapes.setOnCheckedChangeListener(listener);
color.setOnItemSelectedListener(spinner);
}
@Override
public void onClick(View v) {
Log.i("onClick","onClick");
}
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
Log.i( "changeChecked",checkedId + "");
switch(checkedId){
case R.id.rect:break;
case R.id.circle:break;
case R.id.triangle:break;
}
}
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
} | [
"61756179+anastasiaduplina@users.noreply.github.com"
] | 61756179+anastasiaduplina@users.noreply.github.com |
e592aac1b8bf48eb72f62ab36ed676c8b3c1e414 | 6e5af60d4dc67df8524e788f985d1b8024ddd085 | /imageio/imageio-icns/src/main/java/com/twelvemonkeys/imageio/plugins/icns/ICNSImageWriterSpi.java | bf207e3996e0e45e02b11f3b45fe1bffcb753d44 | [
"BSD-3-Clause"
] | permissive | haraldk/TwelveMonkeys | 75c8dbf9490524aaf7d5a2ff4235c29770627c59 | e72255805e45b55120c9f32e1a115cb4a89a42f0 | refs/heads/master | 2023-09-05T09:33:09.855954 | 2023-08-29T08:50:48 | 2023-08-29T08:50:48 | 296,658 | 1,631 | 312 | BSD-3-Clause | 2023-09-14T08:37:10 | 2009-09-03T17:44:28 | Java | UTF-8 | Java | false | false | 2,304 | java | /*
* Copyright (c) 2017, Harald Kuhr
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.imageio.plugins.icns;
import com.twelvemonkeys.imageio.spi.ImageWriterSpiBase;
import javax.imageio.ImageTypeSpecifier;
import java.util.Locale;
/**
* ICNSImageWriterSpi
*/
public final class ICNSImageWriterSpi extends ImageWriterSpiBase {
public ICNSImageWriterSpi() {
super(new ICNSProviderInfo());
}
@Override
public boolean canEncodeImage(final ImageTypeSpecifier type) {
return true;
}
@Override
public ICNSImageWriter createWriterInstance(final Object extension) {
return new ICNSImageWriter(this);
}
@Override
public String getDescription(final Locale locale) {
return "Apple Icon Image (icns) format Writer";
}
}
| [
"harald.kuhr@gmail.com"
] | harald.kuhr@gmail.com |
8ec299abe6a84ffb3cd12222cd772ca3220f9235 | 3f975795f3353ca5b07b9c2fac294db6a6367efd | /app/src/main/java/org/blendin/blendin/models/User.java | 294d2c49c4fecfdc980e8cad4e3ea1876651ebd3 | [] | no_license | humanizer-app/blendin | 28d67f83c855a9bc695e70b7ec6135ba3d46e53e | 7d1150b442f10e9c18f4f2e87f5cd6b4e9aac9bc | refs/heads/master | 2021-01-25T11:02:11.721951 | 2017-06-11T13:50:59 | 2017-06-11T13:50:59 | 93,902,890 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 407 | java | package org.blendin.blendin.models;
import com.google.firebase.database.IgnoreExtraProperties;
@IgnoreExtraProperties
public class User {
public String userId;
public String name;
public String photoUrl;
public User() {
}
public User(String userId, String name, String photoUrl) {
this.userId = userId;
this.name = name;
this.photoUrl = photoUrl;
}
}
| [
"yurii.andrusiak@transferwise.com"
] | yurii.andrusiak@transferwise.com |
3c34404612717b76423180e2a2e4d3ef0e689473 | 2fcac318ce9cad695910f58d074ddcae6a9bba65 | /app/src/main/java/com/msjf/fentuan/app/main/StarData.java | 4e0e8a319548ed91764b399ec0d9e0ab9d18ae6b | [] | no_license | leeowenowen/app_base | fb3fe3159f71b23a538875aa88669a7f5d0753d5 | 237c2381121b113472ab2ed17133f712daa8af78 | refs/heads/master | 2021-01-10T18:51:17.733247 | 2015-06-27T14:22:43 | 2015-06-27T14:22:43 | 38,162,632 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,407 | java | package com.msjf.fentuan.app.main;
import com.owo.app.theme.BitmapId;
import com.owo.base.pattern.Singleton;
import java.util.HashMap;
import java.util.Map;
/**
* Created by wangli on 15-6-24.
*/
public class StarData {
public static StarData instance() {
return Singleton.of(StarData.class);
}
private Map<String, BitmapId> mStars = new HashMap<String, BitmapId>();
private StarData() {
add("邓紫棋", BitmapId.star_dengziqi);
add("宋智孝", BitmapId.start_songzhixiao);
add("吴亦凡", BitmapId.star_wuyifan);
add("朴信惠", BitmapId.star_puxinhui);
add("周杰伦", BitmapId.star_zhoujielun);
add("李敏镐", BitmapId.star_liminhao);
add("李准基", BitmapId.star_lizhunji);
add("鹿晗", BitmapId.star_luhan);
add("张根硕", BitmapId.star_zhanggenshuo);
add("朴有天", BitmapId.star_puyoutian);
add("李钟硕", BitmapId.star_lizhongshuo);
add("bigbang", BitmapId.star_bigbang);
add("张艺兴", BitmapId.star_zhangyixing);
add("宋承宪", BitmapId.star_songchegnxian);
add("宋慧乔", BitmapId.star_songhuiqiao);
add("李易峰", BitmapId.star_liyifeng);
}
private void add(String name, BitmapId id) {
mStars.put(name, id);
}
public BitmapId id(String name) {
return mStars.get(name);
}
}
| [
"leeowenowen@gmail.com"
] | leeowenowen@gmail.com |
1f192417d8be3086d75be70096ec4e500f5cd77c | 3ca3ade1a9ee1b072b92ae965b777096cbf8c301 | /Solution/app/src/main/java/com/droidrank/sample/controller/MagicBoxController.java | 521bf4983725a3e4f9fcd683e522c26d94107d93 | [] | no_license | teslimSulaiman/magixBox | 044b84da2c4b6e413f3c32d7b73edc0f23cc039e | ec775d43417a6303cb3a0f56fa172e1e6ebbdaa9 | refs/heads/master | 2020-03-19T08:16:15.327469 | 2018-06-06T09:43:41 | 2018-06-06T09:43:41 | 136,189,676 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,332 | java | package com.droidrank.sample.controller;
import com.droidrank.sample.R;
import com.droidrank.sample.data.BoxData;
import com.droidrank.sample.viewInterface.InputInterface;
/**
* Created by USER on 5/28/2018.
*/
public class MagicBoxController {
private InputInterface inputInterface;
private BoxData boxData;
public MagicBoxController(InputInterface inputInterface, BoxData boxData) {
this.inputInterface = inputInterface;
this.boxData = boxData;
}
public MagicBoxController( BoxData boxData) {
this.boxData = boxData;
}
public String[] getData(int numberOfColumn){
return boxData.getBoxData(numberOfColumn);
}
public void onButtonClicked() {
String numberOfColumns = inputInterface.getNumberInput();
if (boxData.isFieldEmpty(numberOfColumns)){
inputInterface.showInputError(R.string.error_empty);
return;
}
if(android.text.TextUtils.isDigitsOnly(numberOfColumns) && boxData.isOdd(Integer.parseInt(numberOfColumns))){
inputInterface.startActivity();
}else if(android.text.TextUtils.isDigitsOnly(numberOfColumns)){
inputInterface.showInputError(R.string.only_odd);
}else{
inputInterface.showInputError(R.string.error_input);
}
}
}
| [
"teslimsulaiman@gmail.com"
] | teslimsulaiman@gmail.com |
243e78fd35d3f4f6c9c018dbb01cbfbe2200c554 | 02663867922a68aab7107a0cd3350bc94ac62d70 | /src/main/java/com/amihaiemil/charles/rest/LogsResource.java | b3bd6e282143556e355d3b38de88d5fb626604e1 | [] | no_license | ArchieDavid/charles-rest | 007736dbbecfebb627769de5e3855c9db755ceb1 | d950b3cc0d26162c6ee0d154f28910d2350457dc | refs/heads/master | 2020-03-07T01:43:28.577417 | 2017-10-27T07:24:19 | 2017-10-27T07:24:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,545 | java | /**
* Copyright (c) 2016-2017, Mihai Emil Andronache
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1)Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2)Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3)Neither the name of charles-rest nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package com.amihaiemil.charles.rest;
import java.io.File;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;
/**
* REST resource for fetching the logs of each Action.
* @author Mihai Andronache (amihaiemil@gmail.com)
* @version $Id$
* @since 1.0.0
*/
@Path("/logs")
public class LogsResource {
/**
* Fetch the log file of an Action by name.
* @return HTTP Response.
*/
@Path("/{name}")
@GET
public Response getActionLogs(@PathParam("name") String name) {
String logroot = System.getProperty("LOG_ROOT");
if(logroot != null) {
File log = new File(logroot + "/charles-rest/ActionsLogs/" + name);
if(log.exists()) {
return Response.ok()
.entity(log)
.header("Content-Type", "text/plain; charset=UTF-8").build();
}
}
return Response.noContent().build();
}
}
| [
"amihaiemil@gmail.com"
] | amihaiemil@gmail.com |
837115dd3a4ce9edfe8452f6ca327f476992a559 | f192b9df8d3f7312d6df8d15c75f5a73e3abcd4e | /app/src/main/java/com/example/yoelfebryan/feedme/CRUD/UpdatePSellerActivity.java | 96eef0539f1f708ea70c3f5d3d86f21e167355e4 | [] | no_license | yoelfbt/Feed_Me | 86e9175989c38d37061c512eb6667574a24faeb0 | 28dd9754d5c6e1b199f099f9e0a137820ec61c46 | refs/heads/master | 2020-03-07T11:17:29.811340 | 2018-04-28T04:42:38 | 2018-04-28T04:42:38 | 127,451,879 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,558 | java | package com.example.yoelfebryan.feedme.CRUD;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.example.yoelfebryan.feedme.DBHelper.DatabaseHelper;
import com.example.yoelfebryan.feedme.R;
public class UpdatePSellerActivity extends AppCompatActivity {
protected Cursor cursor;
DatabaseHelper databaseHelper;
Button btn1;
EditText text1, text2, text3, text4, text5;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_update_pseller);
databaseHelper = new DatabaseHelper(this);
text1 = (EditText) findViewById(R.id.editText1);
text2 = (EditText) findViewById(R.id.editText2);
text3 = (EditText) findViewById(R.id.editText3);
text4 = (EditText) findViewById(R.id.editText4);
text5 = (EditText) findViewById(R.id.editText5);
btn1 = (Button) findViewById(R.id.button1);
SQLiteDatabase db = databaseHelper.getReadableDatabase();
cursor = db.rawQuery("SELECT * FROM seller WHERE nama_toko = '" + getIntent().getStringExtra("user") + "'", null);
cursor.moveToFirst();
if (cursor.getCount() > 0) {
cursor.moveToPosition(0);
text1.setText(cursor.getString(0).toString());
text2.setText(cursor.getString(1).toString());
text3.setText(cursor.getString(2).toString());
text4.setText(cursor.getString(3).toString());
text5.setText(cursor.getString(4).toString());
}
btn1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SQLiteDatabase db = databaseHelper.getWritableDatabase();
db.execSQL("update seller set nama_toko='" +
text2.getText().toString() + "', nohp_toko='" +
text3.getText().toString() + "', alamat_toko='" +
text4.getText().toString() + "', password_toko='" +
text5.getText().toString() + "' where id_toko='" +
text1.getText().toString() + "'");
Toast.makeText(getApplicationContext(), "Update Berhasil", Toast.LENGTH_SHORT).show();
finish();
}
});
}
}
| [
"yoel.febrian19@gmail.com"
] | yoel.febrian19@gmail.com |
e3cdc13409c1cfcb555d4d2a21cde951181b7dc6 | 2eb8c58056488abc0fa819bde0ddb0caf4f322ec | /webapp/src/main/java/com/yijiaersan/webapp/utils/Code.java | 727cd174734258b5498409b519469cc9c16bba23 | [] | no_license | xiffent/gushidianjin-app | c0847e837ddba9d272d219c12c1c04152a10a9ab | fc6903d351cd1c6386ede0a34d82e1933aabdf23 | refs/heads/master | 2020-04-05T23:08:34.674316 | 2016-10-16T08:55:34 | 2016-10-16T08:55:34 | 69,012,005 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 570 | java | package com.yijiaersan.webapp.utils;
import java.util.Random;
public class Code {
public static String getRandNum(int charCount) {
String charValue = "";
for (int i = 0; i < charCount; i++) {
char c = (char) (randomInt(0, 10) + '0');
charValue += String.valueOf(c);
}
return charValue;
}
public static int randomInt(int from, int to) {
Random r = new Random();
return from + r.nextInt(to - from);
}
public static void main(String[] args) {
String codeNum = Code.getRandNum(6);
System.out.println(codeNum);
}
}
| [
"xiffent@outlook.com"
] | xiffent@outlook.com |
36c8f072715ca59dad81f61ccf68b239cfff6cb8 | 065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be | /eclipseswt_cluster/9372/tar_0.java | 93685904bf2e4fa2aee379c4120a4e11109432fb | [] | no_license | martinezmatias/GenPat-data-C3 | 63cfe27efee2946831139747e6c20cf952f1d6f6 | b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4 | refs/heads/master | 2022-04-25T17:59:03.905613 | 2020-04-15T14:41:34 | 2020-04-15T14:41:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 31,541 | java | /*******************************************************************************
* Copyright (c) 2000, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.swt.widgets;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.internal.wpf.*;
import org.eclipse.swt.events.*;
/**
* Instances of this class are selectable user interface
* objects that allow the user to enter and modify numeric
* values.
* <p>
* Note that although this class is a subclass of <code>Composite</code>,
* it does not make sense to add children to it, or set a layout on it.
* </p><p>
* <dl>
* <dt><b>Styles:</b></dt>
* <dd>READ_ONLY, WRAP</dd>
* <dt><b>Events:</b></dt>
* <dd>Selection, Modify, Verify</dd>
* </dl>
* </p><p>
* IMPORTANT: This class is <em>not</em> intended to be subclassed.
* </p>
*
* @see <a href="http://www.eclipse.org/swt/snippets/#spinner">Spinner snippets</a>
* @see <a href="http://www.eclipse.org/swt/examples.php">SWT Example: ControlExample</a>
* @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
*
* @since 3.1
* @noextend This class is not intended to be subclassed by clients.
*/
public class Spinner extends Composite {
int textHandle, upHandle, downHandle;
int increment, pageIncrement, digits, max, min, value;
/**
* the operating system limit for the number of characters
* that the text field in an instance of this class can hold
*
* @since 3.4
*/
public static final int LIMIT;
/*
* These values can be different on different platforms.
* Therefore they are not initialized in the declaration
* to stop the compiler from inlining.
*/
static {
LIMIT = 0x7FFFFFFF;
}
/**
* Constructs a new instance of this class given its parent
* and a style value describing its behavior and appearance.
* <p>
* The style value is either one of the style constants defined in
* class <code>SWT</code> which is applicable to instances of this
* class, or must be built by <em>bitwise OR</em>'ing together
* (that is, using the <code>int</code> "|" operator) two or more
* of those <code>SWT</code> style constants. The class description
* lists the style constants that are applicable to the class.
* Style bits are also inherited from superclasses.
* </p>
*
* @param parent a composite control which will be the parent of the new instance (cannot be null)
* @param style the style of control to construct
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
* <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
* </ul>
*
* @see SWT#READ_ONLY
* @see SWT#WRAP
* @see Widget#checkSubclass
* @see Widget#getStyle
*/
public Spinner (Composite parent, int style) {
super (parent, checkStyle (style));
}
Control [] _getChildren () {
return new Control [0];
}
static int checkStyle (int style) {
/*
* Even though it is legal to create this widget
* with scroll bars, they serve no useful purpose
* because they do not automatically scroll the
* widget's client area. The fix is to clear
* the SWT style.
*/
return style & ~(SWT.H_SCROLL | SWT.V_SCROLL);
}
protected void checkSubclass () {
if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
}
int backgroundHandle () {
return textHandle;
}
int backgroundProperty () {
return OS.Control_BackgroundProperty ();
}
public Point computeSize (int wHint, int hHint, boolean changed) {
checkWidget ();
return super.computeSize (handle, wHint, hHint, changed);
}
int createArrow (int direction) {
int geometry = OS.gcnew_StreamGeometry ();
int context = OS.StreamGeometry_Open (geometry);
int start = 0, point = 0, end = 0;
switch (direction) {
case SWT.DOWN:
start = OS.gcnew_Point (0, 0);
point = OS.gcnew_Point (3, 3);
end = OS.gcnew_Point (6, 0);
break;
case SWT.UP:
start = OS.gcnew_Point (0, 3);
point = OS.gcnew_Point (3, 0);
end = OS.gcnew_Point (6, 3);
break;
}
OS.StreamGeometryContext_BeginFigure (context, start, true, true);
OS.StreamGeometryContext_LineTo (context, point, true, true);
OS.StreamGeometryContext_LineTo (context, end, true, true);
OS.StreamGeometryContext_Close (context);
int path = OS.gcnew_Path ();
OS.Path_Data (path, geometry);
int padding = OS.gcnew_Thickness (3, 0, 3, 0);
OS.FrameworkElement_Margin (path, padding);
int brush = OS.Brushes_Black ();
OS.Path_Fill (path, brush);
OS.FrameworkElement_HorizontalAlignment (path, OS.HorizontalAlignment_Center);
OS.FrameworkElement_VerticalAlignment (path, OS.VerticalAlignment_Center);
OS.GCHandle_Free (padding);
OS.GCHandle_Free (start);
OS.GCHandle_Free (point);
OS.GCHandle_Free (end);
OS.GCHandle_Free (brush);
OS.GCHandle_Free (context);
OS.GCHandle_Free (geometry);
return path;
}
void createHandle () {
handle = OS.gcnew_Grid ();
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
int row0 = OS.gcnew_RowDefinition ();
int row1 = OS.gcnew_RowDefinition ();
int rows = OS.Grid_RowDefinitions (handle);
OS.RowDefinitionCollection_Add (rows, row0);
OS.RowDefinitionCollection_Add (rows, row1);
int col0 = OS.gcnew_ColumnDefinition ();
int col1 = OS.gcnew_ColumnDefinition ();
int columns = OS.Grid_ColumnDefinitions (handle);
OS.ColumnDefinitionCollection_Add (columns, col0);
OS.ColumnDefinitionCollection_Add (columns, col1);
int gridChildren = OS.Panel_Children (handle);
textHandle = OS.gcnew_TextBox ();
if (textHandle == 0) error (SWT.ERROR_NO_HANDLES);
OS.Grid_SetRowSpan (textHandle, 2);
OS.UIElementCollection_Add (gridChildren, textHandle);
if ((style & SWT.READ_ONLY) != 0) OS.TextBoxBase_IsReadOnly (textHandle, true);
upHandle = OS.gcnew_RepeatButton ();
if (upHandle == 0) error (SWT.ERROR_NO_HANDLES);
int upArrow = createArrow (SWT.UP);
OS.ContentControl_Content (upHandle, upArrow);
OS.Grid_SetColumn (upHandle, 1);
OS.UIElementCollection_Add (gridChildren, upHandle);
downHandle = OS.gcnew_RepeatButton ();
if (downHandle == 0) error (SWT.ERROR_NO_HANDLES);
int downArrow = createArrow (SWT.DOWN);
OS.ContentControl_Content (downHandle, downArrow);
OS.Grid_SetColumn (downHandle, 1);
OS.Grid_SetRow (downHandle, 1);
OS.UIElementCollection_Add (gridChildren, downHandle);
int colWidth0 = OS.gcnew_GridLength (10, OS.GridUnitType_Star);
OS.ColumnDefinition_Width(col0, colWidth0);
int colWidth1 = OS.gcnew_GridLength (1, OS.GridUnitType_Auto);
OS.ColumnDefinition_Width (col1, colWidth1);
OS.GCHandle_Free (colWidth0);
OS.GCHandle_Free (colWidth1);
OS.GCHandle_Free (upArrow);
OS.GCHandle_Free (downArrow);
OS.GCHandle_Free (row0);
OS.GCHandle_Free (row1);
OS.GCHandle_Free (rows);
OS.GCHandle_Free (col0);
OS.GCHandle_Free (col1);
OS.GCHandle_Free (columns);
OS.GCHandle_Free (gridChildren);
}
void createWidget () {
super.createWidget();
increment = 1;
pageIncrement = 10;
digits = 0;
max = 100;
value = 0;
int ptr = createDotNetString ("0", false);
OS.TextBox_Text (textHandle, ptr);
OS.GCHandle_Free (ptr);
}
/**
* Adds the listener to the collection of listeners who will
* be notified when the receiver's text is modified, by sending
* it one of the messages defined in the <code>ModifyListener</code>
* interface.
*
* @param listener the listener which should be notified
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see ModifyListener
* @see #removeModifyListener
*/
public void addModifyListener (ModifyListener listener) {
checkWidget ();
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
TypedListener typedListener = new TypedListener (listener);
addListener (SWT.Modify, typedListener);
}
/**
* Adds the listener to the collection of listeners who will
* be notified when the control is selected by the user, by sending
* it one of the messages defined in the <code>SelectionListener</code>
* interface.
* <p>
* <code>widgetSelected</code> is not called for texts.
* <code>widgetDefaultSelected</code> is typically called when ENTER is pressed in a single-line text.
* </p>
*
* @param listener the listener which should be notified when the control is selected by the user
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see SelectionListener
* @see #removeSelectionListener
* @see SelectionEvent
*/
public void addSelectionListener(SelectionListener listener) {
checkWidget ();
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
TypedListener typedListener = new TypedListener (listener);
addListener (SWT.Selection,typedListener);
addListener (SWT.DefaultSelection,typedListener);
}
/**
* Adds the listener to the collection of listeners who will
* be notified when the receiver's text is verified, by sending
* it one of the messages defined in the <code>VerifyListener</code>
* interface.
*
* @param listener the listener which should be notified
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see VerifyListener
* @see #removeVerifyListener
*/
void addVerifyListener (VerifyListener listener) {
checkWidget();
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
TypedListener typedListener = new TypedListener (listener);
addListener (SWT.Verify, typedListener);
}
/**
* Copies the selected text.
* <p>
* The current selection is copied to the clipboard.
* </p>
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void copy () {
checkWidget ();
//TODO
}
/**
* Cuts the selected text.
* <p>
* The current selection is first copied to the
* clipboard and then deleted from the widget.
* </p>
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void cut () {
checkWidget ();
if ((style & SWT.READ_ONLY) != 0) return;
//TODO
}
/**
* Returns the number of decimal places used by the receiver.
*
* @return the digits
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int getDigits () {
checkWidget ();
return digits;
}
String getDecimalSeparator () {
return ".";
}
/**
* Returns the amount that the receiver's value will be
* modified by when the up/down arrows are pressed.
*
* @return the increment
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int getIncrement () {
checkWidget ();
return increment;
}
/**
* Returns the maximum value which the receiver will allow.
*
* @return the maximum
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int getMaximum () {
checkWidget ();
return max;
}
/**
* Returns the minimum value which the receiver will allow.
*
* @return the minimum
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int getMinimum () {
checkWidget ();
return min;
}
/**
* Returns the amount that the receiver's position will be
* modified by when the page up/down keys are pressed.
*
* @return the page increment
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int getPageIncrement () {
checkWidget ();
return pageIncrement;
}
/**
* Returns the <em>selection</em>, which is the receiver's position.
*
* @return the selection
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int getSelection () {
checkWidget ();
return value;
}
int getSelectionText (boolean [] parseFail) {
int textPtr = OS.TextBox_Text (textHandle);
String string = createJavaString (textPtr);
OS.GCHandle_Free (textPtr);
try {
int value;
if (digits > 0) {
String decimalSeparator = getDecimalSeparator ();
int index = string.indexOf (decimalSeparator);
if (index != -1) {
int startIndex = string.startsWith ("+") || string.startsWith ("-") ? 1 : 0;
String wholePart = startIndex != index ? string.substring (startIndex, index) : "0";
String decimalPart = string.substring (index + 1);
if (decimalPart.length () > digits) {
decimalPart = decimalPart.substring (0, digits);
} else {
int i = digits - decimalPart.length ();
for (int j = 0; j < i; j++) {
decimalPart = decimalPart + "0";
}
}
int wholeValue = Integer.parseInt (wholePart);
int decimalValue = Integer.parseInt (decimalPart);
for (int i = 0; i < digits; i++) wholeValue *= 10;
value = wholeValue + decimalValue;
if (string.startsWith ("-")) value = -value;
} else {
value = Integer.parseInt (string);
for (int i = 0; i < digits; i++) value *= 10;
}
} else {
value = Integer.parseInt (string);
}
if (min <= value && value <= max) return value;
} catch (NumberFormatException e) {
}
parseFail [0] = true;
return -1;
}
/**
* Returns a string containing a copy of the contents of the
* receiver's text field, or an empty string if there are no
* contents.
*
* @return the receiver's text
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @since 3.4
*/
public String getText () {
checkWidget ();
int text = OS.TextBox_Text (textHandle);
String string = createJavaString (text);
OS.GCHandle_Free (text);
return string;
}
/**
* Returns the maximum number of characters that the receiver's
* text field is capable of holding. If this has not been changed
* by <code>setTextLimit()</code>, it will be the constant
* <code>Spinner.LIMIT</code>.
*
* @return the text limit
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see #LIMIT
*
* @since 3.4
*/
public int getTextLimit () {
checkWidget ();
return OS.TextBox_MaxLength (textHandle);
}
void HandleDownClick (int sender, int e) {
if (!checkEvent (e)) return;
updateSelection (-increment);
}
void HandleLostKeyboardFocus (int sender, int e) {
if (!checkEvent (e)) return;
boolean [] parseFail = new boolean [1];
getSelectionText (parseFail);
if (parseFail [0]) {
setSelection (value, false, true, false);
}
super.HandleLostKeyboardFocus (sender, e);
}
void HandlePreviewKeyDown (int sender, int e) {
super.HandlePreviewKeyDown (sender, e);
if (!checkEvent (e)) return;
int key = OS.KeyEventArgs_Key (e);
int delta = 0;
switch (key) {
case OS.Key_Return:
postEvent (SWT.DefaultSelection);
break;
case OS.Key_Down: delta -= increment; break;
case OS.Key_Up: delta += increment; break;
case OS.Key_PageDown: delta -= pageIncrement; break;
case OS.Key_PageUp: delta += pageIncrement; break;
}
if (delta != 0) {
updateSelection (delta);
}
}
void HandlePreviewTextInput (int sender, int e) {
super.HandlePreviewTextInput (sender, e);
if (!checkEvent (e)) return;
int textPtr = OS.TextCompositionEventArgs_Text (e);
String input = createJavaString(textPtr);
OS.GCHandle_Free (textPtr);
int start = OS.TextBox_SelectionStart (textHandle);
int end = start + OS.TextBox_SelectionLength (textHandle);
String text = verifyText (input, start, end);
if (text != null && !text.equals (input)) {
textPtr = createDotNetString (text, false);
OS.TextBox_SelectedText (textHandle, textPtr);
OS.GCHandle_Free (textPtr);
start = OS.TextBox_SelectionStart (textHandle);
int length = OS.TextBox_SelectionLength (textHandle);
OS.TextBox_Select (textHandle, start+length, 0);
OS.TextBox_SelectionLength (textHandle, 0);
text = null;
}
if (text == null) OS.TextCompositionEventArgs_Handled (e, true);
}
void HandleTextChanged (int sender, int e) {
if (!checkEvent (e)) return;
boolean [] parseFail = new boolean [1];
int value = getSelectionText (parseFail);
if (!parseFail [0]) {
if (this.value != value) setSelection(value, true, false, true);
}
sendEvent (SWT.Modify);
}
void HandleUpClick (int sender, int e) {
if (!checkEvent (e)) return;
updateSelection (increment);
}
void hookEvents () {
super.hookEvents();
//TEXT
int handler = OS.gcnew_TextCompositionEventHandler (jniRef, "HandlePreviewTextInput");
if (handler == 0) error (SWT.ERROR_NO_HANDLES);
OS.UIElement_PreviewTextInput (textHandle, handler);
OS.GCHandle_Free (handler);
// handler = OS.gcnew_ExecutedRoutedEventHandler(jniRef, "HandlePreviewExecutedRoutedEvent");
// if (handler == 0) error (SWT.ERROR_NO_HANDLES);
// OS.CommandManager_AddPreviewExecutedHandler(handle, handler);
// OS.GCHandle_Free(handler);
handler = OS.gcnew_TextChangedEventHandler (jniRef, "HandleTextChanged");
if (handler == 0) error (SWT.ERROR_NO_HANDLES);
OS.TextBoxBase_TextChanged (textHandle, handler);
OS.GCHandle_Free (handler);
//BUTTON
handler = OS.gcnew_RoutedEventHandler (jniRef, "HandleDownClick");
if (handler == 0) error (SWT.ERROR_NO_HANDLES);
OS.ButtonBase_Click (downHandle, handler);
OS.GCHandle_Free (handler);
handler = OS.gcnew_RoutedEventHandler (jniRef, "HandleUpClick");
if (handler == 0) error (SWT.ERROR_NO_HANDLES);
OS.ButtonBase_Click (upHandle, handler);
OS.GCHandle_Free (handler);
}
/**
* Pastes text from clipboard.
* <p>
* The selected text is deleted from the widget
* and new text inserted from the clipboard.
* </p>
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void paste () {
checkWidget ();
//TODO
}
void releaseHandle () {
super.releaseHandle();
OS.GCHandle_Free (textHandle);
OS.GCHandle_Free (upHandle);
OS.GCHandle_Free (downHandle);
}
/**
* Removes the listener from the collection of listeners who will
* be notified when the receiver's text is modified.
*
* @param listener the listener which should no longer be notified
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see ModifyListener
* @see #addModifyListener
*/
public void removeModifyListener (ModifyListener listener) {
checkWidget ();
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
if (eventTable == null) return;
eventTable.unhook (SWT.Modify, listener);
}
/**
* Removes the listener from the collection of listeners who will
* be notified when the control is selected by the user.
*
* @param listener the listener which should no longer be notified
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see SelectionListener
* @see #addSelectionListener
*/
public void removeSelectionListener(SelectionListener listener) {
checkWidget ();
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
if (eventTable == null) return;
eventTable.unhook (SWT.Selection, listener);
eventTable.unhook (SWT.DefaultSelection,listener);
}
/**
* Removes the listener from the collection of listeners who will
* be notified when the control is verified.
*
* @param listener the listener which should no longer be notified
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see VerifyListener
* @see #addVerifyListener
*/
void removeVerifyListener (VerifyListener listener) {
checkWidget ();
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
if (eventTable == null) return;
eventTable.unhook (SWT.Verify, listener);
}
/**
* Sets the number of decimal places used by the receiver.
* <p>
* The digit setting is used to allow for floating point values in the receiver.
* For example, to set the selection to a floating point value of 1.37 call setDigits() with
* a value of 2 and setSelection() with a value of 137. Similarly, if getDigits() has a value
* of 2 and getSelection() returns 137 this should be interpreted as 1.37. This applies to all
* numeric APIs.
* </p>
*
* @param value the new digits (must be greater than or equal to zero)
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_INVALID_ARGUMENT - if the value is less than zero</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setDigits (int value) {
checkWidget ();
if (value < 0) error (SWT.ERROR_INVALID_ARGUMENT);
digits = value;
setSelection (this.value, false, true, false);
}
/**
* Sets the amount that the receiver's value will be
* modified by when the up/down arrows are pressed to
* the argument, which must be at least one.
*
* @param value the new increment (must be greater than zero)
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setIncrement (int value) {
checkWidget ();
if (value < 1) return;
increment = value;
}
/**
* Sets the maximum value that the receiver will allow. This new
* value will be ignored if it is not greater than the receiver's current
* minimum value. If the new maximum is applied then the receiver's
* selection value will be adjusted if necessary to fall within its new range.
*
* @param value the new maximum, which must be greater than the current minimum
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setMaximum (int value) {
checkWidget ();
if (value < min) return;
max = value;
if (this.value > value) setSelection (value, true, true, false);
}
/**
* Sets the minimum value that the receiver will allow. This new
* value will be ignored if it is not less than the receiver's
* current maximum value. If the new minimum is applied then the receiver's
* selection value will be adjusted if necessary to fall within its new range.
*
* @param value the new minimum, which must be less than the current maximum
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setMinimum (int value) {
checkWidget ();
if (value > max) return;
min = value;
if (this.value < value) setSelection (value, true, true, false);
}
/**
* Sets the amount that the receiver's position will be
* modified by when the page up/down keys are pressed
* to the argument, which must be at least one.
*
* @param value the page increment (must be greater than zero)
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setPageIncrement (int value) {
checkWidget ();
if (value < 1) return;
pageIncrement = value;
}
/**
* Sets the <em>selection</em>, which is the receiver's
* position, to the argument. If the argument is not within
* the range specified by minimum and maximum, it will be
* adjusted to fall within this range.
*
* @param value the new selection (must be zero or greater)
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setSelection (int value) {
checkWidget ();
value = Math.min (Math.max (min, value), max);
setSelection (value, true, true, false);
}
void setSelection (int value, boolean setPos, boolean setText, boolean notify) {
if (setPos) {
this.value = value;
}
if (setText) {
String string;
if (digits == 0) {
string = String.valueOf (value);
} else {
string = String.valueOf (Math.abs (value));
String decimalSeparator = getDecimalSeparator ();
int index = string.length () - digits;
StringBuffer buffer = new StringBuffer ();
if (value < 0) buffer.append ("-");
if (index > 0) {
buffer.append (string.substring (0, index));
buffer.append (decimalSeparator);
buffer.append (string.substring (index));
} else {
buffer.append ("0");
buffer.append (decimalSeparator);
while (index++ < 0) buffer.append ("0");
buffer.append (string);
}
string = buffer.toString ();
}
// if (hooks (SWT.Verify) || filters (SWT.Verify)) {
// int length = OS.GetWindowTextLength (hwndText);
// string = verifyText (string, 0, length, null);
// if (string == null) return;
// }
int ptr = createDotNetString (string, false);
OS.TextBox_Text (textHandle, ptr);
OS.GCHandle_Free (ptr);
}
if (notify) postEvent (SWT.Selection);
}
/**
* Sets the maximum number of characters that the receiver's
* text field is capable of holding to be the argument.
* <p>
* To reset this value to the default, use <code>setTextLimit(Spinner.LIMIT)</code>.
* Specifying a limit value larger than <code>Spinner.LIMIT</code> sets the
* receiver's limit to <code>Spinner.LIMIT</code>.
* </p>
* @param limit new text limit
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_CANNOT_BE_ZERO - if the limit is zero</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see #LIMIT
*
* @since 3.4
*/
public void setTextLimit (int limit) {
checkWidget ();
if (limit == 0) error (SWT.ERROR_CANNOT_BE_ZERO);
OS.TextBox_MaxLength (textHandle, limit);
}
/**
* Sets the receiver's selection, minimum value, maximum
* value, digits, increment and page increment all at once.
* <p>
* Note: This is similar to setting the values individually
* using the appropriate methods, but may be implemented in a
* more efficient fashion on some platforms.
* </p>
*
* @param selection the new selection value
* @param minimum the new minimum value
* @param maximum the new maximum value
* @param digits the new digits value
* @param increment the new increment value
* @param pageIncrement the new pageIncrement value
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @since 3.2
*/
public void setValues (int selection, int minimum, int maximum, int digits, int increment, int pageIncrement) {
checkWidget ();
if (maximum < minimum) return;
if (digits < 0) return;
if (increment < 1) return;
if (pageIncrement < 1) return;
selection = Math.min (Math.max (minimum, selection), maximum);
this.pageIncrement = pageIncrement;
this.increment = increment;
this.digits = digits;
this.min = minimum;
this.max = maximum;
setSelection (selection, true, true, false);
}
void updateSelection (int delta) {
boolean [] parseFail = new boolean [1];
int value = getSelectionText (parseFail);
if (parseFail [0]) value = this.value;
int newValue = value + delta;
if ((style & SWT.WRAP) != 0) {
if (newValue < min) newValue = max;
if (newValue > max) newValue = min;
}
newValue = Math.min (Math.max (min, newValue), max);
if (value != newValue) setSelection (newValue, true, true, true);
}
String verifyText (String string, int start, int end) {
Event event = new Event ();
event.text = string;
event.start = start;
event.end = end;
if (string.length () == 1) {
event.character = string.charAt (0);
setInputState (event, SWT.KeyDown, 0, 0);
}
int index = 0;
if (digits > 0) {
String decimalSeparator = getDecimalSeparator ();
index = string.indexOf (decimalSeparator);
if (index != -1) {
string = string.substring (0, index) + string.substring (index + 1);
}
index = 0;
}
if (string.length() > 0) {
if (min < 0 && string.charAt (0) == '-') index++;
}
while (index < string.length ()) {
if (!Character.isDigit (string.charAt (index))) break;
index++;
}
event.doit = index == string.length ();
sendEvent (SWT.Verify, event);
if (!event.doit || isDisposed ()) return null;
return event.text;
}
}
| [
"375833274@qq.com"
] | 375833274@qq.com |
9ce2cce34e0c2df9a89f4e78a1be2588d16c4f15 | 684f50dd1ae58a766ce441d460214a4f7e693101 | /common/src/main/java/com/dimeng/p2p/S70/entities/T7019.java | cf521f7c37374a712edcb995e2ef8bed3dcbee2d | [] | no_license | wang-shun/rainiee-core | a0361255e3957dd58f653ae922088219738e0d25 | 80a96b2ed36e3460282e9e21d4f031cfbd198e69 | refs/heads/master | 2020-03-29T16:40:18.372561 | 2018-09-22T10:05:17 | 2018-09-22T10:05:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 650 | java | package com.dimeng.p2p.S70.entities;
import java.sql.Timestamp;
import com.dimeng.framework.service.AbstractEntity;
import com.dimeng.p2p.S70.enums.T7019_F07;
/**
* 邮件推广
*/
public class T7019 extends AbstractEntity {
private static final long serialVersionUID = 1L;
/**
* 邮件推广自增ID
*/
public int F01;
/**
* 标题
*/
public String F02;
/**
* 内容
*/
public String F03;
/**
* 接受人数
*/
public int F04;
/**
* 创建者,参考T7011.F01
*/
public int F05;
/**
* 创建时间
*/
public Timestamp F06;
/**
* 发送对象,SY:所有;ZDR:指定人
*/
public T7019_F07 F07;
}
| [
"humengmeng@rainiee.com"
] | humengmeng@rainiee.com |
5f1955e4504070956a95ba4fd6dcf7062be916f5 | dfd33b7f22e7ddc383f1066fcdf39ac3a6151cb0 | /src/main/java/com/albuquerque/springlin/models/listtransactions/FxInformation.java | aea0f5397ed6735e1f52060a58f9e61acc1a2df7 | [] | no_license | pedrophs2/spring-lin | 0a94465cd2db2070596f6c2958556ddda8649436 | d2b4b4fdeaea430dcf9e314236fe3f413867a277 | refs/heads/main | 2023-08-21T06:54:10.736180 | 2021-10-16T15:59:24 | 2021-10-16T15:59:24 | 417,109,154 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,277 | java | package com.albuquerque.springlin.models.listtransactions;
public class FxInformation {
private Integer originalAmount;
private String originalCurrency;
private Integer convertedAmount;
private String convertedCurrency;
public FxInformation() {
}
public FxInformation(Integer originalAmount, String originalCurrency, Integer convertedAmount,
String convertedCurrency) {
super();
this.originalAmount = originalAmount;
this.originalCurrency = originalCurrency;
this.convertedAmount = convertedAmount;
this.convertedCurrency = convertedCurrency;
}
public Integer getOriginalAmount() {
return originalAmount;
}
public void setOriginalAmount(Integer originalAmount) {
this.originalAmount = originalAmount;
}
public String getOriginalCurrency() {
return originalCurrency;
}
public void setOriginalCurrency(String originalCurrency) {
this.originalCurrency = originalCurrency;
}
public Integer getConvertedAmount() {
return convertedAmount;
}
public void setConvertedAmount(Integer convertedAmount) {
this.convertedAmount = convertedAmount;
}
public String getConvertedCurrency() {
return convertedCurrency;
}
public void setConvertedCurrency(String convertedCurrency) {
this.convertedCurrency = convertedCurrency;
}
}
| [
"38799159+pedrophs2@users.noreply.github.com"
] | 38799159+pedrophs2@users.noreply.github.com |
198ffbd901327711f2d0722b1c757a5cc5e859d6 | 8f6734d656f7b4448331012acd424f1e3d69d31c | /app/src/main/java/com/example/gymfit02/Adapter/BottomBarAdapter.java | 62d9de8bd971474ebb339799d1a9aa7ee9496f85 | [] | no_license | akindl/GymFit | e39d61473809dac6cad79f164e0e83d66aea3bbf | a456a03af5559b763efb572f70a24c8a02f7d78b | refs/heads/master | 2023-03-23T09:50:03.360497 | 2021-03-14T17:12:47 | 2021-03-14T17:12:47 | 303,108,457 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 760 | java | package com.example.gymfit02.Adapter;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import java.util.ArrayList;
import java.util.List;
public class BottomBarAdapter extends SmartFragmentStatePagerAdapter {
private final List<Fragment> fragments = new ArrayList<>();
public BottomBarAdapter(FragmentManager fragmentManager) {
super(fragmentManager);
}
// Our custom method that populates this Adapter with Fragments
public void addFragments(Fragment fragment) {
fragments.add(fragment);
}
@Override
public Fragment getItem(int position) {
return fragments.get(position);
}
@Override
public int getCount() {
return fragments.size();
}
}
| [
"akindl@students.uni-mainz.de"
] | akindl@students.uni-mainz.de |
d3f5e85398a20e8e4fd73d0cd6e6f517f87535f5 | c724704521b77a5533f48eb9f5480ac5aadc245e | /EurekaSingleFeignHystrix/eurekaclientdemo/src/main/java/com/study/eurekaclientdemo/TestController.java | f23997b2fc7e87efaf6eee521c6606e7b7e325a8 | [
"Apache-2.0"
] | permissive | rouletteChina/Learn | b4c33f59fef03ca5c6efad082d4353e10eeb3189 | 5ec4641cb29a8bfdc5dbe74ffc031b9b4f9fba99 | refs/heads/master | 2020-03-18T19:48:41.209768 | 2018-05-28T16:51:35 | 2018-05-28T16:51:35 | 135,178,978 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 478 | java | package com.study.eurekaclientdemo;
import com.study.eurekaclientdemo.feign.TestFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/")
public class TestController {
@Autowired
private TestFeignClient testFeignClient;
@GetMapping("/router/{id}")
public Police router(@PathVariable("id") Integer id) {
return testFeignClient.call(id);
}
}
| [
"75597151@qq.com"
] | 75597151@qq.com |
d816b3fcc346c05da319e1a8173a2d5da1baf06c | 7ad41276bcff8a34b8057c08f8a4944f888b4648 | /app/src/main/java/com/example/yala_mall/models/Category.java | ce3cf360cb0315435ca3120e48b6c6e9534a715c | [] | no_license | emadsamni/yala-mall | 46a9b6f563851fa303419f87a9ac69da37a53f89 | 507257c02e93d90d2789f30f08fd128b492a6759 | refs/heads/master | 2022-01-28T18:02:03.979326 | 2019-07-16T02:17:20 | 2019-07-16T02:17:20 | 186,168,303 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 680 | java | package com.example.yala_mall.models;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import java.util.List;
public class Category implements Serializable {
public Category(Integer id, String name) {
this.id = id;
this.name = name;
}
@SerializedName("id")
private
Integer id;
@SerializedName("name")
private
String name;
@SerializedName("p_category")
private
List<Category> p_category;
public Integer getId() {
return id;
}
public String getName() {
return name;
}
public List<Category> getP_category() {
return p_category;
}
}
| [
"emad1995211@gmail.com"
] | emad1995211@gmail.com |
011f6dc1735e2b59d2f16dd0107ad0b4bad995f6 | 5d24b31ae62cf40abbbce1490706c1fef070737e | /app/src/main/java/com/candyz/a7center/GameActivity.java | 30d784a87f05f2b68536a9c8d55f74b5d32f4495 | [] | no_license | ukri82/SevenCenter | 1e4662cb0f69930d7a44caf086fc29ef1cc4bb61 | 628e052375fad758c41d375326545646e1a7dc85 | refs/heads/master | 2021-05-04T05:51:04.544502 | 2016-11-05T12:15:42 | 2016-11-05T12:15:42 | 71,071,142 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,917 | java | package com.candyz.a7center;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.util.DisplayMetrics;
import com.candyz.a7center.manager.OptionsManager;
import com.candyz.a7center.manager.ResourcesManager;
import com.candyz.a7center.manager.SceneManager;
import org.andengine.engine.camera.BoundCamera;
import org.andengine.engine.camera.Camera;
import org.andengine.engine.handler.timer.ITimerCallback;
import org.andengine.engine.handler.timer.TimerHandler;
import org.andengine.engine.options.EngineOptions;
import org.andengine.engine.options.ScreenOrientation;
import org.andengine.engine.options.resolutionpolicy.FillResolutionPolicy;
import org.andengine.entity.scene.Scene;
import org.andengine.entity.scene.background.Background;
import org.andengine.ui.activity.SimpleBaseGameActivity;
import java.io.IOException;
public class GameActivity extends SimpleBaseGameActivity
{
private Camera camera;
private static int CAMERA_WIDTH = 800;
private static int CAMERA_HEIGHT = 480;
private ResourcesManager resourcesManager;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
int MyVersion = Build.VERSION.SDK_INT;
if (MyVersion > Build.VERSION_CODES.LOLLIPOP_MR1) {
if (!checkIfAlreadyhavePermission()) {
requestForSpecificPermission();
}
}
OptionsManager.getInstance().init(this);
if(OptionsManager.getInstance().get("player_name") == null)
{
this.startActivity(new Intent(this, BasicDetailsActivity.class));
}
}
@Override
protected void onCreateResources()
{
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
if (requestCode == 1)
{
// Make sure the request was successful
if (resultCode == RESULT_OK)
{
OptionsManager.getInstance().readOptions();
String diffLevelUpdated = data.getStringExtra("DIFF_LEVEL_UPDATED");
String numPlayersUpdated = data.getStringExtra("NUM_PLAYERS_UPDATED");
if(diffLevelUpdated.equals("true") || numPlayersUpdated.equals("true"))
{
SceneManager.getInstance().createGameScene(mEngine);
SceneManager.getInstance().setScene(SceneManager.SceneType.SCENE_GAME);
}
else
{
SceneManager.getInstance().getCurrentScene().updateScene();
}
}
}
}
private boolean checkIfAlreadyhavePermission() {
int result = ContextCompat.checkSelfPermission(this, Manifest.permission.VIBRATE);
if (result == PackageManager.PERMISSION_GRANTED) {
return true;
} else {
return false;
}
}
private void requestForSpecificPermission() {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.GET_ACCOUNTS, Manifest.permission.RECEIVE_SMS, Manifest.permission.READ_SMS, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE}, 101);
}
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
switch (requestCode) {
case 101:
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
resourcesManager.mHasVibratePermission = true;
//granted
} else {
//not granted
}
break;
default:
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
}
public void onCreateResources(OnCreateResourcesCallback pOnCreateResourcesCallback) throws IOException
{
ResourcesManager.prepareManager(mEngine, this, camera, getVertexBufferObjectManager());
resourcesManager = ResourcesManager.getInstance();
pOnCreateResourcesCallback.onCreateResourcesFinished();
resourcesManager.loadGameResources();
}
public void onPopulateScene(Scene pScene, OnPopulateSceneCallback pOnPopulateSceneCallback) throws IOException
{
/*mEngine.registerUpdateHandler(new TimerHandler(2f, new ITimerCallback()
{
public void onTimePassed(final TimerHandler pTimerHandler)
{
mEngine.unregisterUpdateHandler(pTimerHandler);
SceneManager.getInstance().createMenuScene();
}
}));*/
pOnPopulateSceneCallback.onPopulateSceneFinished();
}
@Override
protected Scene onCreateScene()
{
/*Scene scene = new Scene();
scene.setBackground(new Background(0.09804f, 0.6274f, 0.8784f));
return scene;*/
return SceneManager.getInstance().createGameScene(mEngine);
//return null;
}
@Override
public EngineOptions onCreateEngineOptions()
{
//camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
CAMERA_WIDTH = metrics.widthPixels;
CAMERA_HEIGHT = metrics.heightPixels;
camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED,
new FillResolutionPolicy(), camera);
return engineOptions;
}
@Override
protected void onDestroy()
{
super.onDestroy();
System.exit(0);
}
}
| [
"ukri82@outlook.com"
] | ukri82@outlook.com |
a0d95b3abbdb0a9b9ea60c81bef7d5453f295bcf | 3264972229db35cf833466da9ce7236bdd4e149e | /Magic_Server/src/Game/Server/Server.java | f01804c48d3a08ed5cc42a3653e653bc18a3772f | [] | no_license | TYTEKLUV/Magic_Maze | f556ad4b1a4b89eeed04998839590ea45a866948 | e4b51a3553b604a4bc43a3cc0024872c6d0d0d6a | refs/heads/master | 2020-04-04T23:33:55.079366 | 2019-01-12T03:55:35 | 2019-01-12T03:55:35 | 156,364,082 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,813 | java | package Game.Server;
import Game.Model.Player;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.Scanner;
public class Server extends Thread {
private OmegaServer main;
private int port;
private volatile ArrayList<Room> rooms = new ArrayList<>();
public Server(OmegaServer main, int port) {
this.port = port;
this.main = main;
}
@Override
public void run() {
try {
ServerSocket server = new ServerSocket(port);
while (!server.isClosed()) {
Socket client = server.accept();
connect(client);
}
} catch (IOException e) {
e.printStackTrace();
}
}
private void connect(Socket client) throws IOException {
String nickname;
String roomName;
DataInputStream in = new DataInputStream(client.getInputStream());
DataOutputStream out = new DataOutputStream(client.getOutputStream());
out.writeUTF("OMEGA_WELCOME");
Scanner command = new Scanner(in.readUTF());
if (command.next().equals("CONNECT")) {
nickname = command.next();
roomName = command.next();
if (roomName.equals("CREATE")) {
roomName = command.next();
Room room = new Room(roomName, command.nextInt());
rooms.add(room);
main.setCurrentRoom(room);
out.writeUTF("ACCEPT");
Player player = room.getFreeSlot();
player.setNickname(nickname);
room.changeLeader(player);
room.connectClient(client, player);
} else {
Room room = searchRoom(roomName);
if (room != null) {
Player player = room.getFreeSlot();
if (player != null) {
out.writeUTF("ACCEPT");
player.setNickname(nickname);
room.connectClient(client, player);
} else
out.writeUTF("BUSY");
} else
out.writeUTF("NOT_FOUND");
}
}
}
public void destroyRoom(Room room) throws IOException {
room.kickAll();
rooms.remove(room);
System.out.println("| Room " + room.getName() + " destroyed");
main.changeCurrentRoom(0);
}
private Room searchRoom(String roomName) {
for (Room room : rooms)
if (roomName.equals(room.getName()))
return room;
return null;
}
public ArrayList<Room> getRooms() {
return rooms;
}
} | [
"randomisbox@gmail.com"
] | randomisbox@gmail.com |
cc7cd8d19adba892020b3aa327db33e3f8fa3f5c | 6889f8f30f36928a2cd8ba880032c855ac1cc66c | /SemplestServiceMSNv8r3/src/com/microsoft/adcenter/v8/GenderReportFilterNull.java | 3e5f02837168b85607b3bd37e18eb2b95d5ae242 | [] | no_license | enterstudio/semplest2 | 77ceb4fe6d076f8c161d24b510048802cd029b67 | 44eeade468a78ef647c62deb4cec2bea4318b455 | refs/heads/master | 2022-12-28T18:35:54.723459 | 2012-11-20T15:39:09 | 2012-11-20T15:39:09 | 86,645,696 | 0 | 0 | null | 2020-10-14T08:14:22 | 2017-03-30T01:32:35 | Roff | UTF-8 | Java | false | false | 3,021 | java | /**
* GenderReportFilterNull.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.microsoft.adcenter.v8;
public class GenderReportFilterNull implements java.io.Serializable {
private java.lang.String _value_;
private static java.util.HashMap _table_ = new java.util.HashMap();
// Constructor
protected GenderReportFilterNull(java.lang.String value) {
_value_ = value;
_table_.put(_value_,this);
}
public static final java.lang.String _Unknown = "Unknown";
public static final java.lang.String _Male = "Male";
public static final java.lang.String _Female = "Female";
public static final GenderReportFilterNull Unknown = new GenderReportFilterNull(_Unknown);
public static final GenderReportFilterNull Male = new GenderReportFilterNull(_Male);
public static final GenderReportFilterNull Female = new GenderReportFilterNull(_Female);
public java.lang.String getValue() { return _value_;}
public static GenderReportFilterNull fromValue(java.lang.String value)
throws java.lang.IllegalArgumentException {
GenderReportFilterNull enumeration = (GenderReportFilterNull)
_table_.get(value);
if (enumeration==null) throw new java.lang.IllegalArgumentException();
return enumeration;
}
public static GenderReportFilterNull fromString(java.lang.String value)
throws java.lang.IllegalArgumentException {
return fromValue(value);
}
public boolean equals(java.lang.Object obj) {return (obj == this);}
public int hashCode() { return toString().hashCode();}
public java.lang.String toString() { return _value_;}
public java.lang.Object readResolve() throws java.io.ObjectStreamException { return fromValue(_value_);}
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.EnumSerializer(
_javaType, _xmlType);
}
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.EnumDeserializer(
_javaType, _xmlType);
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(GenderReportFilterNull.class);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("https://adcenter.microsoft.com/v8", "GenderReportFilter>null"));
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
}
| [
"mitch@02200ff9-b5b2-46f0-9171-221b09c08c7b"
] | mitch@02200ff9-b5b2-46f0-9171-221b09c08c7b |
217ed193a7700d6d0629b12360ee9b5a4b3e167e | 2d9957f2c7a6883004b1a801f97eab3b033d9c08 | /pulsar-client-api/src/main/java/org/apache/pulsar/client/api/ReaderInterceptor.java | 3a2e93d9c35adbb2241e5a69b8b00cc0d9cb8a5e | [
"Apache-2.0",
"LicenseRef-scancode-unknown",
"LicenseRef-scancode-protobuf"
] | permissive | apache/pulsar | ca729cfb8d2c031312d30096e13431b2e29fb9bf | 843b8307f44cd5e3a2d59ab93cc6b766f0c4ce0f | refs/heads/master | 2023-08-31T23:53:41.323458 | 2023-08-31T18:37:00 | 2023-08-31T18:37:00 | 62,117,812 | 11,865 | 3,546 | Apache-2.0 | 2023-09-14T12:13:23 | 2016-06-28T07:00:03 | Java | UTF-8 | Java | false | false | 2,205 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.pulsar.client.api;
import org.apache.pulsar.common.classification.InterfaceAudience;
import org.apache.pulsar.common.classification.InterfaceStability;
/**
* Reader interceptor.
* @param <T>
*/
@InterfaceAudience.Public
@InterfaceStability.Stable
public interface ReaderInterceptor<T> {
/**
* Close the interceptor.
*/
void close();
/**
* This is called just before the message is returned by
* {@link Reader#readNext()}, {@link ReaderListener#received(Reader, Message)}
* or the {@link java.util.concurrent.CompletableFuture} returned by
* {@link Reader#readNextAsync()} completes.
*
* This method is based on {@link ConsumerInterceptor#beforeConsume(Consumer, Message)},
* so it has the same features.
*
* @param reader the reader which contains the interceptor
* @param message the message to be read by the client.
* @return message that is either modified by the interceptor or same message
* passed into the method.
*/
Message<T> beforeRead(Reader<T> reader, Message<T> message);
/**
* This method is called when partitions of the topic (partitioned-topic) changes.
*
* @param topicName topic name
* @param partitions new updated number of partitions
*/
default void onPartitionsChange(String topicName, int partitions) {
}
}
| [
"noreply@github.com"
] | apache.noreply@github.com |
e6435fc1a86519fdedd7ce81f8ff76c5440d1184 | 9aaa2a6b931900c9cdabe6e124088a71eeeba439 | /manage-admin/src/main/java/xyz/yudong520/manageadmin/system/controller/async/MockQueue.java | 5593911b066b61a828b123fad1885c19ac5ceed0 | [] | no_license | YiFengJava/springBase | d1c0ec67ebf7f07f60722098cd37f560f5a98791 | 94574db7cb6e4b398ac9c991ec054a40d7af0641 | refs/heads/master | 2020-04-04T00:38:04.746854 | 2019-02-27T07:39:47 | 2019-02-27T07:39:47 | 155,656,956 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,050 | java | package xyz.yudong520.manageadmin.system.controller.async;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component
public class MockQueue {
private String placeOrder;
private String completeOrder;
private Logger logger= LoggerFactory.getLogger(MockQueue.class);
public String getPlaceOrder() {
return placeOrder;
}
public void setPlaceOrder(String placeOrder) throws InterruptedException {
new Thread(()->{
logger.info("接到下单请求,"+placeOrder);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
this.placeOrder = placeOrder;
logger.info("下单请求处理完成,"+placeOrder);
}).start();
}
public String getCompleteOrder() {
return completeOrder;
}
public void setCompleteOrder(String completeOrder) {
this.completeOrder = completeOrder;
}
}
| [
"2260213493@qq.com"
] | 2260213493@qq.com |
092310e1de42280e04cfbf46d904f6f30ec80db8 | b57641c357c78db0106d5e7a95a705fd80aaf4ff | /weaver-instrumentation/src/test/java/weaver/instrumentation/test/weaving/interfaces/SampleAnotherClass.java | c7f5495188266eaa8f97d4fb45853ea780d5edc3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | 2050utopia/Weaver | 5e9f71cd46b8c0d8a26532e16d52738fa4607564 | d7827e9cab5e21a80a49d5bf16a4efc6c226315a | refs/heads/master | 2020-12-02T07:57:35.163378 | 2017-06-11T09:00:29 | 2017-06-11T09:00:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 150 | java | package weaver.instrumentation.test.weaving.interfaces;
/**
* @author Saeed Masoumi (saeed@6thsolution.com)
*/
public class SampleAnotherClass {
}
| [
"s-masoumi@live.com"
] | s-masoumi@live.com |
f8eabc1b4f84e37d8efe1483c167f06712cafca7 | 29713395dad66d68fe8b05f2841b53108ec81f8a | /app/src/main/java/vn/doithe66/doithe66/activity/CreateNewPassActivity.java | 8f3313b5d56605f34f5580d1a0cf86147a227a88 | [] | no_license | doantb/doithe66 | 5db3b9cca158a03faba89e56d2253baa5d0b02be | 590d500f2a3e16586afe2a72caa24909eec15b44 | refs/heads/master | 2021-04-15T10:24:42.690161 | 2018-04-10T01:14:30 | 2018-04-10T01:14:30 | 126,316,707 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 9,210 | java | package vn.doithe66.doithe66.activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import vn.doithe66.doithe66.HomeActivity;
import vn.doithe66.doithe66.R;
import vn.doithe66.doithe66.Utils.Constant;
import vn.doithe66.doithe66.Utils.SharedPrefs;
import vn.doithe66.doithe66.Utils.Utils;
import vn.doithe66.doithe66.config.ConfigRetrofitApi;
import vn.doithe66.doithe66.config.InterfaceAPI;
import vn.doithe66.doithe66.model.RegisterMDResult;
import static vn.doithe66.doithe66.Utils.Constant.FULL_NAME;
import static vn.doithe66.doithe66.Utils.Constant.PASS_LV1;
import static vn.doithe66.doithe66.Utils.Constant.PASS_LV2;
/**
* Created by Windows 10 Now on 1/26/2018.
*/
public class CreateNewPassActivity extends BaseActivity {
@BindView(R.id.ab_img_button_back)
ImageButton mAbImgButtonBack;
@BindView(R.id.ab_txt_title_action_bar)
TextView mAbTxtTitleActionBar;
@BindView(R.id.ab_img_button_confirm)
ImageView mAbImgButtonConfirm;
@BindView(R.id.my_progess_bar)
RelativeLayout mMyProgessBar;
@BindView(R.id.edt_old_password_lv1)
EditText edtOldPasswordLv1;
@BindView(R.id.ll_enter_old_pass_lv1)
LinearLayout llEnterOldPassLv1;
private EditText edtNewPass;
private EditText edtOldPass;
private onHandleClickChecked mChecked;
private RegisterMDResult jsonResult;
private String token;
private LinearLayout llEnterOldPass;
private Button btnCreateAccoount;
private View view;
private String fromPass;
public void setChecked(onHandleClickChecked checked) {
mChecked = checked;
}
@Override
protected int getLayoutId() {
return R.layout.activity_create_new_pass;
}
@Override
protected void initView(Bundle savedInstanceState) {
ButterKnife.bind(this);
edtNewPass = findViewById(R.id.edt_new_password);
edtOldPass = findViewById(R.id.edt_old_password);
llEnterOldPass = findViewById(R.id.ll_enter_old_pass);
btnCreateAccoount = findViewById(R.id.btn_creatNewAccount);
}
@Override
protected void initVariables(Bundle savedInstanceState) {
mAbTxtTitleActionBar.setText("Tạo mật khẩu mới");
Intent intent = getIntent();
final String fullName = intent.getStringExtra(FULL_NAME);
fromPass = intent.getStringExtra(Constant.TYPE_PASS);
token = intent.getStringExtra(Constant.KEY_TOKEN);
if (fromPass.equalsIgnoreCase(PASS_LV2)) {
llEnterOldPassLv1.setVisibility(View.VISIBLE);
edtOldPass.setHint("Nhập mật khẩu cấp 2 cũ");
edtNewPass.setHint("Nhập mật khẩu cấp 2 mới");
}
if (intent.getIntExtra("key_acccess", 0) == 2) {
llEnterOldPass.setVisibility(View.GONE);
btnCreateAccoount.setVisibility(View.VISIBLE);
btnCreateAccoount.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
loginWithNewGmail(token, fullName, edtNewPass.getText().toString());
}
});
}
View view = this.getCurrentFocus();
if (view != null) {
InputMethodManager imm =
(InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
btnCreateAccoount.setOnClickListener(mOnProfileClickListener);
}
private View.OnClickListener mOnProfileClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
Utils.closeKeyboard(getApplicationContext(),edtNewPass.getWindowToken());
mMyProgessBar.setVisibility(View.VISIBLE);
if (edtNewPass.getText().toString().equals("")) {
Toast.makeText(CreateNewPassActivity.this, "Vui lòng nhập password",
Toast.LENGTH_SHORT).show();
} else {
Intent intent = getIntent();
if (intent != null) {
newPassRetrofit(edtOldPass.getText().toString(),
edtNewPass.getText().toString());
}
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO: add setContentView(...) invocation
}
@OnClick({R.id.ab_img_button_back, R.id.ab_img_button_confirm})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.ab_img_button_back:
super.onBackPressed();
break;
case R.id.ab_img_button_confirm:
finish();
break;
}
}
public interface onHandleClickChecked {
void onClickCheck(String oldPass, String newPass);
}
private void newPassRetrofit(String oldPass, String newPass) {
Retrofit retrofit = ConfigRetrofitApi.getInstance(token);
if (fromPass.equalsIgnoreCase(PASS_LV1)) {
retrofit.create(InterfaceAPI.class)
.createNewPassLv1(oldPass, newPass)
.enqueue(new Callback<RegisterMDResult>() {
@Override
public void onResponse(Call<RegisterMDResult> call,
Response<RegisterMDResult> response) {
jsonResult = response.body();
chooseRepCode(token);
}
@Override
public void onFailure(Call<RegisterMDResult> call, Throwable t) {
}
});
} else {
retrofit.create(InterfaceAPI.class)
.createNewPassLv2(edtOldPasswordLv1.getText().toString(), oldPass, newPass)
.enqueue(new Callback<RegisterMDResult>() {
@Override
public void onResponse(Call<RegisterMDResult> call,
Response<RegisterMDResult> response) {
jsonResult = response.body();
chooseRepCode(token);
}
@Override
public void onFailure(Call<RegisterMDResult> call, Throwable t) {
}
});
}
}
private void chooseRepCode(String token) {
switch (jsonResult.getRepcode()) {
case 0:
Toast.makeText(this, "Đổi mật khẩu thất bại", Toast.LENGTH_SHORT).show();
break;
case 1:
Toast.makeText(this, "Bạn đã thay đổi mật khẩu thành công", Toast.LENGTH_SHORT).show();
break;
case 2:
Toast.makeText(this, "Mật khẩu cũ không đúng", Toast.LENGTH_SHORT).show();
break;
case -1:
Toast.makeText(this, "Đăng nhập hết hạn", Toast.LENGTH_SHORT).show();
break;
}
mMyProgessBar.setVisibility(View.GONE);
}
private void loginWithNewGmail(final String token, String fullName, String passWord) {
Retrofit retrofit = ConfigRetrofitApi.getInstance();
//
// Log.d("token", token + "");
// Log.d("token", passWord + "");
// Log.d("token", fullName + "");
retrofit.create(InterfaceAPI.class)
.loginWithGoogle(token, fullName, passWord)
.enqueue(new Callback<RegisterMDResult>() {
@Override
public void onResponse(Call<RegisterMDResult> call,
Response<RegisterMDResult> response) {
jsonResult = response.body();
Toast.makeText(CreateNewPassActivity.this, jsonResult.getMessage() + "", Toast.LENGTH_SHORT).show();
saveAccessToken(jsonResult.getToken());
startActivity(HomeActivity.class);
}
@Override
public void onFailure(Call<RegisterMDResult> call, Throwable t) {
Toast.makeText(CreateNewPassActivity.this, "Lỗi hệ thống", Toast.LENGTH_SHORT).show();
}
});
}
private void saveAccessToken(String token) {
SharedPrefs.getInstance().put(Constant.ACCESS_TOKEN, token);
}
}
| [
"doantb95@gmail.com"
] | doantb95@gmail.com |
99873c06cb80997da25d1f6d55ae2e78d811afd3 | 77abdb107815da4560d4ffe7678f4c3384ba9205 | /src/application/dataViewObjects/shaders/DataViewObjectLambert.java | 5d1e0f3593787dae8e4e23f9d70d24ed1195f06c | [] | no_license | thewrightcoder/JavaRayTracerSample | b430852d310a63c7b84d30e43223c02be912423e | 823eaaee912b4b5d31f73c135e227a08f2d978df | refs/heads/master | 2021-01-25T09:21:33.162101 | 2017-06-12T00:53:37 | 2017-06-12T00:53:37 | 93,825,387 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 431 | java | package application.dataViewObjects.shaders;
import application.dataViewObjects.baseClasses.DataViewObjectColor;
import dataTypes.shaderDataTypes.LambertShader;
public class DataViewObjectLambert extends DataViewObjectShader {
private static final long serialVersionUID = 1L;
public DataViewObjectLambert(Object o) {
super(o);
LambertShader s = (LambertShader)o;
add(new DataViewObjectColor(s.getBaseColor()));
}
}
| [
"noreply@github.com"
] | thewrightcoder.noreply@github.com |
2190fb5b26d68d8a35ee8b99962dd68c885c72bc | e67c9352a6a26f1f74ea7049fb44cd4cb4945511 | /gridgain_wrapper/src/main/java/infordist/gg/CombinedComplexityJob.java | 4333f46d770cbdac7314bdea2cb9ac8618a9773a | [] | no_license | petrul/infordist | e1e0c8afdb391885bec188bca83e95b46b38db57 | e38c182c2def5cb6859564f7103b241519288189 | refs/heads/master | 2023-07-06T17:25:55.971386 | 2023-07-04T11:21:37 | 2023-07-04T11:21:37 | 4,136,467 | 0 | 0 | null | 2019-10-08T08:29:45 | 2012-04-25T12:54:50 | Java | UTF-8 | Java | false | false | 2,429 | java | package infordist.gg;
import inform.dist.Constants;
import inform.dist.nld.GistComplexity;
import inform.dist.nld.cache.AbstractFilesystemGistDirectory;
import inform.dist.nld.cache.FsBinaryGistDirectory;
import inform.dist.nld.cache.Gist;
import inform.dist.nld.compressor.Bzip2Compressor;
import java.io.File;
import java.io.Serializable;
import java.util.concurrent.Callable;
import org.apache.commons.lang.time.StopWatch;
import org.apache.log4j.Logger;
public class CombinedComplexityJob implements Callable<CombinedComplexityJobResult>, Serializable {
private static final long serialVersionUID = 1L;
File cacheDir;
String mainTerm;
String[] termsToCompare;
public CombinedComplexityJob(File cacheDir, String mainTerm, String[] termsToCompare) {
this.cacheDir = cacheDir;
this.mainTerm = mainTerm;
this.termsToCompare = termsToCompare;
}
@Override
public CombinedComplexityJobResult call() {
LOG.info("calculating combined complexity of " + this.mainTerm + " to " + this.termsToCompare.length + " comparison terms...");
StopWatch watch = new StopWatch(); watch.start();
int[] results = new int[termsToCompare.length];
for (int i = 0; i < termsToCompare.length; i++) {
results[i] = Constants.MATRIX_CELL_UNINITIALIZED;
}
try {
Bzip2Compressor bzip2 = new Bzip2Compressor();
AbstractFilesystemGistDirectory cache = new FsBinaryGistDirectory(cacheDir, bzip2);
GistComplexity gc = new GistComplexity(cacheDir, bzip2);
String term1 = this.mainTerm;
Gist gist1 = cache.getGist(term1);
if (gist1 == null)
throw new IllegalArgumentException("cannot find binary gist for main term [" + term1 + "]");
for (int i = 0; i < this.termsToCompare.length; i++) {
String term2 = this.termsToCompare[i];
Gist gist2 = cache.getGist(term2);
if (gist2 == null) {
LOG.warn("cannot find binary gist for term [" + term2 + "], will skip...");
continue;
}
long cc = gc.calculateGistCombinedComplexity(gist1, gist2);
LOG.info("C(" + term1 + ", " + term2 + ") = " + cc);
results[i] = (int) cc;
}
LOG.info("done [" + this.mainTerm + "], " + this.termsToCompare.length + " terms compared, took " + watch);
return new CombinedComplexityJobResult(this.mainTerm, this.termsToCompare, results);
} catch (RuntimeException e) {
throw e;
}
}
static Logger LOG = Logger.getLogger(CombinedComplexityJob.class);
}
| [
"petru.dimulescu@gmail.com"
] | petru.dimulescu@gmail.com |
20fe94f06142b1f706ad084fac135b49922579ba | 338f0757efc3c92b3bb5cae004c245a06a4fa25f | /application/swing/SaveImageMenu.java | 0f20e17e8fe9fddc72c718a9eebca7f83ac96b16 | [] | no_license | davidbrowncs/Fractal-Viewer | 31619b8d6b6fa2e4f6622eb4ecc41bb4424d8a16 | 86d451ef67e879ab8dbdd003de9b5f1fb77628ba | refs/heads/master | 2021-01-10T12:49:52.889122 | 2015-12-20T17:53:54 | 2015-12-20T17:53:54 | 48,313,928 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,233 | java |
package swing;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.File;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.List;
import java.util.regex.Pattern;
import javax.imageio.ImageIO;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFileChooser;
import javax.swing.JFormattedTextField;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.border.EmptyBorder;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.text.NumberFormatter;
import math.FractalCalculator;
import net.miginfocom.swing.MigLayout;
public class SaveImageMenu extends JFrame {
private static final long serialVersionUID = 6912621256386165914L;
private JPanel contentPane;
private JFormattedTextField textField;
private JFormattedTextField textField_1;
JFormattedTextField realMinTextField;
JFormattedTextField realMaxTextField;
JFormattedTextField imaginaryMinTextField;
JFormattedTextField imaginaryMaxTextField;
private String[] options = { "16:9", "16:10", "4:3" };
private float[] ratios = { 16 / 9, 16 / 10, 4 / 3 };
private int selectedRatio = 0;
public SaveImageMenu(List<FractalDrawer> drawers) {
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(new MigLayout("", "[grow][grow]", "[][][][][][][][][][grow,top]"));
setType(JFrame.Type.UTILITY);
setUndecorated(true);
JLabel lblWidthOfImage = new JLabel("Width of image (pixels): ");
contentPane.add(lblWidthOfImage, "cell 0 0,alignx trailing");
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
NumberFormat f = NumberFormat.getIntegerInstance();
NumberFormatter form = new NumberFormatter(f);
form.setValueClass(Integer.class);
form.setMinimum(1);
f.setGroupingUsed(false);
textField = new JFormattedTextField(form);
textField.setText(Integer.toString((int) screenSize.getWidth()));
contentPane.add(textField, "cell 1 0,growx");
textField.setColumns(10);
JLabel lblHeightOfImage = new JLabel("Height of image (pixels): ");
contentPane.add(lblHeightOfImage, "cell 0 1,alignx trailing");
textField_1 = new JFormattedTextField(form);
textField_1.setText(Integer.toString((int) screenSize.getHeight()));
contentPane.add(textField_1, "cell 1 1,growx");
textField_1.setColumns(10);
JCheckBox chckbxPreserveAspectRatio = new JCheckBox("Preserve Aspect Ratio?");
contentPane.add(chckbxPreserveAspectRatio, "cell 0 2");
JComboBox<String> comboBox = new JComboBox<String>(options);
// JComboBox<String> comboBox = new JComboBox<String>();
comboBox.setSelectedIndex(selectedRatio);
contentPane.add(comboBox, "cell 1 2,growx");
JLabel lblRealMinimum = new JLabel("Real minimum: ");
contentPane.add(lblRealMinimum, "cell 0 3,alignx trailing");
DecimalFormat df = new DecimalFormat("#.####");
realMinTextField = new JFormattedTextField();
realMinTextField.setText(df.format(drawers.get(0).getFractalCalculator().getXMin()));
contentPane.add(realMinTextField, "cell 1 3,growx");
JLabel lblRealMaximum = new JLabel("Real maximum: ");
contentPane.add(lblRealMaximum, "cell 0 4,alignx trailing");
realMaxTextField = new JFormattedTextField();
realMaxTextField.setText(df.format(drawers.get(0).getFractalCalculator().getXMax()));
contentPane.add(realMaxTextField, "cell 1 4,growx");
JLabel lblImaginaryMinimum = new JLabel("Imaginary minimum: ");
contentPane.add(lblImaginaryMinimum, "cell 0 5,alignx trailing");
imaginaryMinTextField = new JFormattedTextField();
imaginaryMinTextField.setText(df.format(drawers.get(0).getFractalCalculator().getYMin()));
contentPane.add(imaginaryMinTextField, "cell 1 5,growx");
JLabel lblImaginaryMaximum = new JLabel("Imaginary maximum: ");
contentPane.add(lblImaginaryMaximum, "cell 0 6,alignx trailing");
imaginaryMaxTextField = new JFormattedTextField();
imaginaryMaxTextField.setText(df.format(drawers.get(0).getFractalCalculator().getYMax()));
contentPane.add(imaginaryMaxTextField, "cell 1 6,growx");
JRadioButton rdbtnFractalPanel = new JRadioButton("Fractal Panel");
contentPane.add(rdbtnFractalPanel, "cell 0 7 2 1,alignx center");
JRadioButton rdbtnJuliaPanel = new JRadioButton("Julia Panel");
contentPane.add(rdbtnJuliaPanel, "cell 0 8 2 1,alignx center");
ButtonGroup group = new ButtonGroup();
group.add(rdbtnFractalPanel);
group.add(rdbtnJuliaPanel);
rdbtnFractalPanel.setSelected(true);
JButton btnSaveImage = new JButton("Save Image");
btnSaveImage.addActionListener(e -> {
saveImage(drawers, rdbtnFractalPanel.isSelected());
});
contentPane.add(btnSaveImage, "cell 0 9,alignx right");
JButton btnExit = new JButton("Exit");
btnExit.addActionListener(e -> {
this.dispose();
});
contentPane.add(btnExit, "cell 1 9");
pack();
setLocationRelativeTo(null);
setVisible(true);
}
private void saveImage(List<FractalDrawer> drawers, boolean fractalPanelSelected) {
int w = 0;
int h = 0;
try {
w = Integer.parseInt(textField.getText());
h = Integer.parseInt(textField_1.getText());
} catch (Exception e1) {
JOptionPane.showMessageDialog(this, "Width or height not a valid number");
return;
}
if (w < 1 || h < 1) {
JOptionPane.showMessageDialog(this, "Width and height must be greater or equal to 1");
return;
}
double xMin;
double xMax;
double yMin;
double yMax;
try {
xMin = Double.parseDouble(realMinTextField.getText());
xMax = Double.parseDouble(realMaxTextField.getText());
yMin = Double.parseDouble(imaginaryMinTextField.getText());
yMax = Double.parseDouble(imaginaryMaxTextField.getText());
} catch (NumberFormatException e) {
JOptionPane.showMessageDialog(this, "Real/Imaginary fields must be valid");
return;
}
final int width = w;
final int height = h;
JFileChooser chooser = new JFileChooser();
FileNameExtensionFilter filter = new FileNameExtensionFilter("Image files (.jpg, .jpeg, .png)", "jpg", "jpeg", "png");
chooser.setFileFilter(filter);
final FractalDrawer drawer = fractalPanelSelected ? drawers.get(0) : drawers.get(1);
int result = chooser.showSaveDialog(this);
if (result == JFileChooser.APPROVE_OPTION) {
System.out.println("Writing file");
File file = chooser.getSelectedFile();
FractalCalculator c = drawer.getFractalCalculator().clone();
new Thread(() -> {
BufferedImage img = drawer.getImage(c, width, height, xMin, xMax, yMin, yMax);
System.out.println("image null : " + img == null);
String fileName = file.toString();
String pattern = "((^|, )(\\.png|\\.jpg|\\.jpeg))";
if (!Pattern.compile(pattern).matcher(fileName).find()) {
if (Pattern.compile("\\..*").matcher(fileName).find()) {
JOptionPane.showMessageDialog(this, "Wrong file type");
saveImage(drawers, fractalPanelSelected);
return;
} else {
fileName += ".png";
}
}
File newFile = new File(fileName);
if (newFile.exists()) {
int choice = JOptionPane.showConfirmDialog(this, "That file already exists, overwrite it?",
"Confirmation", JOptionPane.YES_NO_OPTION);
if (choice != JOptionPane.YES_OPTION) {
if (choice == JOptionPane.NO_OPTION) {
saveImage(drawers, fractalPanelSelected);
return;
} else {
return;
}
}
}
System.out.println("File to write to: " + newFile);
String type = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length()).toUpperCase();
System.out.println("Type: " + type);
try {
System.out.println("Image written successfully " + ImageIO.write(img, type, newFile));
} catch (Exception e1) {
e1.printStackTrace();
}
}).start();
this.dispose();
}
}
private float getRatio(String selected) {
for (int i = 0; i < ratios.length; i++) {
if (options[i].equals(selected)) {
return ratios[i];
}
}
return -1f;
}
}
| [
"db7g12@soton.ac.uk"
] | db7g12@soton.ac.uk |
ee66b06ac09706417ce8286a39be9b7288302b05 | 2d659692d2b5992f2d17ddbd38a6c415f0376a69 | /app/src/main/java/com/example/ekathapro/Adaptermemapproval.java | 1dbcd58e99dfeeb90d0400a844d3342abe0ec397 | [] | no_license | Athulpreman/ekatha | 814b7a4d49fcb6093d98c27ca68075e4ce2a6927 | 8c615823334612adb012b892db2a5f7121ebf5f5 | refs/heads/master | 2021-04-21T21:38:34.795642 | 2020-03-26T09:31:13 | 2020-03-26T09:31:13 | 249,817,683 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,898 | java | package com.example.ekathapro;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;
import java.util.ArrayList;
public class Adaptermemapproval extends RecyclerView.Adapter<Adaptermemapproval.MembViewHolder>
{
private ValueEventListener mCtx;
private ArrayList<Memb> memb;
Context context;
DatabaseReference reference,reference2;
Adaptermemapproval(Context context, ArrayList<Memb> itemList)
{
this.context = context;
memb= itemList;
}
@NonNull
@Override
public MembViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType)
{
LayoutInflater layoutInflater=LayoutInflater.from((Context) context);
View view=layoutInflater.inflate(R.layout.memberrequestcardview,null);
return new MembViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull MembViewHolder holder, final int position)
{
holder.t1.setText(memb.get(position).getMunitnum());
holder.t3.setText(memb.get(position).getMuser());
holder.t4.setText(memb.get(position).getMplace());
holder.t5.setText(memb.get(position).getMward());
holder.t6.setText(memb.get(position).getMmobile());
reference= FirebaseDatabase.getInstance().getReference().child(memb.get(position).getMward()).child(memb.get(position).getMunitnum());
holder.button.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
reference2=FirebaseDatabase.getInstance().getReference().child(memb.get(position).getMward()).child(memb.get(position).getMunitnum()).child("Member");
Query query=reference2.orderByChild("mmobile").equalTo(memb.get(position).getMmobile());
query.addListenerForSingleValueEvent(new ValueEventListener()
{
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot)
{
for (DataSnapshot snapshot:dataSnapshot.getChildren())
{
snapshot.getRef().child("status").setValue(true);
Toast.makeText(context, memb.get(position).getMunitnum()+" Has accepted", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError)
{
Toast.makeText(context, "Error....!", Toast.LENGTH_SHORT).show();
}
});
}
});
}
@Override
public int getItemCount()
{
return memb.size();
}
class MembViewHolder extends RecyclerView.ViewHolder
{
TextView t1,t3,t4,t5,t6;
Button button;
public MembViewHolder(@NonNull View memView) {
super(memView);
t1=(TextView)memView.findViewById(R.id.unitno);
t3=(TextView)memView.findViewById(R.id.username);
t4=(TextView)memView.findViewById(R.id.plce);
t5=(TextView)memView.findViewById(R.id.ward);
t6=(TextView)memView.findViewById(R.id.mob);
button=(Button)memView.findViewById(R.id.appro);
}
}
}
| [
"athulpreman9562473440@gmail.com"
] | athulpreman9562473440@gmail.com |
9ff5728f89182af4fcce4ccfb36829104429ae15 | b21b6af105039f65f3af2b49a7a16fe00eba3d16 | /app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/android/support/compat/R.java | 4fc8372afb023bf65b7631005acccaeec5d0d462 | [] | no_license | andy010725/BaldFaDaMoney | b3ea4fb9924681affe192989e13477e206c9c13b | c6b1184a56891c50193af8f600dc409f6986561c | refs/heads/master | 2020-06-03T22:50:44.240674 | 2019-06-13T13:13:44 | 2019-06-13T13:13:44 | 191,763,885 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,636 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package android.support.compat;
public final class R {
private R() {}
public static final class attr {
private attr() {}
public static final int alpha = 0x7f020027;
public static final int font = 0x7f02007a;
public static final int fontProviderAuthority = 0x7f02007c;
public static final int fontProviderCerts = 0x7f02007d;
public static final int fontProviderFetchStrategy = 0x7f02007e;
public static final int fontProviderFetchTimeout = 0x7f02007f;
public static final int fontProviderPackage = 0x7f020080;
public static final int fontProviderQuery = 0x7f020081;
public static final int fontStyle = 0x7f020082;
public static final int fontVariationSettings = 0x7f020083;
public static final int fontWeight = 0x7f020084;
public static final int ttcIndex = 0x7f02013c;
}
public static final class color {
private color() {}
public static final int notification_action_color_filter = 0x7f04003f;
public static final int notification_icon_bg_color = 0x7f040040;
public static final int ripple_material_light = 0x7f04004b;
public static final int secondary_text_default_material_light = 0x7f04004d;
}
public static final class dimen {
private dimen() {}
public static final int compat_button_inset_horizontal_material = 0x7f05004b;
public static final int compat_button_inset_vertical_material = 0x7f05004c;
public static final int compat_button_padding_horizontal_material = 0x7f05004d;
public static final int compat_button_padding_vertical_material = 0x7f05004e;
public static final int compat_control_corner_material = 0x7f05004f;
public static final int compat_notification_large_icon_max_height = 0x7f050050;
public static final int compat_notification_large_icon_max_width = 0x7f050051;
public static final int notification_action_icon_size = 0x7f05005b;
public static final int notification_action_text_size = 0x7f05005c;
public static final int notification_big_circle_margin = 0x7f05005d;
public static final int notification_content_margin_start = 0x7f05005e;
public static final int notification_large_icon_height = 0x7f05005f;
public static final int notification_large_icon_width = 0x7f050060;
public static final int notification_main_column_padding_top = 0x7f050061;
public static final int notification_media_narrow_margin = 0x7f050062;
public static final int notification_right_icon_size = 0x7f050063;
public static final int notification_right_side_padding_top = 0x7f050064;
public static final int notification_small_icon_background_padding = 0x7f050065;
public static final int notification_small_icon_size_as_large = 0x7f050066;
public static final int notification_subtext_size = 0x7f050067;
public static final int notification_top_pad = 0x7f050068;
public static final int notification_top_pad_large_text = 0x7f050069;
}
public static final class drawable {
private drawable() {}
public static final int notification_action_background = 0x7f06005a;
public static final int notification_bg = 0x7f06005b;
public static final int notification_bg_low = 0x7f06005c;
public static final int notification_bg_low_normal = 0x7f06005d;
public static final int notification_bg_low_pressed = 0x7f06005e;
public static final int notification_bg_normal = 0x7f06005f;
public static final int notification_bg_normal_pressed = 0x7f060060;
public static final int notification_icon_background = 0x7f060061;
public static final int notification_template_icon_bg = 0x7f060062;
public static final int notification_template_icon_low_bg = 0x7f060063;
public static final int notification_tile_bg = 0x7f060064;
public static final int notify_panel_notification_icon_bg = 0x7f060065;
}
public static final class id {
private id() {}
public static final int action_container = 0x7f07000e;
public static final int action_divider = 0x7f070010;
public static final int action_image = 0x7f070011;
public static final int action_text = 0x7f070017;
public static final int actions = 0x7f070018;
public static final int async = 0x7f07001e;
public static final int blocking = 0x7f070021;
public static final int chronometer = 0x7f070032;
public static final int forever = 0x7f070047;
public static final int icon = 0x7f07004e;
public static final int icon_group = 0x7f07004f;
public static final int info = 0x7f070053;
public static final int italic = 0x7f070055;
public static final int line1 = 0x7f070057;
public static final int line3 = 0x7f070058;
public static final int normal = 0x7f070061;
public static final int notification_background = 0x7f070062;
public static final int notification_main_column = 0x7f070063;
public static final int notification_main_column_container = 0x7f070064;
public static final int right_icon = 0x7f07006d;
public static final int right_side = 0x7f07006e;
public static final int tag_transition_group = 0x7f070091;
public static final int tag_unhandled_key_event_manager = 0x7f070092;
public static final int tag_unhandled_key_listeners = 0x7f070093;
public static final int text = 0x7f070094;
public static final int text2 = 0x7f070095;
public static final int time = 0x7f070099;
public static final int title = 0x7f07009a;
}
public static final class integer {
private integer() {}
public static final int status_bar_notification_info_maxnum = 0x7f080004;
}
public static final class layout {
private layout() {}
public static final int notification_action = 0x7f09001e;
public static final int notification_action_tombstone = 0x7f09001f;
public static final int notification_template_custom_big = 0x7f090026;
public static final int notification_template_icon_group = 0x7f090027;
public static final int notification_template_part_chronometer = 0x7f09002b;
public static final int notification_template_part_time = 0x7f09002c;
}
public static final class string {
private string() {}
public static final int status_bar_notification_info_overflow = 0x7f0b002a;
}
public static final class style {
private style() {}
public static final int TextAppearance_Compat_Notification = 0x7f0c00ec;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0c00ed;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0c00ef;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0c00f2;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0c00f4;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0c015d;
public static final int Widget_Compat_NotificationActionText = 0x7f0c015e;
}
public static final class styleable {
private styleable() {}
public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f020027 };
public static final int ColorStateListItem_android_color = 0;
public static final int ColorStateListItem_android_alpha = 1;
public static final int ColorStateListItem_alpha = 2;
public static final int[] FontFamily = { 0x7f02007c, 0x7f02007d, 0x7f02007e, 0x7f02007f, 0x7f020080, 0x7f020081 };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderCerts = 1;
public static final int FontFamily_fontProviderFetchStrategy = 2;
public static final int FontFamily_fontProviderFetchTimeout = 3;
public static final int FontFamily_fontProviderPackage = 4;
public static final int FontFamily_fontProviderQuery = 5;
public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f02007a, 0x7f020082, 0x7f020083, 0x7f020084, 0x7f02013c };
public static final int FontFamilyFont_android_font = 0;
public static final int FontFamilyFont_android_fontWeight = 1;
public static final int FontFamilyFont_android_fontStyle = 2;
public static final int FontFamilyFont_android_ttcIndex = 3;
public static final int FontFamilyFont_android_fontVariationSettings = 4;
public static final int FontFamilyFont_font = 5;
public static final int FontFamilyFont_fontStyle = 6;
public static final int FontFamilyFont_fontVariationSettings = 7;
public static final int FontFamilyFont_fontWeight = 8;
public static final int FontFamilyFont_ttcIndex = 9;
public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 };
public static final int GradientColor_android_startColor = 0;
public static final int GradientColor_android_endColor = 1;
public static final int GradientColor_android_type = 2;
public static final int GradientColor_android_centerX = 3;
public static final int GradientColor_android_centerY = 4;
public static final int GradientColor_android_gradientRadius = 5;
public static final int GradientColor_android_tileMode = 6;
public static final int GradientColor_android_centerColor = 7;
public static final int GradientColor_android_startX = 8;
public static final int GradientColor_android_startY = 9;
public static final int GradientColor_android_endX = 10;
public static final int GradientColor_android_endY = 11;
public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 };
public static final int GradientColorItem_android_color = 0;
public static final int GradientColorItem_android_offset = 1;
}
}
| [
"noreply@github.com"
] | andy010725.noreply@github.com |
d70d781a4d658d1b540022f94265282ae0f83d55 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/4/4_81e03cea07ae59df120270f1eb078a02f5429510/BaseAction/4_81e03cea07ae59df120270f1eb078a02f5429510_BaseAction_t.java | 4a3c0383c65d6fea600d90bcc7bfb8fb9910ce68 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 2,669 | java | package krasa.mavenrun.analyzer.action;
import org.jetbrains.idea.maven.dom.model.MavenDomProjectModel;
import org.jetbrains.idea.maven.dom.model.MavenDomShortArtifactCoordinates;
import org.jetbrains.idea.maven.model.MavenArtifact;
import org.jetbrains.idea.maven.model.MavenArtifactNode;
import org.jetbrains.idea.maven.project.MavenProject;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
import com.intellij.psi.xml.XmlFile;
import com.intellij.util.xml.DomFileElement;
import com.intellij.util.xml.DomManager;
import com.intellij.util.xml.GenericDomValue;
/**
* @author Vojtech Krasa
*/
public abstract class BaseAction extends DumbAwareAction {
public static final String MAVEN_HELPER_DEPENDENCY_ANALYZER_NOTIFICATION = "Maven Helper - Dependency Analyzer - notification";
protected final Project project;
protected final MavenProject mavenProject;
protected final MavenArtifactNode mavenArtifactNode;
public BaseAction(Project project, MavenProject mavenProject, MavenArtifactNode myTreeNode, final String text) {
super(text);
this.project = project;
this.mavenProject = mavenProject;
mavenArtifactNode = myTreeNode;
}
protected MavenArtifact getParentMavenArtifact() {
MavenArtifactNode oldestParent = mavenArtifactNode.getParent();
if (oldestParent == null) {
return mavenArtifactNode.getArtifact();
}
MavenArtifactNode parentNode = oldestParent.getParent();
while (parentNode != null) {
oldestParent = parentNode;
parentNode = oldestParent.getParent();
}
return oldestParent.getArtifact();
}
protected DomFileElement getDomFileElement() {
final XmlFile xmlFile = getXmlFile();
return DomManager.getDomManager(project).getFileElement(xmlFile, MavenDomProjectModel.class);
}
protected XmlFile getXmlFile() {
PsiFile psiFile = PsiManager.getInstance(project).findFile(mavenProject.getFile());
return (XmlFile) psiFile;
}
protected boolean isSameDependency(MavenArtifact parent, MavenDomShortArtifactCoordinates mavenDomDependency) {
GenericDomValue artifactID = mavenDomDependency.getArtifactId();
GenericDomValue<String> groupId = mavenDomDependency.getGroupId();
return isSameDependency(parent, artifactID, groupId);
}
protected boolean isSameDependency(MavenArtifact parent, GenericDomValue artifactID, GenericDomValue<String> groupId) {
return artifactID != null && groupId != null && parent.getArtifactId().equals(artifactID.getValue())
&& parent.getGroupId().equals(groupId.getValue());
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
4a9318647aeec8190a83e5c2eeb8b57925aafb74 | 00cab1c5de5d94849b2c6b3441e72dfc59c7f357 | /Exercise Spring Data Intro/userSystem/src/main/java/softuni/userssystem/services/AlbumService.java | eee7f9b4edfb7f6ac53605dbadd96f98e340dd63 | [] | no_license | YankoMarkov/Hibernate-Spring-Data | 2466e9f1d9eb4ab377582befba8cd6fe760bc94b | 62297cc0c591a8007690cc683006339761c5e1ef | refs/heads/master | 2020-04-04T10:44:28.520339 | 2018-12-13T18:10:42 | 2018-12-13T18:10:42 | 155,863,379 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 74 | java | package softuni.userssystem.services;
public interface AlbumService {
}
| [
"yanko@markov.eu"
] | yanko@markov.eu |
7cdb58495469fb523eb8aa3ffc828548b9cac0bd | b197739ececfabe7d0e83a1cec04cca8300ebd78 | /App3/src/main/java/com/example/app3/NJCTLClass.java | 0bdec9169c89320f7c6faea468b030f66a9d9ab6 | [] | no_license | cosmc/njctl_teaching_app | bfc9805473bc4d57326cc7cd5bea832607413cbd | 83d5250beff0542678210f91afc39a37ebfea8e5 | refs/heads/master | 2021-01-22T11:31:54.688320 | 2013-11-16T21:59:21 | 2013-11-16T21:59:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 218 | java | package com.example.app3;
/**
* Created by ying on 11/3/13.
*/
public class NJCTLClass {
private int classId;
public String className;
public NJCTLClass(String name) {
className = name;
}
}
| [
"ying.quan.tan@gmail.com"
] | ying.quan.tan@gmail.com |
66cada4ebdb5bafba5f85d9b621adadc1905b4a0 | e7ee659e06a614c59a0145858f7e84e351f8545c | /src/main/java/com/penglecode/common/support/KetamaNodeLocator.java | e994aa33e2e3f2ee56e2817a8276d7e14d23a355 | [] | no_license | dsczs/commons | b4e31d1035285b9df86017a6cfc573ada1966dc7 | 8a3dab2bccdfb0870dbcf2964caa80120eaadc52 | refs/heads/master | 2021-01-21T10:20:00.041204 | 2015-06-14T12:44:16 | 2015-06-14T12:44:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,265 | java | package com.penglecode.common.support;
import java.util.List;
import java.util.SortedMap;
import java.util.TreeMap;
public class KetamaNodeLocator implements NodeLocator {
public static final int DEFAULT_VIRTUAL_NODES = 160;
private HashAlgorithm hashAlg = HashAlgorithm.KETAMA_HASH;
private int virtualNodes = DEFAULT_VIRTUAL_NODES;
private volatile TreeMap<Long,Node> ketamaNodes;
public KetamaNodeLocator() {
super();
}
public KetamaNodeLocator(List<Node> nodeList) {
super();
refreshLocator(nodeList);
}
public KetamaNodeLocator(int virtualNodes) {
super();
this.virtualNodes = virtualNodes;
}
public KetamaNodeLocator(int virtualNodes, List<Node> nodeList) {
super();
this.virtualNodes = virtualNodes;
refreshLocator(nodeList);
}
public Node getNodeByKey(final String key) {
if(key == null || ketamaNodes == null || ketamaNodes.isEmpty()){
return null;
}
long hash = hashAlg.hash(key);
return getNodeByHash(hash);
}
protected Node getNodeByHash(long hash) {
TreeMap<Long,Node> ketamaNodes = this.ketamaNodes;
if(ketamaNodes == null || ketamaNodes.isEmpty()) {
return null;
}
Long key = hash;
if (!ketamaNodes.containsKey(hash)) {
SortedMap<Long,Node> tailMap = ketamaNodes.tailMap(hash);
if(tailMap.isEmpty()) {
key=ketamaNodes.firstKey();
} else {
key=tailMap.firstKey();
}
//For JDK1.6 version
/*key = ketamaNodes.ceilingKey(key);
if (key == null) {
key = ketamaNodes.firstKey();
}*/
}
return ketamaNodes.get(key);
}
public void refreshLocator(final List<Node> nodeList) {
TreeMap<Long,Node> ketamaNodes = new TreeMap<Long,Node>();
if(nodeList != null && !nodeList.isEmpty()){
for (Node node : nodeList) {
for (int i = 0; i < virtualNodes / 4; i++) {
byte[] digest = HashAlgorithm.computeMd5(node.getNodeId() + "-" + i);
for (int h = 0; h < 4; h++) {
long k = (long) (digest[3 + h * 4] & 0xFF) << 24
| (long) (digest[2 + h * 4] & 0xFF) << 16
| (long) (digest[1 + h * 4] & 0xFF) << 8
| digest[h * 4] & 0xFF;
ketamaNodes.put(k, node);
}
}
}
}
this.ketamaNodes = ketamaNodes;
}
}
| [
"pengpeng.prox@gmail.com"
] | pengpeng.prox@gmail.com |
ab5e6fa09d93e9d5cc1511fb016ff8cc1246e651 | 9ae0b9a0f283a1953cd46cbaf1cc5160f896ad8b | /src/main/java/concurrent/Workable.java | 5a925df7da2da8caf1f10a48ca645b281f637ea5 | [] | no_license | dangshanli/on-java-8-maven-biuld | ec1f8ad51a37b8ea6fcb4ade4edeeaa779d17817 | 45db57dd3e434334249875595c32306a09f704a6 | refs/heads/master | 2023-04-16T13:23:11.877085 | 2021-04-17T06:03:07 | 2021-04-17T06:03:07 | 358,287,030 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 868 | java | package concurrent;// concurrent/Workable.java
// (c)2021 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information.
import java.util.concurrent.*;
import onjava.Nap;
public class Workable {
String id;
final double duration;
public Workable(String id, double duration) {
this.id = id;
this.duration = duration;
}
@Override public String toString() {
return "Workable[" + id + "]";
}
public static Workable work(Workable tt) {
new Nap(tt.duration); // Seconds
tt.id = tt.id + "W";
System.out.println(tt);
return tt;
}
public static CompletableFuture<Workable>
make(String id, double duration) {
return
CompletableFuture.completedFuture(
new Workable(id, duration))
.thenApplyAsync(Workable::work);
}
}
| [
"1414377646@qq.com"
] | 1414377646@qq.com |
a4f6560289443964aaa4db37d78fe07ec4e8a527 | 8782061b1e1223488a090f9f3f3b8dfe489e054a | /storeMongoDB/projects/ABCD/aospX_platform_packages_apps_Settings/test/0Test.java | e585234ead2221ca906f1d8375f982d531a5b38b | [] | no_license | ryosuke-ku/TCS_init | 3cb79a46aa217e62d8fff13d600f2a9583df986c | e1207d68bdc9d2f1eed63ef44a672b5a37b45633 | refs/heads/master | 2020-08-08T18:40:17.929911 | 2019-10-18T01:06:32 | 2019-10-18T01:06:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,726 | java | public void testFilter() {
// Define the variables
CharSequence source;
SpannableStringBuilder dest;
// Constructor to create a LengthFilter
InputFilter lengthFilter = new Utf8ByteLengthFilter(10);
InputFilter[] filters = {lengthFilter};
// filter() implicitly invoked. If the total length > filter length, the filter will
// cut off the source CharSequence from beginning to fit the filter length.
source = "abc";
dest = new SpannableStringBuilder("abcdefgh");
dest.setFilters(filters);
dest.insert(1, source);
String expectedString1 = "aabbcdefgh";
assertEquals(expectedString1, dest.toString());
dest.replace(5, 8, source);
String expectedString2 = "aabbcabcgh";
assertEquals(expectedString2, dest.toString());
dest.insert(2, source);
assertEquals(expectedString2, dest.toString());
dest.delete(1, 3);
String expectedString3 = "abcabcgh";
assertEquals(expectedString3, dest.toString());
dest.append("12345");
String expectedString4 = "abcabcgh12";
assertEquals(expectedString4, dest.toString());
source = "\u60a8\u597d"; // 2 Chinese chars == 6 bytes in UTF-8
dest.replace(8, 10, source);
assertEquals(expectedString3, dest.toString());
dest.replace(0, 1, source);
String expectedString5 = "\u60a8bcabcgh";
assertEquals(expectedString5, dest.toString());
dest.replace(0, 4, source);
String expectedString6 = "\u60a8\u597dbcgh";
assertEquals(expectedString6, dest.toString());
source = "\u00a3\u00a5"; // 2 Latin-1 chars == 4 bytes in UTF-8
dest.delete(2, 6);
dest.insert(0, source);
String expectedString7 = "\u00a3\u00a5\u60a8\u597d";
assertEquals(expectedString7, dest.toString());
dest.replace(2, 3, source);
String expectedString8 = "\u00a3\u00a5\u00a3\u597d";
assertEquals(expectedString8, dest.toString());
dest.replace(3, 4, source);
String expectedString9 = "\u00a3\u00a5\u00a3\u00a3\u00a5";
assertEquals(expectedString9, dest.toString());
// filter() explicitly invoked
dest = new SpannableStringBuilder("abcdefgh");
CharSequence beforeFilterSource = "TestLengthFilter";
String expectedAfterFilter = "TestLength";
CharSequence actualAfterFilter = lengthFilter.filter(beforeFilterSource, 0,
beforeFilterSource.length(), dest, 0, dest.length());
assertEquals(expectedAfterFilter, actualAfterFilter);
}
| [
"naist1020@gmail.com"
] | naist1020@gmail.com |
a74e0ed0453eb1a6222a5023d22947125e279134 | 7396ed6ec7ebe89b685c41448312d63f9dcf702b | /src/main/java/com/google/api/codegen/viewmodel/StaticLangApiResourceNameView.java | 5349475dc18fc876faf36f24e4236d0a8577d43f | [
"Apache-2.0"
] | permissive | dr-aryone/gapic-generator | 394df828c7c5353fac51c4b3da32f47346bd2f8f | b465d5651c29c344e90515172cbe662fcb296dd8 | refs/heads/master | 2020-05-29T09:22:41.339305 | 2019-05-24T17:14:18 | 2019-05-24T17:14:18 | 189,060,284 | 2 | 1 | NOASSERTION | 2019-05-28T15:58:24 | 2019-05-28T15:58:24 | null | UTF-8 | Java | false | false | 2,179 | java | /* Copyright 2017 Google LLC
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.api.codegen.viewmodel;
import com.google.auto.value.AutoValue;
import java.util.List;
/** This ViewModel defines the view model structure of ResourceName. */
@AutoValue
public abstract class StaticLangApiResourceNameView
implements Comparable<StaticLangApiResourceNameView> {
// The possibly-transformed ID of the schema from the Discovery Doc
public abstract String name();
// The type name for this Schema when rendered as a field in its parent Schema, e.g.
// "List<Operation>".
public abstract String typeName();
// The template for the path, e.g. "projects/{projects}/topic/{topic}"
public abstract String pathTemplate();
// The leading protocol+hostname string that qualifies a resource path.
// e.g. "https://www.googleapis.com/compute/v1/projects/"
public abstract String serviceAddress();
// The list of path parameter views.
public abstract List<StaticLangMemberView> pathParams();
public static Builder newBuilder() {
return new AutoValue_StaticLangApiResourceNameView.Builder();
}
@AutoValue.Builder
public abstract static class Builder {
public abstract Builder name(String val);
public abstract Builder typeName(String val);
public abstract Builder pathTemplate(String val);
public abstract Builder serviceAddress(String val);
public abstract Builder pathParams(List<StaticLangMemberView> val);
public abstract StaticLangApiResourceNameView build();
}
@Override
public int compareTo(StaticLangApiResourceNameView o) {
return this.name().compareTo(o.name());
}
}
| [
"noreply@github.com"
] | dr-aryone.noreply@github.com |
99a644e4bf1cab0348e5cda7a5ce567c4a9b7553 | 2a7dbce64a17feeae51655005de740116841f0fd | /selenium/src/test/java/ru/tinkoff/qa/neptune/selenium/test/steps/tests/searching/SearchForWebElementsNegativeTest.java | a9934176119b9b36f7bac2edacb9159c12c830d2 | [
"Apache-2.0"
] | permissive | a-artemenko/neptune | c1a0d4698efc97288d7a1e970002b55915c64d0a | 98971dda3fe4d068814671532bc6fd16ec390516 | refs/heads/master | 2022-01-05T23:27:29.677425 | 2019-07-17T13:59:01 | 2019-07-17T13:59:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 49,750 | java | package ru.tinkoff.qa.neptune.selenium.test.steps.tests.searching;
import ru.tinkoff.qa.neptune.selenium.test.BaseWebDriverTest;
import ru.tinkoff.qa.neptune.selenium.test.RetryAnalyzer;
import org.openqa.selenium.By;
import org.openqa.selenium.SearchContext;
import org.openqa.selenium.WebElement;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import java.math.BigDecimal;
import java.util.List;
import java.util.function.Predicate;
import java.util.regex.Pattern;
import static ru.tinkoff.qa.neptune.selenium.functions.searching.CommonConditions.*;
import static ru.tinkoff.qa.neptune.selenium.functions.searching.MultipleSearchSupplier.webElements;
import static ru.tinkoff.qa.neptune.selenium.functions.searching.SearchSupplier.webElement;
import static ru.tinkoff.qa.neptune.selenium.properties.SessionFlagProperties.FIND_ONLY_VISIBLE_ELEMENTS;
import static ru.tinkoff.qa.neptune.selenium.properties.WaitingProperties.TimeUnitProperties.ELEMENT_WAITING_TIME_UNIT;
import static ru.tinkoff.qa.neptune.selenium.properties.WaitingProperties.TimeValueProperties.ELEMENT_WAITING_TIME_VALUE;
import static ru.tinkoff.qa.neptune.selenium.test.FakeDOMModel.*;
import static java.lang.String.format;
import static java.util.regex.Pattern.compile;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
import static org.openqa.selenium.By.*;
public class SearchForWebElementsNegativeTest extends BaseWebDriverTest {
private static final String FOUND_BY_PATTERN = "0 web elements found %s";
private static final String FOUND_ON_CONDITION = FOUND_BY_PATTERN + " and meet criteria ['%s']";
private static final By CLASS_THAT_DOES_NOT_EXIST = className("fakeClass");
private static String expectedDescriptionOfTheFoundElements(By by, Predicate<? extends SearchContext> condition) {
return format(FOUND_ON_CONDITION, by, condition);
}
private static String expectedDescriptionOfTheFoundElements() {
return format(FOUND_BY_PATTERN, CLASS_THAT_DOES_NOT_EXIST);
}
@Test(retryAnalyzer = RetryAnalyzer.class)
public void findWebElementsFirstLevelWithoutConditionWithDefinedTimeTest() {
setStartBenchMark();
List<WebElement> webElements = seleniumSteps.find(webElements(CLASS_THAT_DOES_NOT_EXIST)
.timeOut(ONE_SECOND));
setEndBenchMark();
assertThat(getTimeDifference(), greaterThanOrEqualTo(ONE_SECOND.toMillis()));
assertThat(getTimeDifference() - ONE_SECOND.toMillis(), lessThan(HALF_SECOND.toMillis()));
assertThat(webElements.size(), is(0));
assertThat(webElements.toString(), is(expectedDescriptionOfTheFoundElements()));
}
@Test(retryAnalyzer = RetryAnalyzer.class)
public void findWebElementsFirstLevelWithoutConditionWithTimeDefinedImplicitlyTest() {
setProperty(ELEMENT_WAITING_TIME_UNIT.getPropertyName(), "SECONDS");
setProperty(ELEMENT_WAITING_TIME_VALUE.getPropertyName(), "1");
setStartBenchMark();
try {
List<WebElement> webElements = seleniumSteps.find(webElements(CLASS_THAT_DOES_NOT_EXIST));
setEndBenchMark();
assertThat(getTimeDifference(), greaterThanOrEqualTo(ONE_SECOND.toMillis()));
assertThat(getTimeDifference() - ONE_SECOND.toMillis(), lessThan(HALF_SECOND.toMillis()));
assertThat(webElements.size(), is(0));
assertThat(webElements.toString(), is(expectedDescriptionOfTheFoundElements()));
}
finally {
removeProperty(ELEMENT_WAITING_TIME_UNIT.getPropertyName());
removeProperty(ELEMENT_WAITING_TIME_VALUE.getPropertyName());
}
}
@Test(retryAnalyzer = RetryAnalyzer.class)
public void findWebElementsFirstLevelOnlyVisibleImplicitConditionAndDefinedTimeTest() {
setProperty(FIND_ONLY_VISIBLE_ELEMENTS.getPropertyName(), "true");
setStartBenchMark();
try {
List<WebElement> webElements = seleniumSteps.find(webElements(INVISIBLE_SPAN_BY)
.timeOut(ONE_SECOND));
setEndBenchMark();
assertThat(getTimeDifference(), greaterThanOrEqualTo(ONE_SECOND.toMillis()));
assertThat(getTimeDifference() - ONE_SECOND.toMillis(), lessThan(HALF_SECOND.toMillis()));
assertThat(webElements.size(), is(0));
assertThat(webElements.toString(), is(expectedDescriptionOfTheFoundElements(INVISIBLE_SPAN_BY,
shouldBeVisible())));
}
finally {
removeProperty(FIND_ONLY_VISIBLE_ELEMENTS.getPropertyName());
}
}
@Test(retryAnalyzer = RetryAnalyzer.class)
public void findWebElementsFirstLevelOnlyVisibleImplicitConditionAndImplicitTimeTest() {
setProperty(FIND_ONLY_VISIBLE_ELEMENTS.getPropertyName(), "true");
setProperty(ELEMENT_WAITING_TIME_UNIT.getPropertyName(), "SECONDS");
setProperty(ELEMENT_WAITING_TIME_VALUE.getPropertyName(), "1");
setStartBenchMark();
try {
List<WebElement> webElements = seleniumSteps.find(webElements(INVISIBLE_SPAN_BY));
setEndBenchMark();
assertThat(getTimeDifference(), greaterThanOrEqualTo(ONE_SECOND.toMillis()));
assertThat(getTimeDifference() - ONE_SECOND.toMillis(), lessThan(HALF_SECOND.toMillis()));
assertThat(webElements.size(), is(0));
assertThat(webElements.toString(), is(expectedDescriptionOfTheFoundElements(INVISIBLE_SPAN_BY,
shouldBeVisible())));
}
finally {
removeProperty(FIND_ONLY_VISIBLE_ELEMENTS.getPropertyName());
removeProperty(ELEMENT_WAITING_TIME_UNIT.getPropertyName());
removeProperty(ELEMENT_WAITING_TIME_VALUE.getPropertyName());
}
}
@Test(retryAnalyzer = RetryAnalyzer.class)
public void findWebElementsFirstLevelOnlyVisibleImplicitConditionAndTimeConflictTest() {
setProperty(FIND_ONLY_VISIBLE_ELEMENTS.getPropertyName(), "true");
setProperty(ELEMENT_WAITING_TIME_UNIT.getPropertyName(), "SECONDS");
setProperty(ELEMENT_WAITING_TIME_VALUE.getPropertyName(), "5");
setStartBenchMark();
try {
List<WebElement> webElements = seleniumSteps.find(webElements(INVISIBLE_SPAN_BY)
.timeOut(ONE_SECOND));
setEndBenchMark();
assertThat(getTimeDifference(), greaterThanOrEqualTo(ONE_SECOND.toMillis()));
assertThat(getTimeDifference() - ONE_SECOND.toMillis(), lessThan(HALF_SECOND.toMillis()));
assertThat(webElements.size(), is(0));
assertThat(webElements.toString(), is(expectedDescriptionOfTheFoundElements(INVISIBLE_SPAN_BY,
shouldBeVisible())));
}
finally {
removeProperty(FIND_ONLY_VISIBLE_ELEMENTS.getPropertyName());
removeProperty(ELEMENT_WAITING_TIME_UNIT.getPropertyName());
removeProperty(ELEMENT_WAITING_TIME_VALUE.getPropertyName());
}
}
@Test(retryAnalyzer = RetryAnalyzer.class)
public void findWebElementsChainedWithoutConditionWithDefinedTimeTest() {
setStartBenchMark();
List<WebElement> webElements = seleniumSteps.find(webElements(CLASS_THAT_DOES_NOT_EXIST)
.timeOut(ONE_SECOND)
.foundFrom(webElement(tagName(BUTTON_TAG))));
setEndBenchMark();
assertThat(getTimeDifference(), greaterThanOrEqualTo(ONE_SECOND.toMillis()));
assertThat(getTimeDifference() - ONE_SECOND.toMillis(), lessThan(HALF_SECOND.toMillis()));
assertThat(webElements.size(), is(0));
assertThat(webElements.toString(), is(expectedDescriptionOfTheFoundElements()));
}
@Test(retryAnalyzer = RetryAnalyzer.class)
public void findWebElementsChainedWithoutConditionWithTimeDefinedImplicitlyTest() {
setProperty(ELEMENT_WAITING_TIME_UNIT.getPropertyName(), "SECONDS");
setProperty(ELEMENT_WAITING_TIME_VALUE.getPropertyName(), "1");
setStartBenchMark();
try {
List<WebElement> webElements = seleniumSteps.find(webElements(CLASS_THAT_DOES_NOT_EXIST)
.foundFrom(webElement(tagName(BUTTON_TAG))));
setEndBenchMark();
assertThat(getTimeDifference(), greaterThanOrEqualTo(ONE_SECOND.toMillis()));
assertThat(getTimeDifference() - ONE_SECOND.toMillis(), lessThan(HALF_SECOND.toMillis()));
assertThat(webElements.size(), is(0));
assertThat(webElements.toString(), is(expectedDescriptionOfTheFoundElements()));
}
finally {
removeProperty(ELEMENT_WAITING_TIME_UNIT.getPropertyName());
removeProperty(ELEMENT_WAITING_TIME_VALUE.getPropertyName());
}
}
@Test(retryAnalyzer = RetryAnalyzer.class)
public void findWebElementsChainedOnlyVisibleImplicitConditionAndDefinedTimeTest() {
setProperty(FIND_ONLY_VISIBLE_ELEMENTS.getPropertyName(), "true");
setStartBenchMark();
try {
List<WebElement> webElements = seleniumSteps.find(webElements(INVISIBLE_SPAN_BY)
.timeOut(ONE_SECOND)
.foundFrom(webElement(className(SPREAD_SHEET_CLASS))));
setEndBenchMark();
assertThat(getTimeDifference(), greaterThanOrEqualTo(ONE_SECOND.toMillis()));
assertThat(getTimeDifference() - ONE_SECOND.toMillis(), lessThan(HALF_SECOND.toMillis()));
assertThat(webElements.size(), is(0));
assertThat(webElements.toString(), is(expectedDescriptionOfTheFoundElements(INVISIBLE_SPAN_BY,
shouldBeVisible())));
}
finally {
removeProperty(FIND_ONLY_VISIBLE_ELEMENTS.getPropertyName());
}
}
@Test(retryAnalyzer = RetryAnalyzer.class)
public void findWebElementsChainedOnlyVisibleImplicitConditionAndImplicitTimeTest() {
setProperty(FIND_ONLY_VISIBLE_ELEMENTS.getPropertyName(), "true");
setProperty(ELEMENT_WAITING_TIME_UNIT.getPropertyName(), "SECONDS");
setProperty(ELEMENT_WAITING_TIME_VALUE.getPropertyName(), "1");
setStartBenchMark();
try {
List<WebElement> webElements = seleniumSteps.find(webElements(INVISIBLE_SPAN_BY)
.foundFrom(webElement(className(SPREAD_SHEET_CLASS))));
setEndBenchMark();
assertThat(getTimeDifference(), greaterThanOrEqualTo(ONE_SECOND.toMillis()));
assertThat(getTimeDifference() - ONE_SECOND.toMillis(), lessThan(HALF_SECOND.toMillis()));
assertThat(webElements.size(), is(0));
assertThat(webElements.toString(), is(expectedDescriptionOfTheFoundElements(INVISIBLE_SPAN_BY,
shouldBeVisible())));
}
finally {
removeProperty(FIND_ONLY_VISIBLE_ELEMENTS.getPropertyName());
removeProperty(ELEMENT_WAITING_TIME_UNIT.getPropertyName());
removeProperty(ELEMENT_WAITING_TIME_VALUE.getPropertyName());
}
}
@Test(retryAnalyzer = RetryAnalyzer.class)
public void findWebElementsChainedOnlyVisibleImplicitConditionAndTimeConflictTest() {
setProperty(FIND_ONLY_VISIBLE_ELEMENTS.getPropertyName(), "true");
setProperty(ELEMENT_WAITING_TIME_UNIT.getPropertyName(), "SECONDS");
setProperty(ELEMENT_WAITING_TIME_VALUE.getPropertyName(), "5");
setStartBenchMark();
try {
List<WebElement> webElements = seleniumSteps.find(webElements(INVISIBLE_SPAN_BY)
.timeOut(ONE_SECOND)
.foundFrom(webElement(className(SPREAD_SHEET_CLASS))));
setEndBenchMark();
assertThat(getTimeDifference(), greaterThanOrEqualTo(ONE_SECOND.toMillis()));
assertThat(getTimeDifference() - ONE_SECOND.toMillis(), lessThan(HALF_SECOND.toMillis()));
assertThat(webElements.size(), is(0));
assertThat(webElements.toString(), is(expectedDescriptionOfTheFoundElements(INVISIBLE_SPAN_BY,
shouldBeVisible())));
}
finally {
removeProperty(FIND_ONLY_VISIBLE_ELEMENTS.getPropertyName());
removeProperty(ELEMENT_WAITING_TIME_UNIT.getPropertyName());
removeProperty(ELEMENT_WAITING_TIME_VALUE.getPropertyName());
}
}
@Test(retryAnalyzer = RetryAnalyzer.class)
public void findFromWebElementsWithoutConditionWithDefinedTimeTest() {
WebElement parent = seleniumSteps.find(webElement(tagName(BUTTON_TAG)));
setStartBenchMark();
List<WebElement> webElements = seleniumSteps.find(webElements(CLASS_THAT_DOES_NOT_EXIST)
.timeOut(ONE_SECOND)
.foundFrom(parent));
setEndBenchMark();
assertThat(getTimeDifference(), greaterThanOrEqualTo(ONE_SECOND.toMillis()));
assertThat(getTimeDifference() - ONE_SECOND.toMillis(), lessThan(HALF_SECOND.toMillis()));
assertThat(webElements.size(), is(0));
assertThat(webElements.toString(), is(expectedDescriptionOfTheFoundElements()));
}
@Test(retryAnalyzer = RetryAnalyzer.class)
public void findFromWebElementsWithoutConditionWithTimeDefinedImplicitlyTest() {
WebElement parent = seleniumSteps.find(webElement(tagName(BUTTON_TAG)));
setProperty(ELEMENT_WAITING_TIME_UNIT.getPropertyName(), "SECONDS");
setProperty(ELEMENT_WAITING_TIME_VALUE.getPropertyName(), "1");
setStartBenchMark();
try {
List<WebElement> webElements = seleniumSteps.find(webElements(CLASS_THAT_DOES_NOT_EXIST)
.foundFrom(parent));
setEndBenchMark();
assertThat(getTimeDifference(), greaterThanOrEqualTo(ONE_SECOND.toMillis()));
assertThat(getTimeDifference() - ONE_SECOND.toMillis(), lessThan(HALF_SECOND.toMillis()));
assertThat(webElements.size(), is(0));
assertThat(webElements.toString(), is(expectedDescriptionOfTheFoundElements()));
}
finally {
removeProperty(ELEMENT_WAITING_TIME_UNIT.getPropertyName());
removeProperty(ELEMENT_WAITING_TIME_VALUE.getPropertyName());
}
}
@Test(retryAnalyzer = RetryAnalyzer.class)
public void findFromWebElementsOnlyVisibleImplicitConditionAndDefinedTimeTest() {
setProperty(FIND_ONLY_VISIBLE_ELEMENTS.getPropertyName(), "true");
WebElement parent = seleniumSteps.find(webElement(className(SPREAD_SHEET_CLASS)));
setStartBenchMark();
try {
List<WebElement> webElements = seleniumSteps.find(webElements(INVISIBLE_SPAN_BY)
.timeOut(ONE_SECOND)
.foundFrom(parent));
setEndBenchMark();
assertThat(getTimeDifference(), greaterThanOrEqualTo(ONE_SECOND.toMillis()));
assertThat(getTimeDifference() - ONE_SECOND.toMillis(), lessThan(HALF_SECOND.toMillis()));
assertThat(webElements.size(), is(0));
assertThat(webElements.toString(), is(expectedDescriptionOfTheFoundElements(INVISIBLE_SPAN_BY,
shouldBeVisible())));
}
finally {
removeProperty(FIND_ONLY_VISIBLE_ELEMENTS.getPropertyName());
}
}
@Test(retryAnalyzer = RetryAnalyzer.class)
public void findFromWebElementsOnlyVisibleImplicitConditionAndImplicitTimeTest() {
setProperty(FIND_ONLY_VISIBLE_ELEMENTS.getPropertyName(), "true");
setProperty(ELEMENT_WAITING_TIME_UNIT.getPropertyName(), "SECONDS");
setProperty(ELEMENT_WAITING_TIME_VALUE.getPropertyName(), "1");
WebElement parent = seleniumSteps.find(webElement(className(SPREAD_SHEET_CLASS)));
setStartBenchMark();
try {
List<WebElement> webElements = seleniumSteps.find(webElements(INVISIBLE_SPAN_BY)
.foundFrom(parent));
setEndBenchMark();
assertThat(getTimeDifference(), greaterThanOrEqualTo(ONE_SECOND.toMillis()));
assertThat(getTimeDifference() - ONE_SECOND.toMillis(), lessThan(HALF_SECOND.toMillis()));
assertThat(webElements.size(), is(0));
assertThat(webElements.toString(), is(expectedDescriptionOfTheFoundElements(INVISIBLE_SPAN_BY,
shouldBeVisible())));
}
finally {
removeProperty(FIND_ONLY_VISIBLE_ELEMENTS.getPropertyName());
removeProperty(ELEMENT_WAITING_TIME_UNIT.getPropertyName());
removeProperty(ELEMENT_WAITING_TIME_VALUE.getPropertyName());
}
}
@Test(retryAnalyzer = RetryAnalyzer.class)
public void findFromWebElementsOnlyVisibleImplicitConditionAndTimeConflictTest() {
setProperty(FIND_ONLY_VISIBLE_ELEMENTS.getPropertyName(), "true");
setProperty(ELEMENT_WAITING_TIME_UNIT.getPropertyName(), "SECONDS");
setProperty(ELEMENT_WAITING_TIME_VALUE.getPropertyName(), "5");
WebElement parent = seleniumSteps.find(webElement(className(SPREAD_SHEET_CLASS)));
setStartBenchMark();
try {
List<WebElement> webElements = seleniumSteps.find(webElements(INVISIBLE_SPAN_BY)
.timeOut(ONE_SECOND)
.foundFrom(parent));
setEndBenchMark();
assertThat(getTimeDifference(), greaterThanOrEqualTo(ONE_SECOND.toMillis()));
assertThat(getTimeDifference() - ONE_SECOND.toMillis(), lessThan(HALF_SECOND.toMillis()));
assertThat(webElements.size(), is(0));
assertThat(webElements.toString(), is(expectedDescriptionOfTheFoundElements(INVISIBLE_SPAN_BY,
shouldBeVisible())));
}
finally {
removeProperty(FIND_ONLY_VISIBLE_ELEMENTS.getPropertyName());
removeProperty(ELEMENT_WAITING_TIME_UNIT.getPropertyName());
removeProperty(ELEMENT_WAITING_TIME_VALUE.getPropertyName());
}
}
@DataProvider(name = "search criteria1")
public static Object[][] searchCriteria() {
return new Object[][]{
{INVISIBLE_SPAN_BY, shouldBeEnabled(),
expectedDescriptionOfTheFoundElements(INVISIBLE_SPAN_BY, shouldBeEnabled())},
{VISIBLE_DIV_BY, shouldBeEnabled().negate(),
expectedDescriptionOfTheFoundElements(VISIBLE_DIV_BY, shouldBeEnabled().negate())},
{INVISIBLE_SPAN_BY, shouldBeVisible(),
expectedDescriptionOfTheFoundElements(INVISIBLE_SPAN_BY, shouldBeVisible())},
{VISIBLE_DIV_BY, shouldBeVisible().negate(),
expectedDescriptionOfTheFoundElements(VISIBLE_DIV_BY, shouldBeVisible().negate())},
{className(MULTI_SELECT_CLASS),
shouldContainElements(webElements(className(ITEM_OPTION_CLASS)), 4),
expectedDescriptionOfTheFoundElements(className(MULTI_SELECT_CLASS),
shouldContainElements(webElements(className(ITEM_OPTION_CLASS)), 4))},
{className(MULTI_SELECT_CLASS),
shouldContainElements(webElements(className(ITEM_OPTION_CLASS)), 3)
.or(shouldContainElements(webElements(className(ITEM_OPTION_CLASS)), 2))
.negate(),
expectedDescriptionOfTheFoundElements(className(MULTI_SELECT_CLASS),
shouldContainElements(webElements(className(ITEM_OPTION_CLASS)), 3)
.or(shouldContainElements(webElements(className(ITEM_OPTION_CLASS)), 2))
.negate())},
{className(MULTI_SELECT_CLASS),
shouldContainElements(webElements(tagName(OPTION))),
expectedDescriptionOfTheFoundElements(className(MULTI_SELECT_CLASS),
shouldContainElements(webElements(tagName(OPTION))))},
{tagName(SELECT), shouldContainElements(webElements(tagName(OPTION))).negate(),
expectedDescriptionOfTheFoundElements(tagName(SELECT),
shouldContainElements(webElements(tagName(OPTION))).negate())},
{tagName(TEXT_AREA_TAG), shouldHaveAttribute(ATTR11, VALUE10),
expectedDescriptionOfTheFoundElements(tagName(TEXT_AREA_TAG),
shouldHaveAttribute(ATTR11, VALUE10))},
{tagName(TEXT_AREA_TAG), shouldHaveAttribute(ATTR11, VALUE12)
.or(shouldHaveAttribute(ATTR11, VALUE13))
.or(shouldHaveAttribute(ATTR11, VALUE14))
.or(shouldHaveAttribute(ATTR11, VALUE15)).negate(),
expectedDescriptionOfTheFoundElements(tagName(TEXT_AREA_TAG),
shouldHaveAttribute(ATTR11, VALUE12)
.or(shouldHaveAttribute(ATTR11, VALUE13))
.or(shouldHaveAttribute(ATTR11, VALUE14))
.or(shouldHaveAttribute(ATTR11, VALUE15)).negate())},
{tagName(TEXT_AREA_TAG), shouldHaveAttributeContains(ATTR11, "10"),
expectedDescriptionOfTheFoundElements(tagName(TEXT_AREA_TAG),
shouldHaveAttributeContains(ATTR11, "10"))},
{tagName(TEXT_AREA_TAG), shouldHaveAttributeContains(ATTR11, "12")
.or(shouldHaveAttributeContains(ATTR11, "13"))
.or(shouldHaveAttributeContains(ATTR11, VALUE14))
.or(shouldHaveAttributeContains(ATTR11, VALUE15)).negate(),
expectedDescriptionOfTheFoundElements(tagName(TEXT_AREA_TAG),
shouldHaveAttributeContains(ATTR11, "12")
.or(shouldHaveAttributeContains(ATTR11, "13"))
.or(shouldHaveAttributeContains(ATTR11, VALUE14))
.or(shouldHaveAttributeContains(ATTR11, VALUE15)).negate())},
{tagName(TEXT_AREA_TAG), shouldHaveAttributeContains(ATTR11, compile("10")),
expectedDescriptionOfTheFoundElements(tagName(TEXT_AREA_TAG),
shouldHaveAttributeContains(ATTR11, compile("10")))},
{tagName(TEXT_AREA_TAG), shouldHaveAttributeContains(ATTR11, compile("12"))
.or(shouldHaveAttributeContains(ATTR11, compile("13")))
.or(shouldHaveAttributeContains(ATTR11, compile(VALUE14)))
.or(shouldHaveAttributeContains(ATTR11, compile(VALUE15))).negate(),
expectedDescriptionOfTheFoundElements(tagName(TEXT_AREA_TAG),
shouldHaveAttributeContains(ATTR11, compile("12"))
.or(shouldHaveAttributeContains(ATTR11, compile("13")))
.or(shouldHaveAttributeContains(ATTR11, compile(VALUE14)))
.or(shouldHaveAttributeContains(ATTR11, compile(VALUE15))).negate())},
{xpath(RADIO_BUTTON_XPATH), shouldHaveCssValue(CSS18, CSS_VALUE6),
expectedDescriptionOfTheFoundElements(xpath(RADIO_BUTTON_XPATH),
shouldHaveCssValue(CSS18, CSS_VALUE6))},
{xpath(RADIO_BUTTON_XPATH),
shouldHaveCssValue(CSS18, CSS_VALUE7)
.or(shouldHaveCssValue(CSS18, CSS_VALUE8))
.or(shouldHaveCssValue(CSS18, CSS_VALUE9))
.or(shouldHaveCssValue(CSS18, CSS_VALUE10))
.or(shouldHaveCssValue(CSS18, CSS_VALUE11))
.or(shouldHaveCssValue(CSS18, CSS_VALUE12))
.or(shouldHaveCssValue(CSS18, CSS_VALUE13))
.or(shouldHaveCssValue(CSS18, CSS_VALUE14))
.or(shouldHaveCssValue(CSS18, CSS_VALUE15))
.or(shouldHaveCssValue(CSS18, CSS_VALUE16))
.or(shouldHaveCssValue(CSS18, CSS_VALUE17))
.or(shouldHaveCssValue(CSS18, CSS_VALUE18))
.or(shouldHaveCssValue(CSS18, CSS_VALUE19)).negate(),
expectedDescriptionOfTheFoundElements(xpath(RADIO_BUTTON_XPATH),
shouldHaveCssValue(CSS18, CSS_VALUE7)
.or(shouldHaveCssValue(CSS18, CSS_VALUE8))
.or(shouldHaveCssValue(CSS18, CSS_VALUE9))
.or(shouldHaveCssValue(CSS18, CSS_VALUE10))
.or(shouldHaveCssValue(CSS18, CSS_VALUE11))
.or(shouldHaveCssValue(CSS18, CSS_VALUE12))
.or(shouldHaveCssValue(CSS18, CSS_VALUE13))
.or(shouldHaveCssValue(CSS18, CSS_VALUE14))
.or(shouldHaveCssValue(CSS18, CSS_VALUE15))
.or(shouldHaveCssValue(CSS18, CSS_VALUE16))
.or(shouldHaveCssValue(CSS18, CSS_VALUE17))
.or(shouldHaveCssValue(CSS18, CSS_VALUE18))
.or(shouldHaveCssValue(CSS18, CSS_VALUE19)).negate())},
{xpath(RADIO_BUTTON_XPATH), shouldHaveCssValueContains(CSS18, "value6"),
expectedDescriptionOfTheFoundElements(xpath(RADIO_BUTTON_XPATH),
shouldHaveCssValueContains(CSS18, "value6"))},
{xpath(RADIO_BUTTON_XPATH),
shouldHaveCssValueContains(CSS18, "value").negate(),
expectedDescriptionOfTheFoundElements(xpath(RADIO_BUTTON_XPATH),
shouldHaveCssValueContains(CSS18, "value").negate())},
{xpath(RADIO_BUTTON_XPATH), shouldHaveCssValueContains(CSS18, compile("value6")),
expectedDescriptionOfTheFoundElements(xpath(RADIO_BUTTON_XPATH),
shouldHaveCssValueContains(CSS18, compile("value6")))},
{xpath(RADIO_BUTTON_XPATH),
shouldHaveCssValueContains(CSS18, compile("value")).negate(),
expectedDescriptionOfTheFoundElements(xpath(RADIO_BUTTON_XPATH),
shouldHaveCssValueContains(CSS18, compile("value")).negate())},
{INVISIBLE_SPAN_BY, shouldHaveText(VISIBLE_DIV),
expectedDescriptionOfTheFoundElements(INVISIBLE_SPAN_BY,
shouldHaveText(VISIBLE_DIV))},
{VISIBLE_DIV_BY, shouldHaveText(VISIBLE_DIV).negate(),
expectedDescriptionOfTheFoundElements(VISIBLE_DIV_BY,
shouldHaveText(VISIBLE_DIV).negate())},
{INVISIBLE_SPAN_BY, shouldHaveText(compile("div")),
expectedDescriptionOfTheFoundElements(INVISIBLE_SPAN_BY,
shouldHaveText(compile("div")))},
{VISIBLE_DIV_BY, shouldHaveText(compile("div")).negate(),
expectedDescriptionOfTheFoundElements(VISIBLE_DIV_BY,
shouldHaveText(compile("div")).negate())}
};
}
@Test(dataProvider = "search criteria1", retryAnalyzer = RetryAnalyzer.class)
public void findElementsByCriteriaWithDefinedTimeTest(By by,
Predicate<WebElement> criteria,
String expectedListDescription) {
setStartBenchMark();
List<WebElement> webElements = seleniumSteps.find(webElements(by)
.timeOut(ONE_SECOND)
.criteria(criteria));
setEndBenchMark();
assertThat(getTimeDifference(), greaterThanOrEqualTo(ONE_SECOND.toMillis()));
assertThat(new BigDecimal(getTimeDifference() - ONE_SECOND.toMillis()),
either(lessThan(new BigDecimal(HALF_SECOND.toMillis())))
.or(closeTo(new BigDecimal(HALF_SECOND.toMillis()), new BigDecimal(HALF_SECOND.toMillis()))));
assertThat(webElements.size(), is(0));
assertThat(webElements.toString(), is(expectedListDescription));
}
@Test(dataProvider = "search criteria1", retryAnalyzer = RetryAnalyzer.class)
public void findElementsByCriteriaWithTimeDefinedImplicitlyTest(By by,
Predicate<WebElement> criteria,
String expectedListDescription) {
setProperty(ELEMENT_WAITING_TIME_UNIT.getPropertyName(), "SECONDS");
setProperty(ELEMENT_WAITING_TIME_VALUE.getPropertyName(), "1");
setStartBenchMark();
try {
List<WebElement> webElements = seleniumSteps.find(webElements(by)
.criteria(criteria));
setEndBenchMark();
assertThat(getTimeDifference(), greaterThanOrEqualTo(ONE_SECOND.toMillis()));
assertThat(new BigDecimal(getTimeDifference() - ONE_SECOND.toMillis()),
either(lessThan(new BigDecimal(HALF_SECOND.toMillis())))
.or(closeTo(new BigDecimal(HALF_SECOND.toMillis()), new BigDecimal(HALF_SECOND.toMillis()))));
assertThat(webElements.size(), is(0));
assertThat(webElements.toString(), is(expectedListDescription));
}
finally {
removeProperty(ELEMENT_WAITING_TIME_UNIT.getPropertyName());
removeProperty(ELEMENT_WAITING_TIME_VALUE.getPropertyName());
}
}
@DataProvider(name = "search criteria2")
public static Object[][] searchCriteriaForText() {
return new Object[][]{
{tagName(BUTTON_TAG), BUTTON_TEXT1, shouldBeEnabled(),
expectedDescriptionOfTheFoundElements(tagName(BUTTON_TAG),
shouldHaveText(BUTTON_TEXT1).and(shouldBeEnabled()))},
{tagName(BUTTON_TAG), BUTTON_TEXT3, shouldBeEnabled().negate(),
expectedDescriptionOfTheFoundElements(tagName(BUTTON_TAG),
shouldHaveText(BUTTON_TEXT3).and(shouldBeEnabled().negate()))},
{tagName(LINK_TAG), LINK_TEXT1, shouldBeVisible(),
expectedDescriptionOfTheFoundElements(tagName(LINK_TAG),
shouldHaveText(LINK_TEXT1).and(shouldBeVisible()))},
{tagName(LINK_TAG), LINK_TEXT2, shouldBeVisible().negate(),
expectedDescriptionOfTheFoundElements(tagName(LINK_TAG),
shouldHaveText(LINK_TEXT2).and(shouldBeVisible().negate()))},
{tagName(SELECT), OPTION_TEXT23,
shouldContainElements(webElements(tagName(OPTION), OPTION_TEXT22), 3),
expectedDescriptionOfTheFoundElements(tagName(SELECT), shouldHaveText(OPTION_TEXT23)
.and(shouldContainElements(webElements(tagName(OPTION), OPTION_TEXT22), 3)))},
{tagName(SELECT), OPTION_TEXT20,
shouldContainElements(webElements(tagName(OPTION)), 3).negate(),
expectedDescriptionOfTheFoundElements(tagName(SELECT),
shouldHaveText(OPTION_TEXT20)
.and(shouldContainElements(webElements(tagName(OPTION)), 3).negate()))},
{tagName(BUTTON_TAG), BUTTON_TEXT4,
shouldContainElements(webElements(tagName(LABEL_TAG), BUTTON_LABEL_TEXT1)),
expectedDescriptionOfTheFoundElements(tagName(BUTTON_TAG),
shouldHaveText(BUTTON_TEXT4)
.and(shouldContainElements(webElements(tagName(LABEL_TAG), BUTTON_LABEL_TEXT1))))},
{tagName(BUTTON_TAG), BUTTON_TEXT5,
shouldContainElements(webElements(tagName(LABEL_TAG), BUTTON_LABEL_TEXT1)).negate(),
expectedDescriptionOfTheFoundElements(tagName(BUTTON_TAG),
shouldHaveText(BUTTON_TEXT5)
.and(shouldContainElements(webElements(tagName(LABEL_TAG),
BUTTON_LABEL_TEXT1)).negate()))},
{CHAINED_FIND_TAB, TAB_TEXT3, shouldHaveAttribute(ATTR19, VALUE12),
expectedDescriptionOfTheFoundElements(CHAINED_FIND_TAB,
shouldHaveText(TAB_TEXT3)
.and(shouldHaveAttribute(ATTR19, VALUE12)))},
{CHAINED_FIND_TAB, TAB_TEXT2, shouldHaveAttribute(ATTR19, VALUE12).negate(),
expectedDescriptionOfTheFoundElements(CHAINED_FIND_TAB,
shouldHaveText(TAB_TEXT2)
.and(shouldHaveAttribute(ATTR19, VALUE12).negate()))},
{CHAINED_FIND_TAB, TAB_TEXT4, shouldHaveAttributeContains(ATTR20, VALUE14),
expectedDescriptionOfTheFoundElements(CHAINED_FIND_TAB,
shouldHaveText(TAB_TEXT4).and(shouldHaveAttributeContains(ATTR20, VALUE14)))},
{CHAINED_FIND_TAB, TAB_TEXT3, shouldHaveAttributeContains(ATTR20, VALUE14).negate(),
expectedDescriptionOfTheFoundElements(CHAINED_FIND_TAB,
shouldHaveText(TAB_TEXT3)
.and(shouldHaveAttributeContains(ATTR20, VALUE14).negate()))},
{CHAINED_FIND_TAB, TAB_TEXT3, shouldHaveAttributeContains(ATTR20, compile(VALUE12)),
expectedDescriptionOfTheFoundElements(CHAINED_FIND_TAB,
shouldHaveText(TAB_TEXT3)
.and(shouldHaveAttributeContains(ATTR20, compile(VALUE12))))},
{CHAINED_FIND_TAB, TAB_TEXT1, shouldHaveAttributeContains(ATTR20, compile(VALUE12)).negate(),
expectedDescriptionOfTheFoundElements(CHAINED_FIND_TAB,
shouldHaveText(TAB_TEXT1)
.and(shouldHaveAttributeContains(ATTR20, compile(VALUE12)).negate()))},
{xpath(TEXT_FIELD_XPATH), INPUT_TEXT4, shouldHaveCssValue(CSS8, CSS_VALUE6),
expectedDescriptionOfTheFoundElements(xpath(TEXT_FIELD_XPATH),
shouldHaveText(INPUT_TEXT4)
.and(shouldHaveCssValue(CSS8, CSS_VALUE6)))},
{xpath(TEXT_FIELD_XPATH), INPUT_TEXT3, shouldHaveCssValue(CSS8, CSS_VALUE6).negate(),
expectedDescriptionOfTheFoundElements(xpath(TEXT_FIELD_XPATH),
shouldHaveText(INPUT_TEXT3)
.and(shouldHaveCssValue(CSS8, CSS_VALUE6).negate()))},
{xpath(TEXT_FIELD_XPATH), INPUT_TEXT4, shouldHaveCssValueContains(CSS8, "4")
.and(shouldHaveCssValueContains(CSS9, "5")),
expectedDescriptionOfTheFoundElements(xpath(TEXT_FIELD_XPATH),
shouldHaveText(INPUT_TEXT4).and(shouldHaveCssValueContains(CSS8, "4")
.and(shouldHaveCssValueContains(CSS9, "5"))))},
{xpath(TEXT_FIELD_XPATH), INPUT_TEXT1, shouldHaveCssValueContains(CSS8, "4")
.and(shouldHaveCssValueContains(CSS9, "5")).negate(),
expectedDescriptionOfTheFoundElements(xpath(TEXT_FIELD_XPATH),
shouldHaveText(INPUT_TEXT1).and(shouldHaveCssValueContains(CSS8, "4")
.and(shouldHaveCssValueContains(CSS9, "5")).negate()))},
{xpath(TEXT_FIELD_XPATH), INPUT_TEXT4, shouldHaveCssValueContains(CSS8, compile("4"))
.and(shouldHaveCssValueContains(CSS9, compile("5"))),
expectedDescriptionOfTheFoundElements(xpath(TEXT_FIELD_XPATH),
shouldHaveText(INPUT_TEXT4).and(shouldHaveCssValueContains(CSS8, compile("4"))
.and(shouldHaveCssValueContains(CSS9, compile("5")))))},
{xpath(TEXT_FIELD_XPATH), INPUT_TEXT1, shouldHaveCssValueContains(CSS8, compile("4"))
.and(shouldHaveCssValueContains(CSS9, compile("5"))).negate(),
expectedDescriptionOfTheFoundElements(xpath(TEXT_FIELD_XPATH),
shouldHaveText(INPUT_TEXT1).and(shouldHaveCssValueContains(CSS8, compile("4"))
.and(shouldHaveCssValueContains(CSS9, compile("5"))).negate()))},
};
}
@Test(dataProvider = "search criteria2", retryAnalyzer = RetryAnalyzer.class)
public void findElementsByCriteriaAndTextWithDefinedTimeTest(By by,
String text,
Predicate<WebElement> criteria,
String expectedListDescription) {
setStartBenchMark();
List<WebElement> webElements = seleniumSteps.find(webElements(by, text)
.timeOut(ONE_SECOND)
.criteria(criteria));
setEndBenchMark();
assertThat(getTimeDifference(), greaterThanOrEqualTo(ONE_SECOND.toMillis()));
assertThat(getTimeDifference() - ONE_SECOND.toMillis(), lessThan(HALF_SECOND.toMillis()));
assertThat(webElements.size(), is(0));
assertThat(webElements.toString(), is(expectedListDescription));
}
@Test(dataProvider = "search criteria2", retryAnalyzer = RetryAnalyzer.class)
public void findElementsByCriteriaAndTextWithTimeDefinedImplicitlyTest(By by,
String text,
Predicate<WebElement> criteria,
String expectedListDescription) {
setProperty(ELEMENT_WAITING_TIME_UNIT.getPropertyName(), "SECONDS");
setProperty(ELEMENT_WAITING_TIME_VALUE.getPropertyName(), "1");
setStartBenchMark();
try {
List<WebElement> webElements = seleniumSteps.find(webElements(by, text)
.criteria(criteria));
setEndBenchMark();
assertThat(getTimeDifference(), greaterThanOrEqualTo(ONE_SECOND.toMillis()));
assertThat(getTimeDifference() - ONE_SECOND.toMillis(), lessThan(HALF_SECOND.toMillis()));
assertThat(webElements.size(), is(0));
assertThat(webElements.toString(), is(expectedListDescription));
}
finally {
removeProperty(ELEMENT_WAITING_TIME_UNIT.getPropertyName());
removeProperty(ELEMENT_WAITING_TIME_VALUE.getPropertyName());
}
}
@DataProvider(name = "search criteria3")
public static Object[][] searchCriteriaForTextPattern() {
return new Object[][]{
{tagName(BUTTON_TAG), compile("Text1"), shouldBeEnabled(),
expectedDescriptionOfTheFoundElements(tagName(BUTTON_TAG),
shouldHaveText(compile("Text1")).and(shouldBeEnabled()))},
{tagName(BUTTON_TAG), compile("Text3"), shouldBeEnabled().negate(),
expectedDescriptionOfTheFoundElements(tagName(BUTTON_TAG),
shouldHaveText(compile("Text3")).and(shouldBeEnabled().negate()))},
{tagName(LINK_TAG), compile("Text1"), shouldBeVisible(),
expectedDescriptionOfTheFoundElements(tagName(LINK_TAG),
shouldHaveText(compile("Text1")).and(shouldBeVisible()))},
{tagName(LINK_TAG), compile("Text2"), shouldBeVisible().negate(),
expectedDescriptionOfTheFoundElements(tagName(LINK_TAG),
shouldHaveText(compile("Text2")).and(shouldBeVisible().negate()))},
{tagName(SELECT), compile("Text23"),
shouldContainElements(webElements(tagName(OPTION), OPTION_TEXT22), 3),
expectedDescriptionOfTheFoundElements(tagName(SELECT), shouldHaveText(compile("Text23"))
.and(shouldContainElements(webElements(tagName(OPTION), OPTION_TEXT22), 3)))},
{tagName(SELECT), compile(OPTION_TEXT20),
shouldContainElements(webElements(tagName(OPTION)), 3).negate(),
expectedDescriptionOfTheFoundElements(tagName(SELECT),
shouldHaveText(compile(OPTION_TEXT20))
.and(shouldContainElements(webElements(tagName(OPTION)), 3).negate()))},
{tagName(BUTTON_TAG), compile("Text4"),
shouldContainElements(webElements(tagName(LABEL_TAG), BUTTON_LABEL_TEXT1)),
expectedDescriptionOfTheFoundElements(tagName(BUTTON_TAG),
shouldHaveText(compile("Text4"))
.and(shouldContainElements(webElements(tagName(LABEL_TAG), BUTTON_LABEL_TEXT1))))},
{tagName(BUTTON_TAG), compile("Text5"),
shouldContainElements(webElements(tagName(LABEL_TAG), BUTTON_LABEL_TEXT1)).negate(),
expectedDescriptionOfTheFoundElements(tagName(BUTTON_TAG),
shouldHaveText(compile("Text5"))
.and(shouldContainElements(webElements(tagName(LABEL_TAG),
BUTTON_LABEL_TEXT1)).negate()))},
{CHAINED_FIND_TAB, compile("Text3"), shouldHaveAttribute(ATTR19, VALUE12),
expectedDescriptionOfTheFoundElements(CHAINED_FIND_TAB,
shouldHaveText(compile("Text3"))
.and(shouldHaveAttribute(ATTR19, VALUE12)))},
{CHAINED_FIND_TAB, compile("Text2"), shouldHaveAttribute(ATTR19, VALUE12).negate(),
expectedDescriptionOfTheFoundElements(CHAINED_FIND_TAB,
shouldHaveText(compile("Text2"))
.and(shouldHaveAttribute(ATTR19, VALUE12).negate()))},
{CHAINED_FIND_TAB, compile("Text4"), shouldHaveAttributeContains(ATTR20, VALUE14),
expectedDescriptionOfTheFoundElements(CHAINED_FIND_TAB,
shouldHaveText(compile("Text4")).and(shouldHaveAttributeContains(ATTR20, VALUE14)))},
{CHAINED_FIND_TAB, compile("Text3"), shouldHaveAttributeContains(ATTR20, VALUE14).negate(),
expectedDescriptionOfTheFoundElements(CHAINED_FIND_TAB,
shouldHaveText(compile("Text3"))
.and(shouldHaveAttributeContains(ATTR20, VALUE14).negate()))},
{CHAINED_FIND_TAB, compile("Text3"), shouldHaveAttributeContains(ATTR20, compile(VALUE12)),
expectedDescriptionOfTheFoundElements(CHAINED_FIND_TAB,
shouldHaveText(compile("Text3"))
.and(shouldHaveAttributeContains(ATTR20, compile(VALUE12))))},
{CHAINED_FIND_TAB, compile(TAB_TEXT1), shouldHaveAttributeContains(ATTR20, compile(VALUE12)).negate(),
expectedDescriptionOfTheFoundElements(CHAINED_FIND_TAB,
shouldHaveText(compile(TAB_TEXT1))
.and(shouldHaveAttributeContains(ATTR20, compile(VALUE12)).negate()))},
{xpath(TEXT_FIELD_XPATH), compile(INPUT_TEXT4), shouldHaveCssValue(CSS8, CSS_VALUE6),
expectedDescriptionOfTheFoundElements(xpath(TEXT_FIELD_XPATH),
shouldHaveText(compile(INPUT_TEXT4))
.and(shouldHaveCssValue(CSS8, CSS_VALUE6)))},
{xpath(TEXT_FIELD_XPATH), compile(INPUT_TEXT3), shouldHaveCssValue(CSS8, CSS_VALUE6).negate(),
expectedDescriptionOfTheFoundElements(xpath(TEXT_FIELD_XPATH),
shouldHaveText(compile(INPUT_TEXT3))
.and(shouldHaveCssValue(CSS8, CSS_VALUE6).negate()))},
{xpath(TEXT_FIELD_XPATH), compile(INPUT_TEXT4), shouldHaveCssValueContains(CSS8, "4")
.and(shouldHaveCssValueContains(CSS9, "5")),
expectedDescriptionOfTheFoundElements(xpath(TEXT_FIELD_XPATH),
shouldHaveText(compile(INPUT_TEXT4)).and(shouldHaveCssValueContains(CSS8, "4")
.and(shouldHaveCssValueContains(CSS9, "5"))))},
{xpath(TEXT_FIELD_XPATH), compile(INPUT_TEXT1), shouldHaveCssValueContains(CSS8, "4")
.and(shouldHaveCssValueContains(CSS9, "5")).negate(),
expectedDescriptionOfTheFoundElements(xpath(TEXT_FIELD_XPATH),
shouldHaveText(compile(INPUT_TEXT1)).and(shouldHaveCssValueContains(CSS8, "4")
.and(shouldHaveCssValueContains(CSS9, "5")).negate()))},
{xpath(TEXT_FIELD_XPATH), compile(INPUT_TEXT4), shouldHaveCssValueContains(CSS8, compile("4"))
.and(shouldHaveCssValueContains(CSS9, compile("5"))),
expectedDescriptionOfTheFoundElements(xpath(TEXT_FIELD_XPATH),
shouldHaveText(compile(INPUT_TEXT4)).and(shouldHaveCssValueContains(CSS8, compile("4"))
.and(shouldHaveCssValueContains(CSS9, compile("5")))))},
{xpath(TEXT_FIELD_XPATH), compile(INPUT_TEXT1), shouldHaveCssValueContains(CSS8, compile("4"))
.and(shouldHaveCssValueContains(CSS9, compile("5"))).negate(),
expectedDescriptionOfTheFoundElements(xpath(TEXT_FIELD_XPATH),
shouldHaveText(compile(INPUT_TEXT1)).and(shouldHaveCssValueContains(CSS8, compile("4"))
.and(shouldHaveCssValueContains(CSS9, compile("5"))).negate()))},
};
}
@Test(dataProvider = "search criteria3", retryAnalyzer = RetryAnalyzer.class)
public void findElementsByCriteriaAndTexPatternWithDefinedTimeTest(By by,
Pattern pattern,
Predicate<WebElement> criteria,
String expectedListDescription) {
setStartBenchMark();
List<WebElement> webElements = seleniumSteps.find(webElements(by, pattern).timeOut(ONE_SECOND).criteria(criteria));
setEndBenchMark();
assertThat(getTimeDifference(), greaterThanOrEqualTo(ONE_SECOND.toMillis()));
assertThat(getTimeDifference() - ONE_SECOND.toMillis(), lessThan(HALF_SECOND.toMillis()));
assertThat(webElements.size(), is(0));
assertThat(webElements.toString(), is(expectedListDescription));
}
@Test(dataProvider = "search criteria3", retryAnalyzer = RetryAnalyzer.class)
public void findElementsByCriteriaAndTexPatternWithTimeDefinedImplicitlyTest(By by,
Pattern pattern,
Predicate<WebElement> criteria,
String expectedListDescription) {
setProperty(ELEMENT_WAITING_TIME_UNIT.getPropertyName(), "SECONDS");
setProperty(ELEMENT_WAITING_TIME_VALUE.getPropertyName(), "1");
setStartBenchMark();
try {
List<WebElement> webElements = seleniumSteps.find(webElements(by, pattern).criteria(criteria));
setEndBenchMark();
assertThat(getTimeDifference(), greaterThanOrEqualTo(ONE_SECOND.toMillis()));
assertThat(getTimeDifference() - ONE_SECOND.toMillis(), lessThan(HALF_SECOND.toMillis()));
assertThat(webElements.size(), is(0));
assertThat(webElements.toString(), is(expectedListDescription));
}
finally {
removeProperty(ELEMENT_WAITING_TIME_UNIT.getPropertyName());
removeProperty(ELEMENT_WAITING_TIME_VALUE.getPropertyName());
}
}
}
| [
"tichomirovsergey@gmail.com"
] | tichomirovsergey@gmail.com |
73edcb38bdb96b27e99a7c1ef3f4d98c0c4566ea | 4d57ad70d6e61ca0d829b6b0f7c889be72d03ff5 | /src/main/java/garage/Vehicle.java | 79f822286f462ad40f1131861181bc4889b0f784 | [] | no_license | AlwinThomaz/MyGarage | e957717637abb9e5b25e5db850ea50ce89e63303 | 2a923a401e7c9eae11cdc29547a3df0b07128c3f | refs/heads/master | 2020-09-23T06:28:26.728854 | 2019-12-02T17:11:39 | 2019-12-02T17:11:39 | 225,427,989 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,002 | java | package garage;
public abstract class Vehicle {
private int noOfWheels;
private int noOfEngines;
private String colour;
private String modelName;
public abstract void move();
public void noise() {
System.out.println("Vroom!");
}
public abstract float calcBill();
public int getNoOfWheels() {
return noOfWheels;
}
public void setNoOfWheels(int noOfWheels) {
this.noOfWheels = noOfWheels;
}
public int getNoOfEngines() {
return noOfEngines;
}
public void setNoOfEngines(int noOfEngines) {
this.noOfEngines = noOfEngines;
}
public String getColour() {
return colour;
}
public void setColour(String colour) {
this.colour = colour;
}
public String getModelName() {
return modelName;
}
public void setModelName(String modelName) {
this.modelName = modelName;
}
// @Override
// public String toString() {
// return "Vehicle [noOfWheels=" + noOfWheels + ", noOfEngines=" + noOfEngines +
// ", colour=" + colour
// + ", modelName=" + modelName + "]";
} | [
"alwinthomas@MacBook-Pro.local"
] | alwinthomas@MacBook-Pro.local |
865fd310b01c1803a218a0cfc5cdd71628467530 | db566b55f8fb1aa64c238cee403fccacea8734c3 | /app/src/main/java/com/example/saksham/Writer/MatchesViewHolder.java | 00b61c29727ff8d9376edd7ae12f8e2b14bdb95d | [] | no_license | isham1302/Saksham | 634405d85d18de5f46d20a844aa6cf0d4e41dedb | 8e53be8ac60765a95ee922653227ca6507422bf7 | refs/heads/master | 2022-12-04T10:13:11.450374 | 2020-08-11T15:50:45 | 2020-08-11T15:50:45 | 279,516,357 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,172 | java | package com.example.saksham.Writer;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.example.saksham.Writer.Chat.Chat;
import com.example.saksham.R;
public class MatchesViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
public TextView mMatchId,mMatchName;
public ImageView mMatchImage;
public MatchesViewHolder(@NonNull View itemView) {
super(itemView);
itemView.setOnClickListener(this);
mMatchId= (TextView) itemView.findViewById(R.id.MatchId);
mMatchName= (TextView) itemView.findViewById(R.id.MatchName);
mMatchImage= (ImageView) itemView.findViewById(R.id.MatchImage);
}
@Override
public void onClick(View view) {
Intent intent= new Intent(view.getContext(), Chat.class);
Bundle bundle= new Bundle();
bundle.putString("matchId",mMatchId.getText().toString());
intent.putExtras(bundle);
view.getContext().startActivity(intent);
}
}
| [
"61309519+isham1302@users.noreply.github.com"
] | 61309519+isham1302@users.noreply.github.com |
f42455332202d6c585cfdc30e506f83a6b78f8a3 | 24c4670917d885a4dfebcbc04733d4a4a12fc282 | /src/main/java/com/wang/springboot/service/ProjectService.java | f6ad8caaa10304c87907ad3aa6b036ebebfde9bd | [] | no_license | wyn-365/springboot-blogsV3 | b6f8ab6e31c0137e9685f65a7e1f948d8755580e | 258f9d4713158d0e7b30246c41e939064446dc62 | refs/heads/master | 2023-04-19T01:19:17.258047 | 2020-08-01T03:14:46 | 2020-08-01T03:14:46 | 284,176,547 | 0 | 0 | null | 2021-04-22T19:20:31 | 2020-08-01T03:12:37 | JavaScript | UTF-8 | Java | false | false | 303 | java | package com.wang.springboot.service;
import com.wang.springboot.pojo.Blog;
import com.wang.springboot.pojo.Project;
/**
* @author 王一宁
* @date 2020/3/10 9:36
*/
public interface ProjectService {
//markdown转换成html的详情页面的方法
public Project getAndConvert(Long id);
}
| [
"wyn_365@qq.com"
] | wyn_365@qq.com |
c9cc72bcc74a35732784c7ce9f9a27540ee4db6b | 46739a7b95dd2728cae2951f516feb571193a535 | /src/orbits/Orbit.java | df06ca80a25ae0c1799c03bf63ca07d9fdaccb5c | [] | no_license | hedzup456/RandomStuff | 60dd3fa32c631402cc0bcc8b7c4087a02100f4b6 | 30378311df0a0e21334718ee2166c887fc4f2590 | refs/heads/master | 2020-12-24T06:53:59.165385 | 2016-03-31T23:12:33 | 2016-03-31T23:12:33 | 41,733,865 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,861 | java | package orbits;
public class Orbit {
private double eccentricity, inclination, longitudeOfAscNode, argOfPeriapsis, meanAnomaly;
private int semimajorAxis, radiusOfBody, massOfBody;
private String body;
public String toString(){
return "Body: " + body +
" Radius of body: " + radiusOfBody +
" SMI: " + semimajorAxis +
" Inc: " + inclination +
" Ecc: " + eccentricity +
" LongitudeOfAscNode: " + longitudeOfAscNode +
" ArgOfPeriapsis: " + argOfPeriapsis +
" MeanAnomaly: " + meanAnomaly;
}
/**
* @return the massOfBody
*/
public int getMassOfBody() {
return massOfBody;
}
/**
* @param massOfBody the massOfBody to set
*/
public void setMassOfBody(int massOfBody) {
this.massOfBody = massOfBody;
}
/**
* @return the eccentricity
*/
public double getEccentricity() {
return eccentricity;
}
/**
* @param eccentricity the eccentricity to set
*/
public void setEccentricity(double eccentricity) {
this.eccentricity = eccentricity;
}
/**
* @return the inclination
*/
public double getInclination() {
return inclination;
}
/**
* @param inclination the inclination to set
*/
public void setInclination(double inclination) {
this.inclination = inclination;
}
/**
* @return the longitudeOfAscNode
*/
public double getLongitudeOfAscNode() {
return longitudeOfAscNode;
}
/**
* @param longitudeOfAscNode the longitudeOfAscNode to set
*/
public void setLongitudeOfAscNode(double longitudeOfAscNode) {
this.longitudeOfAscNode = longitudeOfAscNode;
}
/**
* @return the argOfPeriapsis
*/
public double getArgOfPeriapsis() {
return argOfPeriapsis;
}
/**
* @param argOfPeriapsis the argOfPeriapsis to set
*/
public void setArgOfPeriapsis(double argOfPeriapsis) {
this.argOfPeriapsis = argOfPeriapsis;
}
/**
* @return the meanAnomaly
*/
public double getMeanAnomaly() {
return meanAnomaly;
}
/**
* @param meanAnomaly the meanAnomaly to set
*/
public void setMeanAnomaly(double meanAnomaly) {
this.meanAnomaly = meanAnomaly;
}
/**
* @return the semimajorAxis
*/
public int getSemimajorAxis() {
return semimajorAxis;
}
/**
* @param semimajorAxis the semimajorAxis to set
*/
public void setSemimajorAxis(int semimajorAxis) {
this.semimajorAxis = semimajorAxis;
}
/**
* @return the radiusOfBody
*/
public int getRadiusOfBody() {
return radiusOfBody;
}
/**
* @param radiusOfBody the radiusOfBody to set
*/
public void setRadiusOfBody(int radiusOfBody) {
this.radiusOfBody = radiusOfBody;
}
/**
* @return the body
*/
public String getBody() {
return body;
}
/**
* @param body the body to set
*/
public void setBody(String body) {
this.body = body;
}
}
| [
"richardhenry602@gmail.com"
] | richardhenry602@gmail.com |
642a4e31b48acc52672ba865e5de9c1a70b7fdec | 3a66024a5dd76668a17c8b945d840b5388341c5c | /ISO20008/src/org/iso200082/mechanisms/m4/parties/M4Signer.java | e1bc73880ea89b19506de67fa8bb700476a3fab1 | [
"BSD-3-Clause"
] | permissive | darg0001/group-signature-scheme-eval | fdbf07a01590545d54a93a8809cd6ebac45a5c5d | 366c9c6222ae371886cb382840a68048dce0e19b | refs/heads/master | 2021-04-12T04:14:38.633387 | 2013-04-08T13:41:40 | 2013-04-08T13:41:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,727 | java | /*
* This file is part of an unofficial ISO20008-2.2 sample implementation to
* evaluate certain schemes for their applicability on Android-based mobile
* devices. The source is licensed under the modified 3-clause BSD license,
* see the readme.
*
* The code was published in conjunction with the publication called
* "Group Signatures on Mobile Devices: Practical Experiences" by
* Potzmader, Winter, Hein, Hanser, Teufl and Chen
*/
package org.iso200082.mechanisms.m4.parties;
import java.math.BigInteger;
import org.iso200082.common.Debug;
import org.iso200082.common.Hash;
import org.iso200082.common.api.ds.Signature;
import org.iso200082.common.api.ds.SignatureKey;
import org.iso200082.common.api.parties.CarelessSigner;
import org.iso200082.common.api.parties.Signer;
import org.iso200082.common.api.revocation.NonRevocationChallenge;
import org.iso200082.common.api.revocation.NonRevocationProof;
import org.iso200082.common.ecc.api.Point;
import org.iso200082.common.ecc.elements.FqElement;
import org.iso200082.common.ecc.fields.towerextension.Fq;
import org.iso200082.mechanisms.m4.M4Scheme;
import org.iso200082.mechanisms.m4.ds.M4PrecomputationResult;
import org.iso200082.mechanisms.m4.ds.M4Signature;
import org.iso200082.mechanisms.m4.ds.M4SignatureKey;
import org.iso200082.mechanisms.m4.ds.group.M4Parameters;
import org.iso200082.mechanisms.m4.ds.group.M4PublicKey;
import org.iso200082.mechanisms.m4.ds.messages.M4JoinRequest;
import org.iso200082.mechanisms.m4.ds.messages.M4MembershipCredential;
import org.iso200082.mechanisms.m4.ds.messages.M4NonRevokedChallenge;
import org.iso200082.mechanisms.m4.protocol.M4Protocol;
/**
* Signer, provides means to join a group (though not exposed as a non-joined
* member is not much of a 'Signer') and sign messages.
*
* Note that in this framework, there is no separation between actual signer
* (e.g. TPM) and 'assistant signer' (host platform).
*
* @see M4Verifier
* @see M4Issuer
* @see M4Signature
* @see M4SignatureKey
* @see M4Scheme
*
* @param <P> The primitive Type to use
*
* @author Klaus Potzmader <klaus-dot-potzmader-at-student-dot-tugraz-dot-at>
* @version 1.0
*/
public class M4Signer
<
P
>
implements Signer, CarelessSigner
{
/** The group's public key */
protected M4PublicKey<P> gpub;
/** The group's public parameters */
protected M4Parameters<P> gparams;
/** The signers name (ID) */
protected String identifier;
/** The linking base to use */
protected BigInteger bsn;
/** private signature key */
private M4SignatureKey<P> key;
/** temporary 'f' (named as in the draft), used during join phase */
private FqElement<P> f;
/** Precomputation result (remains null if
* {@link #precomputeSignature(boolean)} is not used) */
private M4PrecomputationResult<P> precomp_result;
/**
* Ctor, creates a new (not-yet joined) signer, also creates
* the linking base (simple sha1 hash over the name -> room for improvement
* as it's easy to test all known names against a hash..)
*
* @param gpub The group's public key
* @param gparams The group's public parameters
* @param identifier The signer's ID
*/
public M4Signer(M4PublicKey<P> gpub, M4Parameters<P> gparams,
String identifier)
{
this.gpub = gpub;
this.gparams = gparams;
this.identifier = identifier;
// a more sophisticated (salted!) method would be better.
this.bsn = Hash.H("SHA-1", identifier.getBytes(), 160);
}
/**
* Creates a join request indicating that the non-member wants to join
*
* @param nonce A nonce (nI), initially chosen by the issuer. The nonce
* could be separated into another messages.
*
* @return A new {@link M4JoinRequest}
*/
public M4JoinRequest<P> createJoinRequest(byte[] nonce)
{
f = gparams.getFq().getRandomElement();
return M4Protocol.createJoinRequest(nonce, f, gparams, gpub);
}
/**
* Completes a join request, creates the {@link M4SignatureKey} by combining
* the retrieved {@link M4MembershipCredential} with the private key f.
*
* @param mc The {@link M4MembershipCredential} sent by the {@link M4Issuer}
*
* @return true if the credential could be verified
*/
public boolean completeJoin(M4MembershipCredential<P> mc)
{
key = M4Protocol.createKeyFromCredential(gparams, f, mc, gpub);
f = null;
return key != null;
}
@Override
public boolean precomputeSignature(boolean full)
{
if(key == null)
{
Debug.out(Debug.SIGN, "Join first.");
return false;
}
precomp_result = M4Protocol.precomputeInitialSignature(key, gparams);
if(full)
M4Protocol.precomputeUnlinkableSignature(precomp_result, getLinkingBase(), key, gparams);
return precomp_result != null;
}
@Override
public Signature signMessage(String message)
{
if(key == null)
{
Debug.out(Debug.SIGN, "Join first.");
return null;
}
// if precomp_result != null, fine. If not, it will be computed
M4Signature<P> out = M4Protocol.signMessage(message.getBytes(),
bsn, key, gparams, precomp_result);
precomp_result = null;
return out;
}
@Override
public String getName()
{
return identifier;
}
@Override
public BigInteger getLinkingBase()
{
return bsn;
}
/**
* Updates the group public key, thus affecting the signer's private key.
* Used in Credential Update revocation scenarios.
*
* @param C The updated C
*/
public void updateGroupPublicKey(Point<FqElement<P>, Fq<P>> C)
{
key = new M4SignatureKey<P>(key.getA(), key.getB(), C, key.getD(), key.getF());
}
@SuppressWarnings("unchecked")
@Override
public boolean equals(Object obj)
{
if(this == obj) return true;
if(!(obj instanceof M4Signer))
return false;
return identifier.equals(((M4Signer<P>) obj).getName());
}
@Override
public SignatureKey getDrunkAndTellSecrets()
{
return key;
}
@Override
@SuppressWarnings("unchecked")
public NonRevocationProof
getNonRevocationProof(String message, Signature sig,
NonRevocationChallenge challenge)
{
if(!(challenge instanceof M4NonRevokedChallenge))
return null;
if(!(sig instanceof M4Signature))
return null;
M4NonRevokedChallenge<P> c = (M4NonRevokedChallenge<P>) challenge;
M4Signature<P> s = (M4Signature<P>) sig;
return M4Protocol.getNonRevokedProof(message.getBytes(), key, s, c.getJ(),
c.getK(), gparams);
}
}
| [
"klaus-dot-potzmader-at-student-dot-tugraz-dot-at"
] | klaus-dot-potzmader-at-student-dot-tugraz-dot-at |
28238a7e707846cf5d8914ef6a680d94594f3c9a | 4ed3d7d785155c3143dcb24744de0a36f239a76b | /Podcast/app/src/main/java/br/ufpe/cin/if710/podcast/download/DownloadBroadcastReceiver.java | 9697d106ea9d7107ca4b17a2d8c0ac276427ee57 | [
"MIT"
] | permissive | Shankarmandal82/exercicio-podcast | c49adbd21cd64f6ef76857b589efe9144f7647e1 | a65f59c9d49fe9236c97fde533035135d351d160 | refs/heads/master | 2023-03-15T14:55:41.898213 | 2017-12-08T18:30:28 | 2017-12-08T18:30:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,003 | java | package br.ufpe.cin.if710.podcast.download;
import android.app.DownloadManager;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;
import br.ufpe.cin.if710.podcast.R;
import br.ufpe.cin.if710.podcast.db.PodcastProviderHelper;
import br.ufpe.cin.if710.podcast.domain.ItemFeed;
import br.ufpe.cin.if710.podcast.ui.MainActivity;
/**
* Created by Beto on 07/10/2017.
* Receiver para armazenar a uri do arquivo
* Registrado no manifest, recebe broadcasts do DownloadManager executado pelo service
* Desativado se app estiver em primeiro plano.
*/
public class DownloadBroadcastReceiver extends BroadcastReceiver {
private static final String NOTIFICATION_TITLE = "Download Completo";
private static final String NOTIFICATION_TEXT = "Podcast baixado com sucesso!";
private static final int NOTIFICATION_ID = 1;
@Override
public void onReceive(Context context, Intent intent) {
Log.d("DOWNLOAD_RECEIVER", "onreceive");
Toast.makeText(context, "Download Completo", Toast.LENGTH_SHORT).show();
// recupera o id do download solicitado
long downloadID = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, 0);
// recupera o item correspondente
ItemFeed itemFeed = PodcastProviderHelper.getItem(context, downloadID);
// recupera a uri do arquivo baixado
DownloadManager downloadManager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
String fileURI = downloadManager.getUriForDownloadedFile(downloadID).toString();
if (itemFeed != null) {
// atuaiza o item com a uri do arquivo
PodcastProviderHelper.updateFileURI(context, itemFeed.getId(), fileURI);
}
Log.d("DOWNLOAD_URI", "onReceive: " + fileURI.toString());
}
}
| [
"avss@cin.ufpe.br"
] | avss@cin.ufpe.br |
0ac3a5c755de4c8eff5faa00bdb164b484427c39 | 3823983f9ab8e9a12fbc7f29c99c15cffca36b8e | /src/main/java/eu/openanalytics/containerproxy/auth/impl/SocialAuthenticationBackend.java | 97520b0baa01b77347056a170e628988bf06c2db | [
"Apache-2.0",
"LicenseRef-scancode-philippe-de-muyter"
] | permissive | ZSI-Bio/containerproxy | 7ed08b59f37ebbd7224f7bd89cb0ca5be95461ee | c5b381faa1b51aef6ab4f6c0a75a0d8dc82c7210 | refs/heads/master | 2020-04-29T19:26:35.055718 | 2018-12-21T15:12:34 | 2018-12-21T15:12:34 | 176,354,698 | 0 | 0 | NOASSERTION | 2019-03-18T19:20:53 | 2019-03-18T19:20:53 | null | UTF-8 | Java | false | false | 1,863 | java | /**
* ContainerProxy
*
* Copyright (C) 2016-2018 Open Analytics
*
* ===========================================================================
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the Apache License as published by
* The Apache Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Apache License for more details.
*
* You should have received a copy of the Apache License
* along with this program. If not, see <http://www.apache.org/licenses/>
*/
package eu.openanalytics.containerproxy.auth.impl;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import eu.openanalytics.containerproxy.auth.IAuthenticationBackend;
/**
* This authentication type does nothing by itself. All social configuration is handled in
* {@link eu.openanalytics.containerproxy.security.SocialSecurityConfig}
*/
public class SocialAuthenticationBackend implements IAuthenticationBackend {
public static final String NAME = "social";
@Override
public String getName() {
return NAME;
}
@Override
public boolean hasAuthorization() {
return true;
}
@Override
public void configureHttpSecurity(HttpSecurity http) throws Exception {
// Nothing to do.
}
@Override
public void configureAuthenticationManagerBuilder(AuthenticationManagerBuilder auth) throws Exception {
// Configure a no-op authentication.
auth.inMemoryAuthentication();
}
}
| [
"fmichielssen@openanalytics.eu"
] | fmichielssen@openanalytics.eu |
3212c17d851ee1652f2d5c7e5ade511f4ebcc2b4 | 386d4be1da84df6254a652f2b1fb49db3bb13c2a | /src/main/java/com/rhain/enterprise/exception/AppException.java | e56da9a48008656627894e8e472bcb1281e117bd | [] | no_license | Rhain/enterprise | dcacab71d27d05b0e5e9518c39f529bb59d1e8b9 | 26061c1658b5104fa88e1bb50fdeea75e930ecf5 | refs/heads/master | 2020-03-23T00:01:49.542516 | 2018-07-13T11:42:10 | 2018-07-13T11:42:10 | 140,840,060 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 423 | java | package com.rhain.enterprise.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
public class AppException extends RuntimeException {
public AppException(String message) {
super(message);
}
public AppException(String message, Throwable cause) {
super(message, cause);
}
}
| [
"rhainliu@tencent.com"
] | rhainliu@tencent.com |
b8c33816d76105861f684b45bfd4d670c017c251 | db2a87d7af621679921bfdcd93a212230684793a | /src/cn/javass/dp/prototype/example6/Product.java | 97edd0b492122291df2334df294371c93fe6cdda | [] | no_license | Wilsoncyf/designpattern | fa5f8a50e0d89f644ccb7edc1971465f3d21d3e4 | 11f62dd0753a7848c9de0453ee021a845347ebaa | refs/heads/master | 2022-12-05T02:48:24.323214 | 2020-08-31T15:50:02 | 2020-08-31T15:50:02 | 290,809,079 | 1 | 0 | null | null | null | null | GB18030 | Java | false | false | 805 | java | package cn.javass.dp.prototype.example6;
/**
* 产品对象
*/
public class Product implements ProductPrototype{
/**
* 产品编号
*/
private String productId;
/**
* 产品名称
*/
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getProductId() {
return productId;
}
public void setProductId(String productId) {
this.productId = productId;
}
public String toString(){
return "产品编号="+this.productId+",产品名称="+this.name;
}
public ProductPrototype cloneProduct() {
//创建一个新的订单,然后把本实例的数据复制过去
Product product = new Product();
product.setProductId(this.productId);
product.setName(this.name);
return product;
}
}
| [
"417187306@qq.com"
] | 417187306@qq.com |
382258e8e8581f51341533ea3e7e5b8f87a98d42 | 3d1132dd75c625019673ed55da9cf6bcdf1f7d7c | /lotto/src/main/java/com/juyoung/tddlotto/model/Number.java | a982ddd92b4100f03c0359f79d65268cda17e7b9 | [] | no_license | juyoungyoo/Re.TDD | d76fd953d214a0dd736dfb4f9a338edd2ff3d30a | 8fa2f06e586790e0b79921806b4bc9445696c9d8 | refs/heads/master | 2020-05-02T20:00:30.872428 | 2019-06-11T13:22:26 | 2019-06-11T13:22:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,102 | java | package com.juyoung.tddlotto.model;
import java.util.Objects;
public class Number implements Comparable<Number> {
static int MIN = 1;
static int MAX = 45;
private int number;
private Number(int number) {
validateNumber(number);
this.number = number;
}
public static Number of(int number) {
return new Number(number);
}
private void validateNumber(int number) {
if (number < MIN || number > MAX) {
throw new IllegalArgumentException(MIN + " ~ " + MAX + "숫자만 가능합니다");
}
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Number that = (Number) o;
return number == that.number;
}
@Override
public int hashCode() {
return Objects.hash(number);
}
@Override
public String toString() {
return String.valueOf(number);
}
@Override
public int compareTo(Number o) {
return Integer.compare(number, o.number);
}
}
| [
"juy5790@outlook.com"
] | juy5790@outlook.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.