blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
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
listlengths
1
1
author
stringlengths
0
161
fac1690fdde60394a62135037259fd0633f8aeec
1d619f3297705d1e3c09fae1834ab23c00a56695
/bankaccount/src/main/java/coop/home/bankaccount/service/TransactionService.java
010c48a8e2177b5f99945f5732599cfb1edc509a
[]
no_license
czar8a/bankaccount
34eb8144b2935cbd844faa8b7adb6095762677db
ca4257f5af80dd5f29217f709106eed81893b6ed
refs/heads/master
2023-05-29T00:52:22.072474
2021-06-17T02:47:23
2021-06-17T02:47:23
375,838,458
0
1
null
2021-06-17T02:47:24
2021-06-10T21:50:45
Java
UTF-8
Java
false
false
1,233
java
package coop.home.bankaccount.service; import java.math.BigInteger; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.MessageSource; import org.springframework.context.annotation.PropertySource; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import coop.home.bankaccount.dto.TokenBankAccountDTO; import coop.home.bankaccount.dto.accounts.AccountIDDTO; import coop.home.bankaccount.dto.transaction.TransactionDTO; import coop.home.bankaccount.excepcion.BusinessException; import coop.home.bankaccount.excepcion.UnAuthorizedException; import coop.home.bankaccount.repository.IAccountsRepository; import coop.home.bankaccount.repository.ITransactionsRepository; import coop.home.bankaccount.repository.entity.Accounts; import coop.home.bankaccount.repository.entity.Transactions; import lombok.extern.slf4j.Slf4j; public interface TransactionService { public List<TransactionDTO> getAccountTransactions(BigInteger usersidfinancialcompany, String idaccount, TokenBankAccountDTO tokenBankAccount) ; }
[ "curibe@internal-admins-internal-traffic-l-6ad629-1124484131.us-east-1.elb.amazonaws.com" ]
curibe@internal-admins-internal-traffic-l-6ad629-1124484131.us-east-1.elb.amazonaws.com
e49f34aecf1d5c835cb00e1ab6e18cbbb8c41c7f
eed513c29857cd4c94be75ae0aedfa4df4ecbaee
/TrabalhoFinal/src/apresentacao/PanelConsulta.java
65e75e00ce00132a2a74aef351832b2ddaefeff8
[]
no_license
ERTHang/POO
0d58cd78175a1dbb979c01829570735dcd88248f
7c2b9fd94f5d615598ac6b9cff837ceffca413be
refs/heads/master
2020-08-04T02:22:42.292044
2019-11-25T02:31:04
2019-11-25T02:31:04
199,949,086
0
0
null
null
null
null
UTF-8
Java
false
false
12,700
java
package apresentacao; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.DefaultListModel; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTabbedPane; import javax.swing.JTextField; import dados.Contracheque; import dados.Contribuinte; import dados.NotaFiscal; import dados.PessoaJuridica; import negocio.DeclaracaoRenda; public class PanelConsulta extends JPanel { /** * */ private static final long serialVersionUID = -6312128787590845983L; DeclaracaoRenda declaracaoRenda = new DeclaracaoRenda(); public PanelConsulta() { super(new GridLayout(1, 1)); JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.setTabPlacement(JTabbedPane.TOP); tabbedPane.addTab("Contribuinte", panelContribuinte()); tabbedPane.addTab("Receitas", panelReceitas()); tabbedPane.addTab("Despesas", panelDespesas()); tabbedPane.addTab("Pessoa Jurídica", panelPessoaJuridica()); add(tabbedPane); } public JComponent panelContribuinte() { JPanel panel = new JPanel(new GridLayout(5, 1)); // nome JPanel nomePanel = new JPanel(new FlowLayout()); JLabel nome = new JLabel(); nome.setPreferredSize(new Dimension(400, 20)); JLabel nomeLabel = new JLabel(); nomeLabel.setText("Nome: "); nomeLabel.setLabelFor(nome); nomePanel.add(nomeLabel); nomePanel.add(nome); // idade JPanel idadePanel = new JPanel(new FlowLayout()); JLabel idade = new JLabel(); idade.setPreferredSize(new Dimension(400, 20)); JLabel idadeLabel = new JLabel(); idadeLabel.setText("Idade: "); idadeLabel.setLabelFor(idade); idadePanel.add(idadeLabel); idadePanel.add(idade); // endereco JPanel enderecoPanel = new JPanel(new FlowLayout()); JLabel endereco = new JLabel(); endereco.setPreferredSize(new Dimension(400, 20)); JLabel enderecoLabel = new JLabel(); enderecoLabel.setText("Endereco: "); enderecoLabel.setLabelFor(endereco); enderecoPanel.add(enderecoLabel); enderecoPanel.add(endereco); // conta JPanel contaPanel = new JPanel(new FlowLayout()); JLabel conta = new JLabel(); conta.setPreferredSize(new Dimension(400, 20)); JLabel contaLabel = new JLabel(); contaLabel.setText("Conta Bancaria: "); contaLabel.setLabelFor(conta); contaPanel.add(contaLabel); contaPanel.add(conta); // cpf JPanel cpfPanel = new JPanel(new FlowLayout()); JTextField cpf = new JTextField(); cpf.setPreferredSize(new Dimension(400, 20)); JLabel cpfLabel = new JLabel(); cpfLabel.setText("CPF: "); cpfLabel.setLabelFor(cpf); JButton consulta = new JButton("consultar"); consulta.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Contribuinte contribuinte; try { contribuinte = declaracaoRenda.getContribuinteCpf(cpf.getText()); nome.setText(contribuinte.getNome()); idade.setText(Integer.toString(contribuinte.getIdade())); endereco.setText(contribuinte.getEndereco()); conta.setText(Integer.toString(contribuinte.getContaBancaria())); } catch (Exception e2) { JOptionPane.showMessageDialog(panel, "Cpf não encontrado", "Warning", JOptionPane.WARNING_MESSAGE); return; } } }); cpfPanel.add(cpfLabel); cpfPanel.add(cpf); cpfPanel.add(consulta); panel.add(cpfPanel); panel.add(nomePanel); panel.add(idadePanel); panel.add(enderecoPanel); panel.add(contaPanel); return panel; } private JComponent panelReceitas() { JPanel panel = new JPanel(new GridBagLayout()); JLabel valor = new JLabel(); GridBagConstraints c = new GridBagConstraints(); //list DefaultListModel<String> listModel = new DefaultListModel<String>(); JList<String> lista = new JList<String>(listModel); // cpf JPanel cpfPanel = new JPanel(new FlowLayout()); cpfPanel.setPreferredSize(new Dimension(500, 40)); JTextField cpf = new JTextField(); cpf.setPreferredSize(new Dimension(400, 20)); JLabel cpfLabel = new JLabel(); cpfLabel.setText("CPF: "); cpfLabel.setLabelFor(cpf); cpfPanel.add(cpfLabel); cpfPanel.add(cpf); JButton consulta = new JButton("Verificar"); consulta.setPreferredSize(new Dimension(100, 30)); consulta.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { if (declaracaoRenda.getContracheques().size() == 0) { JOptionPane.showMessageDialog(panel, "Nenhuma receita registrada", "Warning", JOptionPane.WARNING_MESSAGE); } listModel.clear(); double sum = 0; for (Contracheque cheque : declaracaoRenda.getContracheques()) { if (cheque.getIdContribuinte() == declaracaoRenda.getContribuinteCpf(cpf.getText()).getId()) { listModel.addElement(cheque.getNumProtocolo() + ": R$" + cheque.getValor()); sum += cheque.getValor(); } valor.setText("R$" + sum); } } catch (Exception e2) { JOptionPane.showMessageDialog(panel, "Cpf não encontrado", "Warning", JOptionPane.WARNING_MESSAGE); return; } } }); JPanel valorPanel = new JPanel(new FlowLayout()); valor.setPreferredSize(new Dimension(150, 20)); JLabel valorText = new JLabel(); valorText.setText("Valor Final: "); valorPanel.add(valorText); valorPanel.add(valor); c.gridx = 1; c.gridy = 0; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0.5; panel.add(cpfPanel, c); c.gridx = 2; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0.5; panel.add(consulta, c); c.gridx = 1; c.gridy = 2; panel.add(valorPanel, c); c.gridx = 0; c.gridwidth = 2; c.gridy = 1; c.ipady = 300; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0.5; panel.add(lista, c); return panel; } private JComponent panelDespesas() { JPanel panel = new JPanel(new GridBagLayout()); JLabel valor = new JLabel(); GridBagConstraints c = new GridBagConstraints(); //list DefaultListModel<String> listModel = new DefaultListModel<String>(); JList<String> lista = new JList<String>(listModel); // cpf JPanel cpfPanel = new JPanel(new FlowLayout()); cpfPanel.setPreferredSize(new Dimension(500, 40)); JTextField cpf = new JTextField(); cpf.setPreferredSize(new Dimension(400, 20)); JLabel cpfLabel = new JLabel(); cpfLabel.setText("CPF: "); cpfLabel.setLabelFor(cpf); cpfPanel.add(cpfLabel); cpfPanel.add(cpf); JButton consulta = new JButton("Verificar"); consulta.setPreferredSize(new Dimension(100, 30)); consulta.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { if (declaracaoRenda.getNotas().size() == 0) { JOptionPane.showMessageDialog(panel, "Nenhuma despesa registrada", "Warning", JOptionPane.WARNING_MESSAGE); } listModel.clear(); double sum = 0; for (NotaFiscal nota : declaracaoRenda.getNotas()) { if (nota.getIdContribuinte() == declaracaoRenda.getContribuinteCpf(cpf.getText()).getId()) { listModel.addElement(nota.getNumProtocolo() + ": R$" + nota.getValor()); sum += nota.getValor(); } valor.setText("R$" + sum); } } catch (Exception e2) { JOptionPane.showMessageDialog(panel, "Cpf não encontrado", "Warning", JOptionPane.WARNING_MESSAGE); return; } } }); JPanel valorPanel = new JPanel(new FlowLayout()); valor.setPreferredSize(new Dimension(150, 20)); JLabel valorText = new JLabel(); valorText.setText("Valor Final: "); valorPanel.add(valorText); valorPanel.add(valor); c.gridx = 1; c.gridy = 0; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0.5; panel.add(cpfPanel, c); c.gridx = 2; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0.5; panel.add(consulta, c); c.gridx = 1; c.gridy = 2; panel.add(valorPanel, c); c.gridx = 0; c.gridwidth = 2; c.gridy = 1; c.ipady = 300; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0.5; panel.add(lista, c); return panel; } private JComponent panelPessoaJuridica() { JPanel panel = new JPanel(new GridLayout(4, 1)); // nome JPanel nomePanel = new JPanel(new FlowLayout()); JLabel nome = new JLabel(); nome.setPreferredSize(new Dimension(400, 20)); JLabel nomeLabel = new JLabel(); nomeLabel.setText("Nome: "); nomeLabel.setLabelFor(nome); nomePanel.add(nomeLabel); nomePanel.add(nome); // endereco JPanel enderecoPanel = new JPanel(new FlowLayout()); JLabel endereco = new JLabel(); endereco.setPreferredSize(new Dimension(400, 20)); JLabel enderecoLabel = new JLabel(); enderecoLabel.setText("Endereco: "); enderecoLabel.setLabelFor(endereco); enderecoPanel.add(enderecoLabel); enderecoPanel.add(endereco); // numFuncionarios JPanel numFuncionariosPanel = new JPanel(new FlowLayout()); JLabel numFuncionarios = new JLabel(); numFuncionarios.setPreferredSize(new Dimension(400, 20)); JLabel numFuncionariosLabel = new JLabel(); numFuncionariosLabel.setText("Numero de funcionarios: "); numFuncionariosLabel.setLabelFor(numFuncionarios); numFuncionariosPanel.add(numFuncionariosLabel); numFuncionariosPanel.add(numFuncionarios); // cnpj JPanel cnpjPanel = new JPanel(new FlowLayout()); JTextField cnpj = new JTextField(); cnpj.setPreferredSize(new Dimension(400, 20)); JLabel cnpjLabel = new JLabel(); cnpjLabel.setText("CNPJ: "); cnpjLabel.setLabelFor(cnpj); JButton consulta = new JButton("consultar"); consulta.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { PessoaJuridica pessoa; try { pessoa = declaracaoRenda.getPessoaCnpj(cnpj.getText()); nome.setText(pessoa.getNomePJ()); endereco.setText(pessoa.getEndereco()); numFuncionarios.setText(Integer.toString(pessoa.getNumFuncionarios())); }catch (NumberFormatException e3){ JOptionPane.showMessageDialog(panel, "Valor invalido", "Error", JOptionPane.ERROR_MESSAGE); return; } catch (Exception e2) { JOptionPane.showMessageDialog(panel, "Cnpj invalido", "Error", JOptionPane.ERROR_MESSAGE); return; } } }); cnpjPanel.add(cnpjLabel); cnpjPanel.add(cnpj); cnpjPanel.add(consulta); panel.add(cnpjPanel); panel.add(nomePanel); panel.add(enderecoPanel); panel.add(numFuncionariosPanel); return panel; } }
[ "endrewrthang@gmail.com" ]
endrewrthang@gmail.com
7890a42e5bde34b2212dfd7ee72e40334710a72c
f9da3b87363a74e74bab09bde48fd3fe5b5aa5b4
/src/test/java/com/nettyrpc/test/server/RpcBootstrap.java
4df3ab0ab6e5e7a4cd34b1f57a3bf989d683496b
[]
no_license
iceqiw/RpcDemo
c4104a2f047933824716729b88f09138190d8533
68eef29033b36d21a15b33b5de94f8edb67bf45a
refs/heads/master
2021-05-15T23:10:13.016392
2017-10-13T06:22:02
2017-10-13T06:22:02
106,785,252
0
0
null
null
null
null
UTF-8
Java
false
false
507
java
package com.nettyrpc.test.server; import com.google.inject.Guice; import com.google.inject.Injector; import com.nettyrpc.server.RpcServer; public class RpcBootstrap { public static void main(String[] args) { Injector injector = Guice.createInjector(new TestModule()); RpcServer rpcServer = injector.getInstance(RpcServer.class); try { rpcServer.start("com.nettyrpc.test.server"); } catch (Exception e) { e.printStackTrace(); } } }
[ "qqwei1123@163.com" ]
qqwei1123@163.com
6c783dbaeda1d5729eaa7ba30b650a7f83ccb8bf
13414f5b7d66b208f3fb09a3cc04f91ee72b8f3c
/steamclient/src/main/java/br/com/arbo/steamside/steam/client/localfiles/steamlocation/MacOSX.java
3f2cf7a53bf4ded029c7ed47e07be6512c11085f
[ "MIT" ]
permissive
arboliveira/steamside
b06f561778b3898008b5e4163e9590d548609994
b6cf4aa09196ec0632529e065f6303dda8fc4e86
refs/heads/master
2021-05-04T10:52:36.360394
2017-08-03T05:00:57
2017-08-12T05:31:45
36,276,847
3
0
null
null
null
null
UTF-8
Java
false
false
515
java
package br.com.arbo.steamside.steam.client.localfiles.steamlocation; import java.io.File; import javax.inject.Inject; import br.com.arbo.opersys.userhome.UserHome; public class MacOSX implements SteamLocation { @Inject public MacOSX(final UserHome userhome2) { userhome = userhome2; } @Override public File steam() { return new File(parent(), "Steam"); } private File parent() { return new File(userhome.getUserHome(), "Library/Application Support"); } private final UserHome userhome; }
[ "andre@arbo.com.br" ]
andre@arbo.com.br
8cf21bb05589ec0e26a7304daacf9ab127d9971a
e752059329f31b15a47d97a67f3a89071aad6e1c
/src/graphcreation/collisionbased/collisiondetector/Collision.java
5836ed6a67594aa6c3a1ec8b4503c9c661de83e1
[ "Apache-2.0" ]
permissive
unaguil/hyperion
5a26a5587649e94da2d2705abba3a6d1d05dd219
fe7ae4ea20e7e8066b3740ec32cc92ffbddc0823
refs/heads/master
2021-01-10T20:21:31.485660
2013-05-08T09:46:48
2013-05-08T09:46:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,561
java
/* * Copyright (c) 2012 Unai Aguilera * * 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. * * * Author: Unai Aguilera <unai.aguilera@deusto.es> */ package graphcreation.collisionbased.collisiondetector; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import peer.message.UnsupportedTypeException; import serialization.binary.BSerializable; import serialization.binary.SerializationUtils; import taxonomy.parameter.InputParameter; import taxonomy.parameter.OutputParameter; import taxonomy.parameter.Parameter; public class Collision implements BSerializable { private final InputParameter input; private final OutputParameter output; public Collision() { input = null; output = null; } public Collision(final InputParameter input, final OutputParameter output) { this.input = input; this.output = output; } public InputParameter getInput() { return input; } public OutputParameter getOutput() { return output; } @Override public boolean equals(final Object o) { if (!(o instanceof Collision)) return false; final Collision collision = (Collision) o; return this.input.equals(collision.input) && this.output.equals(collision.output); } @Override public int hashCode() { int result = 17; result = 37 * result + this.input.hashCode(); result = 37 * result + this.output.hashCode(); return result; } @Override public String toString() { return "[" + output + "->" + input + "]"; } @Override public void read(ObjectInputStream in) throws IOException { try { final Parameter pInput = Parameter.readParameter(in); SerializationUtils.setFinalField(Collision.class, this, "input", pInput); final Parameter pOutput = Parameter.readParameter(in); SerializationUtils.setFinalField(Collision.class, this, "output", pOutput); } catch (UnsupportedTypeException e) { throw new IOException(e); } } @Override public void write(ObjectOutputStream out) throws IOException { input.write(out); output.write(out); } }
[ "gkalgan@gmail.com" ]
gkalgan@gmail.com
dd2c6c67a394d183bdaad97f1765852779d57295
3cf89a979f4d193d0764d9ded874bd397f0ded6d
/Etang/src/main/java/com/grigri/fishery/domain/Gardon.java
039a70f9e6af5e9db28006183c6bfd3b28679889
[]
no_license
cyril090/Project1
a102341c69a96142a233cf730d19eb3d420451a9
7a809783ac65b867bc6548724095ac5c3515e426
refs/heads/master
2021-01-20T06:25:21.510882
2013-12-20T17:48:34
2013-12-20T17:48:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
202
java
package com.grigri.fishery.domain; public class Gardon extends Fish { public Gardon(Long id, int age, int lengthInCms, int weightInKilo) { super(id, age, lengthInCms, weightInKilo); } }
[ "cyril.aubertin@gmail.com" ]
cyril.aubertin@gmail.com
bb4890680c8638881d00b51cbe7366b9dd01e420
78d2a2fd546c1a4fc51bd58c83cd06308f785477
/app/src/main/java/ng/com/hybridintegrated/a365dailyreadingsfornigeria/prayerThirtyFour.java
e3ec1950a1d77db6b87d3705b9e80f5365736473
[]
no_license
Omamuli-Emmanuel/365job
66b6195f92730b5ff4b8a3829c46423023065ac1
5d03d9dcd68f183b3dedf4a5d03815e4c2f2bd24
refs/heads/master
2020-06-01T10:14:12.054679
2019-06-07T13:11:20
2019-06-07T13:11:20
190,744,545
0
0
null
null
null
null
UTF-8
Java
false
false
1,264
java
package ng.com.hybridintegrated.a365dailyreadingsfornigeria; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.AdView; public class prayerThirtyFour extends AppCompatActivity { private AdView mAdview; private Toolbar mtoolbar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_prayer_thirty_four); mAdview=findViewById(R.id.addprayerthirtyfour); AdRequest adRequest=new AdRequest.Builder().build(); mAdview.loadAd(adRequest); mtoolbar=findViewById(R.id.toolbarprayerthirtyfour); setSupportActionBar(mtoolbar); mtoolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity(new Intent(getApplicationContext(),churchPrayers.class)); finish(); } }); } }
[ "omamuli.emmanuel@gmail.com" ]
omamuli.emmanuel@gmail.com
dea1cb755266df1a467ad9d42d582f44ce91a9fa
23dcd9aa337c1e4a3680d18ab83d3b35228c9590
/src/main/java/view/game/MouseClickListener.java
a04e17494e717719aef8e92eabaeec4442741a57
[ "MIT" ]
permissive
Quinn-Quantum/VL_AlienDefence
6d171a4bd99a19bc0797beeca79cd3c08002554b
ac0894f509dc5c420a52fb25cad35ee561ab64a3
refs/heads/main
2023-06-30T10:18:28.760501
2021-08-06T12:40:49
2021-08-06T12:40:49
362,094,940
0
0
MIT
2021-04-27T11:55:50
2021-04-27T11:55:49
null
UTF-8
Java
false
false
373
java
package view.game; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import controller.GameController; public class MouseClickListener extends MouseAdapter { private GameController gc; public MouseClickListener(GameController gc) { this.gc = gc; } @Override public void mousePressed(MouseEvent e) { gc.fireShot(e.getX(), e.getY()); } }
[ "trutz@oszimt.de" ]
trutz@oszimt.de
20998853ff1dd3508e42a844a8dc388ff37b3949
3530616ea927339d0f7503ecb798ba670ce22439
/src/main/java/com/dictionary/translation/ProjectionOnTranslations.java
a6954faf9a87c6122e61d42a7282c1cbfc726df4
[]
no_license
makss3217/dictionary
fc491b3092fd5f9ac4771aaccc7aec7b1d07c3c0
8d35f4019c36c14349e77099299b1829e6492a80
refs/heads/main
2023-06-27T09:09:04.415168
2021-08-03T08:21:40
2021-08-03T08:21:40
390,342,192
0
0
null
2021-08-03T08:21:41
2021-07-28T12:22:54
Java
UTF-8
Java
false
false
139
java
package com.dictionary.translation; import lombok.Value; @Value public class ProjectionOnTranslations { private String translation; }
[ "maksymilian.bienkowski.ext@nokia.com" ]
maksymilian.bienkowski.ext@nokia.com
90af4f35fc05424d0e7b95c0752d5ed3663bdef8
e2bfb88d702a353fc1f949f8e5c49ba74ca275eb
/spring-faces-mvc-samples/sfm-booking-faces/src/main/java/org/springframework/webflow/samples/booking/MainController.java
b57495f37e4ac838b9c0c7bd7b0702e0065cb58e
[]
no_license
philwebb/springfaces-v1
36b09628423b94d4af7e7914bae2dba7eb9b2b46
420302474390846d697c1f4a7c3f8b0d80bdf082
refs/heads/master
2021-01-17T05:28:14.884384
2010-02-05T15:13:47
2010-02-05T15:13:47
1,768,475
0
1
null
null
null
null
UTF-8
Java
false
false
1,935
java
package org.springframework.webflow.samples.booking; import java.security.Principal; import java.util.List; import javax.faces.context.ExternalContext; import javax.faces.context.FacesContext; import javax.faces.model.DataModel; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.faces.mvc.converter.QuickConverter; import org.springframework.faces.mvc.execution.RequestContextHolder; import org.springframework.faces.mvc.navigation.annotation.NavigationCase; import org.springframework.faces.mvc.navigation.annotation.NavigationRules; import org.springframework.faces.mvc.stereotype.FacesController; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; @FacesController @NavigationRules( { @NavigationCase(on = "search", to = "/search?#{searchCriteria}") }) @RequestMapping("/main") public class MainController { @Autowired private BookingService bookingService; @Autowired private QuickConverter converter; @RequestMapping public ModelAndView main(@ModelAttribute("searchCriteria") SearchCriteria searchCriteria) { searchCriteria.resetPage(); return new ModelAndView("enterSearchCriteria").addObject("bookings", getBookings()); } @NavigationCase(fragments = "bookingsFragment") public void cancelBooking(@ModelAttribute("bookings.selectedRow") Booking booking) { bookingService.cancelBooking(booking); RequestContextHolder.getRequestContext().getViewScope().put("bookings", getBookings()); } private DataModel getBookings() { ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); Principal user = externalContext.getUserPrincipal(); List<Booking> bookings = bookingService.findBookings(user == null ? "" : user.getName()); return converter.toDataModel(bookings); } }
[ "philw@96f92a50-1e92-45f8-a6b0-eb54d5336e60" ]
philw@96f92a50-1e92-45f8-a6b0-eb54d5336e60
60b84b6782ba8a018dbad85b968e28f7e4409679
079148514afec98ada225a9e5b126c34dd4aed53
/java/src/main/java/com/techelevator/controller/PlayerHistoryController.java
2e8822db36d2431fe1ca06b8410d2efc5762d831
[]
no_license
kaileywaal/virtual-stock-market
578e487370183f8265419fdb09673cddec6473ac
77d76f806ccb958cf17cb6fc32ebaac1668b127c
refs/heads/main
2023-08-17T14:42:52.569885
2021-10-06T18:14:35
2021-10-06T18:14:35
414,286,110
1
0
null
null
null
null
UTF-8
Java
false
false
598
java
package com.techelevator.controller; import com.techelevator.dao.PlayerHistoryDao; import com.techelevator.model.PlayerHistory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController @CrossOrigin public class PlayerHistoryController { @Autowired PlayerHistoryDao playerHistoryDao; @RequestMapping(path = "/players/{id}/history", method = RequestMethod.GET) List<PlayerHistory> getPlayerHistories(@PathVariable int id) { return playerHistoryDao.getHistoryById(id); } }
[ "william.himes@richmond.edu" ]
william.himes@richmond.edu
cc8eb353c3f55a2bfb374f451040c98e74162c2b
a314c7ae6c469caa1d1bd2fe6d3fcdbc82e45fcf
/简单的文件浏览/src/com/test/MainClass.java
63e7a9fb983368139e5b3865fd8575ffa05a1ca6
[]
no_license
egdw/javaFileWatch
e9df81fed730077e9c344b39093515f5d4caaf25
4ae7db03c7e3f87e39e40264370f3a0d0b103cbc
refs/heads/master
2021-01-23T07:43:58.497337
2017-03-28T08:43:45
2017-03-28T08:43:45
86,436,258
1
0
null
null
null
null
UTF-8
Java
false
false
1,685
java
package com.test; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; /** * 简单的文件浏览器 * * @author hdy * */ public class MainClass { private static Scanner scanner = new Scanner(System.in); private static boolean flag = true; public static void main(String[] args) throws IOException { start(); } @SuppressWarnings("resource") public static void start() throws IOException { while (flag) { System.out.println("请输入您要浏览的文件."); String nextLine = scanner.nextLine(); // 判断输入的是否有问题: if (nextLine != null && !nextLine.isEmpty()) { File file = new File(nextLine); // 判断是否为文件并且文件存在: if (file.exists() && file.isFile()) { // 重点******************************* // 获取一个文件输入流 FileInputStream fileInputStream = new FileInputStream(file); // 获取一个字符输入流 InputStreamReader inputStreamReader = new InputStreamReader( fileInputStream); // 获取一个输入缓冲流 BufferedReader reader = new BufferedReader( inputStreamReader); // 按行获取内容 while (true) { // 循环读取一行的内容.打印出来 String line = reader.readLine(); if (line == null) { break; } System.out.println(line); } // 重点******************************* } else { System.out.println("文件不存在或者不为文件夹!"); } } else { System.out.println("输入的有误,请重新输入!"); } } } }
[ "378759617@qq.com" ]
378759617@qq.com
6268cc7ee9a2555a0b55488260c4d7f89c1b9dcc
39fb19db2feff034507a169f179a0c14a454ca78
/samples/BusinessCard/app/build/generated/source/buildConfig/debug/com/vuforia/samples/VideoPlayback2/BuildConfig.java
315cbe226ebfbee60e3d025ee5a0ee8316d42efe
[]
no_license
yourworldmedia/ar-v1
293777aa98ea995e199cf6749536c230e4a0cb66
e206ddaa7bbbd168f263d975548f960359c1afc1
refs/heads/master
2020-04-15T06:16:16.065146
2019-01-16T15:38:28
2019-01-16T15:38:28
164,454,542
0
0
null
null
null
null
UTF-8
Java
false
false
477
java
/** * Automatically generated file. DO NOT MODIFY */ package com.vuforia.samples.VideoPlayback2; public final class BuildConfig { public static final boolean DEBUG = Boolean.parseBoolean("true"); public static final String APPLICATION_ID = "com.vuforia.samples.VideoPlayback2"; public static final String BUILD_TYPE = "debug"; public static final String FLAVOR = ""; public static final int VERSION_CODE = 600; public static final String VERSION_NAME = "6.0"; }
[ "pd@goodcode.ch" ]
pd@goodcode.ch
20c3b08754f96c68049293b8df852b0127049bcd
38f90c62fd588447802a68b62e9ae1a0ac4b4e3b
/src/main/java/com/terwergreen/jvue/util/ReflectUtil.java
d6b47b2bb9109c4f8823420c8502dc4fb7bf9f3f
[ "MIT" ]
permissive
terwer/jvue-cli
c19227faa2c6826c185fce610bfc43717b3cacbd
493b45c169280f32332abd754ccb0b944934d3be
refs/heads/master
2020-04-19T16:37:58.337208
2019-02-07T15:52:11
2019-02-07T15:52:11
168,310,409
1
0
null
2019-02-07T15:52:12
2019-01-30T08:53:44
Java
UTF-8
Java
false
false
8,735
java
package com.terwergreen.jvue.util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; /** * @Author Terwer * @Date 2018/11/30 10:32 * @Version 1.0 * @Description 反射工具类 **/ public class ReflectUtil { private static final Log logger = LogFactory.getLog(ReflectUtil.class); /** * 判断对象是否实现接口或者继承了某个类,只支持继承自一级的情况,即B extends A或者B implements A的情况 * * @param clazz1 * @param clazz2 * @return */ public static boolean instanceOf(Class<?> clazz1, Class<?> clazz2) { // 比较自己类型 if (clazz1.getTypeName().equals(clazz2.getTypeName())) { return true; } // 比较自己和父类的类型 return clazz1.getSuperclass().getTypeName().equals(clazz2.getTypeName()); } /** * 获取所有的父类 * * @param clazz * @return */ public static List<Class<?>> getSuperclass(Class<?> clazz) { List<Class<?>> superClassList = new ArrayList<>(); Class superClass = clazz.getSuperclass(); while (superClass != null) { superClassList.add(superClass); superClass = superClass.getSuperclass(); } return superClassList; } /** * 创建新对象 * * @param clazz * @return */ public static Object newInstance(Class<?> clazz) { try { return clazz.newInstance(); } catch (InstantiationException e) { logger.error(e.getMessage(), e); } catch (IllegalAccessException e) { logger.error(e.getMessage(), e); } return null; } /** * 反射读取构造方法创建新对象 * * @param clazz * @param initargs 构造函数参数 * @return */ public static Object newInstance(Class<?> clazz, Object... initargs) { Constructor<?> constructor = null; try { Class[] initargTypes = new Class[initargs.length]; for (int i = 0; i < initargs.length; i++) { Object initarg = initargs[i]; initargTypes[i] = initarg.getClass(); } constructor = clazz.getDeclaredConstructor(initargTypes); //设置允许访问,防止private修饰的构造方法 constructor.setAccessible(true); return constructor.newInstance(initargs); } catch (NoSuchMethodException e) { logger.error("Class " + clazz + "newInstance fail", e); } catch (IllegalAccessException e) { logger.error("Class " + clazz + "newInstance fail", e); } catch (InstantiationException e) { logger.error("Class " + clazz + "newInstance fail", e); } catch (InvocationTargetException e) { logger.error("Class " + clazz + "newInstance fail", e); } return null; } /** * 反射读取构造方法创建新对象,自定义所有参数类型 * * @param clazz * @param initargs 构造函数参数 * @return */ public static Object newInstance(Class<?> clazz, Class[] initargTypes, Object[] initargs) { Constructor<?> constructor = null; try { constructor = clazz.getDeclaredConstructor(initargTypes); //设置允许访问,防止private修饰的构造方法 constructor.setAccessible(true); return constructor.newInstance(initargs); } catch (NoSuchMethodException e) { logger.error("Class " + clazz + "newInstance fail", e); } catch (IllegalAccessException e) { logger.error("Class " + clazz + "newInstance fail", e); } catch (InstantiationException e) { logger.error("Class " + clazz + "newInstance fail", e); } catch (InvocationTargetException e) { logger.error("Class " + clazz + "newInstance fail", e); } return null; } /** * 反射读取属性 * * @param obj * @param fieldName * @return */ public static Object getField(Object obj, String fieldName) { Class<?> clazz = obj.getClass(); try { Field field = clazz.getDeclaredField(fieldName); field.setAccessible(true);//为true则表示反射的对象在使用时取消Java语言访问检查 return field.get(obj); } catch (NoSuchFieldException e) { logger.error("Class " + obj + " get field" + fieldName + " fail", e); } catch (IllegalAccessException e) { logger.error("Class " + obj + " get field" + fieldName + " fail", e); } return null; } /** * 反射设置属性 * * @param obj * @param fieldName * @param value */ public static void setField(Object obj, String fieldName, Object value) { Class<?> clazz = obj.getClass(); try { Field field = clazz.getDeclaredField(fieldName); field.setAccessible(true);//为true则表示反射的对象在使用时取消Java语言访问检查 field.set(obj, value); } catch (NoSuchFieldException e) { logger.error("Class " + obj + " set field" + fieldName + " fail", e); } catch (IllegalAccessException e) { logger.error("Class " + obj + " set field" + fieldName + " fail", e); } } /** * 反射调用无参方法 * * @param obj * @param methodName * @return */ public static Object invoke(Object obj, String methodName) { try { Class<?> clazz = obj.getClass(); Method method = clazz.getDeclaredMethod(methodName); method.setAccessible(true);//为true则表示反射的对象在使用时取消Java语言访问检查 return method.invoke(obj); } catch (NoSuchMethodException e) { logger.error("Class " + obj + " invoke function" + methodName + " fail", e); } catch (IllegalAccessException e) { logger.error("Class " + obj + " invoke function" + methodName + " fail", e); } catch (InvocationTargetException e) { logger.error("Class " + obj + " invoke function" + methodName + " fail", e); } return null; } /** * 反射调用有参方法 * * @param obj * @param methodName * @param args * @return */ public static Object invoke(Object obj, String methodName, Object... args) { try { Class<?> clazz = obj.getClass(); Class[] argTypes = new Class[args.length]; for (int i = 0; i < args.length; i++) { Object arg = args[i]; argTypes[i] = arg.getClass(); } Method method = clazz.getDeclaredMethod(methodName, argTypes); method.setAccessible(true);//为true则表示反射的对象在使用时取消Java语言访问检查 return method.invoke(obj, args); } catch (NoSuchMethodException e) { logger.error("Class " + obj + " invoke function" + methodName + " fail", e); } catch (IllegalAccessException e) { logger.error("Class " + obj + " invoke function" + methodName + " fail", e); } catch (InvocationTargetException e) { logger.error("Class " + obj + " invoke function" + methodName + " fail", e); } return null; } /** * 反射调用有参方法,自定义所有参数类型 * * @param obj * @param methodName * @param args * @return */ public static Object invoke(Object obj, String methodName, Class[] argTypes, Object[] args) { try { Class<?> clazz = obj.getClass(); Method method = clazz.getDeclaredMethod(methodName, argTypes); method.setAccessible(true);//为true则表示反射的对象在使用时取消Java语言访问检查 return method.invoke(obj, args); } catch (NoSuchMethodException e) { logger.error("Class " + obj + " invoke function" + methodName + " fail", e); } catch (IllegalAccessException e) { logger.error("Class " + obj + " invoke function" + methodName + " fail", e); } catch (InvocationTargetException e) { logger.error("Class " + obj + " invoke function" + methodName + " fail", e); } return null; } }
[ "csyouwei@gmail.com" ]
csyouwei@gmail.com
2bc2cd85fe3e2825279b80b5a8cae7459b53c733
704507754a9e7f300dfab163e97cd976b677661b
/src/com/sun/source/doctree/UnknownInlineTagTree.java
fab0170b17bd89d294d15316a7389852967229a9
[]
no_license
ossaw/jdk
60e7ca5e9f64541d07933af25c332e806e914d2a
b9d61d6ade341b4340afb535b499c09a8be0cfc8
refs/heads/master
2020-03-27T02:23:14.010857
2019-08-07T06:32:34
2019-08-07T06:32:34
145,785,700
0
0
null
null
null
null
UTF-8
Java
false
false
436
java
/* * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ package com.sun.source.doctree; import java.util.List; /** * A tree node for an unrecognized inline tag. * <p> * {&#064;name content} * * @since 1.8 */ @jdk.Exported public interface UnknownInlineTagTree extends InlineTagTree { List<? extends DocTree> getContent(); }
[ "jianghao7625@gmail.com" ]
jianghao7625@gmail.com
3b4f43d33ef822c412d5ffb21dedfeadac1d12a4
61c3c37034ad27f7ae9c847bfb100caab9065124
/airline/src/com/jin/quiz04/AirlineParser.java
0dbd19e0cf23415496c3bb528542c4b0555e552d
[]
no_license
jeonheechel/bigdatajava
7e8eb17b5d9404eb1f1e654fde2a72f5cf5081f4
6f0fd9c6c075f1074f1e7d23c3f1dc7d5f602dea
refs/heads/master
2022-12-23T14:22:02.240369
2019-08-19T06:13:23
2019-08-19T06:13:23
181,812,634
0
0
null
2022-12-16T00:57:36
2019-04-17T03:45:31
Java
UTF-8
Java
false
false
565
java
package com.jin.quiz04; import org.apache.hadoop.io.Text; public class AirlineParser { private int year; private int month; private int dayOfWeek; public AirlineParser() { } public AirlineParser(Text value) { String [] airData = value.toString().split(","); year = Integer.parseInt(airData[0]); month = Integer.parseInt(airData[1]); dayOfWeek = Integer.parseInt(airData[3]); } public int getDayOfWeek() { return dayOfWeek; } public int getYear() { return year; } public int getMonth() { return month; } }
[ "noreply@github.com" ]
noreply@github.com
55b7032b01daedd306628c486b5bfebc8d611e7c
66b0b2dbdf000affc0411a8019d64dda8990d6c3
/Android_source/Android_source/workspace(書籍掲載全リスト)/CameraImp/src/com/study/android/cameraimp/ImprintView.java
496521f718873127b087547842718dabb5e5ef41
[]
no_license
takagotch/and
e6bf811e194f47d7e2b30079c308380f7d118929
dfba108b0a1eb965a71ee2c559ac1666a7a6af57
refs/heads/master
2021-09-15T20:02:34.048548
2018-06-09T18:43:20
2018-06-09T18:43:20
109,402,630
0
0
null
null
null
null
UTF-8
Java
false
false
1,483
java
package com.study.android.cameraimp; import android.content.Context; import android.content.SharedPreferences.Editor; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.preference.PreferenceManager; import android.view.View; //埋め込み文字ビュー public class ImprintView extends View { // フィールド private Context mContext; private Paint paint; // コンストラクタ public ImprintView(Context con) { super(con); // コンテキストの保存 mContext = con; paint = new Paint(); } // 描画処理 @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); // 埋め込み文字の描画 paint.setColor(Color.RED); paint.setTextSize(ConstDef.IMP_TEXTSIZE); // 座標位置の設定 int X = ConstDef.MARGIN_X; int Y = canvas.getHeight() - ConstDef.MARGIN_Y; // 埋め込み文字を取得 String str = PreferenceManager.getDefaultSharedPreferences(mContext) .getString("KeyImpText", ""); // 文字が何も入っていないとき if (str == "") { // デフォルト文字列を取得 str = mContext.getString(R.string.ImpText_default); // デフォルトプリファレンスを取得 Editor editor = PreferenceManager.getDefaultSharedPreferences( mContext).edit(); // デフォルト文字をセット editor.putString("KeyImpText", str); } // キャンバスの描画 canvas.drawText(str, X, Y, paint); } }
[ "dyaccb@gmail.com" ]
dyaccb@gmail.com
971c8d37c9a96bc36dd645efaeb50d8267f70127
bead5c9388e0d70156a08dfe86d48f52cb245502
/MyNotes/JDK_8/Java_8_Function_Programming/chapter_3/demo_from_broad/Sum_Array_Map_and_List_Collection_Example/Line.java
d0b63f0998ceb4896dad17d3a0969cafff1705c0
[]
no_license
LinZiYU1996/Learning-Java
bd96e2af798c09bc52a56bf21e13f5763bb7a63d
a0d9f538c9d373c3a93ccd890006ce0e5e1f2d5d
refs/heads/master
2020-11-28T22:22:56.135760
2020-05-03T01:24:57
2020-05-03T01:24:57
229,930,586
0
0
null
null
null
null
UTF-8
Java
false
false
544
java
package JDK_8.Java_8_Function_Programming.chapter_3.demo_from_broad.Sum_Array_Map_and_List_Collection_Example; /** * \* Created with IntelliJ IDEA. * \* User: LinZiYu * \* Date: 2020/1/31 * \* Time: 11:02 * \* Description: * \ */ public class Line { private int length; public Line(int length) { this.length = length; } public int getLength() { return length; } @Override public String toString() { return "Line{" + "length=" + length + '}'; } }
[ "2669093302@qq.com" ]
2669093302@qq.com
083c90fd8befdbc8501b9c298746d062b3662571
19811acc28c43478924b299730799a4e8e3b9978
/app/src/main/java/com/example/hasee/shiyuji/Adapter/quesWarmAdapter.java
818ff1a41dd6a3e71f7f414982646453061e70f6
[ "Apache-2.0" ]
permissive
caiyufeinb/shiyuji
7241b76269663d3cb1abe9317af79a459fd0ae79
c000c00ac8f8828407757172fab45fa81ddb5753
refs/heads/master
2020-04-14T16:54:09.325557
2019-03-15T11:39:45
2019-03-15T11:39:45
163,964,277
4
2
null
null
null
null
UTF-8
Java
false
false
4,998
java
package com.example.hasee.shiyuji.Adapter; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.support.annotation.NonNull; import android.support.v7.widget.CardView; import android.support.v7.widget.RecyclerView; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.widget.Button; import android.widget.ImageView; import android.widget.RatingBar; import android.widget.TextView; import com.bumptech.glide.Glide; import com.example.hasee.shiyuji.DB.Hot; import com.example.hasee.shiyuji.DB.Warm; import com.example.hasee.shiyuji.Log.LogUtil; import com.example.hasee.shiyuji.R; import java.util.List; /** * 该类用作答题界面的食物的适配器 * 相比之前的适配器,点击食物图片得到的监听事件 * 从跳转到食物的详细介绍界面变成了跳出对话框处理答题逻辑 */ public class quesWarmAdapter extends RecyclerView.Adapter<quesWarmAdapter.ViewHolder> { private static final String TAG = "quesHotAdapter"; private Context context; private List<Warm> warmList; //定义对话框按钮 private Button button_determine; private Button button_cancel; //设置星星评分控件 private RatingBar ratingBar; //定义对话框 private AlertDialog dig; /* 构造函数,将包含数据的数组传入 */ public quesWarmAdapter(List<Warm> warmList) { this.warmList = warmList; } @NonNull @Override public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { if (context == null) { context = parent.getContext(); } View view = LayoutInflater.from(context).inflate(R.layout.food_item, parent, false); final ViewHolder holder = new ViewHolder(view); //点击食物图片后弹出对话框,进行相应的逻辑处理 holder.cardView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int position = holder.getAdapterPosition(); final Warm warm = warmList.get(position); //创建对话框对象,设置基本属性 final AlertDialog.Builder commit = new AlertDialog.Builder(context); commit.setTitle("123"); commit.setMessage("456"); commit.setIcon(R.drawable.ic_done); commit.setPositiveButton("确定", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { //此处填写答题评分逻辑 dig = new AlertDialog.Builder(context).create(); dig.show();//显示对话框 Window window = dig.getWindow();//对话框窗口 window.setGravity(Gravity.CENTER);//设置对话框显示中间的位置 window.setContentView(R.layout.dialog_layout); //获取星星评分控件 ratingBar = window.findViewById(R.id.ratingBar); ratingBar.setRating(2); //测试设置评分为两颗星 //获取对话框按钮 button_determine = window.findViewById(R.id.dialog_confirm); button_cancel = window.findViewById(R.id.dialog_back); LogUtil.d(TAG, "点击确定"); } }); commit.setNegativeButton("取消", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { LogUtil.d(TAG, "点击取消"); } }); commit.setCancelable(false); commit.create(); commit.show(); } }); return holder; } /* 为每个子项设置名字和图片 */ @Override public void onBindViewHolder(@NonNull ViewHolder holder, int position) { Warm warm = warmList.get(position); holder.coldName.setText(warm.getFoodName()); Glide.with(context).load(warm.getImageId()).into(holder.coldImage); } @Override public int getItemCount() { return warmList.size(); } /* 静态内部类ViewHolder,用来初始化子项中的各个组件 */ static class ViewHolder extends RecyclerView.ViewHolder { CardView cardView; ImageView coldImage; TextView coldName; ViewHolder(View view) { super(view); cardView = (CardView) view; coldImage = view.findViewById(R.id.food_img); coldName = view.findViewById(R.id.food_name); } } }
[ "1013032271@qq.com" ]
1013032271@qq.com
0ab84090a472514d57565ea9475d4a2006be1ade
33ecb210a3e0377d89fd15cbb84ae9a5e7aa27fa
/app/src/main/java/the/inner/circle/MainActivity.java
59f0c0f9d379b7299ec92987e74e4e72f141db8a
[]
no_license
DickBill/TheInnerCircle
0b67df63306451d4be9907c2e18fe4d227ae9fd7
c42687ce3217fbe6fe5f1a46037ce8d772318b72
refs/heads/master
2020-08-18T12:38:55.567555
2019-10-18T11:25:20
2019-10-18T11:25:20
215,787,641
0
0
null
null
null
null
UTF-8
Java
false
false
627
java
package the.inner.circle; import androidx.appcompat.app.AppCompatActivity; import android.graphics.Point; import android.os.Bundle; import android.view.Display; import android.view.Window; import android.view.WindowManager; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); this.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(new GameView(this)); } }
[ "tim.verhagen@student.kuleuven.be" ]
tim.verhagen@student.kuleuven.be
1eda4ec99f0b5f96073d5f122a019d6c15a9e468
7b8d375ac2d26ab984f98d9a43e9da5671fe8e2f
/pattern/pattern/bihaviralPattern/chainofResponsibilityPatternEx2/Logger.java
d52ebcca63e1c96222d5eef63576f1005541bc7b
[]
no_license
cunbinnak/test
3eea975f1cd5e845dc5acae880c345cf42f3cd4f
db2d2c313148394c86b19eb87452375134d57335
refs/heads/master
2023-06-02T09:43:04.382764
2021-06-20T04:29:34
2021-06-20T04:29:34
378,557,712
0
0
null
null
null
null
UTF-8
Java
false
false
1,023
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 pattern.bihaviralPattern.chainofResponsibilityPatternEx2; public abstract class Logger { protected LogLevel logLevel; protected Logger nextlogger; // The next Handler in the chain public Logger(LogLevel logLevel) { this.logLevel = logLevel; } // Set the next logger to make a list/chain of Handlers. public Logger setNext(Logger nextlogger) { this.nextlogger = nextlogger; return nextlogger; } //NONE(0), INFO(1), DEBUG(2), WARNING(4), ERROR(8), FATAL(16), ALL(32); public void log(LogLevel severity, String msg) { if (logLevel.getLevel() <= severity.getLevel()) { writeMessage(msg); } if (nextlogger != null) { nextlogger.log(severity, msg); } } protected abstract void writeMessage(String msg); }
[ "ntcmia@gmail.com" ]
ntcmia@gmail.com
42a872d285cbccedea10d84aafef7fef8ad1f3b1
c1c485ad8fadfb19d2a9ba10d43c8f83e86c0b5b
/mall-oms/oms-boot/src/main/java/com/youlai/mall/oms/controller/admin/OrderController.java
7328e20b510053428cf1ba2956493815a0a021d8
[ "Apache-2.0" ]
permissive
sugov5/youlai-mall
9c6b483817d1351f60fdc19fa654d0bf0ab9d158
d92a6d21812a0bd05cd128664dc1b1e74d681c15
refs/heads/master
2023-05-31T23:18:29.294281
2021-06-19T16:58:53
2021-06-19T16:58:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,996
java
package com.youlai.mall.oms.controller.admin; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.youlai.common.result.Result; import com.youlai.mall.oms.pojo.bo.app.OrderBO; import com.youlai.mall.oms.pojo.domain.OmsOrder; import com.youlai.mall.oms.pojo.domain.OmsOrderItem; import com.youlai.mall.oms.service.IOrderItemService; import com.youlai.mall.oms.service.IOrderService; import com.youlai.mall.ums.api.MemberFeignClient; import com.youlai.mall.ums.pojo.dto.MemberDTO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; import java.util.ArrayList; import java.util.List; import java.util.Optional; /** * @author huawei * @email huawei_code@163.com * @date 2020-12-30 22:31:10 */ @Api(tags = "【系统管理】订单服务") @RestController("AdminOrderController") @RequestMapping("/api/v1/orders") @Slf4j @AllArgsConstructor public class OrderController { private IOrderService orderService; private IOrderItemService orderItemService; private MemberFeignClient memberFeignClient; @ApiOperation("订单列表") @GetMapping @ApiImplicitParams({ @ApiImplicitParam(name = "page", defaultValue = "1", value = "页码", paramType = "query", dataType = "Long"), @ApiImplicitParam(name = "limit", defaultValue = "10", value = "每页数量", paramType = "query", dataType = "Long") }) public Result list(@RequestParam(defaultValue = "1") Long page, @RequestParam(defaultValue = "10") Long limit, OmsOrder order) { IPage<OmsOrder> result = orderService.list(new Page<>(page, limit), order); return Result.success(result.getRecords(), result.getTotal()); } @ApiOperation(value = "订单详情", httpMethod = "GET") @ApiImplicitParam(name = "id", value = "订单id", required = true, paramType = "path", dataType = "Long") @GetMapping("/{id}") public Result detail(@PathVariable Long id) { OrderBO orderBO = new OrderBO(); // 订单 OmsOrder order = orderService.getById(id); // 订单明细 List<OmsOrderItem> orderItems = orderItemService.list( new LambdaQueryWrapper<OmsOrderItem>().eq(OmsOrderItem::getOrderId, id) ); orderItems = Optional.ofNullable(orderItems).orElse(new ArrayList<>()); // 会员明细 Result<MemberDTO> result = memberFeignClient.getUserById(order.getMemberId()); MemberDTO member = result.getData(); orderBO.setOrder(order).setOrderItems(orderItems).setMember(member); return Result.success(orderBO); } }
[ "1490493387@qq.com" ]
1490493387@qq.com
f97ab65ecaf6e9e943635720c01828e924b19ce9
8c743dc58284b64f39e91541c3b9baf3ba608c3e
/app/src/main/java/com/softteco/roadqualitydetector/model/Evaluation.java
787a46153db411f4d61e8c0492f86e0dd4e58c29
[ "Apache-2.0" ]
permissive
pkavoo/RoadQualityLab
25c81270a661028ffe1219f23781ca5b316615cb
c5eaf8ea09ed272b8416a79fb49812ae1c87bbb6
refs/heads/master
2020-12-28T15:29:51.728015
2019-02-18T11:16:13
2019-02-18T11:16:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,379
java
package com.softteco.roadqualitydetector.model; public class Evaluation { String bumps,speed,distance, quality; String location; double ax,ay,az; String Uid; public String getBumps() { return bumps; } public void setBumps(String bumps) { this.bumps = bumps; } public String getUid() { return Uid; } public void setUid(String uid) { Uid = uid; } public String getSpeed() { return speed; } public void setSpeed(String speed) { this.speed = speed; } public String getDistance() { return distance; } public void setDistance(String distance) { this.distance = distance; } public String getQuality() { return quality; } public void setQuality(String quality) { this.quality = quality; } public String getLocation() { return location; } public void setLocation(String location) { this.location = location; } public double getAx() { return ax; } public void setAx(double ax) { this.ax = ax; } public double getAy() { return ay; } public void setAy(double ay) { this.ay = ay; } public double getAz() { return az; } public void setAz(double az) { this.az = az; } }
[ "simonwambua433@gmail.com" ]
simonwambua433@gmail.com
4a4bc14cf47ab519886587662a2a6475f0110d5e
c3e52bf4a5d979700ee296f50ce6c0a7bc3b1001
/Room.java
f75bdcbb4dc9683256ef4365a939d44cb63214b2
[]
no_license
JAHUMP02/Game-Thing
b7aa2aea0d6a85bd2cb9946a7c14a0a223908cb9
538ec0130511173c2accfb9833bd23df48e817d9
refs/heads/master
2021-01-23T06:21:03.374291
2017-05-08T16:44:41
2017-05-08T16:44:41
86,359,849
0
0
null
null
null
null
UTF-8
Java
false
false
503
java
package com.example; import java.awt.Color; import java.util.ArrayList; public class Room { private Color floor=Color.DARK_GRAY; private int doors; protected ArrayList<Entity> roomEntities=new ArrayList<Entity>(); protected boolean unlocked=false; public Room(){ } public boolean isUnlocked(){ return unlocked; } public ArrayList<Entity> getEntities(){ return roomEntities; } public void removeEntity(Entity e){ roomEntities.remove(e); } public void checkForCompletion(){ } }
[ "noreply@github.com" ]
noreply@github.com
2623a34e2f1d477dc9fb609735320437468a6569
73873523e017b92f3cc273283bda4429ff03b1ba
/acdpsp/ch10isp/src/main/java/oop/acdpsp/ch10isp/multiple/EntityDeletedEvent.java
a910bdc17c8aec0f0834789b57e01516cb9cab25
[]
no_license
dpopkov/learnoop
57c2fa3083b17f99a3d9741839a91c0c94ab8eae
fac286d037cb10f57383c71cac85aa13f11d8c4b
refs/heads/master
2022-02-16T18:36:06.291915
2021-03-25T16:39:22
2021-03-25T16:39:22
235,383,658
0
0
null
2022-01-21T23:37:10
2020-01-21T16:06:40
Java
UTF-8
Java
false
false
326
java
package oop.acdpsp.ch10isp.multiple; public class EntityDeletedEvent<E> extends Event<E> { private E deletedEntity; public EntityDeletedEvent(E deletedEntity) { super("EntityDeleted"); this.deletedEntity = deletedEntity; } public E getDeletedEntity() { return deletedEntity; } }
[ "pkvdenis@gmail.com" ]
pkvdenis@gmail.com
4c8fe3d9875a388b3b75f406e8d356b4691eefcc
e0ae3743f37d4e2add83239accd26bb3b209f0fe
/src/multithreading/_10_thread_factory/Main.java
bb7fed5d27e48faa37c2d0ab05ca13a7465f94c3
[ "MIT", "LicenseRef-scancode-proprietary-license" ]
permissive
DyvakYA/java-design-patterns
04dc3eb82cc48a99c58d05855861f5daa7ba8ea9
5e536cd785c58c681c98bc5c632e05a338e755f4
refs/heads/master
2022-12-26T14:31:59.630090
2019-09-10T06:34:40
2019-09-10T06:34:40
74,051,625
0
0
MIT
2020-10-13T15:55:22
2016-11-17T17:38:08
Java
UTF-8
Java
false
false
523
java
package multithreading._10_thread_factory; public class Main { public static void main(String[] args) { MyThreadFactory factory = new MyThreadFactory("MyThreadFactory"); Task task=new Task(); Thread thread; System.out.printf("Starting the Threads\n"); for (int i = 0; i < 10; i++) { thread = factory.newThread(task); thread.start(); } System.out.printf("Factory stats:\n"); System.out.printf("%s\n",factory.getStats()); } }
[ "dyvakyurii@gmail.com" ]
dyvakyurii@gmail.com
a149701e2d8b43d1481aafa230a4698fbd9e3418
2f6d4c03d271dd4636af6739360af3640bdcf1bc
/message-bus/src/main/java/alma/icd/adapt/messagebus/Envelope.java
6c0ed102dcaeb724a7e00681332e37019c248eac
[]
no_license
amchavan/alma-datapro-workflow-sandbox
9d41e5d65c48cb9d480575459197b540e8f40fca
03f2503dd0d61b95e3766d8dc6a09d3b04f99b30
refs/heads/master
2021-06-25T20:51:01.688768
2020-10-13T08:01:48
2020-10-13T08:01:48
138,999,454
0
0
null
2020-10-13T08:01:50
2018-06-28T09:50:42
Python
UTF-8
Java
false
false
2,332
java
package alma.icd.adapt.messagebus; /** * An {@link Envelope} includes a {@link Message} providing metadata like * forwarding information, timestamp, etc. */ public interface Envelope { /** * The state of this {@linkplain Envelope} -- or rather, of the enclosed * {@linkplain Message} */ public enum State { Sent, Received, Consumed, Expired, Rejected } /** * @return When the message was processed in some form by the receiver: * date/time string in ISO format, e.g. <code>2018-09-18T13:48:31</code> */ public String getConsumedTimestamp(); /** * @return When the message set to {@link State#Expired}: date/time string in * ISO format, e.g. <code>2018-09-18T13:48:31</code> */ public String getExpiredTimestamp(); public String getId(); /** * @return The message we're carrying */ public Message getMessage(); /** TODO */ public String getMessageClass(); /** * @return The IP address of the host where this instance was generated */ public String getOriginIP(); /** * @return Name of the queue to which this message should be sent */ public String getQueueName(); /** * @return When the message was received (that is, read from the queue): * date/time string in ISO format, e.g. <code>2018-09-18T13:48:31</code> */ public String getReceivedTimestamp(); /** * @return When the message was sent: date/time string in ISO format, e.g. * <code>2018-09-18T13:48:31</code> */ public String getSentTimestamp(); /** * @return When the message was rejected: date/time string in ISO format, e.g. * <code>2018-09-18T13:48:31</code> */ public String getRejectedTimestamp(); /** * @return The current state of this instance */ public State getState(); /** * @return The time before this instance expires, in msec. If it's 0, this * instance has expired. If it's negative, this instance never * expires or has been read already.<br> * Only messages that haven't been received can expire. */ public long getTimeToLive(); /** * @return The authorization token sent with this instance, if any; * <code>null</code> otherwise */ public String getToken(); /** * @param message The message to carry */ public void setMessage( Message message ); }
[ "amchavan@eso.org" ]
amchavan@eso.org
f8101dc36b84640dcb289fb5a8094be36c02940d
113134a5b6abb7f3096753305290e19799d2b0d8
/app/src/main/java/com/histudent/jwsoft/histudent/view/adapter/homework/convert/DataConvert.java
80f111eb3ccd3395ab1d019d0fb444ca3056c2f5
[]
no_license
dengjiaping/trunk
5047c99d25125b75451142fdb260d81be85f28b8
bd24e8a6fdc7f2ca003e95ec45c723c17bf50684
refs/heads/master
2021-08-26T07:05:59.113508
2017-11-22T01:42:11
2017-11-22T01:42:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
774
java
package com.histudent.jwsoft.histudent.view.adapter.homework.convert; import android.text.TextUtils; import com.histudent.jwsoft.histudent.model.bean.homework.CommonMemberBean; import java.util.ArrayList; import java.util.List; /** * Created by lichaojie on 2017/10/25. * desc: */ public abstract class DataConvert { protected List<CommonMemberBean> ENTITYS = new ArrayList<>(); protected String mJsonData = null; public abstract List<CommonMemberBean> convert(); public DataConvert setJsonData(String jsonData) { this.mJsonData = jsonData; return this; } protected String getJson() { if (TextUtils.isEmpty(mJsonData)) throw new NullPointerException("DATA IS NULL"); return mJsonData; } }
[ "742315209@qq.com" ]
742315209@qq.com
fe73e37c1e50d4a2049808e8ce1c5b94718add62
6def2fcb05b24cb58706cb129e779398b92e883c
/mandal-remoting/mandal-remoting-zookeeper/src/main/java/cn/ching/mandal/remoting/zookeeper/curator/CuratorZookeeperTransporter.java
9bf9ad98903b152f4328053acdf50c6d7e1720f1
[]
no_license
bearDream/mandal
01d1fc979f9f84a89a78f649a90b72ce344063aa
cd5f2be122f41a354f0a17b85af8a4b6e5736a61
refs/heads/master
2021-05-12T14:25:33.565634
2018-05-05T02:05:48
2018-05-05T02:05:48
116,955,361
1
0
null
2018-05-05T02:05:49
2018-01-10T12:33:56
Java
UTF-8
Java
false
false
480
java
package cn.ching.mandal.remoting.zookeeper.curator; import cn.ching.mandal.common.URL; import cn.ching.mandal.remoting.zookeeper.ZookeeperClient; import cn.ching.mandal.remoting.zookeeper.ZookeeperTransporter; /** * 2018/1/29 * * @author chi.zhang * @email laxzhang@outlook.com */ public class CuratorZookeeperTransporter implements ZookeeperTransporter { @Override public ZookeeperClient connect(URL url) { return new CuratorZookeeperClient(url); } }
[ "chi.zhang09@ele.me" ]
chi.zhang09@ele.me
640f23f4717ac67025ee42d71901bb49768a03a6
9db836efc3ad10427bc78e3e60ce0c268aed3110
/src/ObjectReturnDemo.java
4e5e4ceacbc18fbd1c50e8086e53aa3e0dd41503
[]
no_license
Taide220643/SWA3-3
c79f4317a337c794bd93d6cc9779468e11a53fa1
c8f15dc017b13c367d6b3630a127a8e1074c2b29
refs/heads/main
2023-06-24T09:43:51.478703
2021-07-19T08:24:15
2021-07-19T08:24:15
387,392,263
0
0
null
null
null
null
UTF-8
Java
false
false
279
java
class ObjectReturnDemo { int a; ObjectReturnDemo(int i) { a = i; } // This method returns an object ObjectReturnDemo incrByTen() { ObjectReturnDemo temp = new ObjectReturnDemo(a+10); return temp; } }
[ "59428815+Taide220643@users.noreply.github.com" ]
59428815+Taide220643@users.noreply.github.com
0ab304bdafc39e6c80e5bab5271d8b943ecceff9
abda2a7f2a6c3222bc2a501a015d71f2c6bacccc
/src/numberTest/Number.java
584ed40e394f6b81d921096f0daa4fc55e10584f
[]
no_license
test-q/NaveenJavaAssignments
0b991ea0e0be84cdc82cc31ce8cc431e03f6f56f
a5f82c69ca539ee3ef6fca73d81579ce0844e13b
refs/heads/master
2023-01-22T17:47:08.837605
2020-11-05T13:34:48
2020-11-05T13:34:48
279,565,282
0
0
null
2020-08-12T16:21:09
2020-07-14T11:22:58
Java
UTF-8
Java
false
false
436
java
package numberTest; public class Number { private int age; private String policy; public String name; public int getAge() { return age; } public void setAge(int age) { this.age = age; } public String getPolicy() { return policy; } public void setPolicy(String policy) { this.policy = policy; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
[ "sr.test85@gmail.com" ]
sr.test85@gmail.com
c610f4d7bd57368cc954f123549379e65eec53cb
c98ef2898804391926d08ba950c6d856a99e9dfd
/src/NineMarch/EchoServer.java
d5fd674cec6d723d5f71a404560f13043da3d3bf
[]
no_license
nataliepavelko/GoJava12
27898a37532cf40af659ed0b2e9aa9856108da4f
03f81dbc6d2c866530a3b5ffa5c672fc199ad635
refs/heads/master
2020-05-03T11:06:18.025174
2019-03-30T17:57:11
2019-03-30T17:57:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,579
java
package NineMarch; import java.io.*; import java.net.ServerSocket; import java.net.Socket; public class EchoServer extends Thread { private ServerSocket ss; public EchoServer(int port) { try { ss = new ServerSocket(port); //открытие сервака на порту; // ServerSocket ss = new ServerSocket(777); } catch (IOException e) { e.printStackTrace(); } } @Override public void run() { while (true) { System.out.println("Waiting for clients..."); try { final Socket soc = ss.accept(); //низкоуровневіе клиенты new Thread() { @Override public void run() { try { saveFile(soc); } catch (IOException e) { e.printStackTrace(); } } }.start(); } catch (IOException e) { e.printStackTrace(); } System.out.println("Connection completed"); } } private void saveFile(Socket soc) throws IOException { OutputStream out = soc.getOutputStream(); InputStream in = soc.getInputStream(); DataInputStream din = new DataInputStream(in); Long size = din.readLong(); System.out.println("size "+size); } public static void main(String[] args) { new EchoServer(8081).start(); } }
[ "nataly.pavelko@gmail.com" ]
nataly.pavelko@gmail.com
d4145e2cb0b2f4742480f2319c186aa4cc298e01
6a8e1f0c77b953b0065830a07325a4cb723cfe17
/2.JavaCore/src/com/javarush/task/task14/task1411/Solution.java
bc0ad2bc196a117ec91afb8226c8175ac10d7b7a
[]
no_license
praddx/JavaRushTasks
2161ed620054b1efc83cac9a2f40b7a074e3e356
b7fa7bc9af713860aa91c860b268191b021bd752
refs/heads/master
2021-08-22T17:16:38.245709
2017-11-30T19:26:53
2017-11-30T19:26:53
108,898,103
0
0
null
null
null
null
UTF-8
Java
false
false
1,478
java
package com.javarush.task.task14.task1411; import java.io.BufferedReader; import java.io.InputStreamReader; /* User, Loser, Coder and Proger */ public class Solution { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); Person person = null; String key = null; while (true) { key = reader.readLine(); //создаем объект, пункт 2 if (key.equals("user")) { person = new Person.User(); } else if (key.equals("loser")) { person = new Person.Loser(); } else if (key.equals("coder")) { person = new Person.Coder(); } else if (key.equals("proger")) { person = new Person.Proger(); } else { reader.close(); break; } doWork(person); //вызываем doWork } } public static void doWork(Person person) { if (person instanceof Person.User) { ((Person.User) person).live(); } else if (person instanceof Person.Loser) { ((Person.Loser) person).doNothing(); } else if (person instanceof Person.Coder) { ((Person.Coder) person).coding(); } else if (person instanceof Person.Proger) { ((Person.Proger) person).enjoy(); } } }
[ "praddcell@gmail.com" ]
praddcell@gmail.com
182493a11c901027c07eb84ed82e1f26f622542f
4408e4c637c68a21cf2a56eedcc0afbd02fb868a
/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/table/alarm/InstanceAlarmList.java
c89b1867f143c6b47d74fb735bd592dddbccaeb2
[ "Apache-2.0", "EPL-1.0", "BSD-3-Clause", "MPL-2.0", "MIT" ]
permissive
mouse3150/incubator-skywalking
dd210f7f1137d66282ec16504917c01ff003d9a3
572f985cf17f152422ca112bb21798a7a60b5812
refs/heads/master
2020-04-07T05:37:34.547566
2018-03-07T03:37:50
2018-03-07T03:37:50
124,185,454
1
0
Apache-2.0
2018-03-07T05:45:21
2018-03-07T05:45:21
null
UTF-8
Java
false
false
3,628
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package org.apache.skywalking.apm.collector.storage.table.alarm; import org.apache.skywalking.apm.collector.core.data.Column; import org.apache.skywalking.apm.collector.core.data.StreamData; import org.apache.skywalking.apm.collector.core.data.operator.CoverOperation; import org.apache.skywalking.apm.collector.core.data.operator.NonOperation; /** * @author peng-yongsheng */ public class InstanceAlarmList extends StreamData { private static final Column[] STRING_COLUMNS = { new Column(InstanceAlarmListTable.COLUMN_ID, new NonOperation()), new Column(InstanceAlarmListTable.COLUMN_ALARM_CONTENT, new CoverOperation()), }; private static final Column[] LONG_COLUMNS = { new Column(InstanceAlarmListTable.COLUMN_TIME_BUCKET, new NonOperation()), }; private static final Column[] DOUBLE_COLUMNS = {}; private static final Column[] INTEGER_COLUMNS = { new Column(InstanceAlarmListTable.COLUMN_ALARM_TYPE, new NonOperation()), new Column(InstanceAlarmListTable.COLUMN_SOURCE_VALUE, new NonOperation()), new Column(InstanceAlarmListTable.COLUMN_APPLICATION_ID, new NonOperation()), new Column(InstanceAlarmListTable.COLUMN_INSTANCE_ID, new NonOperation()), }; private static final Column[] BYTE_COLUMNS = {}; public InstanceAlarmList() { super(STRING_COLUMNS, LONG_COLUMNS, DOUBLE_COLUMNS, INTEGER_COLUMNS, BYTE_COLUMNS); } @Override public String getId() { return getDataString(0); } @Override public void setId(String id) { setDataString(0, id); } @Override public String getMetricId() { return getId(); } @Override public void setMetricId(String metricId) { setId(metricId); } public Integer getAlarmType() { return getDataInteger(0); } public void setAlarmType(Integer alarmType) { setDataInteger(0, alarmType); } public Integer getSourceValue() { return getDataInteger(1); } public void setSourceValue(Integer sourceValue) { setDataInteger(1, sourceValue); } public Integer getApplicationId() { return getDataInteger(2); } public void setApplicationId(Integer applicationId) { setDataInteger(2, applicationId); } public Integer getInstanceId() { return getDataInteger(3); } public void setInstanceId(Integer instanceId) { setDataInteger(3, instanceId); } public Long getTimeBucket() { return getDataLong(0); } public void setTimeBucket(Long timeBucket) { setDataLong(0, timeBucket); } public String getAlarmContent() { return getDataString(1); } public void setAlarmContent(String alarmContent) { setDataString(1, alarmContent); } }
[ "8082209@qq.com" ]
8082209@qq.com
e98ee2b06d0900a24667841b269742db3e75dadb
c8564f685218467679645106b3a225c9a42fe87f
/src/collectionsTest/HashcodeAndEquals.java
4474809a332fa882c452d085d75104463ffc6022
[]
no_license
bharathreddyyalaka/Training
8bbe183df0254e56a8533d8b6826ca022e317c57
4bd42b86454c437d813587b43e50f4dcb3014659
refs/heads/master
2022-12-16T22:02:01.711154
2020-09-11T11:34:52
2020-09-11T11:34:52
292,368,099
0
0
null
null
null
null
UTF-8
Java
false
false
1,181
java
package collectionsTest; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; public class HashcodeAndEquals { public static void main(String[] args) { // TODO Auto-generated method stub EmployeeDept e = new EmployeeDept(1, "Bharath", "DNADE", "Systems Engineer"); EmployeeDept e1 = new EmployeeDept(2, "manoj", "Oracle", "Assc Trainee"); EmployeeDept e2 = new EmployeeDept(3, "white", "Visa", "Technology Lead"); EmployeeDept e4 = new EmployeeDept(1, "Bharath", "DNADE", "Systems Engineer"); System.out.println(e.getDept()); HashSet<EmployeeDept> hsObj = new HashSet <EmployeeDept>(); hsObj.add(e); hsObj.add(e1); hsObj.add(e2); hsObj.add(e4); for(EmployeeDept ed : hsObj){ System.out.println(ed.getId()); } ArrayList<EmployeeDept> al=new ArrayList<EmployeeDept>(); al.add(new EmployeeDept(1,"Vijay","sna","Systems Engineer")); al.add(new EmployeeDept(3,"Ajay","sna","Assc Trainee")); al.add(new EmployeeDept(2,"Jai","sna", "Technology Lead")); //Collections.sort(hsObj); for(EmployeeDept ed : al){ System.out.println(ed.getId()+" "+ed.getDept()+" "+ed.getName()); } } }
[ "manojyalaka08@gmail.com" ]
manojyalaka08@gmail.com
99b663914116a30bba37a2b8331b70fd88bdc325
78013c148848cdae7164f88f0ed1dc4853ee2dc2
/src/main/java/com/example/mapper/UserCollectionMapper.java
97fe290e8555c59b41b48066a5e5afbe520f8ec3
[ "MIT" ]
permissive
asd13606410359/eblog
c92aa33f9eeee02b6988a764fa63cefd6b92429f
b76c02611fc9c234aaa02c36bd5ebad1f126aac0
refs/heads/master
2022-12-20T04:48:21.748317
2020-09-03T08:56:47
2020-09-03T08:56:47
262,263,387
1
0
MIT
2020-09-03T08:56:49
2020-05-08T08:03:21
null
UTF-8
Java
false
false
311
java
package com.example.mapper; import com.example.entity.UserCollection; import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** * <p> * Mapper 接口 * </p> * * @author 公众号:java思维导图 * @since 2019-11-17 */ public interface UserCollectionMapper extends BaseMapper<UserCollection> { }
[ "781958167@qq.com" ]
781958167@qq.com
87e1ec578794fb3e3cbe11bbc31eed98bce2dead
0d7783c1f9a9e01e2c7072dbd7190164f568cc4e
/src/main/java/com/example/bio/common/constraint/FieldMatch.java
e29e6251cf00b59afafa7760e9b70777f35cc536
[]
no_license
aLIEz1/bio
fd9b77416400bebe820f87af5d0b847646d20469
aadd6792611a0d4d5ed223da9b0a028b89f54205
refs/heads/master
2023-06-30T22:09:09.509882
2021-08-09T11:16:10
2021-08-09T11:16:10
308,207,308
4
0
null
null
null
null
UTF-8
Java
false
false
972
java
package com.example.bio.common.constraint; import javax.validation.Constraint; import javax.validation.Payload; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.ANNOTATION_TYPE; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; /** * 两次密码匹配验证注解 * * @author zhangfuqi * @date 2020/11/17 */ @Target({TYPE, ANNOTATION_TYPE}) @Retention(RUNTIME) @Constraint(validatedBy = FieldMatchValidator.class) @Documented public @interface FieldMatch { String message() default "{constraints.field-match}"; Class<?>[] groups() default {}; Class<? extends Payload>[] payload() default {}; String first(); String second(); @Target({TYPE, ANNOTATION_TYPE}) @Retention(RUNTIME) @Documented @interface List { FieldMatch[] value(); } }
[ "super1742720898@gmail.com" ]
super1742720898@gmail.com
692556bfb1ccccd1b0ef220e5ab7cc6d40afaa7c
7eb8606369d7f98e766a7d439728b2d746e8f2ec
/collegeportal/src/collegeportal/servlets/CreateCookie.java
446cec62a4e68ef76a4be4e1034ff202507a7045
[]
no_license
saurabhpathaks/College-Portal
d8333c20cd73abf26e065da44e37254ace639366
c72de6cf2fdb8834336c257b2cc9eb6e9d9c8444
refs/heads/master
2023-09-02T20:04:31.574913
2021-11-08T05:44:04
2021-11-08T05:44:04
425,712,092
0
0
null
null
null
null
UTF-8
Java
false
false
1,549
java
package collegeportal.servlets; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class CreateCookie */ @WebServlet("/CreateCookie") public class CreateCookie extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public CreateCookie() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String userid="Saurabh@12345"; String password="qwerty"; String location="London"; String info=userid+"#"+password+"#"+location; Cookie cookie=new Cookie("userinfo", info); cookie.setMaxAge(60*60*24*365); response.addCookie(cookie);//send the cookie on client machine System.out.println("cookie created"); } /** * @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); } }
[ "hp@DESKTOP-078C0EC" ]
hp@DESKTOP-078C0EC
3d6a888493be3b2a700cf33f0617cf7116b1b2b2
5774e32ee46cad7ce2c1b1b0ad055d4dd99fd574
/teach/teach-service/teach-service-student/src/main/java/cn/logicalthinking/models/student/service/course/StGetCourseListService.java
bcff42a6f3d931c9c63c7b9c8eb4048d022059fe
[]
no_license
hsjadmin/text
e467ab8ee94ca099409afbbc5759824589c1338f
5d8afda1811b38a392c61ed163c492a34716ba4e
refs/heads/master
2020-05-25T03:35:16.440342
2019-05-20T09:00:05
2019-05-20T09:00:05
187,603,856
0
0
null
null
null
null
UTF-8
Java
false
false
2,113
java
package cn.logicalthinking.models.student.service.course; import cn.logicalthinking.common.base.entity.Result; import cn.logicalthinking.common.base.enums.CODE; import cn.logicalthinking.common.base.service.AbstractService; import cn.logicalthinking.common.base.service.IClientData; import cn.logicalthinking.common.dao.CourseDao; import cn.logicalthinking.common.entity.Course; import com.github.pagehelper.PageInfo; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.Map; /** * @author xhx * @version 1.0 * @Description 查询指定老师开设的课程 * @date 2018-12-19 */ @Service public class StGetCourseListService extends AbstractService { @Resource private CourseDao courseDao; private IClientData data; @Override protected Result doWork(IClientData data) throws Exception { this.data = data; Map<String, Object> map = data.initMap(); // String[] conditionArr = new String[]{ // "id",//主键 // "createTime",//创建时间 // "updateTime",//修改时间 // "teacherId",//老师id // "name",//课程名 // "grade",//年级 // "subject",//科目 // "introduce",//简介 // "status",//状态(0有效 1无效) // "courseType",//科目类型(0小学 1初中 2高中) // "isShow",//是否显示(0显示 1不显示) // "liveStatus",//是否正在直播(0否,1是) // "isFinish",//老师上完课依据(0否,1是),课程所有类型及章节是否完成 // }; String id = data.getParameter("id"); map.put("teacherId", id); // 有效 map.put("status", 0); // 显示 map.put("isShow", 0); // data.setConditionMap(map, conditionArr); PageInfo<Course> pageInfo = courseDao.selectCourseListByPage(map); return Result.jsonData(CODE.CODE_200_SELECT.getKey(), pageInfo.getList(), pageInfo.getTotal()); } }
[ "1907377985@qq.com" ]
1907377985@qq.com
eb26f72fec23a1788712b33cb9802dd311217d0c
b58b13102a12df08a16455f4aada05335d7f69a7
/calculator/WeightCal.java
62757c41d64e82fe509d4f858f0cfc8f3b9e3e06
[]
no_license
yeepheng96/stiw2044lab1
2b4dcdb4f1d907ab619652560c4bac522a2b96af
69818679b4df6d47f305039f5b4eb6fb374e6655
refs/heads/master
2020-04-23T21:02:52.410898
2019-02-19T11:05:44
2019-02-19T11:05:44
171,458,029
0
0
null
null
null
null
UTF-8
Java
false
false
3,483
java
package com.example.calculator; public class WeightCal { public String kgCal(double input){ double ounces = input * 35.274; double pounds = input * 2.20462; double tPounds = input * 2.6793; double stones = input * 0.157473; double sTons = input * 0.00110231; double lTons = input * 0.000984207; String output = ounces + " ounces\n" + pounds + " pounds\n" + tPounds + " troy pounds\n" + stones + " stones\n" + sTons + " short tons\n" + lTons + " long tons"; return output; } public String ouncesCal(double input){ double kg = input * 0.0283; double pounds = input * 0.0625; double tPounds = input * 0.0760; double stones = input * 0.00446429; double sTons = input * 0.003125; double lTons = input * 0.0027902; String output = kg + " kilograms\n" + pounds + " pounds\n" + tPounds + " troy pounds\n" + stones + " stones\n" + sTons + " short tons\n" + lTons + " long tons"; return output; } public String poundsCal(double input){ double kg = input * 0.453592; double ounces = input * 16.0; double tPounds = input * 1.2153; double stones = input * 0.0714286; double sTons = input * 0.0005; double lTons = input * 0.000446429; String output = kg + " kilograms\n" + ounces + " ounces\n" + tPounds + " troy pounds\n" + stones + " stones\n" + sTons + " short tons\n" + lTons + " long tons"; return output; } public String tPoundsCal(double input){ double kg = input * 0.3732; double ounces = input * 13.165; double pounds = input * 0.8228; double stones = input * 0.058774; double sTons = input * 0.00041142; double lTons = input * 0.00037324; String output = kg + " kilograms\n" + ounces + " ounces\n" + pounds + " pounds\n" + stones + " stones\n" + sTons + " short tons\n" + lTons + " long tons"; return output; } public String stonesCal(double input){ double kg = input * 6.35029; double ounces = input * 224; double pounds = input * 14; double tPounds = input * 17.014; double sTons = input * 0.007; double lTons = input * 0.00625; String output = kg + " kilograms\n" + ounces + " ounces\n" + pounds + " pounds\n" + tPounds + " troy pounds\n" + sTons + " short tons\n" + lTons + " long tons"; return output; } public String sTonsCal(double input){ double kg = input * 907.185; double ounces = input * 32000; double pounds = input * 2000; double tPounds = input * 2430.6; double stones = input * 142.857; double lTons = input * 0.892857; String output = kg + " kilograms\n" + ounces + " ounces\n" + pounds + " pounds\n" + tPounds + " troy pounds\n" + stones + " stones\n" + lTons + " long tons"; return output; } public String lTonsCal(double input){ double kg = input * 1016.05; double ounces = input * 35840; double pounds = input * 2240; double tPounds = input * 2679.3; double stones = input * 160; double sTons = input * 1.12; String output = kg + " kilograms\n" + ounces + " ounces\n" + pounds + " pounds\n" + tPounds + " troy pounds\n" + stones + " stones\n" + sTons + " short tons"; return output; } }
[ "noreply@github.com" ]
noreply@github.com
99190a165db6c2f8f06d8fec0168797147648f12
8bc8d346617a45ffa79704f4fb44cfa3c022e057
/src/main/java/br/com/dxc/core/qrcode/QRCodeUtil.java
1c125edeeb87c261ea6ced5df75da0186b06c3c2
[]
no_license
Ezekii/refactoring
9e5bd33bfd3dc4dc77970cec85c2b7dc70ea59e3
3ad029e2dc67fdb4dce4996a4312466dd4a45e6d
refs/heads/master
2021-04-28T06:28:56.945960
2018-03-08T20:16:57
2018-03-08T20:16:57
122,202,253
0
0
null
null
null
null
UTF-8
Java
false
false
4,348
java
package br.com.dxc.core.qrcode; import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.util.Hashtable; import com.google.zxing.BarcodeFormat; import com.google.zxing.BinaryBitmap; import com.google.zxing.ChecksumException; import com.google.zxing.DecodeHintType; import com.google.zxing.FormatException; import com.google.zxing.LuminanceSource; import com.google.zxing.NotFoundException; import com.google.zxing.Result; import com.google.zxing.WriterException; import com.google.zxing.client.j2se.BufferedImageLuminanceSource; import com.google.zxing.client.j2se.ImageReader; import com.google.zxing.client.j2se.MatrixToImageWriter; import com.google.zxing.common.BitMatrix; import com.google.zxing.common.DetectorResult; import com.google.zxing.common.HybridBinarizer; import com.google.zxing.qrcode.QRCodeReader; import com.google.zxing.qrcode.QRCodeWriter; import com.google.zxing.qrcode.detector.Detector; public class QRCodeUtil { public static final int WIDTH = 100; public static final int HEIGHT = 100; /** * Gera um QRCode para um OutputStream * * @param conteudo * @return * @throws WriterException * @throws IOException */ public static OutputStream gerarStream(String conteudo) throws WriterException, IOException { return gerarStream(conteudo, WIDTH, HEIGHT); } /** * Gera um QRCode para um OutputStream * * @param conteudo * @param width * @param height * @return * @throws WriterException * @throws IOException */ public static OutputStream gerarStream(String conteudo, int width, int height) throws WriterException, IOException { BitMatrix bm = gerarBitMatrix(conteudo, width, height); OutputStream outputStream = new ByteArrayOutputStream(); MatrixToImageWriter.writeToStream(bm, "jpg", outputStream); return outputStream; } /** * Gera um QRCode para um arquivo fisico * * @param conteudo * @param file * @return * @throws WriterException * @throws IOException */ public static File gerarFile(String conteudo, File file) throws WriterException, IOException { return gerarFile(conteudo, WIDTH, HEIGHT, file); } /** * Gera um QRCode para um arquivo fisico * * @param conteudo * @param width * @param height * @param file * @return * @throws WriterException * @throws IOException */ @SuppressWarnings("deprecation") public static File gerarFile(String conteudo, int width, int height, File file) throws WriterException, IOException { BitMatrix bm = gerarBitMatrix(conteudo, width, height); MatrixToImageWriter.writeToFile(bm, "jpg", file); return file; } /** * Gera o BitMatrix do QRCode * * @param conteudo * @param width * @param height * @return * @throws WriterException */ private static BitMatrix gerarBitMatrix(String conteudo, int width, int height) throws WriterException { QRCodeWriter writer = new QRCodeWriter(); BitMatrix bm = writer.encode(conteudo, BarcodeFormat.QR_CODE, width, height); return bm; } /** * Encontra o padrao QRCode e efetua a leitura retornando o conteudo de * texto * * @param file * @return * @throws IOException * @throws NotFoundException * @throws FormatException * @throws ChecksumException */ public static String localizar(File file) throws IOException, NotFoundException, FormatException, ChecksumException { QRCodeReader reader = new QRCodeReader(); BufferedImage originImage = ImageReader.readImage(file.toURI()); LuminanceSource originSource = new BufferedImageLuminanceSource( originImage); BinaryBitmap originBitmap = new BinaryBitmap(new HybridBinarizer( originSource)); Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>(); hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE); Detector detector = new Detector(originBitmap.getBlackMatrix()); DetectorResult detectorResult = detector.detect(hints); BitMatrix originMatrix = detectorResult.getBits(); BufferedImage bf = MatrixToImageWriter.toBufferedImage(originMatrix); LuminanceSource source = new BufferedImageLuminanceSource(bf); BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source)); Result result = reader.decode(bitmap); return result.getText(); } }
[ "eze@bob" ]
eze@bob
081e642c75dcce72f0d7dc3890bc6fc610aed985
1e49f6edd575d48978203e5f8041f78c4db65dbf
/Java Design Patterns/visitor_design_pattern/VisitorPatternDemo.java
5c740393ec0a272a5eec41965ec3bd7d03385a20
[]
no_license
IvanBoykovPeev/HomeWorks
507d7d416333616fb66433536180ad4a84f4a521
8dc65e78a2b694f8bca0e003509b5a6f4c276115
refs/heads/master
2021-01-17T08:00:33.635935
2016-06-02T17:39:00
2016-06-02T17:39:00
23,828,836
0
0
null
null
null
null
UTF-8
Java
false
false
221
java
package visitor_design_pattern; public class VisitorPatternDemo { public static void main(String[] args) { ComputerPart computer = new Computer(); computer.accept(new ComputerPartDisplayVisitor()); } }
[ "ivan.boykov.peev@gmail.com" ]
ivan.boykov.peev@gmail.com
c5149ccf47c99592ac21c3ec065cae7d0777562d
72f993542d5f28ef9a20213e66eef3dc62b2a8bd
/ExecutorBatch/src/main/java/com/reply/batch/processor/TestCasesItemProcessor.java
ae2df97198319a05f434486abbe48fc88f219902
[]
no_license
cltecceReply/TestExecutor
7b9cf52f21bbaebae00ad03a8e3a96d7462f32ec
c001c2248dc00395eb71ea022dbb248c1001061b
refs/heads/main
2023-06-16T09:23:25.827225
2021-06-08T14:47:34
2021-06-08T14:47:34
375,044,241
0
0
null
null
null
null
UTF-8
Java
false
false
1,059
java
package com.reply.batch.processor; import com.reply.batch.io.TestResultRecord; import com.reply.services.TestCaseProcessor; import com.reply.services.TestCaseProcessorOut; import com.reply.io.dto.TERecord; import lombok.extern.slf4j.Slf4j; import org.springframework.batch.core.annotation.AfterStep; import org.springframework.batch.item.ItemProcessor; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Slf4j @Component public class TestCasesItemProcessor implements ItemProcessor<TERecord, TestResultRecord> { @Autowired TestCaseProcessor processor; @AfterStep public void printReport(){ log.info(processor.getReport()); } @Override public TestResultRecord process(TERecord teRecord) throws Exception { TestResultRecord record = new TestResultRecord(); TestCaseProcessorOut out = processor.executeTestCase(teRecord); BeanUtils.copyProperties(out, record); return record; } }
[ "c.tecce@reply.it" ]
c.tecce@reply.it
2bfda851b51d972f6c3915bf7fa384391c37045d
db6daf9c4c5b6dce6395b7be6e86641806311e0f
/src/main/java/com/gjw/service/impl/AreaServiceImpl.java
de09aceaae13516612f6a3458fe76c1ee0c06982
[]
no_license
gjw199513/my-o2o
d696354b8b308d88b595f321b312321a3b2f6e71
8122fb0937592706f02073c3ae73cb9bed090b70
refs/heads/master
2020-03-21T09:13:15.933179
2018-07-08T03:08:59
2018-07-08T03:08:59
138,388,557
1
0
null
null
null
null
UTF-8
Java
false
false
2,346
java
package com.gjw.service.impl; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.ObjectMapper; import com.gjw.cache.JedisUtil; import com.gjw.dao.AreaDao; import com.gjw.dto.AreaOperationException; import com.gjw.entity.Area; import com.gjw.service.AreaService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.io.IOException; import java.util.ArrayList; import java.util.List; /** * Created by gjw19 on 2018/6/23. */ @Service public class AreaServiceImpl implements AreaService { @Autowired private AreaDao areaDao; @Autowired private JedisUtil.Keys jedisKeys; @Autowired private JedisUtil.Strings jedisStrings; private static Logger logger = LoggerFactory.getLogger(AreaServiceImpl.class); /** * 使用redis优化,将Area存入redis中 * 当redis有值直接从redis获取,没有值从数据获取并存入redis * * @return */ @Transactional public List<Area> getAreaList() { // String key = AREALISTKEY; List<Area> areaList = null; ObjectMapper mapper = new ObjectMapper(); if (!jedisKeys.exists(key)) { areaList = areaDao.queryArea(); String jsonString; try { jsonString = mapper.writeValueAsString(areaList); } catch (JsonProcessingException e) { e.printStackTrace(); logger.error(e.getMessage()); throw new AreaOperationException(e.getMessage()); } jedisStrings.set(key, jsonString); } else { String jsonString = jedisStrings.get(key); JavaType javaType = mapper.getTypeFactory().constructParametricType(ArrayList.class, Area.class); try { areaList = mapper.readValue(jsonString, javaType); } catch (IOException e) { e.printStackTrace(); logger.error(e.getMessage()); throw new AreaOperationException(e.getMessage()); } } return areaList; } }
[ "gjw605134015" ]
gjw605134015
9f955dce1db6dace5ef9596318bc496038431a33
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/17/17_85a86b673bf8c2529aeddfa3754d2fb83187fb32/ConcurrentScanChild/17_85a86b673bf8c2529aeddfa3754d2fb83187fb32_ConcurrentScanChild_s.java
f7a04cd84ffb788b5847d4e6ba699931489690ed
[]
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
17,657
java
/*- * Copyright © 2009 Diamond Light Source Ltd. * * This file is part of GDA. * * GDA is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License version 3 as published by the Free * Software Foundation. * * GDA is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with GDA. If not, see <http://www.gnu.org/licenses/>. */ package gda.scan; import gda.configuration.properties.LocalProperties; import gda.device.Detector; import gda.device.Scannable; import gda.device.detector.DetectorWithReadout; import gda.device.scannable.ScannableUtils; import java.util.ArrayList; import java.util.List; import java.util.Map.Entry; import java.util.TreeMap; import java.util.Vector; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.FutureTask; import org.apache.commons.lang.ArrayUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Base class for scan classes which can act as a dimension in a multi-dimensional concurrentscan */ public abstract class ConcurrentScanChild extends ScanBase implements IConcurrentScanChild { private static final Logger logger = LoggerFactory.getLogger(ConcurrentScanChild.class); protected TreeMap<Integer, Scannable[]> scannableLevels; // the list of movements that this scan will perform in the context of the a multi-dimensional set of nested scans protected Vector<ScanObject> allScanObjects = new Vector<ScanObject>(); // the list of child scans belonging to this parent protected Vector<IConcurrentScanChild> allChildScans = new Vector<IConcurrentScanChild>(); private boolean mustBeFinal = false; protected FutureTask<Void> detectorReadoutTask; private Boolean readoutConcurrently; // readout detectors in concurrent threads while the next point is started protected enum PointPositionInLine { FIRST, MIDDLE, LAST } private PointPositionInLine pointPositionInLine; private boolean detectorWithReadoutDeprecationWarningGiven = false; final protected PointPositionInLine getPointPositionInLine() { return pointPositionInLine; } final protected void setPointPositionInLine(PointPositionInLine pointPositionInLine) { this.pointPositionInLine = pointPositionInLine; } public boolean isReadoutConcurrent() { if (readoutConcurrently == null) { // cache value to prevent change during scan String propertyName = LocalProperties.GDA_SCAN_CONCURRENTSCAN_READOUT_CONCURRENTLY; readoutConcurrently = LocalProperties.check(propertyName, false); if (!isReadoutConcurrent()) { logger.info("This gda installation is configured not to move motors to the next point while detectors are readout in parallel threads"); } } return readoutConcurrently; } @Override public IConcurrentScanChild getParent() { return (IConcurrentScanChild) parent; } /** * @param parent */ @Override public void setParent(IConcurrentScanChild parent) { this.parent = parent; } @Override public IConcurrentScanChild getChild() { return (IConcurrentScanChild) super.child; } /** * @param child */ @Override public void setChild(IConcurrentScanChild child) { this.child = child; } /** * @return Returns the scannableLevels. */ @Override public TreeMap<Integer, Scannable[]> getScannableLevels() { return scannableLevels; } /** * @param scannableLevels The scannableLevels to set. */ @Override public void setScannableLevels(TreeMap<Integer, Scannable[]> scannableLevels) { this.scannableLevels = scannableLevels; } /** * @return Returns the allScanObjects. */ @Override public Vector<ScanObject> getAllScanObjects() { return allScanObjects; } /** * @param allScanObjects The allScanObjects to set. */ @Override public void setAllScanObjects(Vector<ScanObject> allScanObjects) { this.allScanObjects = allScanObjects; } /** * @return Returns the allChildScans. */ @Override public Vector<IConcurrentScanChild> getAllChildScans() { return allChildScans; } /** * @param allChildScans The allChildScans to set. */ @Override public void setAllChildScans(Vector<IConcurrentScanChild> allChildScans) { this.allChildScans = allChildScans; } /** * @return Returns the insideMultiScan. */ public static boolean isInsideMultiScan() { return insideMultiScan; } /** * @param insideMultiScan The insideMultiScan to set. */ public static void setInsideMultiScan(boolean insideMultiScan) { ScanBase.insideMultiScan = insideMultiScan; } /** * @return Returns the allScannables. */ @Override public Vector<Scannable> getAllScannables() { return allScannables; } /** * @param allScannables The allScannables to set. */ @Override public void setAllScannables(Vector<Scannable> allScannables) { this.allScannables = allScannables; } /** * @return Returns the allDetectors. */ @Override public Vector<Detector> getAllDetectors() { return allDetectors; } /** * @param allDetectors The allDetectors to set. */ @Override public void setAllDetectors(Vector<Detector> allDetectors) { this.allDetectors = allDetectors; } /** * @return Returns the command. */ @Override public String getCommand() { return command; } @Override public void setCommand(String command) { this.command = command; } public void setMustBeFinal(boolean mustBeFinal) { this.mustBeFinal = mustBeFinal; } @Override public boolean isMustBeFinal() { return mustBeFinal; } @Override public void setTotalNumberOfPoints(int totalNumberOfPoints) { TotalNumberOfPoints = totalNumberOfPoints; } /** * Moves to the next step unless start is true, then moves to the start of the current (possibly child) scan. * @throws Exception */ protected void acquirePoint(boolean start, boolean collectDetectors) throws Exception { TreeMap<Integer, Scannable[]> devicesToMoveByLevel; if(collectDetectors) { devicesToMoveByLevel = generateDevicesToMoveByLevel(scannableLevels, allDetectors); } else { devicesToMoveByLevel = scannableLevels; } for (Integer thisLevel : devicesToMoveByLevel.keySet()) { Scannable[] scannablesAtThisLevel = devicesToMoveByLevel.get(thisLevel); // If there is a detector at this level then wait for detector readout thread to complete for (Scannable scannable : scannablesAtThisLevel) { if (scannable instanceof Detector) { waitForDetectorReadoutAndPublishCompletion(); break; } } // trigger at level move start on all Scannables for (Scannable scannable : scannablesAtThisLevel) { if (isScannableToBeMoved(scannable) != null) { if (isScannableToBeMoved(scannable).hasStart()) { scannable.atLevelMoveStart(); } } } // on detectors (technically scannables) that implement DetectorWithReadout call waitForReadoutComplete for (Scannable scannable : scannablesAtThisLevel) { if (scannable instanceof DetectorWithReadout) { if (!detectorWithReadoutDeprecationWarningGiven ) { logger.warn("The DetectorWithReadout interface is deprecated. Set gda.scan.concurrentScan.readoutConcurrently to true instead (after reading the 8.24 release note"); detectorWithReadoutDeprecationWarningGiven = true; } ((DetectorWithReadout) scannable).waitForReadoutCompletion(); } } for (Scannable device : scannablesAtThisLevel) { if (!(device instanceof Detector)) { // does this scan (is a hierarchy of nested scans) operate this scannable? ScanObject scanObject = isScannableToBeMoved(device); if (scanObject != null) { if (start) { scanObject.moveToStart(); } else { scanObject.moveStep(); } } } else { ((Detector) device).collectData(); } } // pause here until all the scannables at this level have finished moving for (Entry<Integer, Scannable[]> entriesByLevel : devicesToMoveByLevel.entrySet()) { Scannable[] scannablesAtLevel = entriesByLevel.getValue(); for (int i = 0; i < scannablesAtLevel.length; i++) { Scannable scn = scannablesAtLevel[i]; scn.waitWhileBusy(); } } } } TreeMap<Integer, Scannable[]> generateDevicesToMoveByLevel(TreeMap<Integer, Scannable[]> scannableLevels, Vector<Detector> detectors) { TreeMap<Integer, Scannable[]> devicesToMoveByLevel = new TreeMap<Integer, Scannable[]>(); devicesToMoveByLevel.putAll(scannableLevels); for (Scannable detector : detectors) { Integer level = detector.getLevel(); if (devicesToMoveByLevel.containsKey(level)) { Scannable[] levelArray = devicesToMoveByLevel.get(level); levelArray = (Scannable[]) ArrayUtils.add(levelArray, detector); devicesToMoveByLevel.put(level, levelArray); } else { Scannable[] levelArray = new Scannable[] { detector }; devicesToMoveByLevel.put(level, levelArray); } } return devicesToMoveByLevel; } /** * Asks if the given scannable is part of the array of scannables which this scan is to operate in its moveToStarts * and moveBySteps methods. If true returns the ScanObject else returns null. * * @param scannable * @return the ScanObject */ protected ScanObject isScannableToBeMoved(Scannable scannable) { for (ScanObject scanObject : allScanObjects) { if (scanObject.scannable == scannable) { return scanObject; } } return null; } final protected boolean isScannableActuallyToBeMoved(Scannable scannable) { ScanObject scannableToBeMoved = isScannableToBeMoved(scannable); return (scannableToBeMoved) == null ? false : scannableToBeMoved.hasStart(); } /* * Waits until all the scannables of this scan are no longer moving. @throws InterruptedException */ protected void checkAllMovesComplete() throws Exception { for (ScanObject scanObject : allScanObjects) { checkForInterrupts(); // only check those objects which we have moved are no longer busy if (scanObject.hasStart()) { scanObject.scannable.waitWhileBusy(); } } } @Override protected synchronized void setUp() { super.setUp(); // setUp may have removed objects using the Detector interface. // This scan needs its allScanObjects vector to keep to the same order as allScannables // TODO: very dangerous! reorderAllScanObjects(); } /* * Called during instantiation but after the setUp method has been called. The setUp method will have edited and * reordered the allScannables vector. The allScanObjects vector must now be reordered to keep track of this. In * doing this, any objects using the Detector interface in the allScanObjects vector will be removed. */ protected void reorderAllScanObjects() { Vector<ScanObject> sortedAllScanObjects = new Vector<ScanObject>(); int i = 0; for (Object nextObject : allScannables) { for (ScanObject nextScanObject : allScanObjects) { if (nextScanObject.scannable.equals(nextObject)) { sortedAllScanObjects.add(i, nextScanObject); i++; } } } allScanObjects = sortedAllScanObjects; // now save information about which scannables are at each level scannableLevels = new TreeMap<Integer, Scannable[]>(); // loop through all levels saving the amount of scannables at each level for (Scannable scannable : allScannables) { Integer thisLevel = scannable.getLevel(); if (scannableLevels.containsKey(thisLevel)){ Scannable[] levelArray = scannableLevels.get(thisLevel); levelArray = (Scannable[]) ArrayUtils.add(levelArray,scannable); scannableLevels.put(thisLevel, levelArray); } else { Scannable[] levelArray = new Scannable[]{scannable}; scannableLevels.put(thisLevel, levelArray); } } } private class ReadoutDetector implements Callable<Object> { private final Detector detector; public ReadoutDetector(Detector detector) { this.detector = detector; } @Override public Object call() throws Exception { try { return detector.readout(); } catch (Exception e) { logger.info("Exeption reading out detector '" + detector.getName() + "': " + representThrowable(e) + "(first readout exception will be thrown soon from scan thread)"); throw e; } } } /** * Asynchronously, readout detectors using parallel threads into ScanDataPoint and add to pipeline for possible * completion and publishing. Call {@link ConcurrentScanChild#waitForDetectorReadoutAndPublishCompletion()} to wait * for this task to complete, or {@link #cancelReadoutAndPublishCompletion()} to cancel and interrupt it. * <p> * If the property {@link LocalProperties#GDA_SCAN_CONCURRENTSCAN_READOUT_CONCURRENTLY} is its default false value * then simply block while reading out each detector in series and then adding the ScanDataPoint to the pipeline. * * @param point * @throws Exception */ @Override protected void readoutDetectorsAndPublish(final ScanDataPoint point) throws Exception { final boolean lastPointInLine = (getPointPositionInLine() == PointPositionInLine.LAST); // latch value if (!isReadoutConcurrent()) { super.readoutDetectorsAndPublish(point); return; } // Make sure the previous point has read been published // (If the scan contains a detector this method will already have been called) waitForDetectorReadoutAndPublishCompletion(); detectorReadoutTask = new FutureTask<Void>(new Callable<Void>() { List<Future<Object>> readoutTasks; /** * Readout each detector in a thread, add the resulting data to the ScanDataPoint and publish. */ @Override public Void call() throws Exception { try { Vector<Detector> detectors = point.getDetectors(); // if there are detectors then readout in parallel threads if (detectors.size() != 0) { ExecutorService threadPool = Executors.newFixedThreadPool(detectors.size()); // Start readout tasks readoutTasks = new ArrayList<Future<Object>>(detectors.size()); for (Detector detector : point.getDetectors()) { readoutTasks.add(threadPool.submit(new ReadoutDetector(detector))); } // Wait for readout results and put into point for (int i = 0; i < detectors.size(); i++) { if (Thread.interrupted()) { throw new InterruptedException(); // can't trust devices to look for these } checkForInterrupts(); // checks only ScanBase.interupted and may pause Object data = readoutTasks.get(i).get(); point.addDetectorData(data, ScannableUtils.getExtraNamesFormats(detectors.get(i))); } } // Put point onto pipeline checkForInterrupts(); scanDataPointPipeline.put(point); // may block checkForInterrupts(); // The main scan thread cannot call atPointEnd (and subsequently atPointStart) in the correct order // with respect to readout so call these here instead. for (Detector detector : detectors) { detector.atPointEnd(); } // unless this is the last point in the line, call atPointStart hooks for the next point (the one // that main scan thread is now working on. if (! lastPointInLine) { for (Detector detector : detectors) { detector.atPointStart(); } } } catch (Exception e) { // could be the normal result of cancelling this task // (detector.readout() unfortunately doesn't distinguish InteruptedException from DeviceException logger.info("'" + representThrowable(e) + "' --- while reading out detectors. *Canceling any remaining readout tasks.*"); for (Future<Object> task : readoutTasks) { task.cancel(true); } throw e; } return null; } }); String threadName = "ConcurrentScanChild.readoutDetectorsAndPublish(point '" + point.toString() + "')"; new Thread(detectorReadoutTask, threadName).start(); } /** * Blocks while detectors are readout and point is added to pipeline. Throws an exception if one was * thrown while reading out the detectors or adding the point to the pipeline. */ @Override public void waitForDetectorReadoutAndPublishCompletion() throws InterruptedException, ExecutionException { try { if (detectorReadoutTask != null) { detectorReadoutTask.get(); // exceptions, for example from readout, will be thrown here } } catch (InterruptedException e) { cancelReadoutAndPublishCompletion(); throw e; } catch (ExecutionException e) { cancelReadoutAndPublishCompletion(); throw e; } } /** * Cancels readout and publish completion task. */ @Override public void cancelReadoutAndPublishCompletion () { if (detectorReadoutTask != null) { detectorReadoutTask.cancel(true); } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
8062842afa179aa972783607638dc20f2f8bb14e
364ab93b38d3942fc1e8a30b7edcc0be8f6612ef
/Example/android/app/src/main/java/com/example/MainApplication.java
6f58f5f90e1abf6932dc807657bed1e943cbd6f5
[ "MIT" ]
permissive
SoftZen/react-native-bouncy-drawer
45d47f0c58651b774732874fe84a78b4a669b5f5
8947540904f43ce57c32e3e1b47777f60e7ffcd3
refs/heads/master
2021-05-15T09:44:18.538252
2018-06-19T20:17:37
2018-06-19T20:17:37
106,456,187
159
17
MIT
2018-09-09T06:35:50
2017-10-10T18:32:29
JavaScript
UTF-8
Java
false
false
1,132
java
package com.example; import android.app.Application; import com.facebook.react.ReactApplication; import com.oblador.vectoricons.VectorIconsPackage; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.react.shell.MainReactPackage; import com.facebook.soloader.SoLoader; import java.util.Arrays; import java.util.List; public class MainApplication extends Application implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected List<ReactPackage> getPackages() { return Arrays.<ReactPackage>asList( new MainReactPackage(), new VectorIconsPackage() ); } @Override protected String getJSMainModuleName() { return "index"; } }; @Override public ReactNativeHost getReactNativeHost() { return mReactNativeHost; } @Override public void onCreate() { super.onCreate(); SoLoader.init(this, /* native exopackage */ false); } }
[ "azlibe1995@gmail.com" ]
azlibe1995@gmail.com
6ffc00340ace612afba5c8361ec14a5352d64669
3e71c5cb7dbe37c26f72b0f2d04c74a70e11dc39
/Advanced/week10/Addition.java
65fba18c7d9647043d0c2ed745017e1c92b3c686
[]
no_license
ggc-itec/ITEC-Source
acb51eb04205069c65d42db1647ad0a5f4814162
29fc716426d002aa0b839a1c28d9b4ae774e8dc8
refs/heads/master
2021-01-01T15:17:47.910234
2013-11-03T04:08:31
2013-11-03T04:08:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
105
java
package week10; public class Addition { public int add(int x, int y) { return x + y; } }
[ "tacksoo.im@gmail.com" ]
tacksoo.im@gmail.com
b3473a0f916626dd73f78082f4d13d079964dc40
adfbd37e067c428b974d1250ecb3ba80a4140603
/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupQueueServiceImpl.java
c9c1eba5afb2989e15378dc22205217ab42d773e
[ "Apache-2.0", "BSD-3-Clause" ]
permissive
caosuwenwu/incubator-dolphinscheduler
5ed0bc6113cafb874f20b834fc2e972749de7dc1
34cfdfe80df9e5338a0424c6a69e9c789d916e12
refs/heads/dev
2022-09-07T22:23:47.667486
2022-08-29T06:11:09
2022-08-29T06:11:09
242,884,794
1
0
Apache-2.0
2020-03-01T12:08:34
2020-02-25T01:48:26
null
UTF-8
Java
false
false
5,678
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.api.service.impl; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.TaskGroupQueueService; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.AuthorizationType; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.TaskGroupQueue; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import org.apache.dolphinscheduler.dao.mapper.TaskGroupQueueMapper; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; /** * task group queue service */ @Service public class TaskGroupQueueServiceImpl extends BaseServiceImpl implements TaskGroupQueueService { @Autowired TaskGroupQueueMapper taskGroupQueueMapper; @Autowired private ProjectMapper projectMapper; private static final Logger logger = LoggerFactory.getLogger(TaskGroupQueueServiceImpl.class); /** * query tasks in task group queue by group id * * @param loginUser login user * @param groupId group id * @param pageNo page no * @param pageSize page size * @return tasks list */ @Override public Map<String, Object> queryTasksByGroupId(User loginUser, String taskName , String processName, Integer status, int groupId, int pageNo, int pageSize) { Map<String, Object> result = new HashMap<>(); Page<TaskGroupQueue> page = new Page<>(pageNo, pageSize); PageInfo<TaskGroupQueue> pageInfo = new PageInfo<>(pageNo, pageSize); Set<Integer> projectIds = resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.PROJECTS, loginUser.getId(), logger); if (projectIds.isEmpty()) { result.put(Constants.DATA_LIST, pageInfo); putMsg(result, Status.SUCCESS); return result; } List<Project> projects = projectMapper.selectBatchIds(projectIds); IPage<TaskGroupQueue> taskGroupQueue = taskGroupQueueMapper.queryTaskGroupQueueByTaskGroupIdPaging(page, taskName ,processName,status,groupId,projects); pageInfo.setTotal((int) taskGroupQueue.getTotal()); pageInfo.setTotalList(taskGroupQueue.getRecords()); result.put(Constants.DATA_LIST, pageInfo); putMsg(result, Status.SUCCESS); return result; } /** * query tasks in task group queue by project id * * @param loginUser login user * @param pageNo page no * @param pageSize page size * @param processId process id * @return tasks list */ @Override public Map<String, Object> queryTasksByProcessId(User loginUser, int pageNo, int pageSize, int processId) { return this.doQuery(loginUser, pageNo, pageSize, processId); } /** * query all tasks in task group queue * * @param loginUser login user * @param pageNo page no * @param pageSize page size * @return tasks list */ @Override public Map<String, Object> queryAllTasks(User loginUser, int pageNo, int pageSize) { return this.doQuery(loginUser, pageNo, pageSize, 0); } public Map<String, Object> doQuery(User loginUser, int pageNo, int pageSize, int groupId) { Map<String, Object> result = new HashMap<>(); Page<TaskGroupQueue> page = new Page<>(pageNo, pageSize); IPage<TaskGroupQueue> taskGroupQueue = taskGroupQueueMapper.queryTaskGroupQueuePaging(page, groupId); PageInfo<TaskGroupQueue> pageInfo = new PageInfo<>(pageNo, pageSize); pageInfo.setTotal((int) taskGroupQueue.getTotal()); pageInfo.setTotalList(taskGroupQueue.getRecords()); result.put(Constants.DATA_LIST, pageInfo); putMsg(result, Status.SUCCESS); return result; } /** * delete by task id * * @param taskId task id * @return TaskGroupQueue entity */ @Override public boolean deleteByTaskId(int taskId) { return taskGroupQueueMapper.deleteByTaskId(taskId) == 1; } @Override public void forceStartTask(int queueId,int forceStart) { taskGroupQueueMapper.updateForceStart(queueId,forceStart); } @Override public void modifyPriority(Integer queueId, Integer priority) { taskGroupQueueMapper.modifyPriority(queueId,priority); } }
[ "noreply@github.com" ]
noreply@github.com
1bbd3e5c9b85a724e6db20e02a5f93fb47f0f154
53d39f4b06ba03e2830515c9f4415cee64f4f3af
/wyqp/wyqp-common/src/main/java/cn/worldwalker/game/wyqp/common/service/BaseGameService.java
a8c7eff1478e1a9d347a6ccaa5b82edd725e68cd
[]
no_license
worldwalker77/platform.my
d1971e6565e3bc54f8f68794e0ae1744e21eb155
84ab073707fb92165c844062b68010f2997fd9bc
refs/heads/master
2021-08-22T11:02:56.420877
2017-11-30T02:15:46
2017-11-30T02:15:46
112,552,577
0
0
null
null
null
null
UTF-8
Java
false
false
44,606
java
package cn.worldwalker.game.wyqp.common.service; import io.netty.channel.ChannelHandlerContext; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.SortedMap; import java.util.concurrent.locks.ReentrantLock; import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.annotation.Autowired; import cn.worldwalker.game.wyqp.common.channel.ChannelContainer; import cn.worldwalker.game.wyqp.common.constant.Constant; import cn.worldwalker.game.wyqp.common.domain.base.BaseMsg; import cn.worldwalker.game.wyqp.common.domain.base.BasePlayerInfo; import cn.worldwalker.game.wyqp.common.domain.base.BaseRequest; import cn.worldwalker.game.wyqp.common.domain.base.BaseRoomInfo; import cn.worldwalker.game.wyqp.common.domain.base.OrderModel; import cn.worldwalker.game.wyqp.common.domain.base.ProductModel; import cn.worldwalker.game.wyqp.common.domain.base.RedisRelaModel; import cn.worldwalker.game.wyqp.common.domain.base.UserFeedbackModel; import cn.worldwalker.game.wyqp.common.domain.base.UserInfo; import cn.worldwalker.game.wyqp.common.domain.base.UserModel; import cn.worldwalker.game.wyqp.common.domain.base.UserRecordModel; import cn.worldwalker.game.wyqp.common.domain.base.WeiXinUserInfo; import cn.worldwalker.game.wyqp.common.enums.ChatTypeEnum; import cn.worldwalker.game.wyqp.common.enums.DissolveStatusEnum; import cn.worldwalker.game.wyqp.common.enums.GameTypeEnum; import cn.worldwalker.game.wyqp.common.enums.MsgTypeEnum; import cn.worldwalker.game.wyqp.common.enums.OnlineStatusEnum; import cn.worldwalker.game.wyqp.common.enums.PayStatusEnum; import cn.worldwalker.game.wyqp.common.enums.PayTypeEnum; import cn.worldwalker.game.wyqp.common.enums.PlayerStatusEnum; import cn.worldwalker.game.wyqp.common.enums.RoomStatusEnum; import cn.worldwalker.game.wyqp.common.exception.BusinessException; import cn.worldwalker.game.wyqp.common.exception.ExceptionEnum; import cn.worldwalker.game.wyqp.common.manager.CommonManager; import cn.worldwalker.game.wyqp.common.result.Result; import cn.worldwalker.game.wyqp.common.roomlocks.RoomLockContainer; import cn.worldwalker.game.wyqp.common.rpc.WeiXinRpc; import cn.worldwalker.game.wyqp.common.utils.GameUtil; import cn.worldwalker.game.wyqp.common.utils.IPUtil; import cn.worldwalker.game.wyqp.common.utils.UrlImgDownLoadUtil; import cn.worldwalker.game.wyqp.common.utils.wxpay.DateUtils; import cn.worldwalker.game.wyqp.common.utils.wxpay.HttpUtil; import cn.worldwalker.game.wyqp.common.utils.wxpay.MapUtils; import cn.worldwalker.game.wyqp.common.utils.wxpay.PayCommonUtil; import cn.worldwalker.game.wyqp.common.utils.wxpay.WeixinConstant; import cn.worldwalker.game.wyqp.common.utils.wxpay.XMLUtil; import com.google.common.base.Charsets; import com.google.common.collect.ImmutableMap; public abstract class BaseGameService { public final static Log log = LogFactory.getLog(BaseGameService.class); @Autowired public RedisOperationService redisOperationService; @Autowired public ChannelContainer channelContainer; @Autowired public CommonManager commonManager; @Autowired public WeiXinRpc weiXinRpc; public Result login(String code, String deviceType, HttpServletRequest request) { Result result = new Result(); if (StringUtils.isBlank(code)) { throw new BusinessException(ExceptionEnum.PARAMS_ERROR); } WeiXinUserInfo weixinUserInfo = weiXinRpc.getWeiXinUserInfo(code); if (null == weixinUserInfo) { throw new BusinessException(ExceptionEnum.QUERY_WEIXIN_USER_INFO_FAIL); } UserModel userModel = commonManager.getUserByWxOpenId(weixinUserInfo.getOpneid()); if (null == userModel) { userModel = new UserModel(); userModel.setNickName(weixinUserInfo.getName()); userModel.setHeadImgUrl(weixinUserInfo.getHeadImgUrl()); userModel.setWxOpenId(weixinUserInfo.getOpneid()); userModel.setRoomCardNum(10); commonManager.insertUser(userModel); } /**从redis查看此用户是否有roomId*/ Integer roomId = null; RedisRelaModel redisRelaModel = redisOperationService.getRoomIdGameTypeByPlayerId(userModel.getPlayerId()); if (redisRelaModel != null) { roomId = redisRelaModel.getRoomId(); } UserInfo userInfo = new UserInfo(); userInfo.setPlayerId(userModel.getPlayerId()); userInfo.setRoomId(roomId); userInfo.setNickName(weixinUserInfo.getName()); userInfo.setLevel(userModel.getUserLevel() == null ? 1 : userModel.getUserLevel()); userInfo.setServerIp(Constant.localIp); userInfo.setPort(String.valueOf(Constant.websocketPort)); userInfo.setRemoteIp(IPUtil.getRemoteIp(request)); String loginToken = GameUtil.genToken(userModel.getPlayerId()); // userInfo.setHeadImgUrl(UrlImgDownLoadUtil.getLocalImgUrl(weixinUserInfo.getHeadImgUrl(), userModel.getPlayerId())); userInfo.setHeadImgUrl(weixinUserInfo.getHeadImgUrl()); userInfo.setToken(loginToken); /**设置赢牌概率*/ userInfo.setWinProbability(userModel.getWinProbability()); redisOperationService.setUserInfo(loginToken, userInfo); /****-------*/ // redisOperationService.hdelOfflinePlayerIdRoomIdGameTypeTime(userModel.getPlayerId()); userInfo.setRoomCardNum(userModel.getRoomCardNum()); result.setData(userInfo); return result; } public Result login1(String code, String deviceType,HttpServletRequest request) { Result result = new Result(); Integer roomId = null; Integer playerId = GameUtil.genPlayerId(); UserInfo userInfo = new UserInfo(); userInfo.setPlayerId(playerId); userInfo.setRoomId(roomId); userInfo.setNickName("nickName_" + playerId); userInfo.setLevel(1); userInfo.setServerIp(Constant.localIp); userInfo.setPort(String.valueOf(Constant.websocketPort)); userInfo.setRemoteIp(IPUtil.getRemoteIp(request)); String loginToken =GameUtil.genToken(playerId); userInfo.setToken(loginToken); userInfo.setHeadImgUrl("http://wx.qlogo.cn/mmopen/wibbRT31wkCR4W9XNicL2h2pgaLepmrmEsXbWKbV0v9ugtdibibDgR1ybONiaWFtVeVtYWGWhObRiaiaicMgw8zat8Y5p6YzQbjdstE2/0"); redisOperationService.setUserInfo(loginToken, userInfo); userInfo.setRoomCardNum(10); result.setData(userInfo); return result; } public void entryHall(ChannelHandlerContext ctx, BaseRequest request, UserInfo userInfo){ Result result = null; result = new Result(); result.setMsgType(MsgTypeEnum.entryHall.msgType); Integer playerId = request.getMsg().getPlayerId(); /**将channel与playerId进行映射*/ channelContainer.addChannel(ctx, playerId); channelContainer.sendTextMsgByPlayerIds(result, playerId); notice(ctx, request, userInfo); } public void createRoom(ChannelHandlerContext ctx, BaseRequest request, UserInfo userInfo){ Result result = null; BaseMsg msg = request.getMsg(); RedisRelaModel redisRelaModel = redisOperationService.getRoomIdGameTypeByPlayerId(msg.getPlayerId()); if (redisRelaModel != null) { throw new BusinessException(ExceptionEnum.ALREADY_IN_ROOM.index, ExceptionEnum.ALREADY_IN_ROOM.description + ",房间号:" + redisRelaModel.getRoomId()); } /**校验房卡数量是否足够*/ //TODO if (redisOperationService.isLoginFuseOpen()) { commonManager.roomCardCheck(userInfo.getPlayerId(), request.getGameType(), msg.getPayType(), msg.getTotalGames()); } Integer roomId = GameUtil.genRoomId(); int i = 0; while(i < 3){ /**如果不存在则跳出循环,此房间号可以使用*/ if (!redisOperationService.isRoomIdExist(roomId)) { break; } /**如果此房间号存在则重新生成*/ roomId = GameUtil.genRoomId(); i++; if (i >= 3) { throw new BusinessException(ExceptionEnum.GEN_ROOM_ID_FAIL); } } /**将当前房间号设置到userInfo中*/ userInfo.setRoomId(roomId); redisOperationService.setUserInfo(request.getToken(), userInfo); /**doCreateRoom抽象方法由具体实现类去实现*/ BaseRoomInfo roomInfo = doCreateRoom(ctx, request, userInfo); /**组装房间对象*/ roomInfo.setRoomId(roomId); roomInfo.setRoomOwnerId(msg.getPlayerId()); roomInfo.setPayType(msg.getPayType()); roomInfo.setTotalGames(msg.getTotalGames()); roomInfo.setPlayerNumLimit(msg.getPlayerNumLimit()==null?12:msg.getPlayerNumLimit()); roomInfo.setCurGame(0); roomInfo.setStatus(RoomStatusEnum.justBegin.status); roomInfo.setServerIp(Constant.localIp); Date date = new Date(); roomInfo.setCreateTime(date); roomInfo.setUpdateTime(date); List playerList = roomInfo.getPlayerList(); BasePlayerInfo playerInfo = (BasePlayerInfo)playerList.get(0); playerInfo.setPlayerId(msg.getPlayerId()); playerInfo.setLevel(1); playerInfo.setOrder(1); playerInfo.setStatus(PlayerStatusEnum.notReady.status); playerInfo.setOnlineStatus(OnlineStatusEnum.online.status); playerInfo.setRoomCardNum(10); playerInfo.setWinTimes(0); playerInfo.setLoseTimes(0); /**设置地理位置信息*/ playerInfo.setAddress(userInfo.getAddress()); playerInfo.setX(userInfo.getX()); playerInfo.setY(userInfo.getY()); /**设置当前用户ip*/ playerInfo.setIp(userInfo.getRemoteIp()); playerInfo.setNickName(userInfo.getNickName()); playerInfo.setHeadImgUrl(userInfo.getHeadImgUrl()); /**概率控制*/ playerInfo.setWinProbability(userInfo.getWinProbability()); redisOperationService.setRoomIdGameTypeUpdateTime(roomId, request.getGameType(), new Date()); redisOperationService.setRoomIdRoomInfo(roomId, roomInfo); redisOperationService.setPlayerIdRoomIdGameType(userInfo.getPlayerId(), roomId, request.getGameType()); /**设置返回信息*/ result = new Result(); result.setMsgType(MsgTypeEnum.createRoom.msgType); result.setGameType(request.getGameType()); result.setData(roomInfo); channelContainer.sendTextMsgByPlayerIds(result, userInfo.getPlayerId()); /**设置房间锁,此房间的请求排队进入*/ RoomLockContainer.setLockByRoomId(roomId, new ReentrantLock()); } public abstract BaseRoomInfo doCreateRoom(ChannelHandlerContext ctx, BaseRequest request, UserInfo userInfo); public void entryRoom(ChannelHandlerContext ctx, BaseRequest request, UserInfo userInfo) { Result result = null; BaseMsg msg = request.getMsg(); Integer playerId = userInfo.getPlayerId(); /**进入房间的时候,房间号参数是前台传过来的,所以不能从userInfo里面取得*/ Integer roomId = msg.getRoomId(); /**参数为空*/ if (roomId == null) { throw new BusinessException(ExceptionEnum.PARAMS_ERROR); } if (!redisOperationService.isRoomIdExist(roomId)) { throw new BusinessException(ExceptionEnum.ROOM_ID_NOT_EXIST); } BaseRoomInfo roomInfo = doEntryRoom(ctx, request, userInfo); /**如果是麻将(金花和牛牛除外),那么游戏已经开始,则不允许再加入 add by liujinfengnew*/ if (roomInfo.getGameType().equals(GameTypeEnum.mj.gameType)) { if (roomInfo.getStatus() > RoomStatusEnum.justBegin.status) { throw new BusinessException(ExceptionEnum.NOT_IN_READY_STATUS); } } if (redisOperationService.isLoginFuseOpen()) { /**如果是aa支付,则校验房卡数量是否足够*/ if (PayTypeEnum.AAPay.type.equals(roomInfo.getPayType())) { commonManager.roomCardCheck(userInfo.getPlayerId(), request.getGameType(), roomInfo.getPayType(), roomInfo.getTotalGames()); } } List playerList = roomInfo.getPlayerList(); int size = playerList.size(); /**最多12个玩家*/ if (size >= roomInfo.getPlayerNumLimit()) { throw new BusinessException(ExceptionEnum.EXCEED_MAX_PLAYER_NUM); } userInfo.setRoomId(roomId); redisOperationService.setUserInfo(request.getToken(), userInfo); boolean isExist = false; for(int i = 0; i < playerList.size(); i++ ){ BasePlayerInfo tempPlayerInfo = (BasePlayerInfo)playerList.get(i); /**如果加入的玩家id已经存在*/ if (playerId.equals(tempPlayerInfo.getPlayerId())) { isExist = true; break; } } /**如果申请加入房间的玩家已经存在房间中,则只需要走刷新接口*/ if (isExist) { playerList.remove(playerList.size() - 1); refreshRoom(ctx, request, userInfo); return; } /**取list最后一个,即为本次加入的玩家,设置公共信息*/ BasePlayerInfo playerInfo = (BasePlayerInfo)playerList.get(playerList.size() - 1); playerInfo.setPlayerId(userInfo.getPlayerId()); playerInfo.setNickName(userInfo.getNickName()); playerInfo.setHeadImgUrl(userInfo.getHeadImgUrl()); playerInfo.setLevel(1); /***/ BasePlayerInfo lastPlayerInfo = (BasePlayerInfo)playerList.get(playerList.size() - 2); playerInfo.setOrder(lastPlayerInfo.getOrder() + 1); /**加入房间的时候,需要判断当前房间的状态,确定新加入的玩家应该是什么状态*/ if (roomInfo.getStatus().equals(RoomStatusEnum.justBegin.status) ) {//刚开始准备 playerInfo.setStatus(PlayerStatusEnum.notReady.status); }else if(roomInfo.getStatus().equals(RoomStatusEnum.curGameOver.status) ){//小局结束 playerInfo.setStatus(PlayerStatusEnum.notReady.status); }else if(roomInfo.getStatus().equals(RoomStatusEnum.totalGameOver.status) ){//一圈结束 throw new BusinessException(ExceptionEnum.TOTAL_GAME_OVER); }else{//其他状态 playerInfo.setStatus(PlayerStatusEnum.observer.status); } playerInfo.setOnlineStatus(OnlineStatusEnum.online.status); playerInfo.setRoomCardNum(10); playerInfo.setWinTimes(0); playerInfo.setLoseTimes(0); playerInfo.setIp(userInfo.getRemoteIp()); /**设置地理位置信息*/ playerInfo.setAddress(userInfo.getAddress()); playerInfo.setX(userInfo.getX()); playerInfo.setY(userInfo.getY()); /**概率控制*/ playerInfo.setWinProbability(userInfo.getWinProbability()); roomInfo.setUpdateTime(new Date()); redisOperationService.setRoomIdGameTypeUpdateTime(roomId, request.getGameType(), new Date()); redisOperationService.setRoomIdRoomInfo(roomId, roomInfo); redisOperationService.setPlayerIdRoomIdGameType(userInfo.getPlayerId(), roomId, request.getGameType()); result = new Result(); /**如果是麻将,则走正常逻辑返回房间信息*/ if (roomInfo.getGameType().equals(GameTypeEnum.mj.gameType)) { result.setGameType(request.getGameType()); result.setMsgType(MsgTypeEnum.entryRoom.msgType); result.setData(roomInfo); /**给此房间中的所有玩家发送消息*/ channelContainer.sendTextMsgByPlayerIds(result, GameUtil.getPlayerIdArr(playerList)); }else{/**如果是炸金花或者斗牛,由于需要玩家随时可以加入,所以需要通过刷新接口给每个玩家返回房间信息*/ refreshRoomForAllPlayer(roomInfo); } } public void refreshRoomForAllPlayer(BaseRoomInfo roomInfo){ Result result = new Result(); result.setGameType(roomInfo.getGameType()); result.setMsgType(MsgTypeEnum.refreshRoom.msgType); List playerList = roomInfo.getPlayerList(); int size = playerList.size(); UserInfo userInfo = new UserInfo(); BasePlayerInfo playerInfo = null; for(int i = 0; i < size; i++){ playerInfo = (BasePlayerInfo)playerList.get(i); userInfo.setRoomId(roomInfo.getRoomId()); userInfo.setPlayerId(playerInfo.getPlayerId()); /**复用刷新接口*/ List<BaseRoomInfo> roomInfoList = doRefreshRoom(null, null, userInfo); BaseRoomInfo returnRoomInfo = roomInfoList.get(1); result.setData(returnRoomInfo); /**返回给当前玩家刷新信息*/ channelContainer.sendTextMsgByPlayerIds(result, playerInfo.getPlayerId()); } } public abstract BaseRoomInfo doEntryRoom(ChannelHandlerContext ctx, BaseRequest request, UserInfo userInfo); public void dissolveRoom(ChannelHandlerContext ctx, BaseRequest request, UserInfo userInfo) { Result result = new Result(); Map<String, Object> data = new HashMap<String, Object>(); result.setData(data); result.setGameType(request.getGameType()); Integer playerId = userInfo.getPlayerId(); Integer roomId = userInfo.getRoomId(); BaseRoomInfo roomInfo = getRoomInfo(ctx, request, userInfo); List playerList = roomInfo.getPlayerList(); if (!GameUtil.isExistPlayerInRoom(playerId, playerList)) { throw new BusinessException(ExceptionEnum.PLAYER_NOT_IN_ROOM); } GameUtil.setDissolveStatus(playerList, playerId, DissolveStatusEnum.agree); roomInfo.setUpdateTime(new Date()); redisOperationService.setRoomIdRoomInfo(roomId, roomInfo); redisOperationService.setRoomIdGameTypeUpdateTime(roomId, new Date()); if (playerList.size() == 1) { /**解散房间*/ redisOperationService.cleanPlayerAndRoomInfo(roomId, GameUtil.getPlayerIdStrArr(playerList)); /**将用户缓存信息里面的roomId设置为null*/ userInfo.setRoomId(null); redisOperationService.setUserInfo(request.getToken(), userInfo); result.setMsgType(MsgTypeEnum.successDissolveRoom.msgType); data.put("roomId", roomId); channelContainer.sendTextMsgByPlayerIds(result, playerId); return; } Integer playerStatus = GameUtil.getPlayerStatus(playerList, playerId); /**如果玩家的状态是观察者,并且一局都没有玩过,则随时可以退出*/ if (playerStatus.equals(PlayerStatusEnum.observer.status) && GameUtil.getPlayedCountByPlayerId(playerList, playerId) < 1) { /**删除玩家*/ GameUtil.removePlayer(playerList, playerId); redisOperationService.cleanPlayerAndRoomInfoForSignout(roomId, String.valueOf(playerId)); redisOperationService.setRoomIdRoomInfo(roomId, roomInfo); /**将用户缓存信息里面的roomId设置为null*/ userInfo.setRoomId(null); redisOperationService.setUserInfo(request.getToken(), userInfo); result.setMsgType(MsgTypeEnum.entryHall.msgType); /**当前玩家返回大厅*/ channelContainer.sendTextMsgByPlayerIds(result, playerId); /**其他玩家通知刷新*/ refreshRoomForAllPlayer(roomInfo); return; } /**如果玩家的状态是未准备,并且房间状态是最开始准备阶段,则玩家可以退出*/ if (playerStatus.equals(PlayerStatusEnum.notReady.status) && roomInfo.getStatus().equals(RoomStatusEnum.justBegin.status)) { /**如果在游戏最开始准备阶段退出的是庄家(即房主),则需要设置一个默认的庄家(房主),当前退出庄家的下家*/ if (roomInfo.getRoomBankerId().equals(playerId)) { Integer tempId = GameUtil.getNextPlayerId(playerList, playerId); roomInfo.setRoomOwnerId(tempId); if (request.getGameType().equals(GameTypeEnum.jh.gameType)) { roomInfo.setRoomBankerId(tempId); } } /**删除玩家*/ GameUtil.removePlayer(playerList, playerId); redisOperationService.cleanPlayerAndRoomInfoForSignout(roomId, String.valueOf(playerId)); redisOperationService.setRoomIdRoomInfo(roomId, roomInfo); /**将用户缓存信息里面的roomId设置为null*/ userInfo.setRoomId(null); redisOperationService.setUserInfo(request.getToken(), userInfo); result.setMsgType(MsgTypeEnum.entryHall.msgType); /**当前玩家返回大厅*/ channelContainer.sendTextMsgByPlayerIds(result, playerId); /**其他玩家通知刷新*/ refreshRoomForAllPlayer(roomInfo); return; } result.setMsgType(MsgTypeEnum.dissolveRoom.msgType); data.put("roomId", roomId); data.put("playerId", playerId); channelContainer.sendTextMsgByPlayerIds(result, GameUtil.getPlayerIdArr(playerList)); } public void agreeDissolveRoom(ChannelHandlerContext ctx, BaseRequest request, UserInfo userInfo) { Result result = new Result(); Map<String, Object> data = new HashMap<String, Object>(); result.setData(data); result.setGameType(request.getGameType()); BaseMsg msg = request.getMsg(); Integer roomId = msg.getRoomId(); BaseRoomInfo roomInfo = getRoomInfo(ctx, request, userInfo); List playerList = roomInfo.getPlayerList(); if (!GameUtil.isExistPlayerInRoom(msg.getPlayerId(), playerList)) { throw new BusinessException(ExceptionEnum.PLAYER_NOT_IN_ROOM); } int size = playerList.size(); int agreeDissolveCount = 0; for(int i = 0; i < size; i++){ BasePlayerInfo player = (BasePlayerInfo)playerList.get(i); if (player.getPlayerId().equals(msg.getPlayerId())) { player.setDissolveStatus(DissolveStatusEnum.agree.status); } if (DissolveStatusEnum.agree.status.equals(player.getDissolveStatus())) { agreeDissolveCount++; } } roomInfo.setUpdateTime(new Date()); redisOperationService.setRoomIdRoomInfo(roomId, roomInfo); /**如果大部分人同意,则推送解散消息并解散房间*/ if (agreeDissolveCount >= (playerList.size()/2 + 1)) { /**解散房间*/ redisOperationService.cleanPlayerAndRoomInfo(roomId, GameUtil.getPlayerIdStrArr(playerList)); /**解散后需要进行结算*/ data.put("roomInfo", roomInfo); result.setMsgType(MsgTypeEnum.successDissolveRoom.msgType); channelContainer.sendTextMsgByPlayerIds(result, GameUtil.getPlayerIdArr(playerList)); return ; } result.setMsgType(MsgTypeEnum.agreeDissolveRoom.msgType); data.put("roomId", roomId); data.put("playerId", msg.getPlayerId()); channelContainer.sendTextMsgByPlayerIds(result, GameUtil.getPlayerIdArr(playerList)); } public void disagreeDissolveRoom(ChannelHandlerContext ctx, BaseRequest request, UserInfo userInfo) { Result result = new Result(); Map<String, Object> data = new HashMap<String, Object>(); result.setData(data); result.setGameType(request.getGameType()); BaseMsg msg = request.getMsg(); Integer roomId = msg.getRoomId(); BaseRoomInfo roomInfo = getRoomInfo(ctx, request, userInfo); if (null == roomInfo) { throw new BusinessException(ExceptionEnum.ROOM_ID_NOT_EXIST); } List playerList = roomInfo.getPlayerList(); if (!GameUtil.isExistPlayerInRoom(msg.getPlayerId(), playerList)) { throw new BusinessException(ExceptionEnum.PLAYER_NOT_IN_ROOM); } int size = playerList.size(); for(int i = 0; i < size; i++){ BasePlayerInfo player = (BasePlayerInfo)playerList.get(i); if (player.getPlayerId().equals(msg.getPlayerId())) { player.setDissolveStatus(DissolveStatusEnum.disagree.status); } } roomInfo.setUpdateTime(new Date()); redisOperationService.setRoomIdRoomInfo(roomId, roomInfo); result.setMsgType(MsgTypeEnum.disagreeDissolveRoom.msgType); data.put("roomId", roomId); data.put("playerId", msg.getPlayerId()); channelContainer.sendTextMsgByPlayerIds(result, GameUtil.getPlayerIdArr(playerList)); } public void delRoomConfirmBeforeReturnHall(ChannelHandlerContext ctx, BaseRequest request, UserInfo userInfo) { Result result = new Result(); Map<String, Object> data = new HashMap<String, Object>(); result.setData(data); result.setGameType(request.getGameType()); BaseMsg msg = request.getMsg(); Integer roomId = msg.getRoomId(); BaseRoomInfo roomInfo = getRoomInfo(ctx, request, userInfo); if (null == roomInfo) { throw new BusinessException(ExceptionEnum.ROOM_ID_NOT_EXIST); } List playerList = roomInfo.getPlayerList(); if (!GameUtil.isExistPlayerInRoom(msg.getPlayerId(), playerList)) { throw new BusinessException(ExceptionEnum.PLAYER_NOT_IN_ROOM); } int agreeDissolveCount = 0; int size = playerList.size(); for(int i = 0; i < size; i++){ BasePlayerInfo player = (BasePlayerInfo)playerList.get(i); if (player.getPlayerId().equals(msg.getPlayerId())) { player.setDissolveStatus(DissolveStatusEnum.agree.status); } if (player.getDissolveStatus().equals(DissolveStatusEnum.agree.status)) { agreeDissolveCount++; } } roomInfo.setUpdateTime(new Date()); redisOperationService.setRoomIdRoomInfo(roomId, roomInfo); /**如果所有人都有确认消息,则解散房间*/ if (agreeDissolveCount >= playerList.size()) { /**解散房间*/ redisOperationService.cleanPlayerAndRoomInfo(roomId, GameUtil.getPlayerIdStrArr(playerList)); }else{/**如果只有部分人确认,则只删除当前玩家的标记*/ redisOperationService.hdelOfflinePlayerIdRoomIdGameTypeTime(msg.getPlayerId()); redisOperationService.hdelPlayerIdRoomIdGameType(msg.getPlayerId()); } /**通知玩家返回大厅*/ result.setMsgType(MsgTypeEnum.delRoomConfirmBeforeReturnHall.msgType); // channelContainer.sendTextMsgByPlayerIds(result, msg.getPlayerId()); /**将roomId从用户信息中去除*/ userInfo.setRoomId(null); redisOperationService.setUserInfo(request.getToken(), userInfo); } public void chatMsg(ChannelHandlerContext ctx, BaseRequest request, UserInfo userInfo) { Result result = new Result(); Map<String, Object> data = new HashMap<String, Object>(); result.setData(data); result.setGameType(request.getGameType()); BaseMsg msg = request.getMsg(); Integer roomId = msg.getRoomId(); BaseRoomInfo roomInfo = getRoomInfo(ctx, request, userInfo); if (null == roomInfo) { throw new BusinessException(ExceptionEnum.ROOM_ID_NOT_EXIST); } List playerList = roomInfo.getPlayerList(); if (!GameUtil.isExistPlayerInRoom(msg.getPlayerId(), playerList)) { throw new BusinessException(ExceptionEnum.PLAYER_NOT_IN_ROOM); } result.setMsgType(MsgTypeEnum.chatMsg.msgType); if (ChatTypeEnum.specialEmotion.type == msg.getChatType()) { data.put("playerId", msg.getPlayerId()); data.put("otherPlayerId", msg.getOtherPlayerId()); data.put("chatMsg", msg.getChatMsg()); data.put("chatType", msg.getChatType()); List<Integer> playerIdList = new ArrayList<Integer>(); Integer[] playerIdArr = new Integer[2]; playerIdArr[0] = msg.getPlayerId(); playerIdArr[1] = msg.getOtherPlayerId(); channelContainer.sendTextMsgByPlayerIds(result, playerIdArr); return; }else if(ChatTypeEnum.voiceChat.type == msg.getChatType()){ data.put("playerId", msg.getPlayerId()); data.put("chatMsg", msg.getChatMsg()); data.put("chatType", msg.getChatType()); channelContainer.sendTextMsgByPlayerIds(result, GameUtil.getPlayerIdArrWithOutSelf(playerList, msg.getPlayerId())); return; } data.put("playerId", msg.getPlayerId()); data.put("chatMsg", msg.getChatMsg()); data.put("chatType", msg.getChatType()); channelContainer.sendTextMsgByPlayerIds(result, GameUtil.getPlayerIdArr(playerList)); } public void syncPlayerLocation(ChannelHandlerContext ctx, BaseRequest request, UserInfo userInfo) { Result result = new Result(); result.setGameType(request.getGameType()); result.setMsgType(MsgTypeEnum.syncPlayerLocation.msgType); BaseMsg msg = request.getMsg(); userInfo.setAddress(msg.getAddress()); userInfo.setX(msg.getX()); userInfo.setY(msg.getY()); redisOperationService.setUserInfo(request.getToken(), userInfo); } public void queryPlayerInfo(ChannelHandlerContext ctx, BaseRequest request, UserInfo userInfo) { Result result = new Result(); Map<String, Object> data = new HashMap<String, Object>(); result.setData(data); result.setGameType(request.getGameType()); BaseMsg msg = request.getMsg(); Integer roomId = msg.getRoomId(); BaseRoomInfo roomInfo = getRoomInfo(ctx, request, userInfo); if (null == roomInfo) { throw new BusinessException(ExceptionEnum.ROOM_ID_NOT_EXIST); } List playerList = roomInfo.getPlayerList(); if (!GameUtil.isExistPlayerInRoom(msg.getPlayerId(), playerList)) { throw new BusinessException(ExceptionEnum.PLAYER_NOT_IN_ROOM); } Integer otherPlayerId = msg.getOtherPlayerId(); Integer playerId = msg.getPlayerId(); BasePlayerInfo otherPlayer = null; BasePlayerInfo curPlayer = null; int size = playerList.size(); for(int i = 0; i < size; i++){ BasePlayerInfo player = (BasePlayerInfo)playerList.get(i); if (player.getPlayerId().equals(otherPlayerId)) { otherPlayer = player; }else if(player.getPlayerId().equals(playerId)){ curPlayer = player; } } if (otherPlayer != null) { data.put("playerId", otherPlayer.getPlayerId()); data.put("nickName", otherPlayer.getNickName()); data.put("headImgUrl", otherPlayer.getHeadImgUrl()); data.put("address", otherPlayer.getAddress()); String distance = GameUtil.getLatLngDistance(curPlayer, otherPlayer); data.put("distance", distance); }else{ data.put("playerId", curPlayer.getPlayerId()); data.put("nickName", curPlayer.getNickName()); data.put("headImgUrl", curPlayer.getHeadImgUrl()); data.put("address", curPlayer.getAddress()); } result.setMsgType(MsgTypeEnum.queryPlayerInfo.msgType); channelContainer.sendTextMsgByPlayerIds(result, msg.getPlayerId()); } public void userRecord(ChannelHandlerContext ctx, BaseRequest request, UserInfo userInfo) { Result result = new Result(); Map<String, Object> data = new HashMap<String, Object>(); result.setData(data); result.setGameType(request.getGameType()); BaseMsg msg = request.getMsg(); UserRecordModel qmodel = new UserRecordModel(); qmodel.setGameType(request.getGameType()); qmodel.setPlayerId(userInfo.getPlayerId()); List<UserRecordModel> list = commonManager.getUserRecord(qmodel); result.setMsgType(MsgTypeEnum.userRecord.msgType); result.setData(list); channelContainer.sendTextMsgByPlayerIds(result, msg.getPlayerId()); } public void userFeedback(ChannelHandlerContext ctx, BaseRequest request, UserInfo userInfo) { Result result = new Result(); Map<String, Object> data = new HashMap<String, Object>(); result.setData(data); result.setGameType(request.getGameType()); BaseMsg msg = request.getMsg(); UserFeedbackModel model = new UserFeedbackModel(); model.setPlayerId(msg.getPlayerId()); model.setMobilePhone(msg.getMobilePhone()); model.setFeedBack(msg.getFeedBack()); model.setType(msg.getFeedBackType()); commonManager.insertFeedback(model); result.setMsgType(MsgTypeEnum.userFeedback.msgType); channelContainer.sendTextMsgByPlayerIds(result, msg.getPlayerId()); } public abstract BaseRoomInfo getRoomInfo(ChannelHandlerContext ctx, BaseRequest request, UserInfo userInfo); public void ready(ChannelHandlerContext ctx, BaseRequest request, UserInfo userInfo){} public void refreshRoom(ChannelHandlerContext ctx, BaseRequest request, UserInfo userInfo){ Result result = new Result(); Map<String, Object> data = new HashMap<String, Object>(); result.setData(data); BaseMsg msg = request.getMsg(); Integer roomId = msg.getRoomId(); Integer playerId = msg.getPlayerId(); List<BaseRoomInfo> roomInfoList = doRefreshRoom(ctx, request, userInfo); BaseRoomInfo roomInfo = roomInfoList.get(0); BaseRoomInfo returnRoomInfo = roomInfoList.get(1); if (null == roomInfo) { /**房间不存在,则需要删除离线用户与房间的关系标记,防止循环刷新,但是房间不存在*/ redisOperationService.hdelOfflinePlayerIdRoomIdGameTypeTime(playerId); channelContainer.sendTextMsgByPlayerIds(new Result(0, MsgTypeEnum.entryHall.msgType), playerId); return; } List playerList = roomInfo.getPlayerList(); if (!GameUtil.isExistPlayerInRoom(playerId, playerList)) { channelContainer.sendTextMsgByPlayerIds(new Result(0, MsgTypeEnum.entryHall.msgType), playerId); return; } result.setGameType(roomInfo.getGameType()); result.setMsgType(MsgTypeEnum.refreshRoom.msgType); result.setData(returnRoomInfo); /**返回给当前玩家刷新信息*/ channelContainer.sendTextMsgByPlayerIds(result, playerId); /**设置当前玩家缓存中为在线状态*/ GameUtil.setOnlineStatus(playerList, playerId, OnlineStatusEnum.online); redisOperationService.setRoomIdRoomInfo(roomId, roomInfo); /**给其他的玩家发送当前玩家上线通知*/ Result result1 = new Result(); Map<String, Object> data1 = new HashMap<String, Object>(); result1.setData(data1); data1.put("playerId", msg.getPlayerId()); result1.setGameType(roomInfo.getGameType()); result1.setMsgType(MsgTypeEnum.onlineNotice.msgType); channelContainer.sendTextMsgByPlayerIds(result1, GameUtil.getPlayerIdArrWithOutSelf(playerList, playerId)); /**删除此玩家的离线标记*/ redisOperationService.hdelOfflinePlayerIdRoomIdGameTypeTime(playerId); } public abstract List<BaseRoomInfo> doRefreshRoom(ChannelHandlerContext ctx, BaseRequest request, UserInfo userInfo); public void productList(ChannelHandlerContext ctx, BaseRequest request, UserInfo userInfo){ Result result = new Result(); Map<String, Object> data = new HashMap<String, Object>(); result.setData(data); result.setGameType(GameTypeEnum.common.gameType); result.setMsgType(MsgTypeEnum.productList.msgType); commonManager.getProductList(); result.setData(commonManager.getProductList()); /**返回给当前玩家刷新信息*/ channelContainer.sendTextMsgByPlayerIds(result, userInfo.getPlayerId()); } public void bindProxy(ChannelHandlerContext ctx, BaseRequest request, UserInfo userInfo){ Integer proxyId = request.getMsg().getProxyId(); if (proxyId == null) { throw new BusinessException(ExceptionEnum.PARAMS_ERROR); } Integer proxyCount = commonManager.getProxyCountByProxyId(proxyId); if (proxyCount < 1) { throw new BusinessException(ExceptionEnum.PROXY_NOT_EXIST); } Integer proxyUserCount = commonManager.getProxyUserCountByPlayerId(userInfo.getPlayerId()); if (proxyUserCount > 0) { throw new BusinessException(ExceptionEnum.HAS_BIND_PROXY); } commonManager.insertProxyUser(proxyId, userInfo.getPlayerId(), userInfo.getNickName()); /**绑定代理后送15张房卡*/ Map<String, Object> param = new HashMap<String, Object>(); param.put("addNum", 15); param.put("playerId", userInfo.getPlayerId()); commonManager.addRoomCard(param); /**更新后再查询*/ UserModel userModel = commonManager.getUserById(userInfo.getPlayerId()); /**推送房卡更新消息*/ roomCardNumUpdate(userModel.getRoomCardNum(), userInfo.getPlayerId()); Result result = new Result(); Map<String, Object> data = new HashMap<String, Object>(); result.setData(data); result.setGameType(GameTypeEnum.common.gameType); result.setMsgType(MsgTypeEnum.bindProxy.msgType); channelContainer.sendTextMsgByPlayerIds(result, userInfo.getPlayerId()); } public void checkBindProxy(ChannelHandlerContext ctx, BaseRequest request, UserInfo userInfo){ if (!"sjsj".equals(Constant.curCompany)) { Integer proxyId = commonManager.getProxyIdByPlayerId(userInfo.getPlayerId()); if (proxyId == null) { throw new BusinessException(ExceptionEnum.NEED_BIND_PROXY); } } Result result = new Result(); Map<String, Object> data = new HashMap<String, Object>(); result.setData(data); result.setGameType(GameTypeEnum.common.gameType); result.setMsgType(MsgTypeEnum.checkBindProxy.msgType); channelContainer.sendTextMsgByPlayerIds(result, userInfo.getPlayerId()); } public void notice(ChannelHandlerContext ctx, BaseRequest request, UserInfo userInfo){ Result result = new Result(); Map<String, Object> data = new HashMap<String, Object>(); data.put("noticeContent", Constant.noticeMsg); result.setData(data); result.setGameType(GameTypeEnum.common.gameType); result.setMsgType(MsgTypeEnum.notice.msgType); channelContainer.sendTextMsgByPlayerIds(result, userInfo.getPlayerId()); } /** * 微信预支付 统一下单入口(websocket协议) * @param productId * @param playerId * @param ip * @return * @throws Exception */ public void unifiedOrder(ChannelHandlerContext ctx, BaseRequest request, UserInfo userInfo) throws Exception{ BaseMsg msg = request.getMsg(); Integer productId = msg.getProductId(); Integer playerId = userInfo.getPlayerId(); String ip = userInfo.getRemoteIp(); ProductModel productModel = commonManager.getProductById(productId); if (productModel == null) { throw new BusinessException(ExceptionEnum.PARAMS_ERROR); } Long orderId = commonManager.insertOrder(playerId, productId, productModel.getRoomCardNum(), productModel.getPrice()); SortedMap<String, Object> parameters = prepareOrder(ip, String.valueOf(orderId), productModel.getPrice(), productModel.getRemark()); /**生成签名*/ parameters.put("sign", PayCommonUtil.createSign(Charsets.UTF_8.toString(), parameters)); /**生成xml格式字符串*/ String requestXML = PayCommonUtil.getRequestXml(parameters); String responseStr = HttpUtil.httpsRequest(Constant.UNIFIED_ORDER_URL, "POST", requestXML); /**检验API返回的数据里面的签名是否合法,避免数据在传输的过程中被第三方篡改*/ if (!PayCommonUtil.checkIsSignValidFromResponseString(responseStr)) { log.error("微信统一下单失败,签名可能被篡改 "+responseStr); throw new BusinessException(ExceptionEnum.UNIFIED_ORDER_FAIL); } /**解析结果 resultStr*/ SortedMap<String, Object> resutlMap = XMLUtil.doXMLParse(responseStr); if (resutlMap != null && WeixinConstant.FAIL.equals(resutlMap.get("return_code"))) { log.error("微信统一下单失败,订单编号: " + orderId + " 失败原因:"+ resutlMap.get("return_msg")); throw new BusinessException(ExceptionEnum.UNIFIED_ORDER_FAIL); } /**获取到 prepayid*/ /**商户系统先调用该接口在微信支付服务后台生成预支付交易单,返回正确的预支付交易回话标识后再在APP里面调起支付。*/ SortedMap<String, Object> map = buildClientJson(resutlMap); map.put("outTradeNo", orderId); log.info("统一下定单成功 "+map.toString()); Result result = new Result(); result.setGameType(GameTypeEnum.common.gameType); result.setMsgType(MsgTypeEnum.unifiedOrder.msgType); result.setData(map); channelContainer.sendTextMsgByPlayerIds(result, playerId); } /** * 微信预支付 统一下单入口(http协议) * @param productId * @param playerId * @param ip * @return * @throws Exception */ public Result unifiedOrder(Integer productId, Integer playerId, String ip) throws Exception{ Result result = new Result(); ProductModel productModel = commonManager.getProductById(productId); if (productModel == null) { throw new BusinessException(ExceptionEnum.PARAMS_ERROR); } Long orderId = commonManager.insertOrder(playerId, productId, productModel.getRoomCardNum(), productModel.getPrice()); SortedMap<String, Object> parameters = prepareOrder(ip, String.valueOf(orderId), productModel.getPrice(), productModel.getRemark()); /**生成签名*/ parameters.put("sign", PayCommonUtil.createSign(Charsets.UTF_8.toString(), parameters)); /**生成xml格式字符串*/ String requestXML = PayCommonUtil.getRequestXml(parameters); String responseStr = HttpUtil.httpsRequest(Constant.UNIFIED_ORDER_URL, "POST", requestXML); /**检验API返回的数据里面的签名是否合法,避免数据在传输的过程中被第三方篡改*/ if (!PayCommonUtil.checkIsSignValidFromResponseString(responseStr)) { log.error("微信统一下单失败,签名可能被篡改 "+responseStr); throw new BusinessException(ExceptionEnum.UNIFIED_ORDER_FAIL); } /**解析结果 resultStr*/ SortedMap<String, Object> resutlMap = XMLUtil.doXMLParse(responseStr); if (resutlMap != null && WeixinConstant.FAIL.equals(resutlMap.get("return_code"))) { log.error("微信统一下单失败,订单编号: " + orderId + " 失败原因:"+ resutlMap.get("return_msg")); throw new BusinessException(ExceptionEnum.UNIFIED_ORDER_FAIL); } /**获取到 prepayid*/ /**商户系统先调用该接口在微信支付服务后台生成预支付交易单,返回正确的预支付交易回话标识后再在APP里面调起支付。*/ SortedMap<String, Object> map = buildClientJson(resutlMap); map.put("outTradeNo", orderId); log.info("统一下定单成功 "+map.toString()); result.setData(map); return result; } /** * 微信回调告诉微信支付结果 注意:同样的通知可能会多次发送给此接口,注意处理重复的通知。 * 对于支付结果通知的内容做签名验证,防止数据泄漏导致出现“假通知”,造成资金损失。 * * @param params * @return */ public String callback(String responseStr) { try { Map<String, Object> map = XMLUtil.doXMLParse(responseStr); /**校验签名 防止数据泄漏导致出现“假通知”,造成资金损失*/ if (!PayCommonUtil.checkIsSignValidFromResponseString(responseStr)) { log.error("微信回调失败,签名可能被篡改 " + responseStr); return PayCommonUtil.setXML(WeixinConstant.FAIL, "invalid sign"); } if (WeixinConstant.FAIL.equalsIgnoreCase(map.get("result_code").toString())) { log.error("微信回调失败的原因:"+responseStr); return PayCommonUtil.setXML(WeixinConstant.FAIL, "weixin pay fail"); } if (WeixinConstant.SUCCESS.equalsIgnoreCase(map.get("result_code") .toString())) { /**对数据库的操作,更新订单状态为已付款*/ String outTradeNo = (String) map.get("out_trade_no"); String transactionId = (String) map.get("transaction_id"); String totlaFee = (String) map.get("total_fee"); Integer totalPrice = Integer.valueOf(totlaFee); /**根据订单号查询订单信息*/ OrderModel order = commonManager.getOderByOrderId(Long.valueOf(outTradeNo)); Integer payStatus = order.getPayStatus(); /**如果支付状态为已经支付,则说明此次回调为重复回调,直接返回成功*/ if (PayStatusEnum.pay.type.equals(payStatus)) { return PayCommonUtil.setXML(WeixinConstant.SUCCESS, "OK"); } Integer playerId = order.getPlayerId(); Integer roomCardNum = commonManager.updateOrderAndUser(playerId, order.getRoomCardNum(), Long.valueOf(outTradeNo), transactionId, totalPrice); /**推送房卡更新消息*/ roomCardNumUpdate(roomCardNum, playerId); /**告诉微信服务器,我收到信息了,不要在调用回调action了*/ log.info("回调成功:"+responseStr); return PayCommonUtil.setXML(WeixinConstant.SUCCESS, "OK"); } } catch (Exception e) { log.error("回调异常" + e.getMessage()); return PayCommonUtil.setXML(WeixinConstant.FAIL,"weixin pay server exception"); } return PayCommonUtil.setXML(WeixinConstant.FAIL, "weixin pay fail"); } public void roomCardNumUpdate( Integer roomCardNum, Integer playerId){ /**推送房卡更新消息*/ Result result = new Result(); result.setMsgType(MsgTypeEnum.roomCardNumUpdate.msgType); result.setGameType(0); Map<String, Object> data = new HashMap<String, Object>(); data.put("playerId", playerId); data.put("roomCardNum", roomCardNum); result.setData(data); channelContainer.sendTextMsgByPlayerIds(result, playerId); } /** * 生成订单信息 * * @param ip * @param orderId * @return */ private SortedMap<String, Object> prepareOrder(String ip, String orderId, int price, String productBody) { Map<String, Object> oparams = ImmutableMap.<String, Object> builder() .put("appid", Constant.APPID)// 服务号的应用号 .put("body", productBody)// 商品描述 .put("mch_id", Constant.MCH_ID)// 商户号 ? .put("nonce_str", PayCommonUtil.CreateNoncestr())// 16随机字符串(大小写字母加数字) .put("out_trade_no", orderId)// 商户订单号 .put("total_fee", price)// 支付金额 单位分 注意:前端负责传入分 .put("spbill_create_ip", ip)// IP地址 .put("notify_url", Constant.WEIXIN_PAY_CALL_BACK_URL) // 微信回调地址 .put("trade_type", Constant.TRADE_TYPE)// 支付类型 app .build(); return MapUtils.sortMap(oparams); } /** * 生成预付快订单完成,返回给android,ios唤起微信所需要的参数。 * * @param resutlMap * @return * @throws UnsupportedEncodingException */ private SortedMap<String, Object> buildClientJson( Map<String, Object> resutlMap) throws UnsupportedEncodingException { // 获取微信返回的签名 Map<String, Object> params = ImmutableMap.<String, Object> builder() .put("appid", Constant.APPID) .put("noncestr", PayCommonUtil.CreateNoncestr()) .put("package", "Sign=WXPay") .put("partnerid", Constant.MCH_ID) .put("prepayid", resutlMap.get("prepay_id")) .put("timestamp", DateUtils.getTimeStamp()) // 10 位时间戳 .build(); // key ASCII排序 // 这里用treemap也是可以的 可以用treemap // TODO SortedMap<String, Object> sortMap = MapUtils.sortMap(params); sortMap.put("package", "Sign=WXPay"); // paySign的生成规则和Sign的生成规则同理 String paySign = PayCommonUtil.createSign(Charsets.UTF_8.toString(), sortMap); sortMap.put("sign", paySign); return sortMap; } }
[ "jinfeng.liu@china.zhaogang.com" ]
jinfeng.liu@china.zhaogang.com
a896b087e7489085551688ad32cfdf4ad13ee13d
2fcadce8fb44b0f96f0dd65be567e3ca7a21a16e
/flexible-adapter-ui/src/main/java/eu/davidea/flexibleadapter/utils/DrawableUtils.java
c6d20fc07381b5831a56299755f7ebfcd1ff5546
[ "Apache-2.0" ]
permissive
wnchen/FlexibleAdapter
ed8cb1161bea5476e3319cf83ca28f2d18b509f1
7234a176881500005f968420ac7b797bd25ffbab
refs/heads/master
2020-03-17T06:58:37.766261
2018-05-13T21:58:50
2018-05-13T21:58:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,055
java
/* * Copyright 2016-2018 Davide Steduto, Davidea Solutions Sprl * * 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 eu.davidea.flexibleadapter.utils; import android.content.Context; import android.content.res.ColorStateList; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.RippleDrawable; import android.graphics.drawable.ShapeDrawable; import android.graphics.drawable.StateListDrawable; import android.graphics.drawable.shapes.RoundRectShape; import android.support.annotation.ColorInt; import android.support.annotation.DrawableRes; import android.support.v4.view.ViewCompat; import android.util.TypedValue; import android.view.View; import java.util.Arrays; import eu.davidea.flexibleadapter.helpers.R; /** * @author Davide Steduto * @see FlexibleUtils * @see LayoutUtils * @since 14/06/2016 Created * <br>17/12/2017 Moved into UI package */ @SuppressWarnings("deprecation") public final class DrawableUtils { /** * Helper method to set the background depending on the android version. * * @param view the view to apply the drawable * @param drawable drawable object * @since 5.0.0-rc1 */ public static void setBackgroundCompat(View view, Drawable drawable) { ViewCompat.setBackground(view, drawable); } /** * Helper method to set the background depending on the android version * * @param view the view to apply the drawable * @param drawableRes drawable resource id * @since 5.0.0-rc1 */ public static void setBackgroundCompat(View view, @DrawableRes int drawableRes) { setBackgroundCompat(view, getDrawableCompat(view.getContext(), drawableRes)); } /** * Helper method to get the drawable by its resource. Specific to the correct android version.. * * @param context the context * @param drawableRes drawable resource id * @return the drawable object * @since 5.0.0-b7 */ public static Drawable getDrawableCompat(Context context, @DrawableRes int drawableRes) { try { if (FlexibleUtils.hasLollipop()) { return context.getResources().getDrawable(drawableRes, context.getTheme()); } else { return context.getResources().getDrawable(drawableRes); } } catch (Exception ex) { return null; } } /** * Helper to get the default selectableItemBackground drawable of the * {@code R.attr.selectableItemBackground} attribute of the overridden style. * * @param context the context * @return Default selectable item background drawable * @since 5.0.0-rc1 */ public static Drawable getSelectableItemBackground(Context context) { TypedValue outValue = new TypedValue(); // It's important to not use the android.R because this wouldn't add the overridden drawable context.getTheme().resolveAttribute(R.attr.selectableItemBackground, outValue, true); return getDrawableCompat(context, outValue.resourceId); } /** * Helper to get the system default Color Control Highlight. Returns the color of the * {@code R.attr.colorControlHighlight} attribute in the overridden style. * * @param context the context * @return Default Color Control Highlight * @since 5.0.0-b7 Created, returns the resourceId * <br/> 5.0.0-rc1 Now returns the real color (not the resourceId) */ @ColorInt public static int getColorControlHighlight(Context context) { TypedValue outValue = new TypedValue(); // It's important to not use the android.R because this wouldn't add the overridden drawable context.getTheme().resolveAttribute(R.attr.colorControlHighlight, outValue, true); if (FlexibleUtils.hasMarshmallow()) return context.getColor(outValue.resourceId); else return context.getResources().getColor(outValue.resourceId); } /** * Helper to get a custom selectable background with Ripple if device has at least Lollipop. * * @param normalColor the color in normal state * @param pressedColor the pressed color * @param rippleColor the color of the ripple * @return the RippleDrawable with StateListDrawable if at least Lollipop, the normal * StateListDrawable otherwise * @since 5.0.0-b7 Created * <br/>5.0.0-rc1 RippleColor becomes the 3rd parameter */ public static Drawable getSelectableBackgroundCompat(@ColorInt int normalColor, @ColorInt int pressedColor, @ColorInt int rippleColor) { if (FlexibleUtils.hasLollipop()) { return new RippleDrawable(ColorStateList.valueOf(rippleColor), getStateListDrawable(normalColor, pressedColor), getRippleMask(normalColor)); } else { return getStateListDrawable(normalColor, pressedColor); } } /** * Adds a ripple effect to any background. * * @param drawable any background drawable * @param rippleColor the color of the ripple * @return the RippleDrawable with the chosen background drawable if at least Lollipop, * the provided drawable otherwise * @since 5.0.0-rc1 */ public static Drawable getRippleDrawable(Drawable drawable, @ColorInt int rippleColor) { if (FlexibleUtils.hasLollipop()) { return new RippleDrawable(ColorStateList.valueOf(rippleColor), drawable, getRippleMask(Color.BLACK)); } else { return drawable; } } private static Drawable getRippleMask(@ColorInt int color) { float[] outerRadii = new float[8]; // 3 is the radius of final ripple, instead of 3 we can give required final radius Arrays.fill(outerRadii, 3); RoundRectShape r = new RoundRectShape(outerRadii, null, null); ShapeDrawable shapeDrawable = new ShapeDrawable(r); shapeDrawable.getPaint().setColor(color); return shapeDrawable; } private static StateListDrawable getStateListDrawable(@ColorInt int normalColor, @ColorInt int pressedColor) { StateListDrawable states = new StateListDrawable(); states.addState(new int[]{android.R.attr.state_activated}, getColorDrawable(pressedColor)); if (!FlexibleUtils.hasLollipop()) { states.addState(new int[]{android.R.attr.state_pressed}, getColorDrawable(pressedColor)); } states.addState(new int[]{}, getColorDrawable(normalColor)); // Animating across states. // It seems item background is lost on scrolling out of the screen on 21 <= API <= 23 if (!FlexibleUtils.hasLollipop() || FlexibleUtils.hasNougat()) { int duration = 200; //android.R.integer.config_shortAnimTime states.setEnterFadeDuration(duration); states.setExitFadeDuration(duration); } return states; } /** * Generate the {@code ColorDrawable} object from the provided Color. * * @param color the color * @return the {@code ColorDrawable} object * @since 5.0.0-rc1 */ public static ColorDrawable getColorDrawable(@ColorInt int color) { return new ColorDrawable(color); } }
[ "dave.dna@gmail.com" ]
dave.dna@gmail.com
a0543d9596af272e52e7931f7e0ec71317e0011c
404a189c16767191ffb172572d36eca7db5571fb
/structs/build/xml/java/gov/georgia/dhr/dfcs/sacwis/structs/output/BlobDataDescriptor.java
5764bf2c9bcdb3b22443e63c17122f572c95f19c
[]
no_license
tayduivn/training
648a8e9e91194156fb4ffb631749e6d4bf2d0590
95078fb2c7e21bf2bba31e2bbd5e404ac428da2f
refs/heads/master
2021-06-13T16:20:41.293097
2017-05-08T21:37:59
2017-05-08T21:37:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,066
java
/* * This class was automatically generated with * <a href="http://www.castor.org">Castor 1.0.5</a>, using an XML * Schema. * $Id$ */ package gov.georgia.dhr.dfcs.sacwis.structs.output; /** * Class BlobDataDescriptor. * * @version $Revision$ $Date$ */ public class BlobDataDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { //--------------------------/ //- Class/Member Variables -/ //--------------------------/ /** * Field elementDefinition */ private boolean elementDefinition; /** * Field nsPrefix */ private java.lang.String nsPrefix; /** * Field nsURI */ private java.lang.String nsURI; /** * Field xmlName */ private java.lang.String xmlName; /** * Field identity */ private org.exolab.castor.xml.XMLFieldDescriptor identity; //----------------/ //- Constructors -/ //----------------/ public BlobDataDescriptor() { super(); xmlName = "blobData"; elementDefinition = true; org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null; org.exolab.castor.mapping.FieldHandler handler = null; org.exolab.castor.xml.FieldValidator fieldValidator = null; //-- initialize attribute descriptors //-- initialize element descriptors //-- _bookmarkName desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_bookmarkName", "bookmarkName", org.exolab.castor.xml.NodeType.Element); desc.setImmutable(true); handler = new org.exolab.castor.xml.XMLFieldHandler() { @Override public java.lang.Object getValue( java.lang.Object object ) throws IllegalStateException { BlobData target = (BlobData) object; return target.getBookmarkName(); } @Override public void setValue( java.lang.Object object, java.lang.Object value) throws IllegalStateException, IllegalArgumentException { try { BlobData target = (BlobData) object; target.setBookmarkName( (java.lang.String) value); } catch (java.lang.Exception ex) { throw new IllegalStateException(ex.toString()); } } @Override @SuppressWarnings("unused") public java.lang.Object newInstance( java.lang.Object parent ) { return null; } }; desc.setHandler(handler); desc.setMultivalued(false); addFieldDescriptor(desc); //-- validation code for: _bookmarkName fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); //-- _blobId desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_blobId", "blobId", org.exolab.castor.xml.NodeType.Element); desc.setImmutable(true); handler = new org.exolab.castor.xml.XMLFieldHandler() { @Override public java.lang.Object getValue( java.lang.Object object ) throws IllegalStateException { BlobData target = (BlobData) object; return target.getBlobId(); } @Override public void setValue( java.lang.Object object, java.lang.Object value) throws IllegalStateException, IllegalArgumentException { try { BlobData target = (BlobData) object; target.setBlobId( (java.lang.String) value); } catch (java.lang.Exception ex) { throw new IllegalStateException(ex.toString()); } } @Override @SuppressWarnings("unused") public java.lang.Object newInstance( java.lang.Object parent ) { return null; } }; desc.setHandler(handler); desc.setMultivalued(false); addFieldDescriptor(desc); //-- validation code for: _blobId fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); //-- _blobTableName desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_blobTableName", "blobTableName", org.exolab.castor.xml.NodeType.Element); desc.setImmutable(true); handler = new org.exolab.castor.xml.XMLFieldHandler() { @Override public java.lang.Object getValue( java.lang.Object object ) throws IllegalStateException { BlobData target = (BlobData) object; return target.getBlobTableName(); } @Override public void setValue( java.lang.Object object, java.lang.Object value) throws IllegalStateException, IllegalArgumentException { try { BlobData target = (BlobData) object; target.setBlobTableName( (java.lang.String) value); } catch (java.lang.Exception ex) { throw new IllegalStateException(ex.toString()); } } @Override @SuppressWarnings("unused") public java.lang.Object newInstance( java.lang.Object parent ) { return null; } }; desc.setHandler(handler); desc.setMultivalued(false); addFieldDescriptor(desc); //-- validation code for: _blobTableName fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); } //-- gov.georgia.dhr.dfcs.sacwis.structs.output.BlobDataDescriptor() //-----------/ //- Methods -/ //-----------/ /** * Method getAccessMode * * * * @return the access mode specified for this class. */ @Override() public org.exolab.castor.mapping.AccessMode getAccessMode() { return null; } //-- org.exolab.castor.mapping.AccessMode getAccessMode() /** * Method getExtends * * * * @return the class descriptor of the class extended by this * class. */ @Override() public org.exolab.castor.mapping.ClassDescriptor getExtends() { return null; } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() /** * Method getIdentity * * * * @return the identity field, null if this class has no * identity. */ @Override() public org.exolab.castor.mapping.FieldDescriptor getIdentity() { return identity; } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() /** * Method getJavaClass * * * * @return the Java class represented by this descriptor. */ @Override() public java.lang.Class getJavaClass() { return gov.georgia.dhr.dfcs.sacwis.structs.output.BlobData.class; } //-- java.lang.Class getJavaClass() /** * Method getNameSpacePrefix * * * * @return the namespace prefix to use when marshalling as XML. */ @Override() public java.lang.String getNameSpacePrefix() { return nsPrefix; } //-- java.lang.String getNameSpacePrefix() /** * Method getNameSpaceURI * * * * @return the namespace URI used when marshalling and * unmarshalling as XML. */ @Override() public java.lang.String getNameSpaceURI() { return nsURI; } //-- java.lang.String getNameSpaceURI() /** * Method getValidator * * * * @return a specific validator for the class described by this * ClassDescriptor. */ @Override() public org.exolab.castor.xml.TypeValidator getValidator() { return this; } //-- org.exolab.castor.xml.TypeValidator getValidator() /** * Method getXMLName * * * * @return the XML Name for the Class being described. */ @Override() public java.lang.String getXMLName() { return xmlName; } //-- java.lang.String getXMLName() /** * Method isElementDefinition * * * * @return true if XML schema definition of this Class is that * of a global * element or element with anonymous type definition. */ public boolean isElementDefinition() { return elementDefinition; } //-- boolean isElementDefinition() }
[ "lgeddam@gmail.com" ]
lgeddam@gmail.com
cc295fa23bee442a683766f662d9dd276615c487
aafaaca0cd470dd85ce5cccb49c49d5f257553b9
/Algoritmo.java
7507352c02813824730c169b2a0ac23e55d953bc
[]
no_license
MrRagger/Mantenimiento
58e93fa67a6a725dc3cf242b53d6d698301e9a0b
270c77d9ed190d2ff86907c80dfc34bb2de63ab8
refs/heads/master
2021-04-28T06:33:11.263254
2018-04-23T08:32:35
2018-04-23T08:32:35
122,204,389
3
0
null
2018-02-28T00:15:28
2018-02-20T13:51:34
PHP
UTF-8
Java
false
false
5,402
java
import java.io.*; import java.sql.*; import java.util.*; public class Algoritmo { private Connection connection=null; String serverAddress = "77.104.160.115"; String db = "onlyf1st_mantenimiento"; String user = "onlyf1st_root"; String pass = "mantenimiento"; String url = "jdbc:mysql://" + serverAddress + "/" + db; private void conectar() throws SQLException, ClassNotFoundException { try { Class.forName("com.mysql.jdbc.Driver"); connection=(Connection)DriverManager.getConnection(url, user, pass); if(connection!=null) { System.out.println("Conectado a la base de datos!"); } } catch(SQLException e) { System.out.println("No se ha podido conectar a la BD"); } catch(ClassNotFoundException e) { System.out.println(e); } try { //new MessageSender().run(); Statement st2 = connection.createStatement(); //Creamos un statement con la conexion Statement st3 = connection.createStatement(); ResultSet rs2 = st2.executeQuery("SELECT Sensor.IdPieza, Sensor.IdSensor, Sensor.Color FROM Sensor");//Formamos la query con la consulta que queremos hacer while (rs2.next()) { //Bucle para ir avanzando en la query String idSensor = rs2.getString("Sensor.IdSensor"); //Sacamos el id del sensor String idPieza = rs2.getString("Sensor.IdPieza"); //Sacamos la pieza donde esta el sensor String color = rs2.getString("Sensor.Color"); //Sacamos el color del sensor System.out.println(idSensor); System.out.println(idPieza); System.out.println("Color del sensor antes de analizarlo: " +color); Random rand = new Random(); double temperature = 10 + 20*rand.nextDouble(); //Grados double humedad = 15*rand.nextDouble(); //Dado en % System.out.println(humedad); System.out.println(temperature); if(idSensor.equals("Humedad")) { if ( humedad >= 0 && humedad < 5 ){ String color_final = "verde"; PreparedStatement ps = connection.prepareStatement("UPDATE `Sensor` SET `Color`= ? WHERE `IdPieza` = ?"); ps.setString(1, color_final); ps.setString(2, idPieza); ps.executeUpdate(); ps.close(); System.out.println("Color del sensor después de analizarlo: " + color_final); } else { if( humedad >= 5 && humedad < 10 ) { String color_final = "naranja"; PreparedStatement ps = connection.prepareStatement("UPDATE `Sensor` SET `Color`= ? WHERE `IdPieza` = ?"); ps.setString(1, color_final); ps.setString(2, idPieza); ps.executeUpdate(); ps.close(); System.out.println("Color del sensor después de analizarlo: " +color_final); } else { if( humedad >= 10 ) { String color_final = "rojo"; PreparedStatement ps = connection.prepareStatement("UPDATE `Sensor` SET `Color`= ? WHERE `IdPieza` = ?"); ps.setString(1, color_final); ps.setString(2, idPieza); ps.executeUpdate(); ps.close(); System.out.println("Color del sensor después de analizarlo: " + color_final); } } } } else { if(idSensor.equals("Temperatura")) { if ( (temperature < 14) || (temperature > 26) ){ String color_final = "rojo"; PreparedStatement ps = connection.prepareStatement("UPDATE `Sensor` SET `Color`= ? WHERE `IdPieza` = ?"); ps.setString(1, color_final); ps.setString(2, idPieza); ps.executeUpdate(); ps.close(); System.out.println("Color del sensor después de analizarlo: " +color_final); } else if ( (temperature >= 14 && temperature < 18) || (temperature > 22 && temperature <= 26) ){ String color_final = "naranja"; PreparedStatement ps = connection.prepareStatement("UPDATE `Sensor` SET `Color`= ? WHERE `IdPieza` = ?"); ps.setString(1, color_final); ps.setString(2, idPieza); ps.executeUpdate(); ps.close(); System.out.println("Color del sensor después de analizarlo: " +color_final); } else if ( (temperature >= 18 && temperature <= 22) ){ String color_final = "verde"; PreparedStatement ps = connection.prepareStatement("UPDATE `Sensor` SET `Color`= ? WHERE `IdPieza` = ?"); ps.setString(1, color_final); ps.setString(2, idPieza); ps.executeUpdate(); ps.close(); System.out.println("Color del sensor después de analizarlo: " +color_final); } } else { System.out.println("ERROR"); } } } st2.close(); st3.close(); rs2.close(); exit(); } catch (SQLException e) { System.out.println("No se pudo realizar la operacion"); System.out.println("Mensaje de error: " + e.getMessage()); System.out.println("Codigo de error: " + e.getErrorCode()); System.out.println("Estado SQL: " + e.getSQLState()); } catch (Exception e) { System.out.println("Se produjo un error inesperado: " + e.getMessage()); } } private void exit() throws SQLException { System.out.println("Saliendo.. �hasta otra!"); connection.close(); System.exit(0); } public static void main(String args[]) { Algoritmo algoritmos= new Algoritmo(); try { algoritmos.conectar(); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
[ "noreply@github.com" ]
noreply@github.com
f4b00aa99c812c6f31b0c5d6eb11367c1ceb62d5
e12d5a833cfb65d7dbe21bf5fd32c91fd61c9842
/chapter06/Exercise06_10.java
88bc3858c30b99722a1e3f7f59c8787907522d65
[]
no_license
SmartGridsML/Introduction-to-Java-Programming
58cc94f0b7c7f927d2d9e147c70804010ca1be31
7d0fd362a4401f43baead9cfade571374436cfbf
refs/heads/master
2023-03-22T01:07:21.800620
2020-08-25T10:00:40
2020-08-25T10:00:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
444
java
package chapter06; public class Exercise06_10 { public static void main(String[] args) { System.out.println(isPrime(1_000)); } public static String isPrime(int number) { String str = ""; while (number > 1) { boolean isPrime = true; for (int i = 2; i < number; i++) { if (number % i == 0) { isPrime = false; break; } } if (isPrime) { str += number + " "; } number--; } return str; } }
[ "furkanahmet.karadut@gmail.com" ]
furkanahmet.karadut@gmail.com
daed35a8512e15949b6776aa2230c4611170106e
3998fb4158e7feaaf1d731efd401a49f04b75d7b
/app/src/androidTest/java/com/cs639/newyorktrade/ExampleInstrumentedTest.java
d52297e9fcd0dd602a042966ff3e3041230ddd16
[]
no_license
prakashthakuri/NewYorkTrade
26d3bbbb96073b52e48025e37e58e05191e3c16f
25492f0e877b91790b6e5e089adcf220316e7d1c
refs/heads/master
2023-01-22T22:27:04.721193
2019-07-13T15:27:59
2019-07-13T15:27:59
194,163,024
0
0
null
null
null
null
UTF-8
Java
false
false
713
java
package com.cs639.newyorktrade; import android.content.Context; import androidx.test.InstrumentationRegistry; import androidx.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented 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() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.cs639.pacexchange", appContext.getPackageName()); } }
[ "royalboy.prakash@gmail.com" ]
royalboy.prakash@gmail.com
f09a83e5098c9b1d521e8d558e3fb83fd6777469
3491881bcc4fbebb1933eaefa4a05fd842bd2792
/src/test/java/com/cursos/devops/AlumnosApiApplicationTests.java
b39388dd2dcf05800800752850df849b8fa00d87
[]
no_license
javiersolisguzman/alumno-api
ecaf4a5097b5f00d4b461a6fb41dece9365efee6
019c50e1b61fe40bc5cea95f9ec1fd6a2ccb0799
refs/heads/master
2020-04-18T19:37:10.510319
2019-01-26T17:17:53
2019-01-26T17:17:53
167,716,137
0
0
null
null
null
null
UTF-8
Java
false
false
339
java
package com.cursos.devops; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class AlumnosApiApplicationTests { @Test public void contextLoads() { } }
[ "javiersolisguzman1023@gmail.com" ]
javiersolisguzman1023@gmail.com
9450781a1e551789335ef9f6ceb19f1041731f14
67da30885e4ed580bac50af46601b248c669268d
/onlineShopping/onlineShopping-portal/src/main/java/com/online/portal/interceptor/Interceptor.java
bf7906a821df284242ffdbf2eaeed4b0408ba0ea
[]
no_license
1243177911/onlineShopping
230f930e80c4975af6df41c99ab714b37dcc5693
6caf1e163b206d5634be019ba2ef09f593319d83
refs/heads/master
2020-04-27T01:02:53.106758
2019-03-10T12:31:52
2019-03-10T12:31:52
173,953,832
0
0
null
null
null
null
UTF-8
Java
false
false
1,489
java
package com.online.portal.interceptor; import com.online.common.utils.CookieUtils; import com.online.pojo.TbUser; import com.online.portal.service.impl.UserServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class Interceptor implements HandlerInterceptor { @Autowired private UserServiceImpl userService; @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { //获得cookie String token = CookieUtils.getCookieValue(request, "TT_TOKEN"); //通过cookie获得user对象(写一个service调用sso的服务) TbUser user = userService.getUserByToken(token); if(user == null){ response.sendRedirect(userService.SSO_BASE_URL + userService.SSO_PAGE_LOGIN +"?redirect=http://localhost:8082" + request.getRequestURI()); return false; } return true; } @Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { } @Override public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { } }
[ "1243177911@qq.com" ]
1243177911@qq.com
9095073ea3a5926c2032933fdd0a216fd507c33c
4dba1ae57f07a692ac0529bc5f87ca34a9721301
/IS24-CSV/src/main/java/org/openestate/io/is24_csv/records/GewerbeSonstiges.java
2d9c719201cfa4e79c4c02e4113e7339d2bed52f
[ "Apache-2.0" ]
permissive
jniebuhr/OpenEstate-IO
8d792f930876a4f2c7662f70582003a6177a1ed9
8ebfaa495e757eac44004084b4c14baeb5197375
refs/heads/master
2019-07-07T08:13:40.526614
2017-12-06T13:25:25
2017-12-06T13:25:25
86,725,865
0
0
null
2017-03-30T16:42:58
2017-03-30T16:42:57
null
UTF-8
Java
false
false
17,111
java
/* * Copyright 2015-2017 OpenEstate.org. * * 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.openestate.io.is24_csv.records; import java.math.BigDecimal; import org.apache.commons.csv.CSVRecord; import org.openestate.io.is24_csv.Is24CsvFormat; import org.openestate.io.is24_csv.Is24CsvRecord; import org.openestate.io.is24_csv.types.Ausstattung; import org.openestate.io.is24_csv.types.Befeuerungsart; import org.openestate.io.is24_csv.types.Bodenbelag; import org.openestate.io.is24_csv.types.EnergieausweisTyp; import org.openestate.io.is24_csv.types.Heizungsart; import org.openestate.io.is24_csv.types.Immobilienart; import org.openestate.io.is24_csv.types.ObjektkategorieGewerbeSonstiges; import org.openestate.io.is24_csv.types.Objektzustand; import org.openestate.io.is24_csv.types.VermarktungsartGewerbe; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Record from the IS24-CSV format for further commercial objects. * * @since 1.0 * @author Andreas Rudolph */ public class GewerbeSonstiges extends Is24CsvRecord { private final static Logger LOGGER = LoggerFactory.getLogger( GewerbeSonstiges.class ); /** Vermarktungsart, Text 1 */ protected final static int FIELD_VERMARKTUNGSART = 60; /** Objektkategorie 2, Zahl 3 */ protected final static int FIELD_OBJEKTKATEGORIE = 61; /** Hauptfläche, Zahl 10,2 */ protected final static int FIELD_GEWERBEFLAECHE = 62; /** Nebenfläche, Zahl 10,2 */ protected final static int FIELD_NEBENFLAECHE = 63; /** Gesamtfläche, Zahl 10,2 */ protected final static int FIELD_GESAMTFLAECHE = 64; /** Fläche teilbar ab (in m²), Zahl 10,2 */ protected final static int FIELD_TEILBAR_AB = 65; /** Anzahl Parkflächen, Zahl 5 */ protected final static int FIELD_ANZAHL_PARKFLAECHEN = 66; /** Etage(n), Text 50 */ protected final static int FIELD_ETAGEN = 67; /** Baujahr, Zahl 4 */ protected final static int FIELD_BAUJAHR = 68; /** Objektzustand, Zahl 10 */ protected final static int FIELD_OBJEKTZUSTAND = 69; /** Personenaufzug, Text 1 */ protected final static int FIELD_PERSONENAUFZUG = 70; /** Fussweg zu öffentlichen Verkehrsmitteln (in Min.), Zahl 2 */ protected final static int FIELD_FUSSWEG_NAHVERKEHR = 71; /** Fahrzeit zum nächsten Hauptbahnhof (in Min.), Zahl 2 */ protected final static int FIELD_FAHRTWEG_HAUPTBAHNHOF = 72; /** Fahrzeit zum nächsten BAB (in Min.), Zahl 3 */ protected final static int FIELD_FAHRTWEG_AUTOBAHN = 73; /** Fahrzeit zum nächsten Flughafen (in Min.), Zahl 3 */ protected final static int FIELD_FAHRTWEG_FLUGHAFEN = 74; /** Frei ab/Verfügbar ab/Antrittstermin, Text 50 */ protected final static int FIELD_VERFUEGBAR_AB = 75; /** Grundstücksfläche, Zahl 10,2 */ protected final static int FIELD_GRUNDSTUECKSFLAECHE = 76; /** Bodenbelag, Zahl 2 */ protected final static int FIELD_BODENBELAG = 77; /** Jahr letzte Modernisierung/ Sanierung, Zahl 4 */ protected final static int FIELD_SANIERUNGSJAHR = 80; /** Qualität der Ausstattung, Zahl 1 */ protected final static int FIELD_AUSSTATTUNG = 81; /** Befeuerungsart, Zahl 2 (Mehrfachauswahl möglich, wenn Eingaben durch Semikolon getrennt werden. Jeder mögliche Wert darf max. einmal erscheinen.) */ protected final static int FIELD_BEFEUERUNG = 83; /** Energieausweistyp, Zahl 1 */ protected final static int FIELD_ENERGIEAUSWEIS_TYP = 84; /** Kennwert in kWh/(m²*a), Zahl 5,2 */ protected final static int FIELD_ENERGIEAUSWEIS_KENNWERT = 85; /** Energieverbrauch für Warmwasser enthalten, Text 1 (Nur relevant falls Energieausweistyp=VERBRAUCH. In allen anderen Fällen darf das Feld nicht gesetzt sein.) */ protected final static int FIELD_ENERGIEAUSWEIS_INKL_WARMWASSER = 86; /** Heizungsart, Zahl 10 */ protected final static int FIELD_HEIZUNGSART = 87; /** Denkmalschutzobjekt, Text 1 */ protected final static int FIELD_DENKMALSCHUTZ = 88; /** Keller, Text 1 */ protected final static int FIELD_KELLER = 89; /** Preis (Monatsmiete oder Kaufpreis), Zahl 15,2 */ protected final static int FIELD_PREIS = 90; /** Nebenkosten, Zahl 15,2 */ protected final static int FIELD_NEBENKOSTEN = 91; /** Preis pro Parkfläche, Zahl 15,2 */ protected final static int FIELD_PREIS_PRO_PARKFLAECHE = 92; /** Kaution, Text 50 */ protected final static int FIELD_KAUTION = 93; public GewerbeSonstiges() { super(); this.setImmobilienart( Immobilienart.GEWERBE_SONSTIGES ); } public Integer getAnzahlParkflaechen() { try { return Is24CsvFormat.parseInteger( this.get( FIELD_ANZAHL_PARKFLAECHEN ) ); } catch (NumberFormatException ex) { LOGGER.warn( "Can't read 'Anzahl Parkflaechen'!" ); LOGGER.warn( "> " + ex.getLocalizedMessage(), ex ); return null; } } public Ausstattung getAusstattung() { return Ausstattung.parse( this.get( FIELD_AUSSTATTUNG ) ); } public Integer getBaujahr() { try { return Is24CsvFormat.parseInteger( this.get( FIELD_BAUJAHR ) ); } catch (NumberFormatException ex) { LOGGER.warn( "Can't read 'Baujahr'!" ); LOGGER.warn( "> " + ex.getLocalizedMessage(), ex ); return null; } } public Befeuerungsart[] getBefeuerungsart() { return Befeuerungsart.parseMultiple( this.get( FIELD_BEFEUERUNG ) ); } public Bodenbelag getBodenbelag() { return Bodenbelag.parse( this.get( FIELD_BODENBELAG ) ); } public Boolean getDenkmalschutz() { return Is24CsvFormat.parseBoolean( this.get( FIELD_DENKMALSCHUTZ ) ); } public Boolean getEnergieausweisInklWarmwasser() { return Is24CsvFormat.parseBoolean( this.get( FIELD_ENERGIEAUSWEIS_INKL_WARMWASSER ) ); } public BigDecimal getEnergieausweisKennwert() { try { return Is24CsvFormat.parseDecimal( this.get( FIELD_ENERGIEAUSWEIS_KENNWERT ) ); } catch (NumberFormatException ex) { LOGGER.warn( "Can't read 'Energieausweis-Kennwert'!" ); LOGGER.warn( "> " + ex.getLocalizedMessage(), ex ); return null; } } public EnergieausweisTyp getEnergieausweisTyp() { return EnergieausweisTyp.parse( this.get( FIELD_ENERGIEAUSWEIS_TYP ) ); } public String getEtagen() { return this.get( FIELD_ETAGEN ); } public Integer getFahrtwegAutobahn() { try { return Is24CsvFormat.parseInteger( this.get( FIELD_FAHRTWEG_AUTOBAHN ) ); } catch (NumberFormatException ex) { LOGGER.warn( "Can't read 'Fahrtweg zur Autobahn'!" ); LOGGER.warn( "> " + ex.getLocalizedMessage(), ex ); return null; } } public Integer getFahrtwegFlughafen() { try { return Is24CsvFormat.parseInteger( this.get( FIELD_FAHRTWEG_FLUGHAFEN ) ); } catch (NumberFormatException ex) { LOGGER.warn( "Can't read 'Fahrtweg zum Flughafen'!" ); LOGGER.warn( "> " + ex.getLocalizedMessage(), ex ); return null; } } public Integer getFahrtwegHauptbahnhof() { try { return Is24CsvFormat.parseInteger( this.get( FIELD_FAHRTWEG_HAUPTBAHNHOF ) ); } catch (NumberFormatException ex) { LOGGER.warn( "Can't read 'Fahrtweg zum Hauptbahnhof'!" ); LOGGER.warn( "> " + ex.getLocalizedMessage(), ex ); return null; } } public Integer getFusswegNahverkehr() { try { return Is24CsvFormat.parseInteger( this.get( FIELD_FUSSWEG_NAHVERKEHR ) ); } catch (NumberFormatException ex) { LOGGER.warn( "Can't read 'Fussweg zum Nahverkehr'!" ); LOGGER.warn( "> " + ex.getLocalizedMessage(), ex ); return null; } } public BigDecimal getGesamtflaeche() { try { return Is24CsvFormat.parseDecimal( this.get( FIELD_GESAMTFLAECHE ) ); } catch (NumberFormatException ex) { LOGGER.warn( "Can't read 'Gesamtflaeche'!" ); LOGGER.warn( "> " + ex.getLocalizedMessage(), ex ); return null; } } public BigDecimal getGewerbeflaeche() { try { return Is24CsvFormat.parseDecimal( this.get( FIELD_GEWERBEFLAECHE ) ); } catch (NumberFormatException ex) { LOGGER.warn( "Can't read 'Gewerbeflaeche'!" ); LOGGER.warn( "> " + ex.getLocalizedMessage(), ex ); return null; } } public BigDecimal getGrundstuecksflaeche() { try { return Is24CsvFormat.parseDecimal( this.get( FIELD_GRUNDSTUECKSFLAECHE ) ); } catch (NumberFormatException ex) { LOGGER.warn( "Can't read 'Grundstuecksflaeche'!" ); LOGGER.warn( "> " + ex.getLocalizedMessage(), ex ); return null; } } public Heizungsart getHeizungsart() { return Heizungsart.parse( this.get( FIELD_HEIZUNGSART ) ); } public String getKaution() { return this.get( FIELD_KAUTION ); } public Boolean getKeller() { return Is24CsvFormat.parseBoolean( this.get( FIELD_KELLER ) ); } public BigDecimal getNebenflaeche() { try { return Is24CsvFormat.parseDecimal( this.get( FIELD_NEBENFLAECHE ) ); } catch (NumberFormatException ex) { LOGGER.warn( "Can't read 'Nebenflaeche'!" ); LOGGER.warn( "> " + ex.getLocalizedMessage(), ex ); return null; } } public BigDecimal getNebenkosten() { try { return Is24CsvFormat.parseDecimal( this.get( FIELD_NEBENKOSTEN ) ); } catch (NumberFormatException ex) { LOGGER.warn( "Can't read 'Nebenkosten'!" ); LOGGER.warn( "> " + ex.getLocalizedMessage(), ex ); return null; } } public ObjektkategorieGewerbeSonstiges getObjektkategorie() { return ObjektkategorieGewerbeSonstiges.parse( this.get( FIELD_OBJEKTKATEGORIE ) ); } public Objektzustand getObjektzustand() { return Objektzustand.parse( this.get( FIELD_OBJEKTZUSTAND ) ); } public Boolean getPersonenaufzug() { return Is24CsvFormat.parseBoolean( this.get( FIELD_PERSONENAUFZUG ) ); } public BigDecimal getPreis() { try { return Is24CsvFormat.parseDecimal( this.get( FIELD_PREIS ) ); } catch (NumberFormatException ex) { LOGGER.warn( "Can't read 'Preis'!" ); LOGGER.warn( "> " + ex.getLocalizedMessage(), ex ); return null; } } public BigDecimal getPreisProParkflaeche() { try { return Is24CsvFormat.parseDecimal( this.get( FIELD_PREIS_PRO_PARKFLAECHE ) ); } catch (NumberFormatException ex) { LOGGER.warn( "Can't read 'Preis pro Parkflaeche'!" ); LOGGER.warn( "> " + ex.getLocalizedMessage(), ex ); return null; } } public Integer getSanierungsjahr() { try { return Is24CsvFormat.parseInteger( this.get( FIELD_SANIERUNGSJAHR ) ); } catch (NumberFormatException ex) { LOGGER.warn( "Can't read 'Sanierungsjahr'!" ); LOGGER.warn( "> " + ex.getLocalizedMessage(), ex ); return null; } } public BigDecimal getTeilbarAb() { try { return Is24CsvFormat.parseDecimal( this.get( FIELD_TEILBAR_AB ) ); } catch (NumberFormatException ex) { LOGGER.warn( "Can't read 'teilbar ab'!" ); LOGGER.warn( "> " + ex.getLocalizedMessage(), ex ); return null; } } public String getVerfuegbarAb() { return this.get( FIELD_VERFUEGBAR_AB ); } public VermarktungsartGewerbe getVermarktungsart() { return VermarktungsartGewerbe.parse( this.get( FIELD_VERMARKTUNGSART ) ); } public static GewerbeSonstiges newRecord( CSVRecord record ) { GewerbeSonstiges is24Record = new GewerbeSonstiges(); is24Record.parse( record ); return is24Record; } @Override protected Iterable<String> print() { this.setImmobilienart( Immobilienart.GEWERBE_SONSTIGES ); return super.print(); } public void setAnzahlParkflaechen( Number value ) { this.set( FIELD_ANZAHL_PARKFLAECHEN, Is24CsvFormat.printNumber( value, 5 ) ); } public void setAusstattung( Ausstattung value ) { this.set( FIELD_AUSSTATTUNG, (value!=null)? value.print(): null ); } public void setBaujahr( Number value ) { this.set( FIELD_BAUJAHR, Is24CsvFormat.printNumber( value, 4 ) ); } public void setBefeuerungsart( Befeuerungsart value ) { this.set( FIELD_BEFEUERUNG, (value!=null)? value.print(): null ); } public void setBefeuerungsart( Iterable<Befeuerungsart> values ) { this.set( FIELD_BEFEUERUNG, Befeuerungsart.printMultiple( values ) ); } public void setBodenbelag( Bodenbelag value ) { this.set( FIELD_BODENBELAG, (value!=null)? value.print(): null ); } public void setDenkmalschutz( Boolean value ) { this.set( FIELD_DENKMALSCHUTZ, Is24CsvFormat.printBoolean( value ) ); } public void setEnergieausweisInklWarmwasser( Boolean value ) { this.set( FIELD_ENERGIEAUSWEIS_INKL_WARMWASSER, Is24CsvFormat.printBoolean( value ) ); } public void setEnergieausweisKennwert( Number value ) { this.set( FIELD_ENERGIEAUSWEIS_KENNWERT, Is24CsvFormat.printNumber( value, 5, 2 ) ); } public void setEnergieausweisTyp( EnergieausweisTyp value ) { this.set( FIELD_ENERGIEAUSWEIS_TYP, (value!=null)? value.print(): null ); } public void setEtagen( String value ) { this.set( FIELD_ETAGEN, Is24CsvFormat.printString( value, 50 ) ); } public void setFahrtwegAutobahn( Number value ) { this.set( FIELD_FAHRTWEG_AUTOBAHN, Is24CsvFormat.printNumber( value, 3 ) ); } public void setFahrtwegFlughafen( Number value ) { this.set( FIELD_FAHRTWEG_FLUGHAFEN, Is24CsvFormat.printNumber( value, 3 ) ); } public void setFahrtwegHauptbahnhof( Number value ) { this.set( FIELD_FAHRTWEG_HAUPTBAHNHOF, Is24CsvFormat.printNumber( value, 2 ) ); } public void setFusswegNahverkehr( Number value ) { this.set( FIELD_FUSSWEG_NAHVERKEHR, Is24CsvFormat.printNumber( value, 2 ) ); } public void setGesamtflaeche( Number value ) { this.set( FIELD_GESAMTFLAECHE, Is24CsvFormat.printNumber( value, 10, 2 ) ); } public void setGewerbeflaeche( Number value ) { this.set( FIELD_GEWERBEFLAECHE, Is24CsvFormat.printNumber( value, 10, 2 ) ); } public void setGrundstuecksflaeche( Number value ) { this.set( FIELD_GRUNDSTUECKSFLAECHE, Is24CsvFormat.printNumber( value, 10, 2 ) ); } public void setHeizungsart( Heizungsart value ) { this.set( FIELD_HEIZUNGSART, (value!=null)? value.print(): null ); } public void setKaution( String value ) { this.set( FIELD_KAUTION, Is24CsvFormat.printString( value, 50 ) ); } public void setKeller( Boolean value ) { this.set( FIELD_KELLER, Is24CsvFormat.printBoolean( value ) ); } public void setNebenflaeche( Number value ) { this.set( FIELD_NEBENFLAECHE, Is24CsvFormat.printNumber( value, 10, 2 ) ); } public void setNebenkosten( Number value ) { this.set( FIELD_NEBENKOSTEN, Is24CsvFormat.printNumber( value, 15, 2 ) ); } public void setObjektkategorie( ObjektkategorieGewerbeSonstiges value ) { this.set( FIELD_OBJEKTKATEGORIE, (value!=null)? value.print(): null ); } public void setObjektzustand( Objektzustand value ) { this.set( FIELD_OBJEKTZUSTAND, (value!=null)? value.print(): null ); } public void setPersonenaufzug( Boolean value ) { this.set( FIELD_PERSONENAUFZUG, Is24CsvFormat.printBoolean( value ) ); } public void setPreis( Number value ) { this.set( FIELD_PREIS, Is24CsvFormat.printNumber( value, 15, 2 ) ); } public void setPreisProParkflaeche( Number value ) { this.set( FIELD_PREIS_PRO_PARKFLAECHE, Is24CsvFormat.printNumber( value, 15, 2 ) ); } public void setSanierungsjahr( Number value ) { this.set( FIELD_SANIERUNGSJAHR, Is24CsvFormat.printNumber( value, 4 ) ); } public void setTeilbarAb( Number value ) { this.set( FIELD_TEILBAR_AB, Is24CsvFormat.printNumber( value, 10, 2 ) ); } public void setVerfuegbarAb( String value ) { this.set( FIELD_VERFUEGBAR_AB, Is24CsvFormat.printString( value, 50 ) ); } public void setVermarktungsart( VermarktungsartGewerbe value ) { this.set( FIELD_VERMARKTUNGSART, (value!=null)? value.print(): null ); } }
[ "andy@openindex.de" ]
andy@openindex.de
5092e528eeffd866425eca003c15593b52fd1460
7e90b62799ddf034d2dce1b59ff2970f2a3fb345
/src/main/java/com/users/service/MessageServiceImpl.java
ec17d49c0e6ddd2b86254868e2370f5dbbd0c792
[]
no_license
adrianvas1/UserManagement
c0b7b7bbba08134b82f319d733e30dcec98ff44e
11bd01bf08f0b4bb82f28b688b0702266ca04711
refs/heads/master
2021-01-06T20:45:06.171498
2017-10-13T10:17:59
2017-10-13T10:17:59
99,556,667
0
0
null
null
null
null
UTF-8
Java
false
false
889
java
package com.users.service; import com.users.dao.MessageDaoImpl; import com.users.domain.Message; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; @Service public class MessageServiceImpl implements MessageService { @Autowired private MessageDaoImpl messageDao; @Autowired private ConversationService conversationService; @Override @Transactional public List getMessages(String conversationId) { if (conversationId == null || conversationId.isEmpty()) { return (List) messageDao.findAll(); } else return messageDao.findByConversationId(conversationId); } @Override @Transactional public Message create(Message dto) { return messageDao.save(dto); } }
[ "adrian.vas@endava.com" ]
adrian.vas@endava.com
3ede8c86323daaf02d34ccb220223a4ae7333750
8d4f3d6ab20df1f1aeae25e503ba598f71225c87
/src/inheritance/Problem03/Cat.java
d4f644249cc98cf3e25ed0355e334ff036abfbdf
[]
no_license
ChillyWe/JavaOOPBasicsOct2017
c6ad3a5aaaa011a65e80a927f9b9d915a773a5c3
aabf1d5b4e76537999366ca10c52c965ca58dab8
refs/heads/master
2021-04-03T05:55:56.285815
2018-03-11T13:07:48
2018-03-11T13:07:48
118,263,257
0
0
null
null
null
null
UTF-8
Java
false
false
188
java
package inheritance.Problem03; /** * Created by Chilly on 30.10.2017 г.. */ public class Cat extends Animal { public void meow (){ System.out.println("meowing..."); } }
[ "chilly@mail.bg" ]
chilly@mail.bg
92d643c369090bee6592e0d6dbf89319aeb31ec9
9a2186406604c63f87d2039227c7d3544b98a301
/src/com/baiyun2/fragment/sliding/ToolsScanFragment.java
e79c12f4ea1b3768997fe5440ad3ff6b45b04cd6
[]
no_license
Holyn/BaiYun2
179441d9e39ffb991d3e8e3dc23f8718a8994316
a8b5af4836bc70b3aea0109a1ab62a937f0893ab
refs/heads/master
2021-01-17T05:28:33.824167
2015-09-23T07:37:04
2015-09-23T07:37:04
39,782,388
0
0
null
null
null
null
UTF-8
Java
false
false
574
java
package com.baiyun2.fragment.sliding; import android.view.View; import com.baiyun2.activity.R; import com.baiyun2.base.BaseFragment; public class ToolsScanFragment extends BaseFragment{ public static ToolsScanFragment newInstance() { return new ToolsScanFragment(); } public ToolsScanFragment() { // TODO Auto-generated constructor stub } @Override public int getLayoutId() { // TODO Auto-generated method stub return R.layout.fragment_tools_scan; } @Override public void createMyView(View rootView) { // TODO Auto-generated method stub } }
[ "328550680@qq.com" ]
328550680@qq.com
bea68f6bcfef29474f1fa0e513b2350f14928075
4bd3c5390eebb90d5d61d45f94e94581dd06c585
/eclipse-workspace/Homework2/src/Dailylife.java
3fcf910c1f82e0da229742547fe569302d280b26
[]
no_license
EmilMartinez/Selection-
c8e8a2e049952ac6783071b6193ada6e4c00c83e
6773d0cd41cd61d6ac356b172fc46195821b43a2
refs/heads/master
2020-04-26T06:02:42.037685
2019-03-14T19:13:58
2019-03-14T19:13:58
173,352,711
0
0
null
null
null
null
UTF-8
Java
false
false
655
java
public class Dailylife { float shoeSize; int timeIWorkOut; String myBusinessName; char mySexSymbol; double myWeight; public Dailylife (float showSi) { this.shoeSize = showSi; System.out.println(shoeSize); } public Dailylife (int timeIWork) { this.timeIWorkOut = timeIWork; System.out.println(timeIWorkOut); } public Dailylife (String myBusinessN) { this.myBusinessName = myBusinessN; System.out.println(myBusinessName); } public Dailylife (char mySexS) { this.mySexSymbol = mySexS; System.out.println(mySexSymbol); } public Dailylife (double myWei) { this.myWeight = myWei; System.out.println(myWeight); } }
[ "emilmrtnz@gmail.com" ]
emilmrtnz@gmail.com
ef61b225cf6fa6445889b5aae33224d7f0014fcf
f32bfaf656032f60ee004aa85642b281f338bd3d
/src/design/behavioral/strategy/ShoppingCart.java
9bcade6a30b372c0f2187c673cee4de7b1120297
[]
no_license
plasante/designpatterns
b0f5de4ccc781c8373e741949554167ad667949b
55a99643bbc21ed7c603756498a8bf25ca05d925
refs/heads/master
2021-01-19T17:59:52.430475
2014-12-06T14:24:43
2014-12-06T14:24:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
575
java
package design.behavioral.strategy; import java.util.ArrayList; import java.util.List; public class ShoppingCart { List<Item>items; public ShoppingCart() { this.items = new ArrayList<>(); } public void addItem(Item item) { this.items.add(item); } public void removeItem(Item item) { this.items.remove(item); } public int calculateTotal() { int sum = 0; for (Item item : items) { sum += item.getPrice(); } return sum; } public void pay(PaymentStrategy paymentMethod) { int amount = calculateTotal(); paymentMethod.pay(amount); } }
[ "pierre.lasante@videotron.ca" ]
pierre.lasante@videotron.ca
8a29a100c9d9190845eda2644105ceb6d54b1f4d
3fefb7d2c813c0ec9f43b26f541a37596e389d60
/src/main/java/DataStructureAlgo/dynamic_programming/data_structures/hash_tables/MyNode.java
ae492668945dd9c605b6349158f6bb1a10bd6f2f
[]
no_license
lakviat/JavaDevelopment
f991dce487318d0605390980c1eaf4e7a9a26eae
a582380ca5c50e0eb4f2ee67aa1b0448fc5873dd
refs/heads/master
2023-08-08T14:20:45.280138
2023-08-08T13:47:46
2023-08-08T13:47:46
176,372,053
0
1
null
2023-08-01T14:51:37
2019-03-18T21:25:12
Java
UTF-8
Java
false
false
460
java
package DataStructureAlgo.dynamic_programming.data_structures.hash_tables; public class MyNode { private String key; private int value; public MyNode(String key, int value) { this.key = key; this.value = value; } public String getKey() { return key; } public void setKey(String key) { this.key = key; } public int getValue() { return value; } public void setValue(int value) { this.value = value; } }
[ "Nurlan259683" ]
Nurlan259683
568e3978587736a940a56ddb80e7415c46563b41
401c1c63fe7613fb7ee1df66515badda62fd9641
/app/src/androidTest/java/me/jcala/xmarket/ApplicationTest.java
60f7a254f512141110402b6bf0fa380b99795f9c
[]
no_license
SagarDep/xmarket
8f19f31683aa92339067dfc269a5b9855a7e084a
fb7677f6b244e8d2d8b45565fcc929dddae8b368
refs/heads/master
2020-04-06T19:14:01.387264
2017-07-11T04:56:49
2017-07-11T04:56:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
347
java
package me.jcala.xmarket; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
[ "jcalaz@163.com" ]
jcalaz@163.com
3642c174c3c15070832ad829bc8152fae2fbfdc6
e8993a2e127ee223b457c145ce84cd8fd1f48b70
/src/main/java/br/com/mulato/cso/dao/BusinessDAO.java
4d6ed276ab063050f9b1e119b532b90a8bae820f
[]
no_license
chmulato/csonline
09a66dd2b56d97765415310ce8c50557c8c13568
5d485e926c9724b63b98a7e8936f457f1055860f
refs/heads/master
2023-09-01T09:28:38.500174
2023-08-21T20:10:28
2023-08-21T20:10:28
58,210,871
2
0
null
2023-08-21T20:10:19
2016-05-06T13:56:42
Java
UTF-8
Java
false
false
925
java
package br.com.mulato.cso.dao; import java.util.List; import br.com.mulato.cso.dry.InterfaceSQL; import br.com.mulato.cso.exception.DAOException; import br.com.mulato.cso.model.BusinessVO; import br.com.mulato.cso.model.CourierVO; import br.com.mulato.cso.model.CustomerVO; import br.com.mulato.cso.model.DeliveryVO; public interface BusinessDAO extends InterfaceSQL { public BusinessVO findCustomerBusiness (CustomerVO customer) throws DAOException; public BusinessVO findCourierBusiness (CourierVO courier) throws DAOException; public BusinessVO findDeliveryBusiness (DeliveryVO delivery) throws DAOException; public BusinessVO find (Integer id) throws DAOException; public void insert (BusinessVO business) throws DAOException; public void update (BusinessVO business) throws DAOException; public void delete (Integer id) throws DAOException; public List<BusinessVO> listAll () throws DAOException; }
[ "chmulato@gmail.com" ]
chmulato@gmail.com
a4cabf755ec3a7747c0e23421ccfebe4a2c7493f
04cbb8c15ae0b3446606adf8419596d18f25b788
/TestProject/src/StringJoinDemo.java
6cb2839739e3395c169e4a4eb031118c58fbc184
[]
no_license
damukethireddy/Spring-Cloud
db3a8578691c3a59a194adfb840fba4ecb9df1ed
c1efe7e10e1a3b8784095e40d92987039e8ad783
refs/heads/master
2022-11-14T21:53:39.515467
2020-07-09T09:53:14
2020-07-09T09:53:14
278,070,537
0
0
null
null
null
null
UTF-8
Java
false
false
283
java
import java.time.ZoneId; public class StringJoinDemo { public static void main(String[] args) { String joined = String.join("-", "usr", "local", "bin"); System.out.println(joined); String ids = String.join(", ", ZoneId.getAvailableZoneIds()); System.out.println(ids); } }
[ "damukethireddy@gmail.com" ]
damukethireddy@gmail.com
8980fa51cf5f9bc6d2b905d7ba5fa631a5d431a5
b5b025af5fba0000691b181758a0d38db416ce80
/src/test/java/za/ac/cput/HashMapTest.java
10d2dd927e4f307b118b18d016d2f9b467a931fe
[]
no_license
Phindiwe/TestInterfaces
49f9d04a5661e261b8646e5a84d8ce21ae57178d
852231da76d34205b774a80834724c1cf54a362f
refs/heads/master
2023-04-29T18:13:13.729674
2021-05-12T16:33:40
2021-05-12T16:33:40
366,136,999
0
0
null
null
null
null
UTF-8
Java
false
false
754
java
package za.ac.cput; import org.junit.jupiter.api.Test; import java.util.HashMap; import java.util.Map; import static org.junit.jupiter.api.Assertions.*; class HashMapTest { Map<Integer,String> map = new HashMap<>(); @Test void add() { map.put( 5, "Phindiwe"); assertEquals(1, map.size()); map.put( 6, "Bambata"); assertEquals(2, map.size()); } @Test void remove() { map.put( 5,"Phindiwe"); map.put( 6,"Bambata"); map.remove(5); System.out.println(map); assertEquals(1, map.size()); } @Test void find(){ map.put( 5,"Phindiwe"); map.put( 6,"Bambata"); //map.get(5); System.out.println(map.get(5)); } }
[ "bambata.p@gmail.com" ]
bambata.p@gmail.com
5f3ff68f68440efd34726016a4b2b4bdd6427e5e
be64191c8be369808e1c14a99e7deb0eee5a3043
/Rent_io2/src/src/Graph.java
12fa39984fc33d741bfe119af1d9cfcccc048cba
[]
no_license
liam-casola/2xb3_final_g6
1457803883fdc065492264bcf0134edb3fd3c07b
5a601028b0042396adf6cc8ac8b9d35a874e267d
refs/heads/master
2021-01-19T13:49:30.248893
2017-04-10T23:18:29
2017-04-10T23:18:29
82,420,626
1
1
null
null
null
null
UTF-8
Java
false
false
2,476
java
package src; public class Graph { private static final String NEWLINE = System.getProperty("line.separator"); private final int V; private int E; private Bag<Edge>[] adj; //instantiates a new graph of with V verticies public Graph(int V) { if (V < 0) throw new IllegalArgumentException("Number of vertices must be nonnegative"); this.V = V; this.E = 0; //create the adjancy list using the Bag ADT from the lags 4 website. This list will be used to store all adjacent //vertexe's for any given vertex adj = (Bag<Edge>[]) new Bag[V]; //initalize each Bag in the list for (int v = 0; v < V; v++) { adj[v] = new Bag<Edge>(); } } //retunr the number of vertex's in the graph public int V() { return V; } //return the number of edges in the graph public int E() { return E; } // verify that the vertex v exists inside the graph private void validateVertex(int v) { if (v < 0 || v >= V) throw new IllegalArgumentException("vertex " + v + " is not between 0 and " + (V-1)); } //add a new weighted edge to the graph public void addEdge(Edge e) { int v = e.either(); int w = e.other(v); validateVertex(v); validateVertex(w); adj[v].add(e); adj[w].add(e); E++; } //retun all the edges stored in the bag at the vertex v as an iterable public Iterable<Edge> adj(int v) { validateVertex(v); return adj[v]; } //return the number of edges connected to the specified vertex v public int degree(int v) { validateVertex(v); return adj[v].size(); } //return every edge in the graph as an iterable public Iterable<Edge> edges() { Bag<Edge> list = new Bag<Edge>(); for (int v = 0; v < V; v++) { int selfLoops = 0; for (Edge e : adj(v)) { if (e.other(v) > v) { list.add(e); } // only add one copy of each self loop (self loops will be consecutive) else if (e.other(v) == v) { if (selfLoops % 2 == 0) list.add(e); selfLoops++; } } } return list; } }
[ "noreply@github.com" ]
noreply@github.com
1e84792e9758b02701843d63ed00b25ee16abd99
b750ef44a69797456c5ee72a08a267d30d8162b7
/src/com/examples/basic/FibonacciExample1.java
09cde4ee1239370ad3f1ac9c9e41c54ab9e7856d
[]
no_license
subhranshu1003/corejavainterviewprograms
36b5a7512acf334bd00b1a00fc224188fd00a656
cebc8c7693c020f81f88a124fb21f6e2a8b95639
refs/heads/master
2022-12-25T18:57:35.521997
2020-10-02T07:41:19
2020-10-02T07:41:19
272,009,241
0
0
null
null
null
null
UTF-8
Java
false
false
585
java
//this program is to find fibonaci series package com.examples.basic; import java.util.Scanner; public class FibonacciExample1 { public static void main(String[] args) { int n1 = 0, n2 = 1, n3, i; Scanner scanner = new Scanner(System.in); System.out.println("Enter the value of n:"); int count = scanner.nextInt();// fibonaci series upto count System.out.print(n1 + " " + n2);// printing 0 and 1 for (i = 2; i < count; ++i)// loop starts from 2 because 0 and 1 are already printed { n3 = n1 + n2; System.out.print(" " + n3); n1 = n2; n2 = n3; } } }
[ "subh.pujari@gmail.com" ]
subh.pujari@gmail.com
a8a52c36ab37d875ac687c9cd5f6987bd2cfffb5
7ea656240ed7fd8500f201b2c3225f0d4301d47a
/src/prime_patt.java
ddad0ad4894462dd32a1a1b938af7393760ad24e
[]
no_license
B18java/Ayush_BTES
8dd4eb1bd3b9202a0398f32af25d877ffa236bd3
0b4cbefa565f3859ce0d29cb69e085d8d6aec028
refs/heads/master
2021-09-07T08:28:25.460724
2018-02-20T08:33:53
2018-02-20T08:33:53
122,172,489
0
0
null
null
null
null
UTF-8
Java
false
false
479
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. */ /** * * @author DELL */ public class prime_patt { public static void main(String args[]) { char a[]={' ',' ',' ',' ',' '}; for(int i=0;i<5;i++) { System.out.println(a); a[i]='*'; } } }
[ "DELL@DELL-PC" ]
DELL@DELL-PC
67940883e8c4384a59e1fb1318ca88a33c0774d9
dec0acd462a0dc5772f3840b62df68ce106a8126
/framework/spring/spring-amqp/src/main/java/org/laidu/learn/amqp/rabbitmq/java/package-info.java
5d3a0c37ddccf8d5c0b44bc576cdd8d9947f5750
[ "Apache-2.0" ]
permissive
laidu/java-learn
5382cf6a635871de27d0bd84ee75a35a5e45936d
e33e1ca519652c06e6dea47159daeb6f1f76431c
refs/heads/master
2023-07-09T10:37:17.163359
2023-06-26T14:07:57
2023-06-26T14:07:57
100,566,396
12
3
Apache-2.0
2023-07-07T22:07:28
2017-08-17T05:50:37
Java
UTF-8
Java
false
false
181
java
/** * no spring use spring-amqp * * @author tiancai.zang * 2018-01-11 16:18. */ // TODO: 2018-01-11 16:18 no spring use spring-amqp package org.laidu.learn.amqp.rabbitmq.java;
[ "laidu823@sina.com" ]
laidu823@sina.com
80ce1f4221691dcfbf8625d47192116cc4b6c2d6
bd67107fcbca524f22c686e5c07578361493f9f5
/src/com/clean/CleanActivity.java
a701ada88d241074b747d9e9f2cb1ba581f8c0b2
[]
no_license
fengcunhan/Clean
34e63f0204027e0056b12b7c8be06ca88a02710f
8d7a49437aebe6217071b838ce51c077d5c5dba0
refs/heads/master
2021-01-01T06:33:26.224961
2012-03-09T13:04:53
2012-03-09T13:04:53
3,670,161
0
0
null
null
null
null
UTF-8
Java
false
false
1,986
java
package com.clean; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ListView; import com.clean.adapter.ParentAdapter; import com.clean.database.LogUtil; import com.clean.model.Item; import com.clean.widget.CleanListView; public class CleanActivity extends CleanBaseListActivity { /** Called when the activity is first created. */ private static final String TAG = "CleanActivity"; public class Pair{ public int _id; public String name; public int count; public int order; } private List<Pair> pairs; private ParentAdapter adapter; private CleanListView listView; public static final String CHILDREN_ACTION="android.intent.action.VIEW_CHILDREN"; public static final String PARENT_ID="parent_id"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); listView=(CleanListView)findViewById(android.R.id.list); pairs=new ArrayList<CleanActivity.Pair>(); try { List<Item> items=databaseHelper.getAllChildren(0); for(Item item:items){ Pair pair=new Pair(); pair._id=item._id; pair.name=item.name; pair.count=item.childrenNum; pair.order=item.order; pairs.add(pair); } adapter=new ParentAdapter(pairs); listView.setAdapter(adapter); } catch (SQLException e) { // TODO Auto-generated catch block LogUtil.exception(TAG, e); } listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // TODO Auto-generated method stub Intent intent=new Intent(CHILDREN_ACTION); intent.putExtra(PARENT_ID, pairs.get(position)._id); startActivity(intent); } }); } }
[ "fengcunhan@126.com" ]
fengcunhan@126.com
e2dd28584a4dc6791cdae53073a60fde04687190
152af3a25fff3b4d509c60ea1c9f43d8c317d88f
/app/src/main/java/mx/yobibytelabs/rescatapp/util/ConnectionDetector.java
7cb7dcd92b7b25d5d50d4aa276d65ce36cdf97f0
[]
no_license
YobiByteLabs/Rescatapp
f3340bff7d22003fafa7863441066e87c6cbb785
a1e2c5f529e4eb951042f74fdf9cec3006cf6fe7
refs/heads/master
2016-09-05T12:15:48.336680
2014-09-13T17:15:25
2014-09-13T17:15:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
952
java
package mx.yobibytelabs.rescatapp.util; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; /** * Created by jagspage2013 on 21/07/14. */ public class ConnectionDetector { private Context _context; public ConnectionDetector(Context _context){ this._context = _context; } public boolean isConnectedToInternet(){ ConnectivityManager connectivityManager = (ConnectivityManager) _context.getSystemService(Context.CONNECTIVITY_SERVICE); if(connectivityManager !=null){ NetworkInfo[] networkInfo = connectivityManager.getAllNetworkInfo(); if(networkInfo!=null){ for(int i = 0; i<networkInfo.length;i++){ if(networkInfo[i].getState() == NetworkInfo.State.CONNECTED ){ return true; } } } } return false; } }
[ "jagspage2012@gmail.com" ]
jagspage2012@gmail.com
843dbf1c71637de944db93cb633f8f352c6f333e
8e83520b591a09f3ec5d029486bca56ffbf33169
/Recursion5.java
de9eb150f959b2e183d8df572fb1c086ced0d3a0
[]
no_license
deepakprasad20/Programming-Practice
a587d62a85d7d22638b6975cc0bf76194325391f
728f545ca1a49305d2b11a7bc29b6a32599e69ea
refs/heads/main
2023-06-17T00:35:34.203345
2021-07-08T14:05:21
2021-07-08T14:05:21
319,072,561
0
0
null
null
null
null
UTF-8
Java
false
false
981
java
import java.util.ArrayList; import java.util.LinkedList; import java.util.Queue; import java.util.Stack; public class Recursion5 { public static void main(String[] args){ Stack<Integer> stack = new Stack<>(); stack.push(1); stack.push(2); stack.push(3); stack.push(4); stack.push(5); stack.push(6); reverseStack(stack ); while(!stack.isEmpty()){ System.out.println(stack.pop()); } } private static void reverseStack(Stack<Integer> stack) { if(stack.isEmpty()){ return; } int tmp = stack.pop(); reverseStack(stack); insert(stack,tmp); } private static void insert(Stack<Integer> stack, int tmp) { if(stack.isEmpty()){ stack.push(tmp); return; } int ele = stack.pop(); insert(stack,tmp); stack.push(ele); } }
[ "noreply@github.com" ]
noreply@github.com
f4a145b419d7376ea281ad3319d764f174ff3b79
6e8ed39021fb71d2013fb40f4c351c6480a278a3
/src/main/java/com/cngc/pm/activiti/jpa/entity/AttachmentEntity.java
537c4c8a5a6b12d6c72a4af52ac14420d0ee9029
[]
no_license
magiczero/SpringMVCHibernate
a0cbf866a1e481f22300b515f481515976f7994e
9474d85d725e7a99341bb127d592a0925edafdb1
refs/heads/master
2021-04-24T15:41:34.765208
2019-02-01T06:21:41
2019-02-01T06:21:41
39,990,190
0
1
null
2016-06-06T08:12:22
2015-07-31T06:26:27
JavaScript
UTF-8
Java
false
false
5,922
java
package com.cngc.pm.activiti.jpa.entity; import java.io.Serializable; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; import com.cngc.pm.model.AttachType; @Entity(name = "attachment") public class AttachmentEntity implements Serializable{ /** * */ private static final long serialVersionUID = 7313893974105561586L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String name; //原始名,会重名 private String thumbnailFilename; private String newFilename; //需重新命名 private String contentType; //网络文件的类型和网页的编码,如“application/octet-stream” @Column(name = "path_") private String path; //保存到服务器中的路径 @Column(name = "size_") private Long size; //文件大小 @Enumerated(EnumType.ORDINAL) @Column(name="type_") private AttachType type; //文件是哪个类的附件 private Long thumbnailSize; @Temporal(TemporalType.TIMESTAMP) private Date dateCreated; //上传日期 @Temporal(TemporalType.TIMESTAMP) private Date lastUpdated; @Transient private String url; @Transient private String thumbnailUrl; @Transient private String deleteUrl; @Transient private String deleteType; /** * @return the id */ public Long getId() { return id; } /** * @param id the id to set */ public void setId(Long id) { this.id = id; } /** * @return the name */ public String getName() { return name; } /** * @param name the name to set */ public void setName(String name) { this.name = name; } /** * @return the thumbnailFilename */ public String getThumbnailFilename() { return thumbnailFilename; } /** * @param thumbnailFilename the thumbnailFilename to set */ public void setThumbnailFilename(String thumbnailFilename) { this.thumbnailFilename = thumbnailFilename; } /** * @return the newFilename */ public String getNewFilename() { return newFilename; } /** * @param newFilename the newFilename to set */ public void setNewFilename(String newFilename) { this.newFilename = newFilename; } /** * @return the contentType */ public String getContentType() { return contentType; } /** * @param contentType the contentType to set */ public void setContentType(String contentType) { this.contentType = contentType; } /** * @return the size */ public Long getSize() { return size; } /** * @param size the size to set */ public void setSize(Long size) { this.size = size; } /** * @return the thumbnailSize */ public Long getThumbnailSize() { return thumbnailSize; } /** * @param thumbnailSize the thumbnailSize to set */ public void setThumbnailSize(Long thumbnailSize) { this.thumbnailSize = thumbnailSize; } /** * @return the dateCreated */ public Date getDateCreated() { return dateCreated; } /** * @param dateCreated the dateCreated to set */ public void setDateCreated(Date dateCreated) { this.dateCreated = dateCreated; } /** * @return the lastUpdated */ public Date getLastUpdated() { return lastUpdated; } /** * @param lastUpdated the lastUpdated to set */ public void setLastUpdated(Date lastUpdated) { this.lastUpdated = lastUpdated; } /** * @return the url */ public String getUrl() { return url; } /** * @param url the url to set */ public void setUrl(String url) { this.url = url; } /** * @return the thumbnailUrl */ public String getThumbnailUrl() { return thumbnailUrl; } /** * @param thumbnailUrl the thumbnailUrl to set */ public void setThumbnailUrl(String thumbnailUrl) { this.thumbnailUrl = thumbnailUrl; } /** * @return the deleteUrl */ public String getDeleteUrl() { return deleteUrl; } /** * @param deleteUrl the deleteUrl to set */ public void setDeleteUrl(String deleteUrl) { this.deleteUrl = deleteUrl; } /** * @return the deleteType */ public String getDeleteType() { return deleteType; } /** * @param deleteType the deleteType to set */ public void setDeleteType(String deleteType) { this.deleteType = deleteType; } public AttachType getType() { return type; } public void setType(AttachType type) { this.type = type; } public String getPath() { return path; } public void setPath(String path) { this.path = path; } @Override public String toString() { return "File{" + "name=" + name + ", thumbnailFilename=" + thumbnailFilename + ", newFilename=" + newFilename + ", contentType=" + contentType + ", url=" + url + ", thumbnailUrl=" + thumbnailUrl + ", deleteUrl=" + deleteUrl + ", deleteType=" + deleteType + '}'; } }
[ "andy@andy-PC" ]
andy@andy-PC
99eb20fca2c76a92cc740b530e593784524e6ff9
9b4a78bfeca060591475d4499ad2e5fa0cf9658e
/sources/androidx/core/content/res/GrowingArrayUtils.java
94f563a7f0e0d57866310382de41dc85665d69fd
[]
no_license
anobhama/quiz_mobile_app
2829562430bf88fc98e2abb07b19f1b8166c971f
4067449f242aa9895df10db444032b50e2b3cdca
refs/heads/master
2023-04-04T02:31:22.707844
2021-04-25T19:34:02
2021-04-25T19:34:02
361,520,164
0
0
null
null
null
null
UTF-8
Java
false
false
4,266
java
package androidx.core.content.res; import java.lang.reflect.Array; final class GrowingArrayUtils { static final /* synthetic */ boolean $assertionsDisabled = false; public static <T> T[] append(T[] array, int currentSize, T element) { if (currentSize + 1 > array.length) { T[] newArray = (Object[]) Array.newInstance(array.getClass().getComponentType(), growSize(currentSize)); System.arraycopy(array, 0, newArray, 0, currentSize); array = newArray; } array[currentSize] = element; return array; } public static int[] append(int[] array, int currentSize, int element) { if (currentSize + 1 > array.length) { int[] newArray = new int[growSize(currentSize)]; System.arraycopy(array, 0, newArray, 0, currentSize); array = newArray; } array[currentSize] = element; return array; } public static long[] append(long[] array, int currentSize, long element) { if (currentSize + 1 > array.length) { long[] newArray = new long[growSize(currentSize)]; System.arraycopy(array, 0, newArray, 0, currentSize); array = newArray; } array[currentSize] = element; return array; } public static boolean[] append(boolean[] array, int currentSize, boolean element) { if (currentSize + 1 > array.length) { boolean[] newArray = new boolean[growSize(currentSize)]; System.arraycopy(array, 0, newArray, 0, currentSize); array = newArray; } array[currentSize] = element; return array; } public static <T> T[] insert(T[] array, int currentSize, int index, T element) { if (currentSize + 1 <= array.length) { System.arraycopy(array, index, array, index + 1, currentSize - index); array[index] = element; return array; } T[] newArray = (Object[]) Array.newInstance(array.getClass().getComponentType(), growSize(currentSize)); System.arraycopy(array, 0, newArray, 0, index); newArray[index] = element; System.arraycopy(array, index, newArray, index + 1, array.length - index); return newArray; } public static int[] insert(int[] array, int currentSize, int index, int element) { if (currentSize + 1 <= array.length) { System.arraycopy(array, index, array, index + 1, currentSize - index); array[index] = element; return array; } int[] newArray = new int[growSize(currentSize)]; System.arraycopy(array, 0, newArray, 0, index); newArray[index] = element; System.arraycopy(array, index, newArray, index + 1, array.length - index); return newArray; } public static long[] insert(long[] array, int currentSize, int index, long element) { if (currentSize + 1 <= array.length) { System.arraycopy(array, index, array, index + 1, currentSize - index); array[index] = element; return array; } long[] newArray = new long[growSize(currentSize)]; System.arraycopy(array, 0, newArray, 0, index); newArray[index] = element; System.arraycopy(array, index, newArray, index + 1, array.length - index); return newArray; } public static boolean[] insert(boolean[] array, int currentSize, int index, boolean element) { if (currentSize + 1 <= array.length) { System.arraycopy(array, index, array, index + 1, currentSize - index); array[index] = element; return array; } boolean[] newArray = new boolean[growSize(currentSize)]; System.arraycopy(array, 0, newArray, 0, index); newArray[index] = element; System.arraycopy(array, index, newArray, index + 1, array.length - index); return newArray; } public static int growSize(int currentSize) { if (currentSize <= 4) { return 8; } return currentSize * 2; } private GrowingArrayUtils() { } }
[ "anobhama99@gmail.com" ]
anobhama99@gmail.com
32ca6017bbc9d81f3adfbf0a7875b9fe68669c40
8778dae3d5362df3492560815189ec301c9e17f2
/SearchAlgos.java
2d4d569cb249e717d8c0119252f4a7fb8a290115
[]
no_license
DuckShyamalan/blocksworld-tile-puzzle
e0fdd3681bb4b1605f275a7b8cae5b8bfee8a37d
f9cdd1961012e1ec45fed0dcdaa94fe2469cbace
refs/heads/master
2020-12-01T00:23:56.479445
2019-12-27T21:33:36
2019-12-27T21:33:36
230,520,687
0
0
null
null
null
null
UTF-8
Java
false
false
12,164
java
import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.PriorityQueue; import java.util.Random; import java.util.Stack; public class SearchAlgos { /* * This class is a set of 4 search algorithms to solve the puzzle. * It contains Breadth First Search, Depth First Search, Iterative * Deepening and A* Heuristic. To use Depth First Search, use dfs() with * a negative iterations value, otherwise, using it with a +ve iterations * value does Iterative Deepening. */ public static void main(String[] args) { SearchAlgos sa = new SearchAlgos(); //sa.bfs(new Nodes(4)); //new bfs //sa.dfs(new Nodes(4)); //new dfs sa.ids(new Nodes(4), 20); //new ids //sa.aStar(new Manhattan(4)); //a* } public void aStar(Manhattan root) { long startTime = System.nanoTime(); PriorityQueue<Manhattan> open = new PriorityQueue<Manhattan>(); ArrayList<Manhattan> closed = new ArrayList<Manhattan>(); int nodesGen = 0; open.add(root); while (!open.isEmpty()) { Manhattan mi = open.poll(); // for (Manhattan man : open) { //find min f // if (mi == null || man.f < mi.f) { // mi = man; // } // } // open.remove(mi); closed.add(mi); nodesGen++; // just print details mi.getGrid().currentGrid(); System.out.println("Node depth: " + mi.getDepth() + " Node direction: " + mi.directionFromParent); System.out.println("-------------------------------------------------"); if (mi.getGrid().checkSolved()) { long endTime = System.nanoTime(); long totalTime = (endTime - startTime)/1000000; //total time in millisec System.out.println("Puzzle has been solved in: " + totalTime + "ms"); System.out.println("no. of nodes generated: " + nodesGen); System.out.println("Space Complexity of solution: " + open.size()); //time and space complexity are O(bm) //check up on this? Nodes nodePath = mi; String path = nodePath.getDirectionFromParent(); while((nodePath = nodePath.getParent()) != null) { path = nodePath.getDirectionFromParent() + ", " + path; } System.out.println("Path to solution: " + path); return; } //second condition to check if we've not just visited the node if (mi.getGrid().checkMove("up") && !mi.directionFromParent.equals("DOWN")) { Manhattan next = new Manhattan(new Grid(mi.getGrid()), (mi.getDepth() + 1), "UP", mi); if (!open.contains(next) || next.f < mi.f) { next.getGrid().move("up"); open.add(next); } } if (mi.getGrid().checkMove("down") && !mi.directionFromParent.equals("UP")) { Manhattan next = new Manhattan(new Grid(mi.getGrid()), (mi.getDepth() + 1), "DOWN", mi); if (!open.contains(next) || next.f < mi.f) { next.getGrid().move("down"); open.add(next); } } if (mi.getGrid().checkMove("left") && !mi.directionFromParent.equals("RIGHT")) { Manhattan next = new Manhattan(new Grid(mi.getGrid()), (mi.getDepth() + 1), "LEFT", mi); if (!open.contains(next) || next.f < mi.f) { next.getGrid().move("left"); open.add(next); } } if (mi.getGrid().checkMove("right") && !mi.directionFromParent.equals("LEFT")) { Manhattan next = new Manhattan(new Grid(mi.getGrid()), (mi.getDepth() + 1), "RIGHT", mi); if (!open.contains(next) || next.f < mi.f) { next.getGrid().move("right"); open.add(next); } } } } //Uses a linked list(preserving insertion order) to expand nodes public void bfs(Nodes root) { long startTime = System.nanoTime(); LinkedList<Nodes> fringe = new LinkedList<Nodes>(); //FIFO queue ArrayList<Nodes> explored = new ArrayList<Nodes>(); if (root == null) { return; } else { fringe.add(root); } int nodesGen = 0; //nodes generated while (!fringe.isEmpty()) { Nodes temp = fringe.poll(); explored.add(temp); nodesGen++; // just print details temp.getGrid().currentGrid(); System.out.println("Node depth: " + temp.getDepth() + " Node direction: " + temp.directionFromParent); System.out.println("-------------------------------------------------"); if (temp.getGrid().checkSolved()) { long endTime = System.nanoTime(); long totalTime = (endTime - startTime)/1000000; //total time in millisec System.out.println("Puzzle has been solved in: " + totalTime + "ms"); System.out.println("no. of nodes generated: " + nodesGen); System.out.println("Space Complexity: " + explored.size()); Nodes nodePath = temp; String path = nodePath.getDirectionFromParent(); while((nodePath = nodePath.getParent()) != null) { path = nodePath.getDirectionFromParent() + ", " + path; } System.out.println("Path to solution: " + path); return; } //second condition to check if we've not just visited the node if (temp.getGrid().checkMove("up") && !temp.directionFromParent.equals("DOWN")) { Nodes next = new Nodes(new Grid(temp.getGrid()), temp.getDepth() + 1, "UP", temp); if (!fringe.contains(next) && !explored.contains(next)) { //not already visited next.getGrid().move("up"); fringe.add(next); } } if (temp.getGrid().checkMove("down") && !temp.directionFromParent.equals("UP")) { Nodes next = new Nodes(new Grid(temp.getGrid()), temp.getDepth() + 1, "DOWN", temp); if (!fringe.contains(next) && !explored.contains(next)) { next.getGrid().move("down"); fringe.add(next); } } if (temp.getGrid().checkMove("left") && !temp.directionFromParent.equals("RIGHT")) { Nodes next = new Nodes(new Grid(temp.getGrid()), temp.getDepth() + 1, "LEFT", temp); if (!fringe.contains(next) && !explored.contains(next)) { next.getGrid().move("left"); fringe.add(next); } } if (temp.getGrid().checkMove("right") && !temp.directionFromParent.equals("LEFT")){ Nodes next = new Nodes(new Grid(temp.getGrid()), temp.getDepth() + 1, "RIGHT", temp); if (!fringe.contains(next) && !explored.contains(next)) { next.getGrid().move("right"); fringe.add(next); } } } } //Uses a stack to expand nodes to have a LIFO queue-like structure public void dfs(Nodes root) { long startTime = System.nanoTime(); Stack<Nodes> fringe = new Stack<Nodes>(); //LIFO queue if (root == null) { return; } else { fringe.push(root); } int nodesGen = 0; while (!fringe.isEmpty()) { Nodes temp = fringe.pop(); nodesGen++; // just print details temp.getGrid().currentGrid(); System.out.println("Node depth: " + temp.getDepth() + " Node direction: " + temp.directionFromParent); System.out.println("-------------------------------------------------"); //check if solved if (temp.getGrid().checkSolved()) { long endTime = System.nanoTime(); long totalTime = (endTime - startTime) / 1000000; //total time in millisec Nodes nodePath = temp; String path = nodePath.getDirectionFromParent(); System.out.println("Puzzle has been solved in: " + totalTime + "ms"); System.out.println("no. of nodes generated: " + nodesGen); System.out.println("Space Complexity of solution: " + temp.depth); while ((nodePath = nodePath.getParent()) != null) { //create path path = nodePath.getDirectionFromParent() + ", " + path; } System.out.println("Path to solution: " + path); return; } ArrayList<Nodes> nextLvl = new ArrayList<Nodes>(); if (temp.getGrid().checkMove("up")) { Nodes next = new Nodes(new Grid(temp.getGrid()), temp.getDepth() + 1, "UP", temp); next.getGrid().move("up"); nextLvl.add(next); } if (temp.getGrid().checkMove("down")) { Nodes next = new Nodes(new Grid(temp.getGrid()), temp.getDepth() + 1, "DOWN", temp); next.getGrid().move("down"); nextLvl.add(next); } if (temp.getGrid().checkMove("left")) { Nodes next = new Nodes(new Grid(temp.getGrid()), temp.getDepth() + 1, "LEFT", temp); next.getGrid().move("left"); nextLvl.add(next); } if (temp.getGrid().checkMove("right")) { Nodes next = new Nodes(new Grid(temp.getGrid()), temp.getDepth() + 1, "RIGHT", temp); next.getGrid().move("right"); nextLvl.add(next); } //add new nodes to stack while (!nextLvl.isEmpty()) { int random = new Random().nextInt(nextLvl.size()); fringe.push(nextLvl.remove(random)); } } } /* Uses a stack to expand nodes to have a LIFO queue-like structure. * Repetitively calls the dls helper function for each value until the limit. */ public void ids (Nodes root, int iterations) { for (int i = 0; i < iterations; i++) { long startTime = System.nanoTime(); Stack<Nodes> fringe = new Stack<Nodes>(); //LIFO queue if (root == null) { return; } else { fringe.push(root); } int nodesGen = 0; while (!fringe.isEmpty()) { Nodes temp = fringe.pop(); nodesGen++; dls(temp, i, nodesGen, fringe); //print details temp.getGrid().currentGrid(); System.out.println("Node depth: " + temp.getDepth() + " Node direction: " + temp.directionFromParent); System.out.println("-------------------------------------------------"); //check if solved if (temp.getGrid().checkSolved()) { long endTime = System.nanoTime(); long totalTime = (endTime - startTime) / 1000000; //total time in millisec Nodes nodePath = temp; String path = nodePath.getDirectionFromParent(); System.out.println("Puzzle has been solved in: " + totalTime + "ms"); System.out.println("no. of nodes generated: " + nodesGen); System.out.println("Space Complexity of solution: " + temp.getDepth()); while ((nodePath = nodePath.getParent()) != null) { //create path path = nodePath.getDirectionFromParent() + ", " + path; } System.out.println("Path to solution: " + path); return; } } } System.out.println("No solution within given limit"); } /* Function that performs dls and serves as the helper to the ids. * Uses stack, iteration, and node information from ids. Cannot work alone. */ public void dls (Nodes temp, int iterations, int nodesGen, Stack<Nodes> fringe) { ArrayList<Nodes> nextLvl = new ArrayList<Nodes>(); if (temp.getDepth() != iterations) { nodesGen++; //second condition to check if we've not just visited the node if (temp.getGrid().checkMove("up") && !temp.directionFromParent.equals("DOWN")) { Nodes next = new Nodes(new Grid(temp.getGrid()), temp.getDepth() + 1, "UP", temp); next.getGrid().move("up"); nextLvl.add(next); } if (temp.getGrid().checkMove("down") && !temp.directionFromParent.equals("UP")) { Nodes next = new Nodes(new Grid(temp.getGrid()), temp.getDepth() + 1, "DOWN", temp); next.getGrid().move("down"); nextLvl.add(next); } if (temp.getGrid().checkMove("left") && !temp.directionFromParent.equals("RIGHT")) { Nodes next = new Nodes(new Grid(temp.getGrid()), temp.getDepth() + 1, "LEFT", temp); next.getGrid().move("left"); nextLvl.add(next); } if (temp.getGrid().checkMove("right") && !temp.directionFromParent.equals("LEFT")) { Nodes next = new Nodes(new Grid(temp.getGrid()), temp.getDepth() + 1, "RIGHT", temp); next.getGrid().move("right"); nextLvl.add(next); } } else { //System.out.println("No solution at depth " + iterations); } //add new (randomised) nodes to stack while (!nextLvl.isEmpty()) { int random = new Random().nextInt(nextLvl.size()); fringe.push(nextLvl.remove(random)); } } }
[ "noreply@github.com" ]
noreply@github.com
a29ff3f18bc71343b368c915d7fd1c3d145fbf80
e37169e94c45ac4ffa05536c51647f201dff7f56
/src/main/java/by/ladyka/bepaid/dto/AvsVerification.java
17ad420206132d8ddd63ac2368685e8f23d01d0b
[ "MIT" ]
permissive
republicclub/site-engine-of-some-nightclub
3fb317d9f4dc917f9745847282288fa37e288474
00db7000101aea5328f3471dfe846652c657e8b7
refs/heads/master
2020-07-12T05:06:34.955898
2019-08-19T09:53:10
2019-08-19T09:53:10
204,725,573
1
0
MIT
2019-08-27T17:57:13
2019-08-27T14:49:42
Java
UTF-8
Java
false
false
203
java
package by.ladyka.bepaid.dto; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; @Data public class AvsVerification { @JsonProperty("result_code") private String resultCode; }
[ "andrei@ladyka.tk" ]
andrei@ladyka.tk
078d4b58ee33213c8a532ed4487701291b6b8887
c70ab72d571411e475a7d65a44978c8bea82387a
/app/src/main/java/com/skipq/android/adapters/ExploreAdapter.java
8ce7f16b40cfa7cdefc249e28ecb1391bd628d7d
[]
no_license
mobiledeveloper1214/SkipQ
09d5b612478f65e0956f54713bdef2371f6d4a6e
8f9c5de8aa7e6efe7c952aa817671777c77a25a8
refs/heads/master
2021-03-19T16:52:20.661322
2016-12-09T16:41:56
2016-12-09T16:41:56
76,052,931
0
0
null
null
null
null
UTF-8
Java
false
false
2,386
java
package com.skipq.android.adapters; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.bumptech.glide.Glide; import com.skipq.android.R; import com.skipq.android.models.Business; import com.skipq.android.utilities.CommonUtils; import java.util.ArrayList; import butterknife.BindView; import butterknife.ButterKnife; import de.hdodenhof.circleimageview.CircleImageView; import static com.skipq.android.AppConfig.PATH_BUSINESS_LOGO; public class ExploreAdapter extends RecyclerView.Adapter<ExploreAdapter.ViewHolder> { private Context mContext; private ArrayList<Business> businesses; public static class ViewHolder extends RecyclerView.ViewHolder { @BindView(R.id.iv_biz_logo) CircleImageView ivBizLogo; @BindView(R.id.tv_biz_name) TextView tvBizName; @BindView(R.id.tv_biz_category) TextView tvBizCategory; @BindView(R.id.tv_biz_status) TextView tvBizStatus; public ViewHolder(View v) { super(v); ButterKnife.bind(this, v); } } public ExploreAdapter(Context mContext, ArrayList<Business> businesses) { this.mContext = mContext; this.businesses = businesses; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_explore, parent, false); return new ViewHolder(v); } @Override public void onBindViewHolder(final ViewHolder holder, int position) { CommonUtils commonUtils = CommonUtils.getInstance(); Business business = businesses.get(position); Glide.with(mContext) .load(PATH_BUSINESS_LOGO + business.getBiz_logo_url()) .crossFade() .centerCrop() .into(holder.ivBizLogo); holder.tvBizName.setText(business.getBiz_name()); holder.tvBizCategory.setText(business.getBiz_category_name()); holder.tvBizStatus.setText(business.getBiz_status() == 1 ? "Open now" : "Closed"); } @Override public int getItemCount() { return businesses.size(); } }
[ "mobile.developer.1214@gmail.com" ]
mobile.developer.1214@gmail.com
d0de0aa9813883bf063d5b6a112edd2861a307ce
d67e6f552ee0017ae8ee0084a340fe56cb88d9aa
/src/main/java/com/laimewow/mexample/domain/Identifiable.java
4ca1004cb8824148194eae5e32e2517c08326834
[]
no_license
laimewow/MarkBootExample
e7a46e80862bbeebce6c22077b1822806892f358
4cefba54e5a3d3da61f5b0daec6436cf55b67456
refs/heads/master
2022-07-19T01:24:39.850305
2020-05-22T00:02:32
2020-05-22T00:02:32
265,976,774
0
0
null
null
null
null
UTF-8
Java
false
false
167
java
package com.laimewow.mexample.domain; import java.io.Serializable; public interface Identifiable<ID extends Serializable> { ID getId(); void setId(ID id); }
[ "laime.wow@gmail.com" ]
laime.wow@gmail.com
2c2f837a6108c70696988a6a21e11d63a1822e77
de24c5b36431315d498c21941e42759398f93330
/tenant-navigator/src/main/java/io/a97lynk/navigator/config/schema/TenantConnectionProvider.java
059897fdda474dad2486c71cce3c585aafb2178a
[]
no_license
97lynk/base-modules
89e5c699d69daa31adf695fd0e9e2e701450e9ff
e63e9908b86b8d4f17127fbc5337c40f2e6be5ae
refs/heads/master
2023-03-28T13:57:02.955842
2021-04-03T11:04:11
2021-04-03T11:04:11
306,922,450
1
0
null
null
null
null
UTF-8
Java
false
false
1,853
java
package io.a97lynk.navigator.config.schema; import org.hibernate.engine.jdbc.connections.spi.MultiTenantConnectionProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import javax.sql.DataSource; import java.sql.Connection; import java.sql.SQLException; @Component public class TenantConnectionProvider implements MultiTenantConnectionProvider { private static Logger logger = LoggerFactory.getLogger(TenantConnectionProvider.class); private String DEFAULT_TENANT = "public"; private DataSource datasource; public TenantConnectionProvider(DataSource dataSource) { this.datasource = dataSource; } @Override public Connection getAnyConnection() throws SQLException { return datasource.getConnection(); } @Override public void releaseAnyConnection(Connection connection) throws SQLException { connection.close(); } @Override public Connection getConnection(String tenantIdentifier) throws SQLException { logger.info("Get connection for tenant {}", tenantIdentifier); final Connection connection = getAnyConnection(); connection.setSchema(tenantIdentifier); return connection; } @Override public void releaseConnection(String tenantIdentifier, Connection connection) throws SQLException { logger.info("Release connection for tenant {}", tenantIdentifier); connection.setSchema(DEFAULT_TENANT); releaseAnyConnection(connection); } @Override public boolean supportsAggressiveRelease() { return false; } @Override @SuppressWarnings("rawtypes") public boolean isUnwrappableAs(Class aClass) { return false; } @Override public <T> T unwrap(Class<T> aClass) { return null; } }
[ "LUmia435@" ]
LUmia435@
f3a8c1c0da03548c2a1749a63e2e3843459ecfb2
aa8ec9dd49fa9007c293e640db47b2184bd278c8
/ssi-ejb/src/main/java/gr/uagean/authenticators/AfterSSIFinancialAuthenticator.java
5bfa234011bbac93a03d77a273e6c268fefa3d29
[]
no_license
endimion/ssi-keycloak
752b52e5735185d378e92c5fd3c0deeb2029d76d
05110da44d4b59ec734d071bc10cce0eca6cdd34
refs/heads/master
2022-12-31T00:29:21.534951
2020-12-18T08:49:05
2020-12-18T08:49:05
238,400,440
1
1
null
2022-12-16T05:06:33
2020-02-05T08:19:14
Java
UTF-8
Java
false
false
10,892
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 gr.uagean.authenticators; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import gr.uaegean.pojo.VerifiableCredential; import gr.uaegean.singleton.MemcacheSingleton; import static gr.uaegean.utils.CredentialsUtils.getClaimsFromVerifiedArray; import java.io.IOException; import net.spy.memcached.MemcachedClient; import org.keycloak.OAuth2Constants; import org.keycloak.authentication.AuthenticationFlowContext; import org.keycloak.authentication.Authenticator; import org.keycloak.models.KeycloakSession; import org.keycloak.models.RealmModel; import org.keycloak.models.UserModel; import org.keycloak.models.utils.KeycloakModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.util.StringUtils; /** * * @author nikos */ public class AfterSSIFinancialAuthenticator implements Authenticator { // protected ParameterService paramServ = new ParameterServiceImpl(); private static Logger LOG = LoggerFactory.getLogger(AfterSSIFinancialAuthenticator.class); private ObjectMapper mapper; private MemcachedClient mcc; @Override public void authenticate(AuthenticationFlowContext context) { try { KeycloakSession session = context.getSession(); RealmModel realm = context.getRealm(); mapper = new ObjectMapper(); LOG.info("reached after-SSI-authenticator!!!!!"); String sessionId = context.getHttpRequest().getUri().getQueryParameters().getFirst("sessionId"); LOG.info(sessionId); if (StringUtils.isEmpty(sessionId)) { LOG.info("no seessionId found!!!!!!! AFTERSSIAuthenticator"); LOG.info("will continue with attempted"); context.attempted(); return; } this.mcc = MemcacheSingleton.getCache(); LOG.info("looking for: " + "claims" + String.valueOf(sessionId)); String claims = (String) this.mcc.get("claims" + String.valueOf(sessionId)); LOG.info("GOT the following SSI claims " + claims); ObjectMapper mapper = new ObjectMapper() .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); VerifiableCredential credential = mapper.readValue(claims, VerifiableCredential.class); VerifiableCredential.VerifiedClaims vc = getClaimsFromVerifiedArray(credential); // since we are not storing the users we use as a username the did UserModel user = KeycloakModelUtils.findUserByNameOrEmail(session, realm, credential.getDid()); if (user == null) { // since we are not storing the users we use as a username the did user = session.users().addUser(realm, credential.getDid()); } user.setEnabled(true); //TODO Add other data sources!!! if (vc.getE1() != null && vc.getE1().getE1() != null) { user.setFirstName(vc.getE1().getE1().getName()); user.setLastName(vc.getE1().getE1().getSurname()); user.setEmail(credential.getDid() + "@uport"); user.setEmailVerified(true); user.setSingleAttribute("e1-salaries", vc.getE1().getE1().getSalaries()); user.setSingleAttribute("e1-pensionIncome", vc.getE1().getE1().getPensionIncome()); user.setSingleAttribute("e1-farmingActivity", vc.getE1().getE1().getFarmingActivity()); user.setSingleAttribute("e1-freelanceActivity", vc.getE1().getE1().getFreelanceActivity()); user.setSingleAttribute("e1-rentIncome", vc.getE1().getE1().getRentIncome()); user.setSingleAttribute("e1-unemploymentBenefit", vc.getE1().getE1().getUnemploymentBenefit()); user.setSingleAttribute("e1-otherBenefitsIncome", vc.getE1().getE1().getOtherBenefitsIncome()); user.setSingleAttribute("e1-ekas", vc.getE1().getE1().getEkas()); user.setSingleAttribute("e1-additionalIncomes", vc.getE1().getE1().getAdditionalIncomes()); user.setSingleAttribute("e1-ergome", vc.getE1().getE1().getErgome()); user.setSingleAttribute("e1-depositInterest", vc.getE1().getE1().getDepositInterest()); user.setSingleAttribute("e1-deposits", vc.getE1().getE1().getDeposits()); user.setSingleAttribute("e1-valueOfRealEstate", vc.getE1().getE1().getValueOfRealEstate()); user.setSingleAttribute("e1-valueOfRealEstateInOtherCountries", vc.getE1().getE1().getValueOfRealEstateInOtherCountries()); user.setSingleAttribute("e1-valueOfOwnedVehicles", vc.getE1().getE1().getValueOfOwnedVehicles()); user.setSingleAttribute("e1-investments", vc.getE1().getE1().getInvestments()); user.setSingleAttribute("e1-householdComposition", vc.getE1().getE1().getHousehold()); user.setSingleAttribute("e1-name", vc.getE1().getE1().getName()); user.setSingleAttribute("e1-surname", vc.getE1().getE1().getSurname()); user.setSingleAttribute("e1-dateOfBirth", vc.getE1().getE1().getDateOfBirth()); user.setSingleAttribute("e1-municipality", vc.getE1().getE1().getMunicipality()); user.setSingleAttribute("e1-number", vc.getE1().getE1().getNumber()); user.setSingleAttribute("e1-po", vc.getE1().getE1().getPo()); user.setSingleAttribute("e1-prefecture", vc.getE1().getE1().getPrefecture()); user.setSingleAttribute("e1-street", vc.getE1().getE1().getStreet()); user.setSingleAttribute("e1-credential-id", vc.getId()); user.setSingleAttribute("iat", credential.getVerified()[0].getIat()); user.setSingleAttribute("exp", credential.getVerified()[0].getExp()); user.setSingleAttribute("credential-name", "Financial Information"); } if (vc.getAmka() != null && vc.getAmka().getAmka() != null) { if (user.getFirstName() == null) { user.setFirstName(vc.getAmka().getAmka().getLatinFirstName()); } if (user.getLastName() == null) { user.setLastName(vc.getAmka().getAmka().getLatinLastName()); } if (user.getEmail() == null) { user.setEmail(vc.getAmka().getAmka().getBirthDate() + "-" + vc.getAmka().getAmka().getLatinLastName() + "@uport"); } user.setEmailVerified(true); user.setSingleAttribute("amka-latinLastName", vc.getAmka().getAmka().getLatinLastName()); user.setSingleAttribute("amka-latinFirstName", vc.getAmka().getAmka().getLatinFirstName()); user.setSingleAttribute("amka-birthDate", vc.getAmka().getAmka().getBirthDate()); user.setSingleAttribute("amka-father", vc.getAmka().getAmka().getFather()); user.setSingleAttribute("amka-mother", vc.getAmka().getAmka().getMother()); user.setSingleAttribute("amka-mother", vc.getAmka().getAmka().getMother()); user.setSingleAttribute("amka-loa", vc.getAmka().getAmka().getLoa()); } if (vc.getMitro() != null && vc.getMitro().getMitro() != null) { user.setSingleAttribute("mitro-gender", vc.getMitro().getMitro().getGender()); user.setSingleAttribute("mitro-nationality", vc.getMitro().getMitro().getNationality()); user.setSingleAttribute("mitro-maritalStatus", vc.getMitro().getMitro().getMaritalStatus()); } if (vc.getErasmus() != null && vc.getErasmus().getMitro() != null) { user.setSingleAttribute("eidas-familyName", vc.getErasmus().getMitro().getFamilyName()); user.setSingleAttribute("eidas-firstName", vc.getErasmus().getMitro().getGivenName()); user.setSingleAttribute("eidas-dateOfBirth", vc.getErasmus().getMitro().getDateOfBirth()); user.setSingleAttribute("eidas-personIdentifier", vc.getErasmus().getMitro().getPersonIdentifier()); user.setSingleAttribute("eidas-loa", vc.getErasmus().getMitro().getLoa()); user.setSingleAttribute("erasmus-expires", vc.getErasmus().getMitro().getExpires()); user.setSingleAttribute("erasmus-hostingInstitution", vc.getErasmus().getMitro().getHostingInstitution()); user.setSingleAttribute("erasmus-affiliation", vc.getErasmus().getMitro().getAffiliation()); } // grab oidc params String response_type = context.getHttpRequest().getUri().getQueryParameters().getFirst(OAuth2Constants.RESPONSE_TYPE); String client_id = context.getHttpRequest().getUri().getQueryParameters().getFirst(OAuth2Constants.CLIENT_ID); String redirect_uri = context.getHttpRequest().getUri().getQueryParameters().getFirst(OAuth2Constants.REDIRECT_URI); String state = context.getHttpRequest().getUri().getQueryParameters().getFirst(OAuth2Constants.STATE); String scope = context.getHttpRequest().getUri().getQueryParameters().getFirst(OAuth2Constants.SCOPE); //DEbug ensure we are getting the correct parameaters here LOG.info("AFTER SSI PERSONAL Authenticator parameters!!!"); LOG.info(response_type); LOG.info(client_id); LOG.info(redirect_uri); LOG.info(state); LOG.info(scope); context.setUser(user); LOG.info("AfterSSIAuthenticator Success!! user is set " + user.getUsername()); context.success(); } catch (IOException ex) { LOG.error(ex.getMessage()); //TODO failure is better? LOG.info("will continue with attempted"); context.attempted(); } } @Override public void action(AuthenticationFlowContext afc) { LOG.info("AFTER eidas actionImp called"); // LOG.info(afc.getUser()); if (afc.getUser() != null) { afc.success(); } else { afc.attempted(); } } @Override public boolean requiresUser() { return false; } @Override public boolean configuredFor(KeycloakSession ks, RealmModel rm, UserModel um) { return true; } @Override public void setRequiredActions(KeycloakSession ks, RealmModel rm, UserModel um) { } @Override public void close() { } }
[ "triantafyllou.ni@gmail.com" ]
triantafyllou.ni@gmail.com
de8fa1f9d4d40a397f13dc9546562b87795295a4
ccce83a16638fd0c0d04b88cfe79fafa99797680
/src/main/java/com/dailycodebuffer/cloud/gateway/CloudGatewayApplication.java
1d0f4cd3bd3cfd0872af75c1cc98c574886fa9bd
[]
no_license
rupams2002/Microservice-API-gateway
40ca8378a100d1ffb788f074ba1a955741fc283f
29f02e588e0e0fcc8139f784b61f9fb4fe90962c
refs/heads/master
2023-07-23T02:14:03.393747
2021-09-10T03:48:30
2021-09-10T03:48:30
401,830,770
0
0
null
null
null
null
UTF-8
Java
false
false
443
java
package com.dailycodebuffer.cloud.gateway; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; @SpringBootApplication @EnableEurekaClient //@EnableHystrix public class CloudGatewayApplication { public static void main(String[] args) { SpringApplication.run(CloudGatewayApplication.class, args); } }
[ "rupams2002@yahoo.com" ]
rupams2002@yahoo.com
901ffc558396d95351b86dcdff5d6dd57e1bb012
951bd8a62479104eb7a533fce7d53a8719d0dbb2
/app/src/test/java/com/blueradix/android/myprojecttest/ExampleUnitTest.java
495bef4129c674d7d3e963d4f604d0c2491bc45c
[]
no_license
alexpadillarosas/MyProjectTest
65d0bf58037b13ebce5ce70bcac6c392d6806422
85ee7937020fdd20a1793ebd87f8ef9bc0c215b9
refs/heads/master
2022-09-05T10:51:22.232371
2020-06-03T05:52:45
2020-06-03T05:52:45
269,000,810
0
0
null
null
null
null
UTF-8
Java
false
false
396
java
package com.blueradix.android.myprojecttest; 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() { assertEquals(4, 2 + 2); } }
[ "alexpadillarosas@gmail.com" ]
alexpadillarosas@gmail.com
a7c35b5be5208314892f9e3c55ba1b556cb19bf1
e091bdc1f5cdf3dd6e0c7e1e74621ebaff9680df
/mypage/src/main/java/shopide/external/Shipped.java
56cc9c6621bfc8e5a0f4cf0881080fc3e83b6aaa
[]
no_license
jihwancha/shopide
27cea0453fd1ea0c85b4a3e2636a2864f51cbe7d
1c1a8c7f5bb5e56a8f38ea2ca897b7e965976cd6
refs/heads/master
2022-11-17T05:21:11.719088
2020-07-06T07:02:27
2020-07-06T07:02:27
277,461,838
0
0
null
null
null
null
UTF-8
Java
false
false
624
java
package shopide.external; import shopide.AbstractEvent; public class Shipped extends AbstractEvent { private Long id; private Long orderId; private String status; public Shipped(){ super(); } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getOrderId() { return orderId; } public void setOrderId(Long orderId) { this.orderId = orderId; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } }
[ "SKCC@SKCC16D00086.SKCC.NET" ]
SKCC@SKCC16D00086.SKCC.NET
daa7f32c7960e44c3ddbf78c4fa09620b87926f6
7fbec00f474c2d205c7d041bbc6321d32b39ae69
/Toy Language Interpretor/app/model/statement/CompoundStatement.java
f9da34e10f5702555290b65e3eb1a35e22a6e9b7
[]
no_license
filip-x/Personal-projects
d156cfaf9b5faa6112b29a0f5a17a235fb528cb5
b8a351c85e85c81dbeca8cc2640715b28bb1c78e
refs/heads/master
2023-01-19T07:47:29.389312
2020-12-04T08:06:20
2020-12-04T08:06:20
314,050,477
0
0
null
null
null
null
UTF-8
Java
false
false
1,582
java
package app.model.statement; import app.exception.MyInterpreterException; import app.model.expresion.InterfaceExpression; import app.model.programstate.ProgramState; import app.model.stack.InterfaceMyStack; //keeps the input statements in a tree-view(binary tree) public class CompoundStatement implements InterfaceStatement { InterfaceStatement first; InterfaceStatement second; public CompoundStatement(InterfaceStatement first,InterfaceStatement second) { this.first = first; this.second = second; } public ProgramState execute(ProgramState state) throws MyInterpreterException { InterfaceMyStack<InterfaceStatement> stack = state.getExecutionStack(); stack.push(second); stack.push(first); return null; } public String recursiveToString(InterfaceStatement statement){ StringBuilder str = new StringBuilder(); if (statement instanceof CompoundStatement) {// this is compound statement CompoundStatement statement1 = (CompoundStatement) statement; str.append(recursiveToString(statement1.getFirst())); str.append(recursiveToString(statement1.getSecond())); } else{ str.append(statement.toString()+"\n");//this is normal } return str.toString(); } public String toString() { return recursiveToString(this); } public InterfaceStatement getFirst(){ return this.first; } public InterfaceStatement getSecond(){ return this.second; } }
[ "cfie2693@scs.ubbcluj.ro" ]
cfie2693@scs.ubbcluj.ro
0f95a70ed937b7cec72b7b0923294a568df9faa9
7df92060d069122a68639cc31e3a5c8702378392
/core/src/main/java/com/spark/bitrade/entity/AssetExchangeCoin.java
1c352d363ed1e23c3bf769ccd3fbe45495a759b8
[]
no_license
gspandy/bitex
f720a519953f238bfb79962701413edaff2c3dd5
07272ce8978412ead545244764872941ade57be7
refs/heads/master
2023-01-01T04:59:53.598938
2019-12-10T01:51:42
2019-12-10T01:51:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
682
java
package com.spark.bitrade.entity; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import org.hibernate.annotations.CreationTimestamp; import javax.persistence.*; import java.math.BigDecimal; import java.util.Date; /** * 币种汇率 */ @Data @Entity public class AssetExchangeCoin { @GeneratedValue(strategy = GenerationType.IDENTITY) @Id private Long id; @CreationTimestamp @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date createTime; @Column(columnDefinition = "decimal(18,2) comment '汇率'") private BigDecimal exchangeRate; private String fromUnit; private String toUnit; }
[ "496448826@qq.com" ]
496448826@qq.com
fcde792e35e51be56252d9b70dbf3d8c5078254e
9c60d6b83ee512ec93b1a1a438d715836f96d17b
/chrome/android/junit/src/org/chromium/chrome/browser/send_tab_to_self/SendTabToSelfAndroidBridgeTest.java
90f5fda7b7a6f1692e347fa8caa65cfe85566fce
[ "BSD-3-Clause" ]
permissive
HYJ199688/chromium
5a09491b640e068a22bf85123d421e1e427d9c00
70eb35d5df0548b621b7bbc3d380ef1a6a6f6db8
refs/heads/master
2022-11-12T22:24:52.184870
2019-03-29T09:43:44
2019-03-29T09:43:44
178,378,850
1
0
null
2019-03-29T09:51:48
2019-03-29T09:51:48
null
UTF-8
Java
false
false
5,158
java
// Copyright 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.chrome.browser.send_tab_to_self; import static org.mockito.AdditionalAnswers.answerVoid; import static org.mockito.Mockito.any; import static org.mockito.Mockito.anyString; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.eq; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.support.test.filters.SmallTest; import org.junit.Assert; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.mockito.stubbing.VoidAnswer2; import org.robolectric.annotation.Config; import org.chromium.base.test.BaseRobolectricTestRunner; import org.chromium.base.test.util.JniMocker; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.content_public.browser.WebContents; import java.util.List; /** Tests for SendTabToSelfAndroidBridge */ @RunWith(BaseRobolectricTestRunner.class) @Config(manifest = Config.NONE) public class SendTabToSelfAndroidBridgeTest { @Rule public JniMocker mocker = new JniMocker(); @Mock SendTabToSelfAndroidBridge.Natives mNativeMock; private Profile mProfile; private WebContents mWebContents; private static final String GUID = "randomguid"; private static final String URL = "http://www.tanyastacos.com"; private static final String TITLE = "Come try Tanya's famous tacos"; private static final String DEVICE_NAME = "Macbook Pro"; private static final long NAVIGATION_TIME_MS = 123l; private static final long SHARE_TIME_MS = 456l; @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); mocker.mock(SendTabToSelfAndroidBridgeJni.TEST_HOOKS, mNativeMock); } @Test @SmallTest public void testAddEntry() { SendTabToSelfAndroidBridge.addEntry(mProfile, URL, TITLE, NAVIGATION_TIME_MS); verify(mNativeMock).addEntry(eq(mProfile), eq(URL), eq(TITLE), eq(NAVIGATION_TIME_MS)); } @Test @SmallTest @SuppressWarnings("unchecked") public void testGetAllGuids() { doAnswer(answerVoid(new VoidAnswer2<Profile, List<String>>() { @Override public void answer(Profile profile, List<String> guids) { guids.add("one"); guids.add("two"); guids.add("three"); } })) .when(mNativeMock) .getAllGuids(eq(mProfile), any(List.class)); List<String> actual = SendTabToSelfAndroidBridge.getAllGuids(mProfile); verify(mNativeMock).getAllGuids(eq(mProfile), any(List.class)); Assert.assertEquals(3, actual.size()); Assert.assertArrayEquals(new String[] {"one", "two", "three"}, actual.toArray()); } @Test @SmallTest public void testGetEntryByGUID() { SendTabToSelfEntry expected = new SendTabToSelfEntry( GUID, URL, TITLE, SHARE_TIME_MS, NAVIGATION_TIME_MS, DEVICE_NAME); when(mNativeMock.getEntryByGUID(eq(mProfile), anyString())).thenReturn(expected); // Note that the GUID passed in this function does not match the GUID of the returned entry. // This is okay because the purpose of the test is to make sure that the JNI layer passes // the entry returned by the native code. The native code does the actual matching of // the GUID but since that is mocked out and not the purpose of the test, this is fine. SendTabToSelfEntry actual = SendTabToSelfAndroidBridge.getEntryByGUID(mProfile, "guid"); Assert.assertEquals(expected.guid, actual.guid); Assert.assertEquals(expected.url, actual.url); Assert.assertEquals(expected.title, actual.title); Assert.assertEquals(expected.sharedTime, actual.sharedTime); Assert.assertEquals(expected.originalNavigationTime, actual.originalNavigationTime); Assert.assertEquals(expected.deviceName, actual.deviceName); } @Test @SmallTest public void testDeleteAllEntries() { SendTabToSelfAndroidBridge.deleteAllEntries(mProfile); verify(mNativeMock).deleteAllEntries(eq(mProfile)); } @Test @SmallTest public void testDismissEntry() { SendTabToSelfAndroidBridge.dismissEntry(mProfile, GUID); verify(mNativeMock).dismissEntry(eq(mProfile), eq(GUID)); } @Test @SmallTest public void testDeleteEntry() { SendTabToSelfAndroidBridge.deleteEntry(mProfile, GUID); verify(mNativeMock).deleteEntry(eq(mProfile), eq(GUID)); } @Test @SmallTest public void testIsFeatureAvailable() { boolean expected = true; when(mNativeMock.isFeatureAvailable(eq(mProfile), eq(mWebContents))).thenReturn(expected); boolean actual = SendTabToSelfAndroidBridge.isFeatureAvailable(mProfile, mWebContents); Assert.assertEquals(expected, actual); } }
[ "commit-bot@chromium.org" ]
commit-bot@chromium.org
177f3b38d144a805887e382a233984f376f896a6
90eb2996c2a6987bf56543c94e3fcaccd5801f71
/currency-conversion-service/src/main/java/com/ayush/microservice/currencyconversionservice/CurrencyConversion.java
a04a3c945dd2433f0d83b5723df1a825baa14078
[]
no_license
ayush64/TestingMicroserviceArchitechture
dece850d5e55d7f9e621ad87425abe2c92aa700b
eea2050812575e47637113cdbd51ecd51260cf46
refs/heads/main
2023-04-07T18:59:22.130793
2021-04-06T08:41:09
2021-04-06T08:41:09
355,115,175
0
0
null
null
null
null
UTF-8
Java
false
false
2,033
java
package com.ayush.microservice.currencyconversionservice; import java.math.BigDecimal; public class CurrencyConversion { private Long id; private String from; private String to; private BigDecimal quantity; private BigDecimal conversionMultiple; private BigDecimal totalCalculatedAmount; private String environment; public CurrencyConversion() { } public CurrencyConversion(Long id, String from, String to, BigDecimal quantity, BigDecimal conversionMultiple, BigDecimal totalCalculatedAmount, String environment) { super(); this.id = id; this.from = from; this.to = to; this.conversionMultiple = conversionMultiple; this.quantity = quantity; this.totalCalculatedAmount = totalCalculatedAmount; this.environment = environment; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getFrom() { return from; } public void setFrom(String from) { this.from = from; } public String getTo() { return to; } public void setTo(String to) { this.to = to; } public BigDecimal getConversionMultiple() { return conversionMultiple; } public void setConversionMultiple(BigDecimal conversionMultiple) { this.conversionMultiple = conversionMultiple; } public BigDecimal getQuantity() { return quantity; } public void setQuantity(BigDecimal quantity) { this.quantity = quantity; } public BigDecimal getTotalCalculatedAmount() { return totalCalculatedAmount; } public void setTotalCalculatedAmount(BigDecimal totalCalculatedAmount) { this.totalCalculatedAmount = totalCalculatedAmount; } public String getEnvironment() { return environment; } public void setEnvironment(String environment) { this.environment = environment; } }
[ "ayushtyagi64@gmail.com" ]
ayushtyagi64@gmail.com
6a73f7020131f50528f36f4f64aed35b28c0f621
a54032b86b17c66d0ab7c9c5a5586ad64aefa794
/Patient-Health-Info/src/main/java/in/shishirsingh/phi/service/PatientServiceImpl.java
c60f383ff1268fcc3881915fe9ab9c024ef6ff95
[ "MIT" ]
permissive
mjf1310/SpringBoot-RestEasy-Swagger-Boilerplate
ae2261b392282fa9d06f47bc139a877732f6b4fc
ffe4a9a16a211a88221bef60b8a0337533a0f84a
refs/heads/master
2021-09-12T11:01:05.915776
2018-04-16T07:32:14
2018-04-16T07:32:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
577
java
package in.shishirsingh.phi.service; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import in.shishirsingh.phi.dao.PatientRepository; import in.shishirsingh.phi.model.Patient; @Service public class PatientServiceImpl implements PatientService { @Autowired PatientRepository prepo; @Override public List<Patient> getPatients() { return prepo.findAll(); } @Override public boolean createPatient(Patient p) { prepo.save(p); return true; } }
[ "shi2rsingh@gmail.com" ]
shi2rsingh@gmail.com
3b68b8e96c58c9c6ab34487a71131f3b01fcede9
80303c1e6972ebce94793d863dd97594c61cb622
/dawnlightning/dawnlightning/src/com/zhy/Bean/Pics.java
162c301971fbd98064422164d33f4071ae3ca434
[]
no_license
konglinghai123/dawnlightning
a3679f2da54dbdabd024b0bee12e216a4021b4ca
dc63c968293aa5b28937c83c5ff37774ab58a00f
refs/heads/master
2021-01-10T08:27:44.168750
2015-11-16T11:56:15
2015-11-16T11:56:15
46,354,384
2
1
null
null
null
null
UTF-8
Java
false
false
528
java
package com.zhy.Bean; public class Pics { public Pics(){ } private String picurl; private String title; public String getUrl() { return picurl; } public void setUrl(String url) { this.picurl =url; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } @Override public String toString() { return "Pics [url=" + picurl + ", title=" + title + "]"; } public Pics(String url, String title) { super(); this.picurl = url; this.title = title; } }
[ "a343873143@163.com" ]
a343873143@163.com
dbdd248c266f25d30721aca924e8df78aec4990f
5b1f0e61492881652573c6127a46e69a8d824e26
/src/main/java/com/nexos/model/entities/MaintenanceMerchandise.java
ec80672d1c4a5fbaa4011eb5360bee26a80c714a
[]
no_license
fabiolopz97/inventory-system-nexos
79edae012cf77b1d3545e770b2f2f81fd2a216b3
342c404f4412bcdefcbd41de44847d36908b9122
refs/heads/master
2023-08-01T12:09:06.217180
2021-09-16T12:53:13
2021-09-16T12:53:13
406,215,204
0
0
null
null
null
null
UTF-8
Java
false
false
1,724
java
/** * */ package com.nexos.model.entities; import java.time.LocalDateTime; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; /** * @author Soluciones * Class that represents an entity from the maintenance_merchandise table. */ @Entity public class MaintenanceMerchandise { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int idMaintenanceMerchandise; @ManyToOne @JoinColumn(name = "idMerchandise") private Merchandise merchandise; @ManyToOne @JoinColumn(name = "idUser") private User user; private LocalDateTime createdAt; /** * @return the idMaintenanceMerchandise */ public int getIdMaintenanceMerchandise() { return idMaintenanceMerchandise; } /** * @param idMaintenanceMerchandise the idMaintenanceMerchandise to set */ public void setId(int idMaintenanceMerchandise) { this.idMaintenanceMerchandise = idMaintenanceMerchandise; } /** * @return the merchandise */ public Merchandise getMerchandise() { return merchandise; } /** * @param merchandise the merchandise to set */ public void setMerchandise(Merchandise merchandise) { this.merchandise = merchandise; } /** * @return the user */ public User getUser() { return user; } /** * @param user the user to set */ public void setUser(User user) { this.user = user; } /** * @return the createdAt */ public LocalDateTime getCreatedAt() { return createdAt; } /** * @param createdAt the createdAt to set */ public void setCreatedAt(LocalDateTime createdAt) { this.createdAt = createdAt; } }
[ "fabiolopz97@gmail.com" ]
fabiolopz97@gmail.com
1489a03152753e956e59d7634f42b4c1b60dd7b4
6c17a35ba67d61f6d9aff1d6c3c6e957c9ab4cd4
/projects/batfish/src/main/java/org/batfish/representation/cisco_nxos/CiscoNxosStructureUsage.java
c3563fb35143cd7ecdd3bf293a9331dceeb6929f
[ "Apache-2.0" ]
permissive
batfish/batfish
5e8bef0c6977cd7062f2ad03611f496b38d019a1
bfd39eb34e3a7b677bb186b6fc647aac5cb7558f
refs/heads/master
2023-09-01T08:13:38.211980
2023-08-30T21:42:47
2023-08-30T21:42:47
27,507,850
981
249
Apache-2.0
2023-09-12T09:53:49
2014-12-03T21:10:18
Java
UTF-8
Java
false
false
10,746
java
package org.batfish.representation.cisco_nxos; import javax.annotation.Nonnull; import org.batfish.vendor.StructureUsage; public enum CiscoNxosStructureUsage implements StructureUsage { AAA_GROUP_SERVER_RADIUS_SOURCE_INTERFACE("aaa group server radius source-interface"), AAA_GROUP_SERVER_RADIUS_USE_VRF("aaa group server radius use-vrf"), AAA_GROUP_SERVER_TACACSP_SOURCE_INTERFACE("aaa group server tacacs+ source-interface"), AAA_GROUP_SERVER_TACACSP_USE_VRF("aaa group server tacacs+ use-vrf"), BGP_ADDITIONAL_PATHS_ROUTE_MAP("bgp address-family additional-paths route-map"), BGP_ADVERTISE_MAP("bgp address-family advertise-map"), BGP_ATTRIBUTE_MAP("bgp address-family attribute-map"), BGP_DAMPENING_ROUTE_MAP("bgp address-family dampening route-map"), BGP_DEFAULT_ORIGINATE_ROUTE_MAP("bgp address-family default-originate route-map"), BGP_EXIST_MAP("bgp address-family exist-map"), BGP_INJECT_MAP("bgp address-family inject-map"), BGP_L2VPN_EVPN_RETAIN_ROUTE_TARGET_ROUTE_MAP( "bgp address-family l2vpn evpn retain-target route-map"), BGP_NEIGHBOR_ADVERTISE_MAP("bgp neighbor advertise-map"), BGP_NEIGHBOR_EXIST_MAP("bgp neighbor exist-map"), BGP_NEIGHBOR_FILTER_LIST_IN("bgp neighbor address-family filter-list in"), BGP_NEIGHBOR_FILTER_LIST_OUT("bgp neighbor address-family filter-list out"), BGP_NEIGHBOR6_FILTER_LIST_IN("bgp neighbor address-family [IPv6] filter-list in"), BGP_NEIGHBOR6_FILTER_LIST_OUT("bgp neighbor address-family [IPv6] filter-list out"), BGP_NEIGHBOR_INHERIT_PEER("bgp neighbor inherit peer"), BGP_NEIGHBOR_INHERIT_PEER_POLICY("bgp neighbor address-family inherit peer"), BGP_NEIGHBOR_INHERIT_PEER_SESSION("bgp neighbor inherit peer-session"), BGP_NEIGHBOR_PREFIX_LIST_IN("bgp neighbor address-family prefix-list in"), BGP_NEIGHBOR_PREFIX_LIST_OUT("bgp neighbor address-family prefix-list out"), BGP_NEIGHBOR6_PREFIX_LIST_IN("bgp neighbor address-family [IPv6] prefix-list in"), BGP_NEIGHBOR6_PREFIX_LIST_OUT("bgp neighbor address-family [IPv6] prefix-list out"), BGP_NEIGHBOR_NON_EXIST_MAP("bgp neighbor non-exist-map"), BGP_NEIGHBOR_REMOTE_AS_ROUTE_MAP("bgp neighbor remote-as route-map"), BGP_NEIGHBOR_ROUTE_MAP_IN("bgp neighbor address-family route-map in"), BGP_NEIGHBOR_ROUTE_MAP_OUT("bgp neighbor address-family route-map out"), BGP_NEIGHBOR_SELF_REF("bgp neighbor self ref"), BGP_NEIGHBOR_UPDATE_SOURCE("bgp neighbor update-source"), BGP_NETWORK_ROUTE_MAP("bgp address-family network route-map"), BGP_NETWORK6_ROUTE_MAP("bgp address-family [IPv6] network route-map"), BGP_NEXTHOP_ROUTE_MAP("bgp address-family nexthop route-map"), BGP_REDISTRIBUTE_INSTANCE("bgp address-family redistribute"), BGP_REDISTRIBUTE_ROUTE_MAP("bgp address-family redistribute route-map"), BGP_SUPPRESS_MAP("bgp address-family suppress-map"), BGP_TABLE_MAP("bgp address-family table-map"), BGP_UNSUPPRESS_MAP("bgp address-family unsuppress-map"), /** This {@link CiscoNxosStructureUsage} should be used for ANY built-in structure of any type. */ BUILT_IN("built-in structure"), CLASS_MAP_CP_MATCH_ACCESS_GROUP("class-map type control-plane match access-group"), CLASS_MAP_QOS_MATCH_ACCESS_GROUP("class-map type qos match access-group"), CONTROL_PLANE_SERVICE_POLICY("control-plane service-policy"), EIGRP_DISTRIBUTE_LIST_PREFIX_LIST_IN("ip distribute-list eigrp prefix-list in"), EIGRP_DISTRIBUTE_LIST_PREFIX_LIST_OUT("ip distribute-list eigrp prefix-list out"), EIGRP_DISTRIBUTE_LIST_ROUTE_MAP_IN("ip distribute-list eigrp route-map in"), EIGRP_DISTRIBUTE_LIST_ROUTE_MAP_OUT("ip distribute-list eigrp route-map out"), EIGRP_REDISTRIBUTE_INSTANCE("eigrp address-family redistribute"), EIGRP_REDISTRIBUTE_ROUTE_MAP("eigrp address-family redistribute route-map"), FLOW_EXPORTER_SOURCE("flow exporter source"), FLOW_MONITOR_EXPORTER("flow monitor exporter"), FLOW_MONITOR_RECORD("flow monitor record"), INTERFACE_CHANNEL_GROUP("interface channel-group"), INTERFACE_HSRP_GROUP_TRACK("interface hsrp group track"), INTERFACE_IP_ACCESS_GROUP_IN("interface ip access-group in"), INTERFACE_IP_ACCESS_GROUP_OUT("interface ip access-group out"), INTERFACE_IP_EIGRP("interface ip eigrp"), INTERFACE_IP_HELLO_INTERVAL_EIGRP("interface ip hello-interval eigrp"), INTERFACE_IP_HOLD_TIME_EIGRP("interface ip hold-time eigrp"), INTERFACE_IP_IGMP_ACCESS_GROUP("interface ip igmp access-group"), INTERFACE_IP_PIM_JP_POLICY_PREFIX_LIST("interface ip pim jp-policy prefix-list"), INTERFACE_IP_PIM_JP_POLICY_ROUTE_MAP("interface ip pim jp-policy"), INTERFACE_IP_PIM_NEIGHBOR_POLICY_PREFIX_LIST("interface ip pim neighbor-policy prefix-list"), INTERFACE_IP_PIM_NEIGHBOR_POLICY_ROUTE_MAP("interface ip pim neighbor-policy"), INTERFACE_IP_POLICY("interface ip policy"), INTERFACE_IP_PORT_ACCESS_GROUP("interface ip port access-group"), INTERFACE_IP_RIP_ROUTE_FILTER_PREFIX_LIST("interface ip rip route-filter prefix-list"), INTERFACE_IP_RIP_ROUTE_FILTER_ROUTE_MAP("interface ip rip route-filter route-map"), INTERFACE_IP_ROUTER_EIGRP("interface ip router eigrp"), INTERFACE_IP_ROUTER_OSPF("interface ip router ospf"), INTERFACE_IP_ROUTER_RIP("interface ip router rip"), INTERFACE_IPV6_ROUTER_OSPFV3("interface ipv6 router ospfv3"), INTERFACE_SELF_REFERENCE("interface"), INTERFACE_SERVICE_POLICY_QOS("interface service-policy type qos"), INTERFACE_SERVICE_POLICY_QUEUING("interface service-policy type queuing"), INTERFACE_VLAN("interface vlan"), INTERFACE_VRF_MEMBER("interface vrf member"), IP_ACCESS_LIST_DESTINATION_ADDRGROUP("ip access-list destination addrgroup"), IP_ACCESS_LIST_DESTINATION_PORTGROUP("ip access-list destination portgroup"), IP_ACCESS_LIST_SOURCE_ADDRGROUP("ip access-list source addrgroup"), IP_ACCESS_LIST_SOURCE_PORTGROUP("ip access-list source portgroup"), IP_ACCESS_LIST_LINE_SELF_REFERENCE("ip access-list line"), IP_PIM_RP_ADDRESS_PREFIX_LIST("ip pim rp-address prefix-list"), IP_PIM_RP_ADDRESS_ROUTE_MAP("ip pim rp-address route-map"), IP_PIM_RP_CANDIDATE_INTERFACE("ip pim rp-candidate interface"), IP_PIM_RP_CANDIDATE_PREFIX_LIST("ip pim rp-candidate prefix-list"), IP_PIM_RP_CANDIDATE_ROUTE_MAP("ip pim rp-candidate route-map"), IP_ROUTE_NEXT_HOP_INTERFACE("ip route next-hop-interface"), IP_ROUTE_NEXT_HOP_VRF("ip route vrf"), IP_ROUTE_TRACK("ip route track"), IPV6_ROUTE_NEXT_HOP_INTERFACE("ipv6 route next-hop-interface"), IPV6_ROUTE_NEXT_HOP_VRF("ipv6 route vrf"), IPV6_ROUTE_TRACK("ipv6 route track"), LINE_VTY_ACCESS_CLASS_IN("line vty access-class in"), LINE_VTY_ACCESS_CLASS_OUT("line vty access-class out"), LOGGING_SOURCE_INTERFACE("logging source-interface"), MONITOR_SESSION_DESTINATION_INTERFACE("monitor session destination interface"), MONITOR_SESSION_SOURCE_INTERFACE("monitor session source interface"), MONITOR_SESSION_SOURCE_VLAN("monitor session source vlan"), NTP_ACCESS_GROUP_PEER("ntp access-group peer"), NTP_ACCESS_GROUP_QUERY_ONLY("ntp access-group query-only"), NTP_ACCESS_GROUP_SERVE("ntp access-group serve"), NTP_ACCESS_GROUP_SERVE_ONLY("ntp access-group serve-only"), NTP_SOURCE_INTERFACE("ntp source-interface"), NVE_SELF_REFERENCE("interface nve"), NVE_SOURCE_INTERFACE("interface nve source-interface"), OSPF_AREA_FILTER_LIST_IN("router ospf area filter-list in"), OSPF_AREA_FILTER_LIST_OUT("router ospf area filter-list out"), OSPF_AREA_NSSA_ROUTE_MAP("router ospf area nssa route-map"), OSPF_DEFAULT_INFORMATION_ROUTE_MAP("router ospf default-information originate route-map"), OSPF_REDISTRIBUTE_INSTANCE("router ospf redistribute"), OSPF_REDISTRIBUTE_ROUTE_MAP("router ospf redistribute route-map"), OSPFV3_AREA_FILTER_LIST_ROUTE_MAP( "router ospfv3 address-family area ipv6 unicast filter-list route-map"), OSPFV3_DEFAULT_INFORMATION_ORIGINATE_ROUTE_MAP( "router ospfv3 address-family default-information originate route-map"), OSPFV3_NSSA_DEFAULT_INFORMATION_ORIGINATE_ROUTE_MAP( "router ospfv3 area nssa default-information-originate route-map"), OSPFV3_REDISTRIBUTE_INSTANCE("router ospfv3 address-family redistribute"), OSPFV3_REDISTRIBUTE_ROUTE_MAP("router ospfv3 address-family redistribute route-map"), OSPFV3_TABLE_MAP("router ospfv3 address-family table-map"), OSPFV3_VRF("router ospfv3 vrf"), POLICY_MAP_CLASS("policy-map class"), RIP_AF4_DEFAULT_INFORMATION_ROUTE_MAP( "router rip address-family ipv4 default-information originate route-map"), RIP_AF4_REDISTRIBUTE_INSTANCE("router rip address-family ipv4 redistribute"), RIP_AF4_REDISTRIBUTE_ROUTE_MAP("router ospf address-family ipv4 redistribute route-map"), RIP_AF6_DEFAULT_INFORMATION_ROUTE_MAP( "router rip address-family ipv6 default-information originate route-map"), RIP_AF6_REDISTRIBUTE_INSTANCE("router rip address-family ipv6 redistribute"), RIP_AF6_REDISTRIBUTE_ROUTE_MAP("router ospf address-family ipv6 redistribute route-map"), ROUTE_MAP_CONTINUE("route-map continue"), ROUTE_MAP_ENTRY_PREV_REF("route-map entry"), ROUTE_MAP_MATCH_AS_PATH("route-map match as-path"), ROUTE_MAP_MATCH_COMMUNITY("route-map match community"), ROUTE_MAP_MATCH_INTERFACE("route-map match interface"), ROUTE_MAP_MATCH_IP_ADDRESS("route-map match ip address"), ROUTE_MAP_MATCH_IP_ADDRESS_PREFIX_LIST("route-map match ip address prefix-list"), ROUTE_MAP_MATCH_IPV6_ADDRESS("route-map match ipv6 address"), ROUTE_MAP_MATCH_IPV6_ADDRESS_PREFIX_LIST("route-map match ipv6 address prefix-list"), ROUTE_MAP_SET_COMM_LIST_DELETE("route-map set comm-list delete"), ROUTER_EIGRP_SELF_REFERENCE("router eigrp"), ROUTER_ISIS_SELF_REFERENCE("router isis"), ROUTER_OSPF_SELF_REFERENCE("router ospf"), ROUTER_OSPFV3_SELF_REFERENCE("router ospfv3"), ROUTER_RIP_SELF_REFERENCE("router rip"), ROUTER_RIP_VRF("router rip vrf"), SNMP_SERVER_COMMUNITY_USE_ACL("snmp-server community use-acl"), SNMP_SERVER_COMMUNITY_USE_IPV4ACL("snmp-server community use-ipv4acl"), SNMP_SERVER_COMMUNITY_USE_IPV6ACL("snmp-server community use-ipv6acl"), SNMP_SERVER_SOURCE_INTERFACE("snmp-server source-interface"), SYSQOS_NETWORK_QOS("system qos service-policy type network-qos"), SYSQOS_QOS("system qos service-policy type qos"), SYSQOS_QUEUING("system qos service-policy type queuing"), TACACS_SOURCE_INTERFACE("ip tacacs source-interface"), TRACK_INTERFACE("track interface"), TRACK_IP_ROUTE_VRF("track ip route vrf"), VLAN_CONFIGURATION_QOS("vlan configuration service-policy type qos"); private final @Nonnull String _description; private CiscoNxosStructureUsage(String description) { _description = description; } @Override public @Nonnull String getDescription() { return _description; } }
[ "noreply@github.com" ]
noreply@github.com
6e3249ac6b955189b6dd5ccb01233736cf293c8c
639c00a62f9af1fb62ca9921cc383851e931a3c4
/MosaicoWeb/src/main/java/br/com/mosaicoweb/springsecurity/configuration/SecurityWebApplicationInitializer.java
7be4aa653f39ab9aaa68f0e3557046393ff4c0ed
[]
no_license
dcorteztec/mosaicoapp
2c208efaece9ba92a3cafc125a4e6224493414b1
93791bf15040ace1a09e5cb1948c5038d95e98e2
refs/heads/master
2021-08-11T07:49:19.455175
2016-05-11T00:53:26
2016-05-11T00:53:26
110,535,635
0
0
null
null
null
null
UTF-8
Java
false
false
250
java
package br.com.mosaicoweb.springsecurity.configuration; import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer; public class SecurityWebApplicationInitializer extends AbstractSecurityWebApplicationInitializer{ }
[ "dcorteztec@gmail.com" ]
dcorteztec@gmail.com
b85c4d3b54ce35dd70dc66ba2147b802e080ec64
d0382c3c4de344b1ba1deae7aba1192e343b7a5c
/app/src/androidTest/java/com/example/kevin/simpletimerapp/ApplicationTest.java
1576f5c5bf92d40577e28f2ac484ef3c198ae847
[]
no_license
kmcclean/SimpleTimerApp
a6e7dbfd183f9a2c36240a585b88760f9d81d77b
c29df8db614bf2fd33317c28cf1cc855c33098ad
refs/heads/master
2016-08-10T09:48:52.318718
2015-10-01T22:34:50
2015-10-01T22:34:50
43,524,771
0
0
null
null
null
null
UTF-8
Java
false
false
363
java
package com.example.kevin.simpletimerapp; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
[ "mcclean@gmail.com" ]
mcclean@gmail.com
23ccfb3ea85446388b2f3af0e9128ac70e6fdf7e
f2f06235b8cb1b9dede2e7b065c1b1856c043926
/scanners/src/main/java/scanners/Runner.java
2a788fbea74fa0eb8c9e51c694fdde5bd521ebde
[]
no_license
Reece-elder/21SEPSoftware_Java
e584e03696eb967f3dff8c15bca68b961d3b0b30
8612271f04f831ec2f7aab60bb61c7f58820ecdd
refs/heads/main
2023-08-26T16:13:58.012469
2021-10-20T15:17:05
2021-10-20T15:17:05
413,337,237
0
0
null
null
null
null
UTF-8
Java
false
false
261
java
package scanners; import java.util.Scanner; public class Runner { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("What football team do you support?"); String team = scanner.nextLine(); } }
[ "jordanbenbelaid@hotmail.com" ]
jordanbenbelaid@hotmail.com
5ace7fa7ebeb724dd38a8cbcf7ccb72d58dd86f4
99b58f2d86589cc955a0bb34113cf8c1d35a3e44
/Android/chengxin/app/src/main/java/com/beijing/chengxin/ui/adapter/FollowAccountListAdapter.java
e800ff5c104a33985e66d6a77f41f5317c350168
[]
no_license
kkxmax/chengquan
0251dafb390b81d099a56ad7418c080ac91bb574
73eb91d954320b315104f1fa6ff6be5db1b9ad66
refs/heads/master
2021-09-03T10:03:48.366690
2018-01-08T07:21:50
2018-01-08T07:21:50
106,901,418
0
0
null
null
null
null
UTF-8
Java
false
false
12,599
java
package com.beijing.chengxin.ui.adapter; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.AsyncTask; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.SectionIndexer; import android.widget.TextView; import android.widget.Toast; import com.beijing.chengxin.R; import com.beijing.chengxin.config.AppConfig; import com.beijing.chengxin.config.Constants; import com.beijing.chengxin.network.SyncInfo; import com.beijing.chengxin.network.model.BaseModel; import com.beijing.chengxin.network.model.UserModel; import com.beijing.chengxin.ui.activity.DetailActivity; import com.beijing.chengxin.ui.view.FollowAccountListView; import com.beijing.chengxin.ui.widget.CustomToast; import com.beijing.chengxin.ui.widget.Utils; import com.beijing.chengxin.utils.CommonUtils; import com.squareup.picasso.Picasso; import java.util.ArrayList; import static com.beijing.chengxin.config.Constants.ERROR_OK; public class FollowAccountListAdapter extends BaseAdapter implements SectionIndexer { private Context mContext; private ArrayList<UserModel> mDataList; private ArrayList<String> mFollowIdList; private int mWhoIndex = FollowAccountListView.INDEX_PERSON; private int mIndexSelected = -1; public FollowAccountListAdapter(Context context) { mContext = context; } public void setDatas(int indexFlag, ArrayList<UserModel> datas, ArrayList<String> idList) { this.mWhoIndex = indexFlag; this.mDataList = datas; this.mFollowIdList = idList; } @Override public int getCount() { return (mDataList == null) ? 0 : mDataList.size(); } @Override public Object getItem(int position) { return (mDataList == null) ? null : mDataList.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(final int position, View convertView, final ViewGroup parent) { ViewHolder holder = new ViewHolder(); if (convertView == null) { convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_favorite_account, null); holder.viewBody = (View) convertView.findViewById(R.id.view_body); holder.viewPreview = (View) convertView.findViewById(R.id.view_preview); holder.viewMain = (View) convertView.findViewById(R.id.view_main); holder.txtIndex = (TextView) convertView.findViewById(R.id.txt_index); holder.imgAvatar = (ImageView) convertView.findViewById(R.id.img_avatar); holder.txtName = (TextView) convertView.findViewById(R.id.txt_name); holder.txtFollowMe = (TextView) convertView.findViewById(R.id.txt_follow_me); holder.txtFollowNotme = (TextView) convertView.findViewById(R.id.txt_follow_notme); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } convertView.setId(position); final UserModel item = (UserModel) getItem(position); holder.id = item.getId(); String tmpName = item.getAkind() == Constants.ACCOUNT_TYPE_PERSON ? item.getRealname() : item.getEnterName(); tmpName = tmpName.length() == 0 ? item.getMobile() : tmpName; holder.txtName.setText(tmpName); Picasso.with(parent.getContext()) .load(Constants.FILE_ADDR +item.getLogo()) .placeholder(item.getAkind() == Constants.ACCOUNT_TYPE_PERSON ? R.drawable.no_image_person_center : R.drawable.no_image_item) .skipMemoryCache() .into(holder.imgAvatar); String pre_index = null; String index = item.alias; if (position == 0) { pre_index = null; } else { pre_index = ((UserModel) getItem(position - 1)).alias; } if (pre_index != null && pre_index.length() > 0) { pre_index = pre_index.substring(0, 1); } if (index != null && index.length() > 0) { index = index.substring(0, 1); } String index_title = parent.getContext().getString(R.string.str_dis_person); if (index.equals(Constants.STR_STAR)) { index_title = (item.getAkind() == 1) ? parent.getContext().getString(R.string.str_dis_person) : parent.getContext().getString(R.string.str_dis_enterprise); if (mWhoIndex >= FollowAccountListView.INDEX_FRIEND_1_PERSON) index_title = FollowAccountListView.getStarTitle(mWhoIndex); holder.txtFollowMe.setText(R.string.str_follow_notstar); } else { index_title = index.toUpperCase(); holder.txtFollowMe.setText(R.string.str_follow_me); } holder.txtIndex.setText(index == null ? "" : index_title); if (index != null && !index.equals(pre_index)) { holder.txtIndex.setVisibility(View.VISIBLE); } else { holder.txtIndex.setVisibility(View.GONE); } final String final_index = index; holder.txtFollowMe.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (final_index.equals(Constants.STR_STAR)) { if (mFollowIdList.contains("" + item.getId())) { mFollowIdList.remove("" + item.getId()); item.alias = item.alias.substring(1); CommonUtils.sortAccountByChinese(mDataList); String title = FollowAccountListView.getIndexTitle(mWhoIndex); AppConfig.getInstance().setStringArrayValue(title, mFollowIdList); } mIndexSelected = -1; } else { if (!mFollowIdList.contains("" + item.getId())) { mFollowIdList.add("" + item.getId()); item.alias = Constants.STR_STAR + item.alias; CommonUtils.sortAccountByChinese(mDataList); String title = FollowAccountListView.getIndexTitle(mWhoIndex); AppConfig.getInstance().setStringArrayValue(title, mFollowIdList); } mIndexSelected = -1; } notifyDataSetChanged(); } }); if (item.getInterested() == Constants.INTEREST_OK) { holder.txtFollowNotme.setText(R.string.str_follow_notme); holder.txtFollowNotme.setBackgroundResource(R.drawable.rect_gray_gradient); holder.txtFollowNotme.setTextColor(mContext.getResources().getColor(R.color.txt_gray)); } else { holder.txtFollowNotme.setText(R.string.str_follow); holder.txtFollowNotme.setBackgroundResource(R.drawable.rect_orange_gradient); holder.txtFollowNotme.setTextColor(mContext.getResources().getColor(R.color.color_white)); } holder.txtFollowNotme.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int targetInterest = item.getInterested() == Constants.INTEREST_OK ? Constants.INTEREST_NO : Constants.INTEREST_OK; setInterestTask(item.getId(), targetInterest); } }); final ViewHolder finalHolder = holder; holder.viewBody.setOnTouchListener(new View.OnTouchListener() { float x1 = 0, x2 = 0; float y1 = 0, y2 = 0; @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { x1 = x2 = event.getX(); y1 = y2 = event.getY(); } if (event.getAction() == MotionEvent.ACTION_UP) { x2 = event.getX(); y2 = event.getY(); if ((x1 - x2) > 200) { finalHolder.viewMain.setVisibility(View.GONE); mIndexSelected = position; } else { finalHolder.viewMain.setVisibility(View.VISIBLE); mIndexSelected = -1; } if (Math.abs((x1 - x2)) < 10 && Math.abs((y1 - y2)) < 10) { if (item.getTestStatus() == Constants.TEST_STATUS_PASSED) { Intent intent = new Intent(mContext, DetailActivity.class); intent.putExtra("type", Constants.INDEX_ENTERPRISE); intent.putExtra("id", item.getId()); intent.putExtra("akind", item.getAkind()); mContext.startActivity(intent); ((Activity) mContext).overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left); } else { CustomToast.makeText(mContext, mContext.getString(R.string.err_not_test_passed_person), Toast.LENGTH_SHORT).show(); } } notifyDataSetChanged(); } return true; } }); if (mIndexSelected == position) { if (holder.viewMain.getVisibility() == View.GONE) { CommonUtils.animationShowFromRight(holder.viewMain); holder.viewMain.setVisibility(View.VISIBLE); } } else { holder.viewMain.setVisibility(View.GONE); } return convertView; } @Override public Object[] getSections() { return null; } @Override public int getPositionForSection(int sectionIndex) { UserModel info; int size = getCount(); for (int i = 0; i < size; i++) { info = (UserModel) getItem(i); String name = info.alias; if (name.length() > 0) { char firstChar = name.toUpperCase().charAt(0); if (firstChar == sectionIndex) { return i; } } } return -1; } @Override public int getSectionForPosition(int position) { return 0; } private static class ViewHolder { public int id; public View viewBody; public View viewPreview; public View viewMain; public TextView txtIndex; public ImageView imgAvatar; public TextView txtName; public TextView txtFollowMe; public TextView txtFollowNotme; } private void setInterestTask(final int id, final int interest) { new AsyncTask<Object, Object, Object>() { @Override protected void onPreExecute() { super.onPreExecute(); Utils.displayProgressDialog(mContext); } @Override protected BaseModel doInBackground(Object... strs) { return new SyncInfo(mContext).syncSetInterest("" + id, "" + interest); } @Override protected void onPostExecute(Object o) { super.onPostExecute(o); BaseModel result = (BaseModel) o; if (result.isValid()) { if(result.getRetCode() == ERROR_OK) { Intent intent = new Intent(Constants.NOTIFY_FOLLOW_INFO_CHANGED); mContext.sendBroadcast(intent); } else { Toast.makeText(mContext, result.getMsg(), Toast.LENGTH_LONG).show(); } } else { Toast.makeText(mContext, mContext.getString(R.string.err_server), Toast.LENGTH_LONG).show(); } Utils.disappearProgressDialog(); } @Override protected void onCancelled() { super.onCancelled(); Utils.disappearProgressDialog(); } }.execute(); } }
[ "kkx_max@sina.com" ]
kkx_max@sina.com
638b723e358d0847da49bf719159483ed04ff38f
92c0fb118984daee65c83b384bda2f07b370dafd
/src/main/java/com/example/Appointment/AppointmentApplication.java
fe16b5810967e27cdc06b0e69ec4f7b86f366ae6
[]
no_license
capybarin/Appointment-API
4799b4fd44bc88302acafbc6855a37e8b68a0f0c
76f0f07e97d9a3054d90d489cf2343e7f6340df2
refs/heads/master
2023-04-10T15:58:52.551976
2021-04-26T08:00:41
2021-04-26T08:00:41
285,017,217
0
0
null
null
null
null
UTF-8
Java
false
false
330
java
package com.example.Appointment; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication() public class AppointmentApplication { public static void main(String[] args) { SpringApplication.run(AppointmentApplication.class, args); } }
[ "vladibzd@gmail.com" ]
vladibzd@gmail.com
af93f18911c3e7c39d4de64ffbf2a9ea9a91e11d
9ebf59de204f91cbfbf4429af7ed66cb96823b6a
/Framework.TP3/src/Test/DeTest.java
355a6d7d336e5230f89f2c8ed46de4751cb67a89
[]
no_license
zladix/GV_LOG121_TP3
84b3c1f5f969ec9b6fe2f85ea0aa0d3cf0b01187
9e47d824d51a765be2a7e06b518ddea3bc66aa1f
refs/heads/master
2021-01-10T01:46:44.291072
2016-03-15T23:47:06
2016-03-15T23:47:06
51,527,049
0
0
null
null
null
null
ISO-8859-1
Java
false
false
1,287
java
/****************************************************** Cours: LOG121 Projet: Framework.TP3 Nom du fichier: DeTest.java Date créé: 2016-03-07 ******************************************************* Historique des modifications ******************************************************* *@author Vincent Leclerc(LECV07069406) *@author Gabriel Déry(DERG30049401) 2016-03-07 Version initiale *******************************************************/ package Test; import static org.junit.Assert.*; import org.junit.Test; import Framework.Des.De; /** * Classe qui permet de tester les méthode de la classe De * @author pc * */ public class DeTest { private De de1 = new De(); private De de2 = new De(); @Test public void deSuperieurTest() { de1.setFace(2); de2.setFace(3); assertTrue(de1.compareTo(de2)==1); } @Test public void deInferieurTest() { de1.setFace(3); de2.setFace(2); assertTrue(de1.compareTo(de2)==-1); } @Test public void memeDeTest() { de1.setFace(3); de2.setFace(3); assertTrue(de1.compareTo(de2)==0); } @Test public void getFaceTest() { de1.setFace(3); int face = de1.getFace(); assertTrue(face == 3); } @Test public void setFaceTest() { de1.setFace(3); assertTrue(de1.getFace() == 3); } }
[ "gabriodery@hotmail.com" ]
gabriodery@hotmail.com
d2963561fe9a7f97c5d2ff71b671c1ed7cf8cdaf
ccaa535498e3daa911985bc3fc0e396eaf56e226
/spider-55haitao-crawler/src/main/java/com/haitao55/spider/crawler/core/callable/custom/shopspring/ShopspringSelectAllPages.java
32585600b833cabeb562da8d3397318f89c3ad9d
[]
no_license
github4n/spider-55ht
d871aad6e51f7cf800032351137b4b3f12d6e86e
7c59cda6b5b514139bd69cff2b914e0815f53cd6
refs/heads/master
2020-03-29T22:44:38.527732
2018-02-01T07:53:30
2018-02-01T07:53:30
150,438,349
1
0
null
2018-09-26T14:19:14
2018-09-26T14:19:14
null
UTF-8
Java
false
false
2,416
java
package com.haitao55.spider.crawler.core.callable.custom.shopspring; import java.net.URLEncoder; import java.util.ArrayList; import java.util.List; import java.util.Set; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.haitao55.spider.common.http.Crawler; import com.haitao55.spider.common.http.HttpMethod; import com.haitao55.spider.crawler.core.callable.SelectUrls; import com.haitao55.spider.crawler.core.callable.context.Context; import com.haitao55.spider.crawler.core.model.Url; import com.haitao55.spider.crawler.utils.Constants; public class ShopspringSelectAllPages extends SelectUrls{ private static final Logger logger = LoggerFactory.getLogger(Constants.LOGGER_NAME_CRAWLER); private static final String BASEURL = "https://www.shopspring.com/"; private String SHOPSPRING_API ="https://www.shopspring.com/api/1/productsWithRefinements/?taxonomy={}&sortBy=popular&sortOrder=DESC"; private String START_PAGE_API ="https://www.shopspring.com/api/1/productsWithRefinements/?taxonomy={}&start={start}&sortBy=popular&sortOrder=DESC"; @Override public void invoke(Context context) throws Exception { String url = context.getCurrentUrl(); String attr = url.replace(BASEURL, ""); String conversionAttr = attr.replaceAll("/", ":"); List<String> newUrlValues = new ArrayList<String>(); if(StringUtils.isNotBlank(conversionAttr)){ @SuppressWarnings("deprecation") String code = URLEncoder.encode(conversionAttr); String shopUrl = SHOPSPRING_API.replace("{}", code); String content = Crawler.create().timeOut(60000).url(shopUrl) .method(HttpMethod.GET.getValue()).resultAsString(); String pageTotal = StringUtils.substringBetween(content, "total_products_count\":", "}"); newUrlValues.add(shopUrl); if(StringUtils.isNotBlank(pageTotal) && !"0".equals(pageTotal)){ Double page = Double.valueOf(pageTotal) / 80; int pageNumber = (int)Math.ceil(page); for(int i = 1 ;i < pageNumber; i++){ String startPageUrl = START_PAGE_API.replace("{}", code).replace("{start}",String.valueOf(i*80)); newUrlValues.add(startPageUrl); } } } Set<Url> newUrls = this.buildNewUrls(newUrlValues, context, type, grade); context.getUrl().getNewUrls().addAll(newUrls); logger.info("Shopspring list url:{} ,get items :{}", context.getUrl().getValue(), newUrlValues.size()); } }
[ "liusz_ok@126.com" ]
liusz_ok@126.com