blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
sequencelengths
1
1
author
stringlengths
0
161
d58deda1ac9ccf3c7effc4c75a3bc69f43efdabb
430bba6762d37622e2d8a60313d5857cad421829
/src/main/java/edu/poly/spring/models/SanPham.java
4dcff069c98a878e156208185744f66b590558c6
[]
no_license
khaintpd01910/DuAn2
835d0da9aef30259f2f45d56c7a76c25fafc3251
619aceb9651b663299cc7f3ccf921905e4328345
refs/heads/TuanKhai
2021-05-21T04:49:28.185663
2020-04-08T02:05:08
2020-04-08T02:05:08
252,550,455
0
0
null
2020-04-27T08:10:11
2020-04-02T19:42:29
Java
UTF-8
Java
false
false
4,260
java
package edu.poly.spring.models; import java.io.Serializable; import java.util.Date; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToOne; import javax.persistence.Temporal; import javax.persistence.TemporalType; import org.springframework.format.annotation.DateTimeFormat; @Entity public class SanPham implements Serializable { @Id @Column(name = "Ma", length = 10) private String ma; @Column(name = "Ten", length = 50) private String ten; @Column(name = "Hinh", length = 100) private String hinh; @Temporal(TemporalType.DATE) @DateTimeFormat(pattern = "dd/MM/yyyy") @Column(name = "NgayDang") private Date ngayDang; @Column(name = "GiamGia") private Float giamGia; @Column(name = "Gia") private Float gia; @Temporal(TemporalType.DATE) @DateTimeFormat(pattern = "dd/MM/yyyy") @Column(name = "NgayBatDau") private Date ngayBatDau; @Temporal(TemporalType.DATE) @DateTimeFormat(pattern = "dd/MM/yyyy") @Column(name = "NgayKetThuc") private Date ngayKetThuc; @Column(name = "MoTa", length = 200) private String moTa; @Column(name = "TinhTrang") private Boolean tinhTrang; @Column(name = "GhiChu",length = 200) private String ghiChu; @ManyToOne @JoinColumn(name = "maDanhMuc") private DanhMuc danhMuc; @ManyToOne @JoinColumn(name = "maCungCap") private NhaCungCap nhaCungCap; @OneToOne(mappedBy = "sanPham", cascade = CascadeType.ALL) private HoaDonChiTiet hoaDonChiTiet; public String getMa() { return ma; } public void setMa(String ma) { this.ma = ma; } public String getTen() { return ten; } public void setTen(String ten) { this.ten = ten; } public String getHinh() { return hinh; } public void setHinh(String hinh) { this.hinh = hinh; } public Date getNgayDang() { return ngayDang; } public void setNgayDang(Date ngayDang) { this.ngayDang = ngayDang; } public Float getGiamGia() { return giamGia; } public void setGiamGia(Float giamGia) { this.giamGia = giamGia; } public Float getGia() { return gia; } public void setGia(Float gia) { this.gia = gia; } public Date getNgayBatDau() { return ngayBatDau; } public void setNgayBatDau(Date ngayBatDau) { this.ngayBatDau = ngayBatDau; } public Date getNgayKetThuc() { return ngayKetThuc; } public void setNgayKetThuc(Date ngayKetThuc) { this.ngayKetThuc = ngayKetThuc; } public String getMoTa() { return moTa; } public void setMoTa(String moTa) { this.moTa = moTa; } public Boolean getTinhTrang() { return tinhTrang; } public void setTinhTrang(Boolean tinhTrang) { this.tinhTrang = tinhTrang; } public String getGhiChu() { return ghiChu; } public void setGhiChu(String ghiChu) { this.ghiChu = ghiChu; } public DanhMuc getDanhMuc() { return danhMuc; } public void setDanhMuc(DanhMuc danhMuc) { this.danhMuc = danhMuc; } public NhaCungCap getNhaCungCap() { return nhaCungCap; } public void setNhaCungCap(NhaCungCap nhaCungCap) { this.nhaCungCap = nhaCungCap; } public HoaDonChiTiet getHoaDonChiTiet() { return hoaDonChiTiet; } public void setHoaDonChiTiet(HoaDonChiTiet hoaDonChiTiet) { this.hoaDonChiTiet = hoaDonChiTiet; } public SanPham(String ma, String ten, String hinh, Date ngayDang, Float giamGia, Float gia, Date ngayBatDau, Date ngayKetThuc, String moTa, Boolean tinhTrang, String ghiChu, DanhMuc danhMuc, NhaCungCap nhaCungCap, HoaDonChiTiet hoaDonChiTiet) { super(); this.ma = ma; this.ten = ten; this.hinh = hinh; this.ngayDang = ngayDang; this.giamGia = giamGia; this.gia = gia; this.ngayBatDau = ngayBatDau; this.ngayKetThuc = ngayKetThuc; this.moTa = moTa; this.tinhTrang = tinhTrang; this.ghiChu = ghiChu; this.danhMuc = danhMuc; this.nhaCungCap = nhaCungCap; this.hoaDonChiTiet = hoaDonChiTiet; } public SanPham() { super(); } }
[ "TuanKhai@DESKTOP-IEV4A61" ]
TuanKhai@DESKTOP-IEV4A61
41a9f7d68e1db4cd7e703ad7bfb86b379c3b93af
51ab7225a5c21ad1c7436b734eb446d65ce5979e
/src/main/se450/singletons/ShapeList.java
fc11c1f8c0baa108a60c2d9d61197c723e9dfd55
[]
no_license
tareknabulsi/Asteroids
6de6c74bfa27154ce69c73c847e1a215abba3fb0
76a4a5932207edd91956871659325e57b42f55a5
refs/heads/master
2020-04-13T04:02:06.850163
2018-12-24T04:13:13
2018-12-24T04:13:13
162,948,896
0
0
null
null
null
null
UTF-8
Java
false
false
1,250
java
package main.se450.singletons; import java.util.ArrayList; import main.se450.interfaces.IShape; public class ShapeList { private static ShapeList shapeList = null; private ArrayList<IShape> iShapes = null; private ArrayList<IShape> iShapesDebris = null; private ArrayList<IShape> debris = null; static { shapeList = new ShapeList(); } private ShapeList() { iShapes = new ArrayList<IShape>(); iShapesDebris = new ArrayList<IShape>(); debris = new ArrayList<IShape>(); } public final static ShapeList getShapeList() { return shapeList; } public final ArrayList<IShape> getShapes() { return iShapes; } public final ArrayList<IShape> getShapesDebris() { return iShapesDebris; } public void addShapes(final ArrayList<IShape> iShapeList) { iShapes.addAll(iShapeList); } public void addShapesDebris(final IShape iShape) { iShapesDebris.add(iShape); } public void addDebrisToShapes(){ iShapes.addAll(iShapesDebris); iShapesDebris.removeAll(iShapesDebris); } public void addDebris(final IShape iShape) { debris.add(iShape); } public ArrayList<IShape> getDebris() { return debris; } }
3dc0e3bd0b11ed453d17671716f5fa33078ed31a
31ba6f851a6543128f6082db57d4229e5c4cf15a
/src/com/company/zhuojiaoshou/Login.java
4418d411c89ec4d9825793a18216fc32bfe854d3
[]
no_license
0lddriv3r/ChatTool
28fb8ebebce26ad3c339098cf688199c77acc31d
23f25c8dcc9df55b7304c53fd355a00cbcab67a2
refs/heads/master
2021-01-21T23:29:22.016325
2017-03-02T02:36:29
2017-03-02T02:36:29
83,625,595
0
0
null
null
null
null
UTF-8
Java
false
false
2,223
java
package com.company.zhuojiaoshou; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class Login extends JFrame implements ActionListener { private JTextField txtUser = new JTextField(); private JPasswordField txtPass = new JPasswordField(); // constructor public Login() { this.setSize(300, 125); JLabel labUser = new JLabel("UserName"); JLabel labPass = new JLabel("PassWord"); JButton btnLogin = new JButton("Login"); JButton btnRegister = new JButton("Register"); JButton btnCancel = new JButton("Cancel"); // register event listener btnLogin.addActionListener(this); btnRegister.addActionListener(this); btnCancel.addActionListener(this); // set layout of input JPanel panInput = new JPanel(); panInput.setLayout(new GridLayout(2, 2)); panInput.add(labUser); panInput.add(txtUser); panInput.add(labPass); panInput.add(txtPass); // set layout of button JPanel panButton = new JPanel(); panButton.setLayout(new FlowLayout()); panButton.add(btnLogin); panButton.add(btnRegister); panButton.add(btnCancel); // set layout of frame this.setLayout(new BorderLayout()); this.add(panInput, BorderLayout.NORTH); this.add(panButton, BorderLayout.SOUTH); this.setVisible(true); } @Override public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("Login")) { String user = txtUser.getText(); String pass = txtPass.getText(); if (user.equals("zhuojiaoshou") && pass.equals("LearnJavaWithEva")) { Main m = new Main(); m.setVisible(true); this.setVisible(false); } } if (e.getActionCommand().equals("Register")) { System.out.println("Register"); } if (e.getActionCommand().equals("Cancel")) { System.exit(0); } } public static void main(String[] args) { Login login = new Login(); } }
0d589bded06b3bb8a85b56c4a7601c140fde7462
c216ad43174b8f1df2443f65064fb38a4a365205
/AttendanceCheckIn/src/main/java/com/laughing8/attendancecheckin/view/fragment/SecondFragment.java
0f26814584f3a48b4cf4d9ce2f5caab85ee3b6c2
[]
no_license
Kent-GitHub/AttendanceCheckingSystem
b5be5ff8ea3072e7719da34845ed8c17163fe524
9756da693e9e290ee10cbca52e5f50fb30128fe6
refs/heads/master
2021-01-21T14:48:19.142741
2016-07-02T10:22:58
2016-07-02T10:23:01
58,628,812
0
0
null
null
null
null
UTF-8
Java
false
false
852
java
package com.laughing8.attendancecheckin.view.fragment; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import com.laughing8.attendancecheckin.application.MyApplication; import com.laughing8.attendancecheckin.bmobobject.MUser; import com.laughing8.attendancecheckin.view.activity.SecondActivity; /** * Created by Laughing8 on 2016/5/9. */ public class SecondFragment extends Fragment { protected SecondActivity mActivity; protected MyApplication mApplication; protected MUser mUser; @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mActivity = (SecondActivity) getActivity(); mApplication = (MyApplication) mActivity.getApplication(); mUser = mApplication.getUser(); } }
b019a363f5158d5054c749ebec98955aac7a72d4
78e7745b70643e74bc50b48697a5c22fea4a9cea
/app/src/main/java/com/cts/androidtest/activity/FactsActivity.java
dc5ddf4f93a32ae32cb149e21aac70e4dbf12e89
[]
no_license
praburajmohan/Android_Test
fb444a84d91d7bd525c783e213d77890c8448eff
21ca1fe55bd48f85e2fe46ba9ddb6d4ebcd0a513
refs/heads/master
2021-01-10T04:36:00.453005
2015-12-16T04:54:01
2015-12-16T04:54:01
48,088,192
0
0
null
null
null
null
UTF-8
Java
false
false
2,670
java
package com.cts.androidtest.activity; import android.app.ActionBar; import android.app.Activity; import android.content.Context; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.widget.ListView; import android.widget.Toast; import com.cts.androidtest.R; import com.cts.androidtest.adapter.FactsAdapter; import com.cts.androidtest.constants.FactsConstants; import com.cts.androidtest.model.FactsBean; import com.cts.androidtest.threads.FactsAsyncTask; import com.cts.androidtest.util.NetworkUtil; import java.util.ArrayList; public class FactsActivity extends Activity { private ArrayList<FactsBean> mFactsList; private ListView mFactsListView; ActionBar mActionbar = null; public FactsAdapter mFactsAdapter; private Menu optionsMenu; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_facts); mActionbar = getActionBar(); getActionBar().setIcon(new ColorDrawable(getResources().getColor(android.R.color.transparent))); int actionBarColor = getResources().getColor(R.color.colorRedActionBar); mActionbar.setBackgroundDrawable(new ColorDrawable(actionBarColor)); mFactsAdapter = new FactsAdapter(this, null); mFactsListView = (ListView) findViewById(R.id.factsListView); mFactsListView.setAdapter(mFactsAdapter); makeServiceCall(this, mActionbar, mFactsAdapter, FactsConstants.FACTS_URL); } /** * This method is used to call the facts webservice */ private void makeServiceCall(Context context, ActionBar actionBar, FactsAdapter factsAdapter, String factsUrl){ if(NetworkUtil.isOnline(FactsActivity.this)) { new FactsAsyncTask(context, actionBar, factsAdapter).execute(factsUrl); }else{ Toast.makeText(FactsActivity.this, "No network connectivity", Toast.LENGTH_SHORT).show(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { this.optionsMenu = menu; MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu, menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menuRefresh: makeServiceCall(this, mActionbar, mFactsAdapter, FactsConstants.FACTS_URL); return true; } return super.onOptionsItemSelected(item); } }
[ "lavan kumar" ]
lavan kumar
ff67a49eb901d967b7615efd702d2d392273fc69
14af42ed58e9dc3db9152763991a0f01f4903bd8
/app/src/main/java/com/example/gaahk/Activities/Data.java
e4b48d5a74144f450083477815abb133832c2600
[]
no_license
usama8620/Gaahk
678cd5b51dbfc0baf7eb1265817e48bcaf26deb8
141aa7d5945e106472dfff546a34257d7036ed85
refs/heads/master
2022-12-28T21:31:29.153774
2020-10-08T05:21:41
2020-10-08T05:21:41
302,232,636
0
0
null
null
null
null
UTF-8
Java
false
false
665
java
package com.example.gaahk.Activities; public class Data { String name; String image; String price; public Data(String name, String image, String price) { this.name = name; this.image = image; this.price = price; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getImage() { return image; } public void setImage(String image) { this.image = image; } public String getPrice() { return price; } public void setPrice(String price) { this.price = price; } }
7437ff57e31c3d26685754398b9029f808fad429
e2738dfaec459819d63056414e28c84cc64f3ea0
/src/main/java/br/com/conductor/pier/api/v2/model/EstabelecimentoPersist.java
ed0be7c43dc3770ab2b0235e3edba4249a531f82
[]
no_license
carlosmanoel/pier-sdk-java
5cd7e89da7fad1a7f164b72bf44bc0c67a00eb25
2e80f250c1900b9f25f3f1f4e76da119124955b0
refs/heads/master
2020-12-22T10:28:42.213135
2020-01-23T21:08:27
2020-01-23T21:08:27
236,751,472
1
0
null
2020-01-28T14:16:22
2020-01-28T14:16:21
null
UTF-8
Java
false
false
29,258
java
package br.com.conductor.pier.api.v2.model; import java.util.Objects; import br.com.conductor.pier.api.v2.model.ConsultaCadastroEstabelecimentoDTO; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; /** * Par\u00E2metros de requisi\u00E7\u00E3o de um estabelecimento **/ @ApiModel(description = "Par\u00E2metros de requisi\u00E7\u00E3o de um estabelecimento") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen") public class EstabelecimentoPersist { private Integer flagMatriz = null; private Long idGrupoEconomico = null; private String numeroReceitaFederal = null; private String nome = null; private String descricao = null; private String nomeFantasia = null; private String cep = null; private String nomeLogradouro = null; private Integer numeroEndereco = null; private String bairro = null; private String cidade = null; private String complemento = null; private String uf = null; private String cep2 = null; private String nomeLogradouro2 = null; private Integer numeroEndereco2 = null; private String bairro2 = null; private String cidade2 = null; private String complemento2 = null; private String uf2 = null; private String obs = null; private String contato = null; private String email = null; private Integer flagArquivoSecrFazenda = null; private Integer flagCartaoDigitado = null; private Integer inativo = null; private Long idMoeda = null; private Long idPais = null; private Integer associadoSPCBrasil = null; private Long mcc = null; private Long idTipoEstabelecimento = null; private Integer correspondencia = null; private String cargoContato = null; public enum TipoPagamentoEnum { CENTRALIZADO("CENTRALIZADO"), PV("PV"); private String value; TipoPagamentoEnum(String value) { this.value = value; } @Override @JsonValue public String toString() { return value; } } private TipoPagamentoEnum tipoPagamento = null; private ConsultaCadastroEstabelecimentoDTO consulta = null; private ConsultaCadastroEstabelecimentoDTO consulta2 = null; private ConsultaCadastroEstabelecimentoDTO consulta3 = null; private Boolean flagTerminalVirtual = null; private Boolean flagConsultaExtrato = null; /** * Indica se \u00E9 matriz ou filial **/ public EstabelecimentoPersist flagMatriz(Integer flagMatriz) { this.flagMatriz = flagMatriz; return this; } @ApiModelProperty(example = "0", value = "Indica se \u00E9 matriz ou filial") @JsonProperty("flagMatriz") public Integer getFlagMatriz() { return flagMatriz; } public void setFlagMatriz(Integer flagMatriz) { this.flagMatriz = flagMatriz; } /** * Apresenta o n\u00FAmero de identifica\u00E7\u00E3o do Grupo Econ\u00F4mico **/ public EstabelecimentoPersist idGrupoEconomico(Long idGrupoEconomico) { this.idGrupoEconomico = idGrupoEconomico; return this; } @ApiModelProperty(example = "10", value = "Apresenta o n\u00FAmero de identifica\u00E7\u00E3o do Grupo Econ\u00F4mico") @JsonProperty("idGrupoEconomico") public Long getIdGrupoEconomico() { return idGrupoEconomico; } public void setIdGrupoEconomico(Long idGrupoEconomico) { this.idGrupoEconomico = idGrupoEconomico; } /** * N\u00FAmero Receita Federal **/ public EstabelecimentoPersist numeroReceitaFederal(String numeroReceitaFederal) { this.numeroReceitaFederal = numeroReceitaFederal; return this; } @ApiModelProperty(example = "25487412547854", value = "N\u00FAmero Receita Federal") @JsonProperty("numeroReceitaFederal") public String getNumeroReceitaFederal() { return numeroReceitaFederal; } public void setNumeroReceitaFederal(String numeroReceitaFederal) { this.numeroReceitaFederal = numeroReceitaFederal; } /** * Nome do Estabelecimento **/ public EstabelecimentoPersist nome(String nome) { this.nome = nome; return this; } @ApiModelProperty(example = "Padaria Mundial LTDA", value = "Nome do Estabelecimento") @JsonProperty("nome") public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } /** * Raz\u00E3o Social do Estabelecimento **/ public EstabelecimentoPersist descricao(String descricao) { this.descricao = descricao; return this; } @ApiModelProperty(example = "Padaria Mundial", value = "Raz\u00E3o Social do Estabelecimento") @JsonProperty("descricao") public String getDescricao() { return descricao; } public void setDescricao(String descricao) { this.descricao = descricao; } /** * T\u00EDtulo Comercial do Estabelecimento **/ public EstabelecimentoPersist nomeFantasia(String nomeFantasia) { this.nomeFantasia = nomeFantasia; return this; } @ApiModelProperty(example = "Padaria Mundial", value = "T\u00EDtulo Comercial do Estabelecimento") @JsonProperty("nomeFantasia") public String getNomeFantasia() { return nomeFantasia; } public void setNomeFantasia(String nomeFantasia) { this.nomeFantasia = nomeFantasia; } /** * CEP do Estabelecimento **/ public EstabelecimentoPersist cep(String cep) { this.cep = cep; return this; } @ApiModelProperty(example = "58000000", value = "CEP do Estabelecimento") @JsonProperty("cep") public String getCep() { return cep; } public void setCep(String cep) { this.cep = cep; } /** * Nome do Logradouro **/ public EstabelecimentoPersist nomeLogradouro(String nomeLogradouro) { this.nomeLogradouro = nomeLogradouro; return this; } @ApiModelProperty(example = "Rua Antonio da Luz", value = "Nome do Logradouro") @JsonProperty("nomeLogradouro") public String getNomeLogradouro() { return nomeLogradouro; } public void setNomeLogradouro(String nomeLogradouro) { this.nomeLogradouro = nomeLogradouro; } /** * N\u00FAmero do endere\u00E7o **/ public EstabelecimentoPersist numeroEndereco(Integer numeroEndereco) { this.numeroEndereco = numeroEndereco; return this; } @ApiModelProperty(example = "3333", value = "N\u00FAmero do endere\u00E7o") @JsonProperty("numeroEndereco") public Integer getNumeroEndereco() { return numeroEndereco; } public void setNumeroEndereco(Integer numeroEndereco) { this.numeroEndereco = numeroEndereco; } /** * Nome do bairro do endere\u00E7o **/ public EstabelecimentoPersist bairro(String bairro) { this.bairro = bairro; return this; } @ApiModelProperty(example = "Centro", value = "Nome do bairro do endere\u00E7o") @JsonProperty("bairro") public String getBairro() { return bairro; } public void setBairro(String bairro) { this.bairro = bairro; } /** * Nome da cidade do endere\u00E7o **/ public EstabelecimentoPersist cidade(String cidade) { this.cidade = cidade; return this; } @ApiModelProperty(example = "João Pessoa", value = "Nome da cidade do endere\u00E7o") @JsonProperty("cidade") public String getCidade() { return cidade; } public void setCidade(String cidade) { this.cidade = cidade; } /** * Descri\u00E7\u00F5es complementares referente ao endere\u00E7o **/ public EstabelecimentoPersist complemento(String complemento) { this.complemento = complemento; return this; } @ApiModelProperty(example = "Casa", value = "Descri\u00E7\u00F5es complementares referente ao endere\u00E7o") @JsonProperty("complemento") public String getComplemento() { return complemento; } public void setComplemento(String complemento) { this.complemento = complemento; } /** * Sigla de identifica\u00E7\u00E3o da Unidade Federativa do endere\u00E7o **/ public EstabelecimentoPersist uf(String uf) { this.uf = uf; return this; } @ApiModelProperty(example = "PB", value = "Sigla de identifica\u00E7\u00E3o da Unidade Federativa do endere\u00E7o") @JsonProperty("uf") public String getUf() { return uf; } public void setUf(String uf) { this.uf = uf; } /** * Segundo CEP do estabelimento **/ public EstabelecimentoPersist cep2(String cep2) { this.cep2 = cep2; return this; } @ApiModelProperty(example = "58000000", value = "Segundo CEP do estabelimento") @JsonProperty("cep2") public String getCep2() { return cep2; } public void setCep2(String cep2) { this.cep2 = cep2; } /** * Nome do Logradouro **/ public EstabelecimentoPersist nomeLogradouro2(String nomeLogradouro2) { this.nomeLogradouro2 = nomeLogradouro2; return this; } @ApiModelProperty(example = "Rua Antonio da Luz", value = "Nome do Logradouro ") @JsonProperty("nomeLogradouro2") public String getNomeLogradouro2() { return nomeLogradouro2; } public void setNomeLogradouro2(String nomeLogradouro2) { this.nomeLogradouro2 = nomeLogradouro2; } /** * N\u00FAmero do endere\u00E7o **/ public EstabelecimentoPersist numeroEndereco2(Integer numeroEndereco2) { this.numeroEndereco2 = numeroEndereco2; return this; } @ApiModelProperty(example = "3333", value = "N\u00FAmero do endere\u00E7o") @JsonProperty("numeroEndereco2") public Integer getNumeroEndereco2() { return numeroEndereco2; } public void setNumeroEndereco2(Integer numeroEndereco2) { this.numeroEndereco2 = numeroEndereco2; } /** * Nome do bairro do endere\u00E7o **/ public EstabelecimentoPersist bairro2(String bairro2) { this.bairro2 = bairro2; return this; } @ApiModelProperty(example = "Centro", value = "Nome do bairro do endere\u00E7o") @JsonProperty("bairro2") public String getBairro2() { return bairro2; } public void setBairro2(String bairro2) { this.bairro2 = bairro2; } /** * Nome da cidade do endere\u00E7o **/ public EstabelecimentoPersist cidade2(String cidade2) { this.cidade2 = cidade2; return this; } @ApiModelProperty(example = "João Pessoa", value = "Nome da cidade do endere\u00E7o") @JsonProperty("cidade2") public String getCidade2() { return cidade2; } public void setCidade2(String cidade2) { this.cidade2 = cidade2; } /** * Descri\u00E7\u00F5es complementares referente ao endere\u00E7o **/ public EstabelecimentoPersist complemento2(String complemento2) { this.complemento2 = complemento2; return this; } @ApiModelProperty(example = "Casa", value = "Descri\u00E7\u00F5es complementares referente ao endere\u00E7o") @JsonProperty("complemento2") public String getComplemento2() { return complemento2; } public void setComplemento2(String complemento2) { this.complemento2 = complemento2; } /** * Sigla de identifica\u00E7\u00E3o da Unidade Federativa do endere\u00E7o **/ public EstabelecimentoPersist uf2(String uf2) { this.uf2 = uf2; return this; } @ApiModelProperty(example = "PB", value = "Sigla de identifica\u00E7\u00E3o da Unidade Federativa do endere\u00E7o") @JsonProperty("uf2") public String getUf2() { return uf2; } public void setUf2(String uf2) { this.uf2 = uf2; } /** * Detalhes espec\u00EDficos quanto ao Cadastro do Estabelecimento **/ public EstabelecimentoPersist obs(String obs) { this.obs = obs; return this; } @ApiModelProperty(example = "responsavel", value = "Detalhes espec\u00EDficos quanto ao Cadastro do Estabelecimento") @JsonProperty("obs") public String getObs() { return obs; } public void setObs(String obs) { this.obs = obs; } /** * Nome da pessoa para contato com o Estabelecimento **/ public EstabelecimentoPersist contato(String contato) { this.contato = contato; return this; } @ApiModelProperty(example = "Arnaldo", value = "Nome da pessoa para contato com o Estabelecimento") @JsonProperty("contato") public String getContato() { return contato; } public void setContato(String contato) { this.contato = contato; } /** * E-mail da pessoa para contato com o Estabelecimento **/ public EstabelecimentoPersist email(String email) { this.email = email; return this; } @ApiModelProperty(example = "[email protected]", value = "E-mail da pessoa para contato com o Estabelecimento") @JsonProperty("email") public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } /** * Indica se o estabelecimento ser\u00E1 inclu\u00EDdo no arquivo de registro para a Secretaria da Fazenda Estadual **/ public EstabelecimentoPersist flagArquivoSecrFazenda(Integer flagArquivoSecrFazenda) { this.flagArquivoSecrFazenda = flagArquivoSecrFazenda; return this; } @ApiModelProperty(example = "null", value = "Indica se o estabelecimento ser\u00E1 inclu\u00EDdo no arquivo de registro para a Secretaria da Fazenda Estadual") @JsonProperty("flagArquivoSecrFazenda") public Integer getFlagArquivoSecrFazenda() { return flagArquivoSecrFazenda; } public void setFlagArquivoSecrFazenda(Integer flagArquivoSecrFazenda) { this.flagArquivoSecrFazenda = flagArquivoSecrFazenda; } /** * Indica se o estabelecimento poder\u00E1 originar transa\u00E7\u00F5es sem a leitura da tarja ou do chip do cart\u00E3o **/ public EstabelecimentoPersist flagCartaoDigitado(Integer flagCartaoDigitado) { this.flagCartaoDigitado = flagCartaoDigitado; return this; } @ApiModelProperty(example = "null", value = "Indica se o estabelecimento poder\u00E1 originar transa\u00E7\u00F5es sem a leitura da tarja ou do chip do cart\u00E3o") @JsonProperty("flagCartaoDigitado") public Integer getFlagCartaoDigitado() { return flagCartaoDigitado; } public void setFlagCartaoDigitado(Integer flagCartaoDigitado) { this.flagCartaoDigitado = flagCartaoDigitado; } /** * Indica se o estabelecimento est\u00E1 inativo **/ public EstabelecimentoPersist inativo(Integer inativo) { this.inativo = inativo; return this; } @ApiModelProperty(example = "1", value = "Indica se o estabelecimento est\u00E1 inativo") @JsonProperty("inativo") public Integer getInativo() { return inativo; } public void setInativo(Integer inativo) { this.inativo = inativo; } /** * C\u00F3digo identificador da moeda **/ public EstabelecimentoPersist idMoeda(Long idMoeda) { this.idMoeda = idMoeda; return this; } @ApiModelProperty(example = "425", value = "C\u00F3digo identificador da moeda") @JsonProperty("idMoeda") public Long getIdMoeda() { return idMoeda; } public void setIdMoeda(Long idMoeda) { this.idMoeda = idMoeda; } /** * Identificador de Pa\u00EDs **/ public EstabelecimentoPersist idPais(Long idPais) { this.idPais = idPais; return this; } @ApiModelProperty(example = "31", value = "Identificador de Pa\u00EDs") @JsonProperty("idPais") public Long getIdPais() { return idPais; } public void setIdPais(Long idPais) { this.idPais = idPais; } /** * N\u00FAmero do associado ao SPCBrasil **/ public EstabelecimentoPersist associadoSPCBrasil(Integer associadoSPCBrasil) { this.associadoSPCBrasil = associadoSPCBrasil; return this; } @ApiModelProperty(example = "17", value = "N\u00FAmero do associado ao SPCBrasil") @JsonProperty("associadoSPCBrasil") public Integer getAssociadoSPCBrasil() { return associadoSPCBrasil; } public void setAssociadoSPCBrasil(Integer associadoSPCBrasil) { this.associadoSPCBrasil = associadoSPCBrasil; } /** * C\u00F3digo de Categoria de Mercado **/ public EstabelecimentoPersist mcc(Long mcc) { this.mcc = mcc; return this; } @ApiModelProperty(example = "9950", value = "C\u00F3digo de Categoria de Mercado") @JsonProperty("mcc") public Long getMcc() { return mcc; } public void setMcc(Long mcc) { this.mcc = mcc; } /** * C\u00F3digo de identifica\u00E7\u00E3o do tipo de Estabelecimento **/ public EstabelecimentoPersist idTipoEstabelecimento(Long idTipoEstabelecimento) { this.idTipoEstabelecimento = idTipoEstabelecimento; return this; } @ApiModelProperty(example = "1", value = "C\u00F3digo de identifica\u00E7\u00E3o do tipo de Estabelecimento") @JsonProperty("idTipoEstabelecimento") public Long getIdTipoEstabelecimento() { return idTipoEstabelecimento; } public void setIdTipoEstabelecimento(Long idTipoEstabelecimento) { this.idTipoEstabelecimento = idTipoEstabelecimento; } /** * Indicador para qual endere\u00E7o as correspond\u00EAncias ser\u00E3o enviadas, onde 1 \u00E9 ORIGEM e 2 ENDERE\u00C7O DE CORRESPOND\u00CANCIA **/ public EstabelecimentoPersist correspondencia(Integer correspondencia) { this.correspondencia = correspondencia; return this; } @ApiModelProperty(example = "1", value = "Indicador para qual endere\u00E7o as correspond\u00EAncias ser\u00E3o enviadas, onde 1 \u00E9 ORIGEM e 2 ENDERE\u00C7O DE CORRESPOND\u00CANCIA") @JsonProperty("correspondencia") public Integer getCorrespondencia() { return correspondencia; } public void setCorrespondencia(Integer correspondencia) { this.correspondencia = correspondencia; } /** * Cargo do contato do estabelecimento **/ public EstabelecimentoPersist cargoContato(String cargoContato) { this.cargoContato = cargoContato; return this; } @ApiModelProperty(example = "Vendedor", value = "Cargo do contato do estabelecimento") @JsonProperty("cargoContato") public String getCargoContato() { return cargoContato; } public void setCargoContato(String cargoContato) { this.cargoContato = cargoContato; } /** * Tipo do regime de pagamento do estabelecimento **/ public EstabelecimentoPersist tipoPagamento(TipoPagamentoEnum tipoPagamento) { this.tipoPagamento = tipoPagamento; return this; } @ApiModelProperty(example = "CENTRALIZADO", value = "Tipo do regime de pagamento do estabelecimento") @JsonProperty("tipoPagamento") public TipoPagamentoEnum getTipoPagamento() { return tipoPagamento; } public void setTipoPagamento(TipoPagamentoEnum tipoPagamento) { this.tipoPagamento = tipoPagamento; } /** * Consulta de cadastro n\u00FAmero um **/ public EstabelecimentoPersist consulta(ConsultaCadastroEstabelecimentoDTO consulta) { this.consulta = consulta; return this; } @ApiModelProperty(example = "null", value = "Consulta de cadastro n\u00FAmero um") @JsonProperty("consulta") public ConsultaCadastroEstabelecimentoDTO getConsulta() { return consulta; } public void setConsulta(ConsultaCadastroEstabelecimentoDTO consulta) { this.consulta = consulta; } /** * Consulta de cadastro n\u00FAmero dois **/ public EstabelecimentoPersist consulta2(ConsultaCadastroEstabelecimentoDTO consulta2) { this.consulta2 = consulta2; return this; } @ApiModelProperty(example = "null", value = "Consulta de cadastro n\u00FAmero dois") @JsonProperty("consulta2") public ConsultaCadastroEstabelecimentoDTO getConsulta2() { return consulta2; } public void setConsulta2(ConsultaCadastroEstabelecimentoDTO consulta2) { this.consulta2 = consulta2; } /** * Consulta de cadastro n\u00FAmero tr\u00EAs **/ public EstabelecimentoPersist consulta3(ConsultaCadastroEstabelecimentoDTO consulta3) { this.consulta3 = consulta3; return this; } @ApiModelProperty(example = "null", value = "Consulta de cadastro n\u00FAmero tr\u00EAs") @JsonProperty("consulta3") public ConsultaCadastroEstabelecimentoDTO getConsulta3() { return consulta3; } public void setConsulta3(ConsultaCadastroEstabelecimentoDTO consulta3) { this.consulta3 = consulta3; } /** * Flag indicando se o terminal \u00E9 f\u00EDsico ou virtual, sendo: (true: Sim), (false: N\u00E3o)) **/ public EstabelecimentoPersist flagTerminalVirtual(Boolean flagTerminalVirtual) { this.flagTerminalVirtual = flagTerminalVirtual; return this; } @ApiModelProperty(example = "false", required = true, value = "Flag indicando se o terminal \u00E9 f\u00EDsico ou virtual, sendo: (true: Sim), (false: N\u00E3o))") @JsonProperty("flagTerminalVirtual") public Boolean getFlagTerminalVirtual() { return flagTerminalVirtual; } public void setFlagTerminalVirtual(Boolean flagTerminalVirtual) { this.flagTerminalVirtual = flagTerminalVirtual; } /** * Flag indicando se o terminal permite consultar extrato, sendo: (true: Sim), (false: N\u00E3o)) **/ public EstabelecimentoPersist flagConsultaExtrato(Boolean flagConsultaExtrato) { this.flagConsultaExtrato = flagConsultaExtrato; return this; } @ApiModelProperty(example = "false", required = true, value = "Flag indicando se o terminal permite consultar extrato, sendo: (true: Sim), (false: N\u00E3o))") @JsonProperty("flagConsultaExtrato") public Boolean getFlagConsultaExtrato() { return flagConsultaExtrato; } public void setFlagConsultaExtrato(Boolean flagConsultaExtrato) { this.flagConsultaExtrato = flagConsultaExtrato; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } EstabelecimentoPersist estabelecimentoPersist = (EstabelecimentoPersist) o; return Objects.equals(this.flagMatriz, estabelecimentoPersist.flagMatriz) && Objects.equals(this.idGrupoEconomico, estabelecimentoPersist.idGrupoEconomico) && Objects.equals(this.numeroReceitaFederal, estabelecimentoPersist.numeroReceitaFederal) && Objects.equals(this.nome, estabelecimentoPersist.nome) && Objects.equals(this.descricao, estabelecimentoPersist.descricao) && Objects.equals(this.nomeFantasia, estabelecimentoPersist.nomeFantasia) && Objects.equals(this.cep, estabelecimentoPersist.cep) && Objects.equals(this.nomeLogradouro, estabelecimentoPersist.nomeLogradouro) && Objects.equals(this.numeroEndereco, estabelecimentoPersist.numeroEndereco) && Objects.equals(this.bairro, estabelecimentoPersist.bairro) && Objects.equals(this.cidade, estabelecimentoPersist.cidade) && Objects.equals(this.complemento, estabelecimentoPersist.complemento) && Objects.equals(this.uf, estabelecimentoPersist.uf) && Objects.equals(this.cep2, estabelecimentoPersist.cep2) && Objects.equals(this.nomeLogradouro2, estabelecimentoPersist.nomeLogradouro2) && Objects.equals(this.numeroEndereco2, estabelecimentoPersist.numeroEndereco2) && Objects.equals(this.bairro2, estabelecimentoPersist.bairro2) && Objects.equals(this.cidade2, estabelecimentoPersist.cidade2) && Objects.equals(this.complemento2, estabelecimentoPersist.complemento2) && Objects.equals(this.uf2, estabelecimentoPersist.uf2) && Objects.equals(this.obs, estabelecimentoPersist.obs) && Objects.equals(this.contato, estabelecimentoPersist.contato) && Objects.equals(this.email, estabelecimentoPersist.email) && Objects.equals(this.flagArquivoSecrFazenda, estabelecimentoPersist.flagArquivoSecrFazenda) && Objects.equals(this.flagCartaoDigitado, estabelecimentoPersist.flagCartaoDigitado) && Objects.equals(this.inativo, estabelecimentoPersist.inativo) && Objects.equals(this.idMoeda, estabelecimentoPersist.idMoeda) && Objects.equals(this.idPais, estabelecimentoPersist.idPais) && Objects.equals(this.associadoSPCBrasil, estabelecimentoPersist.associadoSPCBrasil) && Objects.equals(this.mcc, estabelecimentoPersist.mcc) && Objects.equals(this.idTipoEstabelecimento, estabelecimentoPersist.idTipoEstabelecimento) && Objects.equals(this.correspondencia, estabelecimentoPersist.correspondencia) && Objects.equals(this.cargoContato, estabelecimentoPersist.cargoContato) && Objects.equals(this.tipoPagamento, estabelecimentoPersist.tipoPagamento) && Objects.equals(this.consulta, estabelecimentoPersist.consulta) && Objects.equals(this.consulta2, estabelecimentoPersist.consulta2) && Objects.equals(this.consulta3, estabelecimentoPersist.consulta3) && Objects.equals(this.flagTerminalVirtual, estabelecimentoPersist.flagTerminalVirtual) && Objects.equals(this.flagConsultaExtrato, estabelecimentoPersist.flagConsultaExtrato); } @Override public int hashCode() { return Objects.hash(flagMatriz, idGrupoEconomico, numeroReceitaFederal, nome, descricao, nomeFantasia, cep, nomeLogradouro, numeroEndereco, bairro, cidade, complemento, uf, cep2, nomeLogradouro2, numeroEndereco2, bairro2, cidade2, complemento2, uf2, obs, contato, email, flagArquivoSecrFazenda, flagCartaoDigitado, inativo, idMoeda, idPais, associadoSPCBrasil, mcc, idTipoEstabelecimento, correspondencia, cargoContato, tipoPagamento, consulta, consulta2, consulta3, flagTerminalVirtual, flagConsultaExtrato); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class EstabelecimentoPersist {\n"); sb.append(" flagMatriz: ").append(toIndentedString(flagMatriz)).append("\n"); sb.append(" idGrupoEconomico: ").append(toIndentedString(idGrupoEconomico)).append("\n"); sb.append(" numeroReceitaFederal: ").append(toIndentedString(numeroReceitaFederal)).append("\n"); sb.append(" nome: ").append(toIndentedString(nome)).append("\n"); sb.append(" descricao: ").append(toIndentedString(descricao)).append("\n"); sb.append(" nomeFantasia: ").append(toIndentedString(nomeFantasia)).append("\n"); sb.append(" cep: ").append(toIndentedString(cep)).append("\n"); sb.append(" nomeLogradouro: ").append(toIndentedString(nomeLogradouro)).append("\n"); sb.append(" numeroEndereco: ").append(toIndentedString(numeroEndereco)).append("\n"); sb.append(" bairro: ").append(toIndentedString(bairro)).append("\n"); sb.append(" cidade: ").append(toIndentedString(cidade)).append("\n"); sb.append(" complemento: ").append(toIndentedString(complemento)).append("\n"); sb.append(" uf: ").append(toIndentedString(uf)).append("\n"); sb.append(" cep2: ").append(toIndentedString(cep2)).append("\n"); sb.append(" nomeLogradouro2: ").append(toIndentedString(nomeLogradouro2)).append("\n"); sb.append(" numeroEndereco2: ").append(toIndentedString(numeroEndereco2)).append("\n"); sb.append(" bairro2: ").append(toIndentedString(bairro2)).append("\n"); sb.append(" cidade2: ").append(toIndentedString(cidade2)).append("\n"); sb.append(" complemento2: ").append(toIndentedString(complemento2)).append("\n"); sb.append(" uf2: ").append(toIndentedString(uf2)).append("\n"); sb.append(" obs: ").append(toIndentedString(obs)).append("\n"); sb.append(" contato: ").append(toIndentedString(contato)).append("\n"); sb.append(" email: ").append(toIndentedString(email)).append("\n"); sb.append(" flagArquivoSecrFazenda: ").append(toIndentedString(flagArquivoSecrFazenda)).append("\n"); sb.append(" flagCartaoDigitado: ").append(toIndentedString(flagCartaoDigitado)).append("\n"); sb.append(" inativo: ").append(toIndentedString(inativo)).append("\n"); sb.append(" idMoeda: ").append(toIndentedString(idMoeda)).append("\n"); sb.append(" idPais: ").append(toIndentedString(idPais)).append("\n"); sb.append(" associadoSPCBrasil: ").append(toIndentedString(associadoSPCBrasil)).append("\n"); sb.append(" mcc: ").append(toIndentedString(mcc)).append("\n"); sb.append(" idTipoEstabelecimento: ").append(toIndentedString(idTipoEstabelecimento)).append("\n"); sb.append(" correspondencia: ").append(toIndentedString(correspondencia)).append("\n"); sb.append(" cargoContato: ").append(toIndentedString(cargoContato)).append("\n"); sb.append(" tipoPagamento: ").append(toIndentedString(tipoPagamento)).append("\n"); sb.append(" consulta: ").append(toIndentedString(consulta)).append("\n"); sb.append(" consulta2: ").append(toIndentedString(consulta2)).append("\n"); sb.append(" consulta3: ").append(toIndentedString(consulta3)).append("\n"); sb.append(" flagTerminalVirtual: ").append(toIndentedString(flagTerminalVirtual)).append("\n"); sb.append(" flagConsultaExtrato: ").append(toIndentedString(flagConsultaExtrato)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
6e43b9cfee1e8d31a2368de2a7b09b78b059815c
da181f89e0b26ffb3fc5f9670a3a5f8f1ccf0884
/BackGestionTextilLevel/src/ar/com/textillevel/gui/util/panels/PanSelectedFloatFromComboOrTextField.java
e381a4507344324522ec3da8be0001b2a4a60ccb
[]
no_license
nacho270/GTL
a1b14b5c95f14ee758e6b458de28eae3890c60e1
7909ed10fb14e24b1536e433546399afb9891467
refs/heads/master
2021-01-23T15:04:13.971161
2020-09-18T00:58:24
2020-09-18T00:58:24
34,962,369
2
1
null
2016-08-22T22:12:57
2015-05-02T20:31:49
Java
UTF-8
Java
false
false
873
java
package ar.com.textillevel.gui.util.panels; import java.util.List; import javax.swing.JTextField; import ar.com.textillevel.gui.util.controles.DecimalNumericTextField; public class PanSelectedFloatFromComboOrTextField extends PanSelectElementFromComboOrTextField<Float> { private static final long serialVersionUID = -2556677628133015664L; public PanSelectedFloatFromComboOrTextField(String titleCombo, List<Float> items) { super(titleCombo, items); } @Override protected JTextField createTextField() { return new DecimalNumericTextField(); } @Override protected Float extractValueFromTextField() { return ((DecimalNumericTextField)getTextField()).getValue(); } @Override protected void setValueInTextField(Float selectedItem) { ((DecimalNumericTextField)getTextField()).setValue(new Double(selectedItem)); } }
[ "[email protected]@9de48aec-ec99-11dd-b2d9-215335d0b316" ]
[email protected]@9de48aec-ec99-11dd-b2d9-215335d0b316
1cbdc67169f365f86a0a556a1170c64804dc3865
ddf6c4c84e5a7119bfcaf6b564e3c624c17b02f8
/CafePos/src/com/minssam/cafepos/model/domain/Topcategory.java
c1cc793167e1aa1f0155961cf3619393f9de6a38
[]
no_license
bang-93/JAVA_APP
4c3d880d5afb070109239164d39f527db6bf3205
d1279832fac19483ff02038429a10325cb4b7478
refs/heads/master
2023-05-29T10:47:58.615049
2021-06-11T08:36:38
2021-06-11T08:36:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
711
java
package com.minssam.cafepos.model.domain; // 이 객체는 로직을 작성하기위한 용도가 아니라, Topcategory 테이블의 레코드를 담기위한, // 데이터를 담기위한 객체이다. 이러한 용도의 객체를 가리켜 설계분야에서는 VO(Value Object)라 한다 // js 의 JSON의 역할과 비슷하다 public class Topcategory { private int topcategory_id; private String top_name; public int getTopcategory_id() { return topcategory_id; } public void setTopcategory_id(int topcategory_id) { this.topcategory_id = topcategory_id; } public String getTop_name() { return top_name; } public void setTop_name(String top_name) { this.top_name = top_name; } }
418a6f16249acfe3902197911364b945108a5d4e
8bb9cbca395976f7bfa56563d772b1456446906e
/jOOQ-meta/src/main/java/org/jooq/meta/xml/XMLDatabase.java
57a390b63be9245d4d0579354ea6194a22f5f331
[ "Apache-2.0" ]
permissive
linqtosql/jOOQ
2121d3d76b75c4c1721806bf86dbcdc69e710ddf
5e780aad315f077a3c4e5e9cebc3f9fe2e1a208b
refs/heads/master
2020-04-10T20:30:59.830292
2018-12-10T11:45:42
2018-12-10T11:45:42
161,270,393
0
1
NOASSERTION
2018-12-11T03:16:01
2018-12-11T03:16:01
null
UTF-8
Java
false
false
24,227
java
/* * 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. * * Other licenses: * ----------------------------------------------------------------------------- * Commercial licenses for this work are available. These replace the above * ASL 2.0 and offer limited warranties, support, maintenance, and commercial * database integrations. * * For more information, please visit: http://www.jooq.org/licenses * * * * * * * * * * * * * * * * */ package org.jooq.meta.xml; import static org.jooq.impl.DSL.name; import static org.jooq.tools.StringUtils.defaultIfBlank; import static org.jooq.tools.StringUtils.defaultIfNull; import static org.jooq.tools.StringUtils.isBlank; import static org.jooq.util.xml.jaxb.TableConstraintType.PRIMARY_KEY; import static org.jooq.util.xml.jaxb.TableConstraintType.UNIQUE; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.io.RandomAccessFile; import java.io.StringReader; import java.io.StringWriter; import java.io.UnsupportedEncodingException; import java.net.URL; import java.sql.SQLException; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; import javax.xml.bind.JAXB; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import org.jooq.Constants; import org.jooq.DSLContext; import org.jooq.Name; import org.jooq.SQLDialect; import org.jooq.SortOrder; import org.jooq.conf.MiniJAXB; import org.jooq.exception.ExceptionTools; import org.jooq.impl.DSL; import org.jooq.meta.AbstractDatabase; import org.jooq.meta.AbstractIndexDefinition; import org.jooq.meta.ArrayDefinition; import org.jooq.meta.CatalogDefinition; import org.jooq.meta.ColumnDefinition; import org.jooq.meta.DataTypeDefinition; import org.jooq.meta.DefaultDataTypeDefinition; import org.jooq.meta.DefaultIndexColumnDefinition; import org.jooq.meta.DefaultRelations; import org.jooq.meta.DefaultSequenceDefinition; import org.jooq.meta.DomainDefinition; import org.jooq.meta.EnumDefinition; import org.jooq.meta.IndexColumnDefinition; import org.jooq.meta.IndexDefinition; import org.jooq.meta.PackageDefinition; import org.jooq.meta.RoutineDefinition; import org.jooq.meta.SchemaDefinition; import org.jooq.meta.SequenceDefinition; import org.jooq.meta.TableDefinition; import org.jooq.meta.UDTDefinition; import org.jooq.tools.JooqLogger; import org.jooq.tools.StringUtils; import org.jooq.util.xml.jaxb.Index; import org.jooq.util.xml.jaxb.IndexColumnUsage; import org.jooq.util.xml.jaxb.InformationSchema; import org.jooq.util.xml.jaxb.KeyColumnUsage; import org.jooq.util.xml.jaxb.ReferentialConstraint; import org.jooq.util.xml.jaxb.Routine; import org.jooq.util.xml.jaxb.Schema; import org.jooq.util.xml.jaxb.Sequence; import org.jooq.util.xml.jaxb.Table; import org.jooq.util.xml.jaxb.TableConstraint; import org.jooq.util.xml.jaxb.TableConstraintType; /** * The XML Database. * * @author Lukas Eder */ public class XMLDatabase extends AbstractDatabase { private static final JooqLogger log = JooqLogger.getLogger(XMLDatabase.class); /** * The property name for the XML file */ public static final String P_XML_FILE = "xml-file"; /** * The property name for the XSL file that pre-processes the XML file */ public static final String P_XSL_FILE = "xsl-file"; /** * The property name for the dialect name */ public static final String P_DIALECT = "dialect"; InformationSchema info; private InformationSchema info() { if (info == null) { String xml = getProperties().getProperty(P_XML_FILE); String xsl = getProperties().getProperty(P_XSL_FILE); log.info("Using XML file", xml); try { String content; if (StringUtils.isBlank(xsl)) { RandomAccessFile f = null; try { URL url = XMLDatabase.class.getResource(xml); File file = url != null ? new File(url.toURI()) : new File(xml); f = new RandomAccessFile(file, "r"); byte[] bytes = new byte[(int) f.length()]; f.readFully(bytes); // [#7414] Default to reading UTF-8 content = new String(bytes, "UTF-8"); // [#7414] Alternatively, read the encoding from the XML file try { XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader( new StringReader(content) ); String encoding = reader.getCharacterEncodingScheme(); // Returned encoding can be null in the presence of a BOM // See https://stackoverflow.com/a/27147259/521799 if (encoding != null && !"UTF-8".equals(encoding)) content = new String(bytes, encoding); } catch (XMLStreamException e) { log.warn("Could not open XML Stream: " + e.getMessage()); } catch (UnsupportedEncodingException e) { log.warn("Unsupported encoding: " + e.getMessage()); } } finally { if (f != null) { try { f.close(); } catch (Exception ignore) {} } } } else { InputStream xmlIs = null; InputStream xslIs = null; try { log.info("Using XSL file", xsl); xmlIs = XMLDatabase.class.getResourceAsStream(xml); if (xmlIs == null) xmlIs = new FileInputStream(xml); xslIs = XMLDatabase.class.getResourceAsStream(xsl); if (xslIs == null) xslIs = new FileInputStream(xsl); StringWriter writer = new StringWriter(); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(new StreamSource(xslIs)); transformer.transform(new StreamSource(xmlIs), new StreamResult(writer)); content = writer.getBuffer().toString(); } catch (TransformerException e) { throw new RuntimeException("Error while transforming XML file " + xml + " with XSL file " + xsl, e); } finally { if (xmlIs != null) { try { xmlIs.close(); } catch (Exception ignore) {} } if (xslIs != null) { try { xslIs.close(); } catch (Exception ignore) {} } } } // TODO [#1201] Add better error handling here content = content.replaceAll( "<(\\w+:)?information_schema xmlns(:\\w+)?=\"http://www.jooq.org/xsd/jooq-meta-\\d+\\.\\d+\\.\\d+.xsd\">", "<$1information_schema xmlns$2=\"" + Constants.NS_META + "\">"); content = content.replace( "<information_schema>", "<information_schema xmlns=\"" + Constants.NS_META + "\">"); // [#7579] [#8044] Workaround for obscure JAXB bug on JDK 9+ content = MiniJAXB.jaxbNamespaceBugWorkaround(content, new InformationSchema()); try { info = JAXB.unmarshal(new StringReader(content), InformationSchema.class); } catch (Throwable t) { if (ExceptionTools.getCause(t, ClassNotFoundException.class) != null || ExceptionTools.getCause(t, Error.class) != null) { info = MiniJAXB.unmarshal(content, InformationSchema.class); } else throw t; } } catch (Exception e) { throw new RuntimeException("Error while opening files " + xml + " or " + xsl, e); } } return info; } @Override protected DSLContext create0() { SQLDialect dialect = SQLDialect.DEFAULT; try { dialect = SQLDialect.valueOf(getProperties().getProperty(P_DIALECT)); } catch (Exception ignore) {} // [#6493] Data types are better discovered from the family, not the dialect. This affects the XMLDatabase, // for instance. Other databases are currently not affected by the family / dialect distinction return DSL.using(dialect.family()); } @Override protected List<IndexDefinition> getIndexes0() throws SQLException { List<IndexDefinition> result = new ArrayList<IndexDefinition>(); final Map<Name, SortedSet<IndexColumnUsage>> indexColumnUsage = new HashMap<Name, SortedSet<IndexColumnUsage>>(); for (IndexColumnUsage ic : info().getIndexColumnUsages()) { Name name = name(ic.getIndexCatalog(), ic.getIndexSchema(), ic.getTableName(), ic.getIndexName()); SortedSet<IndexColumnUsage> list = indexColumnUsage.get(name); if (list == null) { list = new TreeSet<IndexColumnUsage>(new Comparator<IndexColumnUsage>() { @Override public int compare(IndexColumnUsage o1, IndexColumnUsage o2) { int r = 0; r = defaultIfNull(o1.getIndexCatalog(), "").compareTo(defaultIfNull(o2.getIndexCatalog(), "")); if (r != 0) return r; r = defaultIfNull(o1.getIndexSchema(), "").compareTo(defaultIfNull(o2.getIndexSchema(), "")); if (r != 0) return r; r = defaultIfNull(o1.getTableName(), "").compareTo(defaultIfNull(o2.getTableName(), "")); if (r != 0) return r; r = defaultIfNull(o1.getIndexName(), "").compareTo(defaultIfNull(o2.getIndexName(), "")); if (r != 0) return r; return Integer.valueOf(o1.getOrdinalPosition()).compareTo(o2.getOrdinalPosition()); } }); indexColumnUsage.put(name, list); } list.add(ic); } indexLoop: for (Index i : info().getIndexes()) { if (getInputSchemata().contains(i.getTableSchema())) { final SchemaDefinition schema = getSchema(i.getTableSchema()); final TableDefinition table = getTable(schema, i.getTableName()); if (table == null) continue indexLoop; final Name name = name(i.getIndexCatalog(), i.getIndexSchema(), i.getTableName(), i.getIndexName()); IndexDefinition index = new AbstractIndexDefinition(schema, i.getIndexName(), table, Boolean.TRUE.equals(i.isIsUnique()), i.getComment()) { private final List<IndexColumnDefinition> indexColumns; { indexColumns = new ArrayList<IndexColumnDefinition>(); SortedSet<IndexColumnUsage> list = indexColumnUsage.get(name); if (list != null) for (IndexColumnUsage ic : list) { ColumnDefinition column = table.getColumn(ic.getColumnName()); if (column != null) indexColumns.add(new DefaultIndexColumnDefinition( this, column, Boolean.TRUE.equals(ic.isIsDescending()) ? SortOrder.DESC : SortOrder.ASC, ic.getOrdinalPosition() )); else log.error(String.format("Column %s not found in table %s.", ic.getColumnName(), table)); } else log.error(String.format("No columns found for index %s.", name)); } @Override protected List<IndexColumnDefinition> getIndexColumns0() { return indexColumns; } }; result.add(index); } } return result; } @Override protected void loadPrimaryKeys(DefaultRelations relations) { for (KeyColumnUsage usage : keyColumnUsage(PRIMARY_KEY)) { SchemaDefinition schema = getSchema(usage.getConstraintSchema()); String key = usage.getConstraintName(); String tableName = usage.getTableName(); String columnName = usage.getColumnName(); TableDefinition table = getTable(schema, tableName); if (table != null) relations.addPrimaryKey(key, table, table.getColumn(columnName)); } } @Override protected void loadUniqueKeys(DefaultRelations relations) { for (KeyColumnUsage usage : keyColumnUsage(UNIQUE)) { SchemaDefinition schema = getSchema(usage.getConstraintSchema()); String key = usage.getConstraintName(); String tableName = usage.getTableName(); String columnName = usage.getColumnName(); TableDefinition table = getTable(schema, tableName); if (table != null) relations.addUniqueKey(key, table, table.getColumn(columnName)); } } private List<KeyColumnUsage> keyColumnUsage(TableConstraintType constraintType) { List<KeyColumnUsage> result = new ArrayList<KeyColumnUsage>(); for (TableConstraint constraint : info().getTableConstraints()) if (constraintType == constraint.getConstraintType() && getInputSchemata().contains(constraint.getConstraintSchema())) for (KeyColumnUsage usage : info().getKeyColumnUsages()) if ( StringUtils.equals(constraint.getConstraintCatalog(), usage.getConstraintCatalog()) && StringUtils.equals(constraint.getConstraintSchema(), usage.getConstraintSchema()) && StringUtils.equals(constraint.getConstraintName(), usage.getConstraintName())) result.add(usage); Collections.sort(result, new Comparator<KeyColumnUsage>() { @Override public int compare(KeyColumnUsage o1, KeyColumnUsage o2) { int r = 0; r = defaultIfNull(o1.getConstraintCatalog(), "").compareTo(defaultIfNull(o2.getConstraintCatalog(), "")); if (r != 0) return r; r = defaultIfNull(o1.getConstraintSchema(), "").compareTo(defaultIfNull(o2.getConstraintSchema(), "")); if (r != 0) return r; r = defaultIfNull(o1.getConstraintName(), "").compareTo(defaultIfNull(o2.getConstraintName(), "")); if (r != 0) return r; return Integer.valueOf(o1.getOrdinalPosition()).compareTo(o2.getOrdinalPosition()); } }); return result; } @Override protected void loadForeignKeys(DefaultRelations relations) { for (ReferentialConstraint fk : info().getReferentialConstraints()) { if (getInputSchemata().contains(fk.getConstraintSchema())) { for (KeyColumnUsage usage : info().getKeyColumnUsages()) { if ( StringUtils.equals(fk.getConstraintCatalog(), usage.getConstraintCatalog()) && StringUtils.equals(fk.getConstraintSchema(), usage.getConstraintSchema()) && StringUtils.equals(fk.getConstraintName(), usage.getConstraintName())) { SchemaDefinition foreignKeySchema = getSchema(fk.getConstraintSchema()); SchemaDefinition uniqueKeySchema = getSchema(fk.getUniqueConstraintSchema()); String foreignKey = usage.getConstraintName(); String foreignKeyTableName = usage.getTableName(); String foreignKeyColumn = usage.getColumnName(); String uniqueKey = fk.getUniqueConstraintName(); String uniqueKeyTableName = null; for (TableConstraint uk : info().getTableConstraints()) { if ( StringUtils.equals(fk.getUniqueConstraintCatalog(), uk.getConstraintCatalog()) && StringUtils.equals(fk.getUniqueConstraintSchema(), uk.getConstraintSchema()) && StringUtils.equals(fk.getUniqueConstraintName(), uk.getConstraintName())) { uniqueKeyTableName = uk.getTableName(); break; } } TableDefinition foreignKeyTable = getTable(foreignKeySchema, foreignKeyTableName); TableDefinition uniqueKeyTable = getTable(uniqueKeySchema, uniqueKeyTableName); if (foreignKeyTable != null && uniqueKeyTable != null) relations.addForeignKey( foreignKey, foreignKeyTable, foreignKeyTable.getColumn(foreignKeyColumn), uniqueKey, uniqueKeyTable ); } } } } } @Override protected void loadCheckConstraints(DefaultRelations r) { } @Override protected List<CatalogDefinition> getCatalogs0() throws SQLException { List<CatalogDefinition> result = new ArrayList<CatalogDefinition>(); result.add(new CatalogDefinition(this, "", "")); return result; } @Override protected List<SchemaDefinition> getSchemata0() { List<SchemaDefinition> result = new ArrayList<SchemaDefinition>(); for (Schema schema : info().getSchemata()) { result.add(new SchemaDefinition(this, schema.getSchemaName(), schema.getComment())); } return result; } @Override protected List<SequenceDefinition> getSequences0() { List<SequenceDefinition> result = new ArrayList<SequenceDefinition>(); for (Sequence sequence : info().getSequences()) { if (getInputSchemata().contains(sequence.getSequenceSchema())) { SchemaDefinition schema = getSchema(sequence.getSequenceSchema()); DataTypeDefinition type = new DefaultDataTypeDefinition( this, schema, sequence.getDataType(), sequence.getCharacterMaximumLength(), sequence.getNumericPrecision(), sequence.getNumericScale(), false, (String) null ); result.add(new DefaultSequenceDefinition(schema, sequence.getSequenceName(), type, sequence.getComment())); } } return result; } @Override protected List<TableDefinition> getTables0() { List<TableDefinition> result = new ArrayList<TableDefinition>(); for (Table table : info().getTables()) { if (getInputSchemata().contains(table.getTableSchema())) { SchemaDefinition schema = getSchema(table.getTableSchema()); result.add(new XMLTableDefinition(schema, info(), table, table.getComment())); } } return result; } @Override protected List<EnumDefinition> getEnums0() { List<EnumDefinition> result = new ArrayList<EnumDefinition>(); return result; } @Override protected List<DomainDefinition> getDomains0() throws SQLException { List<DomainDefinition> result = new ArrayList<DomainDefinition>(); return result; } @Override protected List<UDTDefinition> getUDTs0() { List<UDTDefinition> result = new ArrayList<UDTDefinition>(); return result; } @Override protected List<ArrayDefinition> getArrays0() { List<ArrayDefinition> result = new ArrayList<ArrayDefinition>(); return result; } @Override protected List<RoutineDefinition> getRoutines0() { List<RoutineDefinition> result = new ArrayList<RoutineDefinition>(); for (Routine routine : info().getRoutines()) { if (isBlank(routine.getSpecificPackage()) && isBlank(routine.getRoutinePackage())) { String schemaName = defaultIfBlank(routine.getSpecificSchema(), routine.getRoutineSchema()); if (getInputSchemata().contains(schemaName)) { SchemaDefinition schema = getSchema(schemaName); result.add(new XMLRoutineDefinition(schema, null, info(), routine, routine.getComment())); } } } return result; } @Override protected List<PackageDefinition> getPackages0() { List<PackageDefinition> result = new ArrayList<PackageDefinition>(); Set<String> packages = new HashSet<String>(); for (Routine routine : info().getRoutines()) { String schemaName = defaultIfBlank(routine.getSpecificSchema(), routine.getRoutineSchema()); if (getInputSchemata().contains(schemaName)) { SchemaDefinition schema = getSchema(schemaName); String packageName = defaultIfBlank(routine.getSpecificPackage(), routine.getRoutinePackage()); if (!isBlank(packageName) && packages.add(packageName)) { result.add(new XMLPackageDefinition(schema, info(), packageName)); } } } return result; } static int unbox(Integer i) { return i == null ? 0 : i.intValue(); } static long unbox(Long l) { return l == null ? 0L : l.longValue(); } }
98d538d5b0f97998b7fd27263385d36ac80b62ba
12999c520ba976d2a6050758f6bf8fbf0467f706
/src/main/java/com/njtech/blog/mapper/MsTagMapper.java
7405f0f55b8b66903b2eacfc115ebb7740105108
[]
no_license
cx19971028/blog-boot
3f314c1c75e24d00feb20ee662ee2fdbe0a3f781
4c1e1d8721651d0e6cbb03ee6599c055ab700def
refs/heads/master
2023-07-19T12:46:50.455911
2021-08-31T06:45:44
2021-08-31T06:45:44
401,601,213
0
0
null
null
null
null
UTF-8
Java
false
false
543
java
package com.njtech.blog.mapper; import com.njtech.blog.entity.MsTag; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import java.util.List; /** * <p> * Mapper 接口 * </p> * * @author chenxin * @since 2021-08-12 */ public interface MsTagMapper extends BaseMapper<MsTag> { /** * 根基文章ID查询标签列表 * @param id * @return */ List<MsTag> findTagsByArticleId(String id); /** * 查询最热前limit标签 * @return */ List<Long> selectHotTagIds(Integer limit); }
c8783c2f024e72194e5001bc6b06fd76fc567c2f
c988795800e8e6c8150657e03359e04160396be9
/app/src/main/java/com/dh/perfectoffer/xutils/sample/utils/PubUtils.java
b150122b6431bcb6d54572cb5bf14c2d1352678c
[]
no_license
caozhiou0804/perfectoffer
740b194710d3ffc1641216626f7ca85133837ebc
102a1c5c1300b66c0eaf13f3310eeccf57c0ab61
refs/heads/master
2020-12-25T09:28:30.567523
2016-08-08T01:43:21
2016-08-08T01:43:21
64,631,956
0
0
null
null
null
null
UTF-8
Java
false
false
16,737
java
package com.dh.perfectoffer.xutils.sample.utils; import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.content.DialogInterface; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.Typeface; import android.text.SpannableString; import android.text.Spanned; import android.text.TextUtils; import android.text.style.ForegroundColorSpan; import android.text.style.StrikethroughSpan; import android.view.View; import android.widget.TextView; import android.widget.Toast; import com.dh.perfectoffer.VehicleApp; import com.dh.perfectoffer.event.framework.log.L; import com.dh.perfectoffer.event.framework.ui.TipDialog; import com.dh.perfectoffer.event.framework.util.Density; import java.math.BigDecimal; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.UUID; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * * 〈公共方法〉<br> * 〈功能详细描述〉 * * @author yinzl * @see [相关类/方法](可选) * @since [产品/模块版本] (可选) */ @SuppressLint("SimpleDateFormat") public class PubUtils { public static Map<String, String> fileFormatMap = new HashMap<String, String>(); static { fileFormatMap.put("art", "image/x-jg"); fileFormatMap.put("bmp", "image/bmp"); fileFormatMap.put("gif", "image/gif"); fileFormatMap.put("jpe", "image/jpeg"); fileFormatMap.put("jpeg", "image/jpeg"); fileFormatMap.put("jpg", "image/jpeg"); fileFormatMap.put("png", "image/png"); } // 修改图片类型 public static String getImgRealMimeType(String imgFormat) { String mineType = fileFormatMap.get(imgFormat); if (TextUtils.isEmpty(mineType)) { mineType = "image/jpeg"; // 默认为jpg } return mineType; } /** * 对话框提示 * * @param context * @param msg */ public static void showTipDialog(Context context, String msg) { if (context instanceof Activity) { Activity ac = ((Activity) context); if (!ac.isFinishing()) { TipDialog tipDialog = new TipDialog(context); tipDialog.showTip(msg); } } } /** * 对话框提示 * * @param context * @param msg */ public static void showTipDialog(Context context, String msg, DialogInterface.OnDismissListener onDismissListener) { if (context instanceof Activity) { Activity ac = ((Activity) context); if (!ac.isFinishing()) { TipDialog tipDialog = new TipDialog(context); if (null != onDismissListener) tipDialog.setOnDismissListener(onDismissListener); tipDialog.showTip(msg); } } } public static void showTipDialog(Context context, int msg) { showTipDialog(context, context.getString(msg)); } /** * 返回中间删除线的文本 */ public static SpannableString getDeleteStr(String content) { SpannableString sps = new SpannableString(content); sps.setSpan(new StrikethroughSpan(), 0, content.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); return sps; } /** * 设置文字的底部下划线文本 * * @param tv * @param str */ public static void setUnderlineStr(TextView tv, String str) { tv.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG); tv.setText(str); } /** * 返回指定颜色的文本 */ public static SpannableString getColorStr(String content, int color) { SpannableString sps = new SpannableString(content); // 更换字体颜色 sps.setSpan(new ForegroundColorSpan(color), 0, content.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); return sps; } /** * 设置TextView的字体风格 * * @param tv * @param tf */ public static void setTextViewFont(TextView tv, Typeface tf) { tv.setTypeface(tf); } /** * 返回图片适配的高度 * * @param picWidth * @param picHeight * @param desWidth * @return */ public static int getRealHeight(int picWidth, int picHeight, int desWidth) { return (picHeight * desWidth) / picWidth; } /** * 根据图片应用在满屏的适配的高度 * * @param picWidth * @param picHeight * @return */ public static int getDefScreenRealHeight(int picWidth, int picHeight) { int sceenWidth = Density.getSceenWidth(VehicleApp.getInstance()); return getRealHeight(picWidth, picHeight, sceenWidth); } // 正则表达式验证 public static boolean checkString(String s, String regex) { return s.matches(regex); } /** * 弹吐司 * * @param ctx * @param txt */ public static void popTipOrWarn(Context ctx, String txt) { Toast.makeText(ctx, txt, Toast.LENGTH_SHORT).show(); } public static void popTipOrWarn(Context ctx, int txt) { Toast.makeText(ctx, txt, Toast.LENGTH_SHORT).show(); } /** * 返回当前程序版本名 */ public static int getAppVersionCode(Context context) { int versionCode = 0; try { PackageManager pm = context.getPackageManager(); PackageInfo pi = pm.getPackageInfo(context.getPackageName(), 0); versionCode = pi.versionCode; } catch (Exception e) { L.e("VersionInfo", "Exception", e); } return versionCode; } /** * 返回当前程序版本号 */ public static String getAppVersionName(Context context) { String versionName = ""; try { PackageManager pm = context.getPackageManager(); PackageInfo pi = pm.getPackageInfo(context.getPackageName(), 0); versionName = pi.versionName; } catch (Exception e) { L.e("VersionInfo", "Exception", e); } return versionName; } // 将文件路径前加上"file://" public static String addFileBegin(String path) { if (path.startsWith("file://")) return path; return "file://" + path; } // 截取文件名称 public static String getFileName(String path) { if (path == null) { return ""; } int i = path.lastIndexOf("\\"); if (i < 0) { i = path.lastIndexOf("/"); } if (i < 0) { return path; } return path.substring(i + 1); } // 截取文件类型 public static String getFileFormat(String path) { if (path == null) { return ""; } int i = path.lastIndexOf("."); if (i < 0) { return path; } return path.substring(i + 1); } /** * 去掉小月份前面的0,譬如07月变成7月,12月不变。 * * @param month * @return */ public static String tranMonth(String month) { if ("0".equals(month.substring(0, 1))) { month = month.substring(1, 2); } return month; } /** * 产生唯一的ID号 * * @return */ public static String getUUId() { return UUID.randomUUID().toString(); } public static String getCookie(List<String> cookies) { StringBuffer sb = new StringBuffer(); int j = 0; String strCookies = cookies.toString(); strCookies = strCookies.replace("[", ""); strCookies = strCookies.replace("]", ""); String[] arrayCookies = strCookies.split(","); if (arrayCookies != null & arrayCookies.length > 0) { // String arrayItems = arrayCookies int arrayLength = arrayCookies.length; for (int i = 0; i < arrayLength; i++) { String strItems = arrayCookies[i]; String[] strArrayItems = strItems.split(";"); if (strArrayItems != null && strArrayItems.length > 0) { if (j > 0) { sb.append(";"); } sb.append(strArrayItems[0]); j++; } } } String cookie = sb.toString(); return cookie; } // 显示整数金额 public static final String getMoneyAmount(String payAmount) { Double douAmount = Double.valueOf(payAmount); int intAmount = douAmount.intValue(); return ("¥" + intAmount / 100); } // 标准时间格式 public static String getNowDatetimeStr() { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss", Locale.CHINA); Date date = new Date(); return sdf.format(date); } // 标准时间格式 public static String getTomDatetimeStr() { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss", Locale.CHINA); Date date = new Date(); Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.add(Calendar.DATE, 1); return sdf.format(cal.getTime()); } /** * type 0 代表 取奇数,1代表 取 偶数 * * @param src * @param type * @return */ public static String getOddOrEvenString(String src, int type) { if (src == null || src.length() <= 0) { return ""; } StringBuffer sb = new StringBuffer(); int sbLength = src.length(); for (int i = 0; i < sbLength; i++) { if (i % 2 == type) { sb.append(src.charAt(i)); } } return sb.toString(); } /** * 判断选择服务日期时间 是否早于手机当前时间 <一句话功能简述> <功能详细描述> * * @return * @see [类、类#方法、类#成员] */ public static boolean compare_date(String time) { DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm"); if (time.length() == 10) { time = time + " 23:59"; } try { Date dt1 = df.parse(time); Date dt2 = new Date(); if (dt1.getTime() > dt2.getTime()) { return true; } else if (dt1.getTime() < dt2.getTime()) { return false; } else { return false; } } catch (Exception exception) { exception.printStackTrace(); } return false; } /** * 正则表达式 判断电话号是否正确 */ public static boolean isPhoneHomeNum(String num) { Pattern p = Pattern .compile("^(((13[0-9])|(15([0-3]|[5-9])|170)|(18[0,5-9]))\\d{8})|(0\\d{2}-\\d{8})|(0\\d{3}-\\d{8})$"); Matcher m = p.matcher(num); return m.matches(); } /** * 正则表达式 判断车牌号是否正确 */ public static boolean isNumCorrect(String num) { Pattern p = Pattern .compile("^(([\u4e00-\u9fa5])([a-z]|[A-Z])([a-z]|[A-Z]|[0-9]){5})$"); Matcher m = p.matcher(num); return m.matches(); } /** * 判断密码是否有中文 true代表无中文,false代表有中文 */ public static boolean isNotChin(String password) { return (password.getBytes().length == password.length()) ? true : false; } /** * 根据原始图,获取指定分辨率的小图 * * @param Url * @param picType * @return */ public static String getFitPicUrlPath(String Url, String picType) { String partOne = null; String partTow = null; if (TextUtils.isEmpty(Url)) { return Url; } else { int indexOf = Url.lastIndexOf("."); if (indexOf < 1) { return Url; } partOne = Url.substring(0, indexOf); partTow = Url.substring(indexOf); } if ("picType168X134".equals(picType)) { return partOne + "_168_134" + partTow; } else if ("picType218X174".equals(picType)) { return partOne + "_218_174" + partTow; } else if ("picType640X384".equals(picType)) { return partOne + "_640_384" + partTow; } else if ("picType168X134".equals(picType)) { return partOne + "_168_134" + partTow; } else if ("picType176X130".equals(picType)) { return partOne + "_176_130" + partTow; } return Url; } public static boolean isPassword(String str) {// 判断字符格式是否正确 if (!TextUtils.isEmpty(str)) { for (char c : str.toCharArray()) { if (!((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '#' || c == '@' || c == '_')) { return false; } } } return true; } // 根据评分计算出是否需要显示半星 public static boolean isHalfStar(String scoreStr) {// 判断是否显示半星,限制小数点后只有一位小数的,012,false,34567,true,89false,但是星的个数要+1; float temp = 0f; try { temp = Float.parseFloat(getScoreBy1(scoreStr)); } catch (Exception e) { // can't reach e.printStackTrace(); } if (temp != 0) { temp = temp * 10; int intTemp = ((int) temp) % 10; if (intTemp > 2 && intTemp <= 7) { return true; } } return false; } // 根据评分计算出全星的分数 public static int starCount(String scoreStr) {// 判断全星个数,限制小数点后只有一位小数的,01234567,个数不变,89,星的个数要+1; float score = 0f; try { score = Float.parseFloat(getScoreBy1(scoreStr)); } catch (Exception e) { // can't reach e.printStackTrace(); } if (score != 0) { score = score * 10; int intTemp = (int) score; int intCount = intTemp / 10; int intYu = intTemp % 10; if (intYu > 7) { return intCount + 1; } else return intCount; } return 0; } // 商家商品评分,可能会出现多位小数,进行四舍五入,取1位小数处理 public static String getScoreBy1(String score) { String grade_score = "0"; float f = Float.parseFloat(score); BigDecimal b = new BigDecimal(f); float f1 = b.setScale(1, BigDecimal.ROUND_HALF_UP).floatValue(); if ((int) f1 == f1)// 末尾是.0的,直接显示整数 grade_score = String.valueOf((int) f1); else grade_score = String.valueOf(f1); return grade_score; } /** * 根据手机的分辨率从 dp 的单位 转成为 px(像素) */ public static int dip2px(Context context, float dpValue) { final float scale = context.getResources().getDisplayMetrics().density; return (int) (dpValue * scale + 0.5f); } /** * 根据手机的分辨率从 px(像素) 的单位 转成为 dp */ public static int px2dip(Context context, float pxValue) { final float scale = context.getResources().getDisplayMetrics().density; return (int) (pxValue / scale + 0.5f); } /* * 将诸如20140630085447时间格式的字符串转化为2014-06-30 08:54:47 */ public static String getTimeStrFromStr(String intime) { try { StringBuffer timeStr = new StringBuffer(); timeStr.append(intime.subSequence(0, 4)); timeStr.append("-"); intime = intime.substring(4); timeStr.append(intime.subSequence(0, 2)); timeStr.append("-"); intime = intime.substring(2); timeStr.append(intime.subSequence(0, 2)); timeStr.append(" "); intime = intime.substring(2); timeStr.append(intime.subSequence(0, 2)); timeStr.append(":"); intime = intime.substring(2); timeStr.append(intime.subSequence(0, 2)); timeStr.append(":"); intime = intime.substring(2); timeStr.append(intime.subSequence(0, 2)); return timeStr.toString(); } catch (Exception e) { return intime; } } /** * 将日期格式YYYYMMDD转换为YYYY-MM-DD * * @param str * @return */ public static String formatDate(String str) { if (str == null || str.length() != 8) { return str; } String strs = ""; strs = str.substring(0, 4) + "-" + str.substring(4, 6) + "-" + str.substring(6, 8); return strs; } /** * 将日期格式YYYY-MM-DD转换为YYYYMMDD * * @param str * @return */ public static String formatDateStr(String str) { if (str == null || str.length() != 10) { return str; } String strs = ""; strs = str.substring(0, 4) + str.substring(5, 7) + str.substring(8, 10); return strs; } /** * 将日期格式YYYY-MM-DD转换为YYYYMMDD * * @param str * @return */ public static String formatDateStrChinese(String str) { if (str == null || str.length() != 10) { return str; } String strs = ""; strs = str.substring(0, 4) + "年" + str.substring(5, 7) + "月" + str.substring(8, 10) + "日"; return strs; } /** * 将日期格式YYYY-MM转换为YYYY年MM月 * * @param str * @return */ public static String formatDateStr_chinese(String str) { if (str == null || str.length() != 7) { return str; } String strs = str.replace("-", "年") + "月"; return strs; } /** * * 功能描述: <获取当前时间> 〈功能详细描述〉 * * @return * @see [相关类/方法](可选) * @since [产品/模块版本](可选) */ public static String getCurrentTime() { SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); String date = sDateFormat.format(new Date()); return date; } public static Bitmap getJieping(Activity activity) {// 获取截屏 View view = activity.getWindow().getDecorView(); view.setDrawingCacheEnabled(true); view.buildDrawingCache(); Bitmap b1 = view.getDrawingCache(); // 获取状态栏高度 Rect frame = new Rect(); activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(frame); int statusBarHeight = frame.top; // 获取屏幕长和高 int width = activity.getWindowManager().getDefaultDisplay().getWidth(); int height = activity.getWindowManager().getDefaultDisplay() .getHeight(); // 去掉标题栏 Bitmap b = Bitmap.createBitmap(b1, 0, statusBarHeight, width, height - statusBarHeight); view.destroyDrawingCache(); return b; } }
4331ec8b3e3f2c2f28b17039f4deec527b108891
39dc5437758f00e3db41a423adec19bd2c33f89a
/src/main/java/kr/co/itcen/springcontainer/soundsystem/CDPlayer.java
95bb6c7fc9f269f3ad6525f1650f16099bacdc4d
[]
no_license
kimhg93/springcontainer
4fe649f626141cbc09091583b9e730f2c1452059
5e76bbc8fde619097e54da716a633c6b052d6913
refs/heads/master
2020-08-13T05:17:46.893987
2019-10-15T05:44:06
2019-10-15T05:44:06
214,914,561
0
0
null
2019-10-14T00:26:06
2019-10-14T00:26:06
null
UTF-8
Java
false
false
1,159
java
package kr.co.itcen.springcontainer.soundsystem; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; @Component public class CDPlayer { // 와이어링 1 @Autowired @Autowired @Qualifier("highSchoolRapper3Final") private CompactDisc compactDisc; // 와이어링 2 //@Inject // 스프링 기반의 와이어링 어노테이션을 사용할 수 없는 경우 // @Autowierd와 별차이는 없다. 선호하는 것을 일관성 있게 사용하면 된다 //@Autowired public CDPlayer(CompactDisc compactDisc) { this.compactDisc = compactDisc; } public CDPlayer() { System.out.println("CDPlayer 기본생성자 호출"); } // 와이어링 3 @Autowired + setter //@Autowired public void setCd(CompactDisc compactDisc) { this.compactDisc = compactDisc; } // 와이어링 3 @Autowired + 일반 메소드 //@Autowired public void insertCompactDisc(CompactDisc compactDisc) { this.compactDisc = compactDisc; } public void play() { compactDisc.play(); } }
[ "defaultuser0@DESKTOP-FDVUPSA" ]
defaultuser0@DESKTOP-FDVUPSA
49b92d1ef1f55575545a0c8f870613157aec7e78
8d324cd6134b640ab3bfc9641152c1355a3977b6
/singleton/src/main/java/br/com/htcursos/presidente/Presidente.java
82dd55dbee85ada3f51a66a32f4f07b003c97334
[]
no_license
ValentimHelio/design-patterns-master
28f688644b540bd879602c70698d9592635140ab
283a20e87a814977cd75f67f1cd74eeefda4fde9
refs/heads/master
2021-01-10T15:21:27.325239
2016-04-09T19:19:18
2016-04-09T19:19:18
55,862,576
0
0
null
null
null
null
UTF-8
Java
false
false
450
java
package br.com.htcursos.presidente; public final class Presidente { private static final Presidente PRESIDENTE = new Presidente(); private String nome; private Presidente() { } public static Presidente getInstance() { if(PRESIDENTE == null) { return new Presidente(); } else { return PRESIDENTE; } } public void definir(String presidente) { this.nome = presidente; } public String getNome() { return this.nome; } }
c25e5458c3c1d10e96b586b6c8d8661072baa2eb
3b72e5ec91db3f307f7e46b0313a902136e69340
/src/main/java/com/aj/disruptor/EventProducer.java
3147149b209885f344885de6bde54027f28612ed
[]
no_license
archine/disruptor-demo
b77f675e8d8bbed0a24879cc6219548b6a17e86f
712943c787941c957405fca1781a62fca0b1ea49
refs/heads/master
2020-05-30T05:13:32.909460
2019-05-31T08:09:00
2019-05-31T08:09:00
189,554,772
0
0
null
null
null
null
UTF-8
Java
false
false
620
java
package com.aj.disruptor; import com.lmax.disruptor.EventTranslatorOneArg; import com.lmax.disruptor.RingBuffer; import java.nio.ByteBuffer; /** * @author Gjing **/ class EventProducer { private RingBuffer<LongEvent> ringBuffer; EventProducer(RingBuffer<LongEvent> ringBuffer) { this.ringBuffer = ringBuffer; } private static final EventTranslatorOneArg<LongEvent, ByteBuffer> TRANSLATOR = (event, sequence, byteBuffer) -> event.set(byteBuffer.getLong(0)); void sendData(ByteBuffer data) { //发布消息 ringBuffer.publishEvent(TRANSLATOR, data); } }
9e130c36ed9235784217da95d347ebb6a8f5e1b5
df4ac8ea526646c9a8377a7c01c180d6a4cb458b
/spring-homework-03/src/main/java/ru/otus/spring/domain/QuestionAnswerPair.java
91ef56a9db6bfb48d76d3272fcc3504fa76f0333
[]
no_license
AlexanderShabanov/2020-11-otus-spring-AlexanderShabanov
841e119e8a3cc4b978af9fc866313955ca4ddd21
bc5e5af3f94b668363f78ebe682f53c599c38d44
refs/heads/main
2023-03-26T15:00:56.394473
2021-03-13T14:23:16
2021-03-13T14:23:16
315,733,649
0
0
null
2021-03-13T14:23:17
2020-11-24T19:33:11
Java
UTF-8
Java
false
false
408
java
package ru.otus.spring.domain; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.RequiredArgsConstructor; import java.util.Collection; /** * @author Александр Шабанов */ @RequiredArgsConstructor @Getter @EqualsAndHashCode public class QuestionAnswerPair { private final Question question; private final Collection<Answer> realAnswerCollection; }
ea8674134fcbf33d46006e31cd8606785f197d14
8f15e93d340560cf75106e684bb5c454aa8911f4
/src/main/java/com/ssoward/controller/SortController.java
7da5a81b84bb4201ae687f2f427a0c67708c1263
[]
no_license
ssoward/sort2014
6697f00048c31303655601c210a4a7d6d65dcb44
62580285ca5a1caa9d0322c13521130f629add23
refs/heads/master
2020-04-15T21:01:30.012470
2014-11-25T15:02:36
2014-11-25T15:02:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,022
java
package com.ssoward.controller; import com.ssoward.model.Users; import com.ssoward.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.Date; import java.util.List; /** * Created by ssoward on 9/24/14. */ @Controller @RequestMapping("/ajax") public class SortController { static Boolean isHarness; @Autowired UserService userService; @RequestMapping(method = RequestMethod.GET, value="/test", produces = MediaType.APPLICATION_JSON_VALUE) public void oldSchoolAjax(HttpServletRequest request, HttpServletResponse response, @RequestParam String val) { try { Thread.sleep(500l); response.getWriter().print("Returned from server at "+ new Date()); } catch (Exception e) { e.printStackTrace(); } } @RequestMapping(method = RequestMethod.GET, value="/users", produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<String> leader(@RequestParam(value = "page", required = false, defaultValue = "0") int page) { List<Users> users = userService.getUsers(); return new ResponseEntity(users, HttpStatus.OK); } @RequestMapping(method = RequestMethod.PUT, value="/rappel/harness", produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<String> toggleHarness(@RequestParam(value = "page", required = false, defaultValue = "0") int page) { List<Users> users = userService.getUsers(); return new ResponseEntity(users, HttpStatus.OK); } }
d9fda1da75d2ea3117938481ae07311d89de30c5
4df4ca1b5d3eeb12f196a7c2cd9f8ddbbad82e87
/src/main/java/com/wangshao/config/MainConfigOfProfile.java
951d254786f64583e7d67f31add5e429fc701b65
[]
no_license
yishanerguo/spring-annotation
b79ae2e347d06d7506ed702d04b90308b2fdabb2
55a3a22b4abcaedf0a051eda5c380422f4bba95a
refs/heads/master
2022-07-11T04:15:06.217434
2020-02-23T09:08:44
2020-02-23T09:08:44
241,298,706
0
0
null
2022-06-21T02:49:58
2020-02-18T07:28:37
Java
UTF-8
Java
false
false
3,065
java
package com.wangshao.config; import com.mchange.v2.c3p0.ComboPooledDataSource; import com.wangshao.bean.Yellow; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.EmbeddedValueResolverAware; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; import org.springframework.context.annotation.PropertySource; import org.springframework.util.StringValueResolver; import javax.sql.DataSource; /** * @author liutao * @create 2020-02-20-17:28 * profile: * spring为我们提供的可以根据当前环境,动态的激活和切换一系列组件的功能 * * 开发环境,测试环境,生产环境: * 数据源:(/A)(/B)(/C) * * @profile: 指定组件在哪个环境的情况下才能被注册容器中 * 1.加了环境标识的bean,只有这个环境被激活的时候才能注册到容器中,默认是default环境 * 2.写在配置类上,只有时指定的环境时候,整个配置类里面的所有配置才能开始生效 * 3.没有标注bean,在任何环境都是加载的 * */ //@Profile("test") @PropertySource("classpath:/dbconfig.properties") @Configuration public class MainConfigOfProfile implements EmbeddedValueResolverAware { @Value("${db.user}") private String user; private StringValueResolver stringValueResolver; private String driverClass; //@Profile("test") @Bean public Yellow yellow(){ return new Yellow(); } @Profile("test") @Bean("testDataSource") public DataSource dataSource(@Value("${db.passowrd}") String pwd) throws Exception { ComboPooledDataSource dataSource = new ComboPooledDataSource(); dataSource.setUser(user); dataSource.setPassword(pwd); dataSource.setJdbcUrl("jdbc:mysql://192.168.1.12:3306/test"); dataSource.setDriverClass(driverClass); return dataSource; } @Profile("dev") @Bean("devDataSource") public DataSource dataSourceDev(@Value("${db.password}") String pwd) throws Exception { ComboPooledDataSource dataSource = new ComboPooledDataSource(); dataSource.setUser(user); dataSource.setPassword(pwd); dataSource.setJdbcUrl("jdbc:mysql://192.168.1.12:3306/dev"); dataSource.setDriverClass(driverClass); return dataSource; } @Profile("prod") @Bean("prodDataSource") public DataSource dataSourceProd(@Value("${db.password}") String pwd) throws Exception { ComboPooledDataSource dataSource = new ComboPooledDataSource(); dataSource.setUser(user); dataSource.setPassword(pwd); dataSource.setJdbcUrl("jdbc:mysql://192.168.1.12:3306/prod"); dataSource.setDriverClass(driverClass); return dataSource; } public void setEmbeddedValueResolver(StringValueResolver resolver) { this.stringValueResolver = resolver; driverClass = stringValueResolver.resolveStringValue("${db.driverClass}"); } }
08a6c0d91b68713ad029ffc49445587d6102a61c
2f51035e9e29c8e65876e82babb7e288a4565ed6
/9-1-Iterator/MenuWithJavaIterator/MenuItem.java
dd3c73d4030a14478083995d5db8923ac546e40b
[]
no_license
rapirent/Java-Design-Patterns
876e4c61f582850e8526aa0c91a34dee1d0ee18d
43a3c9ca4253a6b157ef6a68cb6e3b133789e4d4
refs/heads/master
2023-04-18T13:25:17.537992
2021-05-03T05:19:26
2021-05-03T05:19:26
359,359,880
0
0
null
null
null
null
UTF-8
Java
false
false
666
java
package menuWithJavaIterator; public class MenuItem { protected String name; protected String description; protected boolean vegetarian; protected double price; public MenuItem(String name, String description, boolean vegetarian, double price) { this.name = name; this.description = description; this.vegetarian = vegetarian; this.price = price; } public String getName() { return name; } public String getDescription() { return description; } public double getPrice() { return price; } public boolean isVegetarian() { return vegetarian; } }
846b73570b5017eddbb6be8a504167fcfc746051
bf2966abae57885c29e70852243a22abc8ba8eb0
/aws-java-sdk-customerprofiles/src/main/java/com/amazonaws/services/customerprofiles/model/transform/InternalServerExceptionUnmarshaller.java
6c2d7142fb103c91b2846e5ff050894c6091b170
[ "Apache-2.0" ]
permissive
kmbotts/aws-sdk-java
ae20b3244131d52b9687eb026b9c620da8b49935
388f6427e00fb1c2f211abda5bad3a75d29eef62
refs/heads/master
2021-12-23T14:39:26.369661
2021-07-26T20:09:07
2021-07-26T20:09:07
246,296,939
0
0
Apache-2.0
2020-03-10T12:37:34
2020-03-10T12:37:33
null
UTF-8
Java
false
false
2,912
java
/* * Copyright 2016-2021 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.customerprofiles.model.transform; import java.math.*; import javax.annotation.Generated; import com.amazonaws.services.customerprofiles.model.*; import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*; import com.amazonaws.transform.*; import com.fasterxml.jackson.core.JsonToken; import static com.fasterxml.jackson.core.JsonToken.*; /** * InternalServerException JSON Unmarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class InternalServerExceptionUnmarshaller extends EnhancedJsonErrorUnmarshaller { private InternalServerExceptionUnmarshaller() { super(com.amazonaws.services.customerprofiles.model.InternalServerException.class, "InternalServerException"); } @Override public com.amazonaws.services.customerprofiles.model.InternalServerException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception { com.amazonaws.services.customerprofiles.model.InternalServerException internalServerException = new com.amazonaws.services.customerprofiles.model.InternalServerException( null); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) token = context.nextToken(); if (token == VALUE_NULL) { return null; } while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) break; } } token = context.nextToken(); } return internalServerException; } private static InternalServerExceptionUnmarshaller instance; public static InternalServerExceptionUnmarshaller getInstance() { if (instance == null) instance = new InternalServerExceptionUnmarshaller(); return instance; } }
[ "" ]
d58f4082910b536e59cdfaa989cb085ed46715db
295a386496f11e22b74c1070cde6f0a499fa193d
/erp-web/src/main/java/com/isoft/erp/web/utils/VerifyCode.java
c7d58433ba67cf57f9380f113e3554e4f3d6294c
[]
no_license
SlashTeen/erp-parent
9d04ec6bcb590e052b6855697f9d6bae36e42a43
5c8021091658776f8431a0406ba7445250d06b3e
refs/heads/master
2021-01-20T23:03:03.936184
2017-08-30T04:02:38
2017-08-30T04:02:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,411
java
package com.isoft.erp.web.utils; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; import java.awt.image.BufferedImage; import java.io.IOException; import java.io.OutputStream; import java.util.Random; import javax.imageio.ImageIO; /** * 生成验证码的文本 */ @SuppressWarnings("All") public class VerifyCode { private int w = 70; private int h = 35; private Random r = new Random(); // {"宋体", "华文楷体", "黑体", "华文新魏", "华文隶书", "微软雅黑", "楷体_GB2312"} private String[] fontNames = {"宋体", "华文楷体", "黑体", "微软雅黑", "楷体_GB2312"}; // 可选字符 private String codes = "23456789abcdefghjkmnopqrstuvwxyzABCDEFGHJKMNPQRSTUVWXYZ"; // 背景色 private Color bgColor = new Color(255, 255, 255); // 验证码上的文本 private String text ; // 生成随机的颜色 private Color randomColor () { int red = r.nextInt(150); int green = r.nextInt(150); int blue = r.nextInt(150); return new Color(red, green, blue); } // 生成随机的字体 private Font randomFont () { int index = r.nextInt(fontNames.length); String fontName = fontNames[index];//生成随机的字体名称 int style = r.nextInt(4);//生成随机的样式, 0(无样式), 1(粗体), 2(斜体), 3(粗体+斜体) int size = r.nextInt(5) + 24; //生成随机字号, 24 ~ 28 return new Font(fontName, style, size); } // 画干扰线 private void drawLine (BufferedImage image) { int num = 3;//一共画3条 Graphics2D g2 = (Graphics2D)image.getGraphics(); for(int i = 0; i < num; i++) {//生成两个点的坐标,即4个值 int x1 = r.nextInt(w); int y1 = r.nextInt(h); int x2 = r.nextInt(w); int y2 = r.nextInt(h); g2.setStroke(new BasicStroke(1.5F)); g2.setColor(Color.BLUE); //干扰线是蓝色 g2.drawLine(x1, y1, x2, y2);//画线 } } // 随机生成一个字符 private char randomChar () { int index = r.nextInt(codes.length()); return codes.charAt(index); } // 创建BufferedImage private BufferedImage createImage () { BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = (Graphics2D)image.getGraphics(); g2.setColor(this.bgColor); g2.fillRect(0, 0, w, h); return image; } // 调用这个方法得到验证码 public BufferedImage getImage () { BufferedImage image = createImage();//创建图片缓冲区 Graphics2D g2 = (Graphics2D)image.getGraphics();//得到绘制环境 StringBuilder sb = new StringBuilder();//用来装载生成的验证码文本 // 向图片中画4个字符 for(int i = 0; i < 4; i++) {//循环四次,每次生成一个字符 String s = randomChar() + "";//随机生成一个字母 sb.append(s); //把字母添加到sb中 float x = i * 1.0F * w / 4; //设置当前字符的x轴坐标 g2.setFont(randomFont()); //设置随机字体 g2.setColor(randomColor()); //设置随机颜色 g2.drawString(s, x, h-5); //画图 } this.text = sb.toString(); //把生成的字符串赋给了this.text drawLine(image); //添加干扰线 return image; } // 返回验证码图片上的文本 public String getText () { return text; } // 保存图片到指定的输出流 public static void output (BufferedImage image, OutputStream out) throws IOException { ImageIO.write(image, "JPEG", out); } }
8af4c69365610a6094dc48f5e71566639e3e3aea
6b7078ec87af07439bf05df4f672844a6f746073
/src/main/java/currency_course/models/PrivatBankModel.java
0d6995686b41656aac46f7d2ac6da26d319ec513
[]
no_license
KenediOne/Currency
9f0ff04e1c06c3da7ab89ca89118b2b57a746c51
0d8c0021f4c3de3ca2319462f0146b864b15a439
refs/heads/master
2023-02-12T16:44:38.892625
2021-01-18T14:13:50
2021-01-18T14:13:50
330,672,022
0
0
null
null
null
null
UTF-8
Java
false
false
937
java
package currency_course.models; public class PrivatBankModel { private String ccy; private String base_ccy; private double buy; private double sale; public PrivatBankModel(String ccy, String base_ccy, double buy, double sale) { this.ccy = ccy; this.base_ccy = base_ccy; this.buy = buy; this.sale = sale; } public PrivatBankModel() { } public String getCcy() { return ccy; } public void setCcy(String ccy) { this.ccy = ccy; } public String getBase_ccy() { return base_ccy; } public void setBase_ccy(String base_ccy) { this.base_ccy = base_ccy; } public double getBuy() { return buy; } public void setBuy(double buy) { this.buy = buy; } public double getSale() { return sale; } public void setSale(double sale) { this.sale = sale; } }
529059f279a8ae8bf01e1c9d1d721018d58ee99d
31ce372744d40ce9c7dc1a88e7bfdebd246e82fa
/lib/src/main/java/com/sd/lib/http/utils/HttpIOUtil.java
0c6dd8fcec2dfa0e65028fe2d0ecb69743529cef
[ "MIT" ]
permissive
yao106/http
7414aaa07668a268f220a12e97b86d075d7acfb4
4ebdbc821932d38d924441970b1a900c12bcc95f
refs/heads/master
2022-11-04T09:24:45.814376
2020-06-20T16:32:26
2020-06-20T16:32:26
273,744,653
0
0
null
null
null
null
UTF-8
Java
false
false
2,315
java
package com.sd.lib.http.utils; import android.text.TextUtils; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.Reader; import java.io.Writer; public class HttpIOUtil { private HttpIOUtil() { } public static String readString(InputStream in, String charset) throws IOException { if (TextUtils.isEmpty(charset)) charset = "UTF-8"; if (!(in instanceof BufferedInputStream)) in = new BufferedInputStream(in); final Reader reader = new InputStreamReader(in, charset); final StringBuilder sb = new StringBuilder(); final char[] buffer = new char[1024]; int len; while ((len = reader.read(buffer)) >= 0) { sb.append(buffer, 0, len); } return sb.toString(); } public static void writeString(OutputStream out, String content, String charset) throws IOException { if (TextUtils.isEmpty(charset)) charset = "UTF-8"; final Writer writer = new OutputStreamWriter(out, charset); writer.write(content); writer.flush(); } public static void copy(InputStream in, OutputStream out, ProgressCallback callback) throws IOException { if (!(in instanceof BufferedInputStream)) in = new BufferedInputStream(in); if (!(out instanceof BufferedOutputStream)) out = new BufferedOutputStream(out); long count = 0; int len = 0; final byte[] buffer = new byte[1024]; while ((len = in.read(buffer)) != -1) { out.write(buffer, 0, len); count += len; if (callback != null) callback.onProgress(count); } out.flush(); } public static void closeQuietly(Closeable closeable) { if (closeable != null) { try { closeable.close(); } catch (Throwable ignored) { } } } public interface ProgressCallback { void onProgress(long count); } }
38d53dcd5742a4876e0ba86e16108ec50bb45db0
8d132da0c949f7aa149938d91a7f8c9a50928fd0
/src/main/ui/components/display/background/PanelBackground.java
824b635eff322a1928757fd88e7508e77f6d9ca0
[]
no_license
KieranSherman/textgame
59696c8f3664fb5ee619405e575d35e90d0d6e1b
047e8ebc58f2da53d894d1e61da9eea249adda5c
refs/heads/master
2020-12-29T02:23:34.756452
2017-01-15T18:16:56
2017-01-15T18:16:56
55,558,036
2
0
null
2017-01-15T18:16:57
2016-04-05T22:25:13
Java
UTF-8
Java
false
false
1,393
java
package main.ui.components.display.background; import java.awt.Graphics; import java.awt.Image; import javax.swing.JPanel; import util.Resources; /** * This class extends {@link JPanel}, overriding its {@link #paintComponent()} method. Upon intantiation, * it sets the background of the {@link JPanel} to an image passed through the constructor, and starts * a new custom-rendering thread, updating every {@link Resources#RENDER_SPEED} milliseconds. * * @author kieransherman * */ public class PanelBackground extends JPanel { private static final long serialVersionUID = 1L; private Image imageBackground; private Thread displayThread; private JPanel panel; /** * Creates a new {@link JPanel}, and overrides its {@code paintComponent(Graphics g)} method to paint * an image as the background. * * @param imageBackground the background image. */ public PanelBackground(Image imageBackground) { this.imageBackground = imageBackground; panel = this; displayThread = new Thread() { public void run() { while(true) { panel.repaint(); try { Thread.sleep(Resources.RENDER_SPEED); } catch (Exception e) {} } } }; displayThread.start(); } @Override public void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(imageBackground, 0, 0, Resources.WINDOW_WIDTH, Resources.WINDOW_HEIGHT, null); } }
f4de822ae721756555a6987a176455ff99d9192b
f8eb6c1084c102da06d03de1b72d4aac745d8686
/ignorance-test/src/test/java/nom/ignorance/test/test/io/netty/codec/MsgpackEncoder.java
22cf244596e2655cb38624378675ea033067bdea
[]
no_license
huangzhangting/ignorance
f43a0d5edfd07e94a176dfcf393b90b69964e158
2a6be64e7b7349cd2752be8270a53490b73823e5
refs/heads/master
2020-06-28T12:37:21.940068
2018-07-11T06:49:12
2018-07-11T06:49:12
97,095,706
0
0
null
null
null
null
UTF-8
Java
false
false
619
java
package nom.ignorance.test.test.io.netty.codec; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.MessageToByteEncoder; import org.msgpack.MessagePack; /** * Created by huangzhangting on 2017/8/10. */ public class MsgpackEncoder extends MessageToByteEncoder<Object> { @Override protected void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception { System.out.println("MsgpackEncoder: "+msg); MessagePack pack = new MessagePack(); byte[] bytes = pack.write(msg); out.writeBytes(bytes); } }
333519328257b189cb3ee7f282b10c850c2e20e8
9534f9a0b1bb443d853e77250f6265dc5f3c5a0a
/src/main/java/thinkinjava/test13/proxy/Interface.java
2be6468883adc080245dfb2f189c7307d6bdf907
[]
no_license
arsenal-ac/java-basic
48a2a8a5eddd9956625a57b6820102aafc7ad734
2aece800b5008b58f0d33d8f293a755b2849b296
refs/heads/master
2020-12-30T13:27:55.621179
2018-04-22T10:46:40
2018-04-22T10:46:40
91,216,861
0
2
null
2017-05-14T03:33:55
2017-05-14T03:15:58
Java
UTF-8
Java
false
false
121
java
package thinkinjava.test13.proxy; public interface Interface { void doSomething(); void somethingElse(String args); }
52d950287c16fad5e7de10b505f677309cfda450
d56f8598ca08ca646f37cede43d6cc3e5654e24e
/src/main/java/com/fc/test/controller/admin/DictTypeController.java
8d7c34897facb5020ceb449c90cf3062a80731d5
[ "Apache-2.0" ]
permissive
wuchonggo/Springboot_v2
d015211cfddde4b8467e23db4ebc36e60d8fc85a
6057b0cb49e35afe5a75d6119a8e304808853506
refs/heads/master
2020-08-23T04:39:14.248737
2019-10-20T17:18:42
2019-10-20T17:18:42
216,545,183
2
0
Apache-2.0
2019-10-21T10:54:29
2019-10-21T10:54:29
null
UTF-8
Java
false
false
3,687
java
package com.fc.test.controller.admin; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.github.pagehelper.PageInfo; import com.fc.test.common.base.BaseController; import com.fc.test.common.domain.AjaxResult; import com.fc.test.model.auto.TSysDictType; import com.fc.test.model.custom.TableSplitResult; import com.fc.test.model.custom.Tablepar; import com.fc.test.model.custom.TitleVo; import com.fc.test.service.SysDictTypeService; import io.swagger.annotations.Api; @Controller @RequestMapping("DictTypeController") @Api(value = "字典类型表") public class DictTypeController extends BaseController{ private String prefix = "admin/dict_type"; @Autowired private SysDictTypeService tSysDictTypeService; @GetMapping("view") @RequiresPermissions("system:dictType:view") public String view(ModelMap model) { String str="字典类型表"; setTitle(model, new TitleVo("列表", str+"管理", true,"欢迎进入"+str+"页面", true, false)); return prefix + "/list"; } //@Log(title = "字典类型表集合查询", action = "111") @PostMapping("list") @RequiresPermissions("system:dictType:list") @ResponseBody public Object list(Tablepar tablepar,String searchTxt){ PageInfo<TSysDictType> page=tSysDictTypeService.list(tablepar,searchTxt) ; TableSplitResult<TSysDictType> result=new TableSplitResult<TSysDictType>(page.getPageNum(), page.getTotal(), page.getList()); return result; } /** * 新增 */ @GetMapping("/add") public String add(ModelMap modelMap) { return prefix + "/add"; } //@Log(title = "字典类型表新增", action = "111") @PostMapping("add") @RequiresPermissions("system:dictType:add") @ResponseBody public AjaxResult add(TSysDictType tSysDictType,Model model){ int b=tSysDictTypeService.insertSelective(tSysDictType); if(b>0){ return success(); }else{ return error(); } } /** * 删除用户 * @param ids * @return */ //@Log(title = "字典类型表删除", action = "111") @PostMapping("remove") @RequiresPermissions("system:dictType:remove") @ResponseBody public AjaxResult remove(String ids){ int b=tSysDictTypeService.deleteByPrimaryKey(ids); if(b>0){ return success(); }else{ return error(); } } /** * 检查用户 * @param tsysUser * @return */ @PostMapping("checkNameUnique") @ResponseBody public int checkNameUnique(TSysDictType tSysDictType){ int b=tSysDictTypeService.checkNameUnique(tSysDictType); if(b>0){ return 1; }else{ return 0; } } /** * 修改跳转 * @param id * @param mmap * @return */ @GetMapping("/edit/{id}") public String edit(@PathVariable("id") String id, ModelMap mmap) { mmap.put("TSysDictType", tSysDictTypeService.selectByPrimaryKey(id)); return prefix + "/edit"; } /** * 修改保存 */ //@Log(title = "字典类型表修改", action = "111") @RequiresPermissions("system:dictType:edit") @PostMapping("/edit") @ResponseBody public AjaxResult editSave(TSysDictType record) { return toAjax(tSysDictTypeService.updateByPrimaryKeySelective(record)); } }
1cdaa1cb539e71c6add92442592525e4501da9b2
0bab993df7fad023b9714189d98d3df66b747088
/hawaii-core/src/main/java/org/hawaiiframework/util/tuple/Tuple8.java
3db7c68798938cd9197fb7255fb9d3367e1b667d
[ "Apache-2.0" ]
permissive
hellhand/hawaii-framework
790541737bc9737a8eb1163e4b8b30d744d3ec6b
78c8d569055755d081a1cb3c822831f869c811d7
refs/heads/master
2020-03-16T08:45:46.263542
2017-11-08T12:37:04
2017-11-08T12:37:04
132,601,873
0
1
null
2018-05-08T11:54:51
2018-05-08T11:54:51
null
UTF-8
Java
false
false
2,684
java
/* * Copyright 2015-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.hawaiiframework.util.tuple; import java.util.Objects; /** * A {@link Tuple} of 8 elements. * * @param <T1> the type of the 1st element * @param <T2> the type of the 2nd element * @param <T3> the type of the 3rd element * @param <T4> the type of the 4th element * @param <T5> the type of the 5th element * @param <T6> the type of the 6th element * @param <T7> the type of the 7th element * @param <T8> the type of the 8th element * @author Marcel Overdijk * @since 2.0.0 */ @SuppressWarnings({"checkstyle:ClassTypeParameterName", "checkstyle:ParameterNumber", "PMD.GenericsNaming"}) public class Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> extends Tuple7<T1, T2, T3, T4, T5, T6, T7> { private static final long serialVersionUID = 1L; private T8 element8; /** * Constructs a new {@code Tuple} with the supplied elements. */ public Tuple8(final T1 element1, final T2 element2, final T3 element3, final T4 element4, final T5 element5, final T6 element6, final T7 element7, final T8 element8) { super(element1, element2, element3, element4, element5, element6, element7); this.element8 = element8; } /** * Returns the 8th element of this tuple. * * @return the 8th element of this tuple */ public T8 getElement8() { return element8; } /** * Sets the 8th element of this tuple. */ public void setElement8(final T8 element8) { this.element8 = element8; } @Override public int size() { return 8; } @Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } final Tuple8 other = (Tuple8) o; return Objects.equals(this.element8, other.element8); } @Override public int hashCode() { return super.hashCode() + Objects.hash(element8); } }
6d6e150023d2d78c9893252f63c6e5ab2bdaa606
d46a8f8b81fd002650acd0335b8e239115f6adfb
/src/main/StarPlane.java
c22cdc1eb69aaeb84b07ac544a85c83222f9e7e3
[]
no_license
clarriu97/ShipWar
047db74162768c31a2dc5fa0a964e2195d19629d
5074866698817d4b2481dd72f9366e413abe7fff
refs/heads/master
2022-12-21T15:15:28.802900
2020-09-29T08:16:18
2020-09-29T08:16:18
299,549,788
0
0
null
null
null
null
UTF-8
Java
false
false
547
java
package main; import java.util.ArrayList; public class StarPlane extends ArrayList<Star> implements Dibujable { @Override public void move() { for (Star s: this) { s.move(); } } @Override public void draw() { for (Star s: this) { s.draw(); } } public void removeStars() { int l = size(); for (int i = l-1; i >= 0; i--) { if (get(i).isBeyond()) { remove(i); //System.out.println("star beyond"); } } } }
68e950d7dc177d16451674e3ea20e19c229ee82f
54bfdbe6c1a249f00f87cafacccb65f8a32d40fc
/dspace-api/src/main/java/org/dspace/scripts/factory/impl/ScriptServiceFactoryImpl.java
ba8cd1a7847d90bc30904b455d23e247d826cdb1
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause", "MPL-1.0", "W3C", "GPL-1.0-or-later", "LicenseRef-scancode-unicode", "LGPL-2.1-or-later", "LGPL-2.0-or-later", "CDDL-1.0", "MIT", "Apache-2.0", "JSON", "EPL-1.0", "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unicode-icu-58" ]
permissive
4Science/DSpace
55fb70023af8e742191b3f6dd0a06a061bc8dfc9
0c4ee1a65dca7b0bc3382c1a6a642ac94a0a4fba
refs/heads/dspace-cris-7
2023-08-16T05:22:17.382990
2023-08-11T10:00:00
2023-08-11T10:00:00
63,231,221
43
96
BSD-3-Clause
2023-09-08T15:54:48
2016-07-13T09:02:10
Java
UTF-8
Java
false
false
963
java
/** * The contents of this file are subject to the license and copyright * detailed in the LICENSE and NOTICE files at the root of the source * tree and available online at * * http://www.dspace.org/license/ */ package org.dspace.scripts.factory.impl; import org.dspace.scripts.factory.ScriptServiceFactory; import org.dspace.scripts.service.ProcessService; import org.dspace.scripts.service.ScriptService; import org.springframework.beans.factory.annotation.Autowired; /** * The implementation for the {@link ScriptServiceFactory} */ public class ScriptServiceFactoryImpl extends ScriptServiceFactory { @Autowired(required = true) private ScriptService scriptService; @Autowired(required = true) private ProcessService processService; @Override public ScriptService getScriptService() { return scriptService; } @Override public ProcessService getProcessService() { return processService; } }
cc20f76601c5104f89a105cbf953b61c66ea4bd8
41ccf6613996afd27bed1129ad7124d450efdc71
/sc-order/sc-fulfillment/sc-fulfillment-dubbo/src/main/java/com/yatang/sc/order/handler/CanceledOrderListener.java
abc6e4035d23681478087414fe7b2b53135f8ceb
[]
no_license
sengeiou/demo-1
ea02da49043080694f5d6d1554e5a7766bae3ca6
a15185df951c12ac863ce530f824d0280b8e7e8a
refs/heads/master
2021-09-09T10:18:06.081572
2018-03-15T04:19:37
2018-03-15T04:19:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,609
java
package com.yatang.sc.order.handler; import com.alibaba.fastjson.JSON; import com.busi.common.resp.Response; import com.busi.common.utils.StringUtils; import com.yatang.sc.common.staticvalue.CommonsEnum; import com.yatang.sc.exception.MqBizFailureException; import com.yatang.sc.facade.dto.LogicWarehouseDto; import com.yatang.sc.facade.dubboservice.WarehouseLogicQueryDubboService; import com.yatang.sc.fulfillment.dto.OrderCancelConfirmDto; import com.yatang.sc.fulfillment.dubboservice.OrderFulfillerDubboService; import com.yatang.sc.inventory.dubboservice.ItemLocInventoryDubboService; import com.yatang.sc.kidd.dto.orderCancel.KiddCancelAllOrdersDto; import com.yatang.sc.kidd.dto.orderCancel.KiddCancelOrdersDto; import com.yatang.sc.kidd.service.KiddOrderCancelService; import com.yatang.sc.order.OrderInventoryHelper; import com.yatang.sc.order.domain.Order; import com.yatang.sc.order.msg.OrderMessage; import com.yatang.sc.order.msg.OrderMessageType; import com.yatang.sc.order.service.CommerceItemService; import com.yatang.sc.order.service.OrderItemsService; import com.yatang.sc.order.service.OrderLogService; import com.yatang.sc.order.service.OrderService; import com.yatang.sc.order.states.CancelOrderStates; import com.yatang.sc.order.states.OrderStates; import com.yatang.sc.order.states.ShippingStates; import com.yatang.sc.staticvalue.KiddOrderLogisticsType; import com.yatang.sc.vo.UpdateOrderVO; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; /** * 取消订单mq中间层服务 */ @Service("canceledOrderListener") public class CanceledOrderListener extends OrderMsgListener { protected Logger log = LoggerFactory.getLogger(CanceledOrderListener.class); @Autowired ItemLocInventoryDubboService itemLocInventoryDubboService; @Autowired OrderService orderService; @Autowired OrderItemsService orderItemsService; @Autowired CommerceItemService commerceItemService; @Autowired OrderLogService orderLogService; @Autowired KiddOrderCancelService kiddOrderCancelService; @Autowired OrderInventoryHelper orderInventoryHelper; @Autowired WarehouseLogicQueryDubboService warehouseLogicQueryDubboService; @Autowired private OrderFulfillerDubboService mOrderFulfillerDubboService; @Override public void handle(OrderMessage msg) { log.info("handle msg order id: " + msg.getOrderId()); Order order = orderService.selectByPrimaryKey(msg.getOrderId()); if (order == null) { log.error("can't find order by id: " + msg.getOrderId()); return; } if (order.getOrderState().equals(OrderStates.CANCELLED)) { log.warn("{}订单状态【{}】不正确,取消事件处理失败", msg.getOrderId(), order.getOrderState()); return; } if (OrderStates.CANCELLED.equalsIgnoreCase(order.getOrderState())) { log.info("订单已被取消,不再拆单:{}", order.getOrderState()); return; } if (order.getInteractivePendingRes()) { log.warn("{}订单状态【{}】,等待GLink处理结果通知", msg.getOrderId(), order.getOrderState()); throw new RuntimeException("等待GLink处理结果通知,暂不允许取消操作."); } /** * 1. 如果物流状态为“待出库”,则向WMS发送取消出库通知 * 2. 订单未送到 取消时,向WMS发送取消出库通知 */ if (ShippingStates.PENDING_DELIVERY.equals(order.getShippingState()) //|| ShippingStates.NO_ARRIVED.equals(order.getShippingState())//TODO 暂不对“未送达”订单调用WMS接口取消订单 ) { // 调用Kidd中间件服务取消订单 KiddCancelAllOrdersDto kiddCancelAllOrdersDto = new KiddCancelAllOrdersDto(); List<KiddCancelOrdersDto> cancelOrdersDtos = new ArrayList<KiddCancelOrdersDto>(); KiddCancelOrdersDto kiddCancelOrdersDto = new KiddCancelOrdersDto(); kiddCancelOrdersDto.setOrderCode(order.getId());//订单编号 kiddCancelOrdersDto.setWarehouseCode(order.getBranchCompanyArehouse()); cancelOrdersDtos.add(kiddCancelOrdersDto); kiddCancelAllOrdersDto.setOrders(cancelOrdersDtos); kiddCancelAllOrdersDto.setOrderType(KiddOrderLogisticsType.KIDD_XSCK);//发货出库 自定义类型 kidd销售出库 Response<LogicWarehouseDto> logicWarehouseDtoResponse = warehouseLogicQueryDubboService.selectLogicWarehouseByPrimaryKey(order.getBranchCompanyArehouse()); if (CommonsEnum.RESPONSE_200.getCode().equalsIgnoreCase(logicWarehouseDtoResponse.getCode())) { kiddCancelOrdersDto.setOrgCode(logicWarehouseDtoResponse.getResultObject().getBranchCompanyCode()); // cancelOrders.setOrgCode(logicWarehouseDtoResponse.getResultObject().getBranchCompanyCode()); } else { log.warn("出货仓dubbo服务调用失败:{}", order.getBranchCompanyArehouse()); throw new RuntimeException("出货仓dubbo服务调用失败。"); } Response<String> response = kiddOrderCancelService.cancel(kiddCancelAllOrdersDto);//取消订单发送信息 log.info("处理订单取消操作返回结果:{}", JSON.toJSONString(response)); if (CommonsEnum.RESPONSE_20051.getCode().equals(response.getCode())) {//调用取消操作出错 log.error("send cancel order message failed:{}", JSON.toJSONString(response)); order.setDescription("取消申请接口调用失败:" + subErrorMsg(response.getErrorMessage())); order.setCancelStatus(CancelOrderStates.QXSB.getStateValue()); UpdateOrderVO updateOrderVO = new UpdateOrderVO(); updateOrderVO.setOrder(order); updateOrderVO.setPreOrderState(order.getState()); updateOrderVO.setDescription("取消申请接口调用失败:" + subErrorMsg(response.getErrorMessage())); updateOrderVO.setOperator("系统"); orderService.updateAndSaveLog(updateOrderVO); return; } else if (CommonsEnum.RESPONSE_500.getCode().equals(response.getCode())) { log.error("取消申请接口调用失败", JSON.toJSONString(response)); return; } } else { //订单还停留在我们系统中的处理 OrderCancelConfirmDto orderCancelConfirmDto = new OrderCancelConfirmDto(); orderCancelConfirmDto.setOrderId(order.getId()); Response<Boolean> response = mOrderFulfillerDubboService.orderCancelConfirm(orderCancelConfirmDto); log.info("订单取消接口调用返回结果:{}", JSON.toJSONString(response)); if (response != null && !response.isSuccess()) { throw new MqBizFailureException(response.getErrorMessage()); } } } private String subErrorMsg(String errorMsg) { if (StringUtils.isEmpty(errorMsg)) { return ""; } if (errorMsg.length() < 160) { return errorMsg; } return errorMsg.substring(0, 160); } @Override public boolean isCare(OrderMessage msg) { return OrderMessageType.CANCELED_ORDER.equals(msg.getMssageType()); } }
b4ff9bba2d0e205424ed902537d9dd50a6b2a42a
5713658434a4b558f22691522fdcdf2d06eb2c5a
/Work1/src/main/java/cn/util/SwaggerConfig.java
f519644dcbec5b8683e46e76ef391f877e72b6d6
[]
no_license
WuSong0/workDemo
f18458983f5d6eefb92460b502f2107c50b799b1
be90dd6f437854a4359abecd410bae5adb6f11a3
refs/heads/master
2020-06-11T03:25:37.758412
2016-12-16T04:02:10
2016-12-16T04:02:10
76,015,195
0
0
null
null
null
null
UTF-8
Java
false
false
1,578
java
package cn.util; import com.mangofactory.swagger.configuration.SpringSwaggerConfig; import com.mangofactory.swagger.models.dto.ApiInfo; import com.mangofactory.swagger.plugin.EnableSwagger; import com.mangofactory.swagger.plugin.SwaggerSpringMvcPlugin; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; /** * Created by Administrator on 2016-12-13 0013. */ @Configuration @EnableSwagger @ComponentScan(basePackages = {"cn.controller"}) public class SwaggerConfig extends WebMvcConfigurerAdapter { private SpringSwaggerConfig springSwaggerConfig; @Autowired public void setSpringSwaggerConfig(SpringSwaggerConfig springSwaggerConfig) { this.springSwaggerConfig = springSwaggerConfig; } @Bean public SwaggerSpringMvcPlugin customImplementation() { return new SwaggerSpringMvcPlugin(this.springSwaggerConfig) .apiInfo(apiInfo()) .includePatterns(".*?"); } private ApiInfo apiInfo() { ApiInfo apiInfo = new ApiInfo( "My Apps API Title--XX系统接口", "My Apps API Description", "My Apps API terms of service", "My Apps API Contact Email", "My Apps API Licence Type", null); return apiInfo; } }
3bca98a392e28b1516f944bf62a4c262120c3b37
e5624e46aeb99a73c8302c35856d63119de10d8f
/src/guiObserver/ObserverGui.java
fbaa55ea21868944ccd048f35d9fab5e81f9a75d
[]
no_license
sdlyfyr/distrubutedFileSystem
5b71b958f7c7e6bc9b22779b4709182121fed6b9
8e7652f208377c18322805af72d99593fa7ae572
refs/heads/master
2020-09-04T01:54:59.952899
2019-03-06T01:15:16
2019-03-06T01:15:16
null
0
0
null
null
null
null
GB18030
Java
false
false
3,128
java
package guiObserver; import java.awt.Button; import java.awt.FlowLayout; import java.awt.Font; import java.awt.Frame; import java.awt.TextArea; import java.awt.TextField; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import java.util.Observer; import javax.swing.JTextArea; public class ObserverGui { private Frame f; private TextArea ta; private JTextArea ta1; private JTextArea ta2; private JTextArea ta3; private JTextArea ta4; private JTextArea ta5; private Button but1; private Button but2; private Button but3; private Button but4; ObserverGui() { // TODO Auto-generated method stub init(); } public void init() { System.out.println(1); f=new Frame("ObserverGui"); f.setBounds(400,150,600,500); f.setLayout(new FlowLayout()); ta=new TextArea(3,70); ta.setFont(new Font("宋体",Font.BOLD,27)); ta.setText("\n\n"+" 请选择查看方式:"); ta3=new JTextArea(1,70); ta4=new JTextArea(1,20); ta5=new JTextArea(1,20); ta3.setText(""); ta1=new JTextArea(1,20); ta1.setText("1.定时查看文件信息"); ta1.setFont(new Font("宋体",Font.BOLD,25)); ta2=new JTextArea(1,20); ta2.setText("2.定时查看存储节点信息"); ta2.setFont(new Font("宋体",Font.BOLD,25)); ta4.setText("3.实时查看文件信息"); ta4.setFont(new Font("宋体",Font.BOLD,25)); ta5.setText("4.实时查看存储节点信息"); ta5.setFont(new Font("宋体",Font.BOLD,25)); but1=new Button("选择"); but2=new Button("选择"); but3=new Button("选择"); but4=new Button("选择"); myEvent();// 加载事件处理 f.add(ta); f.add(ta3); f.add(ta1); f.add(but1); f.add(ta2); f.add(but2); f.add(ta4); f.add(but3); f.add(ta5); f.add(but4); f.setVisible(true); } public void myEvent() { f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); but1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub new FileNodeObserverByTimer(10); } }); but2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub new FileStoragyObserverByTimer(10); } }); but3.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub new FileNodeObserverByRealTime(3); } }); but4.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub new FileStoragyObserverByRealTime(10); } }); } public static void main(String[] args) { new ObserverGui(); } }
aaceeba343525cd96fecec4030d2abd1638be58c
e12546a5102fc946cb4e1621ceab5d99d1678565
/file-stores/factory/src/test/java/ai/subut/kurjun/storage/factory/FileStoreFactoryImplTest.java
911764a84b6fcf4dc0c9b8db592b8bbde95d5768
[ "Apache-2.0" ]
permissive
TalasZh/kurjun
afa23f0cb61d182cc2a28c68adaeac38728a2660
bf75eecff43fab26bdd7bfa4ccb08221d4565585
refs/heads/master
2020-12-26T15:48:34.410330
2016-06-13T16:02:42
2016-06-13T16:02:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,505
java
package ai.subut.kurjun.storage.factory; import java.util.Properties; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import com.google.inject.ProvisionException; import ai.subut.kurjun.common.service.KurjunContext; import ai.subut.kurjun.common.service.KurjunProperties; import ai.subut.kurjun.model.storage.FileStore; import ai.subut.kurjun.storage.fs.FileSystemFileStoreFactory; import ai.subut.kurjun.storage.s3.S3FileStoreFactory; import junit.framework.TestCase; import static org.mockito.Mockito.when; @RunWith( MockitoJUnitRunner.class ) public class FileStoreFactoryImplTest extends TestCase { private static final String CONTEXT = "public"; private static final String FILE_SYSTEM_TYPE = "fs"; private static final String S3_TYPE = "s3"; private FileStoreFactoryImpl fileStoreFactory; @Mock KurjunProperties kurjunProperties; @Mock FileSystemFileStoreFactory fileSystemFileStoreFactory; @Mock S3FileStoreFactory s3FileStoreFactory; @Mock KurjunContext kurjunContext; @Mock Properties properties; @Mock FileStore fileStore; @Before public void setUp() throws Exception { fileStoreFactory = new FileStoreFactoryImpl(); // injection fileStoreFactory.setProperties( kurjunProperties ); fileStoreFactory.setFileSystemFileStoreFactory( fileSystemFileStoreFactory ); fileStoreFactory.setS3FileStoreFactory( s3FileStoreFactory ); // mock objects in create method when( kurjunContext.getName() ).thenReturn( CONTEXT ); when( kurjunProperties.getContextProperties( CONTEXT ) ).thenReturn( properties ); } @Test public void testCreatefileSystemFileStoreFactory() throws Exception { when( properties.getProperty( "file.storage.type" ) ).thenReturn( FILE_SYSTEM_TYPE ); fileStoreFactory.create( kurjunContext ); } @Test public void testCreateS3FileStoreFactory() throws Exception { when( properties.getProperty( "file.storage.type" ) ).thenReturn( S3_TYPE ); fileStoreFactory.create( kurjunContext ); } @Test( expected = ProvisionException.class ) public void shouldThrowExceptionInvalidType() throws Exception { when( properties.getProperty( "file.storage.type" ) ).thenReturn( "test" ); fileStoreFactory.create( kurjunContext ); } }
942f1a2ae6991a43265c67a4fb2cb000bbb15d87
0f652aef8fa9715534beed360ff053642fdb565b
/app/src/main/java/com/simbaeducation/reportIt/Date_Operations.java
930ab7459ab50429598a9a900fd1c0406f5cf696
[]
no_license
KudzaiMakufa/REPORTit
838ac2b5ebb1f65be55b020c157facf22acc95bc
d0cd9273e8193ebf8dfdafd0c13a1b02ec3bf0e5
refs/heads/master
2020-04-29T11:56:20.509847
2019-03-19T12:09:44
2019-03-19T12:09:44
176,119,123
1
0
null
null
null
null
UTF-8
Java
false
false
1,352
java
package com.simbaeducation.reportIt; import android.app.DatePickerDialog; import android.content.Context; import android.widget.DatePicker; import android.widget.EditText; import java.text.DateFormat; import java.util.Calendar; import java.util.Date; import java.util.TimeZone; public class Date_Operations { public void appDate(final EditText dateassignarea , Context theclass){ DatePickerDialog.OnDateSetListener dpd = new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { int s=monthOfYear+1; String a = dayOfMonth+"/"+s+"/"+year; dateassignarea.setText(""+a); } }; Calendar c = Calendar.getInstance(); c.setTimeZone(TimeZone.getTimeZone("UTC")); int mYear = c.get(Calendar.YEAR); int mMonth = c.get(Calendar.MONTH); int mDay = c.get(Calendar.DAY_OF_MONTH); DatePickerDialog dialog = new DatePickerDialog(theclass , dpd, mYear, mMonth, mDay); dialog.show(); } public String GetCurrentTimeAndDate(){ String currentDateTimeString = DateFormat.getDateTimeInstance().format(new Date()); return currentDateTimeString; } }
a106b4d2a93f004d1f3d970df0a871eb374dcd78
7435ab01a98caf25ad1d54d867566051f0bb0577
/easyframework-root/easyframework-webapp/src/main/java/com/leixl/easyframework/action/front/SearchAction.java
0a0412c5968a1a087a329728eca4dff0f1318812
[]
no_license
leixl/chang
df2c2e1bf2b51f1934614a7f261cdcdc6dd466ef
6d3490e203dbe3060d2fe03cdd74ec433d875e31
refs/heads/master
2021-03-12T22:33:29.264192
2014-04-22T15:24:08
2014-04-22T15:24:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,651
java
/** * Project: easyframework-webapp * * File Created at 2014年1月22日 * $Id$ * * Copyright 2013 leixl.com Croporation Limited. * All rights reserved. * * This software is the confidential and proprietary information of * disclose such Confidential Information and shall use it only in * accordance with the terms of the license agreement you entered into */ package com.leixl.easyframework.action.front; import static com.leixl.easyframework.web.TplUtils.MODULE_NAME_MOVIE; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.leixl.easyframework.web.BaseAction; import com.leixl.easyframework.web.RequestUtils; import com.leixl.easyframework.web.TplUtils; /** * * @author leixl * @date 2014年1月22日 下午4:39:07 * @version v1.0 */ @Controller public class SearchAction extends BaseAction{ public static final String SEARCH_INPUT = "tpl.searchInput"; public static final String SEARCH_RESULT = "tpl.searchResult"; /** * 列表模板名称 */ public static final String TPL_TAGMOVIE_LIST = "tpl.movie.tag_list"; @RequestMapping(value = "/search*.htm", method = RequestMethod.GET) public String index(HttpServletRequest request, HttpServletResponse response, ModelMap model) { // 将request中所有参数保存至model中。 model.putAll(RequestUtils.getQueryParams(request)); TplUtils.frontData(request, model); TplUtils.frontPageData(request, model); String q = RequestUtils.getQueryParam(request, "q"); String parseQ=parseKeywords(q); model.addAttribute("input",q); model.addAttribute("q",parseQ); if (StringUtils.isBlank(q)) { return TplUtils.getTplPath(request, MODULE_NAME_MOVIE, SEARCH_INPUT); } else { return TplUtils.getTplPath(request, MODULE_NAME_MOVIE, SEARCH_RESULT); } } @RequestMapping(value = "/getPageByTagIds.htm", method = RequestMethod.GET) public String getPageByTagIds(HttpServletRequest request, HttpServletResponse response, ModelMap model) { // 将request中所有参数保存至model中。 model.putAll(RequestUtils.getQueryParams(request)); TplUtils.frontData(request, model); TplUtils.frontPageData(request, model); String tagId = RequestUtils.getQueryParam(request, "tagId"); model.addAttribute("tagId",tagId); return TplUtils.getTplPath(request, MODULE_NAME_MOVIE, TPL_TAGMOVIE_LIST); } }
85e770907a85a360d47d1dc33872c747d644ccc9
2a4585bb74ca0bc5decfed0b63555056ee9746a8
/src/test/java/MyStepdefs.java
ba98f0c9ade9e9b653ae499203756d7a4b539539
[]
no_license
adeepakb1/kristal
bec111ac5308e040a1410f16874eb28ac67c253d
9e24b6792ec95a25e174ec2cb79ee78e0542e722
refs/heads/master
2022-07-04T00:52:45.168148
2020-02-28T11:47:51
2020-02-28T11:47:51
243,746,518
0
0
null
2022-05-20T21:29:27
2020-02-28T11:25:31
Java
UTF-8
Java
false
false
1,221
java
import cucumber.api.java.en.And; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; import io.restassured.response.Response; public class MyStepdefs { private static ApiController apiController; private static TestSteps testSteps; @Given("^I am new user with \"([^\"]*)\" and$") public void iAmNewUserWithAnd(String arg0) throws Throwable { // Write code here that turns the phrase above into concrete actions apiController = new ApiController(); testSteps = new TestSteps(); testSteps.sendOtp(arg0); Response response = apiController.sendOtp(arg0); response.prettyPrint(); /*sendOtp(email); getOtp(email); getKrystals(); addKrystalstoBookMark(); assertBookmarkAdded();*/ } @When("^I get Krystals$") public void iGetKrystals() { testSteps.getKrystals(); } @And("^add kristal to bookmark$") public void addKristalToBookmark() { testSteps.addKrystalstoBookMark(); } @Then("^assert kristal is added to bookmark$") public void assertKristalIsAddedToBookmark() { testSteps.assertBookmarkAdded(); } }
299e4ef05df71d648c6ff22a6ccf9e6e4932eada
b7863c8f4450d6fa9492c1921c8bed482bbc4873
/bus-cache/src/main/java/org/aoju/bus/cache/package-info.java
97b699601d68b3568887664d1dd039e3280bb38e
[ "MIT" ]
permissive
BruceBruceZheng/bus
479284c8143fd70fdc4b4a9f33c81e5d64b5e15e
3123ed5301c0d08a5c4e933653995b9bb63acf5e
refs/heads/master
2023-08-23T20:27:17.715754
2021-10-14T05:57:36
2021-10-14T05:57:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
126
java
/** * 工业级缓存解决方案 * * @author Kimi Liu * @version 6.3.0 * @since JDK 1.8+ */ package org.aoju.bus.cache;
4fed40800a741243efff782a286b0c260b132cb9
b882dc0bdff1eb6764f8f9687b002fc2fa696e57
/src/main/java/org/cowin/tracker/model/Appointment.java
c92e6ed5ca3cc2fc41bf9fab1de0ca8babec61d3
[]
no_license
NitinMaurya/Cowin-Vaccine-Tracker
c170ca7d7b38820946edb8d6897b88f9269b7505
34fea0f4972d3b258c59efefa166f255257c5e69
refs/heads/master
2023-04-19T13:24:53.890553
2021-05-09T18:41:50
2021-05-09T18:41:50
365,808,666
0
1
null
null
null
null
UTF-8
Java
false
false
321
java
package org.cowin.tracker.model; import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Data; import org.cowin.tracker.entity.Session; import java.util.List; @Data @JsonInclude(JsonInclude.Include.NON_NULL) public class Appointment { private List<Session> sessions; private List<Center> centers; }
5f9f84b317b7ff777e8faa7110e209c6cc3be5e4
9bb9853d851b2c48e1f53d9cb94fd99b23464a22
/src/main/java/za/co/neildutoit/jSatisfactorySaveLoader/game/script/FGRailroadTrackConnectionComponent.java
89b22a16d0ecf1e637975a80366fc07bcb8a2e9a
[ "MIT" ]
permissive
NeilDuToit92/JSatisfactorySaveLoader
bb28a35c3cb844b78fb8e2dc19f441b39d7cfd14
ca5408916205b46af7115bb4d700be1ac29a3cf3
refs/heads/master
2022-11-19T07:29:38.262651
2020-07-07T13:54:34
2020-07-07T13:54:34
276,661,186
0
0
null
null
null
null
UTF-8
Java
false
false
504
java
package za.co.neildutoit.jSatisfactorySaveLoader.game.script; import za.co.neildutoit.jSatisfactorySaveLoader.game.SaveObjectClass; @SaveObjectClass("/Script/FactoryGame.FGRailroadTrackConnectionComponent") public class FGRailroadTrackConnectionComponent extends FGConnectionComponent { // @SaveProperty("mConnectedComponents") // public List<ObjectReference> ConnectedComponents { get; } = new List<ObjectReference>(); // // @SaveProperty("mSwitchPosition") // public int SwitchPosition; }
e8c947bd82c7fa5457fca00ac15fc07d3e7d3511
e20155a8f7b8096983ee4d46b5637b4630bd1660
/app-api/src/main/java/com/weno/problem/exception/ProblemNotFoundException.java
6558fb915601bca1c8f66de27087f8c6b9c176b1
[]
no_license
CodeSoom/project-spring-1-wenodev
dcc995663ec77249b87172ba69b9585c377cbab5
00d505affd149c87652f6ef4af1f70a0dea10239
refs/heads/main
2023-06-01T07:02:08.527640
2021-06-16T14:15:56
2021-06-16T14:15:56
349,706,012
0
1
null
2021-06-16T14:15:58
2021-03-20T11:29:09
Java
UTF-8
Java
false
false
321
java
package com.weno.problem.exception; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; @ResponseStatus(HttpStatus.NOT_FOUND) public class ProblemNotFoundException extends RuntimeException{ public ProblemNotFoundException(String s) { super(s); } }
550044f95a44223e4e5b74d773efa7310735ec08
0b4a1f0680193a95eb304ecd9a026bb5a12d6777
/Designer/src/Servlet/UserServlet.java
6c13746a7cf33e17625e22f6be485339f419a041
[]
no_license
2654540459/Designer
a8dae12ef1c104059d75455b96a9c9c9513e5d9a
3911cb9a5fd581d3318a538e67a9026c12417b71
refs/heads/master
2020-03-09T01:37:51.438006
2018-04-07T14:32:45
2018-04-07T14:32:45
128,519,835
0
0
null
null
null
null
UTF-8
Java
false
false
2,837
java
package Servlet; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import Dao.UserDao; import DaoImpl.UserDaoImol; import Entity.User; /** * Servlet implementation class UserServlet */ @WebServlet("/UserServlet") public class UserServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected UserDao userdao = new UserDaoImol(); public UserServlet() { } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8"); response.setContentType("text/html; charset=UTF-8"); String action = request.getParameter("action"); if(action.equals("login")) { login(request, response); }else if(action.equals("regist")) { regist(request, response); } } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } /** * 登录验证 * @param request * @param response * @throws IOException * @throws ServletException */ protected void login(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { String name = request.getParameter("LoginName"); String pwd = request.getParameter("LoginPwd"); PrintWriter out = response.getWriter(); User user = userdao.CheckUserLogin(name, pwd); if(user!=null) { HttpSession session = request.getSession(); session.setAttribute("user", user); System.out.println("登录成功"); //跳转到指定页面 request.getRequestDispatcher("index.jsp").forward(request, response); }else { out.print("<script>alert('用户名或密码错误');history.go(-1)</script>"); } } /** * 注册验证 * @param request * @param response * @throws IOException * @throws ServletException */ protected void regist(HttpServletRequest request,HttpServletResponse response)throws IOException, ServletException { String loginname = request.getParameter("LoginName"); String loginpwd = request.getParameter("LoginPwd"); String username = request.getParameter("UserName"); PrintWriter out = response.getWriter(); if(userdao.CheckOnlyLoginName(loginname)) { out.print("<script>alert('登录名已存在');history.go(-1)</script>"); }else { User user = new User(); user.setLoginName(loginname); user.setLoginPwd(loginpwd); user.setUserName(username); userdao.AddUser(user); //注册成功后返回的页面 response.sendRedirect(""); } } }
725d33cdda87196995e32516993af42ff94afec5
a63d261c59ac4e66e20313a8837f22fac3cd0855
/src/cn/edu/xmu/dao/StaffTeachingAchieveDao.java
4859dcd0caeff2d66d99dfd5d04cf6bd20c53112
[]
no_license
Guosmilesmile/iqa
9a7d54a3192b0e4634b9a0f268c106b9cbf1f07d
db7935120911396818146eeadb1ac4da095e0ffb
refs/heads/master
2021-01-20T17:46:31.076475
2016-08-21T08:46:25
2016-08-21T08:46:25
65,795,465
0
0
null
null
null
null
UTF-8
Java
false
false
1,663
java
package cn.edu.xmu.dao; import java.sql.Date; import java.sql.SQLException; import java.util.List; import java.util.Map; import cn.edu.xmu.entity.StaffTeachingAchieve; /** * * @author zhantu * 教学管理人员获教学成果奖情况(时点) 实体类功能接口 * date 2015-07-09 */ public interface StaffTeachingAchieveDao { /** * 插入数据 * * @param sta * 教学管理人员获教学成果奖情况(时点)实体 * @return * 插入数据结果成功与否 */ public int addRecord(StaffTeachingAchieve sta); /** * * @param staids * @return * @throws SQLException */ boolean batchDelete(String[] staids) throws SQLException; /** * * @param valueMap * @param id * @return */ public int alterStaffTeachingAchieve(Map<String, String> valueMap, String id); /** * * @param queryParams * @return * 根据查询条件返回符合条件的条数 */ public int getStaffTeachingAchieveCount(Map queryParams); /** * * @param start 开始的标记 * @param end 结束的标记 * @param sortStr 排序的字段 * @param orderStr 升降选项 * @param queryParams 查询参数 * @return */ public List<StaffTeachingAchieve> getAllStaffTeachingAchieve(int start, int end, String sortStr, String orderStr, Map queryParams); public List<StaffTeachingAchieve> getStaffTeachingAchieve(int start, int end, String sortStr, String orderStr, Map<String, String> params, Date deadline); void deleteByCollegeandDeadline(String college, Date deadline) throws SQLException; List<StaffTeachingAchieve> getAllStaffTeachingAchieve(); }
29fb1949f155904f5011b5ad19468e45831f7248
4260585738d77deb11590f185c6ddd482af40a90
/src/main/java/com/telran/jpa2/entity/Car.java
1c360832185c8ac07e07b38d071003b9e42e7ebd
[]
no_license
chernulich/java-2h-jpa-2-inheritance-converter
2310177a59a6fa0178b84bbf975918fb8eb6a422
bee64378dfd094a78d99dbd4024494753158927f
refs/heads/master
2020-04-11T10:15:20.711927
2018-12-13T22:03:47
2018-12-13T22:03:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
416
java
package com.telran.jpa2.entity; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import javax.persistence.Entity; import javax.persistence.Table; @AllArgsConstructor @NoArgsConstructor @Getter @Setter @Entity @Table(name = "car") public class Car extends Base { private String brand; private String model; private Integer inUseSince; }
bf07da23ce12f08d58c9e9ba32c9b975f67befb5
1bf10a539598f91ab3ac880b2938f270724c6d96
/app/src/main/java/walletmix/com/walletmixpayment/ui/SignUpActivity.java
324faf24ca696ab152164705bc81d03d533ba0f6
[]
no_license
shikto1/qrCodeScanningTest
38cab3a63e3153eae9ecd91d6a29595f0be8ee68
2c0a2c9b48470fb9d4dff0e4aef20189b2e6a2b2
refs/heads/master
2020-04-04T00:58:30.287190
2018-11-28T11:01:57
2018-11-28T11:01:57
155,663,382
0
0
null
null
null
null
UTF-8
Java
false
false
13,193
java
package walletmix.com.walletmixpayment.ui; import android.app.ProgressDialog; import android.content.Intent; import android.support.annotation.NonNull; import android.os.Bundle; import android.view.MenuItem; import android.view.View; import android.widget.EditText; 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.api.ApiException; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.AuthCredential; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseAuthException; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.auth.GoogleAuthProvider; 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.ValueEventListener; import butterknife.BindView; import butterknife.OnClick; import walletmix.com.walletmixpayment.R; import walletmix.com.walletmixpayment.base.BaseActivity; import walletmix.com.walletmixpayment.data.firebase.User; import walletmix.com.walletmixpayment.data.pref.Key; import walletmix.com.walletmixpayment.data.pref.SessionManager; import walletmix.com.walletmixpayment.utils.AlertServices; import walletmix.com.walletmixpayment.utils.ValidationUtils; public class SignUpActivity extends BaseActivity { @BindView(R.id.et_full_name) EditText etFullName; @BindView(R.id.et_email) EditText etEmail; @BindView(R.id.et_password) EditText etPassword; @BindView(R.id.et_phone_number) EditText etPhoneNumber; private DatabaseReference mDatabase; private FirebaseAuth mFireBaseAuth; private SessionManager sessionManager; GoogleSignInClient googleSignInClient; @Override protected int getContentView() { return R.layout.activity_sign_up; } @Override protected void onViewReady(Intent getIntent, Bundle savedInstanceSated) { if (mActionBar != null) { this.setTitle("SIGN UP"); mActionBar.setDisplayHomeAsUpEnabled(true); mActionBar.setDisplayShowHomeEnabled(true); } init(); } private void init() { sessionManager = new SessionManager(this); mDatabase = FirebaseDatabase.getInstance().getReference(); mFireBaseAuth = FirebaseAuth.getInstance(); GoogleSignInOptions signInOptions = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestIdToken(getString(R.string.default_web_client_id)) .requestEmail() .build(); googleSignInClient = GoogleSignIn.getClient(this, signInOptions); googleSignInClient.revokeAccess(); } @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == android.R.id.home) { onBackPressed(); } return super.onOptionsItemSelected(item); } @OnClick({R.id.signUpBtn, R.id.sign_up_with_google_button}) public void onSignUpButtonClicked(View view) { switch (view.getId()) { case R.id.signUpBtn: String userFullName = etFullName.getText().toString(); String email = etEmail.getText().toString(); String phoneNumber = etPhoneNumber.getText().toString(); final String password = etPassword.getText().toString(); final User newUser = new User(userFullName, email, phoneNumber); if (inputIsValid(newUser)) { logUtils.logV(userFullName + "'\n" + email + "\n" + phoneNumber + "\n" + password); showProgressDialog("Signing up..."); mFireBaseAuth.createUserWithEmailAndPassword(email, password).addOnCompleteListener(new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { String userUiId = task.getResult().getUser().getUid(); writeNewUser(userUiId, newUser, task.getResult().getUser()); } else { hideProgressDialog(); String errorCode = ((FirebaseAuthException) task.getException()).getErrorCode(); switch (errorCode) { case "ERROR_INVALID_EMAIL": alertServices.showToast("The email address is not valid."); break; case "ERROR_EMAIL_ALREADY_IN_USE": alertServices.showToast("The email address is already used"); ; break; case "ERROR_CREDENTIAL_ALREADY_IN_USE": alertServices.showToast("This credential is already associated with a different user account."); break; case "ERROR_WEAK_PASSWORD": alertServices.showToast("The given password is very weak"); break; } } } }); } break; case R.id.sign_up_with_google_button: if(networkUtils.isNetworkAvailable()){ if (mFireBaseAuth != null) { Intent signInIntent = googleSignInClient.getSignInIntent(); startActivityForResult(signInIntent, 13); } }else{ showInternetAlertDialog(); } break; } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == 13) { Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data); try { // Google Sign In was successful, authenticate with Firebase GoogleSignInAccount account = task.getResult(ApiException.class); if (account != null) { if (networkUtils.isNetworkAvailable()) { fireBaseAuthWithGoogle(account); } else { showInternetAlertDialog(); } } } catch (ApiException ignored) { } } super.onActivityResult(requestCode, resultCode, data); } private void fireBaseAuthWithGoogle(final GoogleSignInAccount acct) { AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null); showProgressDialog("Signing up..."); mFireBaseAuth.signInWithCredential(credential) .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { FirebaseUser user = task.getResult().getUser(); final String userUiId = user.getUid(); DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference().child(getString(R.string.app_name)).child("users").child(userUiId); databaseReference.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { hideProgressDialog(); if(dataSnapshot.exists()){ User user = dataSnapshot.getValue(User.class); assert user != null; sessionManager.putString(Key.userFullName.name(), user.getUserFullName()); sessionManager.putString(Key.userEmail.name(), user.getEmail()); sessionManager.putString(Key.userPhone.name(), user.getPhoneNumber()); sessionManager.putBoolean(Key.allowed_to_go_home.name(),true); mNavigator.navigateToHomeByFinishingall(SignUpActivity.this); }else{ Intent extraInfoIntent = new Intent(SignUpActivity.this, ExtraInfoForSignUpActivity.class).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); extraInfoIntent.putExtra(Key.userFullName.name(), acct.getDisplayName()); extraInfoIntent.putExtra(Key.userEmail.name(),acct.getEmail()); extraInfoIntent.putExtra(Key.current_user_uiId.name(), userUiId); startActivity(extraInfoIntent); finish(); } } @Override public void onCancelled(DatabaseError databaseError) { hideProgressDialog(); } }); } else { alertServices.showToast("Failed to Sign up."); } } }); } private boolean inputIsValid(User newUser) { boolean result = false; if (newUser.getUserFullName().isEmpty()) { alertServices.showToast("Name can not be empty."); } else if (newUser.getEmail().isEmpty()) { alertServices.showToast("Email can not be empty."); } else if (newUser.getPhoneNumber().isEmpty()) { alertServices.showToast("Phone number can not be empty."); } else if (etPassword.getText().toString().isEmpty()) { alertServices.showToast("Password can not be empty."); } else if (etPassword.getText().toString().trim().length() < 6) { alertServices.showToast("Password must be at least 6 digits."); } else { result = true; } return result; } private void writeNewUser(final String userId, final User user, final FirebaseUser firebaseUser) { if (mDatabase != null) mDatabase.child(getString(R.string.app_name)).child("users").child(userId).setValue(user).addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { firebaseUser.sendEmailVerification().addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { hideProgressDialog(); if(task.isSuccessful()){ etFullName.getText().clear(); etEmail.getText().clear(); etPhoneNumber.getText().clear(); etPassword.getText().clear(); alertServices.showAlertForConfirmation(SignUpActivity.this, "Email Verification Required", "A verification mail has been sent to " + user.getEmail() + ". Please verify your email address and sign in.", null, "Okay", new AlertServices.AlertListener() { @Override public void onNegativeBtnClicked() { } @Override public void onPositiveBtnClicked() { onBackPressed(); } }); } } }); } } }); } }
a821320011623b235bec079f4b8e013aa7912387
e03690fa59d065ebca3724dd2cde092d73c08820
/app/src/main/java/com/ranzan/callerapp/OnItemClicked.java
38d53edc5de292b8b259cc439fde81c4fb00b360
[]
no_license
RANZN/Caller-App
abb1d4bf1ddf6689a15c6148a16605cfaa578e4b
c566f63dce66ce13b2e5833aeb8ef6d76871757d
refs/heads/master
2023-06-17T14:40:45.327451
2021-07-14T06:40:55
2021-07-14T06:40:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
121
java
package com.ranzan.callerapp; public interface OnItemClicked { void onItemClicked(Contact contact, int position); }
e709afb46f5a5db63852b08434f64fa5a460bddc
1ad6422c4ac815641eef90d44b6b7ba6512099de
/src/carsalesandmanagemantproject/CarSalesAndManagemantProject.java
a7d79168287a1d0528a667d6dc5b28592491afb8
[]
no_license
md-bayazid/Car-Sale-Management-Java
f8bef2a23bb90f18f81b8fdf4f15d3475209cf23
a074fa128a24da21d7ec12a674ac061e1a4ce42f
refs/heads/main
2023-01-08T07:48:49.728962
2020-10-31T19:17:35
2020-10-31T19:17:35
308,945,567
0
0
null
null
null
null
UTF-8
Java
false
false
497
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 carsalesandmanagemantproject; /** * * @author md_bayazid */ public class CarSalesAndManagemantProject { /** * @param args the command line arguments */ public static void main(String[] args) { RootTest home = new RootTest(); home.setVisible(true); } }
9ec56d0ff603e8cd7ae104241e008fe8a5bd6e91
878f852abd0c59d2ff5d63cdb562fcaf278ab4b2
/src/com/example/Sapient/flightservice/FlightServiceImpl.java
7c241688514ff1126684a0fc6cc33c769593cba5
[]
no_license
bappaseet/JavaProject
522785f860b2a8f0a7764d632ad54682d8ec328c
fe9e0f7f3d503e5a117e78b7971a49ccdb9efa09
refs/heads/master
2016-08-05T09:08:13.000895
2015-07-12T14:02:17
2015-07-12T14:02:17
38,963,762
0
0
null
null
null
null
UTF-8
Java
false
false
679
java
package com.example.Sapient.flightservice; import java.util.ArrayList; import java.util.List; import com.example.Sapient.entity.FlightDetails; public class FlightServiceImpl implements FlightService{ @Override public List<FlightDetails> searchFlight(List<FlightDetails> flightDetails, String departureLocation, String arrivalLocation, String flightTime) { List<FlightDetails> matchingFlights = new ArrayList<FlightDetails>(); if(flightDetails != null){ for(FlightDetails flightDetail : flightDetails){ if(flightDetail.getDepartureLocation().equals(departureLocation) ){ matchingFlights.add(flightDetail); } } } return matchingFlights; } }
2b73cc33bf32d1864f3e9fbd631a8d7a6a271629
4ec8e7cf370cd1043eb7ae7e91d7588c29f3240e
/EducationAssignment1/src/Oregon/Lesson.java
03e178aa589b176c3d5c8d03816c7f17a30dbdad
[]
no_license
TheSquibby/Squibby-EducationAssignment1
08463ea2db72d7b19515573634790398e5fca736
c302df21e6a31e7ab9f9afbc7209621b664a5bce
refs/heads/master
2016-09-06T19:37:24.845695
2015-05-19T06:46:42
2015-05-19T06:46:42
35,857,508
0
0
null
2015-05-19T06:39:53
2015-05-19T03:37:54
null
UTF-8
Java
false
false
84
java
/** * */ package Oregon; /** * @author Squibby * */ public class Lesson { }
155d88ae8df1b822707643a307c084d70dfda37c
4631f68a8930de7416f749d23a1e0162c4174f52
/src/edu/ucla/library/libservices/webservices/invoices/vger/db/procs/UpdateInvoiceProcedure.java
4ebfd4540128401e07a954ef3a595b5a0b0c71c2
[]
no_license
UCLALibrary/VgerLibBill
9093d876b6b0ad465d36e6e7514943a9417fafed
0658342430700b4957988cd2eabf1d027b43c077
refs/heads/master
2021-06-16T10:01:17.300926
2021-05-28T01:11:41
2021-05-28T01:11:41
55,724,447
0
2
null
2016-04-07T20:06:01
2016-04-07T20:06:01
null
UTF-8
Java
false
false
2,277
java
package edu.ucla.library.libservices.webservices.invoices.vger.db.procs; import edu.ucla.library.libservices.webservices.invoices.vger.db.source.DataSourceFactory; import java.sql.Types; import java.util.HashMap; import java.util.Map; import java.util.Properties; import javax.sql.DataSource; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.SqlParameter; import org.springframework.jdbc.object.StoredProcedure; public class UpdateInvoiceProcedure extends StoredProcedure { private DataSource ds; private Properties props; private String invoiceNumber; private String status; private String whoBy; public UpdateInvoiceProcedure( JdbcTemplate jdbcTemplate, String string ) { super( jdbcTemplate, string ); } public UpdateInvoiceProcedure( DataSource dataSource, String string ) { super( dataSource, string ); } public UpdateInvoiceProcedure() { super(); } public void setProps( Properties props ) { this.props = props; } public void setInvoiceNumber( String invoiceNumber ) { this.invoiceNumber = invoiceNumber; } public void setStatus( String status ) { this.status = status; } public void setWhoBy( String whoBy ) { this.whoBy = whoBy; } private void makeConnection() { ds = DataSourceFactory.createBillSource(getProps()); } public void updateInvoice() { Map results; makeConnection(); prepProc(); results = execute(); } private void prepProc() { setDataSource( ds ); setFunction( false ); //setSql( "invoice_owner.update_invoice" ); setSql( "update_invoice" ); declareParameter( new SqlParameter( "p_invoice_number", Types.VARCHAR ) ); declareParameter( new SqlParameter( "p_status", Types.VARCHAR ) ); declareParameter( new SqlParameter( "p_user_name", Types.VARCHAR ) ); compile(); } private Map execute() { Map input; Map out; out = null; input = new HashMap(); input.put( "p_invoice_number", invoiceNumber ); input.put( "p_status", status ); input.put( "p_user_name", whoBy ); out = execute( input ); return out; } private Properties getProps() { return props; } }
d25f4046e3505b6e5fd7ac57c4dbbb5dda9f39f5
869f4ece0fedf378e80dac0131c1682f06631dd0
/hryweb/src/main/java/com/haier/service/AutocodeService.java
36ffa9800d64d0cf51de87f6b1b3ba102838bdb5
[]
no_license
Rain0193/hryAuto
a9edb9a84b939e3e652b7c210b6209553cea66ac
aa3450c25d3ad16875f403e73f4feeaa15a081cf
refs/heads/master
2020-03-24T04:07:51.809682
2018-07-26T12:38:41
2018-07-26T12:38:41
142,444,886
0
1
null
null
null
null
UTF-8
Java
false
false
194
java
package com.haier.service; import java.util.Map; /** * @Description: * @Author: luqiwei * @Date: 2018/7/25 11:20 */ public interface AutocodeService { Map<String,String> generate(); }
2d6a3778f445a378258557c7bda2705b31ff5985
1977757fa8a337e3346795cfb1ceca9ae95b97fb
/src/code45/Earth.java
f96f7237eb6d6751024cfb6fa69672dbfd189944
[]
no_license
Tarana82/MyFirstProject
fcb3e81c3659e9f846a71c7856fcf4ba914e15ad
6fe9bb5f1d90812f6c2e5ef68ba275435a7cabce
refs/heads/master
2021-02-11T16:22:21.801471
2020-03-03T03:33:39
2020-03-03T03:33:39
244,509,280
0
0
null
null
null
null
UTF-8
Java
false
false
1,143
java
package code45; public class Earth extends Planet { // double gravity; // int radius ; // boolean hasLife; int population; // PRACTICAL USAGE OF Super() keyword to call super class constructor is // to reuse the functionality of super class constructor in sub class constructor public Earth(double gravity, int radius, boolean hasLife, int population) { super(gravity, radius, hasLife); // this.gravity = gravity; // this.radius = radius; // this.hasLife = hasLife; this.population = population; } public static void main(String[] args) { Earth e1 = new Earth(9.81, 5000, true, 100000); System.out.println("e1 = " + e1); } // ADDING toString method so we can print out object @Override public String toString() { return "Earth{" + "population=" + population + ", gravity=" + gravity + ", radius=" + radius + ", hasLife=" + hasLife + '}'; } }
c887167ca7536db4fd7389d48a73817d6fccba3c
624c514120a8382d998ec607fe61094ff1d373cb
/src/main/java/com/arllain/agcsjwtauthapp/security/JwtAuthenticationEntryPoint.java
19f89fb1f3182148712afba3965a5c23d5902ee4
[ "MIT" ]
permissive
arllain/agcs-jwt-auth-app
1cb72db51b5d4d5d839e400a035b6f776495e92d
eecb07ae76e2d9e0e14b9195947d42793e5c49bc
refs/heads/master
2022-12-30T16:01:42.335556
2020-10-13T02:06:06
2020-10-13T02:06:06
303,216,363
0
0
null
null
null
null
UTF-8
Java
false
false
1,472
java
package com.arllain.agcsjwtauthapp.security; import java.io.IOException; import java.io.Serializable; import java.util.Date; import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.AuthenticationEntryPoint; import org.springframework.stereotype.Component; import com.fasterxml.jackson.databind.ObjectMapper; @Component public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint, Serializable { private static final long serialVersionUID = -8970718410437077606L; @Override public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException { final Map<String, Object> mapBodyException = new HashMap<>() ; mapBodyException.put("message" , "Unauthorized") ; mapBodyException.put("status" , HttpServletResponse.SC_UNAUTHORIZED) ; mapBodyException.put("timestamp", (new Date()).getTime()) ; response.setContentType("application/json") ; response.setStatus(HttpServletResponse.SC_UNAUTHORIZED) ; final ObjectMapper mapper = new ObjectMapper() ; mapper.writeValue(response.getOutputStream(), mapBodyException) ; } }
a9ceff578579786cae79994456cd04c4975cc1f7
72d37b5d6a86ca5489af7b85179ed819441fe38f
/meander-detectors/src/main/java/uk/ac/bangor/meander/detectors/m2d/pipes/TSquared.java
b711d96574b5e3c01b5648f249aa3c30ad997ac9
[ "Apache-2.0" ]
permissive
wfaithfull/meander
e3cecb7041144d25d6467aea5b0c8249345ab923
53e765776e6fb9bed70a3b1c5da0a0d930a9fd33
refs/heads/master
2018-09-17T23:01:21.115866
2018-06-05T22:23:19
2018-06-05T22:23:19
111,133,673
3
0
null
2018-03-19T10:49:01
2017-11-17T17:48:29
Java
UTF-8
Java
false
false
3,097
java
package uk.ac.bangor.meander.detectors.m2d.pipes; import org.apache.commons.math3.linear.MatrixUtils; import org.apache.commons.math3.linear.RealMatrix; import org.apache.commons.math3.linear.SingularValueDecomposition; import org.apache.commons.math3.stat.correlation.Covariance; import uk.ac.bangor.meander.detectors.CollectionUtils; import uk.ac.bangor.meander.detectors.Pipe; import uk.ac.bangor.meander.detectors.stats.cdf.support.FStatisticAndDegreesFreedom; import uk.ac.bangor.meander.detectors.windowing.support.WindowPair; import uk.ac.bangor.meander.streams.StreamContext; /** * @author Will Faithfull */ public class TSquared implements Pipe<WindowPair<Double[]>, FStatisticAndDegreesFreedom> { private static final int MAX_CONDITION = 10000; private int df1, df2; private double[] getDiagonal(RealMatrix matrix) { if (!matrix.isSquare()) throw new RuntimeException("Matrix must be square to retrieve diagonal."); double[][] data = matrix.getData(); double[] diagonal = new double[data.length]; int col = 0; for (int i = 0; i < data.length; i++) { diagonal[col] = data[i][col++]; } return diagonal; } @Override public FStatisticAndDegreesFreedom execute(WindowPair<Double[]> windowPair, StreamContext context) { double[][] w1 = CollectionUtils.unbox(windowPair.getTail().getElements()); double[][] w2 = CollectionUtils.unbox(windowPair.getHead().getElements()); double m1 = w1.length; double m2 = w2.length; double n = w1[0].length; RealMatrix covW1 = new Covariance(w1).getCovarianceMatrix().scalarMultiply(m1); RealMatrix covW2 = new Covariance(w2).getCovarianceMatrix().scalarMultiply(m2); RealMatrix pooledCovariance = covW1.add(covW2).scalarMultiply(1 / (m1 + m2 - 2)); double tsq = (m1 + m2 - n - 1) * m1 * m2 / ((m1 + m2) * n * (m1 + m2 - n - 1)); RealMatrix meanW1 = MatrixUtils.createRowRealMatrix(CollectionUtils.colMean(w1)); RealMatrix meanW2 = MatrixUtils.createRowRealMatrix(CollectionUtils.colMean(w2)); SingularValueDecomposition svd = new SingularValueDecomposition(pooledCovariance); double[] diag = getDiagonal(pooledCovariance); if (svd.getConditionNumber() > MAX_CONDITION) { // Regularisation pooledCovariance = MatrixUtils.createRealDiagonalMatrix(diag); svd = new SingularValueDecomposition(pooledCovariance); } RealMatrix inverseCovariance; if (CollectionUtils.min(diag) > 0.000001) inverseCovariance = svd.getSolver().getInverse(); else inverseCovariance = MatrixUtils.createRealIdentityMatrix((int) n); double dist = meanW1.subtract(meanW2) .multiply(inverseCovariance) .multiply(meanW1.subtract(meanW2).transpose()).getEntry(0, 0); tsq = tsq * dist; df1 = (int) n; df2 = (int) (m1 + m2 - n - 1); return new FStatisticAndDegreesFreedom(df1, df2, tsq); } }
2c2bdd72d9a9af3d0ecde3ee128ef8a1eaa88645
e17b089016aa532e6d0822436f2ead16eb0acc7c
/src/wfw/IOJVSCHEME.java
a528bf40ba55cf28a9af0a676b4fd17d7766bd73
[]
no_license
babymills/nhnh
2f74442d54960fe2a1ca36cf6b968003ecee833a
a28eb5f7d97f56a24a5f6a66cd2e30987bfdc8c6
refs/heads/master
2016-08-11T23:10:09.713751
2015-11-28T12:36:38
2015-11-28T12:36:38
47,022,868
0
0
null
null
null
null
UTF-8
Java
false
false
608
java
package wfw; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; /** * Created by IT_School on 22.11.2015. */ public class IOJVSCHEME { public static void main(String[] args) { try{ FileWriter out = new FileWriter("D:/lesson/untitled876/src/io/as"); BufferedWriter br = new BufferedWriter(out); PrintWriter pw= new PrintWriter(br); pw.print("Iam a sentence in a text file"); pw.close(); }catch (IOException e){ e.printStackTrace(); } } }
0212dcaf7c0b500cc8911dd9bdb9d310a8dd7835
4bb5e0e79b660d8c701f8f3b5f7f870e926d33f4
/app/src/test/java/com/example/a2019_seg2105_project/ui/clinicApp/register/PasswordWithinRangeTest.java
446f439a5572e60695b7a226e9edfec304c580d0
[]
no_license
feimlyang/clinic-services-android
55d76eace7794c2da1cc91ab9dbb62d2846043bf
963e9c2e72b3100df9957a1f9029fadf46b12eb5
refs/heads/master
2022-12-24T09:04:43.848621
2019-12-01T06:58:30
2019-12-01T06:58:30
301,991,505
0
0
null
null
null
null
UTF-8
Java
false
false
3,038
java
package com.example.a2019_seg2105_project.ui.clinicApp.register; import static org.junit.Assert.*; import org.junit.Test; import java.lang.reflect.Method; public class PasswordWithinRangeTest { //test: The length of password should not be bigger than 16. @Test public void check_PasswordWithinRange1(){ RegisterViewModel registerViewModel = new RegisterViewModel(null); Class<RegisterViewModel> loginViewModelClass = RegisterViewModel.class; try { Method methodIsPasswordWithinRange = loginViewModelClass.getDeclaredMethod("isPasswordWithinRange", String.class); methodIsPasswordWithinRange.setAccessible(true); boolean shouldFail = (boolean)(methodIsPasswordWithinRange.invoke(registerViewModel, "passwordwithinrange")); assertFalse(shouldFail); }catch (Exception e) { assertTrue(false); } } //test: The length of password should not be smaller than 5. @Test public void check_PasswordWithinRange2(){ RegisterViewModel registerViewModel = new RegisterViewModel(null); Class<RegisterViewModel> loginViewModelClass = RegisterViewModel.class; try { Method methodIsPasswordWithinRange = loginViewModelClass.getDeclaredMethod("isPasswordWithinRange", String.class); methodIsPasswordWithinRange.setAccessible(true); boolean shouldFail = (boolean)(methodIsPasswordWithinRange.invoke(registerViewModel, "pass")); assertFalse(shouldFail); }catch (Exception e) { assertTrue(false); } } //test: The length of password can be exactly 5. @Test public void check_PasswordWithinRange3(){ RegisterViewModel registerViewModel = new RegisterViewModel(null); Class<RegisterViewModel> loginViewModelClass = RegisterViewModel.class; try { Method methodIsPasswordWithinRange = loginViewModelClass.getDeclaredMethod("isPasswordWithinRange", String.class); methodIsPasswordWithinRange.setAccessible(true); boolean shouldPass = (boolean)(methodIsPasswordWithinRange.invoke(registerViewModel, "12345")); assertTrue(shouldPass); }catch (Exception e) { assertFalse(true); } } //test: The length of password can be exactly 16. @Test public void check_PasswordWithinRange4(){ RegisterViewModel registerViewModel = new RegisterViewModel(null); Class<RegisterViewModel> loginViewModelClass = RegisterViewModel.class; try { Method methodIsPasswordWithinRange = loginViewModelClass.getDeclaredMethod("isPasswordWithinRange", String.class); methodIsPasswordWithinRange.setAccessible(true); boolean shouldPass = (boolean)(methodIsPasswordWithinRange.invoke(registerViewModel, "1234567890123456")); assertTrue(shouldPass); }catch (Exception e) { assertFalse(true); } } }
7ed3fcdde33e796c2327ca1f92a596f4ec92be0b
707f1f34beb3e03e84afa02fd5d50fa5156083cf
/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/CouponEntity.java
582ceebc8f8b843cb50f97aaa2e0684d1e211c52
[]
no_license
SudhaAnbalagan/FoodOrderingAppBackend
fb9988aef685b0d7742a8d454554d357bff768c0
faa66bd95fe294a3214692e26e598856f89b9ea1
refs/heads/master
2023-02-27T04:03:26.039014
2021-02-08T14:48:26
2021-02-08T14:48:26
336,461,379
0
1
null
2021-02-08T14:48:27
2021-02-06T05:13:23
Java
UTF-8
Java
false
false
1,592
java
package com.upgrad.FoodOrderingApp.service.entity; import javax.persistence.*; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; @SuppressWarnings("ALL") @Entity @Table(name = "coupon") @NamedQueries( { @NamedQuery(name = "getCouponByCouponName", query = "SELECT c FROM CouponEntity c WHERE c.couponName = :coupon_name"), @NamedQuery(name = "getCouponByCouponId",query = "SELECT c FROM CouponEntity c WHERE c.uuid = :uuid") } ) public class CouponEntity { @Id @Column(name = "id") @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @Column(name = "uuid") @NotNull @Size(max = 200) private String uuid; @Column(name = "coupon_name") @NotNull @Size(max = 255) private String couponName; @Column(name = "percent") @NotNull private Integer percent; public CouponEntity(){ } public CouponEntity(String couponId, String myCoupon, int percent) { this.uuid = couponId; this.couponName = myCoupon; this.percent = percent; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getUuid() { return uuid; } public void setUuid(String uuid) { this.uuid = uuid; } public String getCouponName() { return couponName; } public void setCouponName(String couponName) { this.couponName = couponName; } public Integer getPercent() { return percent; } public void setPercent(Integer percent) { this.percent = percent; } }
0986030b9dc4421ca78e9c69c7b526b9c8a54ca8
8702d82cc29571dfb523d716aa0c84631ae43143
/finalProject/src/main/java/korea/notice/model/NoticeDAOImple.java
758f67cce3982fd4954039ea5ff816c6675b4e15
[]
no_license
zanwarl/finalProject
9631c60f016b45e779741e8df48bf9cb3502cc2d
43f0c72ae3ad0a2dbc934531cb7d799918feb373
refs/heads/master
2021-08-18T23:25:06.185789
2017-11-24T05:50:07
2017-11-24T05:50:07
108,346,704
0
0
null
null
null
null
UTF-8
Java
false
false
1,538
java
package korea.notice.model; import java.util.HashMap; import java.util.List; import java.util.Map; import org.mybatis.spring.SqlSessionTemplate; public class NoticeDAOImple implements NoticeDAO{ private SqlSessionTemplate sqlMap; public NoticeDAOImple(SqlSessionTemplate sqlMap) { super(); this.sqlMap = sqlMap; } public int noticeWrite(NoticeDTO dto) { int res = sqlMap.insert("noticeWriteSql", dto); return res ; } public List<NoticeDTO> noticeList(int cp, int listSize) { Map<String, Object>map = new HashMap<String, Object>(); int startNum = (cp -1)* listSize+1; int endNum = cp*listSize; map.put("startNum", startNum); map.put("endNum", endNum); List<NoticeDTO> list = sqlMap.selectList("noticeListSql", map); return list; } public int getTotalCnt() { int res = sqlMap.selectOne("noticeTotalCnt"); // System.out.println(res); return res; } public int noticeUpdate(int idx, String title, String content ) { Map<String, Object>map = new HashMap<String, Object>(); map.put("noticeIdx", idx); map.put("title", title); map.put("content", content); int res = sqlMap.insert("noticeUpdateSql", map); return res; } public NoticeDTO noticeContent(int idx) { NoticeDTO dto = sqlMap.selectOne("noticeContentSql", idx); return dto ; } public int noticeDelete(int idx) { // TODO A int res = sqlMap.delete("noticeDeleteSql", idx); return res; } }
[ "user1@KH_H" ]
user1@KH_H
f65160b75cae8fce349eb80ad5b6ee3caf8e7c5a
615ba6787aa7520d670e1b4f66af8d6c2ec56ec1
/app/src/test/java/com/example/umesh/fetchjsonobj/ExampleUnitTest.java
3d7d9a742871c96d548725f8965f0914c7161bde
[]
no_license
umeshtaneja/Fetch_Json_Data
ffb6f014908450b08f8ebb372aa262a96fe3d75d
558900764251f36f8daec42e68f2907e9beded78
refs/heads/master
2021-01-20T09:49:12.889642
2017-05-04T17:26:41
2017-05-04T17:26:41
90,289,605
0
0
null
null
null
null
UTF-8
Java
false
false
408
java
package com.example.umesh.fetchjsonobj; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
7a2fba7cbde538872f9980584a76ff1f37598180
16c6b2798195bd83cd6a7477b389771faac96317
/src/main/java/com/school/studentDetails/pojo/StudentInput.java
6453e0b195a938a859d124a62384e2b4628d0d98
[]
no_license
piyushjainwork1/Firstspring-project
6caa4819b82ffe3dc2ee0b8a54c309a13bbe3f28
991479501c94281ff55a9dbb51bfac51ea85baaa
refs/heads/master
2022-12-01T15:54:36.048085
2019-10-23T04:25:17
2019-10-23T04:25:17
216,701,852
0
0
null
2022-11-16T09:57:28
2019-10-22T01:57:12
Java
UTF-8
Java
false
false
1,139
java
package com.school.studentDetails.pojo; import javax.validation.constraints.Email; import javax.validation.constraints.Min; import javax.validation.constraints.Size; import org.springframework.stereotype.Component; @Component public class StudentInput { @Size(min = 2) private String stuname; @Min(value = 6) private int stuRollno; private int stuclass; @Email private String stuemail; public String getStuname() { return stuname; } public void setStuname(String stuname) { this.stuname = stuname; } public int getStuRollno() { return stuRollno; } public void setStuRollno(int stuRollno) { this.stuRollno = stuRollno; } public int getStuclass() { return stuclass; } public void setStuclass(int stuclass) { this.stuclass = stuclass; } public String getStuemail() { return stuemail; } public void setStuemail(String stuemail) { this.stuemail = stuemail; } @Override public String toString() { return String.format("StudentInput [stuname=%s, stuRollno=%s, stuclass=%s, stuemail=%s]", stuname, stuRollno, stuclass, stuemail); } }
a69263e91c8dfd8392c794f465c39bb074e41c04
bd30d88ade4922e5e070222ca709ed61a4430edc
/proxy/src/main/java/io/zjh/IUserMapper.java
f6d1ca021fb5f1b03a7dda03f66af5f025fd5af4
[ "Apache-2.0" ]
permissive
onlyonezhongjinhui/scattered-learning
70cd0c185995b293e0a9b53bc998d8f80f89a766
c25c311d666667a277e285162d6de4fc0530433f
refs/heads/main
2023-06-29T11:17:06.766575
2021-08-05T02:17:58
2021-08-05T02:17:58
323,030,444
0
0
null
null
null
null
UTF-8
Java
false
false
256
java
package io.zjh; import io.zjh.entity.User; import java.util.List; public interface IUserMapper { void insert(User user); void update(User user); void deleteById(String id); User selectById(String id); List<User> selectAll(); }
89931f201ae18b576efc1d48678b1a1d570ca68a
6be49f4dbaa4d1fa297fd55114cf181e72102daa
/thread/src/com/company/Main.java
a6169b0ab62a5846e9b553d17a88c2fdbc658ddf
[]
no_license
MrTrung16974/Schools
ef6af7a6c7a0fa3bf866a6e6d81ef27d6916763c
cabb783be3270816e06e21bc5d079355e3fd8652
refs/heads/master
2022-11-30T12:51:27.451912
2020-08-11T08:49:18
2020-08-11T08:49:18
284,604,763
0
0
null
null
null
null
UTF-8
Java
false
false
1,383
java
package com.company; import java.io.*; public class Main { public static void main(String[] args) throws IOException { ThreadFilter threadFilterOne = new ThreadFilter(); ThreadFilter threadFilterTwo = new ThreadFilter(); threadFilterOne.start(); threadFilterTwo.start(); ManagerThread managerThread = new ManagerThread(); // managerThread.readFile(); System.out.println("end"); TheadCreator theadCreatorOne = new TheadCreator(); TheadCreator theadCreatorTwo = new TheadCreator(); TheadCreator theadCreatorThree = new TheadCreator(); TheadCreator theadCreatorFour = new TheadCreator(); TheadCreator theadCreatorFive = new TheadCreator(); TheadCreator theadReadSix = new TheadCreator(); TheadCreator theadCreatorSeven = new TheadCreator(); TheadCreator theadCreatorEight = new TheadCreator(); TheadCreator theadCreatorNine = new TheadCreator(); TheadCreator theadCreatorTen = new TheadCreator(); theadCreatorOne.start(); theadCreatorTwo.start(); theadCreatorThree.start(); theadCreatorFour.start(); theadCreatorFive.start(); theadReadSix.start(); theadCreatorSeven.start(); theadCreatorEight.start(); theadCreatorNine.start(); theadCreatorTen.start(); } }
0e44fb0776aaa948953b4ef8293876c758b27762
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/6/6_0e8c12ca4a135e41f7a96d4a820e4109d3366d31/Cache/6_0e8c12ca4a135e41f7a96d4a820e4109d3366d31_Cache_t.java
9c8888f5116a31326761598cc2445c41612820f2
[]
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
20,926
java
package ini.trakem2.persistence; import ij.ImagePlus; import ij.io.FileInfo; import ini.trakem2.utils.Utils; import java.awt.Image; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.Map; import java.util.Set; import java.util.TreeMap; /** Access is not synchronized, that is your duty. * * The current setup depends on calls to removeAndFlushSome to clean up empty slots; * otherwise these slots are never cleaned up to avoid O(n) overhead (worst case) * when removing a Pyramid for a given id, or O(1) cost of checking whether the first interval * is empty and removing it. Granted, the latter could be done in all calls to {@method append}, * but in the current setup this overhead is just not necessary. * * This Cache self-regulates the size to stay always at or below max_bytes. * If the smallest image added is larger than max_bytes, then that image will be the only * one in the cache, and will be thrown out when adding a new image. * That is, the max_bytes is an indication for a desired maximum. The usual is that * the cache will stay below max_bytes, unless when a single image is larger than max_bytes. * Also, momentarily when adding an image, max_bytes may be overflown by maximum the * size of the newly added image. Take that into account when choosing a value for max_bytes. * * When an image is removed, either directly or out of house-keeping to stay under max_bytes, * that image is flushed. ImagePlus instances are not flushed, but if they point to an Image, * then that image is flushed. */ public class Cache { private final class Pyramid { private final Image[] images; private HashMap<Long,Pyramid> interval = null; private final long id; private ImagePlus imp; private int n_images; // counts non-null instances in images array /** ASSUMES that @param image is not null. */ Pyramid(final long id, final Image image, final int level) { this.id = id; this.images = new Image[maxLevel(image, level)]; this.images[level] = image; this.n_images = 1; } /** *@param maxdim is the max(width, height) of the Patch that wraps @param imp, * i.e. the dimensions of the mipmap images. */ Pyramid(final long id, final ImagePlus imp, final int maxdim) { this.id = id; this.imp = imp; this.images = new Image[maxLevel(maxdim)]; this.n_images = 0; } /** Accepts a null @param img. * Returns number of bytes used/free (positive/negative) * If it was null here and img is not null, returns zero: no bytes to free. */ final long replace(final Image img, final int level) { if (null == images[level]) { if (null == img) return 0; // A: both null // B: only old is null images[level] = img; n_images++; return Cache.size(img); // some bytes used } else { if (null == img) { // C: old is not null, and new is null: must return freed bytes n_images--; long b = -Cache.size(images[level]); // some bytes to free images[level].flush(); images[level] = null; return b; } else if (img != images[level]) { // D: both are not null, and are not the same instance: long b = Cache.size(img) - Cache.size(images[level]); // some bytes to free or to be added images[level].flush(); images[level] = img; return b; } return 0; } } /** Returns the number of bytes used/free (positive/negative). */ final long replace(final ImagePlus imp) { if (null == imp) { if (null == this.imp) return 0; // A: both null // B: this.imp is not null; some bytes to be free long b = -Cache.size(this.imp); this.imp = imp; // nullifying return b; } else { // imp is not null: if (null == this.imp) { // C: this.imp is null; some bytes to be used this.imp = imp; return Cache.size(imp); } else { // D: both not null if (this.imp.getType() == imp.getType() && this.imp.getWidth() == imp.getWidth() && this.imp.getHeight() == imp.getHeight()) { this.imp = imp; return 0; // ImageProcessor is of identical dimensions } // else: this.imp = imp; return Cache.size(imp) - Cache.size(this.imp); // ImageProcessor may be different } } } } private final class ImagePlusUsers { final Set<Long> users = new HashSet<Long>(); final ImagePlus imp; ImagePlusUsers(final ImagePlus imp, final Long firstUser) { this.imp = imp; users.add(firstUser); } final void addUser(final Long id) { users.add(id); } /** When the number of users is zero, it removes itself from imps. */ final void removeUser(final Long id) { users.remove(id); if (users.isEmpty()) imps.remove(getPath(imp)); } } /** Keep a table of loaded ImagePlus. */ private final HashMap<String,ImagePlusUsers> imps = new HashMap<String,ImagePlusUsers>(); static private final int[] PIXEL_SIZE = new int[]{1, 2, 4, 1, 4}; // GRAY0, GRAY16, GRAY32, COLOR_256 and COLOR_RGB static private final int OVERHEAD = 1024; // in bytes: what a LUT would take (256 * 3) plus some extra static final long size(final ImagePlus imp) { return imp.getWidth() * imp.getHeight() * imp.getNSlices() * PIXEL_SIZE[imp.getType()] + OVERHEAD; } static final long size(final Image img) { return img.getWidth(null) * img.getHeight(null) * 4 + OVERHEAD; // assume int[] image } static private final int computeLevel(final int i) { return (int)(0.5 + ((Math.log(i) - Math.log(32)) / Math.log(2))) + 1; } /** The position in the array is the Math.max(width, height) of an image. */ private final static int[] max_levels = new int[50000]; // don't change to smaller than 33. Here 50000 is the maximum width or height for which precomputed mipmap levels will exist. static { // from 0 to 31 all zeros for (int i=32; i<max_levels.length; i++) { max_levels[i] = computeLevel(i); } } static private int maxLevel(final int maxdim) { return maxdim < max_levels.length ? max_levels[maxdim] : computeLevel(maxdim); } private final int maxLevel(final Image image, final int starting_level) { /* final int w = image.getWidth(null); final int h = image.getHeight(null); int max_level = starting_level; while (w > 32 || h > 32) { w /= 2; h /= 2; max_level++; } return max_level; */ final int max = Math.max(image.getWidth(null), image.getHeight(null)); return starting_level + (max < max_levels.length ? max_levels[max] : computeLevel(max)); /* if (max >= max_levels.length) { return starting_level + computeLevel(max); } else { return starting_level + max_levels[max]; } */ } /////////////// private final HashMap<Long,Pyramid> pyramids = new HashMap<Long,Pyramid>(); private final LinkedList<HashMap<Long,Pyramid>> intervals = new LinkedList<HashMap<Long,Pyramid>>(); private int count = 0; // if the cache is empty, this count must be 0; // if not empty, then it counts the number of images stored (not of pyramids) private long bytes = 0, max_bytes = 0; // negative values are ok public Cache(final long max_bytes) { this.max_bytes = max_bytes; } private final void addBytes(final long b) { this.bytes += b; //Utils.log2("Added " + b + " and then: bytes = " + this.bytes); //Utils.printCaller(this, 3); } public void setMaxBytes(final long max_bytes) { if (max_bytes < this.max_bytes) { removeAndFlushSome(this.max_bytes - max_bytes); } this.max_bytes = max_bytes; } /** Remove and flush the minimal amount of images to ensure there are at least min_free_bytes free. */ public final long ensureFree(final long min_free_bytes) { if (bytes + min_free_bytes > max_bytes) { // remove the difference (or a bit more): return removeAndFlushSome(bytes + min_free_bytes - max_bytes); } return 0; } /** Maximum desired space for this cache. */ public long getMaxBytes() { return max_bytes; } /** Current estimated space occupied by the images in this cache. */ public long getBytes() { return bytes; } public final boolean contains(final long id) { return pyramids.containsKey(id); } public final boolean contains(final long id, final int level) { final Pyramid p = pyramids.get(id); return null != p && null != p.images[level]; } public final Image get(final long id, final int level) { final Pyramid p = pyramids.get(id); if (null == p) return null; if (null == p || null == p.images[level]) return null; update(p); return p.images[level]; } public final ImagePlus get(final String path) { final ImagePlusUsers u = imps.get(path); return null == u ? null : u.imp; } public final ImagePlus get(final long id) { final Pyramid p = pyramids.get(id); if (null == p) return null; if (null == p.imp) return null; update(p); return p.imp; } public final Map<Integer,Image> getAll(final long id) { final Pyramid p = pyramids.get(id); final HashMap<Integer,Image> m = new HashMap<Integer,Image>(); if (null == p) return m; for (int i=0; i<p.images.length; i++) { if (null != p.images[i]) m.put(i, p.images[i]); } update(p); return m; } public final Image getClosestAbove(final long id, final int level) { final Pyramid p = pyramids.get(id); if (null == p) return null; for (int i=Math.min(level, p.images.length-1); i>-1; i--) { if (null == p.images[i]) continue; update(p); return p.images[i]; } return null; } // Below or equal public final Image getClosestBelow(final long id, final int level) { final Pyramid p = pyramids.get(id); if (null == p) return null; for (int i=level; i<p.images.length; i++) { if (null == p.images[i]) continue; update(p); return p.images[i]; } return null; } static private final int MAX_INTERVAL_SIZE = 20; private HashMap<Long,Pyramid> last_interval = new HashMap<Long,Pyramid>(MAX_INTERVAL_SIZE); { intervals.add(last_interval); } private final void reset() { pyramids.clear(); intervals.clear(); count = 0; bytes = 0; last_interval = new HashMap<Long, Pyramid>(MAX_INTERVAL_SIZE); intervals.add(last_interval); imps.clear(); } private final void update(final Pyramid p) { // Last-access -based priority queue: // Remove from current interval and append to last interval if (last_interval != p.interval) { p.interval.remove(p.id); append(p); } } /** Append the key to the last interval, creating a new interval if the last is full. * Then set that interval as the key's interval. */ private final void append(final Pyramid p) { // May have been removed: if (0 == intervals.size()) intervals.add(last_interval); // Push an new interval if the last one is full: if (last_interval.size() >= MAX_INTERVAL_SIZE) { last_interval = new HashMap<Long,Pyramid>(MAX_INTERVAL_SIZE); intervals.add(last_interval); } last_interval.put(p.id, p); // Reflection: tell the Pyramid instance where it is p.interval = last_interval; } /** Makes up space to fit b, and also drops empty intervals from the head. */ private final void fit(final long b) { addBytes(b); if (bytes > max_bytes) { removeAndFlushSome(bytes - max_bytes); } } // If already there, move to latest interval // If the image is different, flush the old image public final void put(final long id, final Image image, final int level) { Pyramid p = pyramids.get(id); if (null == p) { p = new Pyramid(id, image, level); pyramids.put(id, p); append(p); fit(Cache.size(image)); // AFTER adding it count++; } else { update(p); if (null == p.images[level]) count++; fit(p.replace(image, level)); } } public final void updateImagePlusPath(final String oldPath, final String newPath) { final ImagePlusUsers u = imps.remove(oldPath); if (null == u) return; imps.put(newPath, u); } /** Returns null if the ImagePlus was preprocessed or doesn't have an original FileInfo * (which means the image does not come from a file). */ static public final String getPath(final ImagePlus imp) { final FileInfo fi = imp.getOriginalFileInfo(); if (null == fi || Loader.PREPROCESSED == fi.fileFormat) return null; final String dir = fi.directory; if (null == dir) { return fi.url; } return dir + fi.fileName; } /** @param maxdim is max(width, height) of the Patch wrapping @param imp; * that is, the dimensions of the mipmap image. */ public final void put(final long id, final ImagePlus imp, final int maxdim) { Pyramid p = pyramids.get(id); if (null == p) { p = new Pyramid(id, imp, maxdim); pyramids.put(id, p); append(p); // final String path = getPath(imp); // may be null, in which case it is not stored in imps final ImagePlusUsers u = imps.get(path); // u is null if path is null if (null == u) { fit(Cache.size(imp)); // AFTER adding it to the pyramids if (null != path) imps.put(path, new ImagePlusUsers(imp, id)); } else { u.addUser(id); } // count++; } else { update(p); if (null == p.imp) count++; else if (imp != p.imp) { // Remove from old final ImagePlusUsers u1 = imps.get(getPath(p.imp)); u1.removeUser(id); // Add to new, which may have to be created final String path = getPath(imp); final ImagePlusUsers u2 = imps.get(path); if (null == u2) { if (null != path) { imps.put(path, new ImagePlusUsers(imp, id)); } } else { u2.addUser(id); } } fit(p.replace(imp)); } } // WARNING: an empty interval may be left behind. Will be cleaned up by removeAndFlushSome. /** Remove one mipmap level, if there. */ public final Image remove(final long id, final int level) { final Pyramid p = pyramids.get(id); if (null == p) return null; final Image im = p.images[level]; if (null != im) { addBytes(p.replace(null, level)); count--; } // If at least one level is still not null, keep the pyramid; otherwise drop it if (0 == p.n_images && null == p.imp) { p.interval.remove(id); pyramids.remove(id); } return im; } /** Remove only the ImagePlus, if there. */ public final ImagePlus removeImagePlus(final long id) { return removeImagePlus(pyramids.get(id)); } private final ImagePlus removeImagePlus(final Pyramid p) { if (null == p || null == p.imp) return null; final ImagePlus imp = p.imp; // final ImagePlusUsers u = imps.get(p); u.removeUser(p.id); if (u.users.isEmpty()) { addBytes(p.replace(null)); } // count--; if (0 == p.n_images) { p.interval.remove(p.id); pyramids.remove(p.id); } return imp; } public final void remove(final long id) { final Pyramid p = pyramids.remove(id); if (null == p) return; if (null != p.imp) { removeImagePlus(p); } count -= p.n_images; for (int i=0; i<p.images.length; i++) { if (null == p.images[i]) continue; addBytes(p.replace(null, i)); } p.interval.remove(id); } /** Flush all mipmaps, and forget all mipmaps and imps. */ public final void removeAndFlushAll() { for (final Pyramid p : pyramids.values()) { p.replace(null); // the imp may need cleanup for (int i=0; i<p.images.length; i++) { if (null == p.images[i]) continue; p.images[i].flush(); } } reset(); } // WARNING: an empty interval may be left behind. Will be cleaned up by removeAndFlushSome. /** Does not alter the ImagePlus. */ public final void removeAndFlushPyramid(final long id) { final Pyramid p = pyramids.get(id); if (null == p) return; count -= p.n_images; for (int i=0; i<p.images.length; i++) { if (null == p.images[i]) continue; addBytes(p.replace(null, i)); } if (null == p.imp) { pyramids.remove(id); p.interval.remove(id); } } /** Returns the number of released bytes. */ public final long removeAndFlushSome(final long min_bytes) { long size = 0; while (intervals.size() > 0) { final HashMap<Long,Pyramid> interval = intervals.getFirst(); for (final Iterator<Pyramid> it = interval.values().iterator(); it.hasNext(); ) { final Pyramid p = it.next(); if (null != p.imp) { final String path = getPath(p.imp); final ImagePlusUsers u = imps.get(path); if (null == path || 1 == u.users.size()) { // imps.remove(path); // final long s = p.replace(null); // the imp may need cleanup size -= s; addBytes(s); count--; if (size >= min_bytes) { if (0 == p.n_images) { pyramids.remove(p.id); it.remove(); if (interval.isEmpty()) intervals.removeFirst(); } return size; } } } for (int i=0; i<p.images.length && p.n_images > 0; i++) { if (null == p.images[i]) continue; final long s = p.replace(null, i); size -= s; addBytes(s); count--; if (size >= min_bytes) { if (0 == p.n_images) { pyramids.remove(p.id); it.remove(); if (interval.isEmpty()) intervals.removeFirst(); } return size; } } pyramids.remove(p.id); it.remove(); // from the interval } intervals.removeFirst(); } return size; } public final long removeAndFlushSome(int n) { long size = 0; while (intervals.size() > 0) { final HashMap<Long,Pyramid> interval = intervals.getFirst(); for (final Iterator<Pyramid> it = interval.values().iterator(); it.hasNext(); ) { final Pyramid p = it.next(); if (null != p.imp) { final String path = getPath(p.imp); final ImagePlusUsers u = imps.get(path); if (null == path || 1 == u.users.size()) { // imps.remove(path); // final long s = p.replace(null); size -= s; addBytes(s); p.replace(null); // the imp may need cleanup n--; count--; if (0 == n) { if (0 == p.n_images) { pyramids.remove(p.id); it.remove(); if (interval.isEmpty()) intervals.removeFirst(); } return size; } } } for (int i=0; i<p.images.length; i++) { if (null == p.images[i]) continue; final long s = p.replace(null, i); size -= s; addBytes(s); n--; count--; if (0 == n) { if (0 == p.n_images) { pyramids.remove(p.id); it.remove(); if (interval.isEmpty()) intervals.removeFirst(); } return size; } } pyramids.remove(p.id); it.remove(); // from the interval } intervals.removeFirst(); } return size; } public final int size() { return count; } public void debug() { Utils.log2("@@@@@@@@@@ START"); Utils.log2("pyramids: " + pyramids.size()); for (Map.Entry<Long,Pyramid> e : new TreeMap<Long,Pyramid>(pyramids).entrySet()) { Pyramid p = e.getValue(); Utils.log2("p id:" + e.getKey() + "; images: " + p.n_images + " / " + p.images.length + "; imp: " + e.getValue().imp); } Utils.log2("----"); int i = 0; for (HashMap<Long,Pyramid> m : intervals) { Utils.log2("interval " + (++i)); for (Map.Entry<Long,Pyramid> e : new TreeMap<Long,Pyramid>(m).entrySet()) { Pyramid p = e.getValue(); Utils.log2("p id:" + e.getKey() + "; images: " + p.n_images + " / " + p.images.length + "; imp: " + e.getValue().imp); int[] levels = new int[p.images.length]; for (int k=0; k<levels.length; k++) levels[k] = null == p.images[k] ? 0 : 1; Utils.log2(" levels: " + Utils.toString(levels)); } } Utils.log2("----"); for (Map.Entry<String,ImagePlusUsers> e : imps.entrySet()) { ImagePlusUsers u = e.getValue(); Utils.log2(u.users.size() + " ImagePlusUsers of " + e.getKey()); } Utils.log2("----"); // Analytics Utils.log2("count is: " + count + ", size is: " + bytes + " / " + max_bytes + ", intervals.size = " + intervals.size() + ", pyr.size = " + pyramids.size()); HashMap<Integer,Integer> s = new HashMap<Integer,Integer>(); for (HashMap<Long,Pyramid> m : intervals) { int l = m.size(); Integer in = s.get(l); if (null == in) s.put(l, 1); else s.put(l, in.intValue() + 1); } Utils.log2("interval size distribution: ", s); } public final long seqFindId(final ImagePlus imp) { for (final Pyramid p : pyramids.values()) { if (p.imp == imp) return p.id; } return Long.MIN_VALUE; } }
cc6a8b1c68e52f1539179ec53099eb49bdb82039
9a71d86ba96e56b7c3d764a13e78c253fd15ad92
/Talk_신은호/1.프로젝트/웹서버 클래스/FriendCheckAction.java
7da794139e0b96347414e2a87eb1c5a3c53d046b
[]
no_license
ssss2589/ShinEunho
f5c348fd2e168f04792b81f709f7bf8da2529d0d
198d02fb6f7703909b73b007bdeebfdfd60c877a
refs/heads/master
2020-07-23T07:00:55.124411
2019-09-10T06:46:07
2019-09-10T06:46:07
207,480,379
0
0
null
null
null
null
UTF-8
Java
false
false
682
java
import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class FriendCheckAction implements Action{ @Override public void execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String name = request.getParameter("name"); String id = request.getParameter("id"); System.out.println(""+name+" == "+id); boolean friend = FriendDAO.getInstance().search(id.trim(), name.trim()); request.setAttribute("protocol", friend); request.getRequestDispatcher("android/FrendCheck.jsp").forward(request, response);; } }
efe996117ba18ada02e83915bf47329e88dd9d52
1cae405ce38f98707e7845e862e3e693a0f7fa91
/src/main/java/com/crud/tasks/trello/validator/TrelloValidator.java
ad4ebbeb7962562f0723f9642f9f6abb0c793072
[]
no_license
wnuki/Trello-tasks
34cbcf5c33f98a3507d9cf754bcdfdba0468f149
8e74b86712031078769150247bf7db773ec37f8b
refs/heads/master
2020-05-27T14:47:53.650051
2019-07-23T23:00:12
2019-07-23T23:12:49
188,667,837
0
0
null
null
null
null
UTF-8
Java
false
false
1,173
java
package com.crud.tasks.trello.validator; import com.crud.tasks.domain.TrelloBoard; import com.crud.tasks.domain.TrelloCard; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import java.util.List; import java.util.stream.Collectors; @Component public class TrelloValidator { private static final Logger LOGGER = LoggerFactory.getLogger(TrelloValidator.class); public void validateCard(final TrelloCard trelloCard) { if(trelloCard.getName().contains("test")) { LOGGER.info("Someone is testing application"); } else { LOGGER.info("Seems application is used in proper way"); } } public List<TrelloBoard> validateTrelloBoards(final List<TrelloBoard> trelloBoards) { LOGGER.info("Starting filtering boards..."); List<TrelloBoard> filteredBoards = trelloBoards.stream() .filter(trelloBoard -> !trelloBoard.getName().equalsIgnoreCase("test")) .collect(Collectors.toList()); LOGGER.info("Boards have been filtered. Current list size: " + filteredBoards.size()); return filteredBoards; } }
b09a198b23c2ba441bb3db76d7a2aa3519ecd278
1be7126e8746baae9d3dd8112a53afbd5890df89
/osdu-r2/os-core-common/src/main/java/org/opengroup/osdu/core/common/model/crs/TrajectoryInputStation.java
dba1fc6c830e258c88af3383e74305cf8babddf9
[ "Apache-2.0" ]
permissive
google/framework-for-osdu
ae94a01943aa3298dd6f0ccda2fc64196bc2e1f4
73870a7dee903d4ec50d16b3f84fce6ca592d71d
refs/heads/master
2023-08-31T00:58:34.236993
2021-12-16T19:43:03
2021-12-16T19:43:03
224,537,036
17
7
Apache-2.0
2023-07-22T22:51:43
2019-11-28T00:00:29
Java
UTF-8
Java
false
false
1,311
java
/* * Copyright 2020 Google LLC * Copyright 2017-2019, Schlumberger * * 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 org.opengroup.osdu.core.common.model.crs; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.AllArgsConstructor; import lombok.Data; @Data @AllArgsConstructor public class TrajectoryInputStation { @JsonProperty private Double md; @JsonProperty private Double inclination; @JsonProperty private Double azimuth; public TrajectoryInputStation() { this.md = null; this.inclination = null; this.azimuth = null; } public TrajectoryInputStation(double md, double inclination, double azimuth) { this.md = md; this.inclination = inclination; this.azimuth = azimuth; } }
05cdd155bb694ad5297a8f4c6131d5782d0177c7
6bb10fb0b7f866b434589951bd3555989cf63837
/cse360assign2/src/cse360assign3/calculator.java
f1bba7cc5fb808cacb9c58d005013ea3b36a6494
[]
no_license
dana133/CSE360Assignment2
332aeb7e1e36c79f95512e27d5bd65ae47cd1f16
3fa3b7c063fb67eefdd8ba36f302b51f984e8aa5
refs/heads/master
2020-08-09T09:52:37.590197
2019-10-21T06:52:27
2019-10-21T06:52:27
214,062,363
0
0
null
null
null
null
UTF-8
Java
false
false
1,139
java
package cse360assign3; /** * @Assignment: 3 * @author Dana Lee * @Class: CSE 360 * This class is a child class of the AddingMachine class. It includes the divide, multiply, and power methods. */ public class calculator extends AddingMachine{ public calculator() { super(); } /** * * @param value divides the total, sets total to 0 if division by 0 is attempted */ public void divide(int value) { if(value == 0) { total = 0; history = "(" + history + ") / " + value; } else { total = total/value; history = "(" + history + ") / " + value; } } /** * * @param value gets multiplied with total */ public void multiply(int value) { total = total * value; history = "(" + history + ") * " + value; } /** * * @param value is the power the total is raised to; sets total to 0 if negative exponent is entered */ public void power(int value) { if(value < 0) { total = 0; history = "(" + history + ") ^ " + value; } else { total = (int) Math.pow(total, value); history = "(" + history + ") ^ " + value; } } }
[ "Dana Lee@DESKTOP-CGJ6OQF" ]
Dana Lee@DESKTOP-CGJ6OQF
e279a93182ce652f552920d63fb1d05f0106c221
93d4f06cfb4defc180d8d3de6cbc730be3c4f815
/bus-socket/src/main/java/org/aoju/bus/socket/plugins/StreamMonitorPlugin.java
ca4b20cd3a92d379a57e525c49167db90d4f3547
[ "MIT" ]
permissive
ShuaibiCool/bus
7e01a04cc74cdb3260deb4d91b81460ef805d672
bc9521c7c47651d09a0bb3f5baaa6002fbc60ddf
refs/heads/master
2023-08-25T05:45:31.120542
2021-09-24T07:21:44
2021-09-24T07:21:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,293
java
/********************************************************************************* * * * The MIT License (MIT) * * * * Copyright (c) 2015-2021 aoju.org sandao and other contributors. * * * * Permission is hereby granted, free of charge, to any person obtaining a copy * * of this software and associated documentation files (the "Software"), to deal * * in the Software without restriction, including without limitation the rights * * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included in * * all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * * THE SOFTWARE. * * * ********************************************************************************/ package org.aoju.bus.socket.plugins; import org.aoju.bus.core.lang.Fields; import org.aoju.bus.core.toolkit.StringKit; import org.aoju.bus.logger.Logger; import org.aoju.bus.socket.channel.AsynchronousSocketChannelProxy; import org.aoju.bus.socket.channel.UnsupportedAsynchronousSocketChannel; import java.io.IOException; import java.net.SocketAddress; import java.nio.ByteBuffer; import java.nio.channels.AsynchronousSocketChannel; import java.nio.channels.CompletionHandler; import java.util.Date; import java.util.Objects; import java.util.concurrent.TimeUnit; import java.util.function.BiConsumer; /** * 传输层码流监控插件 * * @author Kimi Liu * @version 6.2.9 * @since JDK 1.8+ */ public class StreamMonitorPlugin<T> extends AbstractPlugin<T> { public static final BiConsumer<AsynchronousSocketChannel, byte[]> BLUE_HEX_INPUT_STREAM = (channel, bytes) -> { try { Logger.info(ConsoleColors.BLUE + Fields.NORM_DATETIME_MS_FORMAT.format(new Date()) + " [ " + channel.getRemoteAddress() + " --> " + channel.getLocalAddress() + " ] [ read: " + bytes.length + " bytes ]" + StringKit.byteArrayToHex(bytes) + ConsoleColors.RESET); } catch (IOException e) { e.printStackTrace(); } }; public static final BiConsumer<AsynchronousSocketChannel, byte[]> RED_HEX_OUTPUT_STREAM = (channel, bytes) -> { try { Logger.info(ConsoleColors.RED + Fields.NORM_DATETIME_MS_FORMAT.format(new Date()) + " [ " + channel.getLocalAddress() + " --> " + channel.getRemoteAddress() + " ] [ write: " + bytes.length + " bytes ]" + StringKit.byteArrayToHex(bytes) + ConsoleColors.RESET); } catch (IOException e) { e.printStackTrace(); } }; public static final BiConsumer<AsynchronousSocketChannel, byte[]> BLUE_TEXT_INPUT_STREAM = (channel, bytes) -> { try { Logger.info(ConsoleColors.BLUE + Fields.NORM_DATETIME_MS_FORMAT.format(new Date()) + " [ " + channel.getRemoteAddress() + " --> " + channel.getLocalAddress() + " ] [ read: " + bytes.length + " bytes ]\r\n" + new String(bytes) + ConsoleColors.RESET); } catch (IOException e) { e.printStackTrace(); } }; public static final BiConsumer<AsynchronousSocketChannel, byte[]> RED_TEXT_OUTPUT_STREAM = (channel, bytes) -> { try { Logger.info(ConsoleColors.RED + Fields.NORM_DATETIME_MS_FORMAT.format(new Date()) + " [ " + channel.getLocalAddress() + " --> " + channel.getRemoteAddress() + " ] [ write: " + bytes.length + " bytes ]\r\n" + new String(bytes) + ConsoleColors.RESET); } catch (IOException e) { e.printStackTrace(); } }; private final BiConsumer<AsynchronousSocketChannel, byte[]> inputStreamConsumer; private final BiConsumer<AsynchronousSocketChannel, byte[]> outputStreamConsumer; public StreamMonitorPlugin() { this(BLUE_HEX_INPUT_STREAM, RED_HEX_OUTPUT_STREAM); } public StreamMonitorPlugin(BiConsumer<AsynchronousSocketChannel, byte[]> inputStreamConsumer, BiConsumer<AsynchronousSocketChannel, byte[]> outputStreamConsumer) { this.inputStreamConsumer = Objects.requireNonNull(inputStreamConsumer); this.outputStreamConsumer = Objects.requireNonNull(outputStreamConsumer); } @Override public AsynchronousSocketChannel shouldAccept(AsynchronousSocketChannel channel) { return new StreamMonitorAsynchronousSocketChannel(channel); } static class MonitorCompletionHandler<A> implements CompletionHandler<Integer, A> { CompletionHandler<Integer, A> handler; BiConsumer<AsynchronousSocketChannel, byte[]> consumer; ByteBuffer buffer; AsynchronousSocketChannel channel; public MonitorCompletionHandler(AsynchronousSocketChannel channel, CompletionHandler<Integer, A> handler, BiConsumer<AsynchronousSocketChannel, byte[]> consumer, ByteBuffer buffer) { this.channel = new UnsupportedAsynchronousSocketChannel(channel) { @Override public SocketAddress getRemoteAddress() throws IOException { return channel.getRemoteAddress(); } @Override public SocketAddress getLocalAddress() throws IOException { return channel.getLocalAddress(); } }; this.handler = handler; this.consumer = consumer; this.buffer = buffer; } @Override public void completed(Integer result, A attachment) { if (result > 0) { byte[] bytes = new byte[result]; buffer.position(buffer.position() - result); buffer.get(bytes); consumer.accept(channel, bytes); } handler.completed(result, attachment); } @Override public void failed(Throwable exc, A attachment) { handler.failed(exc, attachment); } } static class ConsoleColors { /** * 重置颜色 */ public static final String RESET = "\033[0m"; /** * 蓝色 */ public static final String BLUE = "\033[34m"; /** * 红色 */ public static final String RED = "\033[31m"; } class StreamMonitorAsynchronousSocketChannel extends AsynchronousSocketChannelProxy { public StreamMonitorAsynchronousSocketChannel(AsynchronousSocketChannel asynchronousSocketChannel) { super(asynchronousSocketChannel); } @Override public <A> void read(ByteBuffer dst, long timeout, TimeUnit unit, A attachment, CompletionHandler<Integer, ? super A> handler) { super.read(dst, timeout, unit, attachment, new MonitorCompletionHandler<>(this, handler, inputStreamConsumer, dst)); } @Override public <A> void write(ByteBuffer src, long timeout, TimeUnit unit, A attachment, CompletionHandler<Integer, ? super A> handler) { super.write(src, timeout, unit, attachment, new MonitorCompletionHandler<>(this, handler, outputStreamConsumer, src)); } } }
8c5d4a86ebf1e32201dc1ec93e7fc2754f327c60
ed068591f3111c344bb39438f4d51ed5476da01b
/3.1-DAM_-_Dispozitive-si-aplicatii-mobile/ToDoApp/app/src/main/java/ro/liis/todoapp/AddTaskActivity.java
a3c06fc4726b8cbba20b79efd79e4e4ea73b7b5e
[]
no_license
maximcovali/Anul_3-Sem_1
efe029b3c11cf011403dc67e7e26496ea9669335
2080efd182d0f3717dc21e86ebcbff2a7598d579
refs/heads/master
2020-12-29T16:42:27.005011
2019-07-09T08:27:47
2019-07-09T08:27:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,132
java
package ro.liis.todoapp; import android.content.Intent; import android.provider.CalendarContract; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.CheckBox; import android.widget.EditText; import android.widget.SeekBar; import android.widget.Toast; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import ro.liis.todoapp.model.Task; public class AddTaskActivity extends AppCompatActivity { private EditText titleEditText = null; private EditText descEditText = null; private EditText dueDateEditText = null; private SeekBar prioritySeekBar = null; private CheckBox addToCalendarCheckBox = null; private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_task); titleEditText = findViewById(R.id.titleEditText); descEditText = findViewById(R.id.descriptionEditText); dueDateEditText = findViewById(R.id.dueDateEditText); prioritySeekBar = findViewById(R.id.prioritySeekBar); addToCalendarCheckBox = findViewById(R.id.calendarCheckBox); } public void AddTask(View view){ Task t = new Task(); t.title = titleEditText.getText().toString(); if(t.title.trim().length() == 0) { Toast.makeText(getApplicationContext(), "Enter a title", Toast.LENGTH_LONG).show(); return; } t.description = descEditText.getText().toString(); t.priority = (short)prioritySeekBar.getProgress(); try { t.dueDate = format.parse(dueDateEditText.getText().toString()); } catch (ParseException e) { if(dueDateEditText.getText().toString().length() > 0) { Toast.makeText(getApplicationContext(), "Enter a valid date", Toast.LENGTH_LONG).show(); return; } e.printStackTrace(); } if(addToCalendarCheckBox.isChecked()) { AddTaskToCalendar(view); } Intent i = new Intent(); i.putExtra("task", t); setResult(RESULT_OK, i); finish(); } public void AddTaskToCalendar(View view) { Intent intent = new Intent(Intent.ACTION_INSERT, CalendarContract.Events.CONTENT_URI); Calendar calendar = Calendar.getInstance(); String dueDate = dueDateEditText.getText().toString(); try { Date date = format.parse(dueDate); calendar.setTime(date); } catch (ParseException e) { e.printStackTrace(); } intent.putExtra(CalendarContract.Events.TITLE, titleEditText.getText().toString()); intent.putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY, true); intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, calendar.getTimeInMillis()); startActivity(intent); } }
882781a5ceb9a193186da0afa461518a8f7ff364
fa4ced574feff9cbb8d8ec33fc9909cb22a1c535
/Parenteses/Parenteses.java
12f940557e6abb1cd0ca7685ea876f16b986f6d2
[]
no_license
samuelribeiroc/TST-EDA
cc276c836d9368bca24cccd051ad6f3838404c63
27fbc24ae4ef8ff435a7b6ace261bd5dcf106c3c
refs/heads/master
2023-05-26T05:57:09.160910
2021-06-17T04:00:00
2021-06-17T04:00:00
294,868,542
0
3
null
2020-10-01T16:47:37
2020-09-12T04:19:49
Java
UTF-8
Java
false
false
834
java
import java.util.Scanner; class Parenteses { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String entrada = sc.nextLine(); System.out.println(validation(entrada)); } private static String validation(String entrada) { String answer = "N"; if (entrada.length() % 2 == 0 && entrada.charAt(0) == '(') { int contOpen = 0; int contClose = 0; for (int i = 0; i < entrada.length(); i++) { if (entrada.charAt(i) == '(') { contOpen++; } else if (entrada.charAt(i) == ')') { contClose++; } } if (contOpen == contClose) { answer = "S"; } } return answer; } }
101db15469cb5a680883dbcbbcacb7aee17a57e1
5faac92d09ba8b86681f99f7132d335f8950b10a
/app/src/main/java/com/nightowldevelopers/xtreamemusicplayer/permissions/PermissionRequest.java
ac70066f6076cb9024887cd0f8964d56933e4e36
[]
no_license
nnishad/XtreamMusicApp
6d4237d2c2d59ba40659d2f85206a8afef8b4b5f
2a3c32a4f37669a4a15eba3b0e3a4a558febe74e
refs/heads/master
2020-09-27T17:28:57.547679
2019-12-07T20:10:33
2019-12-07T20:10:33
226,569,946
0
1
null
null
null
null
UTF-8
Java
false
false
2,463
java
/* * The MIT License (MIT) * Copyright (c) 2015 Michal Tajchert * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.nightowldevelopers.xtreamemusicplayer.permissions; import java.util.ArrayList; import java.util.Random; public class PermissionRequest { private static Random random; private ArrayList<String> permissions; private int requestCode; private PermissionCallback permissionCallback; public PermissionRequest(int requestCode) { this.requestCode = requestCode; } public PermissionRequest(ArrayList<String> permissions, PermissionCallback permissionCallback) { this.permissions = permissions; this.permissionCallback = permissionCallback; if (random == null) { random = new Random(); } this.requestCode = random.nextInt(32768); } public ArrayList<String> getPermissions() { return permissions; } public int getRequestCode() { return requestCode; } public PermissionCallback getPermissionCallback() { return permissionCallback; } public boolean equals(Object object) { if (object == null) { return false; } if (object instanceof PermissionRequest) { return ((PermissionRequest) object).requestCode == this.requestCode; } return false; } @Override public int hashCode() { return requestCode; } }
aac54f3b7e10d9e873ed43ca43ec70a78beba368
7ed34d048aa7175e98c57d46a5815a15b4e3fe10
/src/main/java/ru/grig/labyrinth_app/common/StatusEnum.java
784fb4d2ccf26d3b6b0a32a5050e86fee3df1d4f
[]
no_license
GrigUP/labyrinth_app
4cf30679383aa240c914f7a6ead7c51ec56bcab2
8ce5224486913807b2817840ecc1a76c9c779c6b
refs/heads/master
2020-05-18T16:07:31.586122
2019-05-02T09:15:23
2019-05-02T09:15:23
184,518,344
0
0
null
null
null
null
UTF-8
Java
false
false
105
java
package ru.grig.labyrinth_app.common; public enum StatusEnum { SUCCESS, ERROR, UNKNOWN, }
4048cc7768a9656b73bd4c8efa7739929ca6d03a
19ec7c84ba890b9db6af52e1c5b344f150e0bc51
/exception/TechnicalException.java
329bb85309722c63242a432c03452204c217bf75
[]
no_license
UserYulia/finalProject
8dd8babc9bb94d4f240b58bd333ae311b03bdfed
4d15aa787647981a2d7fdaf834a46c5cee75fc45
refs/heads/master
2021-01-19T18:14:35.054164
2017-05-16T15:19:40
2017-05-16T15:19:40
88,349,577
0
0
null
null
null
null
UTF-8
Java
false
false
390
java
package by.galkina.game.exception; public class TechnicalException extends Exception { public TechnicalException() { } public TechnicalException(String message, Throwable cause) { super(message, cause); } public TechnicalException(String message) { super(message); } public TechnicalException(Throwable cause) { super(cause); } }
5ff860bec40020d22195ec5f63e582eacf17ff77
7dc84715770f16d95713c1599aa1ba6986444dab
/src/main/java/com/lmf/integral/controller/IndexController.java
6f62a7d19ee396063c4f36c683c69182e69918c9
[]
no_license
lililiminhao/1137366521
18ef17602f4f55117eb2a809244f0bedec306f4a
ddeec2470a80be5ebe1eb0c5b17cf0536379a8b5
refs/heads/master
2022-12-21T11:16:42.777728
2019-06-20T03:42:46
2019-06-20T03:42:46
192,843,716
0
0
null
2022-12-16T08:44:53
2019-06-20T03:41:30
JavaScript
UTF-8
Java
false
false
1,688
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 com.lmf.integral.controller; import com.lmf.integral.service.WebsiteProxyService; import com.lmf.website.entity.WebsiteUser; import com.lmf.website.service.WebsiteService; import com.lmf.website.theme.v2.PageSkeleton; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; /** * * @author shenzhixiong */ @Controller public class IndexController { @Autowired private WebsiteProxyService websiteProxyService; @RequestMapping(value = "/index.php", method = RequestMethod.GET) public String index(Model model, HttpSession session) { PageSkeleton skeleton = websiteProxyService.getV2ThemeSkeleton(); if (skeleton != null) { model.addAttribute("skeleton", skeleton); } return "index"; } @RequestMapping(value = "/enterpriseIndex.php", method = RequestMethod.GET) public String enterpriseIndex(Model model, HttpSession session,WebsiteUser websiteUser) { PageSkeleton skeleton = websiteProxyService.getV2ThemeSkeleton(); if (skeleton != null) { model.addAttribute("skeleton", skeleton); } model.addAttribute("websiteUser", websiteUser); return "index_enterprise"; } }
aa35723fd1c127db2145bf9f7a918b3810988b07
1bab7b23e4294d26de0f07fb5b01a249a131c6ca
/EFFECTIVE RUTINE v2.0/EFFECTIVE RUTINE/src/com/ihm/effective/rutine/MultiplicadorComidas.java
a585d18144300322878a6e089b9b7739cc402488
[]
no_license
rxcampoz/IHM
5a10c41255bda3b5836dd7f9345e7a4dbba69015
fe4d9b5e0788f898991dbb4d892b726dde19d28c
refs/heads/master
2021-01-22T06:58:53.407217
2012-10-01T19:40:39
2012-10-01T19:40:39
6,034,456
0
1
null
null
null
null
UTF-8
Java
false
false
6,482
java
package com.ihm.effective.rutine; import android.app.Activity; import android.content.ContentValues; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.Spinner; import android.widget.TextView; import com.ihm.bd.DetalleRutinaAlimento; import com.ihm.graphics.Hmensual; import com.ihm.graphics.Hsemanal; import com.ihm.providers.DatosProvider; import com.ihm.providers.DetalleRutinaActividadProvider; import com.ihm.providers.DetalleRutinaAlimentoProvider; public class MultiplicadorComidas extends Activity{ String id; String calorias; String grasas; String proteinas; String carbohidratos; String porciones; String nombre; String regimen; String codigo; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.multiplicador_comidas2); Bundle extras = getIntent().getExtras(); if(extras!=null){ calorias = extras.getString("calorias"); grasas = extras.getString("grasas"); proteinas = extras.getString("proteinas"); carbohidratos = extras.getString("carbohidratos"); porciones = extras.getString("porciones"); id = extras.getString("id"); nombre=extras.getString("nombre"); Log.d("my tag2" ,"kcal "+calorias+" g "+grasas+" p "+proteinas+" c "+carbohidratos+" p "+porciones+" y soy "+id); regimen=extras.getString("regimen"); codigo=extras.getString("codigo"); } TextView tcal = (TextView) findViewById(R.id.icalorias); TextView tgrasas = (TextView) findViewById(R.id.igrasas); TextView tpro = (TextView) findViewById(R.id.iproteinas); TextView tcar = (TextView) findViewById(R.id.icarbohidratos); TextView inombre = (TextView) findViewById(R.id.inombre); if(calorias==null){ Log.d("my tag2" ,"mori aqui y no tengo calorias"); calorias="0"; } //Log.d("my tag2" ,"mori aqui y tengo calorias "+calorias); tcal.setText(calorias); tgrasas.setText(grasas); tpro.setText(proteinas); tcar.setText(carbohidratos); inombre.setText(nombre); String array_spinner[]; array_spinner=new String[10]; array_spinner[0]="1"; array_spinner[1]="2"; array_spinner[2]="3"; array_spinner[3]="4"; array_spinner[4]="5"; array_spinner[5]="6"; array_spinner[6]="7"; array_spinner[7]="8"; array_spinner[8]="9"; array_spinner[9]="10"; Spinner s = (Spinner) findViewById(R.id.spinner1); /* String myString = "some value"; //the value you want the position for ArrayAdapter myAdap = (ArrayAdapter) mySpinner.getAdapter(); //cast to an ArrayAdapter int spinnerPosition = myAdap.getPosition(myString); //set the default according to value mySpinner.setSelection(spinnerPosition);*/ ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, array_spinner); s.setAdapter(adapter); } public void cambiarPeso(View view){ Intent i = new Intent(this, CambiarPeso.class); startActivity(i); } public void verComidas(View view){ Intent i = new Intent(this, ComidasDisponibles.class); startActivity(i); } public void verHConsulta(View view){ Intent i = new Intent(this, HistorialConsulta.class); startActivity(i); } public void verRutina(View view){ Intent i = new Intent(this, Rutina.class); startActivity(i); } public void verHMensual(View view){ Intent i = new Intent(this, Hmensual.class); startActivity(i); } public void verHSemanal(View view){ Intent i = new Intent(this, Hsemanal.class); startActivity(i); } public void verLActividades(View view){ Intent i = new Intent(this, ListaActividades.class); startActivity(i); } public void verLComidas(View view){ Intent i = new Intent(this, ListaComidas.class); startActivity(i); } public void verHome(View view){ Intent i = new Intent(this, MainActivity.class); startActivity(i); } public void verHsemanal(View view){ Intent i = new Intent(this, Hsemanal.class); startActivity(i); } public void verHmensual(View view){ Intent i = new Intent(this, Hmensual.class); startActivity(i); } public void actualizarPorcion(View view){ double caloria=Double.parseDouble(calorias); double gras=Double.parseDouble(grasas); double prot=Double.parseDouble(proteinas); double carb=Double.parseDouble(carbohidratos); String p=((Spinner) findViewById(R.id.spinner1)).getSelectedItem().toString(); int por=Integer.parseInt(p); Log.d("my tag2" ,"aqui "+p+" y yo soy "+id); Log.d("my tag2" ,"c "+caloria+" g "+gras+" p "+prot+" car "+carb); caloria=caloria*por; gras=gras*por; prot=prot*por; carb=carb*por; Log.d("my tag2" ,"multiplico c "+caloria+" g "+gras+" p "+prot+" car "+carb); ContentValues values = new ContentValues(); values.put( DetalleRutinaAlimentoProvider.CALORIAS_KCAL,caloria); values.put( DetalleRutinaAlimentoProvider.GRASAS_G,gras); values.put( DetalleRutinaAlimentoProvider.PROTEINAS_G,prot); values.put( DetalleRutinaAlimentoProvider.CARBOHIDRATOS_G,carb); values.put( DetalleRutinaAlimentoProvider.CANTIDAD_INGERIDA_G,por); String uriString="content://"+DetalleRutinaAlimentoProvider.PROVIDER_NAME+"/"+DetalleRutinaAlimentoProvider.ENTIDAD+"/"+id; Uri CONTENT_URI = Uri.parse(uriString); getContentResolver().update(CONTENT_URI, values,null,null); Intent i = new Intent(this, ListaComidasSeleccionadas.class); i.putExtra("regimen", regimen); i.putExtra("codigo", codigo); startActivity(i); } public void verAyuda(View view){ Intent i = new Intent(this, Ayuda.class); startActivity(i); } }
41a0faa6cd338cdf4e2a50c19a4d0a36004c0aeb
df9222858b26a9d629c34c7281870ae3717968f2
/src/main/java/test/Manzer.java
39f78593ed9a9456e76140b3c2bfa5f6e48df4a6
[]
no_license
gusreiber/simple-maven-project-with-tests
f930aff661654e02293f52581f885bc6ac4b8a8d
062c92c2df28d6f9170c1e3332672708cc297d0b
refs/heads/master
2021-01-14T09:10:38.870413
2014-10-28T17:35:20
2014-10-28T17:35:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
271
java
package test; public class Manzer { public static void main(String[] args) { System.out.println("Hi world"); System.out.println("Doing okay?"); System.out.println("Doing great thanks!!"); System.out.println("Live from Palo Alto!!"); } }
2d3e6658b3aabb13f9c61492669696609492a5b9
7dc0400d068c9790e75112d0682d0c5c20ddd6a1
/src/main/java/com/jedlab/pm/prime/ProjectActionBean.java
1661ece17314fd5ab4b72bff3c58593623457a97
[]
no_license
jedlab/pmPrime
993ce56a86773a8a56252e1c7a5558c96f5b411b
1ab40f28a93ca4edd1dbb6c643a762229180969d
refs/heads/master
2021-01-13T04:48:45.811394
2017-01-11T16:51:11
2017-01-11T16:51:11
78,659,266
0
0
null
null
null
null
UTF-8
Java
false
false
703
java
package com.jedlab.pm.prime; import javax.faces.bean.ManagedBean; import javax.faces.bean.RequestScoped; import javax.faces.view.ViewScoped; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.jedlab.pm.model.Project; import com.jedlab.pm.service.ProjectService; @Component("projectActionBean") @RequestScoped public class ProjectActionBean { @Autowired ProjectService projectService; Project project = new Project(); public Project getProject() { return project; } public void createProject() { projectService.persist(getProject()); project = new Project(); } }
3ba94efbe1803f90324a3b1097b4da2d4d491857
22dbd95f8227ccc6e27add83f1a54ba25dd2be3e
/app/src/androidTest/java/com/ojeda/manuel/contactos/ExampleInstrumentedTest.java
0478bc0e059cace30ae9479f805b45306d76e9a8
[]
no_license
manuoj/Contactos
516ce5dd6fe1ac8bb318b5e0161bdd4d4d1629ca
f85159acb8f3c472bb2b45c9b592534e15412bd2
refs/heads/master
2021-01-20T14:15:45.527037
2017-05-08T02:30:44
2017-05-08T02:30:44
90,577,949
0
0
null
null
null
null
UTF-8
Java
false
false
756
java
package com.ojeda.manuel.contactos; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.ojeda.manuel.contactos", appContext.getPackageName()); } }
45b1d6c7c69ddf75c835248ee1c155cc1a50031d
7413efa7a69b237e702a96dd5fc8bfdedf72c811
/annot8-components-files/src/main/java/io/annot8/components/files/sources/FolderSource.java
cb4d467ae12b18e0f28df4a7dadd867bcdcd0af3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
permissive
annot8/annot8-components
0442bdafbee29b5fc800a6676a64335dbecc3e4f
dc7580e74a479961be6d45da8c6bc4655ca27eef
refs/heads/develop
2022-09-17T21:27:00.892804
2022-05-06T13:25:39
2022-05-06T13:25:39
207,294,286
2
5
Apache-2.0
2022-09-01T23:49:49
2019-09-09T11:33:50
Java
UTF-8
Java
false
false
5,298
java
/* Annot8 (annot8.io) - Licensed under Apache-2.0. */ package io.annot8.components.files.sources; import io.annot8.api.capabilities.Capabilities; import io.annot8.api.components.annotations.ComponentDescription; import io.annot8.api.components.annotations.ComponentName; import io.annot8.api.components.annotations.SettingsClass; import io.annot8.api.components.responses.SourceResponse; import io.annot8.api.context.Context; import io.annot8.api.data.ItemFactory; import io.annot8.api.settings.Description; import io.annot8.common.components.AbstractSource; import io.annot8.common.components.AbstractSourceDescriptor; import io.annot8.common.components.capabilities.SimpleCapabilities; import io.annot8.common.data.content.FileContent; import io.annot8.conventions.PropertyKeys; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Queue; import java.util.stream.Collectors; @ComponentName("Folder Source") @ComponentDescription( "Treat each folder as an item with each file in the folder content for the item.") @SettingsClass(FolderSource.Settings.class) public class FolderSource extends AbstractSourceDescriptor<FolderSource.Source, FolderSource.Settings> { @Override public Capabilities capabilities() { return new SimpleCapabilities.Builder().withCreatesContent(FileContent.class).build(); } @Override protected Source createComponent(Context context, Settings settings) { return new Source(settings); } public static class Source extends AbstractSource { private final Queue<Path> folders = new LinkedList<>(); private final Settings settings; public Source(FolderSource.Settings settings) { this.settings = settings; if (settings.isRecursive()) { settings .getPaths() .forEach( p -> { try { Files.walk(p) .filter(f -> !p.equals(f)) .filter(Files::isDirectory) .forEach(folders::add); } catch (Exception e) { log().error("Unable to read files recursively in path {}", p, e); } }); } else { settings .getPaths() .forEach( p -> { try { Files.list(p).filter(Files::isDirectory).forEach(folders::add); } catch (Exception e) { log().error("Unable to read files in path {}", p, e); } }); } log().info("{} folders to be processed", folders.size()); } private boolean acceptExtension(Path p) { List<String> extensions = settings.getExtensions(); if (extensions.isEmpty()) { return true; } return extensions.contains( com.google.common.io.Files.getFileExtension(p.toString()).toLowerCase()); } @Override public SourceResponse read(ItemFactory itemFactory) { if (folders.isEmpty()) { return SourceResponse.done(); } Path p = folders.poll(); log().info("Processing {}", p); itemFactory.create( item -> { item.getProperties().set(PropertyKeys.PROPERTY_KEY_SOURCE, p); try { Files.list(p) .filter(Files::isRegularFile) .filter(this::acceptExtension) .forEach( file -> itemFactory.create( item, child -> { child.getProperties().set(PropertyKeys.PROPERTY_KEY_SOURCE, file); child .createContent(FileContent.class) .withData(file.toFile()) .save(); })); } catch (Exception e) { log().error("Unable to read files in folder {}", p, e); } }); return SourceResponse.ok(); } } public static class Settings implements io.annot8.api.settings.Settings { private List<Path> paths = new ArrayList<>(); private List<String> extensions = new ArrayList<>(); private boolean recursive = true; @Override public boolean validate() { return extensions != null && paths != null && !paths.isEmpty(); } @Description("List of paths to process") public List<Path> getPaths() { return paths; } public void setPaths(List<Path> paths) { this.paths = paths; } @Description("List of file extensions to accept (accepts all files if no extensions are given)") public List<String> getExtensions() { return extensions; } public void setExtensions(List<String> extensions) { this.extensions = extensions.stream().map(String::toLowerCase).collect(Collectors.toList()); } @Description("Should we process paths recursively?") public boolean isRecursive() { return recursive; } public void setRecursive(boolean recursive) { this.recursive = recursive; } } }
b422dd6fdbd861d778300948debe981ef27cd2ff
b7d1b49a3f992e1b2af9d8a086e36601848b6546
/app/src/main/java/com/example/allapps/genericFile/fragments/pictureBrowserFragment.java
09db426fae4ff32a5276d32d241770db7e6e9046
[]
no_license
vishnukumar7/All-Application-Tools
b6857c3c4e50fcd3f58957541ce24ab7a39aa01c
00b630f133e6a8f36c547dfd0d75d663ef51033b
refs/heads/master
2022-11-10T08:51:19.904242
2020-06-27T08:45:46
2020-06-27T08:45:46
275,332,986
1
0
null
null
null
null
UTF-8
Java
false
false
9,979
java
package com.example.allapps.genericFile.fragments; import android.annotation.SuppressLint; import android.content.Context; import android.os.Bundle; import android.os.Handler; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.viewpager.widget.PagerAdapter; import androidx.viewpager.widget.ViewPager; import com.bumptech.glide.Glide; import com.bumptech.glide.request.RequestOptions; import com.example.allapps.R; import com.example.allapps.Interface.imageIndicatorListener; import com.example.allapps.genericFile.utils.recyclerViewPagerImageIndicator; import com.example.allapps.model.AllFacer; import java.util.ArrayList; import static androidx.core.view.ViewCompat.setTransitionName; /** * Author: CodeBoy722 * <p> * this fragment handles the browsing of all images in an ArrayList of AllFacer passed in the constructor * the images are loaded in a ViewPager an a RecyclerView is used as a pager indicator for * each image in the ViewPager */ public class pictureBrowserFragment extends Fragment implements imageIndicatorListener { private ArrayList<AllFacer> allImages = new ArrayList<>(); private int position; private Context animeContx; private ImageView image; private ViewPager imagePager; private RecyclerView indicatorRecycler; private int viewVisibilityController; private int viewVisibilitylooper; private ImagesPagerAdapter pagingImages; private int previousSelected = -1; public pictureBrowserFragment() { } public pictureBrowserFragment(ArrayList<AllFacer> allImages, int imagePosition, Context anim) { this.allImages = allImages; this.position = imagePosition; this.animeContx = anim; } public static pictureBrowserFragment newInstance(ArrayList<AllFacer> allImages, int imagePosition, Context anim) { return new pictureBrowserFragment(allImages, imagePosition, anim); } @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.picture_browser, container, false); } @SuppressLint("ClickableViewAccessibility") @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); /** * initialisation of the recyclerView visibility control integers */ viewVisibilityController = 0; viewVisibilitylooper = 0; /** * setting up the viewPager with images */ imagePager = view.findViewById(R.id.imagePager); pagingImages = new ImagesPagerAdapter(); imagePager.setAdapter(pagingImages); imagePager.setOffscreenPageLimit(3); imagePager.setCurrentItem(position);//displaying the image at the current position passed by the FileDisplay Activity /** * setting up the recycler view indicator for the viewPager */ indicatorRecycler = view.findViewById(R.id.indicatorRecycler); indicatorRecycler.hasFixedSize(); indicatorRecycler.setLayoutManager(new GridLayoutManager(getContext(), 1, RecyclerView.HORIZONTAL, false)); RecyclerView.Adapter indicatorAdapter = new recyclerViewPagerImageIndicator(allImages, getContext(), this); indicatorRecycler.setAdapter(indicatorAdapter); //adjusting the recyclerView indicator to the current position of the viewPager, also highlights the image in recyclerView with respect to the //viewPager's position allImages.get(position).setSelected(true); previousSelected = position; indicatorAdapter.notifyDataSetChanged(); indicatorRecycler.scrollToPosition(position); /** * this listener controls the visibility of the recyclerView * indication and it current position in respect to the image ViewPager */ imagePager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { if (previousSelected != -1) { allImages.get(previousSelected).setSelected(false); previousSelected = position; allImages.get(position).setSelected(true); indicatorRecycler.getAdapter().notifyDataSetChanged(); indicatorRecycler.scrollToPosition(position); } else { previousSelected = position; allImages.get(position).setSelected(true); indicatorRecycler.getAdapter().notifyDataSetChanged(); indicatorRecycler.scrollToPosition(position); } } @Override public void onPageScrollStateChanged(int state) { } }); indicatorRecycler.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { /** * uncomment the below condition to control recyclerView visibility automatically * when image is clicked also uncomment the condition set on the image's onClickListener in the ImagesPagerAdapter adapter */ /*if(viewVisibilityController == 0){ indicatorRecycler.setVisibility(View.VISIBLE); visibiling(); }else{ viewVisibilitylooper++; }*/ return false; } }); } /** * this method of the imageIndicatorListerner interface helps in communication between the fragment and the recyclerView Adapter * each time an iten in the adapter is clicked the position of that item is communicated in the fragment and the position of the * viewPager is adjusted as follows * * @param ImagePosition The position of an image item in the RecyclerView Adapter */ @Override public void onImageIndicatorClicked(int ImagePosition) { //the below lines of code highlights the currently select image in the indicatorRecycler with respect to the viewPager position if (previousSelected != -1) { allImages.get(previousSelected).setSelected(false); previousSelected = ImagePosition; indicatorRecycler.getAdapter().notifyDataSetChanged(); } else { previousSelected = ImagePosition; } imagePager.setCurrentItem(ImagePosition); } /** * function for controlling the visibility of the recyclerView indicator */ private void visibiling() { viewVisibilityController = 1; final int checker = viewVisibilitylooper; new Handler().postDelayed(new Runnable() { @Override public void run() { if (viewVisibilitylooper > checker) { visibiling(); } else { indicatorRecycler.setVisibility(View.GONE); viewVisibilityController = 0; viewVisibilitylooper = 0; } } }, 4000); } /** * the imageViewPager's adapter */ private class ImagesPagerAdapter extends PagerAdapter { @Override public int getCount() { return allImages.size(); } @NonNull @Override public Object instantiateItem(@NonNull ViewGroup containerCollection, int position) { LayoutInflater layoutinflater = (LayoutInflater) containerCollection.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = layoutinflater.inflate(R.layout.picture_browser_pager, null); image = view.findViewById(R.id.image); setTransitionName(image, position + "picture"); AllFacer pic = allImages.get(position); Glide.with(animeContx) .load(pic.getFilePath()) .apply(new RequestOptions().fitCenter()) .into(image); image.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (indicatorRecycler.getVisibility() == View.GONE) { indicatorRecycler.setVisibility(View.VISIBLE); } else { indicatorRecycler.setVisibility(View.GONE); } /** * uncomment the below condition and comment the one above to control recyclerView visibility automatically * when image is clicked */ /*if(viewVisibilityController == 0){ indicatorRecycler.setVisibility(View.VISIBLE); visibiling(); }else{ viewVisibilitylooper++; }*/ } }); containerCollection.addView(view); return view; } @Override public void destroyItem(ViewGroup containerCollection, int position, Object view) { containerCollection.removeView((View) view); } @Override public boolean isViewFromObject(@NonNull View view, @NonNull Object object) { return view == object; } } }
6f1d0ffcbe2584b038ad7c432dd787b7c32f4405
dca3687e2cd57f326bc9b9ef71449745899b073f
/app/src/main/java/com/example/rsc/myapplication/Mascota.java
085c4d2a7fce20712edcc20428ff85d917810a64
[]
no_license
rubensanco/PetagramSem3
8d9df9ad61ac271f591fea078541537ba483a4c0
9845dfd6b4a0da8a9dd6896d3cf301e5710737c7
refs/heads/master
2016-09-12T18:23:57.386673
2016-05-14T18:29:25
2016-05-14T18:29:25
58,823,711
0
0
null
null
null
null
UTF-8
Java
false
false
1,057
java
package com.example.rsc.myapplication; import java.io.Serializable; /** * Created by Silvia on 12/05/2016. */ public class Mascota implements Serializable{ private boolean favorito; private String nombre; private int imagen; private int likes; public Mascota(String nombre, int imagen, int likes) { this.nombre = nombre; this.imagen = imagen; this.likes = likes; } public int getLikes() { return likes; } public void setLikes(int likes) { this.likes = likes; } public boolean isFavorito() { return favorito; } public void setFavorito(boolean favorito) { this.favorito = favorito; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public int getImagen() { return imagen; } public void setImagen(int imagen) { this.imagen = imagen; } public void sumaLike () { this.likes = this.likes + 1; } }
927c55e8f5d6a3543f6db68929824875f2067db7
0af8b92686a58eb0b64e319b22411432aca7a8f3
/single-large-project/src/main/java/org/gradle/test/performancenull_81/Productionnull_8010.java
13ff4de37b0c2cc56b49a65a854e50086a76a607
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
585
java
package org.gradle.test.performancenull_81; public class Productionnull_8010 { private final String property; public Productionnull_8010(String param) { this.property = param; } public String getProperty() { return property; } private String prop0; public String getProp0() { return prop0; } public void setProp0(String value) { prop0 = value; } private String prop1; public String getProp1() { return prop1; } public void setProp1(String value) { prop1 = value; } }
64dd11e0f830250007827ce6a5b0ef42f42cdb83
c627ab18918d08c8ca328438cf6291a4b5d2a867
/src/main/java/ee/smkv/erply/api/client/models/CustomerType.java
b6113286fcc5b4bd7a69ed24c2f00c03de9b308c
[]
no_license
smkv/simple-erply-api-client-java
8eb16420cce8fbdfa70b8a3f244648990da380c2
caff451c4e764690b62abe7a6d06f04d4880faa1
refs/heads/master
2021-01-01T06:27:30.163804
2015-05-13T21:04:19
2015-05-13T21:04:19
35,274,606
1
0
null
null
null
null
UTF-8
Java
false
false
91
java
package ee.smkv.erply.api.client.models; public enum CustomerType { COMPANY ,PERSON }
dcb049ddaadf8c8568d3bd4ac0dc40c781ace85c
872c3863339da129104226d9aa2d2e7b4321dc8d
/src/main/java/com/tobdev/qywxthird/mapper/QywxThirdDepartmentMapper.java
fe1838e9a6fcc2e7066bc7ba04820f584c0306be
[]
no_license
snowbuffer/qywx-third-java
14096aab7df5107d9aa491e9573c6d6ba766d5af
8b6f3cca8ff02c6c92a980df8f80997115046add
refs/heads/master
2023-06-06T01:06:37.937456
2021-06-29T08:49:08
2021-06-29T08:49:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
410
java
package com.tobdev.qywxthird.mapper; import com.tobdev.qywxthird.model.entity.QywxThirdDepartment; import org.apache.ibatis.annotations.Param; public interface QywxThirdDepartmentMapper { QywxThirdDepartment getDepartmentByCorpId(@Param("corp_id") String corpId); Integer saveDepartment(QywxThirdDepartment Department); Integer deleteDepartmentByCorpId(@Param("corp_id") String corpId); }
[ "" ]
d11d8cf0730425fd47e36477a41a4efa3dd9e53d
8cb5ae1c2577bfd88858a90f401de56841af144d
/SphereVolume.java
aafbad8e6d7e070d55ff63bf7bb54f3d2c3fe170
[]
no_license
sunnyfeng/JavaCodes
860170d0a2cd51b14984ba9f5de7185fd6c2dea7
73246d6feceb8d439b894e9a2885572cae7daeb1
refs/heads/master
2021-01-19T21:32:43.372270
2017-04-18T19:43:53
2017-04-18T19:43:53
88,663,723
0
0
null
null
null
null
UTF-8
Java
false
false
483
java
public class SphereVolume{ public static void main (String[] args){ System.out.println("Enter the radius: "); double radius = IO.readDouble(); if (radius >= 0){ double Volume = (4.0/3.0)*(Math.PI)*radius*radius*radius; // println(4/3) prints 1. WHY? Because / is not division operator! // System.out.println("The volume of the sphere is: " + Volume); } else { System.out.println("This is not a valid radius. Sorry!"); } } }
978656a8832bc98a53c693520926f9875170d667
73f76982bf1597936f3d8aae78e5cb4074e8762f
/Ejercicios/Ejercicio2/Ejercicio2.java
be1bbc64a6682f5d1eb8f0fd3e676b2a80be8600
[]
no_license
Dave-Canedo/Test
c5b26cd43311e8ddf94a2d117c686fadfb70890b
3b55ddc0a21f53ad704a82319825d8e0d3d67fe3
refs/heads/master
2023-04-21T09:08:14.027790
2021-05-15T00:07:43
2021-05-15T00:07:43
367,483,294
0
0
null
null
null
null
UTF-8
Java
false
false
785
java
import java.util.Scanner; public class Ejercicio2 { public static void main(String[] args) { System.out.println("introducir un numero"); Scanner sc = new Scanner(System.in); int x = sc.nextInt(); while(x!=0) { if(x*1>0) { System.out.println(x+" es positivo"); } else if(x*1<0) { System.out.println(x+" es negativo"); } System.out.println("introducir un nuevo numero"); x= sc.nextInt(); } } } // Leer un numero e indicar si es positivo o negativo. Repetir hasta que se introduzca 0. // Se debe mostrar un mensaje para introducir un nuevo numero: // "Introduzca un numero:" // "X es positivo" // "X es negativo"
8e7e70709d356ac3fe601c3932620f698aa1fc5b
43f42e2480e1a82d9a8ab6da91cdf482f798bb29
/api/timer/AppUserMonthlyIncomeStatisti.java
87c9e03e3034b0b3c7cd9426a5e0766824dd49a3
[]
no_license
jreyson/shopping
1cbf9c8d843c04c456d6e1b1a42d33ab93d34893
85e81a6fa72a16c453ca36bbb4c1f73a28296f38
refs/heads/master
2020-03-22T21:30:39.071407
2018-07-12T09:39:09
2018-07-12T09:39:09
140,692,217
0
1
null
null
null
null
UTF-8
Java
false
false
3,871
java
package com.shopping.api.timer; import java.util.Date; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.shopping.api.domain.userBill.UserMonthlyBill; import com.shopping.core.tools.CommUtil; import com.shopping.foundation.domain.User; import com.shopping.foundation.service.ICommonService; import com.shopping.foundation.service.IUserService; /** * @author:gaohao * @description:在app上每月初统计上月的用户收入 */ @Component("appUserMonthlyIncomeStatisti") public class AppUserMonthlyIncomeStatisti { @Autowired private IUserService userService; @Autowired private ICommonService commonService; public void execute(){ String beginTime = CommUtil.getLastMonthFirstDay(); String endTime = CommUtil.getLastMonthFinalDay(); int currentPage=0; int pageSize=50; String count_sql="select count(distinct obj.user_id) from shopping_orderform as obj where obj.addTime >='"+beginTime+"' and obj.addTime <='"+endTime+"' and obj.order_status in (20,30,40,50,60)"; List<?> count = commonService.executeNativeNamedQuery(count_sql); String user_sql=""; int num=0; if (count.size()>0) { num=CommUtil.null2Int(count.get(0)); num=num%50==0?num/50:num/50+1; } for (int i = 0; i < num; i++) { user_sql="select distinct obj.user_id from shopping_orderform as obj where obj.addTime >='"+beginTime+"' and obj.addTime <='"+endTime+"' and obj.order_status in (20,30,40,50,60) limit "+currentPage*pageSize+","+pageSize; List<?> users = commonService.executeNativeNamedQuery(user_sql); currentPage++; for (Object obj : users) { Long userId = CommUtil.null2Long(obj); if (userId!=-1) { User user = userService.getObjById(userId); if (user!=null) { Double chubeiMoney = this.getUserIncomeMoneys(beginTime, endTime, user, "储备金"); Double daogouMoney = this.getUserIncomeMoneys(beginTime, endTime, user, "导购金"); Double danbaoMoney = this.getUserIncomeMoneys(beginTime, endTime, user, "担保金"); Double zhaoshangMoney = this.getUserIncomeMoneys(beginTime, endTime, user, "招商金"); Double xianjiMoney = this.getUserIncomeMoneys(beginTime, endTime, user, "衔级金"); Double fenhongMoney = this.getUserIncomeMoneys(beginTime, endTime, user, "分红股"); Double zengguMoney = this.getUserIncomeMoneys(beginTime, endTime, user, "赠股金"); Double moneySum=chubeiMoney+daogouMoney+zhaoshangMoney+xianjiMoney+danbaoMoney+fenhongMoney+zengguMoney; if (moneySum>0) { UserMonthlyBill bill=new UserMonthlyBill(); bill.setUser(user); bill.setChubeiMoney(chubeiMoney); bill.setDaogouMoney(daogouMoney); bill.setDanbaoMoney(danbaoMoney); bill.setXianjiMoney(xianjiMoney); bill.setMoneySum(CommUtil.formatDouble(moneySum, 2)); bill.setZhaoshangMoney(zhaoshangMoney); bill.setAddTime(new Date()); bill.setDeleteStatus(false); bill.setZengguMoney(zengguMoney); bill.setFenhongMoney(fenhongMoney); commonService.save(bill); } } } } } System.out.println(beginTime+"收入统计完毕。"); } private Double getUserIncomeMoneys(String begin,String end,User user,String type){ String where=""; if ("分红股".equals(type)) { where=" and obj.pd_log_info not LIKE '%退款%'"; } String sql="SELECT ROUND(SUM(obj.pd_log_amount),2) FROM shopping_predeposit_log AS obj WHERE obj.addTime >= '" + begin + "' AND obj.addTime <= '" + end + "' AND obj.pd_log_user_id=" + user.getId() + " AND obj.pd_log_info LIKE '%" + type + "%'" + where; List<?> money = commonService.executeNativeNamedQuery(sql); if (money.size()>0) { Double userMoney=CommUtil.formatDouble(CommUtil.null2Double(money.get(0)), 2); return userMoney; } return 0d; } }
0c14b4c3374b6160e4f697151dd2c12233ab6eb4
5fa10d3442c30684df8d0040539dbb5637a8ea4a
/src/main/java/pack/App.java
119aadd655bb074afc2e6d5ff45263f309551f76
[]
no_license
riskop/spring_environment_demo
3ac3fadcd9a9290e5e76db17dcfb1ac2b898e76b
9b643d601943a651285500067c4d8f10d8d513f8
refs/heads/master
2020-05-18T17:29:22.780422
2019-05-02T09:50:47
2019-05-02T09:50:47
184,556,928
0
0
null
null
null
null
UTF-8
Java
false
false
452
java
package pack; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; @Component public class App { @Value("${java.runtime.name}") private String javaRuntimeName; @Value("${value}") private String value; public void doSomething() { System.out.println("app is doing something"); System.out.println("javaRuntimeName: " + javaRuntimeName); System.out.println("value: " + value); } }
936c849d0aca3851ae5f47880bb34d5c5256501c
b9dc3412091788527896fe0bd80a318570aa341c
/src/main/java/com/tcsb/shophours/service/TcsbShopHoursServiceI.java
539d4f166f239ccd42dc5a53fdb4f264b4374c37
[]
no_license
zhengwangfeng/ddmshopv2
f23fc64e6d498c33f5ec69c31b9838921443a549
2a70060fea3429b4081bf22c3df9c7fec0130245
refs/heads/master
2020-03-09T05:48:57.763427
2018-04-08T09:18:15
2018-04-08T09:18:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
470
java
package com.tcsb.shophours.service; import com.tcsb.shophours.entity.TcsbShopHoursEntity; import org.jeecgframework.core.common.service.CommonService; import java.io.Serializable; public interface TcsbShopHoursServiceI extends CommonService{ public void delete(TcsbShopHoursEntity entity) throws Exception; public Serializable save(TcsbShopHoursEntity entity) throws Exception; public void saveOrUpdate(TcsbShopHoursEntity entity) throws Exception; }
9021b8d51de9f30b42f8501172419574b23fb7ec
decb694320c8f864b090663a448dc874d0736467
/java/practicelog/PaymentCreated.java
dcbc4e0736ee066fc583e82e3c989b25ba8cc2bc
[]
no_license
hangilc/myclinic-api
a2a78ef5382314ddb0ac547bb881ae2d79c0f85a
335afbdb37fefa75dcc3c4f3f4bd1dfd112be3e9
refs/heads/master
2022-11-22T12:43:03.346548
2020-06-04T04:28:08
2020-06-04T04:28:08
242,602,502
0
0
null
null
null
null
UTF-8
Java
false
false
317
java
package jp.chang.myclinic.logdto.practicelog; import jp.chang.myclinic.dto.PaymentDTO; public class PaymentCreated implements PracticeLogBody { public PaymentDTO created; public PaymentCreated() { } public PaymentCreated(PaymentDTO created) { this.created = created; } }
c83982a4e815c765a5841a05b877b505c28a925b
2f0c5db07e8169c2054ca937e4ca89d77ce97994
/src/main/java/cn/et/lesson03/food/entity/Result.java
53aeb4d004c91eb01789395efb5918ca7b314731
[]
no_license
PeterOnlyOne/SpringBootLesson
098747782b000e2531c6fbd5dd3df31eec4673d9
f0b7f4166e2e50f7903ef85234414c114c1269cf
refs/heads/master
2021-09-01T22:56:54.217297
2017-12-29T02:32:01
2017-12-29T02:32:01
115,678,212
0
0
null
null
null
null
UTF-8
Java
false
false
929
java
package cn.et.lesson03.food.entity; import java.io.ByteArrayOutputStream; import java.io.PrintStream; public class Result { /** * 0��ʾʧ�� * 1��ʾ�ɹ� */ private int code; /** * ʧ�ܵ���Ϣ */ private String message; public int getCode() { return code; } public void setCode(int code) { this.code = code; } public String getMessage() { if(message!=null && message.length()>1000) return message.substring(0, 1000); return message; } public void setMessage(String message) { this.message = message; } /** * ��дsetMessage�������쳣�Ķ�ջ��Ϣ���õ� message������ * @param msg */ public void setMessage(Exception msg) { ByteArrayOutputStream baos=new ByteArrayOutputStream(); msg.printStackTrace(new PrintStream(baos)); this.message = new String(baos.toByteArray()); } }
71d115ef04472efbed7ce1a0a99de667d2c88f3a
0a72759bc47c04919f420b06f95f489a200dcbe9
/.svn/pristine/32/3256d65166e19ab464eded2af078f7853afd276e.svn-base
3011e7e55102d4f92dbf356d70aa2dbdb8b3d970
[]
no_license
percys/yyy
390a926c1ae21b4b59d4cb3b82ce1aa911e8f1d5
e884f7bbf9e52ce141b96d514df01598f3482c7f
refs/heads/master
2021-01-19T18:58:15.467423
2015-01-06T09:23:57
2015-01-06T09:23:57
28,855,895
0
0
null
null
null
null
UTF-8
Java
false
false
3,564
package dv.sys.dao.impl; import java.sql.SQLException; import java.util.List; import org.hibernate.HibernateException; import org.hibernate.Query; import org.hibernate.Session; import org.springframework.orm.hibernate3.HibernateCallback; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; import dv.sys.dao.MailBoxDao; import dv.sys.entity.Mailbox; import dv.sys.entity.MailboxDetails; import dv.sys.entity.WebUser; public class MailBoxDaoImpl extends HibernateDaoSupport implements MailBoxDao { public List<MailboxDetails> getUnReadInfo(WebUser user) { return super.getHibernateTemplate().find("from Mailbox mb inner join fetch mb.mailboxDetails md where md.mdId=mb.mbId and mb.sendname=?",user.getUsername()); } public List<MailboxDetails> getMailInfo(WebUser user,MailboxDetails mds) { return super.getHibernateTemplate().find("from Mailbox mb inner join fetch mb.mailboxDetails md where md.mdId=mb.mbId and mb.receivename=? and md.mdId=?",user.getUsername(),mds.getMdId()); } public int addsend(Mailbox maibox) { super.getHibernateTemplate().save(maibox); return maibox.getMbId(); } public void updateMail(Mailbox mb) { super.getHibernateTemplate().update(mb); } public Long getCount(WebUser user) { String hql = "select count(*) from Mailbox where receivename='"+user.getUsername()+"' and mbState=0"; return (Long) getHibernateTemplate().find(hql).listIterator().next(); } public Long getCommodityTotal(WebUser user) { String hql = "select count(*) from Mailbox where receivename='"+user.getUsername()+"'"; return (Long) getHibernateTemplate().find(hql).listIterator().next(); } public List<Mailbox> doSplitPage(final int page,final int rows, final WebUser user) { List list = getHibernateTemplate().executeFind(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException, SQLException { // from Mailbox mb inner join fetch mb.mailboxDetails md where md.mdId=mb.mbId and mb.receivename='"+user.getUsername()+"'"; String hql = "from Mailbox where receivename='"+user.getUsername()+"' order by mbId desc"; Query query = session.createQuery(hql); query.setFirstResult((page - 1) * rows); query.setMaxResults(rows); List list = query.list(); return list; } }); return list; } public Long getCommodityTotals(WebUser user) { String hql = "select count(*) from Mailbox where sendname='"+user.getUsername()+"'"; return (Long) getHibernateTemplate().find(hql).listIterator().next(); } public List<Mailbox> doSplitPages(final int page,final int rows, final WebUser user) { List list = getHibernateTemplate().executeFind(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException, SQLException { // from Mailbox mb inner join fetch mb.mailboxDetails md where md.mdId=mb.mbId and mb.receivename='"+user.getUsername()+"'"; String hql = "from Mailbox where sendname='"+user.getUsername()+"' order by mbId desc"; Query query = session.createQuery(hql); query.setFirstResult((page - 1) * rows); query.setMaxResults(rows); List list = query.list(); return list; } }); return list; } public Mailbox getMailbox(Integer id) { // TODO Auto-generated method stub return (Mailbox) super.getHibernateTemplate().find("from Mailbox where mbId='"+id+"'").get(0); } public MailboxDetails saveMbDetail(MailboxDetails detail) { // TODO Auto-generated method stub return (MailboxDetails) super.getHibernateTemplate().save(detail); } }
98235810cacd137bf1b42e7ba321f81b38348adb
bf2966abae57885c29e70852243a22abc8ba8eb0
/aws-java-sdk-location/src/main/java/com/amazonaws/services/location/model/transform/TruckDimensionsJsonUnmarshaller.java
87c2312d585786f41817efbdfb2fdd0da85c9298
[ "Apache-2.0" ]
permissive
kmbotts/aws-sdk-java
ae20b3244131d52b9687eb026b9c620da8b49935
388f6427e00fb1c2f211abda5bad3a75d29eef62
refs/heads/master
2021-12-23T14:39:26.369661
2021-07-26T20:09:07
2021-07-26T20:09:07
246,296,939
0
0
Apache-2.0
2020-03-10T12:37:34
2020-03-10T12:37:33
null
UTF-8
Java
false
false
3,430
java
/* * Copyright 2016-2021 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.location.model.transform; import java.math.*; import javax.annotation.Generated; import com.amazonaws.services.location.model.*; import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*; import com.amazonaws.transform.*; import com.fasterxml.jackson.core.JsonToken; import static com.fasterxml.jackson.core.JsonToken.*; /** * TruckDimensions JSON Unmarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class TruckDimensionsJsonUnmarshaller implements Unmarshaller<TruckDimensions, JsonUnmarshallerContext> { public TruckDimensions unmarshall(JsonUnmarshallerContext context) throws Exception { TruckDimensions truckDimensions = new TruckDimensions(); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) token = context.nextToken(); if (token == VALUE_NULL) { return null; } while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { if (context.testExpression("Height", targetDepth)) { context.nextToken(); truckDimensions.setHeight(context.getUnmarshaller(Double.class).unmarshall(context)); } if (context.testExpression("Length", targetDepth)) { context.nextToken(); truckDimensions.setLength(context.getUnmarshaller(Double.class).unmarshall(context)); } if (context.testExpression("Unit", targetDepth)) { context.nextToken(); truckDimensions.setUnit(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("Width", targetDepth)) { context.nextToken(); truckDimensions.setWidth(context.getUnmarshaller(Double.class).unmarshall(context)); } } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) break; } } token = context.nextToken(); } return truckDimensions; } private static TruckDimensionsJsonUnmarshaller instance; public static TruckDimensionsJsonUnmarshaller getInstance() { if (instance == null) instance = new TruckDimensionsJsonUnmarshaller(); return instance; } }
[ "" ]
0483d7f95c539b1bf0488debc5777cc7d7bd3b77
f403acaef15d89e4a2d66abf13d930b7e64ea510
/people.management/src/main/java/com/globallogic/people/management/model/Country.java
5f71da8127c773391c165a00485036961543f7d2
[]
no_license
ldecheverz/microservices
6da718c39894607605eac209a45369c06dd62498
fadcc3023bd3fc4d8d290c7b4549c78ee671540f
refs/heads/master
2022-11-13T18:24:32.188316
2020-06-17T21:31:53
2020-06-17T21:31:53
273,081,678
0
0
null
null
null
null
UTF-8
Java
false
false
295
java
package com.globallogic.people.management.model; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; @Data @Builder @NoArgsConstructor @AllArgsConstructor public class Country { private String name; private String continent; }
7699d33b7315fa15576da4a871084fe2e05a4763
c726f082cdec145f724246f5faf23a00704406b7
/fop-1.0-sqs/src/java/org/apache/fop/fo/flow/InitialPropertySet.java
c3f0f894c352eff023ef44dc0fba7d52a88f4e45
[ "Apache-2.0" ]
permissive
freinhold/sqs
a8ef0b1a99b7891a676bd02f6040ef2080246efe
4c2b8fd41ec1ff18f4e2ac43c59860ff81950c6d
refs/heads/master
2020-09-09T12:58:58.287148
2012-05-04T08:04:23
2012-05-04T08:04:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,379
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. */ /* $Id: InitialPropertySet.java 679326 2008-07-24 09:35:34Z vhennebert $ */ package org.apache.fop.fo.flow; // XML import org.xml.sax.Locator; import org.apache.fop.apps.FOPException; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.ValidationException; import org.apache.fop.fo.properties.SpaceProperty; /** * Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_initial-property-set"> * <code>fo:initial-property-set</code></a> object. */ public class InitialPropertySet extends FObj { // The value of properties relevant for fo:initial-property-set. // private ToBeImplementedProperty letterSpacing; private SpaceProperty lineHeight; // private ToBeImplementedProperty textShadow; // Unused but valid items, commented out for performance: // private CommonAccessibility commonAccessibility; // private CommonAural commonAural; // private CommonBorderPaddingBackground commonBorderPaddingBackground; // private CommonFont commonFont; // private CommonRelativePosition commonRelativePosition; // private Color color; // private int scoreSpaces; // private int textDecoration; // private int textTransform; // private SpaceProperty wordSpacing; // End of property values /** * Base constructor * * @param parent {@link FONode} that is the parent of this object */ public InitialPropertySet(FONode parent) { super(parent); } /** {@inheritDoc} */ public void bind(PropertyList pList) throws FOPException { super.bind(pList); // letterSpacing = pList.get(PR_LETTER_SPACING); lineHeight = pList.get(PR_LINE_HEIGHT).getSpace(); // textShadow = pList.get(PR_TEXT_SHADOW); } /** * {@inheritDoc} * <br>XSL Content Model: empty */ protected void validateChildNode(Locator loc, String nsURI, String localName) throws ValidationException { if (FO_URI.equals(nsURI)) { invalidChildError(loc, nsURI, localName); } } /** @return the "line-height" property */ public SpaceProperty getLineHeight() { return lineHeight; } /** {@inheritDoc} */ public String getLocalName() { return "initial-property-set"; } /** * {@inheritDoc} * @return {@link org.apache.fop.fo.Constants#FO_INITIAL_PROPERTY_SET} */ public int getNameId() { return FO_INITIAL_PROPERTY_SET; } }
bb12682506ec5872da45693719cb547479773183
d7dd931861ad717625c39a7aa41c688f906393c5
/pabili-core/pabili-core-service/src/main/java/com/pabili/core/config/MailConfig.java
268779c2ad52020f75e62ed551deea76f9ce5e81
[]
no_license
lordmarkm/pabili
353321a56b95e90e2ef2bca262d350e6480370b9
f575c184d8f835a2c589cc82dc90fad09ae76378
refs/heads/master
2021-01-01T19:11:31.486330
2015-09-28T08:25:54
2015-09-28T08:25:54
40,460,513
0
0
null
null
null
null
UTF-8
Java
false
false
1,796
java
package com.pabili.core.config; import java.util.Properties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; import org.springframework.core.env.Environment; import org.springframework.core.task.TaskExecutor; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.JavaMailSenderImpl; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @Configuration @PropertySource("classpath:mail.properties") public class MailConfig { @Autowired private Environment env; @Bean public JavaMailSender javaMailService() { JavaMailSenderImpl mailSender = new JavaMailSenderImpl(); Properties mailProperties = new Properties(); mailProperties.put("mail.smtp.auth", env.getProperty("mail.smtp.auth")); mailProperties.put("mail.smtp.starttls.enable", env.getProperty("mail.smtp.starttls.enable")); mailSender.setJavaMailProperties(mailProperties); mailSender.setHost(env.getProperty("mail.host")); mailSender.setPort(env.getProperty("mail.port", Integer.class)); mailSender.setProtocol(env.getProperty("mail.protocol")); mailSender.setUsername(env.getProperty("mail.username")); mailSender.setPassword(env.getProperty("mail.password")); return mailSender; } @Bean public TaskExecutor taskExecutor() { ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor(); taskExecutor.setCorePoolSize(5); taskExecutor.setMaxPoolSize(10); taskExecutor.setQueueCapacity(100); return taskExecutor; } }
2bfda6b30923510690d364456c54fb8cb9faaeda
640d72bd6c2b5834b5d0c84a9fb15252ab6017e9
/src/cis3270/user/User.java
c74d508a1ece8afe03cfc2c30c3e8f126dc6ddf8
[]
no_license
SamuelU89/CIS3270_Project
e19230a3c270caf58de0b65a0ca65c9f8b3120a3
246774512acd639a3f419b406534b2573c95197c
refs/heads/master
2021-01-10T15:35:26.547178
2015-12-16T06:03:52
2015-12-16T06:03:52
47,860,367
0
0
null
null
null
null
UTF-8
Java
false
false
9,698
java
package cis3270.user; import java.sql.*; import javax.swing.JOptionPane; import cis3270.database.dbModify; import cis3270.flight.Flight; import cis3270.flight.Plane; public abstract class User implements dbModify { /** These fields are the attributes in the User table of the database. These will also be the * fields a person has to fill out when they register as a user. */ private PreparedStatement preparedStatement; private String firstName; private String lastName; private String address; private String state; private int zip; private String email; private int ssn; private String securityQuestion; private String securityAnswer; private String username; private String password; private int admin = 0; public User() { } public User(String firstName, String lastName, String address, String state, int zip, String email, int ssn, String securityQuestion, String securityAnswer, String username, String password, int admin) { setFirstName(firstName); setLastName(lastName); setAddress(address); setState(state); setZip(zip); setEmail(email); setSSN(ssn); setSecurityQuestion(securityQuestion); setSecurityAnswer(securityAnswer); setUsername(username); setPassword(password); setAdmin(admin); } public User(String username) { setUsername(username); } public void setFirstName(String firstName) { this.firstName = firstName; } public String getFirstName() { return firstName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getLastName() { return lastName; } public void setAddress(String address) { this.address = address; } public String getAddress() { return address; } public void setState(String state) { this.state = state; } public String getState() { return state; } public void setZip(int zip) { this.zip = zip; } public int getZip() { return zip; } public void setEmail(String email) { this.email = email; } public String getEmail() { return email; } public void setSSN(int ssn) { this.ssn = ssn; } public int getSSN() { return ssn; } public void setSecurityQuestion(String securityQuestion) { this.securityQuestion = securityQuestion; } public String getSecurityQuestion() { return securityQuestion; } public void setSecurityAnswer(String securityAnswer) { this.securityAnswer = securityAnswer; } public String getSecurityAnswer() { return securityAnswer; } public void setUsername(String username) { this.username = username; } public String getUsername() { return username; } public void setPassword(String password) { this.password = password; } public String getPassword() { return password; } public void setAdmin(int admin) { this.admin = admin; } public int getAdmin() { return admin; } public void getInformation() throws SQLException, ClassNotFoundException{ Connection connection = initializeDB(); try{ Statement statement = connection.createStatement(); String queryString = "select firstName, lastName, address, zip, " + "state, email, ssn, securityQuestion, securityAnswer, username, password, admin" + " from User" + " where username = '" + getUsername() + "'"; ResultSet rs = statement.executeQuery(queryString); if (!rs.next()) { //JOptionPane.showMessageDialog(null, "Invalid Login", "Error", JOptionPane.INFORMATION_MESSAGE); } else { setFirstName(rs.getString(1)); setLastName(rs.getString(2)); setAddress(rs.getString(3)); setZip(rs.getInt(4)); setState(rs.getString(5)); setEmail(rs.getString(6)); setSSN(rs.getInt(7)); setSecurityQuestion(rs.getString(8)); setSecurityAnswer(rs.getString(9)); setPassword(rs.getString(11)); setAdmin(rs.getInt(12)); } } catch(Exception ex){ ex.printStackTrace(); } finally { connection.close(); } } public Connection initializeDB() throws SQLException, ClassNotFoundException{ try { Class.forName("com.mysql.jdbc.Driver"); System.out.println("Driver loaded"); Connection connection = DriverManager.getConnection("jdbc:mysql://localhost/mydb", "CIS3270", "Cis3270"); System.out.println("Connection complete"); return connection; } catch(SQLException ex){ ex.printStackTrace(); } catch(Exception ex) { ex.printStackTrace(); } return null; } public void add() throws ClassNotFoundException, SQLException { Connection connection = initializeDB(); try{ String queryString = "insert into User(firstName, lastName, address, zip, " + "state, email, ssn, securityQuestion, securityAnswer, username, password, admin)" + "values(?,?,?,?,?,?,?,?,?,?,?,?)"; preparedStatement = connection.prepareStatement(queryString); preparedStatement.setString(1, getFirstName()); preparedStatement.setString(2, getLastName()); preparedStatement.setString(3, getAddress()); preparedStatement.setInt(4, getZip()); preparedStatement.setString(5, getState()); preparedStatement.setString(6, getEmail()); preparedStatement.setInt(7, getSSN()); preparedStatement.setString(8, getSecurityQuestion()); preparedStatement.setString(9, getSecurityAnswer()); preparedStatement.setString(10, getUsername()); preparedStatement.setString(11, getPassword()); preparedStatement.setInt(12, getAdmin()); preparedStatement.executeUpdate(); } catch(SQLException ex){ ex.printStackTrace(); } catch(Exception ex) { ex.printStackTrace(); } finally { connection.close(); } } public String getFlight() throws ClassNotFoundException, SQLException { String labelText = "<html>"; Connection connection = initializeDB(); try{ Statement statement = connection.createStatement(); String queryString = "select b.planeNum, b.airlineName, a.flightFrom, a.flightTo, a.flightDeparture, a.flightArrival, b.capacity " + "from flight a left join plane b " + " on a.idPlane = b.idPlane " + " right join reserve c " + " on a.idFlight = c.idFlight " + " where c.username = '" + getUsername() +"'"; ResultSet rs = statement.executeQuery(queryString); while(rs.next()) { labelText = labelText + rs.getString(1) + " " + rs.getString(3) + " " + rs.getString(4) + " " + rs.getString(5) + " " + rs.getString(6) + " " + rs.getString(7) + "<br>"; } } catch (SQLException ex) { ex.printStackTrace(); } catch(Exception ex){ ex.printStackTrace(); } finally { connection.close(); } labelText = labelText + "</HTML>"; return labelText; } public void bookFlight(int idFlight) throws SQLException, ClassNotFoundException { Flight book = new Flight(idFlight); book.getInformation(); int capacity = Plane.getCapacity(book.getIdPlane()); Connection connection = initializeDB(); int bookedFlights = 0; try{ Statement statement = connection.createStatement(); String queryString = "select count(*) " + " from reserve " + " where idFlight = '" + book.getIdFlight() +"'"; ResultSet rs = statement.executeQuery(queryString); if(rs.next()) { bookedFlights = rs.getInt(1); } } catch (SQLException ex) { ex.printStackTrace(); } catch(Exception ex){ ex.printStackTrace(); } finally { connection.close(); } /** This check overcapacity */ if (bookedFlights > capacity) { JOptionPane.showMessageDialog(null, "Over capacity"); } /** This checks time constraints */ else { connection = initializeDB(); Flight f1; boolean conflict = false; ResultSet rs = null; try{ Statement statement = connection.createStatement(); String queryString = "select idFlight " + "from reserve " + " where username = '" + getUsername() +"'"; rs = statement.executeQuery(queryString); } catch (SQLException ex) { ex.printStackTrace(); } catch(Exception ex){ ex.printStackTrace(); } while(rs.next() && conflict == false) { f1 = new Flight(rs.getInt(1)); f1.getInformation(); if((f1.getFlightDeparture().after(book.getFlightDeparture()) && f1.getFlightDeparture().before(book.getFlightArrival())) || (f1.getFlightArrival().after(book.getFlightDeparture()) && f1.getFlightArrival().before(book.getFlightArrival()))) { JOptionPane.showMessageDialog(null, "Time constraint"); conflict = true; } } if(conflict == false) { connection = initializeDB(); try{ String queryString = "insert into reserve(idFlight, username) " + "values(?,?)"; preparedStatement = connection.prepareStatement(queryString); preparedStatement.setInt(1, book.getIdFlight()); preparedStatement.setString(2, getUsername()); preparedStatement.executeUpdate(); JOptionPane.showMessageDialog(null, "Booked!"); } catch(SQLException ex){ ex.printStackTrace(); } catch(Exception ex) { ex.printStackTrace(); } finally { connection.close(); } } } } public void delete() throws ClassNotFoundException, SQLException{ initializeDB(); } public void update() throws ClassNotFoundException, SQLException{ initializeDB(); } }
5fcde19960eba0f4ad7ff546e483b2a7e4a232ac
36459e0e6231de9589c0d1267de9d420f8086c2f
/src/com/kh/challenge/controller/ChallengeInsertFormServlet.java
e6ab3d5ed6337982910484f61481c3a064b72312
[]
no_license
meengi07/DOLIKE
2a7440793d3b64be438669c284599bfe64290196
630da4abb98c1f79958b814be7985c4db75ba067
refs/heads/master
2023-08-11T17:42:42.710801
2021-10-12T15:26:14
2021-10-12T15:26:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,784
java
package com.kh.challenge.controller; import java.io.IOException; import java.util.ArrayList; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.kh.category.model.vo.Category; import com.kh.challenge.model.service.ChallengeService; import com.kh.challenge.model.vo.ChallengeVote; import com.kh.follow.model.service.FollowService; /** * Servlet implementation class ChallengeInsertFormServlet */ @WebServlet("/challengeInsertForm.ch") public class ChallengeInsertFormServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public ChallengeInsertFormServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ArrayList<ChallengeVote> list = new ChallengeService().selectChallengeVoteList(); request.setAttribute("list", list); ArrayList<Category> catList = new ArrayList<Category>(); catList = new FollowService().getCatList(); request.setAttribute("catList", catList); request.getRequestDispatcher("views/challenge/insertChallenge.jsp").forward(request, response); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }
37eba59aad9c3bab43554dc9974aa52ff0a79d67
7bc4096ca209857d693639183e802e3ae38a1cc7
/app/src/main/java/com/b2infosoft/addley/recycler/LoadingListItemSpanLookup.java
c25f97734ada86b54d55847c061a0169684d0d61
[]
no_license
b2infosoftandroid/Addley
0013cb6895787157ad38d133d93da8462de6505d
5087936224a4410da8af367c0fdee419fd353b00
refs/heads/master
2021-01-12T12:57:46.191783
2016-10-06T07:29:54
2016-10-06T07:29:54
70,127,305
0
0
null
null
null
null
UTF-8
Java
false
false
245
java
package com.b2infosoft.addley.recycler; /** SpanSizeLookup that will be used to determine the span of loading list item. */ public interface LoadingListItemSpanLookup { /** @return the span of loading list item. */ int getSpanSize(); }
678aac858eac22181421698fe800f26c67cf664b
baffff1bc6454352780e1262aac507f668853bfb
/src/main/java/com/boubei/tss/portal/engine/macrocode/LayoutMacrocodeContainer.java
4d955321a9363f3c3d99d769d3eb12a2c63fe016
[ "MIT" ]
permissive
bierguogai/boubei-tss
926c76c9aabef22db3d659488c6adb2d0710b219
9af9b9437f70d86f27026beb1a88215ecef4a893
refs/heads/master
2021-04-09T10:38:15.249177
2018-03-16T06:05:53
2018-03-16T06:06:12
125,503,070
2
0
null
2018-03-16T10:45:16
2018-03-16T10:45:15
null
UTF-8
Java
false
false
2,167
java
/* ================================================================== * Created [2009-09-27] by Jon.King * ================================================================== * TSS * ================================================================== * mailTo:[email protected] * Copyright (c) boubei.com, 2015-2018 * ================================================================== */ package com.boubei.tss.portal.engine.macrocode; import java.util.Map; import com.boubei.tss.portal.engine.HTMLGenerator; import com.boubei.tss.portal.engine.model.LayoutNode; /** * <p> 布局器宏代码运行容器 </p> * <p> * 负责解析和运行包含宏代码、变量代码的字符串(HTML、JS、CSS等) * </p> */ public class LayoutMacrocodeContainer extends AbstractMacrocodeContainer{ /** * js中访问布局器对象,最终转化为document.getElementById("Lxxx")(假设此Layout所在门户结构的ID="xxx") */ static final String JS_LAYOUT_MACROCODE = "${js.layout}"; /** * 容器初始化函数 * * @param code * String 包含宏代码、变量代码的字符串 * @param node * LayoutNode 代码所在布局器节点对象,包含所有宏代码、变量代码的真实含义等信息 * @param children * Map 宏代码${porti}(i=0,1,2,3...)所对应的HTMLGenerator.Element对象( 用于解析${porti} ) */ public LayoutMacrocodeContainer(String code, LayoutNode node, Map<String, HTMLGenerator.Element> children) { this(code, node); macrocodes.put(JS_LAYOUT_MACROCODE, getElementInJS()); // 所有子节点(版面中的版面或Portlet实例) if (children != null) { macrocodes.putAll(children); } } public LayoutMacrocodeContainer(String code, LayoutNode node) { super(code, node); } protected String getElementId() { return "L" + node.getParent().getId(); } protected String getElementPortotypeId() { return "LP" + node.getId(); } }