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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1fe95c9919e773deb72a2aa15b0944061bbeb51e
|
9c316ae503770864741096da3e64b6fcb3553e22
|
/seleniumBDDV2/src/main/java/automation/config/RunFrameworkConfiguration.java
|
020dc29bb6ee57362d5a5af5b0c1d9a207411226
|
[] |
no_license
|
yusi118/seleniumOrangeHRM
|
6815f65dd5d3d39f6ffa44dcb1569a1cb1512efb
|
aaee1798c5a16422ef4ce7e9a2bf7edfcbc50910
|
refs/heads/main
| 2023-08-12T09:46:18.307438 | 2021-10-04T09:13:46 | 2021-10-04T09:13:46 | 411,765,617 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 342 |
java
|
package automation.config;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import io.cucumber.spring.CucumberContextConfiguration;
@Configuration
@ComponentScan("automation")
public class RunFrameworkConfiguration {
public RunFrameworkConfiguration() {
}
}
|
[
"[email protected]"
] | |
27d47613c586576b97ba972e8541f2b10503abe9
|
b8977ab505a540e3cb4b9c076cecd197d7d54e39
|
/Project/src/dao/ViewEventDao.java
|
d6d5ef99afe26382b57e0503d8fd886fabb5bbd4
|
[] |
no_license
|
bhargavipatel259/Hangouts_Project
|
221d901a2a14ab1015f380e31abd64c0c37edbb7
|
30ed182ea3763af1b8e5eda1304492a265422ba5
|
refs/heads/master
| 2020-04-16T07:22:01.107488 | 2019-01-12T12:09:02 | 2019-01-12T12:09:02 | 165,383,647 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,666 |
java
|
package dao;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import java.math.*;
import javax.servlet.http.HttpSession;
import bean.Eventbean;
import bean.loginbean;
import controller.EditServlet;
public class ViewEventDao {
public List<Eventbean> getAllEvents(String email){
List <Eventbean> list = new ArrayList<Eventbean>();
java.sql.Connection con = null;
java.sql.PreparedStatement ps = null;
System.out.println("----------email-------"+ email);
try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/ualbanyhangouts", "icsi518", "secretICSI518");
String sqlp = "SELECT * FROM ualbanyhangouts.event where email=?";
ps = con.prepareStatement(sqlp);
ps.setString(1,email);
ResultSet rs = ps.executeQuery();
while(rs.next()){
Eventbean e = new Eventbean();
e.setTitle(rs.getString("title"));
e.setTextpart(rs.getString("textpart"));
e.setSpeaker(rs.getString("speaker"));
e.setSpeakerinfo(rs.getString("speakerinfo"));
e.setVenue(rs.getString("venue"));
//e.setDate(rs.getString("day"));
e.setEventid(rs.getInt("eventid"));
try{
String p= (String) rs.getString("time");// 12:12:12
String[] parts = p.split(":"); //returns an array with the 2 parts
String firstPart = parts[0];
String secondPart =parts[1];
String tim = (firstPart +":"+secondPart) ;
System.out.println("Time---------"+firstPart + secondPart + tim);
e.setTime(tim);
}
catch(Exception u){System.out.println("Exception"+u);}
System.out.println("list item"+ e.getTitle());
list.add(e);
}
con.close();
}
catch(Exception e){e.printStackTrace();}
return list;
}
public List<Eventbean> getAllpEvents(String email){
List <Eventbean> list = new ArrayList<Eventbean>();
java.sql.Connection con = null;
java.sql.PreparedStatement ps = null;
System.out.println("----------email-------"+ email);
try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/ualbanyhangouts", "icsi518", "secretICSI518");
String sqlp = "SELECT * FROM ualbanyhangouts.event where email=?";
ps = con.prepareStatement(sqlp);
ps.setString(1,email);
ResultSet rs = ps.executeQuery();
while(rs.next()){
Eventbean e = new Eventbean();
e.setTitle(rs.getString("title"));
e.setTextpart(rs.getString("textpart"));
e.setSpeaker(rs.getString("speaker"));
//e.setSpeakerinfo(rs.getString("speakerinfo"));
e.setVenue(rs.getString("venue"));
//e.setDate(rs.getString("day"));
e.setEventid(rs.getInt("eventid"));
// try{
// String p= (String) rs.getString("time");// 12:12:12
// String[] parts = p.split(":"); //returns an array with the 2 parts
// String firstPart = parts[0];
// String secondPart =parts[1];
// String tim = (firstPart +":"+secondPart) ;
// System.out.println("Time---------"+firstPart + secondPart + tim);
// e.setTime(tim);
// }
// catch(Exception u){System.out.println("Exception"+u);}
//
System.out.println("list item"+ e.getTitle());
list.add(e);
}
con.close();
}
catch(Exception e){e.printStackTrace();}
return list;
}
public List<Eventbean> getEvent(int id){
List <Eventbean> list = new ArrayList<Eventbean>();
java.sql.Connection con = null;
java.sql.PreparedStatement ps = null;
try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost:9050/ualbanyhangouts", "root", "root");
String sqp = "SELECT * FROM ualbanyhangouts.event where eventid=?";
ps = con.prepareStatement(sqp);
ps.setInt(1,id);
System.out.println(id+"-----------------id------------------");
Eventbean e = new Eventbean();
ResultSet rs = ps.executeQuery();
while(rs.next()){
String title= rs.getString("title");
String textpart= rs.getString("textpart");
String speaker = rs.getString("speaker");
String speakerinfo = rs.getString("speakerinfo");
String venue = rs.getString("venue");
String date= rs.getString("date");
String time =rs.getString("time");
int eventid = id;
//e.setDate(date);
e.setSpeaker(speaker);
e.setSpeakerinfo(speakerinfo);
e.setTextpart(textpart);
e.setTime(time);
e.setTitle(title);
e.setVenue(venue);
e.setEventid(eventid);
list.add(e);
con.close();
}
}
catch(Exception p){p.printStackTrace();}
return list;
}
}
|
[
"[email protected]"
] | |
6678048ed5185376f0db21bc932ea666d941e998
|
6b14d3353b81718e5c51755cfb1023d44980b696
|
/java/com/example/syp/service/FollowUpService.java
|
35fbd17a39374d3371fce26d46a99174e5f92b37
|
[] |
no_license
|
ghinaAK/Ticketing-System
|
538e9d448a040cc6b08f20608195a951bd6f4db2
|
ecf6ad6c22b64b892992e946ccf88e58f8f21c7a
|
refs/heads/master
| 2021-04-18T19:12:16.362078 | 2018-06-26T09:37:48 | 2018-06-26T09:37:48 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,044 |
java
|
package com.example.syp.service;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.example.syp.dao.FollowUpDAO;
import com.example.syp.model.FollowUp;
import com.example.syp.repository.FollowUpRepository;
@Service
public class FollowUpService implements FollowUpDAO{
@Autowired
FollowUpRepository followUpRepository;
@Override
public void insert(FollowUp followup) {
// TODO Auto-generated method stub
}
@Override
public void update(FollowUp followup) {
// TODO Auto-generated method stub
}
@Override
public void delete(FollowUp followup) {
// TODO Auto-generated method stub
}
@Override
public FollowUp getById(long id) {
// TODO Auto-generated method stub
return null;
}
@Override
public List<FollowUp> getAll() {
List<FollowUp> lfp = new ArrayList<>();
followUpRepository.findAll().forEach(lfp::add);
return lfp;
}
}
|
[
"[email protected]"
] | |
d74befc6212391171a941ed471a19633f960b741
|
a47801d1613d06d5a3857932e93fcd9f47143574
|
/src/main/java/br/gov/rj/fazenda/arr/model/ImportaReceitaModel.java
|
0d5d40f0096a99c35d0a412f6afbdc91d2ba652f
|
[] |
no_license
|
escastro27/WebServiceClient
|
78a322cd684c1abbb7295df2bcb7a19d6766185b
|
78304dba34a4bd1804489820b293f904a4560201
|
refs/heads/master
| 2022-12-11T08:01:45.261253 | 2019-06-19T18:52:14 | 2019-06-19T18:52:14 | 191,608,735 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,199 |
java
|
package br.gov.rj.fazenda.arr.model;
public class ImportaReceitaModel {
private String sqSiafeEnvioArrecadacao;
private String sqSistema;
private String sqTipoDocumento;
private String coReceita;
private String sqCampoFinanceiro;
private String inApostilamento;
private String nuUnidadeGestora;
private String dtArrecadacao;
private String dtRepasse;
private String dtApostilamento;
private String coMunicipio;
private String vlTotal;
private String nuCnpjCpfDepositante;
private String noDepositante;
private String inCredito;
private Integer inProcessado;
private Integer inEnviado;
private String coRetorno;
private String TxMesagemRetorno;
private Integer qtdTentativas;
private Integer inRejeitado = 0;
public String getSqSiafeEnvioArrecadacao() {
return sqSiafeEnvioArrecadacao;
}
public void setSqSiafeEnvioArrecadacao(String sqSiafeEnvioArrecadacao) {
this.sqSiafeEnvioArrecadacao = sqSiafeEnvioArrecadacao;
}
public String getSqSistema() {
return sqSistema;
}
public void setSqSistema(String sqSistema) {
this.sqSistema = sqSistema;
}
public String getSqTipoDocumento() {
return sqTipoDocumento;
}
public void setSqTipoDocumento(String sqTipoDocumento) {
this.sqTipoDocumento = sqTipoDocumento;
}
public String getCoReceita() {
return coReceita;
}
public void setCoReceita(String coReceita) {
this.coReceita = coReceita;
}
public String getSqCampoFinanceiro() {
return sqCampoFinanceiro;
}
public void setSqCampoFinanceiro(String sqCampoFinanceiro) {
this.sqCampoFinanceiro = sqCampoFinanceiro;
}
public String getInApostilamento() {
return inApostilamento;
}
public void setInApostilamento(String inApostilamento) {
this.inApostilamento = inApostilamento;
}
public String getNuUnidadeGestora() {
return nuUnidadeGestora;
}
public void setNuUnidadeGestora(String nuUnidadeGestora) {
this.nuUnidadeGestora = nuUnidadeGestora;
}
public String getDtArrecadacao() {
return dtArrecadacao;
}
public void setDtArrecadacao(String dtArrecadacao) {
this.dtArrecadacao = dtArrecadacao;
}
public String getDtRepasse() {
return dtRepasse;
}
public void setDtRepasse(String dtRepasse) {
this.dtRepasse = dtRepasse;
}
public String getDtApostilamento() {
return dtApostilamento;
}
public void setDtApostilamento(String dtApostilamento) {
this.dtApostilamento = dtApostilamento;
}
public String getCoMunicipio() {
return coMunicipio;
}
public void setCoMunicipio(String coMunicipio) {
this.coMunicipio = coMunicipio;
}
public String getVlTotal() {
return vlTotal;
}
public void setVlTotal(String vlTotal) {
this.vlTotal = vlTotal;
}
public String getNuCnpjCpfDepositante() {
return nuCnpjCpfDepositante;
}
public void setNuCnpjCpfDepositante(String nuCnpjCpfDepositante) {
this.nuCnpjCpfDepositante = nuCnpjCpfDepositante;
}
public String getNoDepositante() {
return noDepositante;
}
public void setNoDepositante(String noDepositante) {
this.noDepositante = noDepositante;
}
public String getInCredito() {
return inCredito;
}
public void setInCredito(String inCredito) {
this.inCredito = inCredito;
}
public Integer getInProcessado() {
return inProcessado;
}
public void setInProcessado(Integer inProcessado) {
this.inProcessado = inProcessado;
}
public Integer getInEnviado() {
return inEnviado;
}
public void setInEnviado(Integer inEnviado) {
this.inEnviado = inEnviado;
}
public String getCoRetorno() {
return coRetorno;
}
public void setCoRetorno(String coRetorno) {
this.coRetorno = coRetorno;
}
public String getTxMesagemRetorno() {
return TxMesagemRetorno;
}
public void setTxMesagemRetorno(String txMesagemRetorno) {
TxMesagemRetorno = txMesagemRetorno;
}
public Integer getQtdTentativas() {
return qtdTentativas;
}
public void setQtdTentativas(Integer qtdTentativas) {
this.qtdTentativas = qtdTentativas;
}
public Integer getInRejeitado() {
return inRejeitado;
}
public void setInRejeitado(Integer inRejeitado) {
this.inRejeitado = inRejeitado;
}
}
|
[
"[email protected]"
] | |
f6ea719c239574464553a5dede665939d3e41809
|
fffa89f078110fa624e6894be60ed3112b5cedc4
|
/src/system/PartIterator.java
|
e9b01c29268a750ad6bae849f9909a805514dd50
|
[
"MIT"
] |
permissive
|
PeterCappello/jpregel-aws
|
c182233b74800651f387f3c2aecf89f4d6ad07b8
|
3ddcbaf9e99d5fe6bc1df39b1cd9be893e602eeb
|
refs/heads/master
| 2021-01-19T11:57:06.689237 | 2012-12-01T07:10:27 | 2012-12-01T07:10:27 | 4,812,894 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 423 |
java
|
package system;
import java.util.Iterator;
/**
*
* @author Pete Cappello
*/
public class PartIterator
{
private Iterator<Part> partIterator;
PartIterator( Iterator<Part> partIterator ) { this.partIterator = partIterator;
}
synchronized Part getPart()
{
return partIterator.hasNext() ? partIterator.next() : null;
}
}
|
[
"[email protected]"
] | |
27eab642b474c856c696568db108c12c29059587
|
42ed12696748a102487c2f951832b77740a6b70d
|
/Mage.Sets/src/mage/sets/magic2013/LilianasShade.java
|
44125f7d37b217294fd06f337b64960a0181b695
|
[] |
no_license
|
p3trichor/mage
|
fcb354a8fc791be4713e96e4722617af86bd3865
|
5373076a7e9c2bdabdabc19ffd69a8a567f2188a
|
refs/heads/master
| 2021-01-16T20:21:52.382334 | 2013-05-09T21:13:25 | 2013-05-09T21:13:25 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,688 |
java
|
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.magic2013;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterLandCard;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.target.common.TargetCardInLibrary;
/**
*
* @author North
*/
public class LilianasShade extends CardImpl<LilianasShade> {
private static final FilterLandCard filter = new FilterLandCard("Swamp");
static {
filter.add(new SubtypePredicate("Swamp"));
}
public LilianasShade(UUID ownerId) {
super(ownerId, 98, "Liliana's Shade", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{B}{B}");
this.expansionSetCode = "M13";
this.subtype.add("Shade");
this.color.setBlack(true);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// When Liliana's Shade enters the battlefield, you may search your library for a Swamp card, reveal it, put it into your hand, then shuffle your library.
this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(filter), true, true)));
// {B}: Liliana's Shade gets +1/+1 until end of turn.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 1, Duration.EndOfTurn), new ManaCostsImpl("{B}")));
}
public LilianasShade(final LilianasShade card) {
super(card);
}
@Override
public LilianasShade copy() {
return new LilianasShade(this);
}
}
|
[
"robyter@gmail"
] |
robyter@gmail
|
a557d093281e3722fd66c0cb2a0737e33b2c2143
|
bfcdee934a8ebb0f4e3f6f21e6b84137fd299fdb
|
/studentQuizFinal2_IS_T7/AppletExample/ChartApplet11.java
|
7ba956c6ba862228216defcadad1ef10b574cb1e
|
[] |
no_license
|
xtang224/primary_school
|
05b8711f45e5efa5bd9f2e115771a07c671bfbc0
|
869b841dd853687d1f772315940830bcd9adbd32
|
refs/heads/master
| 2021-05-04T00:58:16.691410 | 2018-02-05T20:21:53 | 2018-02-05T20:21:53 | 120,355,427 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 15,988 |
java
|
/**
@version 1.30 2000-05-12
@author Cay Horstmann
*/
import java.awt.geom.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
public class ChartApplet11 extends JApplet
{
public void init()
{
Container contentPane = getContentPane();
contentPane.add(new ChartLine11());
}
}
class ChartLine11 extends JPanel implements MouseListener, ActionListener
{
private JButton buttonStart;
private JButton buttonEnd;
private boolean canDrawStart = false;
private boolean canDrawEnd = true;
private static boolean firstClick = false;
private static boolean drawCorrect = false;
private static int clickCount = -1;
private static int startX = 0;
private static int startY = 0;
private static int endX = 0;
private static int endY = 0;
private static int startX2 = 0;
private static int startY2 = 0;
private static int endX2 = 0;
private static int endY2 = 0;
private static int startX3 = 0;
private static int startY3 = 0;
private static int endX3 = 0;
private static int endY3 = 0;
private static int startX4 = 0;
private static int startY4 = 0;
private static int startX5 = 0;
private static int startY5 = 0;
private boolean done1 = false;
private boolean done2 = false;
private boolean done3 = false;
private boolean done4 = false;
private boolean done5 = false;
private static int xcenterA = 220;
private static int ycenterA = 460; // Center position of A
private static int xcenterB = 180;
private static int ycenterB = 380; // Center position of B
private static int xcenterC = 280;
private static int ycenterC = 300; // Center position of C
private static int xcenterD = 300;
private static int ycenterD = 220; // Center position of D
private static int xcenterE = 320;
private static int ycenterE = 140; // Center position of D
private static int xcenterO = xcenterA+80;
private static int ycenterO = ycenterA; // Center position of O
private static String comment = "";
private static String comment2 = "";
private static String target = "50";
Connection dbCon = null;
ResultSetMetaData rsmd = null;
PreparedStatement ptmt = null;
ResultSet rs = null;
//Constructor
ChartLine11()
{
//Enables the closing of the window.
//addWindowListener(new MyFinishWindow());
addMouseListener(this);
clickCount = -1;
firstClick = false;
drawCorrect = false;
done1 = false;
done2 = false;
done3 = false;
done4 = false;
done5 = false;
try{
connect();
ptmt = dbCon.prepareStatement("select term2 from hintMatch where term1=?");
ptmt.clearParameters();
ptmt.setString(1, "line");
rs = ptmt.executeQuery();
while (rs.next()){
target = rs.getString(1);
}
}catch (SQLException ex){
ex.printStackTrace();
}catch (ClassNotFoundException ex){
ex.printStackTrace();
}finally{
try{
if (rs != null) rs.close();
if (ptmt != null) ptmt.close();
if (dbCon != null) dbCon.close();
}catch (SQLException e2){
e2.printStackTrace();
}
}
}
public void actionPerformed(ActionEvent e) {
String command = e.getActionCommand();
System.out.println("Button clicked");
}
public void mousePressed(MouseEvent e){}
public void mouseClicked(MouseEvent e){
clickCount ++;
if (done1==false){
startX = e.getX();
startY = e.getY();
}else if (done2==false){
startX2 = e.getX();
startY2 = e.getY();
}else if (done3==false){
startX3 = e.getX();
startY3 = e.getY();
}else if (done4==false){
startX4 = e.getX();
startY4 = e.getY();
}else if (done5==false){
startX5 = e.getX();
startY5 = e.getY();
}
firstClick = true;
repaint();
System.out.println("Mouse clicked and e.getX()=" + e.getX() + " and e.getY()=" + e.getY() + " and target = " + target + " and clickCount = " + clickCount);
}
public void clearWindow(Graphics2D g)
{
g.setPaint(Color.white);
g.fill(new Rectangle(0,0,getWidth(),getHeight()));
g.setPaint(Color.black);
}
public void paint(Graphics g)
{
Graphics2D g2d = (Graphics2D) g;
clearWindow(g2d);
drawGrid(g2d);
//Use of antialiasing to have nicer lines.
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
//The lines should have a thickness of 3.0 instead of 1.0.
BasicStroke bs = new BasicStroke(3.0f);
g2d.setStroke(bs);
drawArc(g2d);
drawRuler(g2d);
drawRuler2(g2d);
g2d.drawString("某城市2010年-2014年植树情况统计图", 150, 50);
}
public void drawArc(Graphics2D g2d){
g2d.setPaint(Color.red);
/*
g2d.fillArc(xcenterA-5, ycenterA-5, 10, 10, 0, 360);
g2d.drawString("A", xcenterA-20, ycenterA+20);
g2d.fillArc(xcenterB-5, ycenterB-5, 10, 10, 0, 360);
g2d.drawString("B", xcenterB-20, ycenterB-20);
*/
if (clickCount>=0){
if (done1){
g2d.fillRect(xcenterA-120, ycenterA-40, 120, 40);
}else{
if (between2Points(startX, startY, xcenterA,ycenterA,xcenterA,ycenterA-40)){
done1 = true;
g2d.fillRect(xcenterA-120, ycenterA-40, 120, 40);
}
}
if (done2){
g2d.fillRect(xcenterB-80, ycenterB-40, 80, 40);
}else{
if (between2Points(startX2, startY2, xcenterB,ycenterB,xcenterB,ycenterB-40)){
done2 = true;
g2d.fillRect(xcenterB-80, ycenterB-40, 80, 40);
}
}
if (done3){
g2d.fillRect(xcenterC-180, ycenterC-40, 180, 40);
}else{
if (between2Points(startX3, startY3, xcenterC,ycenterC,xcenterC,ycenterC-40)){
done3 = true;
g2d.fillRect(xcenterC-180, ycenterC-40, 180, 40);
}
}
if (done4){
g2d.fillRect(xcenterD-200, ycenterD-40, 200, 40);
}else{
if (between2Points(startX4, startY4, xcenterD,ycenterD,xcenterD,ycenterD-40)){
done4 = true;
g2d.fillRect(xcenterD-200, ycenterD-40, 200, 40);
}
}
if (done5){
g2d.fillRect(xcenterE-220, ycenterE-40, 220, 40);
}else{
if (between2Points(startX5, startY5, xcenterE,ycenterE,xcenterE,ycenterE-40)){
done5 = true;
drawCorrect = true;
g2d.fillRect(xcenterE-220, ycenterE-40, 220, 40);
}
}
}
if (clickCount>=0){
if (done1==false){
comment = "你还没有画对,请先画出某城市2010年植树3000棵的柱状图,你画了" + (clickCount+1) + "次";
}else{
if (done2==false){
comment = "你已经画出了2010年植树的柱状图,请继续画2011年植树2000棵的柱状图。你画了" + (clickCount+1) + "次";
}else{
if (done3==false){
comment = "你已经画出了2010年-2011年植树的柱状图,请继续画2012年植树4500棵的柱状图。你画了" + (clickCount+1) + "次";
}else{
if (done4 == false){
comment = "你已经画出了2010年-2012年植树的柱状图,请继续画2013年植树5000棵的柱状图。你画了" + (clickCount+1) + "次";
}else{
if (done5==false){
comment = "你已经画出了2010年-2013年植树的柱状图,请继续画2014年植树5500棵的柱状图。你画了" + (clickCount+1) + "次";
}else{
drawCorrect = true;
comment = "你完全画对了,你画了" + (clickCount+1) + "次;请返回原答题页面点击按钮完成填空,然后提交";
}
}
}
}
}
}else{
comment = "你还没有开始画,请用鼠标点击画线:请按照提示先后画出某城市2010年-2014年植树情况的柱状图。";
comment2 = "即画出2010年3000棵、2011年2000棵、2012年4500棵、2013年5000棵和2014年5500棵的条形统计图。";
}
g2d.drawString(comment, 50, 550);
if (clickCount<0)
g2d.drawString(comment2, 50, 570);
if (drawCorrect){
try{
connect();
ptmt = dbCon.prepareStatement("select term2 from hintMatch where term1=?");
ptmt.clearParameters();
ptmt.setString(1, "chart");
rs = ptmt.executeQuery();
while (rs.next()){
target = rs.getString(1);
}
ptmt = dbCon.prepareStatement("update hintMatch set term2=? where term1=?");
ptmt.clearParameters();
ptmt.setString(1, target);
ptmt.setString(2, "input");
ptmt.executeUpdate();
ptmt = dbCon.prepareStatement("update hintMatch set term2=? where term1=?");
ptmt.clearParameters();
ptmt.setString(1, "done and correct");
ptmt.setString(2, "chartHint");
ptmt.executeUpdate();
}catch (SQLException ex){
ex.printStackTrace();
}catch (ClassNotFoundException ex){
ex.printStackTrace();
}finally{
try{
if (rs != null) rs.close();
if (ptmt != null) ptmt.close();
if (dbCon != null) dbCon.close();
}catch (SQLException e2){
e2.printStackTrace();
}
}
}else if (clickCount>3){
try{
connect();
ptmt = dbCon.prepareStatement("update hintMatch set term2=? where term1=?");
ptmt.clearParameters();
ptmt.setString(1, "0");
ptmt.setString(2, "input");
ptmt.executeUpdate();
ptmt = dbCon.prepareStatement("update hintMatch set term2=? where term1=?");
ptmt.clearParameters();
ptmt.setString(1, "done and not correct");
ptmt.setString(2, "lineHint");
ptmt.executeUpdate();
}catch (SQLException ex){
ex.printStackTrace();
}catch (ClassNotFoundException ex){
ex.printStackTrace();
}finally{
try{
if (rs != null) rs.close();
if (ptmt != null) ptmt.close();
if (dbCon != null) dbCon.close();
}catch (SQLException e2){
e2.printStackTrace();
}
}
}
}
public void drawGrid(Graphics2D g2d){
g2d.setPaint(Color.yellow);
GeneralPath gp = new GeneralPath();
for (int i=100; i<=460; i+=40){
gp.moveTo(i,100);
gp.lineTo(i,500);
}
for (int i=500; i>=100; i-=40){
gp.moveTo(100,i);
gp.lineTo(460,i);
}
g2d.draw(gp);
}
public void drawRuler(Graphics2D g2d){
g2d.setPaint(Color.red);
//g2d.drawArc(xcenterA-10, ycenterA-10, 20, 20, 0, 360);
//g2d.drawString("A", xcenterA-20, ycenterA+20);
GeneralPath gp = new GeneralPath();
String[] strs = new String[]{"","1000","2000","3000","4000","5000","6000","7000","8000"};
int intV = 0;
for (int i=0; i<90; i++){
if (i % 10 == 0){
intV = i/10;
g2d.drawString(strs[intV], 100+i*4, 520);
}
}
gp.moveTo(100,500);
gp.lineTo(500,500);
gp.moveTo(500,500);
gp.lineTo(490,490);
gp.moveTo(500,500);
gp.lineTo(490,510);
g2d.drawString("棵数", 500, 520);
g2d.draw(gp);
}
public void drawRuler2(Graphics2D g2d){
g2d.setPaint(Color.red);
GeneralPath gp = new GeneralPath();
String[] strs = new String[]{"","2010年","","2011年","","2012年","","2013年","","2014年"};
int intV = 0;
for (int i=0; i<100; i++){
if (i % 10 == 0){
intV = i/10;
//str = intV*2 + "";
g2d.drawString(strs[intV], 100-70, 500-i*4);
}
}
gp.moveTo(100,500);
gp.lineTo(100,60);
gp.moveTo(100,60);
gp.lineTo(90,70);
gp.moveTo(100,60);
gp.lineTo(110,70);
//g2d.drawString("20", 80, 100);
g2d.drawString("年份", 80, 50);
g2d.draw(gp);
}
public boolean perpendicular(int startX, int startY, int endX, int endY, int targetStartX, int targetStartY, int targetEndX, int targetEndY){
if (targetStartX==targetEndX && targetStartY!=targetEndY){
if (Math.abs(startY-endY)<=10 && startX!=endX)
return true;
else
return false;
}else if (targetStartY==targetEndY && targetStartX!=targetEndX){
if (Math.abs(startX-endX)<=10 && startY!=endY)
return true;
else
return false;
}else{
double tangent1 = ((double)(targetEndX - targetStartX)) / (-(targetEndY - targetStartY));
double tangent2 = ((double)(endX - startX)) / (-(endY - startY));
if (Math.abs(tangent1 * tangent2 + 1)<=0.5)
return true;
else
return false;
}
}
public boolean aroundPoint(int startX, int startY, int targetX, int targetY){
if (Math.abs(startX-targetX)<=10 && Math.abs(startY-targetY)<=10)
return true;
return false;
}
public boolean between2Points(int startX, int startY, int targetX, int targetY, int targetX2, int targetY2){
if (targetY==targetY2){
if (Math.abs(startY-targetY)<=10 && startX>=targetX && startX<=targetX2)
return true;
return false;
}else if (targetX==targetX2){
if (Math.abs(startX-targetX)<=10 && startY<=targetY && startY>=targetY2)
return true;
return false;
}else
return inLine(startX,startY,targetX,targetY,targetX2,targetY2);
}
public boolean inLine(int startX, int endX, int startY, int endY, int pX, int pY){
/*
int r1 = (endY-startY) * (pX-startX);
int r2 = (endX-startX) * (pY-startY);
System.out.println("r1=" + r1 + ", r2=" + r2);
if (Math.abs(r1-r2)<=10)
return true;
*/
double d1=0, d2=0;
if ((endX-startX)!=0 && (pX-startX)!=0){
d1=((double)(endY-startY))/(endX-startX);
d2=((double)(pY-startY))/(pX-startX);
System.out.println("d1=" + d1 + ", d2=" + d2);
if (Math.abs(d1-d2)<=15)
return true;
}else if ((endX-startX)==0 && (pX-startX)==0)
return true;
return false;
}
public void mouseEntered(MouseEvent e){}
public void mouseExited(MouseEvent e){}
public void mouseReleased(MouseEvent e){}
private boolean connect() throws ClassNotFoundException, SQLException
{
Class.forName("org.hsqldb.jdbcDriver");
dbCon = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost/xdb", "SA", "");
return true;
}
}
|
[
"[email protected]"
] | |
3466e754530be81c47590f605047f84216ea4c6b
|
b6ef284bcbf0375593b0f93e81402b965a79b81e
|
/test/web/mx/edu/um/buildtools/EscapeHtmlEntitiesTest.java
|
e0ae90bf028c12071a94b081f2eef61057488c40
|
[
"Apache-2.0"
] |
permissive
|
guepardo190889/siscofe
|
88663c34b18384f74e3e7b80838a1e4f748643ee
|
affafeeae834b765e955a85abc34cadacb0035ff
|
refs/heads/master
| 2021-01-19T14:56:41.908072 | 2010-04-28T23:27:43 | 2010-04-28T23:27:43 | null | 0 | 0 | null | null | null | null |
ISO-8859-1
|
Java
| false | false | 1,426 |
java
|
package mx.edu.um.buildtools;
import java.io.StringReader;
import junit.framework.TestCase;
import org.apache.tools.ant.util.FileUtils;
/**
* Testcase to verify EscapeHtmlEntities filter.
* @author <a href="mailto:[email protected]">Mika Göckel</a>
*/
public class EscapeHtmlEntitiesTest extends TestCase {
/**
* Test Unicode->Entity escaping.
* @throws Exception
*/
public void testEscape() throws Exception {
StringReader str = new StringReader("\u00E4\u00FC\u00F6\u00DF-\u00D6\u00F3");
EscapeHtmlEntities boot = new EscapeHtmlEntities();
EscapeHtmlEntities filter = (EscapeHtmlEntities) boot.chain(str);
filter.setMode(EscapeHtmlEntities.ESCAPE);
String result = FileUtils.readFully(filter, 200);
assertEquals("äüöß-Öó",result);
}
/**
* Test Entity->Unicode unescaping.
* @throws Exception
*/
public void testUnescape() throws Exception {
StringReader str = new StringReader("äüöß-Öó&noentity;");
EscapeHtmlEntities boot = new EscapeHtmlEntities();
EscapeHtmlEntities filter = (EscapeHtmlEntities) boot.chain(str);
filter.setMode(EscapeHtmlEntities.UNESCAPE);
String result = FileUtils.readFully(filter, 200);
assertEquals("\u00E4\u00FC\u00F6\u00DF-\u00D6\u00F3&noentity;",result);
}
}
|
[
"blackdeath@.(none)"
] |
blackdeath@.(none)
|
19e61a14c3ba3cef4ac62bf059c80a36f07b60e0
|
bf3c03e13da800c5bcc0813c5cf7e7e96c97699a
|
/src/main/java/com/wxy/model/request/StoreAdminDTO.java
|
f7b6423685ab3344d7f43734cebe67e240b6568a
|
[] |
no_license
|
ClearLiF/storeroom-mgr
|
c52dbfb8dc6c6b73ddd70f5f24f39c946b6601a4
|
31010f70c7c8f984550290a5360bf45d85bedeff
|
refs/heads/master
| 2023-04-02T03:50:29.724617 | 2021-04-05T10:54:42 | 2021-04-05T10:54:42 | 353,721,595 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 380 |
java
|
package com.wxy.model.request;
import lombok.Data;
/**
* @author : wxy
* @version : V1.0
* @className : StoreAdminDTO
* @packageName : com.wxy.model.request
* @description : 一般类
* @date : 2021-03-24 15:44
**/
@Data
public class StoreAdminDTO {
/**
*仓库id
*/
private Long storeId;
/**
* 管理员id
*/
private Long adminId;
}
|
[
"[email protected]"
] | |
eba444041c12e6d676ce1bc9f857c70c61840865
|
5d6d2e6ab733a9dd8913f44232ce53e01e5c99e7
|
/rt-gateway-impl-ctp/src/main/java/xyz/redtorch/gateway/ctp/x64v6v3v16t1v/api/CThostFtdcSyncingInstrumentCommissionRateField.java
|
f2e9d15694a8c385772f14b50b85effc24157b4a
|
[
"MIT"
] |
permissive
|
fj8542758/redtorch
|
53953366e5303538397c3c64ee4de03adbed1475
|
216446e883598f247044070e9c478bf2b7e01a83
|
refs/heads/master
| 2021-05-18T09:51:21.279710 | 2020-06-06T10:23:32 | 2020-06-06T10:23:32 | 251,198,412 | 0 | 0 |
MIT
| 2020-03-30T04:09:16 | 2020-03-30T04:09:16 | null |
UTF-8
|
Java
| false | false | 4,706 |
java
|
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 4.0.0
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package xyz.redtorch.gateway.ctp.x64v6v3v16t1v.api;
public class CThostFtdcSyncingInstrumentCommissionRateField {
private transient long swigCPtr;
protected transient boolean swigCMemOwn;
protected CThostFtdcSyncingInstrumentCommissionRateField(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = cPtr;
}
protected static long getCPtr(CThostFtdcSyncingInstrumentCommissionRateField obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@SuppressWarnings("deprecation")
protected void finalize() {
delete();
}
public synchronized void delete() {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
jctpv6v3v16t1x64apiJNI.delete_CThostFtdcSyncingInstrumentCommissionRateField(swigCPtr);
}
swigCPtr = 0;
}
}
public void setInstrumentID(String value) {
jctpv6v3v16t1x64apiJNI.CThostFtdcSyncingInstrumentCommissionRateField_InstrumentID_set(swigCPtr, this, value);
}
public String getInstrumentID() {
return jctpv6v3v16t1x64apiJNI.CThostFtdcSyncingInstrumentCommissionRateField_InstrumentID_get(swigCPtr, this);
}
public void setInvestorRange(char value) {
jctpv6v3v16t1x64apiJNI.CThostFtdcSyncingInstrumentCommissionRateField_InvestorRange_set(swigCPtr, this, value);
}
public char getInvestorRange() {
return jctpv6v3v16t1x64apiJNI.CThostFtdcSyncingInstrumentCommissionRateField_InvestorRange_get(swigCPtr, this);
}
public void setBrokerID(String value) {
jctpv6v3v16t1x64apiJNI.CThostFtdcSyncingInstrumentCommissionRateField_BrokerID_set(swigCPtr, this, value);
}
public String getBrokerID() {
return jctpv6v3v16t1x64apiJNI.CThostFtdcSyncingInstrumentCommissionRateField_BrokerID_get(swigCPtr, this);
}
public void setInvestorID(String value) {
jctpv6v3v16t1x64apiJNI.CThostFtdcSyncingInstrumentCommissionRateField_InvestorID_set(swigCPtr, this, value);
}
public String getInvestorID() {
return jctpv6v3v16t1x64apiJNI.CThostFtdcSyncingInstrumentCommissionRateField_InvestorID_get(swigCPtr, this);
}
public void setOpenRatioByMoney(double value) {
jctpv6v3v16t1x64apiJNI.CThostFtdcSyncingInstrumentCommissionRateField_OpenRatioByMoney_set(swigCPtr, this, value);
}
public double getOpenRatioByMoney() {
return jctpv6v3v16t1x64apiJNI.CThostFtdcSyncingInstrumentCommissionRateField_OpenRatioByMoney_get(swigCPtr, this);
}
public void setOpenRatioByVolume(double value) {
jctpv6v3v16t1x64apiJNI.CThostFtdcSyncingInstrumentCommissionRateField_OpenRatioByVolume_set(swigCPtr, this, value);
}
public double getOpenRatioByVolume() {
return jctpv6v3v16t1x64apiJNI.CThostFtdcSyncingInstrumentCommissionRateField_OpenRatioByVolume_get(swigCPtr, this);
}
public void setCloseRatioByMoney(double value) {
jctpv6v3v16t1x64apiJNI.CThostFtdcSyncingInstrumentCommissionRateField_CloseRatioByMoney_set(swigCPtr, this, value);
}
public double getCloseRatioByMoney() {
return jctpv6v3v16t1x64apiJNI.CThostFtdcSyncingInstrumentCommissionRateField_CloseRatioByMoney_get(swigCPtr, this);
}
public void setCloseRatioByVolume(double value) {
jctpv6v3v16t1x64apiJNI.CThostFtdcSyncingInstrumentCommissionRateField_CloseRatioByVolume_set(swigCPtr, this, value);
}
public double getCloseRatioByVolume() {
return jctpv6v3v16t1x64apiJNI.CThostFtdcSyncingInstrumentCommissionRateField_CloseRatioByVolume_get(swigCPtr, this);
}
public void setCloseTodayRatioByMoney(double value) {
jctpv6v3v16t1x64apiJNI.CThostFtdcSyncingInstrumentCommissionRateField_CloseTodayRatioByMoney_set(swigCPtr, this, value);
}
public double getCloseTodayRatioByMoney() {
return jctpv6v3v16t1x64apiJNI.CThostFtdcSyncingInstrumentCommissionRateField_CloseTodayRatioByMoney_get(swigCPtr, this);
}
public void setCloseTodayRatioByVolume(double value) {
jctpv6v3v16t1x64apiJNI.CThostFtdcSyncingInstrumentCommissionRateField_CloseTodayRatioByVolume_set(swigCPtr, this, value);
}
public double getCloseTodayRatioByVolume() {
return jctpv6v3v16t1x64apiJNI.CThostFtdcSyncingInstrumentCommissionRateField_CloseTodayRatioByVolume_get(swigCPtr, this);
}
public CThostFtdcSyncingInstrumentCommissionRateField() {
this(jctpv6v3v16t1x64apiJNI.new_CThostFtdcSyncingInstrumentCommissionRateField(), true);
}
}
|
[
"[email protected]"
] | |
25f26251af4bb09959272c9ec1573495df3cf132
|
ba649c15023909c68d34385a2f086801c2cc4a5d
|
/src/systemPackage/AdminUI.java
|
e48fe16fe19c5853608ed4002c723a486858258f
|
[] |
no_license
|
n256Coding/video-lending-system
|
47c616d8f666a6a8031f32988212386edcc01791
|
dbfff3988c8994490c36f2dfaa83daf49114c005
|
refs/heads/master
| 2020-03-28T20:29:51.809199 | 2018-09-17T06:34:16 | 2018-09-17T06:34:16 | 149,076,084 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 24,599 |
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 systemPackage;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
/**
*
* @author NishanV
*/
public class AdminUI extends javax.swing.JFrame {
/**
* Creates new form AdminUI
*/
public AdminUI() {
initComponents();
this.setLocationRelativeTo(null);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
jTable_customer = new javax.swing.JTable();
jScrollPane2 = new javax.swing.JScrollPane();
jTable_cashier = new javax.swing.JTable();
jSeparator1 = new javax.swing.JSeparator();
jButton_AddCustomer = new javax.swing.JButton();
jButton_AddCashier = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jButton_RemoveCustomer = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jButton_AddVideo = new javax.swing.JButton();
jButton_RemoveCashier = new javax.swing.JButton();
jButton_ireport = new javax.swing.JButton();
jButton_removeVideo = new javax.swing.JButton();
jScrollPane3 = new javax.swing.JScrollPane();
jTable_videos = new javax.swing.JTable();
jButton_logout = new javax.swing.JButton();
jLabel4 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setResizable(false);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowActivated(java.awt.event.WindowEvent evt) {
formWindowActivated(evt);
}
});
jTable_customer.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Member ID", "First Name", "Last Name", "Address", "Phone", "Password"
}
) {
boolean[] canEdit = new boolean [] {
false, false, false, false, true, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jScrollPane1.setViewportView(jTable_customer);
jTable_cashier.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Member ID", "First Name", "Last Name", "Password"
}
) {
boolean[] canEdit = new boolean [] {
false, false, false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jScrollPane2.setViewportView(jTable_cashier);
jButton_AddCustomer.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icons/1457975586_User.png"))); // NOI18N
jButton_AddCustomer.setText("Add Customer");
jButton_AddCustomer.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_AddCustomerActionPerformed(evt);
}
});
jButton_AddCashier.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icons/1457975586_User.png"))); // NOI18N
jButton_AddCashier.setText("Add Cashier");
jButton_AddCashier.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_AddCashierActionPerformed(evt);
}
});
jLabel1.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
jLabel1.setText("Admin Panel");
jButton_RemoveCustomer.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icons/user-remove-icon.png"))); // NOI18N
jButton_RemoveCustomer.setText("Remove Customer");
jButton_RemoveCustomer.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_RemoveCustomerActionPerformed(evt);
}
});
jLabel2.setText("Registered Customers:");
jLabel3.setText("Registered Cashiers:");
jButton_AddVideo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icons/movie-track-add-icon.png"))); // NOI18N
jButton_AddVideo.setText("Add Video");
jButton_AddVideo.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_AddVideoActionPerformed(evt);
}
});
jButton_RemoveCashier.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icons/user-remove-icon.png"))); // NOI18N
jButton_RemoveCashier.setText("Remove Cashier");
jButton_RemoveCashier.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_RemoveCashierActionPerformed(evt);
}
});
jButton_ireport.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icons/clipboard_report_form_checklist_business_plan_sheet_file_note_pad_paper_page_document_planning_check_list_survey_questionnaire_flat_design_icon-512.png"))); // NOI18N
jButton_ireport.setText("i-Reports");
jButton_ireport.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_ireportActionPerformed(evt);
}
});
jButton_removeVideo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icons/movie_track_remove.png"))); // NOI18N
jButton_removeVideo.setText("Remove Video");
jButton_removeVideo.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_removeVideoActionPerformed(evt);
}
});
jTable_videos.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"video ID", "Title", "Quantity", "Price per 7 Days"
}
) {
boolean[] canEdit = new boolean [] {
false, false, false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jTable_videos.getTableHeader().setReorderingAllowed(false);
jScrollPane3.setViewportView(jTable_videos);
if (jTable_videos.getColumnModel().getColumnCount() > 0) {
jTable_videos.getColumnModel().getColumn(3).setResizable(false);
}
jButton_logout.setText("Logout");
jButton_logout.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_logoutActionPerformed(evt);
}
});
jLabel4.setText("Videos in Store:");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addGap(281, 281, 281)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(20, 20, 20)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton_AddCashier, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton_AddCustomer, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton_AddVideo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton_ireport, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jButton_RemoveCashier, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton_RemoveCustomer, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton_removeVideo, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(18, 18, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGap(73, 73, 73)
.addComponent(jButton_logout)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 569, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 569, Short.MAX_VALUE)
.addComponent(jLabel2)
.addComponent(jLabel3)
.addComponent(jScrollPane3)))
.addGap(21, 21, 21))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(16, 16, 16)
.addComponent(jLabel1)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton_logout)
.addGap(62, 62, 62))
.addGroup(layout.createSequentialGroup()
.addGap(18, 18, 18)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton_AddCustomer, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton_RemoveCustomer, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton_AddCashier, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton_RemoveCashier, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(24, 24, 24)
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton_AddVideo, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton_removeVideo, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton_ireport, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 22, Short.MAX_VALUE)
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(21, 21, 21))))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton_AddCashierActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_AddCashierActionPerformed
RegisterNewCashier rgCashier = new RegisterNewCashier();
rgCashier.setVisible(true);
}//GEN-LAST:event_jButton_AddCashierActionPerformed
private void jButton_AddCustomerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_AddCustomerActionPerformed
RegisterNewCustomer regCust = new RegisterNewCustomer();
regCust.setVisible(true);
}//GEN-LAST:event_jButton_AddCustomerActionPerformed
private void jButton_RemoveCustomerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_RemoveCustomerActionPerformed
int row=jTable_customer.getSelectedRow();
String memberId=(jTable_customer.getModel().getValueAt(row,0).toString());
DBConnect connect = new DBConnect();
if(memberId.equals(""))
{
JOptionPane.showMessageDialog(null, "No selected data");
}else{
try{
String query = "delete from members where memberId = '"+memberId+"'";
connect.st.executeUpdate(query);
JOptionPane.showMessageDialog(null, "User Removed!!");
}catch(Exception e){
}
}
}//GEN-LAST:event_jButton_RemoveCustomerActionPerformed
private void formWindowActivated(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowActivated
DBConnect connectCust = new DBConnect();
DBConnect connectCashier = new DBConnect();
DBConnect connectVideos = new DBConnect();
DefaultTableModel custTable = (DefaultTableModel) jTable_customer.getModel();
DefaultTableModel cashierTable = (DefaultTableModel) jTable_cashier.getModel();
DefaultTableModel videoTable = (DefaultTableModel) jTable_videos.getModel();
int custTableRowCount = custTable.getRowCount();
int cashierTableRowCount = cashierTable.getRowCount();
int videoTableRowCount = videoTable.getRowCount();
for(int i = custTableRowCount - 1; i >=0; i--)
custTable.removeRow(i);
for(int i = cashierTableRowCount - 1; i >=0; i--)
cashierTable.removeRow(i);
for(int i = videoTableRowCount - 1; i >=0; i--)
videoTable.removeRow(i);
String queryCust = "Select * from members where type = 2";
String queryCashier = "Select * from members where type = 1";
String queryVideos = "select * from videos";
try{
connectCust.rs = connectCust.st.executeQuery(queryCust);
connectCashier.rs = connectCashier.st.executeQuery(queryCashier);
connectVideos.rs = connectVideos.st.executeQuery(queryVideos);
}catch(Exception e){
//JOptionPane.showMessageDialog(null, e);
}
try{
while(connectCust.rs.next())
custTable.addRow(new Object[]{connectCust.rs.getString("memberId"), connectCust.rs.getString("fname"), connectCust.rs.getString("lname"), connectCust.rs.getString("address"), connectCust.rs.getString("phone"), connectCust.rs.getString("pwd")});
while(connectCashier.rs.next())
cashierTable.addRow(new Object[]{connectCashier.rs.getString("memberId"), connectCashier.rs.getString("fname"), connectCashier.rs.getString("lname"), connectCashier.rs.getString("pwd")});
while(connectVideos.rs.next())
videoTable.addRow(new Object[]{connectVideos.rs.getString("videoId"), connectVideos.rs.getString("title"), connectVideos.rs.getString("qty"), connectVideos.rs.getString("pricePer7d")});
}catch(Exception e){
//JOptionPane.showMessageDialog(null, e);
}
}//GEN-LAST:event_formWindowActivated
private void jButton_AddVideoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_AddVideoActionPerformed
AddVideoDetails addVid = new AddVideoDetails(this, rootPaneCheckingEnabled);
addVid.setVisible(true);
}//GEN-LAST:event_jButton_AddVideoActionPerformed
private void jButton_RemoveCashierActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_RemoveCashierActionPerformed
int row=jTable_cashier.getSelectedRow();
String memberId=(jTable_cashier.getModel().getValueAt(row,0).toString());
DBConnect connect = new DBConnect();
if(memberId.equals(""))
{
JOptionPane.showMessageDialog(null, "No selected data");
}else{
try{
String query = "delete from members where memberId = '"+memberId+"'";
connect.st.executeUpdate(query);
JOptionPane.showMessageDialog(null, "User Removed!!");
}catch(Exception e){
}
}
}//GEN-LAST:event_jButton_RemoveCashierActionPerformed
private void jButton_ireportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_ireportActionPerformed
report ireport = new report();
ireport.setVisible(true);
}//GEN-LAST:event_jButton_ireportActionPerformed
private void jButton_logoutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_logoutActionPerformed
this.dispose();
MainLogin login = new MainLogin();
login.setVisible(true);
}//GEN-LAST:event_jButton_logoutActionPerformed
private void jButton_removeVideoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_removeVideoActionPerformed
int row=jTable_videos.getSelectedRow();
String videoId=(jTable_videos.getModel().getValueAt(row,0).toString());
DBConnect connect = new DBConnect();
if(videoId.equals(""))
{
JOptionPane.showMessageDialog(null, "No selected data");
}else{
try{
String query = "delete from videos where videoId = '"+videoId+"'";
connect.st.executeUpdate(query);
JOptionPane.showMessageDialog(null, "Video Removed!!");
}catch(Exception e){
}
}
}//GEN-LAST:event_jButton_removeVideoActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Windows".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(AdminUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(AdminUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(AdminUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(AdminUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new AdminUI().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton_AddCashier;
private javax.swing.JButton jButton_AddCustomer;
private javax.swing.JButton jButton_AddVideo;
private javax.swing.JButton jButton_RemoveCashier;
private javax.swing.JButton jButton_RemoveCustomer;
private javax.swing.JButton jButton_ireport;
private javax.swing.JButton jButton_logout;
private javax.swing.JButton jButton_removeVideo;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JTable jTable_cashier;
private javax.swing.JTable jTable_customer;
private javax.swing.JTable jTable_videos;
// End of variables declaration//GEN-END:variables
}
|
[
"[email protected]"
] | |
9284a78456c881f59b8752784fd360d2e97375ed
|
11504becc106dfd389bca0a56b811fca85c8eeda
|
/android/app/build/generated/not_namespaced_r_class_sources/release/processReleaseResources/r/androidx/core/R.java
|
8ecb7e74a4174c36db21262b1208b5cae0405d68
|
[] |
no_license
|
sanchitwakekar/LinkedIn
|
717fe60517f6166b37f6b5e49cb11dddd45108ce
|
444a6b8a99f98802a2e5a621983439072087f5d1
|
refs/heads/master
| 2023-01-29T20:09:55.428586 | 2019-09-05T08:11:16 | 2019-09-05T08:11:16 | 204,413,123 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 10,444 |
java
|
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package androidx.core;
public final class R {
private R() {}
public static final class attr {
private attr() {}
public static final int alpha = 0x7f02002a;
public static final int font = 0x7f02007a;
public static final int fontProviderAuthority = 0x7f02007c;
public static final int fontProviderCerts = 0x7f02007d;
public static final int fontProviderFetchStrategy = 0x7f02007e;
public static final int fontProviderFetchTimeout = 0x7f02007f;
public static final int fontProviderPackage = 0x7f020080;
public static final int fontProviderQuery = 0x7f020081;
public static final int fontStyle = 0x7f020082;
public static final int fontVariationSettings = 0x7f020083;
public static final int fontWeight = 0x7f020084;
public static final int ttcIndex = 0x7f020121;
}
public static final class color {
private color() {}
public static final int notification_action_color_filter = 0x7f04003d;
public static final int notification_icon_bg_color = 0x7f04003e;
public static final int ripple_material_light = 0x7f040048;
public static final int secondary_text_default_material_light = 0x7f04004a;
}
public static final class dimen {
private dimen() {}
public static final int compat_button_inset_horizontal_material = 0x7f05004b;
public static final int compat_button_inset_vertical_material = 0x7f05004c;
public static final int compat_button_padding_horizontal_material = 0x7f05004d;
public static final int compat_button_padding_vertical_material = 0x7f05004e;
public static final int compat_control_corner_material = 0x7f05004f;
public static final int compat_notification_large_icon_max_height = 0x7f050050;
public static final int compat_notification_large_icon_max_width = 0x7f050051;
public static final int notification_action_icon_size = 0x7f05005b;
public static final int notification_action_text_size = 0x7f05005c;
public static final int notification_big_circle_margin = 0x7f05005d;
public static final int notification_content_margin_start = 0x7f05005e;
public static final int notification_large_icon_height = 0x7f05005f;
public static final int notification_large_icon_width = 0x7f050060;
public static final int notification_main_column_padding_top = 0x7f050061;
public static final int notification_media_narrow_margin = 0x7f050062;
public static final int notification_right_icon_size = 0x7f050063;
public static final int notification_right_side_padding_top = 0x7f050064;
public static final int notification_small_icon_background_padding = 0x7f050065;
public static final int notification_small_icon_size_as_large = 0x7f050066;
public static final int notification_subtext_size = 0x7f050067;
public static final int notification_top_pad = 0x7f050068;
public static final int notification_top_pad_large_text = 0x7f050069;
}
public static final class drawable {
private drawable() {}
public static final int notification_action_background = 0x7f060059;
public static final int notification_bg = 0x7f06005a;
public static final int notification_bg_low = 0x7f06005b;
public static final int notification_bg_low_normal = 0x7f06005c;
public static final int notification_bg_low_pressed = 0x7f06005d;
public static final int notification_bg_normal = 0x7f06005e;
public static final int notification_bg_normal_pressed = 0x7f06005f;
public static final int notification_icon_background = 0x7f060060;
public static final int notification_template_icon_bg = 0x7f060061;
public static final int notification_template_icon_low_bg = 0x7f060062;
public static final int notification_tile_bg = 0x7f060063;
public static final int notify_panel_notification_icon_bg = 0x7f060064;
}
public static final class id {
private id() {}
public static final int action_container = 0x7f070012;
public static final int action_divider = 0x7f070014;
public static final int action_image = 0x7f070015;
public static final int action_text = 0x7f07001b;
public static final int actions = 0x7f07001c;
public static final int async = 0x7f070022;
public static final int blocking = 0x7f070024;
public static final int chronometer = 0x7f07002e;
public static final int forever = 0x7f070046;
public static final int icon = 0x7f07004c;
public static final int icon_group = 0x7f07004d;
public static final int info = 0x7f070050;
public static final int italic = 0x7f070051;
public static final int line1 = 0x7f070053;
public static final int line3 = 0x7f070054;
public static final int normal = 0x7f07005c;
public static final int notification_background = 0x7f07005d;
public static final int notification_main_column = 0x7f07005e;
public static final int notification_main_column_container = 0x7f07005f;
public static final int right_icon = 0x7f070067;
public static final int right_side = 0x7f070068;
public static final int tag_transition_group = 0x7f070091;
public static final int tag_unhandled_key_event_manager = 0x7f070092;
public static final int tag_unhandled_key_listeners = 0x7f070093;
public static final int text = 0x7f070094;
public static final int text2 = 0x7f070095;
public static final int time = 0x7f070098;
public static final int title = 0x7f070099;
}
public static final class integer {
private integer() {}
public static final int status_bar_notification_info_maxnum = 0x7f080006;
}
public static final class layout {
private layout() {}
public static final int notification_action = 0x7f09001f;
public static final int notification_action_tombstone = 0x7f090020;
public static final int notification_template_custom_big = 0x7f090021;
public static final int notification_template_icon_group = 0x7f090022;
public static final int notification_template_part_chronometer = 0x7f090023;
public static final int notification_template_part_time = 0x7f090024;
}
public static final class string {
private string() {}
public static final int status_bar_notification_info_overflow = 0x7f0c0055;
}
public static final class style {
private style() {}
public static final int TextAppearance_Compat_Notification = 0x7f0d00fa;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0d00fb;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0d00fc;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0d00fd;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0d00fe;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0d016e;
public static final int Widget_Compat_NotificationActionText = 0x7f0d016f;
}
public static final class styleable {
private styleable() {}
public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f02002a };
public static final int ColorStateListItem_android_color = 0;
public static final int ColorStateListItem_android_alpha = 1;
public static final int ColorStateListItem_alpha = 2;
public static final int[] FontFamily = { 0x7f02007c, 0x7f02007d, 0x7f02007e, 0x7f02007f, 0x7f020080, 0x7f020081 };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderCerts = 1;
public static final int FontFamily_fontProviderFetchStrategy = 2;
public static final int FontFamily_fontProviderFetchTimeout = 3;
public static final int FontFamily_fontProviderPackage = 4;
public static final int FontFamily_fontProviderQuery = 5;
public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f02007a, 0x7f020082, 0x7f020083, 0x7f020084, 0x7f020121 };
public static final int FontFamilyFont_android_font = 0;
public static final int FontFamilyFont_android_fontWeight = 1;
public static final int FontFamilyFont_android_fontStyle = 2;
public static final int FontFamilyFont_android_ttcIndex = 3;
public static final int FontFamilyFont_android_fontVariationSettings = 4;
public static final int FontFamilyFont_font = 5;
public static final int FontFamilyFont_fontStyle = 6;
public static final int FontFamilyFont_fontVariationSettings = 7;
public static final int FontFamilyFont_fontWeight = 8;
public static final int FontFamilyFont_ttcIndex = 9;
public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 };
public static final int GradientColor_android_startColor = 0;
public static final int GradientColor_android_endColor = 1;
public static final int GradientColor_android_type = 2;
public static final int GradientColor_android_centerX = 3;
public static final int GradientColor_android_centerY = 4;
public static final int GradientColor_android_gradientRadius = 5;
public static final int GradientColor_android_tileMode = 6;
public static final int GradientColor_android_centerColor = 7;
public static final int GradientColor_android_startX = 8;
public static final int GradientColor_android_startY = 9;
public static final int GradientColor_android_endX = 10;
public static final int GradientColor_android_endY = 11;
public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 };
public static final int GradientColorItem_android_color = 0;
public static final int GradientColorItem_android_offset = 1;
}
}
|
[
"[email protected]"
] | |
85210f1f4569ab2c556310e999caa02f09d1d894
|
5b74e796e63b38424ca665fdf143564d81d482a9
|
/core/transport/src/main/java/alluxio/grpc/FileSystemMasterJobServiceGrpc.java
|
ca0cabe9fb74701583372c18bc9139cec0205d50
|
[
"LicenseRef-scancode-free-unknown",
"BSD-3-Clause",
"MIT",
"CC-PDDC",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"EPL-1.0",
"LicenseRef-scancode-proprietary-license",
"CC0-1.0",
"Unlicense",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-2-Clause"
] |
permissive
|
geweixuan/alluxio
|
93ab06d274880d4bd55a7de2da436b1eb4ffe7b4
|
152ef18afa6e5aa3a740c0554159a68fbc08db33
|
refs/heads/master
| 2020-05-17T17:09:16.863001 | 2019-09-03T06:42:39 | 2019-09-03T06:42:39 | 183,841,488 | 3 | 0 |
Apache-2.0
| 2019-04-28T01:59:42 | 2019-04-28T01:59:42 | null |
UTF-8
|
Java
| false | false | 16,158 |
java
|
package alluxio.grpc;
import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
/**
* <pre>
**
* This interface contains file system master service endpoints for Alluxio workers.
* </pre>
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler (version 1.17.1)",
comments = "Source: grpc/file_system_master.proto")
public final class FileSystemMasterJobServiceGrpc {
private FileSystemMasterJobServiceGrpc() {}
public static final String SERVICE_NAME = "alluxio.grpc.file.FileSystemMasterJobService";
// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<alluxio.grpc.GetFileInfoPRequest,
alluxio.grpc.GetFileInfoPResponse> getGetFileInfoMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "GetFileInfo",
requestType = alluxio.grpc.GetFileInfoPRequest.class,
responseType = alluxio.grpc.GetFileInfoPResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<alluxio.grpc.GetFileInfoPRequest,
alluxio.grpc.GetFileInfoPResponse> getGetFileInfoMethod() {
io.grpc.MethodDescriptor<alluxio.grpc.GetFileInfoPRequest, alluxio.grpc.GetFileInfoPResponse> getGetFileInfoMethod;
if ((getGetFileInfoMethod = FileSystemMasterJobServiceGrpc.getGetFileInfoMethod) == null) {
synchronized (FileSystemMasterJobServiceGrpc.class) {
if ((getGetFileInfoMethod = FileSystemMasterJobServiceGrpc.getGetFileInfoMethod) == null) {
FileSystemMasterJobServiceGrpc.getGetFileInfoMethod = getGetFileInfoMethod =
io.grpc.MethodDescriptor.<alluxio.grpc.GetFileInfoPRequest, alluxio.grpc.GetFileInfoPResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(
"alluxio.grpc.file.FileSystemMasterJobService", "GetFileInfo"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
alluxio.grpc.GetFileInfoPRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
alluxio.grpc.GetFileInfoPResponse.getDefaultInstance()))
.setSchemaDescriptor(new FileSystemMasterJobServiceMethodDescriptorSupplier("GetFileInfo"))
.build();
}
}
}
return getGetFileInfoMethod;
}
private static volatile io.grpc.MethodDescriptor<alluxio.grpc.GetUfsInfoPRequest,
alluxio.grpc.GetUfsInfoPResponse> getGetUfsInfoMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "GetUfsInfo",
requestType = alluxio.grpc.GetUfsInfoPRequest.class,
responseType = alluxio.grpc.GetUfsInfoPResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<alluxio.grpc.GetUfsInfoPRequest,
alluxio.grpc.GetUfsInfoPResponse> getGetUfsInfoMethod() {
io.grpc.MethodDescriptor<alluxio.grpc.GetUfsInfoPRequest, alluxio.grpc.GetUfsInfoPResponse> getGetUfsInfoMethod;
if ((getGetUfsInfoMethod = FileSystemMasterJobServiceGrpc.getGetUfsInfoMethod) == null) {
synchronized (FileSystemMasterJobServiceGrpc.class) {
if ((getGetUfsInfoMethod = FileSystemMasterJobServiceGrpc.getGetUfsInfoMethod) == null) {
FileSystemMasterJobServiceGrpc.getGetUfsInfoMethod = getGetUfsInfoMethod =
io.grpc.MethodDescriptor.<alluxio.grpc.GetUfsInfoPRequest, alluxio.grpc.GetUfsInfoPResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(
"alluxio.grpc.file.FileSystemMasterJobService", "GetUfsInfo"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
alluxio.grpc.GetUfsInfoPRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
alluxio.grpc.GetUfsInfoPResponse.getDefaultInstance()))
.setSchemaDescriptor(new FileSystemMasterJobServiceMethodDescriptorSupplier("GetUfsInfo"))
.build();
}
}
}
return getGetUfsInfoMethod;
}
/**
* Creates a new async stub that supports all call types for the service
*/
public static FileSystemMasterJobServiceStub newStub(io.grpc.Channel channel) {
return new FileSystemMasterJobServiceStub(channel);
}
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
public static FileSystemMasterJobServiceBlockingStub newBlockingStub(
io.grpc.Channel channel) {
return new FileSystemMasterJobServiceBlockingStub(channel);
}
/**
* Creates a new ListenableFuture-style stub that supports unary calls on the service
*/
public static FileSystemMasterJobServiceFutureStub newFutureStub(
io.grpc.Channel channel) {
return new FileSystemMasterJobServiceFutureStub(channel);
}
/**
* <pre>
**
* This interface contains file system master service endpoints for Alluxio workers.
* </pre>
*/
public static abstract class FileSystemMasterJobServiceImplBase implements io.grpc.BindableService {
/**
* <pre>
* Returns the file information for a file or directory identified by the given file id.
* </pre>
*/
public void getFileInfo(alluxio.grpc.GetFileInfoPRequest request,
io.grpc.stub.StreamObserver<alluxio.grpc.GetFileInfoPResponse> responseObserver) {
asyncUnimplementedUnaryCall(getGetFileInfoMethod(), responseObserver);
}
/**
* <pre>
**
* Returns the UFS information for the given mount point identified by its id.
* </pre>
*/
public void getUfsInfo(alluxio.grpc.GetUfsInfoPRequest request,
io.grpc.stub.StreamObserver<alluxio.grpc.GetUfsInfoPResponse> responseObserver) {
asyncUnimplementedUnaryCall(getGetUfsInfoMethod(), responseObserver);
}
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getGetFileInfoMethod(),
asyncUnaryCall(
new MethodHandlers<
alluxio.grpc.GetFileInfoPRequest,
alluxio.grpc.GetFileInfoPResponse>(
this, METHODID_GET_FILE_INFO)))
.addMethod(
getGetUfsInfoMethod(),
asyncUnaryCall(
new MethodHandlers<
alluxio.grpc.GetUfsInfoPRequest,
alluxio.grpc.GetUfsInfoPResponse>(
this, METHODID_GET_UFS_INFO)))
.build();
}
}
/**
* <pre>
**
* This interface contains file system master service endpoints for Alluxio workers.
* </pre>
*/
public static final class FileSystemMasterJobServiceStub extends io.grpc.stub.AbstractStub<FileSystemMasterJobServiceStub> {
private FileSystemMasterJobServiceStub(io.grpc.Channel channel) {
super(channel);
}
private FileSystemMasterJobServiceStub(io.grpc.Channel channel,
io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected FileSystemMasterJobServiceStub build(io.grpc.Channel channel,
io.grpc.CallOptions callOptions) {
return new FileSystemMasterJobServiceStub(channel, callOptions);
}
/**
* <pre>
* Returns the file information for a file or directory identified by the given file id.
* </pre>
*/
public void getFileInfo(alluxio.grpc.GetFileInfoPRequest request,
io.grpc.stub.StreamObserver<alluxio.grpc.GetFileInfoPResponse> responseObserver) {
asyncUnaryCall(
getChannel().newCall(getGetFileInfoMethod(), getCallOptions()), request, responseObserver);
}
/**
* <pre>
**
* Returns the UFS information for the given mount point identified by its id.
* </pre>
*/
public void getUfsInfo(alluxio.grpc.GetUfsInfoPRequest request,
io.grpc.stub.StreamObserver<alluxio.grpc.GetUfsInfoPResponse> responseObserver) {
asyncUnaryCall(
getChannel().newCall(getGetUfsInfoMethod(), getCallOptions()), request, responseObserver);
}
}
/**
* <pre>
**
* This interface contains file system master service endpoints for Alluxio workers.
* </pre>
*/
public static final class FileSystemMasterJobServiceBlockingStub extends io.grpc.stub.AbstractStub<FileSystemMasterJobServiceBlockingStub> {
private FileSystemMasterJobServiceBlockingStub(io.grpc.Channel channel) {
super(channel);
}
private FileSystemMasterJobServiceBlockingStub(io.grpc.Channel channel,
io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected FileSystemMasterJobServiceBlockingStub build(io.grpc.Channel channel,
io.grpc.CallOptions callOptions) {
return new FileSystemMasterJobServiceBlockingStub(channel, callOptions);
}
/**
* <pre>
* Returns the file information for a file or directory identified by the given file id.
* </pre>
*/
public alluxio.grpc.GetFileInfoPResponse getFileInfo(alluxio.grpc.GetFileInfoPRequest request) {
return blockingUnaryCall(
getChannel(), getGetFileInfoMethod(), getCallOptions(), request);
}
/**
* <pre>
**
* Returns the UFS information for the given mount point identified by its id.
* </pre>
*/
public alluxio.grpc.GetUfsInfoPResponse getUfsInfo(alluxio.grpc.GetUfsInfoPRequest request) {
return blockingUnaryCall(
getChannel(), getGetUfsInfoMethod(), getCallOptions(), request);
}
}
/**
* <pre>
**
* This interface contains file system master service endpoints for Alluxio workers.
* </pre>
*/
public static final class FileSystemMasterJobServiceFutureStub extends io.grpc.stub.AbstractStub<FileSystemMasterJobServiceFutureStub> {
private FileSystemMasterJobServiceFutureStub(io.grpc.Channel channel) {
super(channel);
}
private FileSystemMasterJobServiceFutureStub(io.grpc.Channel channel,
io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected FileSystemMasterJobServiceFutureStub build(io.grpc.Channel channel,
io.grpc.CallOptions callOptions) {
return new FileSystemMasterJobServiceFutureStub(channel, callOptions);
}
/**
* <pre>
* Returns the file information for a file or directory identified by the given file id.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<alluxio.grpc.GetFileInfoPResponse> getFileInfo(
alluxio.grpc.GetFileInfoPRequest request) {
return futureUnaryCall(
getChannel().newCall(getGetFileInfoMethod(), getCallOptions()), request);
}
/**
* <pre>
**
* Returns the UFS information for the given mount point identified by its id.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<alluxio.grpc.GetUfsInfoPResponse> getUfsInfo(
alluxio.grpc.GetUfsInfoPRequest request) {
return futureUnaryCall(
getChannel().newCall(getGetUfsInfoMethod(), getCallOptions()), request);
}
}
private static final int METHODID_GET_FILE_INFO = 0;
private static final int METHODID_GET_UFS_INFO = 1;
private static final class MethodHandlers<Req, Resp> implements
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final FileSystemMasterJobServiceImplBase serviceImpl;
private final int methodId;
MethodHandlers(FileSystemMasterJobServiceImplBase serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
case METHODID_GET_FILE_INFO:
serviceImpl.getFileInfo((alluxio.grpc.GetFileInfoPRequest) request,
(io.grpc.stub.StreamObserver<alluxio.grpc.GetFileInfoPResponse>) responseObserver);
break;
case METHODID_GET_UFS_INFO:
serviceImpl.getUfsInfo((alluxio.grpc.GetUfsInfoPRequest) request,
(io.grpc.stub.StreamObserver<alluxio.grpc.GetUfsInfoPResponse>) responseObserver);
break;
default:
throw new AssertionError();
}
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public io.grpc.stub.StreamObserver<Req> invoke(
io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
default:
throw new AssertionError();
}
}
}
private static abstract class FileSystemMasterJobServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
FileSystemMasterJobServiceBaseDescriptorSupplier() {}
@java.lang.Override
public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
return alluxio.grpc.FileSystemMasterProto.getDescriptor();
}
@java.lang.Override
public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
return getFileDescriptor().findServiceByName("FileSystemMasterJobService");
}
}
private static final class FileSystemMasterJobServiceFileDescriptorSupplier
extends FileSystemMasterJobServiceBaseDescriptorSupplier {
FileSystemMasterJobServiceFileDescriptorSupplier() {}
}
private static final class FileSystemMasterJobServiceMethodDescriptorSupplier
extends FileSystemMasterJobServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final String methodName;
FileSystemMasterJobServiceMethodDescriptorSupplier(String methodName) {
this.methodName = methodName;
}
@java.lang.Override
public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
return getServiceDescriptor().findMethodByName(methodName);
}
}
private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
public static io.grpc.ServiceDescriptor getServiceDescriptor() {
io.grpc.ServiceDescriptor result = serviceDescriptor;
if (result == null) {
synchronized (FileSystemMasterJobServiceGrpc.class) {
result = serviceDescriptor;
if (result == null) {
serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
.setSchemaDescriptor(new FileSystemMasterJobServiceFileDescriptorSupplier())
.addMethod(getGetFileInfoMethod())
.addMethod(getGetUfsInfoMethod())
.build();
}
}
}
return result;
}
}
|
[
"[email protected]"
] | |
44d65079b4daa9ba71cff67ecd125be3e29e6d68
|
1e1f1fc18d088038242eef7861f969fafc1ff0aa
|
/pt.iscte.pidesco.codegenerator/src/pt/iscte/pidesco/codegenerator/extensibility/RangeScope.java
|
faf266d7dc01ce1fb2d7102c43f60409885f821b
|
[] |
no_license
|
gpaea-iscteiulpt/pidesco
|
afcaaf4582c80539a61fe90b997b5acb6361ad6e
|
029d01481fa73a66358e0c275a8544ec684f8d76
|
refs/heads/master
| 2020-04-11T08:08:30.823631 | 2018-12-13T16:18:45 | 2018-12-13T16:18:45 | 161,042,547 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 144 |
java
|
package pt.iscte.pidesco.codegenerator.extensibility;
public enum RangeScope {
INSIDECLASS, OUTOFCLASS, INSIDEMETHOD, OUTSIDEMETHOD, ALL
}
|
[
"[email protected]"
] | |
35f3aade7ecefcebc896cf40f145e099c3866b6a
|
d4d3540abfa41b692a64261aad5290dafddb08d2
|
/src/main/java/com/example/myproject/processor/MoviesItemCRUD.java
|
dce5ccb392092080d405e4cf832b6cce0ae08393
|
[] |
no_license
|
denglitong/java-dynamodb-client-maven
|
cebfba948aba8d7c72732ebd3b69d18d46b26b8f
|
3c2d4021ad1e4243203351270823be3efa5c9faa
|
refs/heads/main
| 2023-08-30T17:14:51.742056 | 2021-11-18T05:17:59 | 2021-11-18T05:17:59 | 429,278,210 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,613 |
java
|
package com.example.myproject.processor;
import com.amazonaws.services.dynamodbv2.document.*;
import com.amazonaws.services.dynamodbv2.document.spec.DeleteItemSpec;
import com.amazonaws.services.dynamodbv2.document.spec.GetItemSpec;
import com.amazonaws.services.dynamodbv2.document.spec.UpdateItemSpec;
import com.amazonaws.services.dynamodbv2.model.ReturnValue;
import com.example.myproject.builder.DynamoDBBuilder;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import static com.example.myproject.config.DynamoDBConfig.*;
import static org.junit.Assert.*;
public class MoviesItemCRUD {
private static final Table table = DynamoDBBuilder.getInstance().getTable(MOVIES);
private static final int year = 2015;
private static final String title = "The Big New Movie";
public static void main(String[] args) {
createItem();
readItem();
updateItem();
deleteItem();
}
private static void createItem() {
System.out.println("Adding item...");
final Map<String, Object> infoMap = new HashMap<>();
infoMap.put("plot", "Nothing happens at all.");
infoMap.put("rating", 0);
Item item = new Item()
.withPrimaryKey(YEAR, year, TITLE, title)
.withMap(INFO, infoMap);
PutItemOutcome outcome = table.putItem(item);
System.out.println("PutItem succeed: " + outcome.getPutItemResult());
}
private static void readItem() {
System.out.println("Getting a item...");
GetItemSpec spec = new GetItemSpec().withPrimaryKey(YEAR, year, TITLE, title);
Item outcome = table.getItem(spec);
assertNotNull(outcome);
assertEquals(year, outcome.getInt(YEAR));
assertEquals(title, outcome.getString(TITLE));
System.out.println("GetItem succeed: " + outcome);
}
private static void updateItem() {
System.out.println("Updating item...");
final Map<String, Object> infoMap = new HashMap<>();
infoMap.put("plot", "Everything happens all at once.");
infoMap.put("rating", 5.5);
infoMap.put("actors", Arrays.asList("Larry", "Moe", "Curly"));
AttributeUpdate infoUpdate = new AttributeUpdate(INFO).put(infoMap);
UpdateItemSpec updateSpec = new UpdateItemSpec()
.withPrimaryKey(YEAR, year, TITLE, title)
.withAttributeUpdate(infoUpdate)
.withReturnValues(ReturnValue.UPDATED_NEW);
UpdateItemOutcome updateOutcome = table.updateItem(updateSpec);
// assert validate
Item readOutcome = table.getItem(new GetItemSpec().withPrimaryKey(YEAR, year, TITLE, title));
assertEquals(infoMap.get("plot"), readOutcome.getMap("info").get("plot"));
assertEquals(infoMap.get("rating").toString(), readOutcome.getMap("info").get("rating").toString());
assertEquals(infoMap.get("actors"), readOutcome.getMap("info").get("actors"));
System.out.println("UpdateItem succeeded: " + updateOutcome.getUpdateItemResult());
}
private static void deleteItem() {
System.out.println("Delete item...");
DeleteItemSpec deleteSpec = new DeleteItemSpec().withPrimaryKey(YEAR, year, TITLE, title);
DeleteItemOutcome deleteOutcome = table.deleteItem(deleteSpec);
// assert validate
Item readOutcome = table.getItem(new GetItemSpec().withPrimaryKey(YEAR, year, TITLE, title));
assertNull(readOutcome);
System.out.println("DeleteItem succeeded: " + deleteOutcome.getDeleteItemResult());
}
}
|
[
"[email protected]"
] | |
0e4c543bf67a70b4168e8e0823abdfba8322fd2b
|
a227bfc77ce1dcdddd2af5f5c45275bc58eb37c8
|
/springboot-spi-enhance/springboot-spi-mysql/src/main/java/com/github/lybgeek/dialect/mysql/SpringMysqlDialect.java
|
ac134762ebb18d034bea07fd8070da8693f76dd8
|
[] |
no_license
|
amylis/springboot-learning
|
6f4991e083257c002d159f101d5a34fc90fd94e5
|
ff909d76bdace95760e81025ce3337109ffd536a
|
refs/heads/master
| 2023-08-22T11:42:53.945750 | 2021-10-15T12:29:17 | 2021-10-15T12:29:17 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 584 |
java
|
package com.github.lybgeek.dialect.mysql;
import com.github.lybgeek.dialect.SpringSqlDialect;
import com.github.lybgeek.dialect.SqlDialect;
import com.github.lybgeek.dialect.mysql.service.MysqlDialectService;
import com.github.lybgeek.spi.anotatation.Activate;
import org.springframework.beans.factory.annotation.Autowired;
@Activate("hello-mysql")
public class SpringMysqlDialect implements SpringSqlDialect {
@Autowired
private MysqlDialectService mysqlDialectService;
@Override
public String dialect() {
return mysqlDialectService.dialect();
}
}
|
[
"[email protected]"
] | |
0dfeea708e5bade15755f5588bdb69bb7a82133c
|
ca8a56003e3db94e5637ea3a60d1ebd96d1ec858
|
/src/test/java/com/deriv/expression/LogTest.java
|
70b52796558e73ad9f53022f24aa61de5a3f1d79
|
[] |
no_license
|
horeilly1101/deriv
|
57c598b374a3cca83aac53c846dbff4d4869b38e
|
69c4e8395a404b5670754a705dd39239cc31098d
|
refs/heads/master
| 2023-05-10T17:47:38.682461 | 2019-07-14T06:21:01 | 2019-07-14T06:21:01 | 150,195,842 | 11 | 3 | null | 2023-04-28T17:40:38 | 2018-09-25T02:22:39 |
Java
|
UTF-8
|
Java
| false | false | 2,201 |
java
|
package com.deriv.expression;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import static com.deriv.expression.Add.add;
import static com.deriv.expression.Log.*;
import static com.deriv.expression.Mult.*;
import static com.deriv.expression.Constant.*;
import static com.deriv.expression.Variable.*;
import static com.deriv.expression.Power.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
class LogTest {
@Test
void logTest() {
// check that the stack doesn't overflow
log(x(), poly(x(), 2));
}
@Test
void simplifyTest() {
// log(x, x ^ 2)
Expression lg = log(x(), poly(x(), 2));
assertEquals(constant(2), lg);
// log(ln(x), ln(x) ^ e())
Expression lg2 = log(ln(x()), power(ln(x()), e()));
assertEquals(e(), lg2);
}
@Test
void evaluateTest() {
// log(2, x)
Expression lg = log(constant(2), x());
// evaluate at 2
Optional<Expression> eval = lg.evaluate(x(), constant(2));
assertTrue(eval.isPresent());
assertEquals(multID(), eval.get());
// evaluate at 5
Optional<Expression> eval2 = lg.evaluate(x(), constant(5));
assertTrue(eval2.isPresent());
assertEquals(log(constant(2), constant(5)), eval2.get());
// evaluate at -1
Optional<Expression> eval3 = lg.evaluate(x(), negate(multID()));
assertFalse(eval3.isPresent());
}
@Test
void differentiateTest() {
// ln(x)
Expression ln = ln(x());
assertEquals(div(multID(), x()), ln.differentiate(x()).get());
// log(e, x)
Expression ln2 = log(e(), x());
assertEquals(ln.differentiate(x()).get(), ln2.differentiate(x()).get());
// log(2, x)
Expression lg = log(constant(2), x());
assertEquals(div(multID(), mult(ln(constant(2)), x())), lg.differentiate(x()).get());
}
@Test
void toLatexTest() {
// log(2, x)
Expression lg = log(constant(2), x());
assertEquals("\\log_{2} x", lg.toLaTex());
// ln(x)
Expression nat = ln(x());
assertEquals("\\ln(x)", nat.toLaTex());
}
}
|
[
"[email protected]"
] | |
39c98c7017e0fc39e74fdc43ca29e636f1f1ace0
|
337eb85af016b34e71803e9c5a7dbffce27b79aa
|
/src/main/java/gd/internship/par_class/BadClassField.java
|
76bcc3084ba154d79c6b454aff8865b1aa1c087a
|
[
"MIT"
] |
permissive
|
vitaly-magyari/good-bad-ugly
|
ba29b400ad3cfe0de1b5d036043d81c9f25f2072
|
97cbfc1440c65cc4239468425bf3e4e1fdf87d25
|
refs/heads/master
| 2020-09-25T01:41:53.734389 | 2019-12-04T14:56:57 | 2019-12-04T14:56:57 | 225,890,737 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 183 |
java
|
package gd.internship.par_class;
public class BadClassField {
private int implicitParam = 2;
public int calculateSomeBusinessValue() {
return implicitParam + 2;
}
}
|
[
"[email protected]"
] | |
7a895a77cea00a235e186cd5437f30ea22233952
|
0792cc9a3bbcf32e6dae1d3bb794b9c658b3dc46
|
/TextInputOutput/TextFields.java
|
1cea13a6e75709a3c5aceb1230cf51b93facd23f
|
[] |
no_license
|
snak3codes/java-gui
|
11e6a0fb10577ff05c9094445f8ecce08a3f20b6
|
b501a74a983413516150ecfeb4168eeeb282cdae
|
refs/heads/master
| 2022-11-24T10:32:57.734231 | 2020-07-25T20:21:19 | 2020-07-25T20:21:19 | 282,337,146 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,118 |
java
|
package text_fields;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class TextFields {
public static void main(String[] args) {
NameFrame frame = new NameFrame();
frame.addWindowListener((new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
}));
}
}
class NameFrame extends JFrame implements ActionListener {
private JTextField givenName;
private JTextField familyName;
private JTextField fullName;
public NameFrame() {
super("Text Fields");
// Organize content pane
JPanel pane = (JPanel) getContentPane();
pane.setLayout(new BorderLayout());
// Create fields for I/O
givenName = new JTextField(10);
familyName = new JTextField(10);
fullName = new JTextField(10);
fullName.setEditable(false);
// Add labelled input fields to display
JPanel inFieldPane = new JPanel();
inFieldPane.setLayout(new GridLayout(2, 2));
inFieldPane.add(new JLabel("Given Name"));
inFieldPane.add(givenName);
givenName.addActionListener(this);
inFieldPane.add(new JLabel("Family Name"));
inFieldPane.add(familyName);
familyName.addActionListener(this);
pane.add(inFieldPane, BorderLayout.NORTH);
// Add submission button
JPanel submitPane = new JPanel();
submitPane.setLayout(new FlowLayout());
submitPane.add(new JLabel("Press Button to Enter Name"));
JButton submitButton = new JButton("Submit");
submitButton.addActionListener(this);
submitPane.add(submitButton);
pane.add(submitPane, BorderLayout.CENTER);
// Add Output fields
JPanel outFieldPane = new JPanel();
outFieldPane.setLayout(new GridLayout(1, 2));
outFieldPane.add(new JLabel("Full Name"));
outFieldPane.add(fullName);
pane.add(outFieldPane, BorderLayout.SOUTH);
// Display the final product
pack();
setVisible(true);
}
public void actionPerformed(ActionEvent e) {
// Display full name if and only if button was pushed
if (e.getActionCommand().equals("Submit")) {
String fullString = familyName.getText().trim() + ", " + givenName.getText().trim();
fullName.setText(fullString);
}
}
}
|
[
"[email protected]"
] | |
c6404494165c290987933649d8f10fa4dd8851a3
|
4aedec7284255b4e67fb4e4fb46aace938e885a8
|
/OnlineShop/app/src/main/java/com/example/onlineshop/SensorActivity.java
|
ab4f1f6031b4991c18f7617f0bdec6f6a7d41da5
|
[] |
no_license
|
Bloogdan/fii-android
|
255c2a2a45212058c375f1ba87c1be740cb5f811
|
bd01cf492451ab3454d05103f93e60568c80057e
|
refs/heads/master
| 2021-04-01T06:29:53.669258 | 2020-04-01T08:04:00 | 2020-04-01T08:04:00 | 248,163,582 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,441 |
java
|
package com.example.onlineshop;
import androidx.appcompat.app.AppCompatActivity;
import com.example.onlineshop.R;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
public class SensorActivity extends AppCompatActivity implements SensorEventListener {
private SensorManager mSensorManager;
private Sensor mAccelerometer;
private Sensor mTermometer;
private Sensor mGyroscope;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mSensorManager = (SensorManager)getSystemService(SENSOR_SERVICE);
mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
mGyroscope = mSensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE);
mTermometer = mSensorManager.getDefaultSensor(Sensor.TYPE_AMBIENT_TEMPERATURE);
setContentView(R.layout.activity_sensor);
}
@Override
protected void onResume() {
super.onResume();
mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL);
mSensorManager.registerListener(this, mTermometer, SensorManager.SENSOR_DELAY_NORMAL);
mSensorManager.registerListener(this, mGyroscope, SensorManager.SENSOR_DELAY_NORMAL);
}
@Override
protected void onPause() {
super.onPause();
mSensorManager.unregisterListener(this);
}
public void onAccuracyChanged(Sensor sensor, int accuracy) {
}
public void onSensorChanged(SensorEvent event) {
if(event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
TextView tv = (TextView)findViewById(R.id.accelerometerView);
tv.setText("Accelerometer: " + event.values[0] + " " + event.values[1] + " " + event.values[2]);
}
else if (event.sensor.getType() == Sensor.TYPE_AMBIENT_TEMPERATURE) {
TextView tv = (TextView)findViewById(R.id.temperatureView);
tv.setText("Temperature: " + String.valueOf(event.values[0]));
} else if(event.sensor.getType() == Sensor.TYPE_GYROSCOPE) {
TextView tv = (TextView)findViewById(R.id.gyroscopeView);
tv.setText("Gyroscope: " + event.values[0] + " " + event.values[1] + " " + event.values[2]);
}
}
}
|
[
"[email protected]"
] | |
126a47c84d651cb22a0a692d4dfb583c8c774d7a
|
25115d5df911c8e78e0a6f542e00b6544d3afc60
|
/src/Model/Bhuser.java
|
079d10fd6a1812a65c79e374e2a94b638df85749
|
[] |
no_license
|
aakshay29/BullHorn
|
ba7c1391fa3971e34cae95888f901d82b05d71d7
|
3bdec7d1014f3f666553b6695654ed3c46e440bd
|
refs/heads/master
| 2020-05-29T08:50:35.725055 | 2016-09-29T20:52:33 | 2016-09-29T20:52:33 | 69,289,704 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,938 |
java
|
package Model;
import java.io.Serializable;
import javax.persistence.*;
import java.util.Date;
import java.util.List;
/**
* The persistent class for the BHUSER database table.
*
*/
@Entity
@NamedQuery(name="Bhuser.findAll", query="SELECT b FROM Bhuser b")
public class Bhuser implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private long bhuserid;
@Temporal(TemporalType.DATE)
private Date joindate;
private String motto;
private String useremail;
private String username;
private String userpassword;
//bi-directional many-to-one association to Bhpost
@OneToMany(mappedBy="bhuser")
private List<Bhpost> bhposts;
public Bhuser() {
}
public long getBhuserid() {
return this.bhuserid;
}
public void setBhuserid(long bhuserid) {
this.bhuserid = bhuserid;
}
public Date getJoindate() {
return this.joindate;
}
public void setJoindate(Date joindate) {
this.joindate = joindate;
}
public String getMotto() {
return this.motto;
}
public void setMotto(String motto) {
this.motto = motto;
}
public String getUseremail() {
return this.useremail;
}
public void setUseremail(String useremail) {
this.useremail = useremail;
}
public String getUsername() {
return this.username;
}
public void setUsername(String username) {
this.username = username;
}
public String getUserpassword() {
return this.userpassword;
}
public void setUserpassword(String userpassword) {
this.userpassword = userpassword;
}
public List<Bhpost> getBhposts() {
return this.bhposts;
}
public void setBhposts(List<Bhpost> bhposts) {
this.bhposts = bhposts;
}
public Bhpost addBhpost(Bhpost bhpost) {
getBhposts().add(bhpost);
bhpost.setBhuser(this);
return bhpost;
}
public Bhpost removeBhpost(Bhpost bhpost) {
getBhposts().remove(bhpost);
bhpost.setBhuser(null);
return bhpost;
}
}
|
[
"[email protected]"
] | |
a19a9ad2dcf9a42a332468f2efa71d36a5058ff0
|
54896bca36c1215bd8348188edad4a279342f206
|
/src/main/java/com/twlghtzn/p2p/repositories/UserRepository.java
|
943845a2ae3fba786d1159142dc5779a73b596c8
|
[] |
no_license
|
green-fox-academy/twlghtzn-p2p
|
108f0a7373aec42d8cbcc77e3f000e4786d2c29c
|
f665d115f7ccaeec512fc1eef88a6887367f5d3c
|
refs/heads/master
| 2022-12-19T05:09:14.468949 | 2020-10-05T15:04:14 | 2020-10-05T15:04:14 | 301,446,134 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 253 |
java
|
package com.twlghtzn.p2p.repositories;
import com.twlghtzn.p2p.models.User;
import org.springframework.data.repository.CrudRepository;
public interface UserRepository extends CrudRepository<User, Long> {
User findUserByUniqueId(String uniqueId);
}
|
[
"[email protected]"
] | |
65f03351977f223e18a0683e208dcd6766f1d927
|
2c47102088f263e50253ee8b54ed182f858f19a1
|
/CardLayoutManagerDemo/src/main/java/com/example/cardlayoutmanagerdemo/CardLayoutManager.java
|
2e3bad0a11e7c5c6612392e641aaf4be585bfdde
|
[] |
no_license
|
wqd0214/AndroidDemos
|
453f7a37c2ae6a5a05b0dbfea4b2465dd429dcac
|
afacadbd7b847c176a82c636af9542e38ca161da
|
refs/heads/master
| 2021-09-07T15:48:16.801046 | 2018-02-25T12:25:28 | 2018-02-25T12:25:28 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 6,062 |
java
|
package com.example.cardlayoutmanagerdemo;
import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
/**
* Created by qibin on 16-9-25.
*/
public class CardLayoutManager extends RecyclerView.LayoutManager {
public static final int DEFAULT_GROUP_SIZE = 5;
private int mGroupSize;
private int mHorizontalOffset;
private int mVerticalOffset;
private int mTotalWidth;
private int mTotalHeight;
private int mGravityOffset;
private boolean isGravityCenter;
private Pool<Rect> mItemFrames;
public CardLayoutManager(boolean center) {
this(DEFAULT_GROUP_SIZE, center);
}
public CardLayoutManager(int groupSize, boolean center) {
mGroupSize = groupSize;
isGravityCenter = center;
mItemFrames = new Pool<>(new Pool.New<Rect>() {
@Override
public Rect get() { return new Rect();}
});
}
@Override
public RecyclerView.LayoutParams generateDefaultLayoutParams() {
return new RecyclerView.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
}
@Override
public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
if (getItemCount() <= 0 || state.isPreLayout()) { return;}
detachAndScrapAttachedViews(recycler);
View first = recycler.getViewForPosition(0);
measureChildWithMargins(first, 0, 0);
int itemWidth = getDecoratedMeasuredWidth(first);
int itemHeight = getDecoratedMeasuredHeight(first);
int firstLineSize = mGroupSize / 2 + 1;
int secondLineSize = firstLineSize + mGroupSize / 2;
if (isGravityCenter && firstLineSize * itemWidth < getHorizontalSpace()) {
mGravityOffset = (getHorizontalSpace() - firstLineSize * itemWidth) / 2;
} else {
mGravityOffset = 0;
}
for (int i = 0; i < getItemCount(); i++) {
Rect item = mItemFrames.get(i);
float coefficient = isFirstGroup(i) ? 1.5f : 1.f;
int offsetHeight = (int) ((i / mGroupSize) * itemHeight * coefficient);
// 每一组的第一行
if (isItemInFirstLine(i)) {
int offsetInLine = i < firstLineSize ? i : i % mGroupSize;
item.set(mGravityOffset + offsetInLine * itemWidth, offsetHeight, mGravityOffset + offsetInLine * itemWidth + itemWidth,
itemHeight + offsetHeight);
}else {
int lineOffset = itemHeight / 2;
int offsetInLine = (i < secondLineSize ? i : i % mGroupSize) - firstLineSize;
item.set(mGravityOffset + offsetInLine * itemWidth + itemWidth / 2,
offsetHeight + lineOffset, mGravityOffset + offsetInLine * itemWidth + itemWidth + itemWidth / 2,
itemHeight + offsetHeight + lineOffset);
}
}
mTotalWidth = Math.max(firstLineSize * itemWidth, getHorizontalSpace());
int totalHeight = getGroupSize() * itemHeight;
if (!isItemInFirstLine(getItemCount() - 1)) { totalHeight += itemHeight / 2;}
mTotalHeight = Math.max(totalHeight, getVerticalSpace());
fill(recycler, state);
}
private void fill(RecyclerView.Recycler recycler, RecyclerView.State state) {
if (getItemCount() <= 0 || state.isPreLayout()) { return;}
Rect displayRect = new Rect(mHorizontalOffset, mVerticalOffset,
getHorizontalSpace() + mHorizontalOffset,
getVerticalSpace() + mVerticalOffset);
for (int i = 0; i < getItemCount(); i++) {
Rect frame = mItemFrames.get(i);
if (Rect.intersects(displayRect, frame)) {
View scrap = recycler.getViewForPosition(i);
addView(scrap);
measureChildWithMargins(scrap, 0, 0);
layoutDecorated(scrap, frame.left - mHorizontalOffset, frame.top - mVerticalOffset,
frame.right - mHorizontalOffset, frame.bottom - mVerticalOffset);
}
}
}
@Override
public int scrollVerticallyBy(int dy, RecyclerView.Recycler recycler, RecyclerView.State state) {
detachAndScrapAttachedViews(recycler);
if (mVerticalOffset + dy < 0) {
dy = -mVerticalOffset;
} else if (mVerticalOffset + dy > mTotalHeight - getVerticalSpace()) {
dy = mTotalHeight - getVerticalSpace() - mVerticalOffset;
}
offsetChildrenVertical(-dy);
fill(recycler, state);
mVerticalOffset += dy;
return dy;
}
@Override
public int scrollHorizontallyBy(int dx, RecyclerView.Recycler recycler, RecyclerView.State state) {
detachAndScrapAttachedViews(recycler);
if (mHorizontalOffset + dx < 0) {
dx = -mHorizontalOffset;
} else if (mHorizontalOffset + dx > mTotalWidth - getHorizontalSpace()) {
dx = mTotalWidth - getHorizontalSpace() - mHorizontalOffset;
}
offsetChildrenHorizontal(-dx);
fill(recycler, state);
mHorizontalOffset += dx;
return dx;
}
@Override
public boolean canScrollVertically() {
return true;
}
@Override
public boolean canScrollHorizontally() {
return true;
}
private boolean isItemInFirstLine(int index) {
int firstLineSize = mGroupSize / 2 + 1;
return index < firstLineSize || (index >= mGroupSize && index % mGroupSize < firstLineSize);
}
private int getGroupSize() {
return (int) Math.ceil(getItemCount() / (float)mGroupSize);
}
private boolean isFirstGroup(int index) {
return index < mGroupSize;
}
private int getHorizontalSpace() {
return getWidth() - getPaddingLeft() - getPaddingRight();
}
private int getVerticalSpace() {
return getHeight() - getPaddingTop() - getPaddingBottom();
}
}
|
[
"[email protected]"
] | |
6d05ae7a77bb37cf276f01ccf5eb4ae74f8bc64c
|
ff5b00aac406b6c6d7f0475989905a16edc30b7e
|
/src/org/usfirst/frc/team1708/robot/commands/MoveForward.java
|
9c19d3d880227ae02c4e34a415b1da0e6985eb8b
|
[] |
no_license
|
AmpdRobotics/1708-2015-Code
|
90014865fdb1cd955dd162e38340a928903f1dc1
|
0c206c860ca73705f1b51d8df57b96dd47c6a497
|
refs/heads/master
| 2021-01-19T05:57:59.133921 | 2016-08-08T23:53:39 | 2016-08-08T23:53:39 | 65,247,883 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,156 |
java
|
package org.usfirst.frc.team1708.robot.commands;
import org.usfirst.frc.team1708.robot.Robot;
import org.usfirst.frc.team1708.robot.subsystems.AutonomousDrive;
import edu.wpi.first.wpilibj.command.Command;
/**
*
*/
public class MoveForward extends Command {
public MoveForward() {
// Use requires() here to declare subsystem dependencies
// eg. requires(chassis);
requires(Robot.autos);
setTimeout(3.5);
}
//Called just before this Command runs the first time
protected void initialize() {
}
// Called repeatedly when this Command is scheduled to run
protected void execute() {
AutonomousDrive.moveForward();
}
// Make this return true when this Command no longer needs to run execute()
protected boolean isFinished() {
return isTimedOut();
}
// Called once after isFinished returns true
protected void end() {
AutonomousDrive.stopDrive();
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
protected void interrupted() {
AutonomousDrive.stopDrive();
}
}
|
[
"[email protected]"
] | |
423b875efa669d15616d979b315126a030e6d220
|
cb913271091d98a8c0b5b56c663248b88ac14acc
|
/src/main/java/elec332/eflux2/api/electricity/component/AbstractResistorElement.java
|
17e71bfc0a4c5e82d1122909968f3cec57bdedc5
|
[] |
no_license
|
Elecs-Mods/E-Flux-2
|
0485718a53a2370d157aa2b10075697fcd7d9f25
|
2d85a0581ed7a1a1b4e68bbc01675432451897e9
|
refs/heads/master
| 2023-07-09T02:38:07.400790 | 2023-06-27T22:49:25 | 2023-06-27T22:49:25 | 171,550,416 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,235 |
java
|
package elec332.eflux2.api.electricity.component;
import elec332.eflux2.api.electricity.IEnergyObject;
import elec332.eflux2.api.electricity.IEnergyReceiver;
import javax.annotation.Nullable;
/**
* Created by Elec332 on 12-11-2017.
*/
public abstract class AbstractResistorElement<T extends IEnergyObject> extends CircuitElement<T> {
public AbstractResistorElement(T receiver) {
super(receiver);
}
public boolean combineData;
public abstract double getResistance();
public boolean isPolarityAgnostic() {
return true;
}
@Nullable
protected abstract IEnergyReceiver getReceiver();
@Override
protected void calculateCurrent() {
current = getVoltageDiff() / getResistance();
}
@Override
public void stamp() {
getCircuit().stampResistor(nodes[0], nodes[1], getResistance());
}
@Override
public abstract void apply();
@Override
public double getVoltageDiff() {
double ret = super.getVoltageDiff();
if (isPolarityAgnostic()) {
return Math.abs(ret);
}
return ret;
}
@Override
public String toString() {
return "ResistorElement: R=" + getResistance();
}
}
|
[
"[email protected]"
] | |
40f08fdb59ae0872438c397998f34afcdba60aa7
|
77b2e52ebe2c8dd52bbca7e03331cb5c58d48b5d
|
/src/main/java/com/mascova/solus/service/CountryServiceImpl.java
|
2134bbaa5cab2f92827441ffe479d96cd2d3280c
|
[] |
no_license
|
irfanr/solus
|
cade6b6de75292e60c73f78cde60944af50b0c6e
|
6400c75c63a67440d4db2267c6501e9dd1038cff
|
refs/heads/master
| 2021-01-25T07:08:40.956587 | 2014-08-09T15:48:12 | 2014-08-09T15:48:12 | 22,163,899 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,849 |
java
|
package com.mascova.solus.service;
import com.mascova.solus.dao.CountryDao;
import com.mascova.solus.entity.Country;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.persistence.Query;
import org.openswing.swing.util.server.JPAUtils;
import org.primefaces.model.SortOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@Transactional
public class CountryServiceImpl implements CountryService {
@Autowired
CountryDao countryDao;
@Override
public long countAll() {
return countryDao.count();
}
@Override
public void delete(Country country) {
countryDao.delete(country);
}
@Override
public Country find(Long id) {
return countryDao.findOne(id);
}
@Override
public List<Country> findAll() {
return countryDao.findAll();
}
@Override
public Country findByName(String name) {
return Country.findByName(name);
}
@Override
public List<Country> findEntries(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, String> filters) {
return Country.findEntries(first, pageSize, sortField, sortOrder, filters);
}
public List<Country> findEntries(int firstResult, int maxResults) {
return countryDao.findAll(new org.springframework.data.domain.PageRequest(firstResult / maxResults, maxResults)).getContent();
}
@Override
public List<Country> findEntries(int action, int startIndex, int blockSize,
Map filteredColumns, ArrayList currentSortedColumns,
ArrayList currentSortedVersusColumns, Class valueObjectType, String baseSQL,
Object[] paramValues) {
try {
ArrayList values = new ArrayList();
values.addAll(Arrays.asList(paramValues));
baseSQL = JPAUtils.applyFiltersAndSorter(
filteredColumns,
currentSortedColumns,
currentSortedVersusColumns,
valueObjectType,
baseSQL,
values,
JPAUtils.getValueObjectAlias(valueObjectType, baseSQL));
Query q = Country.entityManager().createQuery(baseSQL);
for (int i = 0; i < values.size(); i++) {
q.setParameter(i + 1, values.get(i));
}
q.setFirstResult(startIndex);
q.setMaxResults(blockSize);
return q.getResultList();
} catch (Exception ex) {
Logger.getLogger(ProvinceServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
return null;
}
}
@Override
public Country save(Country country) {
return countryDao.save(country);
}
@Override
public Country update(Country country) {
return countryDao.save(country);
}
@Override
public List<Country> save(List<Country> countryList) {
for (Country country : countryList) {
save(country);
}
return countryList;
}
@Override
public List<Country> update(List<Country> countryList) {
for (Country country : countryList) {
update(country);
}
return countryList;
}
@Override
public void delete(List<Country> countryList) {
for (Country country : countryList) {
delete(country);
}
}
@Override
public long countEntries(Map<String, String> filters) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
|
[
"[email protected]"
] | |
764f1c926c710bed49f94b520578bddfbc9ca350
|
8995ef1d435c6bc8e51c95ed3896384ffae322c1
|
/code/app/src/main/java/com/infomax/ibotncloudplayer/FullScreenActivity.java
|
9a28eddc56de9e158e6efa4b89773ed4f65973ab
|
[] |
no_license
|
woshinimei/Ibot
|
6b619fabd476357edaf171df66cf442d139517ce
|
0cb821291bd6d6ced9beb993f7a5ef51f091e44b
|
refs/heads/master
| 2020-03-22T23:06:09.625426 | 2018-07-13T06:35:14 | 2018-07-13T06:35:14 | 140,789,588 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,780 |
java
|
package com.infomax.ibotncloudplayer;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
public class FullScreenActivity extends Activity {
private static final int INITIAL_HIDE_DELAY = 300;
private View mDecorView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mDecorView = getWindow().getDecorView();
}
@Override
protected void onResume() {
super.onResume();
hideSystemUI();
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
// When the window loses focus (e.g. the action overflow is shown),
// cancel any pending hide action. When the window gains focus,
// hide the system UI.
if (hasFocus) {
hideSystemUIDelay(INITIAL_HIDE_DELAY);
} else {
mHideHandler.removeMessages(0);
}
}
private void hideSystemUI() {
mDecorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
private final Handler mHideHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
hideSystemUI();
}
};
public void hideSystemUIDelay(int delayMillis) {
mHideHandler.removeMessages(0);
mHideHandler.sendEmptyMessageDelayed(0, delayMillis);
}
}
|
[
"[email protected]"
] | |
86a4a48a50c25cfdad721d8dc1f7578df537ad17
|
117a90114e3c40c87a4351df2077a36505b939f5
|
/temporal-sdk/src/test/java/io/temporal/workflow/shared/TestActivities.java
|
493647662e3602a871ab033fb02b74675b397190
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
cfieber/sdk-java
|
eccf7836ff3b1222461a1b5377502141f3d44108
|
221c4bb6a197b52e1e242b3713bd61cd251b6190
|
refs/heads/master
| 2023-05-14T13:04:17.949997 | 2021-05-20T01:27:20 | 2021-05-20T01:27:20 | 364,964,573 | 0 | 0 |
NOASSERTION
| 2021-05-26T21:38:48 | 2021-05-06T15:57:15 |
Java
|
UTF-8
|
Java
| false | false | 11,527 |
java
|
/*
* Copyright (C) 2020 Temporal Technologies, Inc. All Rights Reserved.
*
* Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Modifications copyright (C) 2017 Uber Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. A copy of the License is
* located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package io.temporal.workflow.shared;
import static org.junit.Assert.*;
import io.temporal.activity.*;
import io.temporal.client.ActivityCanceledException;
import io.temporal.client.ActivityCompletionClient;
import io.temporal.client.ActivityNotExistsException;
import io.temporal.common.MethodRetry;
import io.temporal.failure.ApplicationFailure;
import java.io.IOException;
import java.time.Duration;
import java.util.*;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
@ActivityInterface
public interface TestActivities {
String sleepActivity(long milliseconds, int input);
String activityWithDelay(long milliseconds, boolean heartbeatMoreThanOnce);
String activity();
@ActivityMethod(name = "customActivity1")
int activity1(int input);
String activity2(String a1, int a2);
String activity3(String a1, int a2, int a3);
String activity4(String a1, int a2, int a3, int a4);
String activity5(String a1, int a2, int a3, int a4, int a5);
String activity6(String a1, int a2, int a3, int a4, int a5, int a6);
void proc();
void proc1(String input);
void proc2(String a1, int a2);
void proc3(String a1, int a2, int a3);
void proc4(String a1, int a2, int a3, int a4);
void proc5(String a1, int a2, int a3, int a4, int a5);
void proc6(String a1, int a2, int a3, int a4, int a5, int a6);
void heartbeatAndThrowIO();
void throwIO();
void throwApplicationFailureThreeTimes();
void neverComplete();
@MethodRetry(initialIntervalSeconds = 1, maximumIntervalSeconds = 1, maximumAttempts = 3)
void throwIOAnnotated();
List<UUID> activityUUIDList(List<UUID> arg);
@ActivityInterface
interface TestActivity {
@ActivityMethod
Map<String, Duration> activity1();
@ActivityMethod
Map<String, Duration> activity2();
}
@ActivityInterface
interface AngryChildActivity {
@ActivityMethod
void execute();
}
class TestActivityImpl implements TestActivity {
@Override
public Map<String, Duration> activity1() {
ActivityInfo info = Activity.getExecutionContext().getInfo();
Hashtable<String, Duration> result =
new Hashtable<String, Duration>() {
{
put("HeartbeatTimeout", info.getHeartbeatTimeout());
put("ScheduleToCloseTimeout", info.getScheduleToCloseTimeout());
put("StartToCloseTimeout", info.getStartToCloseTimeout());
}
};
return result;
}
@Override
public Map<String, Duration> activity2() {
ActivityInfo info = Activity.getExecutionContext().getInfo();
Hashtable<String, Duration> result =
new Hashtable<String, Duration>() {
{
put("HeartbeatTimeout", info.getHeartbeatTimeout());
put("ScheduleToCloseTimeout", info.getScheduleToCloseTimeout());
put("StartToCloseTimeout", info.getStartToCloseTimeout());
}
};
return result;
}
}
class TestActivitiesImpl implements TestActivities {
public final List<String> invocations = Collections.synchronizedList(new ArrayList<>());
public final List<String> procResult = Collections.synchronizedList(new ArrayList<>());
final AtomicInteger heartbeatCounter = new AtomicInteger();
public final AtomicInteger applicationFailureCounter = new AtomicInteger();
private final ThreadPoolExecutor executor =
new ThreadPoolExecutor(0, 100, 1, TimeUnit.SECONDS, new LinkedBlockingQueue<>());
public ActivityCompletionClient completionClient;
int lastAttempt;
public void setCompletionClient(ActivityCompletionClient completionClient) {
this.completionClient = completionClient;
}
public void close() throws InterruptedException {
executor.shutdownNow();
executor.awaitTermination(1, TimeUnit.MINUTES);
}
public void assertInvocations(String... expected) {
assertEquals(Arrays.asList(expected), invocations);
}
@Override
public String sleepActivity(long milliseconds, int input) {
try {
Thread.sleep(milliseconds);
} catch (InterruptedException e) {
throw Activity.wrap(new RuntimeException("interrupted", new Throwable("simulated")));
}
invocations.add("sleepActivity");
return "sleepActivity" + input;
}
@Override
public String activityWithDelay(long delay, boolean heartbeatMoreThanOnce) {
ActivityExecutionContext ctx = Activity.getExecutionContext();
byte[] taskToken = ctx.getInfo().getTaskToken();
executor.execute(
() -> {
invocations.add("activityWithDelay");
long start = System.currentTimeMillis();
try {
int count = 0;
while (System.currentTimeMillis() - start < delay) {
if (heartbeatMoreThanOnce || count == 0) {
completionClient.heartbeat(taskToken, "heartbeatValue");
}
count++;
Thread.sleep(100);
}
completionClient.complete(taskToken, "activity");
} catch (InterruptedException e) {
} catch (ActivityNotExistsException | ActivityCanceledException e) {
try {
Thread.sleep(500);
} catch (InterruptedException interruptedException) {
// noop
}
completionClient.reportCancellation(taskToken, null);
}
});
ctx.doNotCompleteOnReturn();
return "ignored";
}
@Override
public String activity() {
invocations.add("activity");
return "activity";
}
@Override
public int activity1(int a1) {
invocations.add("activity1");
return a1;
}
@Override
public String activity2(String a1, int a2) {
invocations.add("activity2");
return a1 + a2;
}
@Override
public String activity3(String a1, int a2, int a3) {
invocations.add("activity3");
return a1 + a2 + a3;
}
@Override
public String activity4(String a1, int a2, int a3, int a4) {
byte[] taskToken = Activity.getExecutionContext().getInfo().getTaskToken();
executor.execute(
() -> {
invocations.add("activity4");
completionClient.complete(taskToken, a1 + a2 + a3 + a4);
});
Activity.getExecutionContext().doNotCompleteOnReturn();
return "ignored";
}
@Override
public String activity5(String a1, int a2, int a3, int a4, int a5) {
ActivityInfo activityInfo = Activity.getExecutionContext().getInfo();
String workflowId = activityInfo.getWorkflowId();
String id = activityInfo.getActivityId();
executor.execute(
() -> {
invocations.add("activity5");
completionClient.complete(workflowId, Optional.empty(), id, a1 + a2 + a3 + a4 + a5);
});
Activity.getExecutionContext().doNotCompleteOnReturn();
return "ignored";
}
@Override
public String activity6(String a1, int a2, int a3, int a4, int a5, int a6) {
invocations.add("activity6");
return a1 + a2 + a3 + a4 + a5 + a6;
}
@Override
public void proc() {
invocations.add("proc");
procResult.add("proc");
}
@Override
public void proc1(String a1) {
invocations.add("proc1");
procResult.add(a1);
}
@Override
public void proc2(String a1, int a2) {
invocations.add("proc2");
procResult.add(a1 + a2);
}
@Override
public void proc3(String a1, int a2, int a3) {
invocations.add("proc3");
procResult.add(a1 + a2 + a3);
}
@Override
public void proc4(String a1, int a2, int a3, int a4) {
invocations.add("proc4");
procResult.add(a1 + a2 + a3 + a4);
}
@Override
public void proc5(String a1, int a2, int a3, int a4, int a5) {
invocations.add("proc5");
procResult.add(a1 + a2 + a3 + a4 + a5);
}
@Override
public void proc6(String a1, int a2, int a3, int a4, int a5, int a6) {
invocations.add("proc6");
procResult.add(a1 + a2 + a3 + a4 + a5 + a6);
}
@Override
public void heartbeatAndThrowIO() {
ActivityExecutionContext ctx = Activity.getExecutionContext();
ActivityInfo info = ctx.getInfo();
assertEquals(info.getAttempt(), heartbeatCounter.get() + 1);
invocations.add("throwIO");
Optional<Integer> heartbeatDetails = ctx.getHeartbeatDetails(int.class);
assertEquals(heartbeatCounter.get(), (int) heartbeatDetails.orElse(0));
ctx.heartbeat(heartbeatCounter.incrementAndGet());
assertEquals(heartbeatCounter.get(), (int) ctx.getHeartbeatDetails(int.class).get());
try {
throw new IOException("simulated IO problem");
} catch (IOException e) {
throw Activity.wrap(e);
}
}
@Override
public void throwIO() {
ActivityInfo info = Activity.getExecutionContext().getInfo();
assertEquals(SDKTestWorkflowRule.NAMESPACE, info.getWorkflowNamespace());
assertNotNull(info.getWorkflowId());
assertNotNull(info.getRunId());
assertFalse(info.getWorkflowId().isEmpty());
assertFalse(info.getRunId().isEmpty());
lastAttempt = info.getAttempt();
invocations.add("throwIO");
try {
throw new IOException("simulated IO problem", new Throwable("test throwable wrapping"));
} catch (IOException e) {
throw Activity.wrap(e);
}
}
@Override
public void throwApplicationFailureThreeTimes() {
ApplicationFailure failure =
ApplicationFailure.newNonRetryableFailure("simulated", "simulatedType");
failure.setNonRetryable(applicationFailureCounter.incrementAndGet() > 2);
throw failure;
}
@Override
public void neverComplete() {
invocations.add("neverComplete");
Activity.getExecutionContext().doNotCompleteOnReturn(); // Simulate activity timeout
}
@Override
public void throwIOAnnotated() {
invocations.add("throwIOAnnotated");
try {
throw new IOException("simulated IO problem");
} catch (IOException e) {
throw Activity.wrap(e);
}
}
@Override
public List<UUID> activityUUIDList(List<UUID> arg) {
return arg;
}
public int getLastAttempt() {
return lastAttempt;
}
}
class AngryChildActivityImpl implements AngryChildActivity {
private long invocationCount;
@Override
public void execute() {
invocationCount++;
}
public long getInvocationCount() {
return invocationCount;
}
}
}
|
[
"[email protected]"
] | |
dccd7bf3b7fcf7fe002c2689d023a2d9d16e0ba5
|
e89ec1f04330c54870bce9baa90c6b413cc1e31e
|
/Slick2DTemplate/src/at/grabher/game/SnakeGame.java
|
4e57c043a3ebffc541f839f91706589162b0d945
|
[] |
no_license
|
aimless-cpu/SnakeDesignPatterns
|
fb54b7e09f644921efc890774be706d4edb2f5e6
|
f040a1856df5e361abd12e4e27b74034972f2730
|
refs/heads/main
| 2023-05-26T18:18:14.360803 | 2021-06-09T16:54:48 | 2021-06-09T16:54:48 | 374,742,370 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,658 |
java
|
package at.grabher.game;
import at.grabher.game.actors.Element;
import at.grabher.game.actors.ElementSnake;
import org.newdawn.slick.*;
import org.newdawn.slick.util.pathfinding.navmesh.Link;
import java.util.LinkedList;
import java.util.List;
public class SnakeGame extends BasicGame {
public static final int GRID_SIZE = 40;
public static final int CLOCK = 500;
private List<ElementSnake> snakeList;
private ElementSnake elementSnake;
public SnakeGame(String title) {
super(title);
}
@Override
public void init(GameContainer gameContainer) throws SlickException {
this.snakeList = new LinkedList<>();
for (int i = 0; i < 3; i++) {
elementSnake = new ElementSnake(i + 3, 3);
this.snakeList.add(0 + i, elementSnake);
}
}
@Override
public void update(GameContainer gameContainer, int delta) throws SlickException {
// for (ElementSnake elementSnake : this.snakeList) {
// elementSnake.update(gameContainer, delta);
// }
}
@Override
public void render(GameContainer gameContainer, Graphics graphics) throws SlickException {
// for (ElementSnake elementSnake : this.snakeList) {
// elementSnake.render(gameContainer, graphics);
// }
}
public static void main (String[]argv){
try {
AppGameContainer container = new AppGameContainer(new SnakeGame("plain snake DesignPatterns"));
container.setDisplayMode(800, 600, false);
container.start();
} catch (SlickException e) {
e.printStackTrace();
}
}
}
|
[
"[email protected]"
] | |
540ca0e3b11b962467c6aaf7fb1c6a56a6d633c6
|
cd0cd11ed41ab7f69a8b012a243c771ec97ed47f
|
/src/main/java/Mx/AST/Expressions/AssignmentExprNode.java
|
c915ec02618d91a1cd810e5ba15ba26de97e9814
|
[] |
no_license
|
HeydrichBeillschmidt/MxCompiler
|
53ab41c037c57937097f6d998f7a81f8b0de6fc1
|
ff188c13ec421e440dce27f2e291b7dfbe6c6064
|
refs/heads/main
| 2023-04-30T07:00:01.151237 | 2021-05-09T13:18:46 | 2021-05-09T13:18:46 | 322,250,589 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,106 |
java
|
package Mx.AST.Expressions;
import Mx.AST.ASTVisitor;
import Mx.AST.Initializers.InitializerClauseNode;
import Mx.Utils.Location;
public class AssignmentExprNode extends ExprNode {
private final LogicalOrExprNode lhs;
private final String op;
private final InitializerClauseNode rhs;
public AssignmentExprNode(Location loc, String text,
LogicalOrExprNode lhs, String op,
InitializerClauseNode rhs) {
super(loc, text);
this.lhs = lhs;
this.op = op;
this.rhs = rhs;
}
public LogicalOrExprNode getLhs() {
return lhs;
}
public String getOperator() {
return op;
}
public InitializerClauseNode getRhs() {
return rhs;
}
@Override
public String toString() {
return "<AssignmentExprNode>"
+ "assign operator =\n" + op + "\n"
+ "lhs =\n" + lhs.toString()
+ "rhs =\n" + rhs.toString();
}
@Override
public void accept(ASTVisitor visitor) {
visitor.visit(this);
}
}
|
[
"[email protected]"
] | |
0d9af17710e278b3e92d3655d4f51fde64abe7a3
|
e7a69456e2285202dc6b74dbb9af14b168d13719
|
/src/main/java/com/ruowei/config/WebMvcConfig.java
|
a261fe13c78261f1b094f76900c573b046d223c3
|
[] |
no_license
|
zeal607/jhipsite
|
b915e242b1a4a807a656d152921381a94509406d
|
083a561d55289f36592c31cb6050aef14ae3b287
|
refs/heads/master
| 2022-12-24T02:38:19.637975 | 2020-01-09T06:28:20 | 2020-01-09T06:28:20 | 207,093,203 | 0 | 0 | null | 2022-12-16T05:03:27 | 2019-09-08T10:00:20 |
TypeScript
|
UTF-8
|
Java
| false | false | 583 |
java
|
package com.ruowei.config;
import com.ruowei.common.enumeration.StringToEnumConverterFactory;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.format.FormatterRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@SpringBootConfiguration
public class WebMvcConfig implements WebMvcConfigurer {
/**
* 枚举类的转换器 addConverterFactory
*/
@Override
public void addFormatters(FormatterRegistry registry) {
registry.addConverterFactory(new StringToEnumConverterFactory());
}
}
|
[
"[email protected]"
] | |
4304c3169dc99e4761fe7ace62398ea42cf1711b
|
d79133bbc187ff2ab7c3bc66f3f274e3ce1f56d3
|
/tacuso/tacuso-buyer/src/main/java/com/tacuso/buyer/utils/IP/IPSeeker.java
|
0380d1b7927e512357317ab0981031510f9e8987
|
[] |
no_license
|
xiaocong1107/tacuso_customer
|
15ed205c8621b4d3fc695d7e9b8ed2f7d20ddaf2
|
7c541e9ce46153483c96b716764a897953c8cc30
|
refs/heads/master
| 2020-05-14T14:41:28.711275 | 2019-04-17T10:30:25 | 2019-04-17T10:37:37 | 181,838,186 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 21,873 |
java
|
package com.tacuso.buyer.utils.IP;
/**
* LumaQQ - Java QQ Client
*
* Copyright (C) 2004 luma < [email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteOrder;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
/**
* * 用来读取QQwry.dat文件,以根据ip获得好友位置,QQwry.dat的格式是
* 一. 文件头,共8字节
* 1. 第一个起始IP的绝对偏移, 4字节
* 2. 最后一个起始IP的绝对偏移, 4字节
* 二. "结束地址/国家/区域"记录区
* 四字节ip地址后跟的每一条记录分成两个部分
* 1. 国家记录
* 2. 地区记录
* 但是地区记录是不一定有的。而且国家记录和地区记录都有两种形式
* 1. 以0结束的字符串
* 2. 4个字节,一个字节可能为0x1或0x2
* a. 为0x1时,表示在绝对偏移后还跟着一个区域的记录,注意是绝对偏移之后,而不是这四个字节之后
* b. 为0x2时,表示在绝对偏移后没有区域记录
* 不管为0x1还是0x2,后三个字节都是实际国家名的文件内绝对偏移
* 如果是地区记录,0x1和0x2的含义不明,但是如果出现这两个字节,也肯定是跟着3个字节偏移,如果不是
* 则为0结尾字符串
* 三. "起始地址/结束地址偏移"记录区
* 1. 每条记录7字节,按照起始地址从小到大排列
* a. 起始IP地址,4字节
* b. 结束ip地址的绝对偏移,3字节
*
* 注意,这个文件里的ip地址和所有的偏移量均采用little-endian格式,而java是采用
* big-endian格式的,要注意转换
*
*
* @author 马若劼
*/
public class IPSeeker {
/**
* * 用来封装ip相关信息,目前只有两个字段,ip所在的国家和地区
*
*
* @author swallow */
private class IPLocation {
public String country;
public String area;
public IPLocation() {
country = area = "";
}
public IPLocation getCopy() {
IPLocation ret = new IPLocation();
ret.country = country;
ret.area = area;
return ret;
}
}
private static final String IP_FILE = IPSeeker.class.getResource("location/qqwry.dat").toString().substring(5);
// 一些固定常量,比如记录长度等等
private static final int IP_RECORD_LENGTH = 7;
private static final byte AREA_FOLLOWED = 0x01;
private static final byte NO_AREA = 0x2;
// 用来做为cache,查询一个ip时首先查看cache,以减少不必要的重复查找
private Hashtable ipCache;
// 随机文件访问类
private RandomAccessFile ipFile;
// 内存映射文件
private MappedByteBuffer mbb;
// 单一模式实例
private static IPSeeker instance = new IPSeeker();
// 起始地区的开始和结束的绝对偏移
private long ipBegin, ipEnd;
// 为提高效率而采用的临时变量
private IPLocation loc;
private byte[] buf;
private byte[] b4;
private byte[] b3;
/**
* 私有构造函数
*/
private IPSeeker() {
ipCache = new Hashtable();
loc = new IPLocation();
buf = new byte[100];
b4 = new byte[4];
b3 = new byte[3];
try {
ipFile = new RandomAccessFile(IP_FILE, "r");
} catch (FileNotFoundException e) {
System.out.println(IPSeeker.class.getResource("/QQWry.dat").toString());
System.out.println(IP_FILE);
System.out.println("IP地址信息文件没有找到,IP显示功能将无法使用");
ipFile = null;
}
// 如果打开文件成功,读取文件头信息
if(ipFile != null) {
try {
ipBegin = readLong4(0);
ipEnd = readLong4(4);
if(ipBegin == -1 || ipEnd == -1) {
ipFile.close();
ipFile = null;
}
} catch (IOException e) {
System.out.println("IP地址信息文件格式有错误,IP显示功能将无法使用");
ipFile = null;
}
}
}
/**
* @return 单一实例
*/
public static IPSeeker getInstance() {
return instance;
}
/**
* 给定一个地点的不完全名字,得到一系列包含s子串的IP范围记录
* @param s 地点子串
* @return 包含IPEntry类型的List
*/
public List getIPEntriesDebug(String s) {
List ret = new ArrayList();
long endOffset = ipEnd + 4;
for(long offset = ipBegin + 4; offset <= endOffset; offset += IP_RECORD_LENGTH) {
// 读取结束IP偏移
long temp = readLong3(offset);
// 如果temp不等于-1,读取IP的地点信息
if(temp != -1) {
IPLocation loc = getIPLocation(temp);
// 判断是否这个地点里面包含了s子串,如果包含了,添加这个记录到List中,如果没有,继续
if(loc.country.indexOf(s) != -1 || loc.area.indexOf(s) != -1) {
IPEntry entry = new IPEntry();
entry.country = loc.country;
entry.area = loc.area;
// 得到起始IP
readIP(offset - 4, b4);
entry.beginIp = Utils.getIpStringFromBytes(b4);
// 得到结束IP
readIP(temp, b4);
entry.endIp = Utils.getIpStringFromBytes(b4);
// 添加该记录
ret.add(entry);
}
}
}
return ret;
}
/**
* 给定一个地点的不完全名字,得到一系列包含s子串的IP范围记录
* @param s 地点子串
* @return 包含IPEntry类型的List
*/
public List getIPEntries(String s) {
List ret = new ArrayList();
try {
// 映射IP信息文件到内存中
if(mbb == null) {
FileChannel fc = ipFile.getChannel();
mbb = fc.map(FileChannel.MapMode.READ_ONLY, 0, ipFile.length());
mbb.order(ByteOrder.LITTLE_ENDIAN);
}
int endOffset = (int)ipEnd;
for(int offset = (int)ipBegin + 4; offset <= endOffset; offset += IP_RECORD_LENGTH) {
int temp = readInt3(offset);
if(temp != -1) {
IPLocation loc = getIPLocation(temp);
// 判断是否这个地点里面包含了s子串,如果包含了,添加这个记录到List中,如果没有,继续
if(loc.country.indexOf(s) != -1 || loc.area.indexOf(s) != -1) {
IPEntry entry = new IPEntry();
entry.country = loc.country;
entry.area = loc.area;
// 得到起始IP
readIP(offset - 4, b4);
entry.beginIp = Utils.getIpStringFromBytes(b4);
// 得到结束IP
readIP(temp, b4);
entry.endIp = Utils.getIpStringFromBytes(b4);
// 添加该记录
ret.add(entry);
}
}
}
} catch (IOException e) {
System.out.println(e.getMessage());
}
return ret;
}
/**
* 从内存映射文件的offset位置开始的3个字节读取一个int
* @param offset
* @return
*/
private int readInt3(int offset) {
mbb.position(offset);
return mbb.getInt() & 0x00FFFFFF;
}
/**
* 从内存映射文件的当前位置开始的3个字节读取一个int
* @return
*/
private int readInt3() {
return mbb.getInt() & 0x00FFFFFF;
}
/**
* 根据IP得到国家名
* @param ip ip的字节数组形式
* @return 国家名字符串
*/
public String getCountry(byte[] ip) {
// 检查ip地址文件是否正常
if(ipFile == null) return "错误的IP数据库文件";
// 保存ip,转换ip字节数组为字符串形式
String ipStr = Utils.getIpStringFromBytes(ip);
// 先检查cache中是否已经包含有这个ip的结果,没有再搜索文件
if(ipCache.containsKey(ipStr)) {
IPLocation loc = (IPLocation)ipCache.get(ipStr);
return loc.country;
} else {
IPLocation loc = getIPLocation(ip);
ipCache.put(ipStr, loc.getCopy());
return loc.country;
}
}
/**
* 根据IP得到国家名
* @param ip IP的字符串形式
* @return 国家名字符串
*/
public String getCountry(String ip) {
return getCountry(Utils.getIpByteArrayFromString(ip));
}
/**
* 根据IP得到地区名
* @param ip ip的字节数组形式
* @return 地区名字符串
*/
public String getArea(byte[] ip) {
// 检查ip地址文件是否正常
if(ipFile == null) return "错误的IP数据库文件";
// 保存ip,转换ip字节数组为字符串形式
String ipStr = Utils.getIpStringFromBytes(ip);
// 先检查cache中是否已经包含有这个ip的结果,没有再搜索文件
if(ipCache.containsKey(ipStr)) {
IPLocation loc = (IPLocation)ipCache.get(ipStr);
return loc.area;
} else {
IPLocation loc = getIPLocation(ip);
ipCache.put(ipStr, loc.getCopy());
return loc.area;
}
}
/**
* 根据IP得到地区名
* @param ip IP的字符串形式
* @return 地区名字符串
*/
public String getArea(String ip) {
return getArea(Utils.getIpByteArrayFromString(ip));
}
/**
* 根据ip搜索ip信息文件,得到IPLocation结构,所搜索的ip参数从类成员ip中得到
* @param ip 要查询的IP
* @return IPLocation结构
*/
private IPLocation getIPLocation(byte[] ip) {
IPLocation info = null;
long offset = locateIP(ip);
if(offset != -1)
info = getIPLocation(offset);
if(info == null) {
info = new IPLocation();
info.country = "未知国家";
info.area = "未知地区";
}
return info;
}
/**
* 从offset位置读取4个字节为一个long,因为java为big-endian格式,所以没办法
* 用了这么一个函数来做转换
* @param offset
* @return 读取的long值,返回-1表示读取文件失败
*/
private long readLong4(long offset) {
long ret = 0;
try {
ipFile.seek(offset);
ret |= (ipFile.readByte() & 0xFF);
ret |= ((ipFile.readByte() << 8) & 0xFF00);
ret |= ((ipFile.readByte() << 16) & 0xFF0000);
ret |= ((ipFile.readByte() << 24) & 0xFF000000);
return ret;
} catch (IOException e) {
return -1;
}
}
/**
* 从offset位置读取3个字节为一个long,因为java为big-endian格式,所以没办法
* 用了这么一个函数来做转换
* @param offset
* @return 读取的long值,返回-1表示读取文件失败
*/
private long readLong3(long offset) {
long ret = 0;
try {
ipFile.seek(offset);
ipFile.readFully(b3);
ret |= (b3[0] & 0xFF);
ret |= ((b3[1] << 8) & 0xFF00);
ret |= ((b3[2] << 16) & 0xFF0000);
return ret;
} catch (IOException e) {
return -1;
}
}
/**
* 从当前位置读取3个字节转换成long
* @return
*/
private long readLong3() {
long ret = 0;
try {
ipFile.readFully(b3);
ret |= (b3[0] & 0xFF);
ret |= ((b3[1] << 8) & 0xFF00);
ret |= ((b3[2] << 16) & 0xFF0000);
return ret;
} catch (IOException e) {
return -1;
}
}
/**
* 从offset位置读取四个字节的ip地址放入ip数组中,读取后的ip为big-endian格式,但是
* 文件中是little-endian形式,将会进行转换
* @param offset
* @param ip
*/
private void readIP(long offset, byte[] ip) {
try {
ipFile.seek(offset);
ipFile.readFully(ip);
byte temp = ip[0];
ip[0] = ip[3];
ip[3] = temp;
temp = ip[1];
ip[1] = ip[2];
ip[2] = temp;
} catch (IOException e) {
System.out.println(e.getMessage());
}
}
/**
* 从offset位置读取四个字节的ip地址放入ip数组中,读取后的ip为big-endian格式,但是
* 文件中是little-endian形式,将会进行转换
* @param offset
* @param ip
*/
private void readIP(int offset, byte[] ip) {
mbb.position(offset);
mbb.get(ip);
byte temp = ip[0];
ip[0] = ip[3];
ip[3] = temp;
temp = ip[1];
ip[1] = ip[2];
ip[2] = temp;
}
/**
* 把类成员ip和beginIp比较,注意这个beginIp是big-endian的
* @param ip 要查询的IP
* @param beginIp 和被查询IP相比较的IP
* @return 相等返回0,ip大于beginIp则返回1,小于返回-1。
*/
private int compareIP(byte[] ip, byte[] beginIp) {
for(int i = 0; i < 4; i++) {
int r = compareByte(ip[i], beginIp[i]);
if(r != 0)
return r;
}
return 0;
}
/**
* 把两个byte当作无符号数进行比较
* @param b1
* @param b2
* @return 若b1大于b2则返回1,相等返回0,小于返回-1
*/
private int compareByte(byte b1, byte b2) {
if((b1 & 0xFF) > (b2 & 0xFF)) // 比较是否大于
return 1;
else if((b1 ^ b2) == 0)// 判断是否相等
return 0;
else
return -1;
}
/**
* 这个方法将根据ip的内容,定位到包含这个ip国家地区的记录处,返回一个绝对偏移
* 方法使用二分法查找。
* @param ip 要查询的IP
* @return 如果找到了,返回结束IP的偏移,如果没有找到,返回-1
*/
private long locateIP(byte[] ip) {
long m = 0;
int r;
// 比较第一个ip项
readIP(ipBegin, b4);
r = compareIP(ip, b4);
if(r == 0) return ipBegin;
else if(r < 0) return -1;
// 开始二分搜索
for(long i = ipBegin, j = ipEnd; i < j; ) {
m = getMiddleOffset(i, j);
readIP(m, b4);
r = compareIP(ip, b4);
// log.debug(Utils.getIpStringFromBytes(b));
if(r > 0)
i = m;
else if(r < 0) {
if(m == j) {
j -= IP_RECORD_LENGTH;
m = j;
} else
j = m;
} else
return readLong3(m + 4);
}
// 如果循环结束了,那么i和j必定是相等的,这个记录为最可能的记录,但是并非
// 肯定就是,还要检查一下,如果是,就返回结束地址区的绝对偏移
m = readLong3(m + 4);
readIP(m, b4);
r = compareIP(ip, b4);
if(r <= 0) return m;
else return -1;
}
/**
* 得到begin偏移和end偏移中间位置记录的偏移
* @param begin
* @param end
* @return
*/
private long getMiddleOffset(long begin, long end) {
long records = (end - begin) / IP_RECORD_LENGTH;
records >>= 1;
if(records == 0) records = 1;
return begin + records * IP_RECORD_LENGTH;
}
/**
* 给定一个ip国家地区记录的偏移,返回一个IPLocation结构
* @param offset
* @return
*/
private IPLocation getIPLocation(long offset) {
try {
// 跳过4字节ip
ipFile.seek(offset + 4);
// 读取第一个字节判断是否标志字节
byte b = ipFile.readByte();
if(b == AREA_FOLLOWED) {
// 读取国家偏移
long countryOffset = readLong3();
// 跳转至偏移处
ipFile.seek(countryOffset);
// 再检查一次标志字节,因为这个时候这个地方仍然可能是个重定向
b = ipFile.readByte();
if(b == NO_AREA) {
loc.country = readString(readLong3());
ipFile.seek(countryOffset + 4);
} else
loc.country = readString(countryOffset);
// 读取地区标志
loc.area = readArea(ipFile.getFilePointer());
} else if(b == NO_AREA) {
loc.country = readString(readLong3());
loc.area = readArea(offset + 8);
} else {
loc.country = readString(ipFile.getFilePointer() - 1);
loc.area = readArea(ipFile.getFilePointer());
}
return loc;
} catch (IOException e) {
return null;
}
}
/**
* @param offset
* @return
*/
private IPLocation getIPLocation(int offset) {
// 跳过4字节ip
mbb.position(offset + 4);
// 读取第一个字节判断是否标志字节
byte b = mbb.get();
if(b == AREA_FOLLOWED) {
// 读取国家偏移
int countryOffset = readInt3();
// 跳转至偏移处
mbb.position(countryOffset);
// 再检查一次标志字节,因为这个时候这个地方仍然可能是个重定向
b = mbb.get();
if(b == NO_AREA) {
loc.country = readString(readInt3());
mbb.position(countryOffset + 4);
} else
loc.country = readString(countryOffset);
// 读取地区标志
loc.area = readArea(mbb.position());
} else if(b == NO_AREA) {
loc.country = readString(readInt3());
loc.area = readArea(offset + 8);
} else {
loc.country = readString(mbb.position() - 1);
loc.area = readArea(mbb.position());
}
return loc;
}
/**
* 从offset偏移开始解析后面的字节,读出一个地区名
* @param offset
* @return 地区名字符串
* @throws IOException
*/
private String readArea(long offset) throws IOException {
ipFile.seek(offset);
byte b = ipFile.readByte();
if(b == 0x01 || b == 0x02) {
long areaOffset = readLong3(offset + 1);
if(areaOffset == 0)
return "未知地区";
else
return readString(areaOffset);
} else
return readString(offset);
}
/**
* @param offset
* @return
*/
private String readArea(int offset) {
mbb.position(offset);
byte b = mbb.get();
if(b == 0x01 || b == 0x02) {
int areaOffset = readInt3();
if(areaOffset == 0)
return "未知地区";
else
return readString(areaOffset);
} else
return readString(offset);
}
/**
* 从offset偏移处读取一个以0结束的字符串
* @param offset
* @return 读取的字符串,出错返回空字符串
*/
private String readString(long offset) {
try {
ipFile.seek(offset);
int i;
for(i = 0, buf[i] = ipFile.readByte(); buf[i] != 0; buf[++i] = ipFile.readByte());
if(i != 0)
return Utils.getString(buf, 0, i, "GBK");
} catch (IOException e) {
System.out.println(e.getMessage());
}
return "";
}
/**
* 从内存映射文件的offset位置得到一个0结尾字符串
* @param offset
* @return
*/
private String readString(int offset) {
try {
mbb.position(offset);
int i;
for(i = 0, buf[i] = mbb.get(); buf[i] != 0; buf[++i] = mbb.get());
if(i != 0)
return Utils.getString(buf, 0, i, "GBK");
} catch (IllegalArgumentException e) {
System.out.println(e.getMessage());
}
return "";
}
public String getAddress(String ip){
String country = getCountry(ip).equals(" CZ88.NET")?"":getCountry(ip);
String area = getArea(ip).equals(" CZ88.NET")?"":getArea(ip);
String address = country+" "+area;
return address.trim();
}
}
|
[
"[email protected]"
] | |
c8c304ccac96c4554bb57e04bba74c33c3fc8aaf
|
dfd7e70936b123ee98e8a2d34ef41e4260ec3ade
|
/analysis/reverse-engineering/decompile-fitts-with-gradle-20191031-2200/src/main/java/kr/co/popone/fitts/feature/identification/view/IdentificationAdditionalInfoFragment$onViewCreated$10.java
|
c822bd08276aba680d86ff96fd1d0db78a44e1c8
|
[
"Apache-2.0"
] |
permissive
|
skkuse-adv/2019Fall_team2
|
2d4f75bc793368faac4ca8a2916b081ad49b7283
|
3ea84c6be39855f54634a7f9b1093e80893886eb
|
refs/heads/master
| 2020-08-07T03:41:11.447376 | 2019-12-21T04:06:34 | 2019-12-21T04:06:34 | 213,271,174 | 5 | 5 |
Apache-2.0
| 2019-12-12T09:15:32 | 2019-10-07T01:18:59 |
Java
|
UTF-8
|
Java
| false | false | 1,704 |
java
|
package kr.co.popone.fitts.feature.identification.view;
import android.content.Intent;
import androidx.fragment.app.FragmentActivity;
import io.reactivex.functions.Consumer;
import kotlin.TypeCastException;
import kr.co.popone.fitts.feature.intro.IntroActivity;
import kr.co.popone.fitts.utils.Snackbar;
import kr.co.popone.fitts.utils.Snackbar.Companion;
import retrofit2.HttpException;
final class IdentificationAdditionalInfoFragment$onViewCreated$10<T> implements Consumer<Throwable> {
final /* synthetic */ IdentificationAdditionalInfoFragment this$0;
IdentificationAdditionalInfoFragment$onViewCreated$10(IdentificationAdditionalInfoFragment identificationAdditionalInfoFragment) {
this.this$0 = identificationAdditionalInfoFragment;
}
public final void accept(Throwable th) {
if (!(th instanceof HttpException)) {
Companion companion = Snackbar.Companion;
FragmentActivity activity = this.this$0.getActivity();
if (activity != null) {
companion.showMessage((IdentificationActivity) activity, "죄송합니다.\n서비스가 잠시 지연되고 있습니다.\n잠시 후 다시 이용해주세요.");
return;
}
throw new TypeCastException("null cannot be cast to non-null type kr.co.popone.fitts.feature.identification.view.IdentificationActivity");
} else if (((HttpException) th).code() == 401) {
Intent intent = new Intent(this.this$0.getContext(), IntroActivity.class);
intent.addFlags(32768);
intent.addFlags(268435456);
this.this$0.startActivity(intent);
}
}
}
|
[
"[email protected]"
] | |
6acdafaae697e937e22becae6269f7f7f063ede1
|
44fe50877e55f4495b7a3428059f5086d4c1dc9a
|
/sample.java
|
238191dcb0f94c050fff436a41aa55b3a1dae961
|
[] |
no_license
|
Aadimithuntechnologies/walmart
|
67dd89dbcb2c13880356f652358f9345b03dc800
|
66b1b7a2582c287456dcfe19b8e0988a456fbdef
|
refs/heads/master
| 2020-03-24T04:09:55.341511 | 2018-08-21T19:34:57 | 2018-08-21T19:34:57 | 142,446,210 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 52 |
java
|
this is sample code
added code
one more time added
|
[
"[email protected]"
] | |
bbf75b1cc3dafe3cb346a1e8196c60976c9e5993
|
5c3dcc250278c47f2a45ad6cef9ff3262f6a3076
|
/app/src/main/java/kelembagaan/pdpp/kemenag/gov/kelembagaan/ui/bookmark/MadrasahBookmarkAdapter.java
|
9b2ace116ad60bfa6ec25d9c762f96df002e6929
|
[] |
no_license
|
indi60/Kelembagaan
|
d73336ed6c842eb450e028f7ae71752d4fae9407
|
846a818d6b27b6a94961762954e818e49155bfba
|
refs/heads/master
| 2021-07-06T11:19:37.542181 | 2017-10-02T02:26:43 | 2017-10-02T02:26:43 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,905 |
java
|
package kelembagaan.pdpp.kemenag.gov.kelembagaan.ui.bookmark;
import android.content.Context;
import android.support.design.widget.Snackbar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import kelembagaan.pdpp.kemenag.gov.kelembagaan.R;
import kelembagaan.pdpp.kemenag.gov.kelembagaan.data.local.KabupatenDbHelper;
import kelembagaan.pdpp.kemenag.gov.kelembagaan.data.local.LembagaDbHelper;
import kelembagaan.pdpp.kemenag.gov.kelembagaan.data.local.ProvinsiDbHelper;
import kelembagaan.pdpp.kemenag.gov.kelembagaan.data.model.Kabupaten;
import kelembagaan.pdpp.kemenag.gov.kelembagaan.data.model.Lembaga;
import kelembagaan.pdpp.kemenag.gov.kelembagaan.data.model.Provinsi;
/**
* Created by Amiral on 6/12/17.
*/
public class MadrasahBookmarkAdapter extends BaseAdapter {
private Context mContext;
private LayoutInflater mInflater;
private List<Lembaga> mDataSource;
public MadrasahBookmarkAdapter(Context mContext, List<Lembaga> mDataSource) {
this.mContext = mContext;
this.mDataSource = mDataSource;
mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public int getCount() {
return mDataSource.size();
}
@Override
public Lembaga getItem(int position) {
return mDataSource.get(position);
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(int position, View view, ViewGroup parent) {
final ViewHolder holder;
if (view != null) {
holder = (ViewHolder) view.getTag();
} else {
view = mInflater.inflate(R.layout.item_bookmark_madrasah, parent, false);
holder = new ViewHolder(view);
view.setTag(holder);
}
final Lembaga madrasah = mDataSource.get(position);
holder.nama.setText(madrasah.getNamaLembaga());
holder.nomor.setText(""+madrasah.getNsm());
Kabupaten k = new KabupatenDbHelper(mContext).getKabupaten(madrasah.getKabupatenId());
Provinsi p = new ProvinsiDbHelper(mContext).getProvinsi(k.getProvinsiIdProvinsi());
String lks = k.getNamaKabupaten() + ", " + p.getNamaProvinsi();
holder.lokasi.setText(lks);
holder.btnBookmark.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LembagaDbHelper helper = new LembagaDbHelper(mContext);
int iFavorit = helper.getLembaga(madrasah.getIdLembaga()).getIsFavorit();
if (iFavorit == 1){
helper.setBookmark(madrasah, 0);
holder.btnBookmark.setImageResource(R.drawable.ic_action_bookmark_off);
Snackbar.make(holder.view, "Madrasah dihapus dari favorit.", Snackbar.LENGTH_SHORT).show();
}else{
helper.setBookmark(madrasah, 1);
holder.btnBookmark.setImageResource(R.drawable.ic_action_bookmark_on);
Snackbar.make(holder.view, "Madrasah telah dijadikan favorit", Snackbar.LENGTH_SHORT).show();
}
}
});
return view;
}
static class ViewHolder {
@BindView(R.id.text_nama_madrasah_bookmark)
TextView nama;
@BindView(R.id.text_nsm_madrasah_bookmark) TextView nomor;
@BindView(R.id.text_lokasi_madrasah)
TextView lokasi;
@BindView(R.id.bookmark)
ImageView btnBookmark;
View view;
public ViewHolder(View view) {
ButterKnife.bind(this, view);
this.view = view;
}
}
}
|
[
"[email protected]"
] | |
4174b70e4c553e48b82f952d97aa635e6ba1be6b
|
30c38711aae68265ac761cee96a58b0826b2b45e
|
/android/src/main/java/com/snowplowanalytics/react/tracker/RNSnowplowTrackerModule.java
|
20a80e289c37e6c1917deb1c9951f5c93f630c72
|
[] |
no_license
|
jdmunro/snowplow-react-native-tracker
|
bca0463abc3dfba8a4a873d659d37a5b8809f96a
|
6a283aea45808a94aa62dd4feb5dbee822902f65
|
refs/heads/master
| 2022-07-04T03:38:11.316011 | 2020-05-05T13:01:18 | 2020-05-05T13:01:18 | 262,011,899 | 0 | 0 | null | 2020-05-07T09:50:01 | 2020-05-07T09:50:00 | null |
UTF-8
|
Java
| false | false | 7,879 |
java
|
package com.snowplowanalytics.react.tracker;
import java.util.UUID;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.snowplowanalytics.react.util.EventUtil;
import com.snowplowanalytics.snowplow.tracker.Emitter;
import com.snowplowanalytics.snowplow.tracker.Tracker;
import com.snowplowanalytics.snowplow.tracker.emitter.HttpMethod;
import com.snowplowanalytics.snowplow.tracker.emitter.RequestSecurity;
import com.snowplowanalytics.snowplow.tracker.events.SelfDescribing;
import com.snowplowanalytics.snowplow.tracker.events.Structured;
import com.snowplowanalytics.snowplow.tracker.events.ScreenView;
import com.snowplowanalytics.snowplow.tracker.events.PageView;
public class RNSnowplowTrackerModule extends ReactContextBaseJavaModule {
private final ReactApplicationContext reactContext;
private Tracker tracker;
private Emitter emitter;
public RNSnowplowTrackerModule(ReactApplicationContext reactContext) {
super(reactContext);
this.reactContext = reactContext;
}
@Override
public String getName() {
return "RNSnowplowTracker";
}
@ReactMethod
public void initialize(String endpoint, String method, String protocol,
String namespace, String appId, ReadableMap options) {
this.emitter = new Emitter.EmitterBuilder(endpoint, this.reactContext)
.method(method.equalsIgnoreCase("post") ? HttpMethod.POST : HttpMethod.GET)
.security(protocol.equalsIgnoreCase("https") ? RequestSecurity.HTTPS : RequestSecurity.HTTP)
.build();
this.emitter.waitForEventStore();
com.snowplowanalytics.snowplow.tracker.Subject subject = new com.snowplowanalytics.snowplow.tracker.Subject.SubjectBuilder()
.build();
this.tracker = Tracker.init(new Tracker
.TrackerBuilder(this.emitter, namespace, appId, this.reactContext)
// setSubject/UserID
.subject(subject)
// setBase64Encoded
.base64(options.hasKey("setBase64Encoded") ? options.getBoolean("setBase64Encoded") : false)
// setPlatformContext
.mobileContext(options.hasKey("setPlatformContext") ? options.getBoolean("setPlatformContext") : false)
.screenviewEvents(options.hasKey("autoScreenView") ? options.getBoolean("autoScreenView") : false)
// setApplicationContext
.applicationContext(options.hasKey("setApplicationContext") ? options.getBoolean("setApplicationContext") : false)
// setSessionContext
.sessionContext(options.hasKey("setSessionContext") ? options.getBoolean("setSessionContext") : false)
.sessionCheckInterval(options.hasKey("checkInterval") ? options.getInt("checkInterval") : 15)
.foregroundTimeout(options.hasKey("foregroundTimeout") ? options.getInt("foregroundTimeout") : 600)
.backgroundTimeout(options.hasKey("backgroundTimeout") ? options.getInt("backgroundTimeout") : 300)
// setLifecycleEvents
.lifecycleEvents(options.hasKey("setLifecycleEvents") ? options.getBoolean("setLifecycleEvents") : false)
// setScreenContext
.screenContext(options.hasKey("setScreenContext") ? options.getBoolean("setScreenContext") : false)
// setInstallEvent
.installTracking(options.hasKey("setInstallEvent") ? options.getBoolean("setInstallEvent") : false)
.build()
);
}
@ReactMethod
public void setSubjectData(ReadableMap options) {
if (options.hasKey("userId") && options.getString("userId") != null && !options.getString("userId").isEmpty()) {
tracker.instance().getSubject().setUserId(options.getString("userId"));
}
if (options.hasKey("viewportWidth") && options.hasKey("viewportHeight")) {
tracker.instance().getSubject().setViewPort(options.getInt("viewportWidth"), options.getInt("viewportHeight"));
}
if (options.hasKey("screenWidth") && options.hasKey("screenHeight")) {
tracker.instance().getSubject().setScreenResolution(options.getInt("screenWidth"), options.getInt("screenHeight"));
}
if (options.hasKey("colorDepth")) {
tracker.instance().getSubject().setColorDepth(options.getInt("colorDepth"));
}
if (options.hasKey("timezone") && options.getString("timezone") != null
&& !options.getString("timezone").isEmpty()) {
tracker.instance().getSubject().setTimezone(options.getString("timezone"));
}
if (options.hasKey("language") && options.getString("language") != null
&& !options.getString("language").isEmpty()) {
tracker.instance().getSubject().setLanguage(options.getString("language"));
}
if (options.hasKey("ipAddress") && options.getString("ipAddress") != null
&& !options.getString("ipAddress").isEmpty()) {
tracker.instance().getSubject().setIpAddress(options.getString("ipAddress"));
}
if (options.hasKey("useragent") && options.getString("useragent") != null
&& !options.getString("useragent").isEmpty()) {
tracker.instance().getSubject().setUseragent(options.getString("useragent"));
}
if (options.hasKey("networkUserId") && options.getString("networkUserId") != null
&& !options.getString("networkUserId").isEmpty()) {
tracker.instance().getSubject().setNetworkUserId(options.getString("networkUserId"));
}
if (options.hasKey("domainUserId") && options.getString("domainUserId") != null
&& !options.getString("domainUserId").isEmpty()) {
tracker.instance().getSubject().setDomainUserId(options.getString("domainUserId"));
}
}
@ReactMethod
public void trackSelfDescribingEvent(ReadableMap event, ReadableArray contexts) {
SelfDescribing trackerEvent = EventUtil.getSelfDescribingEvent(event, contexts);
if (trackerEvent != null) {
tracker.track(trackerEvent);
}
}
@ReactMethod
public void trackStructuredEvent(String category, String action, String label,
String property, Float value, ReadableArray contexts) {
Structured trackerEvent = EventUtil.getStructuredEvent(category, action, label,
property, value, contexts);
if (trackerEvent != null) {
tracker.track(trackerEvent);
}
}
@ReactMethod
public void trackScreenViewEvent(String screenName, String screenId, String screenType,
String previousScreenName, String previousScreenType,
String previousScreenId, String transitionType,
ReadableArray contexts) {
if (screenId == null) {
screenId = UUID.randomUUID().toString();
}
ScreenView trackerEvent = EventUtil.getScreenViewEvent(screenName,
screenId, screenType, previousScreenName, previousScreenId, previousScreenType,
transitionType, contexts);
if (trackerEvent != null) {
tracker.track(trackerEvent);
}
}
@ReactMethod
public void trackPageViewEvent(String pageUrl, String pageTitle, String referrer, ReadableArray contexts) {
PageView trackerEvent = EventUtil.getPageViewEvent(pageUrl, pageTitle, referrer, contexts);
if (trackerEvent != null) {
tracker.track(trackerEvent);
}
}
}
|
[
"[email protected]"
] | |
a4aded2dcf7d7a760b97edb33abe44b8053dbbe4
|
c24c526de35318186b4828252081a409c9784d79
|
/src/main/java/za/ac/cput/Entity/Registration.java
|
b0451e0fb03b494d52a050daf269527aa8f8228b
|
[] |
no_license
|
AbdulQ13/EntityFactory
|
146d2b6cdbd0eb6e325f5a59c98691783060d358
|
cc8a50db16349be283a425dd93c7ef37eb43254c
|
refs/heads/master
| 2023-05-31T03:23:11.669791 | 2021-06-10T20:22:38 | 2021-06-10T20:22:38 | 375,804,909 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 28 |
java
|
package za.ac.cput.Entity;
|
[
"[email protected]"
] | |
ff53a38500c4b4158ac6367f5ed0594589d8f554
|
f5c3c512b269a0d10cfc4fd894ffc2764704f35f
|
/SpringMVC03_filter_aop_login_interceptor_transaction_security/src/main/java/com/mvc/upgrade/common/interceptor/LoginInterceptor.java
|
c23a52e281ebe74936fab9851a9d356da2f04642
|
[] |
no_license
|
NamMinHyuk/Spring
|
05ce4236c5ab924506c07b000b00a84a45101d09
|
bcca33db42ec42703bafb1e0c9bc5253a8d30739
|
refs/heads/master
| 2023-05-07T11:53:11.268766 | 2021-06-04T07:34:45 | 2021-06-04T07:34:45 | 366,357,602 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,745 |
java
|
package com.mvc.upgrade.common.interceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
public class LoginInterceptor implements HandlerInterceptor {
private Logger logger = LoggerFactory.getLogger(LoginInterceptor.class);
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
logger.info("[Interceptor] : preHandle");
// spring 3.2 이상부터는 servlet-context.xml에서 <exclude-mapping-path>를 통해 설정 가능
if(request.getRequestURI().contains("/loginform.do") ||
request.getRequestURI().contains("/ajaxlogin.do") ||
request.getSession().getAttribute("login") != null ||
request.getRequestURI().contains("/test.do") ||
request.getRequestURI().contains("/registerform.do") ||
request.getRequestURI().contains("/register.do")
) {
return true;
}
if(request.getSession().getAttribute("login") == null) {
response.sendRedirect("loginform.do");
}
return false;
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
ModelAndView modelAndView) throws Exception {
logger.info("[Interceptor] : postHandle");
if(modelAndView != null) {
logger.info("target View : " + modelAndView.getViewName());
}
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
throws Exception {
logger.info("[Interceptor] : afterCompletion");
}
}
|
[
"[email protected]"
] | |
d0f85f2870ee4339e8bda92672242bee33374878
|
3129ace1210a15d18c2a620a67bf1ee5f720e7d5
|
/learning/dubbo_server/src/main/java/com/lhx/service/impl/SayHelloToClientImpl.java
|
5bb751577cf6ab2d47fbc484e2457a6beff622f7
|
[] |
no_license
|
outstandingP/learning
|
a290f897fd57cafcb62c427278b0d61e0e814c59
|
1d72058e98810f8c80b7aff14dcb95eadbbba7ab
|
refs/heads/master
| 2021-01-24T07:47:51.112030 | 2017-06-05T02:37:15 | 2017-06-05T02:37:15 | 93,358,541 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 333 |
java
|
package com.lhx.service.impl;
import com.lhx.service.SayHelloToClient;
/**
* Created by Lhx on 14-11-19.
*/
public class SayHelloToClientImpl implements SayHelloToClient{
public String sayHello(String hello){
System.out.println("我接收到了:" + hello);
return hello + "你也好啊!!!" ;
}
}
|
[
"songll.fun.tv"
] |
songll.fun.tv
|
5a404819f4d9016c91be60671bbb8cdc2c086b75
|
0cacd64262a0b6a00e313523769224e9edbe1383
|
/Day42-06052018/src/com/sreenu/personmgmt/pojo/PersonPojo.java
|
5f247dcde97795d87fcdf2d2dd730306e0e18a96
|
[] |
no_license
|
sreenu9997/JSEappliws
|
f47eaafd3451267f5db77449344816f23903d8e4
|
d17cd47c599499d88ac89730a48e381fb0c26dfd
|
refs/heads/master
| 2020-03-27T20:43:03.829496 | 2018-09-02T13:47:16 | 2018-09-02T13:47:16 | 147,089,068 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 947 |
java
|
package com.sreenu.personmgmt.pojo;
public class PersonPojo {
private int idperson;
private String pname;
private String qualification;
private int age;
private int parentid;
private PersonPojo parent;
public PersonPojo getParent() {
return parent;
}
public void setParent(PersonPojo parent) {
this.parent = parent;
}
public int getIdperson() {
return idperson;
}
public String getPname() {
return pname;
}
public String getQualification() {
return qualification;
}
public int getAge() {
return age;
}
public int getParentid() {
return parentid;
}
public void setIdperson(int idperson) {
this.idperson = idperson;
}
public void setPname(String pname) {
this.pname = pname;
}
public void setQualification(String qualification) {
this.qualification = qualification;
}
public void setAge(int age) {
this.age = age;
}
public void setParentid(int parentid) {
this.parentid = parentid;
}
}
|
[
"[email protected]"
] | |
35bdba2457f7076c54fec08fe552b9511249a920
|
1264ce4f7240a56b39b99bbfcdf7c59131cac5db
|
/(만들면서 이해하는) 안드로이드 프로그래밍 입문+활용북 소스 설명이 쉬운 88 예제[4.4 킷캣(KitKat)]/Sample Source/ImageSlideChange/gen/com/example/imageslidechange/BuildConfig.java
|
3b380343d6147197cfda73cbb608c659a5930382
|
[] |
no_license
|
danielkulcsar/webhon
|
7ea0caef64fc7ddec691f809790c5aa1d960635a
|
c6a25cc2fd39dda5907ee1b5cb875a284aa6ce3d
|
refs/heads/master
| 2021-06-23T08:06:48.890022 | 2017-08-27T05:28:19 | 2017-08-27T05:28:19 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 170 |
java
|
/** Automatically generated file. DO NOT MODIFY */
package com.example.imageslidechange;
public final class BuildConfig {
public final static boolean DEBUG = true;
}
|
[
"[email protected]"
] | |
ad7d47a9152ed63a11a25fc44ceb9de4704a55c5
|
d81fd75783d56945382c1382b5f7b6004fe5c309
|
/bonita/trunk/bonita-console/forms/forms-server/src/main/java/org/bonitasoft/forms/server/accessor/impl/EngineApplicationConfigDefAccessorImpl.java
|
3708fedcbdc3fbc76e7215b9a8d7e57250713fe1
|
[] |
no_license
|
sirpentagon/bpm-infufsm
|
51fc76013d60e109550aab1998ca3b44ba7e5bb0
|
bbcff4ef2d7b4383b41ed37a1e7387c5bbefc6dd
|
refs/heads/master
| 2021-01-25T13:11:48.217742 | 2014-04-28T17:06:02 | 2014-04-28T17:06:02 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,853 |
java
|
/**
* Copyright (C) 2011 BonitaSoft S.A.
* BonitaSoft, 31 rue Gustave Eiffel - 38000 Grenoble
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2.0 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.bonitasoft.forms.server.accessor.impl;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bonitasoft.forms.server.accessor.DefaultFormsPropertiesFactory;
import org.bonitasoft.forms.server.accessor.IApplicationConfigDefAccessor;
import org.bonitasoft.forms.server.exception.InvalidFormDefinitionException;
import org.bonitasoft.forms.server.provider.impl.util.FormServiceProviderUtil;
import org.ow2.bonita.facade.QueryDefinitionAPI;
import org.ow2.bonita.facade.def.majorElement.ProcessDefinition;
import org.ow2.bonita.facade.exception.ProcessNotFoundException;
import org.ow2.bonita.facade.uuid.ProcessDefinitionUUID;
import org.ow2.bonita.util.AccessorUtil;
/**
* @author Haojie Yuan
*
*/
public class EngineApplicationConfigDefAccessorImpl implements IApplicationConfigDefAccessor {
/**
* The process definition UUID of the process to which this instance is associated
*/
private final ProcessDefinitionUUID processDefinitionUUID;
/**
* Logger
*/
private static Logger LOGGER = Logger.getLogger(EngineApplicationConfigDefAccessorImpl.class.getName());
/**
* @param processDefinitionUUID The process definition UUID of the process to which this instance is associated. This
* parameter is allowed be null because an instance of this class should be available to retrieve the default
* process template to display error pages
*/
public EngineApplicationConfigDefAccessorImpl(final ProcessDefinitionUUID processDefinitionUUID) {
this.processDefinitionUUID = processDefinitionUUID;
}
/**
* {@inheritDoc}
*/
public String getApplicationErrorTemplate() {
return DefaultFormsPropertiesFactory.getDefaultFormProperties().getPageErrorTemplate();
}
/**
* {@inheritDoc}
*/
public String getApplicationLabel() throws InvalidFormDefinitionException {
final QueryDefinitionAPI queryDefinitionAPI = AccessorUtil.getQueryDefinitionAPI();
try {
String label = null;
if (processDefinitionUUID != null) {
final ProcessDefinition processDefinition = queryDefinitionAPI.getProcess(processDefinitionUUID);
label = processDefinition.getLabel();
if (label == null || label.length() == 0) {
if (LOGGER.isLoggable(Level.SEVERE)) {
LOGGER.log(Level.SEVERE, "application definition label : " + label + " - application name : " + processDefinition.getName());
}
label = processDefinition.getName();
}
}
return label;
} catch (final ProcessNotFoundException e) {
final String message = "application " + processDefinitionUUID + " not found.";
if (LOGGER.isLoggable(Level.SEVERE)) {
LOGGER.log(Level.SEVERE, message, e);
}
throw new InvalidFormDefinitionException(message, e);
}
}
/**
* {@inheritDoc}
*/
public String getApplicationMandatoryLabel() {
return DefaultFormsPropertiesFactory.getDefaultFormProperties().getApplicationMandatoryLabel();
}
/**
* {@inheritDoc}
*/
public String getApplicationMandatorySymbol() {
return DefaultFormsPropertiesFactory.getDefaultFormProperties().getApplicationMandatorySymbol();
}
/**
* {@inheritDoc}
*/
public String getApplicationMandatorySymbolStyle() {
return null;
}
/**
* {@inheritDoc}
*/
public String getApplicationName() throws InvalidFormDefinitionException {
return processDefinitionUUID.getProcessName();
}
/**
* {@inheritDoc}
*/
public String getApplicationVersion() throws InvalidFormDefinitionException {
return processDefinitionUUID.getProcessVersion();
}
/**
* {@inheritDoc}
*/
public String getApplicationLayout() {
return DefaultFormsPropertiesFactory.getDefaultFormProperties().getApplicationLayout();
}
/**
* {@inheritDoc}
*/
public String getApplicationPermissions() {
if (processDefinitionUUID != null) {
return FormServiceProviderUtil.PROCESS_UUID + "#" + processDefinitionUUID.getValue();
}
return null;
}
/**
* {@inheritDoc}
*/
public String getMigrationProductVersion() {
return null;
}
/**
* {@inheritDoc}
*/
public String getExternalWelcomePage() {
return null;
}
/**
* {@inheritDoc}
*/
public String getWelcomePage() {
return null;
}
/**
* {@inheritDoc}
*/
public String getHomePage() {
return null;
}
/**
* {@inheritDoc}
*/
public String getProductVersion() {
return null;
}
}
|
[
"[email protected]"
] | |
7be5fb84a86b15861a3928cd431191a7b207d147
|
6cb9aa1bc44c1ea613f5f92bf578b3064c3c6942
|
/app/src/main/java/com/example/fithub/ui/leaderboard/DashboardViewModel.java
|
75d8ae2afa684908db532ab266deefbf549b007b
|
[] |
no_license
|
Sakshi16/FitHub
|
f12a3fe3b900859d62d10c61861149ecd99730b7
|
e2ce01e5f2a82d7cb3bab1a940ba9f07837b8d5a
|
refs/heads/master
| 2023-04-22T07:08:01.532442 | 2021-05-12T18:22:13 | 2021-05-12T18:22:13 | 355,550,958 | 1 | 3 | null | 2021-05-12T18:22:14 | 2021-04-07T13:14:52 |
Java
|
UTF-8
|
Java
| false | false | 463 |
java
|
package com.example.fithub.ui.leaderboard;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
public class DashboardViewModel extends ViewModel {
private MutableLiveData<String> mText;
public DashboardViewModel() {
mText = new MutableLiveData<>();
mText.setValue("This is dashboard fragment");
}
public LiveData<String> getText() {
return mText;
}
}
|
[
"[email protected]"
] | |
9cff977ef853b27eea0d8b227dce9fa230d819d4
|
47e128c03741c6137bc4305f23f87755f46d1399
|
/java-basic/src/main/java/ch03/Test6.java
|
aa3f726ba77ed76b30e913af8e6cd3c545b04df3
|
[] |
no_license
|
jeajoong/bitcamp-java-2018-12
|
cda916ca6ec02336bf39c374178a3c158faa1a15
|
f10ccbcb498de0d11d02d78b7204fde6ed8e296d
|
refs/heads/master
| 2021-07-25T09:41:30.978244 | 2020-05-07T08:32:54 | 2020-05-07T08:32:54 | 163,650,670 | 0 | 0 | null | 2020-04-30T11:56:40 | 2018-12-31T08:00:40 |
Java
|
UTF-8
|
Java
| false | false | 1,200 |
java
|
//키보드로 입력한 값을 받기
package ch03;
public class Test6 {
public static void main(String[] args) {
//1)키보드의 입력한 데이터를 읽을 때 사용할 도구를 준비한다.
java.io.InputStream in = System.in;
//2)InputStream은 바이트 단위로 읽는 기능이 있다.
// 바이트 단위로 읽어서 int나 문자열로 바꾸려면 또 코딩해야 하는 불편함이 있다
// 이런 불편함을 줄이기 위해 자바에서는 바이트를 개발자가 원하는 값으로
// 바꿔주는 기능을 제공한다.
// 그런 기능이 들어있는 도구가 java.util.Scanner이다.
java.util.Scanner keyboard = new java.util.Scanner(in);
System.out.println("이름을 입력하세요. :");
//3) Scanner에 들어 있는 nextLine()은
// 사용자가 한 줄을 입력할 때까지(LF 코드를 읽을 때까지) 기다리다가
// 한 줄을 입력하면 그 값을 문자열로 만들어 리턴한다.
java.lang.String str = keyboard.nextLine();
// 사용자가 입력한 문자열을 출력한다.
System.out.printf("당신의 이름은 %s입니다.\n", str);
}
}
|
[
"[email protected]"
] | |
ccf369e616bfb667b6d6000053efe8bfeb8ed50b
|
0e4b210de54db995f0ac96142d1f44e9e3ab8778
|
/jueguito/src/vista/HeroeVista.java
|
243b28d52c834d3b4bfed6ca0f4c3d2d6335d3fd
|
[] |
no_license
|
valentinaz0306/Space-Invaders
|
7f17205fb22d492a6540eb291e9cd1b6d841fca0
|
17c8d804ef73a41bee18cf10b670e069224b0273
|
refs/heads/master
| 2021-02-26T22:50:28.525561 | 2020-03-07T06:19:34 | 2020-03-07T06:19:34 | 245,557,523 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 266 |
java
|
package vista;
import processing.core.PApplet;
public class HeroeVista {
private PApplet app;
public HeroeVista(PApplet app) {
this.app = app;
}
public void pintarHeroe(int posX, int posY, int tam) {
app.fill(255,0,0);
app.rect(posX,posY,tam,tam);
}
}
|
[
"[email protected]"
] | |
c7b0e5056fc5bb1c4de383c635682f01915e7bf2
|
45768be3c18206ae3750ec5898d954aade6236c7
|
/mixin-test/src/com/berniecode/mixin4j/test/hello/HelloTestRunner.java
|
37b56ae180bb4d893381c39d54a480a4f26966aa
|
[] |
no_license
|
BernieSumption/mixins-for-java
|
f7a4ee3aedbd2d4cb124092d90c5b709f9e3fbf8
|
2f2396141f05769b453f663134b0194539bd38ce
|
refs/heads/master
| 2016-08-04T08:03:46.128128 | 2015-02-09T18:00:27 | 2015-02-09T18:00:27 | 30,549,742 | 5 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,158 |
java
|
package com.berniecode.mixin4j.test.hello;
import com.berniecode.mixin4j.*;
/**
* <p>Simple test of static and dynamic mixins
*
* @author Bernard Sumption
*/
public class HelloTestRunner {
public static void main(String[] args) throws Exception {
System.out.print("Dynamically mixed northern greeting: ");
// Specify the mixin: apply the GreetingMixin mixin, using NorthernGreeting an an implementation
// to the DynamicallyMixedObject base class
Mixin<DynamicallyMixedObject> mixin = new Mixin<DynamicallyMixedObject>(
GreetingMixin.class, NorthernGreeting.class, DynamicallyMixedObject.class);
// create a mixer and apply the mixin
Factory<? extends DynamicallyMixedObject> factory =
new DynamicProxyMixer().getFactory(DynamicallyMixedObject.class, mixin);
// test it - this should print a northern greeting
DynamicallyMixedObject dmo = factory.newInstance();
dmo.doGreeting();
System.out.print("Statically mixed posh greeting: ");
StaticallyMixedObject smo = MixinSupport.getSingleton().newInstanceOf(StaticallyMixedObject.class);
smo.doGreeting();
}
}
|
[
"[email protected]"
] | |
6019af050a4b87a72fd1da1821656f27f3d21661
|
83deb5c80e12e4b19bb892273303fb2d0bf4d71f
|
/rds/src/test/java/org/jclouds/rds/features/SecurityGroupApiExpectTest.java
|
f7b159ee1e4f4c700d0ffc37ff32faab799bc1b6
|
[
"Apache-2.0"
] |
permissive
|
gaul/jclouds-labs-aws
|
d4b9e1628046a030ee9cb221a365a9dfe13c95c3
|
d429f324bd29edbcecdcee61591fe16a622ccf4c
|
refs/heads/master
| 2021-05-30T22:14:49.729834 | 2013-12-17T19:50:23 | 2013-12-17T19:50:23 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 22,785 |
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.jclouds.rds.features;
import static org.jclouds.rds.options.ListSecurityGroupsOptions.Builder.afterMarker;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull;
import java.util.TimeZone;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
import org.jclouds.rds.RDSApi;
import org.jclouds.rds.internal.BaseRDSApiExpectTest;
import org.jclouds.rds.parse.DescribeDBSecurityGroupsResponseTest;
import org.jclouds.rds.parse.GetSecurityGroupResponseTest;
import org.jclouds.rest.ResourceNotFoundException;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
/**
* @author Adrian Cole
*/
@Test(groups = "unit", testName = "SecurityGroupApiExpectTest")
public class SecurityGroupApiExpectTest extends BaseRDSApiExpectTest {
public SecurityGroupApiExpectTest() {
TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"));
}
public void testCreateWithNameAndDescriptionWhenResponseIs2xx() throws Exception {
HttpRequest create = HttpRequest.builder()
.method("POST")
.endpoint("https://rds.us-east-1.amazonaws.com/")
.addHeader("Host", "rds.us-east-1.amazonaws.com")
.payload(
payloadFromStringWithContentType(
"Action=CreateDBSecurityGroup" +
"&DBSecurityGroupDescription=My%20new%20DBSecurityGroup" +
"&DBSecurityGroupName=mydbsecuritygroup" +
"&Signature=ZJ0F0Y5veTPir5NWc7KhmHp7cYIijAxKQFikPHJzzBI%3D" +
"&SignatureMethod=HmacSHA256" +
"&SignatureVersion=2" +
"&Timestamp=2009-11-08T15%3A54%3A08.897Z" +
"&Version=2012-04-23" +
"&AWSAccessKeyId=identity",
"application/x-www-form-urlencoded"))
.build();
HttpResponse createResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResourceWithContentType("/create_securitygroup.xml", "text/xml")).build();
RDSApi apiWhenExist = requestSendsResponse(create, createResponse);
apiWhenExist.getSecurityGroupApi().createWithNameAndDescription("mydbsecuritygroup", "My new DBSecurityGroup");
}
public void testCreateInVPCWithNameAndDescriptionWhenResponseIs2xx() throws Exception {
HttpRequest create = HttpRequest.builder()
.method("POST")
.endpoint("https://rds.us-east-1.amazonaws.com/")
.addHeader("Host", "rds.us-east-1.amazonaws.com")
.payload(
payloadFromStringWithContentType(
"Action=CreateDBSecurityGroup" +
"&DBSecurityGroupDescription=My%20new%20DBSecurityGroup" +
"&DBSecurityGroupName=mydbsecuritygroup" +
"&EC2VpcId=vpc-1a2b3c4d" +
"&Signature=8MXHQRkGSKb0TzCKRIlDN9ymruqzY/QKgLMXoxYcqFI%3D" +
"&SignatureMethod=HmacSHA256" +
"&SignatureVersion=2" +
"&Timestamp=2009-11-08T15%3A54%3A08.897Z" +
"&Version=2012-04-23" +
"&AWSAccessKeyId=identity",
"application/x-www-form-urlencoded"))
.build();
HttpResponse createResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResourceWithContentType("/create_securitygroup.xml", "text/xml")).build();
RDSApi apiWhenExist = requestSendsResponse(create, createResponse);
apiWhenExist.getSecurityGroupApi().createInVPCWithNameAndDescription("vpc-1a2b3c4d", "mydbsecuritygroup", "My new DBSecurityGroup");
}
HttpRequest get = HttpRequest.builder()
.method("POST")
.endpoint("https://rds.us-east-1.amazonaws.com/")
.addHeader("Host", "rds.us-east-1.amazonaws.com")
.payload(
payloadFromStringWithContentType(
"Action=DescribeDBSecurityGroups" +
"&DBSecurityGroupName=name" +
"&Signature=F019%2B74qM/ivsW6ngZWfILFBss4RqPGlppawtAjwUPg%3D" +
"&SignatureMethod=HmacSHA256" +
"&SignatureVersion=2" +
"&Timestamp=2009-11-08T15%3A54%3A08.897Z" +
"&Version=2012-04-23" +
"&AWSAccessKeyId=identity",
"application/x-www-form-urlencoded"))
.build();
public void testGetWhenResponseIs2xx() throws Exception {
HttpResponse getResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResourceWithContentType("/get_securitygroup.xml", "text/xml")).build();
RDSApi apiWhenExist = requestSendsResponse(
get, getResponse);
assertEquals(apiWhenExist.getSecurityGroupApi().get("name").toString(), new GetSecurityGroupResponseTest().expected().toString());
}
public void testGetWhenResponseIs404() throws Exception {
HttpResponse getResponse = HttpResponse.builder().statusCode(404).build();
RDSApi apiWhenDontExist = requestSendsResponse(
get, getResponse);
assertNull(apiWhenDontExist.getSecurityGroupApi().get("name"));
}
HttpRequest list = HttpRequest.builder()
.method("POST")
.endpoint("https://rds.us-east-1.amazonaws.com/")
.addHeader("Host", "rds.us-east-1.amazonaws.com")
.payload(
payloadFromStringWithContentType(
"Action=DescribeDBSecurityGroups" +
"&Signature=6PMtOHuBCxE/uujPnvn/nN8NIZrwcx9X0Jy6hz/RXtg%3D" +
"&SignatureMethod=HmacSHA256" +
"&SignatureVersion=2" +
"&Timestamp=2009-11-08T15%3A54%3A08.897Z" +
"&Version=2012-04-23" +
"&AWSAccessKeyId=identity",
"application/x-www-form-urlencoded"))
.build();
public void testListWhenResponseIs2xx() throws Exception {
HttpResponse listResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResourceWithContentType("/describe_securitygroups.xml", "text/xml")).build();
RDSApi apiWhenExist = requestSendsResponse(
list, listResponse);
assertEquals(apiWhenExist.getSecurityGroupApi().list().get(0).toString(), new DescribeDBSecurityGroupsResponseTest().expected().toString());
}
public void testList2PagesWhenResponseIs2xx() throws Exception {
HttpResponse listResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResourceWithContentType("/describe_securitygroups_marker.xml", "text/xml")).build();
HttpRequest list2 = HttpRequest.builder()
.method("POST")
.endpoint("https://rds.us-east-1.amazonaws.com/")
.addHeader("Host", "rds.us-east-1.amazonaws.com")
.payload(
payloadFromStringWithContentType(
"Action=DescribeDBSecurityGroups" +
"&Marker=MARKER" +
"&Signature=DeZcA5ViQu/bB3PY9EmRZavRgYxLFMvdbq7topMKKhw%3D" +
"&SignatureMethod=HmacSHA256" +
"&SignatureVersion=2" +
"&Timestamp=2009-11-08T15%3A54%3A08.897Z" +
"&Version=2012-04-23" +
"&AWSAccessKeyId=identity",
"application/x-www-form-urlencoded"))
.build();
HttpResponse list2Response = HttpResponse.builder().statusCode(200)
.payload(payloadFromResourceWithContentType("/describe_securitygroups.xml", "text/xml")).build();
RDSApi apiWhenExist = requestsSendResponses(
list, listResponse, list2, list2Response);
assertEquals(apiWhenExist.getSecurityGroupApi().list().concat().toList(),
ImmutableList.copyOf(Iterables.concat(new DescribeDBSecurityGroupsResponseTest().expected(),
new DescribeDBSecurityGroupsResponseTest().expected())));
}
// TODO: this should really be an empty set
@Test(expectedExceptions = ResourceNotFoundException.class)
public void testListWhenResponseIs404() throws Exception {
HttpResponse listResponse = HttpResponse.builder().statusCode(404).build();
RDSApi apiWhenDontExist = requestSendsResponse(
list, listResponse);
apiWhenDontExist.getSecurityGroupApi().list().get(0);
}
public void testListWithOptionsWhenResponseIs2xx() throws Exception {
HttpRequest listWithOptions =
HttpRequest.builder()
.method("POST")
.endpoint("https://rds.us-east-1.amazonaws.com/")
.addHeader("Host", "rds.us-east-1.amazonaws.com")
.payload(payloadFromStringWithContentType(
"Action=DescribeDBSecurityGroups" +
"&Marker=MARKER" +
"&Signature=DeZcA5ViQu/bB3PY9EmRZavRgYxLFMvdbq7topMKKhw%3D" +
"&SignatureMethod=HmacSHA256" +
"&SignatureVersion=2" +
"&Timestamp=2009-11-08T15%3A54%3A08.897Z" +
"&Version=2012-04-23" +
"&AWSAccessKeyId=identity",
"application/x-www-form-urlencoded"))
.build();
HttpResponse listWithOptionsResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResourceWithContentType("/describe_securitygroups.xml", "text/xml")).build();
RDSApi apiWhenWithOptionsExist = requestSendsResponse(listWithOptions,
listWithOptionsResponse);
assertEquals(apiWhenWithOptionsExist.getSecurityGroupApi().list(afterMarker("MARKER")).toString(),
new DescribeDBSecurityGroupsResponseTest().expected().toString());
}
public void testAuthorizeIngressToIPRangeWhenResponseIs2xx() throws Exception {
HttpRequest authorize = HttpRequest.builder()
.method("POST")
.endpoint("https://rds.us-east-1.amazonaws.com/")
.addHeader("Host", "rds.us-east-1.amazonaws.com")
.payload(
payloadFromStringWithContentType(
"Action=AuthorizeDBSecurityGroupIngress" +
"&CIDRIP=0.0.0.0/0" +
"&DBSecurityGroupName=mydbsecuritygroup" +
"&Signature=Wk06HjnbFH5j/yfguUK6p3ZJU9kpYPgOlN9IGctLVSk%3D" +
"&SignatureMethod=HmacSHA256" +
"&SignatureVersion=2" +
"&Timestamp=2009-11-08T15%3A54%3A08.897Z" +
"&Version=2012-04-23" +
"&AWSAccessKeyId=identity",
"application/x-www-form-urlencoded"))
.build();
HttpResponse authorizeResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResourceWithContentType("/authorize_securitygroup.xml", "text/xml")).build();
RDSApi apiWhenExist = requestSendsResponse(authorize, authorizeResponse);
apiWhenExist.getSecurityGroupApi().authorizeIngressToIPRange("mydbsecuritygroup", "0.0.0.0/0");
}
public void testAuthorizeIngressToEC2SecurityGroupOfOwnerWhenResponseIs2xx() throws Exception {
HttpRequest authorize = HttpRequest.builder()
.method("POST")
.endpoint("https://rds.us-east-1.amazonaws.com/")
.addHeader("Host", "rds.us-east-1.amazonaws.com")
.payload(
payloadFromStringWithContentType(
"Action=AuthorizeDBSecurityGroupIngress" +
"&DBSecurityGroupName=mydbsecuritygroup" +
"&EC2SecurityGroupName=myec2securitygroup" +
"&EC2SecurityGroupOwnerId=054794666394" +
"&Signature=MM%2B8ccK7Mh%2BWLS4qA1NUyOqtkjC1ICXug8wcEyD4a6c%3D" +
"&SignatureMethod=HmacSHA256" +
"&SignatureVersion=2" +
"&Timestamp=2009-11-08T15%3A54%3A08.897Z" +
"&Version=2012-04-23" +
"&AWSAccessKeyId=identity",
"application/x-www-form-urlencoded"))
.build();
HttpResponse authorizeResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResourceWithContentType("/authorize_securitygroup.xml", "text/xml")).build();
RDSApi apiWhenExist = requestSendsResponse(authorize, authorizeResponse);
apiWhenExist.getSecurityGroupApi().authorizeIngressToEC2SecurityGroupOfOwner("mydbsecuritygroup", "myec2securitygroup", "054794666394");
}
public void testAuthorizeIngressToVPCSecurityGroupWhenResponseIs2xx() throws Exception {
HttpRequest authorize = HttpRequest.builder()
.method("POST")
.endpoint("https://rds.us-east-1.amazonaws.com/")
.addHeader("Host", "rds.us-east-1.amazonaws.com")
.payload(
payloadFromStringWithContentType(
"Action=AuthorizeDBSecurityGroupIngress" +
"&DBSecurityGroupName=mydbsecuritygroup" +
"&EC2SecurityGroupId=sg-1312321312" +
"&Signature=o31Wey/wliTbHJoxdF7KGqIJwSM6pfqzkjIYio3XNGs%3D" +
"&SignatureMethod=HmacSHA256" +
"&SignatureVersion=2" +
"&Timestamp=2009-11-08T15%3A54%3A08.897Z" +
"&Version=2012-04-23" +
"&AWSAccessKeyId=identity",
"application/x-www-form-urlencoded"))
.build();
HttpResponse authorizeResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResourceWithContentType("/authorize_securitygroup.xml", "text/xml")).build();
RDSApi apiWhenExist = requestSendsResponse(authorize, authorizeResponse);
apiWhenExist.getSecurityGroupApi().authorizeIngressToVPCSecurityGroup("mydbsecuritygroup", "sg-1312321312");
}
public void testRevokeIngressFromIPRangeWhenResponseIs2xx() throws Exception {
HttpRequest revoke = HttpRequest.builder()
.method("POST")
.endpoint("https://rds.us-east-1.amazonaws.com/")
.addHeader("Host", "rds.us-east-1.amazonaws.com")
.payload(
payloadFromStringWithContentType(
"Action=RevokeDBSecurityGroupIngress" +
"&CIDRIP=0.0.0.0/0" +
"&DBSecurityGroupName=mydbsecuritygroup" +
"&Signature=YD1%2BzKmoWyYCmqWq1X9f/Vj6UC7UnkwkPf%2BA5urnz%2BE%3D" +
"&SignatureMethod=HmacSHA256" +
"&SignatureVersion=2" +
"&Timestamp=2009-11-08T15%3A54%3A08.897Z" +
"&Version=2012-04-23" +
"&AWSAccessKeyId=identity",
"application/x-www-form-urlencoded"))
.build();
HttpResponse revokeResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResourceWithContentType("/revoke_securitygroup.xml", "text/xml")).build();
RDSApi apiWhenExist = requestSendsResponse(revoke, revokeResponse);
apiWhenExist.getSecurityGroupApi().revokeIngressFromIPRange("mydbsecuritygroup", "0.0.0.0/0");
}
public void testRevokeIngressFromEC2SecurityGroupOfOwnerWhenResponseIs2xx() throws Exception {
HttpRequest revoke = HttpRequest.builder()
.method("POST")
.endpoint("https://rds.us-east-1.amazonaws.com/")
.addHeader("Host", "rds.us-east-1.amazonaws.com")
.payload(
payloadFromStringWithContentType(
"Action=RevokeDBSecurityGroupIngress" +
"&DBSecurityGroupName=mydbsecuritygroup" +
"&EC2SecurityGroupName=myec2securitygroup" +
"&EC2SecurityGroupOwnerId=054794666394" +
"&Signature=OknWXceQDAgmZBNzDdhxjaOJI48hYrnFJDOySBc4Qy4%3D" +
"&SignatureMethod=HmacSHA256" +
"&SignatureVersion=2" +
"&Timestamp=2009-11-08T15%3A54%3A08.897Z" +
"&Version=2012-04-23" +
"&AWSAccessKeyId=identity",
"application/x-www-form-urlencoded"))
.build();
HttpResponse revokeResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResourceWithContentType("/revoke_securitygroup.xml", "text/xml")).build();
RDSApi apiWhenExist = requestSendsResponse(revoke, revokeResponse);
apiWhenExist.getSecurityGroupApi().revokeIngressFromEC2SecurityGroupOfOwner("mydbsecuritygroup", "myec2securitygroup", "054794666394");
}
public void testRevokeIngressFromVPCSecurityGroupWhenResponseIs2xx() throws Exception {
HttpRequest revoke = HttpRequest.builder()
.method("POST")
.endpoint("https://rds.us-east-1.amazonaws.com/")
.addHeader("Host", "rds.us-east-1.amazonaws.com")
.payload(
payloadFromStringWithContentType(
"Action=RevokeDBSecurityGroupIngress" +
"&DBSecurityGroupName=mydbsecuritygroup" +
"&EC2SecurityGroupId=sg-1312321312" +
"&Signature=YI2oGYI%2BCx4DGYx43WH/ehW6CWe6X6wEipsp5zPySzw%3D" +
"&SignatureMethod=HmacSHA256" +
"&SignatureVersion=2" +
"&Timestamp=2009-11-08T15%3A54%3A08.897Z" +
"&Version=2012-04-23" +
"&AWSAccessKeyId=identity",
"application/x-www-form-urlencoded"))
.build();
HttpResponse revokeResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResourceWithContentType("/revoke_securitygroup.xml", "text/xml")).build();
RDSApi apiWhenExist = requestSendsResponse(revoke, revokeResponse);
apiWhenExist.getSecurityGroupApi().revokeIngressFromVPCSecurityGroup("mydbsecuritygroup", "sg-1312321312");
}
HttpRequest delete = HttpRequest.builder()
.method("POST")
.endpoint("https://rds.us-east-1.amazonaws.com/")
.addHeader("Host", "rds.us-east-1.amazonaws.com")
.payload(
payloadFromStringWithContentType(
"Action=DeleteDBSecurityGroup" +
"&DBSecurityGroupName=name" +
"&Signature=7lQqK7wJUuc7nONYnXdHVibudxqnfJPFrfdnzwEEKxE%3D" +
"&SignatureMethod=HmacSHA256" +
"&SignatureVersion=2" +
"&Timestamp=2009-11-08T15%3A54%3A08.897Z" +
"&Version=2012-04-23" +
"&AWSAccessKeyId=identity",
"application/x-www-form-urlencoded"))
.build();
public void testDeleteWhenResponseIs2xx() throws Exception {
HttpResponse deleteResponse = HttpResponse.builder().statusCode(200).build();
RDSApi apiWhenExist = requestSendsResponse(delete, deleteResponse);
apiWhenExist.getSecurityGroupApi().delete("name");
}
public void testDeleteWhenResponseIs404() throws Exception {
HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build();
RDSApi apiWhenDontExist = requestSendsResponse(delete, deleteResponse);
apiWhenDontExist.getSecurityGroupApi().delete("name");
}
}
|
[
"[email protected]"
] | |
36dc36e09caef8a000e7bbdf3d03ef632e146f17
|
bc4608494c455234af5d28820580574944e42f85
|
/app/src/androidTest/java/sg/edu/rp/c346/id20011066/demosimpleclick/ExampleInstrumentedTest.java
|
d914ffa7c46067a333ee81c1d83e602207723d1b
|
[] |
no_license
|
2108Sharan/Demo_Simple_Click
|
1926d26fe9a2c751b46911ec925ef42542f0424f
|
0f3291abf8d623e1e5957fca86fb6e42c8917bd0
|
refs/heads/master
| 2023-04-18T12:04:44.229989 | 2021-05-03T03:58:26 | 2021-05-03T03:58:26 | 363,811,109 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 796 |
java
|
package sg.edu.rp.c346.id20011066.demosimpleclick;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.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.getInstrumentation().getTargetContext();
assertEquals("sg.edu.rp.c346.id20011066.demosimpleclick", appContext.getPackageName());
}
}
|
[
"[email protected]"
] | |
7685823fc943d460d1a4abd0e52b3a597cd5f81b
|
4fa9db2d2ab4730ee1e885f26ddcb5781e7a7b22
|
/SpringBoot系列/01-整合MyBatis-Plus/demo-plus/src/main/java/com/zhengqing/demo/Application.java
|
2bb395d0bb59a3014c3eaeeda31c5971389723a2
|
[
"MIT"
] |
permissive
|
zhengqingya/java-workspace
|
f55c33431ae5b2cdf3eefdeec1faa9a4899571f2
|
1b3843dd0d6da2a6ee850f6f8466b37fd9d82ec7
|
refs/heads/master
| 2023-08-09T02:51:26.062628 | 2023-07-18T07:58:59 | 2023-07-18T07:58:59 | 233,746,185 | 30 | 24 |
MIT
| 2023-07-23T02:45:03 | 2020-01-14T03:14:52 |
Java
|
UTF-8
|
Java
| false | false | 311 |
java
|
package com.zhengqing.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
|
[
"[email protected]"
] | |
b4e967162e2e385aa84b05cceccf6636280ee8d6
|
3343050b340a8594d802598cddfd0d8709ccc45a
|
/src/share/classes/javax/security/auth/callback/NameCallback.java
|
3dd380dc57b9a1e6dfe8db792351450e379c4dd4
|
[
"Apache-2.0"
] |
permissive
|
lcyanxi/jdk8
|
be07ce687ca610c9e543bf3c1168be8228c1f2b3
|
4f4c2d72670a30dafaf9bb09b908d4da79119cf6
|
refs/heads/master
| 2022-05-25T18:11:28.236578 | 2022-05-03T15:28:01 | 2022-05-03T15:28:01 | 228,209,646 | 0 | 0 |
Apache-2.0
| 2022-05-03T15:28:03 | 2019-12-15T15:49:24 |
Java
|
UTF-8
|
Java
| false | false | 4,110 |
java
|
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javax.security.auth.callback;
/**
* <p> Underlying security services instantiate and pass a
* {@code NameCallback} to the {@code handle}
* method of a {@code CallbackHandler} to retrieve name information.
*
* @see javax.security.auth.callback.CallbackHandler
*/
public class NameCallback implements Callback, java.io.Serializable {
private static final long serialVersionUID = 3770938795909392253L;
/**
* @serial
* @since 1.4
*/
private String prompt;
/**
* @serial
* @since 1.4
*/
private String defaultName;
/**
* @serial
* @since 1.4
*/
private String inputName;
/**
* Construct a {@code NameCallback} with a prompt.
*
* <p>
*
* @param prompt the prompt used to request the name.
*
* @exception IllegalArgumentException if {@code prompt} is null
* or if {@code prompt} has a length of 0.
*/
public NameCallback(String prompt) {
if (prompt == null || prompt.length() == 0)
throw new IllegalArgumentException();
this.prompt = prompt;
}
/**
* Construct a {@code NameCallback} with a prompt
* and default name.
*
* <p>
*
* @param prompt the prompt used to request the information. <p>
*
* @param defaultName the name to be used as the default name displayed
* with the prompt.
*
* @exception IllegalArgumentException if {@code prompt} is null,
* if {@code prompt} has a length of 0,
* if {@code defaultName} is null,
* or if {@code defaultName} has a length of 0.
*/
public NameCallback(String prompt, String defaultName) {
if (prompt == null || prompt.length() == 0 ||
defaultName == null || defaultName.length() == 0)
throw new IllegalArgumentException();
this.prompt = prompt;
this.defaultName = defaultName;
}
/**
* Get the prompt.
*
* <p>
*
* @return the prompt.
*/
public String getPrompt() {
return prompt;
}
/**
* Get the default name.
*
* <p>
*
* @return the default name, or null if this {@code NameCallback}
* was not instantiated with a {@code defaultName}.
*/
public String getDefaultName() {
return defaultName;
}
/**
* Set the retrieved name.
*
* <p>
*
* @param name the retrieved name (which may be null).
*
* @see #getName
*/
public void setName(String name) {
this.inputName = name;
}
/**
* Get the retrieved name.
*
* <p>
*
* @return the retrieved name (which may be null)
*
* @see #setName
*/
public String getName() {
return inputName;
}
}
|
[
"[email protected]"
] | |
dfa564ab6e0734401fb6f961ed2939e58976b7ae
|
e4f10e6260fc0c1facb7730abc2811dc77da2872
|
/spring-web/src/main/java/org/springframework/remoting/jaxws/AbstractJaxWsServiceExporter.java
|
722fbd8d75c258e2a220339f779a2122ab8e050a
|
[
"Apache-2.0"
] |
permissive
|
aJavaBird/spring-framework
|
e3cc12707874628a12f475aa2e86934437910a2a
|
78cb31e8b495a5fc2779efa183875b55954499b6
|
refs/heads/master
| 2023-08-06T08:16:20.937745 | 2021-10-10T11:35:23 | 2021-10-10T11:35:23 | 397,800,769 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 6,985 |
java
|
/*
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.remoting.jaxws;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Executor;
import javax.jws.WebService;
import javax.xml.ws.Endpoint;
import javax.xml.ws.WebServiceFeature;
import javax.xml.ws.WebServiceProvider;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.CannotLoadBeanClassException;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.ListableBeanFactory;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
* Abstract exporter for JAX-WS services, autodetecting annotated service beans
* (through the JAX-WS {@link javax.jws.WebService} annotation).
*
* <p>Subclasses need to implement the {@link #publishEndpoint} template methods
* for actual endpoint exposure.
*
* @author Juergen Hoeller
* @since 2.5.5
* @see javax.jws.WebService
* @see javax.xml.ws.Endpoint
* @see SimpleJaxWsServiceExporter
*/
public abstract class AbstractJaxWsServiceExporter implements BeanFactoryAware, InitializingBean, DisposableBean {
@Nullable
private Map<String, Object> endpointProperties;
@Nullable
private Executor executor;
@Nullable
private String bindingType;
@Nullable
private WebServiceFeature[] endpointFeatures;
@Nullable
private ListableBeanFactory beanFactory;
private final Set<Endpoint> publishedEndpoints = new LinkedHashSet<>();
/**
* Set the property bag for the endpoint, including properties such as
* "javax.xml.ws.wsdl.service" or "javax.xml.ws.wsdl.port".
* @see javax.xml.ws.Endpoint#setProperties
* @see javax.xml.ws.Endpoint#WSDL_SERVICE
* @see javax.xml.ws.Endpoint#WSDL_PORT
*/
public void setEndpointProperties(Map<String, Object> endpointProperties) {
this.endpointProperties = endpointProperties;
}
/**
* Set the JDK concurrent executor to use for dispatching incoming requests
* to exported service instances.
* @see javax.xml.ws.Endpoint#setExecutor
*/
public void setExecutor(Executor executor) {
this.executor = executor;
}
/**
* Specify the binding type to use, overriding the value of
* the JAX-WS {@link javax.xml.ws.BindingType} annotation.
*/
public void setBindingType(String bindingType) {
this.bindingType = bindingType;
}
/**
* Specify WebServiceFeature objects (e.g. as inner bean definitions)
* to apply to JAX-WS endpoint creation.
* @since 4.0
*/
public void setEndpointFeatures(WebServiceFeature... endpointFeatures) {
this.endpointFeatures = endpointFeatures;
}
/**
* Obtains all web service beans and publishes them as JAX-WS endpoints.
*/
@Override
public void setBeanFactory(BeanFactory beanFactory) {
if (!(beanFactory instanceof ListableBeanFactory)) {
throw new IllegalStateException(getClass().getSimpleName() + " requires a ListableBeanFactory");
}
this.beanFactory = (ListableBeanFactory) beanFactory;
}
/**
* Immediately publish all endpoints when fully configured.
* @see #publishEndpoints()
*/
@Override
public void afterPropertiesSet() throws Exception {
publishEndpoints();
}
/**
* Publish all {@link javax.jws.WebService} annotated beans in the
* containing BeanFactory.
* @see #publishEndpoint
*/
public void publishEndpoints() {
Assert.state(this.beanFactory != null, "No BeanFactory set");
Set<String> beanNames = new LinkedHashSet<>(this.beanFactory.getBeanDefinitionCount());
Collections.addAll(beanNames, this.beanFactory.getBeanDefinitionNames());
if (this.beanFactory instanceof ConfigurableBeanFactory) {
Collections.addAll(beanNames, ((ConfigurableBeanFactory) this.beanFactory).getSingletonNames());
}
for (String beanName : beanNames) {
try {
Class<?> type = this.beanFactory.getType(beanName);
if (type != null && !type.isInterface()) {
WebService wsAnnotation = type.getAnnotation(WebService.class);
WebServiceProvider wsProviderAnnotation = type.getAnnotation(WebServiceProvider.class);
if (wsAnnotation != null || wsProviderAnnotation != null) {
Endpoint endpoint = createEndpoint(this.beanFactory.getBean(beanName));
if (this.endpointProperties != null) {
endpoint.setProperties(this.endpointProperties);
}
if (this.executor != null) {
endpoint.setExecutor(this.executor);
}
if (wsAnnotation != null) {
publishEndpoint(endpoint, wsAnnotation);
}
else {
publishEndpoint(endpoint, wsProviderAnnotation);
}
this.publishedEndpoints.add(endpoint);
}
}
}
catch (CannotLoadBeanClassException ex) {
// ignore beans where the class is not resolvable
}
}
}
/**
* Create the actual Endpoint instance.
* @param bean the service object to wrap
* @return the Endpoint instance
* @see Endpoint#create(Object)
* @see Endpoint#create(String, Object)
*/
protected Endpoint createEndpoint(Object bean) {
return (this.endpointFeatures != null ?
Endpoint.create(this.bindingType, bean, this.endpointFeatures) :
Endpoint.create(this.bindingType, bean));
}
/**
* Actually publish the given endpoint. To be implemented by subclasses.
* @param endpoint the JAX-WS Endpoint object
* @param annotation the service bean's WebService annotation
*/
protected abstract void publishEndpoint(Endpoint endpoint, WebService annotation);
/**
* Actually publish the given provider endpoint. To be implemented by subclasses.
* @param endpoint the JAX-WS Provider Endpoint object
* @param annotation the service bean's WebServiceProvider annotation
*/
protected abstract void publishEndpoint(Endpoint endpoint, WebServiceProvider annotation);
/**
* Stops all published endpoints, taking the web services offline.
*/
@Override
public void destroy() {
for (Endpoint endpoint : this.publishedEndpoints) {
endpoint.stop();
}
}
}
|
[
"[email protected]"
] | |
d3e15065c43b2a78d8ddf274d02feec2eff30d15
|
fa714f553961379bc41ceb0f09ccb27a84ecf3be
|
/src/test/java/com/sbr/userapi/test/JsonUtils.java
|
7b67d4232d50a1b4505f8ce978dc996757cc73ff
|
[] |
no_license
|
sbrouet/userapi
|
830cf6f43a173774b9118edc156de93e370715c2
|
fda559c9fb861f13842a63fab53d2cdeb6b92609
|
refs/heads/master
| 2022-12-05T22:53:04.850376 | 2020-08-25T11:53:39 | 2020-08-25T11:53:39 | 276,886,766 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 426 |
java
|
package com.sbr.userapi.test;
import java.io.IOException;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
public class JsonUtils {
public static byte[] toJson(Object object) throws IOException {
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
return mapper.writeValueAsBytes(object);
}
}
|
[
"[email protected]"
] | |
bb0e94e7c2df918a221ffc9db681955a615466f1
|
171e134bcbb2d5d5b6e9f54b5c788e7f26afc39e
|
/pinyougou-sellergoods-service/src/main/java/com/pinyougou/sellergoods/service/impl/TypeTemplateServiceImpl.java
|
689462666f723741d74ad9b83030e7f44b78b2b9
|
[] |
no_license
|
godLiuli/pinyougou-parent
|
6b0f7fa44b92670b8c7a1055c4529ba0bf2475be
|
ceb774691ba06fe9ea21e8ba67ef50496d55579b
|
refs/heads/master
| 2020-05-03T03:34:29.205164 | 2019-03-30T09:16:06 | 2019-03-30T09:16:11 | 178,401,598 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,186 |
java
|
package com.pinyougou.sellergoods.service.impl;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.dubbo.config.annotation.Service;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.pinyougou.mapper.TbSpecificationOptionMapper;
import com.pinyougou.mapper.TbTypeTemplateMapper;
import com.pinyougou.pojo.TbSpecificationOption;
import com.pinyougou.pojo.TbSpecificationOptionExample;
import com.pinyougou.pojo.TbTypeTemplate;
import com.pinyougou.pojo.TbTypeTemplateExample;
import com.pinyougou.pojo.TbTypeTemplateExample.Criteria;
import com.pinyougou.sellergoods.service.TypeTemplateService;
import entity.PageResult;
/**
* 服务实现层
* @author Administrator
*
*/
@Service
@Transactional
public class TypeTemplateServiceImpl implements TypeTemplateService {
@Autowired
private TbTypeTemplateMapper typeTemplateMapper;
@Autowired
private TbSpecificationOptionMapper specificationOptionMapper;
@Autowired
private RedisTemplate redisTemplate;
/**
* 查询全部
*/
@Override
public List<TbTypeTemplate> findAll() {
return typeTemplateMapper.selectByExample(null);
}
/**
* 按分页查询
*/
@Override
public PageResult findPage(int pageNum, int pageSize) {
PageHelper.startPage(pageNum, pageSize);
Page<TbTypeTemplate> page= (Page<TbTypeTemplate>) typeTemplateMapper.selectByExample(null);
return new PageResult(page.getTotal(), page.getResult());
}
/**
* 增加
*/
@Override
public void add(TbTypeTemplate typeTemplate) {
typeTemplateMapper.insert(typeTemplate);
}
/**
* 修改
*/
@Override
public void update(TbTypeTemplate typeTemplate){
typeTemplateMapper.updateByPrimaryKey(typeTemplate);
}
/**
* 根据ID获取实体
* @param id
* @return
*/
@Override
public TbTypeTemplate findOne(Long id){
return typeTemplateMapper.selectByPrimaryKey(id);
}
/**
* 批量删除
*/
@Override
public void delete(Long[] ids) {
for(Long id:ids){
typeTemplateMapper.deleteByPrimaryKey(id);
}
}
@Override
public PageResult findPage(TbTypeTemplate typeTemplate, int pageNum, int pageSize) {
PageHelper.startPage(pageNum, pageSize);
TbTypeTemplateExample example=new TbTypeTemplateExample();
Criteria criteria = example.createCriteria();
if(typeTemplate!=null){
if(typeTemplate.getName()!=null && typeTemplate.getName().length()>0){
criteria.andNameLike("%"+typeTemplate.getName()+"%");
}
if(typeTemplate.getSpecIds()!=null && typeTemplate.getSpecIds().length()>0){
criteria.andSpecIdsLike("%"+typeTemplate.getSpecIds()+"%");
}
if(typeTemplate.getBrandIds()!=null && typeTemplate.getBrandIds().length()>0){
criteria.andBrandIdsLike("%"+typeTemplate.getBrandIds()+"%");
}
if(typeTemplate.getCustomAttributeItems()!=null && typeTemplate.getCustomAttributeItems().length()>0){
criteria.andCustomAttributeItemsLike("%"+typeTemplate.getCustomAttributeItems()+"%");
}
}
Page<TbTypeTemplate> page= (Page<TbTypeTemplate>)typeTemplateMapper.selectByExample(example);
saveToRedis(); //把品牌和规格列表存入缓存中 {"itemCat":[],"brandList":[],specList:[]}
return new PageResult(page.getTotal(), page.getResult());
}
@Override
public List<Map> selectOptionTemp() {
return typeTemplateMapper.selectOptionTemp();
}
@Override
public List<Map> findSpecList(Long id) {
TbTypeTemplate typeTemplate = typeTemplateMapper.selectByPrimaryKey(id);//获取指定id的模板对象
//[{"id":1,"text":"联想"},{"id":3,"text":"三星"}]
//String brandIds = template.getBrandIds();
//List<Map> list = JSON.parseArray(brandIds, Map.class) ;
List<Map> list = JSON.parseArray(typeTemplate.getSpecIds(), Map.class);
for(Map map:list) {
//规格id
Long specId = new Long((Integer)map.get("id"));
TbSpecificationOptionExample example = new TbSpecificationOptionExample();
com.pinyougou.pojo.TbSpecificationOptionExample.Criteria criteria = example.createCriteria();
criteria.andSpecIdEqualTo(specId);
//获取对应id规格的 规格列表
List<TbSpecificationOption> option = specificationOptionMapper.selectByExample(example);
map.put("options", option);
}
return list;
}
/**
* 把品牌和规格列表存入缓存中 {"itemCat":[],"brandList":[],specList:[]}
*/
private void saveToRedis() {
//获取模板集合
List<TbTypeTemplate> list = findAll();
for (TbTypeTemplate typeTemplate : list) {
//1.品牌-存入缓存中
List<Map> brandList = JSON.parseArray(typeTemplate.getBrandIds(), Map.class);
redisTemplate.boundHashOps("brandList").put(typeTemplate.getId(), brandList);
//2.规格列表-存入缓存中
List<Map> specList = findSpecList(typeTemplate.getId());
redisTemplate.boundHashOps("specList").put(typeTemplate.getId(), specList);
System.out.println("更新品牌和规格列表缓存。。。");
}
}
}
|
[
"[email protected]"
] | |
28685b68fd5a3bc9c172c9c6b5b746bb24f979da
|
30409671fac423525c81b4c11289d20fe5e78fa4
|
/app/src/main/java/com/apporiotaxi/techbangla/getipaddressretrofit/Common.java
|
7922aae912ebcb73fa8f0b0355cff2c689deab2f
|
[] |
no_license
|
emonm/GetIPAddressRetrofit
|
543fc6073e335b984a6c00297f51320c2bde0aa6
|
6fe447e81d291d2012dad1e57d17f2b624198a28
|
refs/heads/master
| 2021-08-23T14:45:23.250232 | 2017-12-05T08:40:20 | 2017-12-05T08:40:20 | 113,155,663 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 471 |
java
|
package com.apporiotaxi.techbangla.getipaddressretrofit;
import com.apporiotaxi.techbangla.getipaddressretrofit.Remote.IpService;
import com.apporiotaxi.techbangla.getipaddressretrofit.Remote.RetrofitClient;
/**
* Created by emon on 11/29/2017.
*/
public class Common {
private static final String BASE_URL="http://ip.jsontest.com/";
public static IpService getIpService(){
return RetrofitClient.getClient(BASE_URL).create(IpService.class);
}
}
|
[
"[email protected]"
] | |
02f36507ca72c7893624f8ef61bcd84dc7102179
|
66220fbb2b7d99755860cecb02d2e02f946e0f23
|
/src/net/sourceforge/plantuml/cucadiagram/UnparsableGraphvizException.java
|
8e7b058f81d53e6423cd6bc675860c26ce71a0f1
|
[
"MIT"
] |
permissive
|
isabella232/plantuml-mit
|
27e7c73143241cb13b577203673e3882292e686e
|
63b2bdb853174c170f304bc56f97294969a87774
|
refs/heads/master
| 2022-11-09T00:41:48.471405 | 2020-06-28T12:42:10 | 2020-06-28T12:42:10 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,360 |
java
|
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: https://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* Licensed under The MIT License (Massachusetts Institute of Technology License)
*
* See http://opensource.org/licenses/MIT
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
* IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*
* Original Author: Arnaud Roques
*/
package net.sourceforge.plantuml.cucadiagram;
public class UnparsableGraphvizException extends RuntimeException {
private final String graphvizVersion;
private final String svg;
private final String diagramSource;
public UnparsableGraphvizException(Exception cause, String graphvizVersion, String svg, String diagramSource) {
super(cause);
this.graphvizVersion = graphvizVersion;
this.svg = svg;
this.diagramSource = diagramSource;
}
public String getGraphvizVersion() {
return graphvizVersion;
}
public final String getDebugData() {
return "SVG=" + svg + "\r\nDIAGRAM=" + diagramSource;
}
}
|
[
"[email protected]"
] | |
6f31f3c5398005318fb7c27a0501cdd20a03fafb
|
0d2a29b502090476eeda5f5d5f047a1e712224a0
|
/sunshine/src/main/java/cn/study/nio/TestBuffer.java
|
3c7e4777ba9d21a1a40730edbfaffb413dfef147
|
[] |
no_license
|
sxydxg/javaStudy
|
c2b10688cd1f2c275199ba1247ead89101f5c69b
|
236e6b78abcdb2afd40195ccdee8d25532b65ac6
|
refs/heads/master
| 2021-09-21T15:29:46.156878 | 2018-08-28T14:36:55 | 2018-08-28T14:36:55 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,253 |
java
|
package cn.study.nio;
import java.nio.ByteBuffer;
import org.junit.Test;
/*
* 一、缓冲区(Buffer):在 Java NIO 中负责数据的存取。缓冲区就是数组。用于存储不同数据类型的数据
*
* 根据数据类型不同(boolean 除外),提供了相应类型的缓冲区:
* ByteBuffer
* CharBuffer
* ShortBuffer
* IntBuffer
* LongBuffer
* FloatBuffer
* DoubleBuffer
*
* 上述缓冲区的管理方式几乎一致,通过 allocate() 获取缓冲区
*
* 二、缓冲区存取数据的两个核心方法:
* put() : 存入数据到缓冲区中
* get() : 获取缓冲区中的数据
*
* 三、缓冲区中的四个核心属性:
* capacity : 容量,表示缓冲区中最大存储数据的容量。一旦声明不能改变。
* limit : 界限,表示缓冲区中可以操作数据的大小。(limit 后数据不能进行读写)
* position : 位置,表示缓冲区中正在操作数据的位置。
*
* mark : 标记,表示记录当前 position 的位置。可以通过 reset() 恢复到 mark 的位置
*
* 0 <= mark <= position <= limit <= capacity
*
* 四、直接缓冲区与非直接缓冲区:
* 非直接缓冲区:通过 allocate() 方法分配缓冲区,将缓冲区建立在 JVM 的内存中
* 直接缓冲区:通过 allocateDirect() 方法分配直接缓冲区,将缓冲区建立在物理内存中。可以提高效率
*/
public class TestBuffer {
@Test
public void test3(){
//分配直接缓冲区
ByteBuffer buf = ByteBuffer.allocateDirect(1024);
System.out.println(buf.isDirect());
}
@Test
public void test2(){
String str = "abcde";
ByteBuffer buf = ByteBuffer.allocate(1024);
buf.put(str.getBytes());
buf.flip();
byte[] dst = new byte[buf.limit()];
buf.get(dst, 0, 2);
System.out.println(new String(dst, 0, 2));
System.out.println(buf.position());
//mark() : 标记
buf.mark();
buf.get(dst, 2, 2);
System.out.println(new String(dst, 2, 2));
System.out.println(buf.position());
//reset() : 恢复到 mark 的位置
buf.reset();
System.out.println(buf.position());
//判断缓冲区中是否还有剩余数据
if(buf.hasRemaining()){
//获取缓冲区中可以操作的数量
System.out.println(buf.remaining());
}
}
@Test
public void test1(){
String str = "abcde";
//1. 分配一个指定大小的缓冲区
ByteBuffer buf = ByteBuffer.allocate(1024);
System.out.println("-----------------allocate()----------------");
System.out.println(buf.position());
System.out.println(buf.limit());
System.out.println(buf.capacity());
//2. 利用 put() 存入数据到缓冲区中
buf.put(str.getBytes());
System.out.println("-----------------put()----------------");
System.out.println(buf.position());
System.out.println(buf.limit());
System.out.println(buf.capacity());
//3. 切换读取数据模式
buf.flip();
System.out.println("-----------------flip()----------------");
System.out.println(buf.position());
System.out.println(buf.limit());
System.out.println(buf.capacity());
//4. 利用 get() 读取缓冲区中的数据
byte[] dst = new byte[buf.limit()];
buf.get(dst);
System.out.println(new String(dst, 0, dst.length));
System.out.println("-----------------get()----------------");
System.out.println(buf.position());
System.out.println(buf.limit());
System.out.println(buf.capacity());
//5. rewind() : 可重复读
buf.rewind();
System.out.println("-----------------rewind()----------------");
System.out.println(buf.position());
System.out.println(buf.limit());
System.out.println(buf.capacity());
//6. clear() : 清空缓冲区. 但是缓冲区中的数据依然存在,但是处于“被遗忘”状态
buf.clear();
System.out.println("-----------------clear()----------------");
System.out.println(buf.position());
System.out.println(buf.limit());
System.out.println(buf.capacity());
System.out.println((char)buf.get());
}
}
|
[
"[email protected]"
] | |
4852401f60d843f0c2518348385be16267fa489f
|
52b24546ecd6e103437c7ba70d60917306af7bd7
|
/web/src/main/java/com/jeesite/modules/mc/service/McPlantgalleryService.java
|
fb9a8b63ce9a0eaeb0811fbb25e7da3ef7c42a81
|
[] |
no_license
|
weizilong0611/mccode
|
895a823c5de73c13b8e6f555cd9a92410d95b0e4
|
7021ed23f9d094d30a4100f9aef65068758c8d8b
|
refs/heads/main
| 2023-04-26T17:33:52.643600 | 2021-04-22T03:51:29 | 2021-04-22T03:51:29 | 359,997,778 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,842 |
java
|
/**
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
*/
package com.jeesite.modules.mc.service;
import java.util.List;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.jeesite.common.entity.Page;
import com.jeesite.common.service.QCrudService;
import com.jeesite.modules.mc.entity.McPlantgallery;
import com.jeesite.modules.mc.dao.McPlantgalleryDao;
import com.jeesite.modules.file.utils.FileUploadUtils;
/**
* 植物图册Service
* @author 阿
* @version 2020-09-16
*/
@Service
@Transactional(readOnly=true)
public class McPlantgalleryService extends QCrudService<McPlantgalleryDao, McPlantgallery> {
/**
* 获取单条数据
* @param mcPlantgallery
* @return
*/
@Override
public McPlantgallery get(McPlantgallery mcPlantgallery) {
return super.get(mcPlantgallery);
}
/**
* 查询分页数据
* @param page 分页对象
* @param mcPlantgallery
* @return
*/
@Override
public Page<McPlantgallery> findPage(Page<McPlantgallery> page, McPlantgallery mcPlantgallery) {
return super.findPage(page, mcPlantgallery);
}
/**
* 保存数据(插入或更新)
* @param mcPlantgallery
*/
@Override
@Transactional(readOnly=false)
public void save(McPlantgallery mcPlantgallery) {
super.save(mcPlantgallery);
// 保存上传图片
FileUploadUtils.saveFileUpload(mcPlantgallery.getId(), "mcPlantgallery_image");
}
/**
* 更新状态
* @param mcPlantgallery
*/
@Override
@Transactional(readOnly=false)
public void updateStatus(McPlantgallery mcPlantgallery) {
super.updateStatus(mcPlantgallery);
}
/**
* 删除数据
* @param mcPlantgallery
*/
@Override
@Transactional(readOnly=false)
public void delete(McPlantgallery mcPlantgallery) {
super.delete(mcPlantgallery);
}
}
|
[
"[email protected]"
] | |
34be5748c20f8d7bec9b7b66678bdaf104827114
|
76f3f97eea31c6993b2d9ab2739e8858d8a3fe6e
|
/libmc/src/main/java/com/kiun/modelcommonsupport/ui/views/ActionView.java
|
788dc8f18563628042e0da933ea04275eb5e48d7
|
[] |
no_license
|
shanghaif/o2o-android-app
|
4309dc88047ca16c7ae0bc2477e420070bcb486a
|
a883287a00d91c62eee4d7d5847b544828402973
|
refs/heads/master
| 2022-03-04T08:35:58.649521 | 2019-11-04T07:40:35 | 2019-11-04T07:42:00 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 291 |
java
|
package com.kiun.modelcommonsupport.ui.views;
/**
* Created by kiun_2007 on 2018/4/17.
* 有动作的View.
*/
public interface ActionView<T extends EventListener> {
/**
* 设置事件监听器.
* @param listener 监听器.
*/
void setEventListener(T listener);
}
|
[
"[email protected]"
] | |
7ce067f5eb1c6566a4d663cc00ffd1e762a373ea
|
6aa0a9a0333c9aeb5b0cbaa000122ee7d597be55
|
/app/src/main/java/com/john/jmusicstore/ui/message/AboutUsFragment.java
|
25d2936af8fb9013f9d59115f1bda533d98633f7
|
[] |
no_license
|
JohnhoJ1/JMusicStore
|
6d043545d0d35cdf42b9484796b951c7ed02693c
|
b66674f5a95ecbb6053248d2a3861ba362dc1791
|
refs/heads/master
| 2021-01-13T21:52:10.609636 | 2020-02-23T13:31:00 | 2020-02-23T13:31:00 | 242,506,132 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,765 |
java
|
package com.john.jmusicstore.ui.message;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.fragment.app.Fragment;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapView;
import com.google.android.gms.maps.MapsInitializer;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import com.john.jmusicstore.R;
public class AboutUsFragment extends Fragment implements OnMapReadyCallback {
private MapView mapView;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_about_us, container, false);
mapView = v.findViewById(R.id.map);
mapView.getMapAsync(this);
mapView.onCreate(savedInstanceState);
mapView.onResume();
try {
MapsInitializer.initialize(getActivity().getApplicationContext());
} catch (Exception e) {
e.printStackTrace();
}
return v;
}
@Override
public void onMapReady(GoogleMap googleMap) {
googleMap.addMarker(new MarkerOptions()
.position(new LatLng(27.706185, 85.330024))
.title("J Music Store")
.icon(BitmapDescriptorFactory
.defaultMarker(BitmapDescriptorFactory.HUE_GREEN)));
googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(27.706185, 85.330024), 14f));
}
}
|
[
"email [at] [email protected]"
] |
email [at] [email protected]
|
2e5bb42565ecf1601e6eb81ac3c3cdbdac43beb4
|
c3d59c0f1804617ca918e1e8367399c5eb729475
|
/src/Person.java
|
98ee1a59e0f354ef00c58247aac8024e45da14ea
|
[] |
no_license
|
mahpgnaohhnim/TextAdventureGame
|
ccc1f2685851e7c60698008b8f71941f4e546f24
|
d2d5526f5cb387ea62efb184d11b0aeea8347634
|
refs/heads/master
| 2021-01-10T07:48:03.627189 | 2016-01-14T15:18:35 | 2016-01-14T15:18:35 | 49,651,526 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,504 |
java
|
import java.util.*;
/**
* Created by henry on 28.11.15.
*/
public class Person{
Scanner scan = new Scanner(System.in);
String name;
Weapon weapon = new Weapon("nothing", 0, 0, 0);
Weapon armor = new Weapon("nothing", 0, 0, 0);
int inventorySlot = 5;
String[] inventory = new String[inventorySlot];
int baseHP = 5;
int baseDef = 1;
int baseAtk = 1;
int level = 1;
int currentExp = 0;
int expTillLvlUp = 8; //default
int nextLvlExp = 8; //default
int totalHP = 1;
int currentHP = totalHP;
int damage = 0;
int money = 0;
int totalDef;
int totalAtk;
public void setName(){
System.out.println("What is your name?");
this.name = scan.next();
}
public void changeWeapon(Weapon newWeapon){
weapon = newWeapon;
}
public void updateStats(){
totalHP = baseHP + weapon.hpBonus + armor.hpBonus;
currentHP = totalHP - damage;
totalDef = baseDef + weapon.defBonus + armor.defBonus;
totalAtk = baseAtk + weapon.atkBonus + armor.atkBonus;
if(currentExp >= nextLvlExp){
levelUp();
}
if(currentHP <= 0){
System.out.println("Your Health Points are now at 0. You are Dead!");
System.exit(0);
}
}
public void showStats(){
updateStats();
System.out.println("This is Your Stats right now: ");
System.out.println("Name:\t\t\t" + name);
System.out.println("Level:\t\t\t" + level);
System.out.println("EXP:\t\t\t" + currentExp);
System.out.println("Until next Level:\t" + (nextLvlExp-currentExp));
System.out.println("HP:\t\t\t" + currentHP + "/" + totalHP);
System.out.println("Attack:\t\t\t" + totalAtk);
System.out.println("Defense:\t\t" + totalDef);
System.out.println("Money:\t\t\t" + money);
}
public void showItem(){
System.out.print("Your Items:\n" + weapon.name + " ");
for(String item : inventory){
if(item != null)
System.out.print(", " + item);
}
System.out.println(".");
}
public void getEXP(int i){
System.out.println("You earned "+i+" EXP!");
currentExp = currentExp + i;
updateStats();
}
public void levelUp(){
level++;
baseHP = baseHP+4;
baseAtk = baseAtk + 3;
baseDef++;
expTillLvlUp = (int)(expTillLvlUp * 1.3);
nextLvlExp = nextLvlExp + expTillLvlUp;
damage = 0;
updateStats();
System.out.println("Congratulation!!! You have leveled up! Now your level is "+this.level);
showStats();
}
public void addItem(String newItem){
for(int i = 0; i<inventorySlot;i++){
if(inventory[i]==null){
inventory[i] = newItem;
break;
}
}
}
public void getDamage(int dmg){
int trueDamage = dmg -this.totalDef;
if(trueDamage > 0){
damage = damage + trueDamage;
System.out.println("You lost " + trueDamage + "HP!" );
}
else{
System.out.println("Nothing happened..." );
}
updateStats();
}
public void getMoney(int addMoney){
this.money = this.money + addMoney;
}
public void fullHeal(){
this.currentHP = this.totalHP;
this.damage = 0;
System.out.println("Your Health has been fully restored!");
}
}
|
[
"[email protected]"
] | |
85d1f18791998fb67e775fa04a99c761bfe0d0f3
|
5b75aae3db53a88202a4845ab426238b1806a7d6
|
/src/Solution138.java
|
00e0ca36c748e0711a6bcace78fe88341edf6516
|
[] |
no_license
|
doumitang/leetcode
|
f32b23205c939bb3d1b3b20d75b553daead99450
|
612e45753b4e1133bd6cfd6c4e6f16bc8ce08044
|
refs/heads/master
| 2020-09-13T15:46:50.993722 | 2020-09-03T08:31:30 | 2020-09-03T08:31:30 | 222,832,919 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,650 |
java
|
import java.util.HashMap;
import java.util.Map;
public class Solution138 {
class Node {
int val;
Node next;
Node random;
public Node(int val) {
this.val = val;
this.next = null;
this.random = null;
}
}
private Map<Node, Node> map = new HashMap<>();
/**
* 用 map 存储原节点到深拷贝节点的映射,时间 O(n),空间 O(n)
* Runtime: 0 ms, faster than 100.00% of Java online submissions for Copy List with Random Pointer.
* Memory Usage: 41.6 MB, less than 5.61% of Java online submissions for Copy List with Random Pointer.
* @param head
* @return
*/
public Node copyRandomList(Node head) {
if (head == null) return head;
Node copyHead = new Node(head.val);
map.put(head, copyHead);
Node pCopy = copyHead, pHead = head;
Node next = null, random = null;
while (pHead != null) {
next = pHead.next;
if (next == null) pCopy.next = next;
else if (map.containsKey(next)) pCopy.next = map.get(next);
else {
pCopy.next = new Node(next.val);
map.put(next, pCopy.next);
}
random = pHead.random;
if (random == null) pCopy.random = null;
else if (map.containsKey(random)) pCopy.random = map.get(random);
else {
pCopy.random = new Node(random.val);
map.put(random, pCopy.random);
}
pCopy = pCopy.next;
pHead = pHead.next;
}
return copyHead;
}
}
|
[
"[email protected]"
] | |
3a0448c5ab67f358c37c858460f55900a0f6b6f3
|
a0238a983ee0142c2e0c50100cb6c26d609a3d6c
|
/app/src/main/java/com/example/hideseekapp/MapItem.java
|
3beff19cb301349031fe2df26d4fc630afba4500
|
[] |
no_license
|
efpm168806/map
|
886a48a23448b4811c8daae0ef062f8e676a6188
|
2c2a5647decf0ef02e3a68b20993edc09fee7629
|
refs/heads/master
| 2020-03-31T09:13:16.354715 | 2018-12-16T16:04:38 | 2018-12-16T16:04:38 | 152,086,749 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 10,072 |
java
|
package com.example.hideseekapp;
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class MapItem {
double latitude ,longitude;
String ID;
String Ghost_stay = null;
String[][]list;
String[][]list2;
int a;
int a2;
JSONArray jsonArray;
private static final double EARTH_RADIUS = 6378.137;
public MapItem(double longitude, double latitude,String ID){
this.longitude = longitude;
this.latitude = latitude;
this.ID = ID;
}
public void map_update() {
Log.i("map_update","go to map_update function");
Thread map_DB = new Thread(new Runnable() {
@Override
public void run() {
mapDB();
}
});
map_DB.start();
try {
map_DB.join();
//抓取其他玩家的位置以及是否使用道具
location_get();
//判斷是否有進入鬼的抓人範圍
ghostcatch();
} catch (InterruptedException e) {
System.out.println("執行序被中斷");
Log.i("map_update","XXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
}
}
private void mapDB(){
Log.i("FUCK3",latitude+"++++++"+longitude);
String result = DBconnect.executeQuery("UPDATE map SET longitude = '" + longitude + "',latitude = '" + latitude + "' WHERE User_Id ='"+ID+"'");
}
public void location_get() {
Thread location_DB = new Thread(new Runnable() {
@Override
public void run() {
locationDB();
}
});
location_DB.start();
try {
location_DB.join();
makepoint_middle_stay(Ghost_stay,list2,a2);
} catch (InterruptedException e) {
System.out.println("執行序被中斷");
Log.i("location_get","XXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
}
}
//取得其他玩家的位置
public void locationDB(){
try{
String map_index = DBconnect.executeQuery("SELECT map_id FROM map WHERE User_id = '"+ID+"' ");
JSONObject mapID = new JSONArray(map_index).getJSONObject(0);
String MapID=(String)mapID.getString("map_id").toString();
String room_player_info = DBconnect.executeQuery("SELECT User_id,longitude,latitude,item,ghost FROM map WHERE map_id = '"+MapID+"'");
JSONArray jsonArray = new JSONArray(room_player_info);
int a = jsonArray.length();
list = new String [a][5];
for(int i=0 ; i<a ; i++){
JSONObject jsonData = jsonArray.getJSONObject(i);
list[i][0]=(String)jsonData.getString("User_id").toString();
list[i][1]=(String)jsonData.getString("longitude").toString();
list[i][2]=(String)jsonData.getString("latitude").toString();
list[i][3]=(String)jsonData.getString("item").toString();
list[i][4]=(String)jsonData.getString("ghost").toString();
System.out.println("User_id:"+list[i][0]+"。longitude:"+list[i][1]+"。latitude:"+list[i][2]+"。item:"+list[i][3]+"。ghost:"+list[i][4]);
}
String ghost = DBconnect.executeQuery("SELECT ghost FROM map WHERE User_id = '"+ID+"' ");
JSONObject ghost2 = new JSONArray(ghost).getJSONObject(0);
String Ghost=(String)ghost2.getString("ghost").toString();
Log.i("XXXX",Ghost);
//將同個房間內玩家的資訊(ID、經緯度、道具)放入list陣列並傳回MapsActivity來做標點
Ghost_stay = null;
Ghost_stay = Ghost;
list2 = list;
a2 = jsonArray.length();
Log.i("XXXX", String.valueOf(list2));
Log.i("a2", String.valueOf(a2));
}
catch(JSONException e){
Log.i("locationDB","XXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
}
}
//將同個房間內玩家的資訊(ID、經緯度、道具)放入list陣列並傳回MapsActivity來做標點
public void makepoint_middle_stay(String Ghost,String[][]list2,int a2){
MapsActivity MapsActivity = new MapsActivity();
MapsActivity.getlist(list2,a2,Ghost);
Log.i("呼叫getlist && MAKEPOINT","XXXXXXXXXXXXXXXX");
}
public void ghostcatch(){
Thread ghostcatchDB = new Thread(new Runnable() {
@Override
public void run() {
ghostcatch_DB();
}
});
ghostcatchDB.start();
try {
ghostcatchDB.join();
} catch (InterruptedException e) {
Log.i("ghostcatch","XXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
}
}
//鬼抓人判斷
public void ghostcatch_DB(){
try{
String map_index = DBconnect.executeQuery("SELECT map_id FROM map WHERE User_id = '"+ID+"' ");
JSONObject mapID = new JSONArray(map_index).getJSONObject(0);
String MapID=(String)mapID.getString("map_id").toString();
String ghost = DBconnect.executeQuery("SELECT ghost FROM map WHERE User_id = '"+ID+"' ");
JSONObject ghost2 = new JSONArray(ghost).getJSONObject(0);
String Ghost=(String)ghost2.getString("ghost").toString();
System.out.println("MapID:"+MapID+"。Ghost:"+Ghost+"。a22222:"+a2);
if(Ghost.equals("0") && a2!=1){
String ghost_info = DBconnect.executeQuery("SELECT User_id,longitude,latitude FROM map WHERE ghost = '1' AND map_id = '"+MapID+"' ");
String my_info = DBconnect.executeQuery("SELECT longitude,latitude,ghost_catch FROM map WHERE User_id = '"+ID+"' ");
JSONArray ghostArray = new JSONArray(ghost_info);
JSONArray myArray = new JSONArray(my_info);
int g = ghostArray.length();
int s = myArray.length();
String[][] g_list = new String[g][3];
for(int i=0;i<g;i++){
JSONObject jsonData = ghostArray.getJSONObject(i);
g_list[i][0]=(String)jsonData.getString("User_id").toString();
g_list[i][1]=(String)jsonData.getString("longitude").toString();
g_list[i][2]=(String)jsonData.getString("latitude").toString();
System.out.println("User_id:"+g_list[i][0]+"。longitude:"+g_list[i][1]+"。latitude:"+g_list[i][2]);
}
String[][] s_list = new String[s][3];
for(int i=0;i<s;i++){
JSONObject jsonData = myArray.getJSONObject(i);
s_list[i][0]=(String)jsonData.getString("longitude").toString();
s_list[i][1]=(String)jsonData.getString("latitude").toString();
s_list[i][2]=(String)jsonData.getString("ghost_catch").toString();
System.out.println("longitude:"+s_list[i][0]+"。latitude:"+s_list[i][1]+"。ghost_catch:"+s_list[i][2]);
}
for(int i=0;i<g;i++){
double ghostLat = rad(Double.parseDouble(g_list[i][2]));
double myLat = rad(Double.parseDouble(s_list[0][1]));
double a = ghostLat - myLat;
double ghostLongt = rad(Double.parseDouble(g_list[i][1]));
double myLongt = rad(Double.parseDouble(s_list[0][0]));
double b = ghostLongt - myLongt;
double distance = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a/2),2) + Math.cos(ghostLat)*Math.cos(myLat)*Math.pow(Math.sin(b/2),2)));
distance = distance * EARTH_RADIUS;
distance = Math.round(distance * 10000) / 10000;
Log.i("Distance", String.valueOf(distance));
//距離小於3KM時資料庫中ghost_catch會+1,ghost_catch大於3時則代表玩家被抓到了
if(distance<=1.5){
if(s_list[0][2].equals("2")){
String result = DBconnect.executeQuery("UPDATE map SET ghost = '1' WHERE User_Id ='"+ID+"'");
}else if(s_list[0][2].equals("1")){
String result = DBconnect.executeQuery("UPDATE map SET ghost_catch = '2' WHERE User_Id ='"+ID+"'");
}else{
String result = DBconnect.executeQuery("UPDATE map SET ghost_catch = '1' WHERE User_Id ='"+ID+"'");
}
}else{
//超出被鬼抓的範圍,ghost_catch就為0
String result = DBconnect.executeQuery("UPDATE map SET ghost_catch = '0' WHERE User_Id ='"+ID+"'");
}
}
}else{
//當鬼沒事
}
}
catch(JSONException e){
Log.i("ghostcatch_DB","XXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
}
}
//抓人判斷要使用之公式
private static double rad(double d)
{
return d * Math.PI / 180.0;
}
public JSONArray item_set(){
Thread item_get = new Thread(new Runnable() {
@Override
public void run() {
item_get();
}
});
item_get.start();
try {
item_get.join();
} catch (InterruptedException e) {
System.out.println("執行序被中斷");
}
return jsonArray;
}
private JSONArray item_get() { //道具放置
try {
String result = DBconnect.executeQuery("SELECT * FROM playeritem WHERE user_id = '"+ID+"'");
JSONArray jsonArray_get = new JSONArray(result);
System.out.println("connect ok");
jsonArray =jsonArray_get;
return jsonArray;
} catch (Exception e) {
Log.e("log_tag", e.toString());
System.out.println("connect failed");
}
return jsonArray;
}
}
|
[
"[email protected]"
] | |
0d911775e6562f8fbc021bf4a4c31d04ddd9fdf0
|
471a1d9598d792c18392ca1485bbb3b29d1165c5
|
/jadx-MFP/src/main/java/org/apache/sanselan/formats/tiff/write/TiffImageWriterLossy.java
|
793347da27461b59e21779eac3e007625e719cea
|
[] |
no_license
|
reed07/MyPreferencePal
|
84db3a93c114868dd3691217cc175a8675e5544f
|
365b42fcc5670844187ae61b8cbc02c542aa348e
|
refs/heads/master
| 2020-03-10T23:10:43.112303 | 2019-07-08T00:39:32 | 2019-07-08T00:39:32 | 129,635,379 | 2 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,889 |
java
|
package org.apache.sanselan.formats.tiff.write;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
import org.apache.sanselan.ImageWriteException;
import org.apache.sanselan.common.BinaryOutputStream;
public class TiffImageWriterLossy extends TiffImageWriterBase {
public TiffImageWriterLossy() {
}
public TiffImageWriterLossy(int i) {
super(i);
}
public void write(OutputStream outputStream, TiffOutputSet tiffOutputSet) throws IOException, ImageWriteException {
TiffOutputSummary validateDirectories = validateDirectories(tiffOutputSet);
List outputItems = tiffOutputSet.getOutputItems(validateDirectories);
updateOffsetsStep(outputItems);
validateDirectories.updateOffsets(this.byteOrder);
writeStep(new BinaryOutputStream(outputStream, this.byteOrder), outputItems);
}
private void updateOffsetsStep(List list) throws IOException, ImageWriteException {
int i = 8;
for (int i2 = 0; i2 < list.size(); i2++) {
TiffOutputItem tiffOutputItem = (TiffOutputItem) list.get(i2);
tiffOutputItem.setOffset(i);
int itemLength = tiffOutputItem.getItemLength();
i = i + itemLength + imageDataPaddingLength(itemLength);
}
}
private void writeStep(BinaryOutputStream binaryOutputStream, List list) throws IOException, ImageWriteException {
writeImageFileHeader(binaryOutputStream);
for (int i = 0; i < list.size(); i++) {
TiffOutputItem tiffOutputItem = (TiffOutputItem) list.get(i);
tiffOutputItem.writeItem(binaryOutputStream);
int imageDataPaddingLength = imageDataPaddingLength(tiffOutputItem.getItemLength());
for (int i2 = 0; i2 < imageDataPaddingLength; i2++) {
binaryOutputStream.write(0);
}
}
}
}
|
[
"[email protected]"
] | |
b81dfc58fbb5edd1343623b7680f4fe7743b70f6
|
a6b36cc4a59d696576626b9f16aac912e0c1712c
|
/JenisSegi3.java
|
51b2bd27b7d0b69cf6bf1ca3dce9d11c7ab06ef7
|
[] |
no_license
|
Fathimatuzzahro/Praktikum-Algoritma-Pemrograman
|
b8eee0c899e6daa3d21237ec28eea51b908d1ddf
|
e4b8eff68e44f158673db5a500bacaf8ecfccfd6
|
refs/heads/main
| 2023-02-16T20:14:06.267725 | 2021-01-16T05:17:47 | 2021-01-16T05:17:47 | 301,898,812 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 990 |
java
|
import java.util.Scanner; //Import the Scanner class
public class JenisSegi3 {
public static void main(String[] abc ) {
Scanner data = new Scanner(System.in); //Create a Scanner object
int a, b, c;
System.out.print("Masukkan Sisi Pertama :");
a=data.nextInt(); data.nextLine(); // Read user Input
System.out.print("Masukkan Sisi Kedua :");
b=data.nextInt(); data.nextLine(); // Read user Input
System.out.print("Masukkan Sisi Ketiga :");
c=data.nextInt(); data.nextLine(); // Read user Input
String jenis=Jenis(a,b,c);
System.out.println("Merupakan "+Jenis(a,b,c));
}
public static String Jenis(int a, int b, int c) {
if (a==b && b!=c && a!=c || b==c && b!=a && a!=c || a==c && b!=a && b!=c) {
return "Segitiga Sama Kaki";
} else if (a==b || a==c || a==b) {
return "Segitiga Sama Sisi";
} else {
return "Segitiga Sembarang";
}
}
}
|
[
"[email protected]"
] | |
92c5f93bfa6e60cb97e3866ed8b7f5a20b916056
|
98f20ec801c8acddc757fa4339d21e83dcbb2a02
|
/adpharma/adpharma.modules/adpharma.client.frontoffice/src/main/java/org/adorsys/adpharma/client/jpa/customerinvoice/CustomerInvoiceAgencySelection.java
|
f4710a309ed8b52234d7971c8a68727d907e2a56
|
[
"Apache-2.0"
] |
permissive
|
francis-pouatcha/forgelab
|
f7e6bcc47621d4cab0f306c606e9a7dffbbe68e1
|
fdcbbded852a985f3bd437b639a2284d92703e33
|
refs/heads/master
| 2021-03-24T10:37:26.819883 | 2014-10-08T13:22:29 | 2014-10-08T13:22:29 | 15,254,083 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,752 |
java
|
package org.adorsys.adpharma.client.jpa.customerinvoice;
import java.util.ResourceBundle;
import javafx.scene.control.ComboBox;
import javafx.scene.control.ListCell;
import javafx.scene.control.ListView;
import javafx.util.Callback;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import org.adorsys.adpharma.client.jpa.agency.Agency;
import org.adorsys.javafx.crud.extensions.locale.Bundle;
import org.adorsys.javafx.crud.extensions.locale.CrudKeys;
import org.adorsys.javafx.crud.extensions.view.AbstractSelection;
import org.adorsys.javafx.crud.extensions.view.LazyViewBuilder;
public class CustomerInvoiceAgencySelection extends AbstractSelection<CustomerInvoice, Agency>
{
private ComboBox<CustomerInvoiceAgency> agency;
@Inject
@Bundle({ CrudKeys.class, Agency.class, CustomerInvoice.class })
private ResourceBundle resourceBundle;
@PostConstruct
public void postConstruct()
{
LazyViewBuilder viewBuilder = new LazyViewBuilder();
agency = viewBuilder.addComboBox("CustomerInvoice_agency_description.title", "agency", resourceBundle, false);
agency.setCellFactory(new Callback<ListView<CustomerInvoiceAgency>, ListCell<CustomerInvoiceAgency>>()
{
@Override
public ListCell<CustomerInvoiceAgency> call(ListView<CustomerInvoiceAgency> listView)
{
return new CustomerInvoiceAgencyListCell();
}
});
agency.setButtonCell(new CustomerInvoiceAgencyListCell());
gridRows = viewBuilder.toRows();
}
public void bind(CustomerInvoice model)
{
agency.valueProperty().bindBidirectional(model.agencyProperty());
}
public ComboBox<CustomerInvoiceAgency> getAgency()
{
return agency;
}
}
|
[
"[email protected]"
] | |
b9ab9ee7e8ec163cdd8d4f318b1799f21f84bb92
|
1f00fd1f0a9a2f70a6534758a16d12d80610512b
|
/storage/connectors/redis/src/test/java/feast/storage/connectors/redis/retriever/RedisOnlineRetrieverTest.java
|
1292f4ab0dc522dc3c3a5d30a7835ce93dd215d0
|
[
"Apache-2.0"
] |
permissive
|
RaniereRamos/feast
|
7b7468ecfac7adf8219e91ac85a298ed7414c7ec
|
896cb562f987c8a36d879e4d6953edc78a82fc5a
|
refs/heads/master
| 2022-12-07T22:06:38.355374 | 2020-08-25T10:49:17 | 2020-08-25T10:49:17 | 290,528,956 | 1 | 0 |
Apache-2.0
| 2020-08-26T15:06:35 | 2020-08-26T15:06:34 | null |
UTF-8
|
Java
| false | false | 10,212 |
java
|
/*
* SPDX-License-Identifier: Apache-2.0
* Copyright 2018-2020 The Feast Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package feast.storage.connectors.redis.retriever;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.initMocks;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.google.protobuf.AbstractMessageLite;
import com.google.protobuf.Duration;
import com.google.protobuf.Timestamp;
import feast.proto.core.FeatureSetProto.EntitySpec;
import feast.proto.core.FeatureSetProto.FeatureSetSpec;
import feast.proto.core.FeatureSetProto.FeatureSpec;
import feast.proto.serving.ServingAPIProto.FeatureReference;
import feast.proto.serving.ServingAPIProto.GetOnlineFeaturesRequest.EntityRow;
import feast.proto.storage.RedisProto.RedisKey;
import feast.proto.types.FeatureRowProto.FeatureRow;
import feast.proto.types.FieldProto.Field;
import feast.proto.types.ValueProto.Value;
import feast.storage.api.retriever.FeatureSetRequest;
import feast.storage.api.retriever.OnlineRetriever;
import io.lettuce.core.KeyValue;
import io.lettuce.core.api.StatefulRedisConnection;
import io.lettuce.core.api.sync.RedisCommands;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
public class RedisOnlineRetrieverTest {
@Mock StatefulRedisConnection<byte[], byte[]> connection;
@Mock RedisCommands<byte[], byte[]> syncCommands;
private OnlineRetriever redisOnlineRetriever;
private byte[][] redisKeyList;
@Before
public void setUp() {
initMocks(this);
when(connection.sync()).thenReturn(syncCommands);
redisOnlineRetriever = RedisOnlineRetriever.create(connection);
redisKeyList =
Lists.newArrayList(
RedisKey.newBuilder()
.setFeatureSet("project/featureSet")
.addAllEntities(
Lists.newArrayList(
Field.newBuilder().setName("entity1").setValue(intValue(1)).build(),
Field.newBuilder().setName("entity2").setValue(strValue("a")).build()))
.build(),
RedisKey.newBuilder()
.setFeatureSet("project/featureSet")
.addAllEntities(
Lists.newArrayList(
Field.newBuilder().setName("entity1").setValue(intValue(2)).build(),
Field.newBuilder().setName("entity2").setValue(strValue("b")).build()))
.build())
.stream()
.map(AbstractMessageLite::toByteArray)
.collect(Collectors.toList())
.toArray(new byte[0][0]);
}
@Test
public void shouldReturnResponseWithValuesIfKeysPresent() {
FeatureSetRequest featureSetRequest =
FeatureSetRequest.newBuilder()
.setSpec(getFeatureSetSpec())
.addFeatureReference(
FeatureReference.newBuilder().setName("feature1").setProject("project").build())
.addFeatureReference(
FeatureReference.newBuilder().setName("feature2").setProject("project").build())
.build();
List<EntityRow> entityRows =
ImmutableList.of(
EntityRow.newBuilder()
.setEntityTimestamp(Timestamp.newBuilder().setSeconds(100))
.putFields("entity1", intValue(1))
.putFields("entity2", strValue("a"))
.build(),
EntityRow.newBuilder()
.setEntityTimestamp(Timestamp.newBuilder().setSeconds(100))
.putFields("entity1", intValue(2))
.putFields("entity2", strValue("b"))
.build());
List<FeatureRow> featureRows =
Lists.newArrayList(
FeatureRow.newBuilder()
.setEventTimestamp(Timestamp.newBuilder().setSeconds(100))
.addAllFields(
Lists.newArrayList(
Field.newBuilder().setValue(intValue(1)).build(),
Field.newBuilder().setValue(intValue(1)).build()))
.build(),
FeatureRow.newBuilder()
.setEventTimestamp(Timestamp.newBuilder().setSeconds(100))
.addAllFields(
Lists.newArrayList(
Field.newBuilder().setValue(intValue(2)).build(),
Field.newBuilder().setValue(intValue(2)).build()))
.build());
List<KeyValue<byte[], byte[]>> featureRowBytes =
featureRows.stream()
.map(x -> KeyValue.from(new byte[1], Optional.of(x.toByteArray())))
.collect(Collectors.toList());
redisOnlineRetriever = RedisOnlineRetriever.create(connection);
when(connection.sync()).thenReturn(syncCommands);
when(syncCommands.mget(redisKeyList)).thenReturn(featureRowBytes);
List<Optional<FeatureRow>> expected =
Lists.newArrayList(
Optional.of(
FeatureRow.newBuilder()
.setEventTimestamp(Timestamp.newBuilder().setSeconds(100))
.setFeatureSet("project/featureSet")
.addAllFields(
Lists.newArrayList(
Field.newBuilder().setName("feature1").setValue(intValue(1)).build(),
Field.newBuilder().setName("feature2").setValue(intValue(1)).build()))
.build()),
Optional.of(
FeatureRow.newBuilder()
.setEventTimestamp(Timestamp.newBuilder().setSeconds(100))
.setFeatureSet("project/featureSet")
.addAllFields(
Lists.newArrayList(
Field.newBuilder().setName("feature1").setValue(intValue(2)).build(),
Field.newBuilder().setName("feature2").setValue(intValue(2)).build()))
.build()));
List<Optional<FeatureRow>> actual =
redisOnlineRetriever.getOnlineFeatures(entityRows, featureSetRequest);
assertThat(actual, equalTo(expected));
}
@Test
public void shouldReturnNullIfKeysNotPresent() {
FeatureSetRequest featureSetRequest =
FeatureSetRequest.newBuilder()
.setSpec(getFeatureSetSpec())
.addFeatureReference(
FeatureReference.newBuilder().setName("feature1").setProject("project").build())
.addFeatureReference(
FeatureReference.newBuilder().setName("feature2").setProject("project").build())
.build();
List<EntityRow> entityRows =
ImmutableList.of(
EntityRow.newBuilder()
.setEntityTimestamp(Timestamp.newBuilder().setSeconds(100))
.putFields("entity1", intValue(1))
.putFields("entity2", strValue("a"))
.build(),
EntityRow.newBuilder()
.setEntityTimestamp(Timestamp.newBuilder().setSeconds(100))
.putFields("entity1", intValue(2))
.putFields("entity2", strValue("b"))
.build());
List<FeatureRow> featureRows =
Lists.newArrayList(
FeatureRow.newBuilder()
.setEventTimestamp(Timestamp.newBuilder().setSeconds(100))
.addAllFields(
Lists.newArrayList(
Field.newBuilder().setValue(intValue(1)).build(),
Field.newBuilder().setValue(intValue(1)).build()))
.build());
List<KeyValue<byte[], byte[]>> featureRowBytes =
featureRows.stream()
.map(row -> KeyValue.from(new byte[1], Optional.of(row.toByteArray())))
.collect(Collectors.toList());
featureRowBytes.add(null);
redisOnlineRetriever = RedisOnlineRetriever.create(connection);
when(connection.sync()).thenReturn(syncCommands);
when(syncCommands.mget(redisKeyList)).thenReturn(featureRowBytes);
List<Optional<FeatureRow>> expected =
Lists.newArrayList(
Optional.of(
FeatureRow.newBuilder()
.setEventTimestamp(Timestamp.newBuilder().setSeconds(100))
.setFeatureSet("project/featureSet")
.addAllFields(
Lists.newArrayList(
Field.newBuilder().setName("feature1").setValue(intValue(1)).build(),
Field.newBuilder().setName("feature2").setValue(intValue(1)).build()))
.build()),
Optional.empty());
List<Optional<FeatureRow>> actual =
redisOnlineRetriever.getOnlineFeatures(entityRows, featureSetRequest);
assertThat(actual, equalTo(expected));
}
private Value intValue(int val) {
return Value.newBuilder().setInt64Val(val).build();
}
private Value strValue(String val) {
return Value.newBuilder().setStringVal(val).build();
}
private FeatureSetSpec getFeatureSetSpec() {
return FeatureSetSpec.newBuilder()
.setProject("project")
.setName("featureSet")
.addEntities(EntitySpec.newBuilder().setName("entity1"))
.addEntities(EntitySpec.newBuilder().setName("entity2"))
.addFeatures(FeatureSpec.newBuilder().setName("feature1"))
.addFeatures(FeatureSpec.newBuilder().setName("feature2"))
.setMaxAge(Duration.newBuilder().setSeconds(30)) // default
.build();
}
}
|
[
"[email protected]"
] | |
2c0fe2dc4c4e1864fc3393d45f6c0d0cf0ef6979
|
73a70b63201cc0b7d3eb5336085491d44aa23686
|
/src/java/services/AccountService.java
|
20fee9a43277a63dd7239a578233a0a89910bce6
|
[] |
no_license
|
Matt-rempel/Week5Lab_MyLogin
|
c2378ea98899a3beb55f7ec2c053357a31598dee
|
8fad951f91825086ae119406db9ee2eeefd8d2f4
|
refs/heads/master
| 2022-12-28T09:11:04.170033 | 2020-10-09T17:40:07 | 2020-10-09T17:40:07 | 301,753,025 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 857 |
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 services;
import models.User;
/**
*
* @author 584893
*/
public class AccountService {
User abe;
User barb;
public AccountService() {
this.barb = new User("barb", "password");
this.abe = new User("abe", "password");
}
public User login(String username, String password) {
User user = new User(username, password);
if ((this.barb.getUsername().equals(user.getUsername()) || this.abe.getUsername().equals(user.getUsername())) && password.equals("password")) {
user.setPassNull();
return user;
}
return null;
}
}
|
[
"[email protected]"
] | |
9b16a6fbf11c34727b70f861b252fd7483a02be8
|
3e7285b35f1cfa4122fddc58024f123312b4eaae
|
/app/src/main/java/com/giovanniburresi/mfr15iotserver/json/JsonParser.java
|
11b447ada04161a65fa183523f2da589508bf76f
|
[] |
no_license
|
ekirei/MFR15_IoT_server_qdl
|
5a403701b0ba6b33cdca83c7f700455beb7aa2ca
|
793057843c626c5c95e2c422768e3dedda611827
|
refs/heads/master
| 2022-03-22T22:25:54.327670 | 2015-09-24T09:34:03 | 2015-09-24T09:34:03 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,287 |
java
|
package com.giovanniburresi.mfr15iotserver.json;
import org.json.JSONException;
import org.json.JSONObject;
/**
* Created by Mario on 18/09/2015.
*/
public class JsonParser {
public JsonParser(){}
public String getLookupAddressResponse(String localip){
JSONObject response = new JSONObject();
try {
response = new JSONObject();
response.put("RESPONSE", "true");
response.put("SERVER_IP", localip);
} catch (JSONException e) {
e.printStackTrace();
}
return response.toString();
}
public static String getMessageError(String error){
String response = "";
JSONObject json = new JSONObject();
try {
json.put("RESPONSE", "false");
json.put("ERROR", error);
} catch (JSONException e) {
e.printStackTrace();
}
return json.toString();
}
public static String getMessageSuccess(String error){
String response = "";
JSONObject json = new JSONObject();
try {
json.put("RESPONSE", "true");
json.put("MESSAGE", error);
} catch (JSONException e) {
e.printStackTrace();
}
return json.toString();
}
}
|
[
"[email protected]"
] | |
9be2f81e3b1e9305d25e0e97ce1e82d3ecee6c72
|
7341a99870201edca1851dbfd763a608b49d5951
|
/software/base/src/main/java/brooklyn/event/feed/jmx/JmxFeed.java
|
5e58e6fa2cb31c8decdbf5d1fb0fa8da5e72918d
|
[
"Apache-2.0"
] |
permissive
|
strategist922/brooklyn
|
620e81c0815521598ffc4870b0e9b5a789dec505
|
38ed10558e7657e3a4a13a855a9b7cb886af26ec
|
refs/heads/master
| 2021-01-18T04:53:27.909990 | 2013-03-05T10:22:40 | 2013-03-05T10:22:40 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 12,863 |
java
|
package brooklyn.event.feed.jmx;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
import javax.management.Notification;
import javax.management.NotificationFilter;
import javax.management.NotificationListener;
import javax.management.ObjectName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import brooklyn.entity.basic.EntityLocal;
import brooklyn.entity.basic.SoftwareProcessImpl;
import brooklyn.event.feed.AbstractFeed;
import brooklyn.event.feed.AttributePollHandler;
import brooklyn.event.feed.DelegatingPollHandler;
import brooklyn.event.feed.PollHandler;
import brooklyn.event.feed.Poller;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.SetMultimap;
import com.google.common.collect.Sets;
/**
* Provides a feed of attribute values, by polling or subscribing over jmx.
*
* Example usage (e.g. in an entity that extends {@link SoftwareProcessImpl}):
* <pre>
* {@code
* private JmxFeed feed;
*
* //@Override
* protected void connectSensors() {
* super.connectSensors();
*
* feed = JmxFeed.builder()
* .entity(this)
* .period(500, TimeUnit.MILLISECONDS)
* .pollAttribute(new JmxAttributePollConfig<Integer>(ERROR_COUNT)
* .objectName(requestProcessorMbeanName)
* .attributeName("errorCount"))
* .pollAttribute(new JmxAttributePollConfig<Boolean>(SERVICE_UP)
* .objectName(serverMbeanName)
* .attributeName("Started")
* .onError(Functions.constant(false)))
* .build();
* }
*
* {@literal @}Override
* protected void disconnectSensors() {
* super.disconnectSensors();
* if (feed != null) feed.stop();
* }
* }
* </pre>
*
* @author aled
*/
public class JmxFeed extends AbstractFeed {
public static final Logger log = LoggerFactory.getLogger(JmxFeed.class);
public static final long JMX_CONNECTION_TIMEOUT_MS = 120*1000;
public static Builder builder() {
return new Builder();
}
public static class Builder {
private EntityLocal entity;
private JmxHelper helper;
private long jmxConnectionTimeout = JMX_CONNECTION_TIMEOUT_MS;
private long period = 500;
private TimeUnit periodUnits = TimeUnit.MILLISECONDS;
private List<JmxAttributePollConfig<?>> attributePolls = Lists.newArrayList();
private List<JmxOperationPollConfig<?>> operationPolls = Lists.newArrayList();
private List<JmxNotificationSubscriptionConfig<?>> notificationSubscriptions = Lists.newArrayList();
private volatile boolean built;
public Builder entity(EntityLocal val) {
this.entity = val;
return this;
}
public Builder helper(JmxHelper val) {
this.helper = val;
return this;
}
public Builder period(long millis) {
return period(millis, TimeUnit.MILLISECONDS);
}
public Builder period(long val, TimeUnit units) {
this.period = val;
this.periodUnits = units;
return this;
}
public Builder pollAttribute(JmxAttributePollConfig<?> config) {
attributePolls.add(config);
return this;
}
public Builder pollOperation(JmxOperationPollConfig<?> config) {
operationPolls.add(config);
return this;
}
public Builder subscribeToNotification(JmxNotificationSubscriptionConfig<?> config) {
notificationSubscriptions.add(config);
return this;
}
public JmxFeed build() {
built = true;
JmxFeed result = new JmxFeed(this);
result.start();
return result;
}
@Override
protected void finalize() {
if (!built) log.warn("JmxFeed.Builder created, but build() never called");
}
}
private final JmxHelper helper;
private final boolean ownHelper;
private final String jmxUri;
private final long jmxConnectionTimeout;
// Treat as immutable; never modified after constructor
private final SetMultimap<String, JmxAttributePollConfig<?>> attributePolls = HashMultimap.<String,JmxAttributePollConfig<?>>create();
private final SetMultimap<List<?>, JmxOperationPollConfig<?>> operationPolls = HashMultimap.<List<?>,JmxOperationPollConfig<?>>create();
private final SetMultimap<NotificationFilter, JmxNotificationSubscriptionConfig<?>> notificationSubscriptions = HashMultimap.create();
private final SetMultimap<ObjectName, NotificationListener> notificationListeners = HashMultimap.create();
protected JmxFeed(Builder builder) {
super(builder.entity);
this.helper = (builder.helper != null) ? builder.helper : new JmxHelper(entity);
this.ownHelper = (builder.helper == null);
this.jmxUri = helper.getUrl();
this.jmxConnectionTimeout = builder.jmxConnectionTimeout;
for (JmxAttributePollConfig<?> config : builder.attributePolls) {
JmxAttributePollConfig<?> configCopy = new JmxAttributePollConfig(config);
if (configCopy.getPeriod() < 0) configCopy.period(builder.period, builder.periodUnits);
attributePolls.put(configCopy.getAttributeName(), configCopy);
}
for (JmxOperationPollConfig<?> config : builder.operationPolls) {
JmxOperationPollConfig<?> configCopy = new JmxOperationPollConfig(config);
if (configCopy.getPeriod() < 0) configCopy.period(builder.period, builder.periodUnits);
operationPolls.put(configCopy.buildOperationIdentity(), configCopy);
}
for (JmxNotificationSubscriptionConfig<?> config : builder.notificationSubscriptions) {
notificationSubscriptions.put(config.getNotificationFilter(), config);
}
}
public String getJmxUri() {
return jmxUri;
}
@SuppressWarnings("unchecked")
private Poller<Object> getPoller() {
return (Poller<Object>) poller;
}
@Override
protected void preStart() {
helper.connect(jmxConnectionTimeout);
for (NotificationFilter filter : notificationSubscriptions.keySet()) {
// TODO Could config.getObjectName have wildcards? Is this code safe?
Set<JmxNotificationSubscriptionConfig<?>> configs = notificationSubscriptions.get(filter);
NotificationListener listener = registerNotificationListener(configs);
ObjectName objectName = Iterables.get(configs, 0).getObjectName();
notificationListeners.put(objectName, listener);
}
// Setup polling of sensors
for (final String jmxAttributeName : attributePolls.keys()) {
registerAttributePoller(attributePolls.get(jmxAttributeName));
}
// Setup polling of operations
for (final List<?> operationIdentifier : operationPolls.keys()) {
registerOperationPoller(operationPolls.get(operationIdentifier));
}
}
@Override
protected void preStop() {
super.preStop();
for (Map.Entry<ObjectName, NotificationListener> entry : notificationListeners.entries()) {
unregisterNotificationListener(entry.getKey(), entry.getValue());
}
notificationListeners.clear();
}
@Override
protected void postStop() {
super.postStop();
if (helper != null && ownHelper) helper.disconnect();
}
/**
* Registers to poll a jmx-operation for an ObjectName, where all the given configs are for the same ObjectName + operation + parameters.
*/
private void registerOperationPoller(Set<JmxOperationPollConfig<?>> configs) {
Set<AttributePollHandler<Object>> handlers = Sets.newLinkedHashSet();
long minPeriod = Integer.MAX_VALUE;
final ObjectName objectName = Iterables.get(configs, 0).getObjectName();
final String operationName = Iterables.get(configs, 0).getOperationName();
final List<String> signature = Iterables.get(configs, 0).getSignature();
final List<?> params = Iterables.get(configs, 0).getParams();
for (JmxOperationPollConfig<?> config : configs) {
handlers.add(new AttributePollHandler<Object>(config, getEntity(), this));
if (config.getPeriod() > 0) minPeriod = Math.min(minPeriod, config.getPeriod());
}
getPoller().scheduleAtFixedRate(
new Callable<Object>() {
public Object call() throws Exception {
if (log.isDebugEnabled()) log.debug("jmx operation polling for {} sensors at {} -> {}", new Object[] {getEntity(), jmxUri, operationName});
if (signature.size() == params.size()) {
return helper.operation(objectName, operationName, signature, params);
} else {
return helper.operation(objectName, operationName, params.toArray());
}
}
},
new DelegatingPollHandler(handlers), minPeriod);
}
/**
* Registers to poll a jmx-attribute for an ObjectName, where all the given configs are for that same ObjectName + attribute.
*/
private void registerAttributePoller(Set<JmxAttributePollConfig<?>> configs) {
Set<AttributePollHandler<Object>> handlers = Sets.newLinkedHashSet();
long minPeriod = Integer.MAX_VALUE;
final ObjectName objectName = Iterables.get(configs, 0).getObjectName();
final String jmxAttributeName = Iterables.get(configs, 0).getAttributeName();
for (JmxAttributePollConfig<?> config : configs) {
handlers.add(new AttributePollHandler<Object>(config, getEntity(), this));
if (config.getPeriod() > 0) minPeriod = Math.min(minPeriod, config.getPeriod());
}
// TODO Not good calling this holding the synchronization lock
getPoller().scheduleAtFixedRate(
new Callable<Object>() {
public Object call() throws Exception {
if (log.isDebugEnabled()) log.debug("jmx attribute polling for {} sensors at {} -> {}", new Object[] {getEntity(), jmxUri, jmxAttributeName});
return helper.getAttribute(objectName, jmxAttributeName);
}
},
new DelegatingPollHandler(handlers), minPeriod);
}
/**
* Registers to subscribe to notifications for an ObjectName, where all the given configs are for that same ObjectName + filter.
*/
private NotificationListener registerNotificationListener(Set<JmxNotificationSubscriptionConfig<?>> configs) {
final List<AttributePollHandler<javax.management.Notification>> handlers = Lists.newArrayList();
final ObjectName objectName = Iterables.get(configs, 0).getObjectName();
final NotificationFilter filter = Iterables.get(configs, 0).getNotificationFilter();
for (final JmxNotificationSubscriptionConfig<?> config : configs) {
AttributePollHandler<javax.management.Notification> handler = new AttributePollHandler<javax.management.Notification>(config, getEntity(), this) {
@Override protected Object transformValue(Object val) {
if (config.getOnNotification() != null) {
return config.getOnNotification().apply((javax.management.Notification)val);
} else {
return super.transformValue(((javax.management.Notification)val).getUserData());
}
}
};
handlers.add(handler);
}
final PollHandler<javax.management.Notification> compoundHandler = new DelegatingPollHandler(handlers);
NotificationListener listener = new NotificationListener() {
@Override public void handleNotification(Notification notification, Object handback) {
compoundHandler.onSuccess(notification);
}
};
helper.addNotificationListener(objectName, listener, filter);
return listener;
}
private void unregisterNotificationListener(ObjectName objectName, NotificationListener listener) {
try {
helper.removeNotificationListener(objectName, listener);
} catch (RuntimeException e) {
log.warn("Failed to unregister listener: "+objectName+", "+listener+"; continuing...", e);
}
}
}
|
[
"[email protected]"
] | |
fe0ecfa2eba06102b2c97b45e9c2b5687404d6ba
|
ae0e9a25377a2c637c71d6b9f01ab378919d570a
|
/springcloud/spring-cloud-spring-security/src/main/java/com/cn/springsecurity/config/UserInfo.java
|
b89582db69277e0ccbefffee40a0c9d49361c206
|
[] |
no_license
|
xiaoziyi5300/spring-cloud
|
37c5d79520fa4adb9b1e9a7a5f5969a66556f91c
|
d76addfca21d9cdc43c8cc0725e8ca784a588c61
|
refs/heads/master
| 2022-06-22T05:07:21.921334 | 2019-07-12T01:58:10 | 2019-07-12T01:58:10 | 128,165,417 | 3 | 0 | null | 2022-06-20T23:01:52 | 2018-04-05T06:01:24 |
Java
|
UTF-8
|
Java
| false | false | 2,247 |
java
|
package com.cn.springsecurity.config;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.userdetails.UserDetails;
import java.util.Collection;
/**
* @Auther: lzf
* @Date: 2018/9/15 0015 14:01
* @Description:
*/
public class UserInfo implements UserDetails {
/**
*
*/
private static final long serialVersionUID = 1L;
private String username;
private String password;
private String role;
private boolean accountNonExpired;
private boolean accountNonLocked;
private boolean credentialsNonExpired;
private boolean enabled;
public UserInfo(String username, String password, String role, boolean accountNonExpired, boolean accountNonLocked,
boolean credentialsNonExpired, boolean enabled) {
// TODO Auto-generated constructor stub
this.username = username;
this.password = password;
this.role = role;
this.accountNonExpired = accountNonExpired;
this.accountNonLocked = accountNonLocked;
this.credentialsNonExpired = credentialsNonExpired;
this.enabled = enabled;
}
// 这是权限
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
// TODO Auto-generated method stub
return AuthorityUtils.commaSeparatedStringToAuthorityList(role);
}
@Override
public String getPassword() {
// TODO Auto-generated method stub
return password;
}
@Override
public String getUsername() {
// TODO Auto-generated method stub
return username;
}
@Override
public boolean isAccountNonExpired() {
// TODO Auto-generated method stub
return accountNonExpired;
}
@Override
public boolean isAccountNonLocked() {
// TODO Auto-generated method stub
return accountNonLocked;
}
@Override
public boolean isCredentialsNonExpired() {
// TODO Auto-generated method stub
return credentialsNonExpired;
}
@Override
public boolean isEnabled() {
// TODO Auto-generated method stub
return enabled;
}
}
|
[
"[email protected]"
] | |
d1f5b4b1027b3bcd7fd0ef17c17a046d28cec956
|
9ab0c6d682a3c4979a2e1404dfb8fc46f37dc351
|
/spring-boot-learning/spring-boot-web-jsp/src/main/java/com/yqw/boot/web/jsp/controller/WelcomeController.java
|
b3a6c0b890ee194bb8426c2399b7a2105ae5d078
|
[] |
no_license
|
yang75n/middleware-framework-research
|
6ba928014a25e67ba275f16b5f0cbea3a7a842aa
|
dc7ccc24996ff41ed7d9162869ba5365e7a9ef88
|
refs/heads/master
| 2022-07-13T03:08:14.669631 | 2019-12-31T09:54:16 | 2019-12-31T09:54:16 | 132,089,551 | 0 | 0 | null | 2022-06-21T01:08:21 | 2018-05-04T05:02:21 |
JavaScript
|
UTF-8
|
Java
| false | false | 959 |
java
|
package com.yqw.boot.web.jsp.controller;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.Date;
import java.util.Map;
/**
* Created by iQiwen on 2019/5/17.
*/
@Controller
public class WelcomeController {
@Value("${application.message:Hello World}")
private String message = "Hello World";
@GetMapping("/")
public String welcome(Map<String, Object> model) {
System.out.println("access welcome model=" + model);
model.put("time", new Date());
model.put("message", this.message);
System.out.println("model=" + model);
return "welcome";
}
@RequestMapping("/err")
public String err() {
System.out.println("access err");
throw new RuntimeException("MyException");
}
}
|
[
"[email protected]"
] | |
de9f316aa227cbfe2579e5d3a232555c582f1089
|
5df1e5d98df9a818c5aa5a661aa30e0920b7d992
|
/src/main/java/com/conveyal/r5/speed_test/transit/AccessEgressLeg.java
|
60edb313f8cbe2dc44d778ace3bc335a33907cc1
|
[
"MIT"
] |
permissive
|
entur/r5
|
eba6e942f4241ff369b62fefd22ab06412568b27
|
42472d53f2fe5247bc4e302faeb59a42e6b24f99
|
refs/heads/entur_develop
| 2021-04-12T09:56:36.287517 | 2019-07-04T15:21:02 | 2019-07-04T15:21:02 | 126,152,542 | 3 | 2 |
MIT
| 2020-09-09T04:21:31 | 2018-03-21T09:13:36 |
Java
|
UTF-8
|
Java
| false | false | 695 |
java
|
package com.conveyal.r5.speed_test.transit;
import com.conveyal.r5.profile.otp2.api.transit.TransferLeg;
import com.conveyal.r5.profile.otp2.util.TimeUtils;
public class AccessEgressLeg implements TransferLeg {
private final int stop, durationInSeconds;
public AccessEgressLeg(int stop, int durationInSeconds) {
this.stop = stop;
this.durationInSeconds = durationInSeconds;
}
@Override
public int stop() {
return stop;
}
@Override
public int durationInSeconds() {
return durationInSeconds;
}
@Override
public String toString() {
return TimeUtils.timeToStrCompact(durationInSeconds) + " " + stop;
}
}
|
[
"[email protected]"
] | |
efb2e99080a7efabd6608320999f36a5647af4b4
|
139960e2d7d55e71c15e6a63acb6609e142a2ace
|
/mobile_app1/module116/src/main/java/module116packageJava0/Foo205.java
|
ba427b39ac033a7ba82ae3a726a25b725329e2a6
|
[
"Apache-2.0"
] |
permissive
|
uber-common/android-build-eval
|
448bfe141b6911ad8a99268378c75217d431766f
|
7723bfd0b9b1056892cef1fef02314b435b086f2
|
refs/heads/master
| 2023-02-18T22:25:15.121902 | 2023-02-06T19:35:34 | 2023-02-06T19:35:34 | 294,831,672 | 83 | 7 |
Apache-2.0
| 2021-09-24T08:55:30 | 2020-09-11T23:27:37 |
Java
|
UTF-8
|
Java
| false | false | 946 |
java
|
package module116packageJava0;
import java.lang.Integer;
public class Foo205 {
Integer int0;
Integer int1;
Integer int2;
public void foo0() {
new module116packageJava0.Foo204().foo18();
}
public void foo1() {
foo0();
}
public void foo2() {
foo1();
}
public void foo3() {
foo2();
}
public void foo4() {
foo3();
}
public void foo5() {
foo4();
}
public void foo6() {
foo5();
}
public void foo7() {
foo6();
}
public void foo8() {
foo7();
}
public void foo9() {
foo8();
}
public void foo10() {
foo9();
}
public void foo11() {
foo10();
}
public void foo12() {
foo11();
}
public void foo13() {
foo12();
}
public void foo14() {
foo13();
}
public void foo15() {
foo14();
}
public void foo16() {
foo15();
}
public void foo17() {
foo16();
}
public void foo18() {
foo17();
}
}
|
[
"[email protected]"
] | |
5ec62b1e9d6064eb39fd029b0b4ed922da924635
|
92dd6bc0a9435c359593a1f9b309bb58d3e3f103
|
/src/Dec2020Leetcode/_0020ValidParentheses.java
|
648883776451cb9199fc56a8c4a6f188b575341e
|
[
"MIT"
] |
permissive
|
darshanhs90/Java-Coding
|
bfb2eb84153a8a8a9429efc2833c47f6680f03f4
|
da76ccd7851f102712f7d8dfa4659901c5de7a76
|
refs/heads/master
| 2023-05-27T03:17:45.055811 | 2021-06-16T06:18:08 | 2021-06-16T06:18:08 | 36,981,580 | 3 | 3 | null | null | null | null |
UTF-8
|
Java
| false | false | 936 |
java
|
package Dec2020Leetcode;
import java.util.Stack;
public class _0020ValidParentheses {
public static void main(String[] args) {
System.out.println(isValid("()"));
System.out.println(isValid("()[]{}"));
System.out.println(isValid("(]"));
System.out.println(isValid("([)]"));
System.out.println(isValid("{[]}"));
}
public static boolean isValid(String s) {
if (s == null || s.length() == 0)
return true;
else if (s.length() % 2 != 0)
return false;
Stack<Character> stack = new Stack<Character>();
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c == '(' || c == '{' || c == '[') {
stack.push(c);
} else {
if (stack.isEmpty())
return false;
else if ((c == ')' && stack.peek() == '(') || (c == '}' && stack.peek() == '{')
|| (c == ']' && stack.peek() == '[')) {
stack.pop();
} else {
return false;
}
}
}
return stack.isEmpty();
}
}
|
[
"[email protected]"
] | |
d20388e7c122e20ca0bf0157c02efba09810f3e2
|
8ab7e3b126a8db5a67218320d9c60d4d25bb65f7
|
/ep-sys-service/src/main/java/com/hsdc/epro/control/GenerateRFPUco.java
|
644436d2cde7d50c4278fb1e12b0ccbf1c7e3946
|
[
"Apache-2.0"
] |
permissive
|
kingchang/SA12th
|
417c7d52163c50506572c1fdff3c232e7ed8052e
|
0feca44e1ad68b6dc208a62584e7e143c1d23d4a
|
refs/heads/master
| 2020-12-27T15:01:03.328143 | 2016-05-06T14:10:36 | 2016-05-06T14:10:36 | null | 0 | 0 | null | null | null | null |
WINDOWS-1252
|
Java
| false | false | 299 |
java
|
package com.hsdc.epro.control;
/**
* @author Ringle
* @version 1.0
* @created 30-¥|¤ë-2016 ¤U¤È 02:01:24
*/
public interface GenerateRFPUco {
/**
*
* @param yearlyMaterialPurchasing
*/
public String generateSuggestedSupplier(String yearlyMaterialPurchasing);
}
|
[
"[email protected]"
] | |
5db3b8c442dc7e28face7acc33fd36b1ab9ca519
|
5fab93340cc2a486ac4e14991f7edc7da4c586a1
|
/microservicios-respuestas/src/main/java/com/microservicios/app/respuestas/models/entity/Respuesta.java
|
dd02578e56f5102376df8b225f58c5834b400b2a
|
[] |
no_license
|
odilver07/Microservicios-spring
|
33e39a0eb6fa6f85a41115f0a881a56cd214dcc9
|
133c3468360b39d5b51578eb7dc7ec6bd9404359
|
refs/heads/master
| 2023-06-16T07:04:58.442293 | 2021-07-10T17:04:17 | 2021-07-10T17:04:17 | 384,748,936 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,337 |
java
|
package com.microservicios.app.respuestas.models.entity;
import org.springframework.data.annotation.Id;
//import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.mapping.Document;
import com.microservicios.commons.alumnos.models.entity.Alumno;
import com.microservicios.commons.examenes.models.entity.Pregunta;
@Document(collection = "respuestas")
public class Respuesta {
@Id
private String id;
private String texto;
// @Transient
private Alumno alumno;
private Long alumnoId;
// @Transient
private Pregunta pregunta;
private Long preguntaId;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTexto() {
return texto;
}
public void setTexto(String texto) {
this.texto = texto;
}
public Alumno getAlumno() {
return alumno;
}
public void setAlumno(Alumno alumno) {
this.alumno = alumno;
}
public Pregunta getPregunta() {
return pregunta;
}
public void setPregunta(Pregunta pregunta) {
this.pregunta = pregunta;
}
public Long getAlumnoId() {
return alumnoId;
}
public void setAlumnoId(Long alumnoId) {
this.alumnoId = alumnoId;
}
public Long getPreguntaId() {
return preguntaId;
}
public void setPreguntaId(Long preguntaId) {
this.preguntaId = preguntaId;
}
}
|
[
"[email protected]"
] | |
49a28df01d95fc393d827bdd8bbd08f9c650cc0e
|
1d5ecd04cb2d5ab4df71fde9a9c1371860806dbb
|
/NightProject/src/adrianpackage/Board.java
|
b3c98a3a93d9af77de652b75a3a5af6755294415
|
[] |
no_license
|
sleepinwolf/Java_SpeedBall
|
07e7afb7b6ddc137bf8a70758f2703e09fc166dc
|
fec88d3920b3289ecce449746d4ca91fa0b2e7b2
|
refs/heads/master
| 2020-12-31T08:39:41.526171 | 2020-02-07T15:23:11 | 2020-02-07T15:23:11 | 238,956,205 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 14,648 |
java
|
package adrianpackage;
import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import java.util.Timer;
import java.util.TimerTask;
public class Board extends JFrame implements KeyListener {
public static STATE State = STATE.MENU;
int[] speedsX = {10, 15, 20};
int backgroundBounce = 0;
private String path = "C://images/"; //// <---------- Show the path to the images example C://images/
private PreparedStatement stmt;
private String TimeString;
private String Namee;
private Connection con;
private String dbType = "mysql"; /// Database type
private String dbName = "sql7288675"; // Database Name
private String dbUser = "sql7288675"; // Databse username
private String dbPassword = "mR2Ay9gYIX"; // Database password
private String dbPort = "3306"; /// Database port.
private String dbServer = "sql7.freemysqlhosting.net"; /// <Put your own dbServer
private boolean endgame = true;
private boolean magicT = true;
private boolean magicF = false;
private int smoothness = 30;
private int bounces = 1;
private int[] speedsY = {15, 20, 24};
private JButton startButton, scoresButton, exitButton, backButton, submit;
private int counter = 0;
private int delay = 0;
private int period = 900;
private int time = 0;
private int automaticThreadCount = 0;
private Container cnt = this.getContentPane();
private JLabel ball, title, board, GameOver;
private int width = 800;
private int height = 600;
private int ballX = 100;
private int ballY = 100;
private int boardX;
private int boardY = 510;
private int boardWidth = 150;
private int ballWidth = 30;
private int ballHeight = 30;
private int boardHeight = 25;
private int speedX = 8;
private int speedY = 10;
void create() {
endgame = false;
this.setTitle("Random Speed Ball Game");
this.setSize(width, height);
this.setLocation(600, 200);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setResizable(false);
this.setLayout(null);
ImageIcon boardImg = new ImageIcon(path + "redboard.png");
ImageIcon ballImg = new ImageIcon(path + "redball.png");
board = new JLabel(boardImg);
ball = new JLabel(ballImg);
ball.setBounds(ballX, ballY, ballWidth, ballHeight);
if (State == STATE.GAME) {
ball.setVisible(true);
} else if (State == STATE.MENU) {
ball.setVisible(false);
}
board.setBounds(boardX, boardY, boardWidth, boardHeight);
board.setVisible(true);
this.add(board);
this.add(ball);
this.setMouseListener();
addKeyListener(this);
this.setVisible(true);
this.setFocusable(true);
ConnectDB();
// this.getContentPane().setBackground(Color.white);
repaintMethod();
if (State == STATE.GAME) {
automaticUpdates();
} else if (State == STATE.MENU) {
start();
}
}
public final void setMouseListener() {
this.addMouseMotionListener(new MouseMotionAdapter() {
@Override
public void mouseMoved(MouseEvent e) {
boardX = e.getX() - 55;
board.setLocation(boardX, boardY);
repaintMethod();
Toolkit.getDefaultToolkit().sync();
}
});
}
public void movement() {
if (State == STATE.GAME) {
ballY = ballY + speedY;
ballX = ballX + speedX;
int randomSpeedY = speedsY[(int) (Math.random() * 3)];
int randomSpeedX = speedsX[(int) (Math.random() * 3)];
if (ballX >= boardX && ballX <= boardX + boardWidth && ballY + 30 == 510) {
speedY = (bounces < 3) ? -10 : -randomSpeedY;
onBounce();
bounces++;
} else if (ballX <= 0) {
speedX = (bounces < 3) ? 8 : randomSpeedX;
onBounce();
} else if (ballX + 30 >= 800) {
speedX = (bounces < 3) ? -8 : -randomSpeedX;
onBounce();
} else if (ballY <= 0) {
speedY = (bounces < 3) ? 10 : randomSpeedY;
onBounce();
} else if (ballY > 610) {
State = STATE.MENU;
repaintMethod();
GameOver(true);
endgame = false;
JTextField java = new JTextField();
ImageIcon restrictedImg = new ImageIcon(path + "only15.png");
JLabel restricted = new JLabel(restrictedImg);
restricted.setBounds(240, 410, 320, 50);
this.add(restricted);
restricted.setVisible(false);
ImageIcon submitButtonImg = new ImageIcon(path + "submit.png");
submit = new JButton(submitButtonImg);
java.setBounds(342, 310, 120, 20);
submit.setBounds(292, 350, 220, 50);
this.add(java);
this.add(submit);
java.setVisible(true);
submit.setVisible(true);
submit.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (java.getText().length() <= 15) {
Namee = java.getText();
GameOver.setVisible(false);
TimeString = "" + time;
addHighscore(Namee, TimeString);
visibleZero();
create();
} else {
submit.setIcon(new ImageIcon(path + "submitred.png"));
restricted.setVisible(true);
repaintMethod();
java.setText("");
}
}
});
}
time++;
ball.setLocation(ballX, ballY);
}
}
void automaticUpdates() { ///
if (automaticThreadCount == 0) {
new Thread(new Runnable() {
public void run() {
Timer t = new Timer(); // J
t.scheduleAtFixedRate(
new TimerTask() {
public void run() {
movement();
repaintMethod();
}
}, delay, period / smoothness); //
}
}).start();
} else if (automaticThreadCount == 1) {
/// lai thread nepalaižas vēlreiz no jauna, bet turpina esošo no pirmās reizes.
}
}
void setRandomBackground() {
Color c = new Color((int) (Math.random() * 255), (int) (Math.random() * 255), (int) (Math.random() * 255));
this.getContentPane().setBackground(c);
}
void onBounce() {
backgroundBounce++;
setRandomBackground();
}
public void start() {
if (State == STATE.MENU) {
Container startMenu = this.getContentPane();
startMenu.setLayout(null);
ImageIcon startButtonImg = new ImageIcon(path + "start2.png");
ImageIcon scoresButtonImg = new ImageIcon(path + "scores.png");
ImageIcon exitButtonImg = new ImageIcon(path + "exit.png");
ImageIcon titleButtonImg = new ImageIcon(path + "title.png");
ImageIcon backButtonImg = new ImageIcon(path + "back.png");
title = new JLabel(titleButtonImg);
startButton = new JButton(startButtonImg);
scoresButton = new JButton(scoresButtonImg);
exitButton = new JButton(exitButtonImg);
backButton = new JButton(backButtonImg);
startMenu.add(title);
title.setBounds(0, 60, 800, 130);
startMenu.add(startButton);
startButton.setBounds(292, 205, 220, 50);
startMenu.add(scoresButton);
scoresButton.setMnemonic(KeyEvent.VK_H);
scoresButton.setBounds(292, 260, 220, 50);
startMenu.add(exitButton);
exitButton.setMnemonic(KeyEvent.VK_E);
exitButton.setBounds(292, 315, 220, 50);
startMenu.add(backButton);
backButton.setMnemonic(KeyEvent.VK_E);
backButton.setBounds(292, 375, 220, 50);
backButton.setVisible(false);
startButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (counter == 0) {
State = STATE.GAME;
repaintMethod();
setVisibleThings();
automaticUpdates();
counter++;
repaintMethod();
endgame = true;
automaticThreadCount++;
} else if (counter >= 1) {
magicF = false;
magicT = true;
setVisibleThings();
State = STATE.GAME;
automaticUpdates();
repaintMethod();
automaticThreadCount++;
}
}
});
}
exitButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
scoresButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
startButton.setVisible(false);
scoresButton.setVisible(false);
exitButton.setVisible(false);
backButton.setVisible(true);
AddScoreTableToFrame();
}
});
}
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
int keyCode = e.getKeyCode();
if (keyCode == KeyEvent.VK_ESCAPE && endgame) {
State = STATE.MENU;
magicF = true;
magicT = false;
setVisibleThings();
backButton.setVisible(false);
this.getContentPane().setBackground(Color.WHITE);
automaticThreadCount++;
}
}
@Override
public void keyReleased(KeyEvent e) {
}
public void setVisibleThings() {
startButton.setVisible(magicF);
scoresButton.setVisible(magicF);
exitButton.setVisible(magicF);
title.setVisible(magicF);
ball.setVisible(magicT);
}
public void GameOver(boolean a) {
ImageIcon GameOverImg = new ImageIcon(path + "gameover.png");
GameOver = new JLabel(GameOverImg);
this.add(GameOver);
GameOver.setBounds(200, 140, 400, 150);
GameOver.setVisible(a);
this.getContentPane().setBackground(Color.white);
this.repaintMethod();
}
public void visibleZero() {
dispose();
this.getContentPane().removeAll();
revalidate();
this.repaintMethod();
counter = 0;
magicT = true;
magicF = false;
backgroundBounce = 0;
smoothness = 30;
bounces = 1;
width = 800;
height = 600;
ballX = 100;
ballY = 100;
boardY = 510;
boardWidth = 150;
ballWidth = 30;
ballHeight = 30;
boardHeight = 25;
speedX = 8;
speedY = 10;
counter = 0;
int[] speedsXnew = {10, 15, 20};
int[] speedsYnew = {15, 20, 24};
speedsX = speedsXnew;
speedsY = speedsYnew;
time = 0;
}
public void repaintMethod() {
String osName = System.getProperty("os.name");
if (osName.contains("Linux")) {
repaint();
Toolkit.getDefaultToolkit().sync();
} else {
repaint();
}
}
public void ConnectDB() {
try {
con = DriverManager.getConnection("jdbc:" + dbType + "://" + dbServer + ":" + dbPort + "/" + dbName, dbUser, dbPassword);
System.out.println("Connected to database successfully!");
} catch (SQLException ex) {
System.out.println("Could not connect to database");
}
}
public void AddScoreTableToFrame() {
DefaultTableModel model = new DefaultTableModel();
JTable scoreTable = new JTable(model);
cnt.setLayout(null);
model.addColumn("Name");
model.addColumn("Score");
try {
PreparedStatement pstm = con.prepareStatement("SELECT * FROM Score ORDER BY `Score`+0 DESC LIMIT 10");
ResultSet Rs = pstm.executeQuery();
while (Rs.next()) {
model.addRow(new Object[]{Rs.getString(1), Rs.getString(2)});
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
((DefaultTableCellRenderer) scoreTable.getDefaultRenderer(Object.class)).setOpaque(false);
scoreTable.setOpaque(false);
scoreTable.setShowGrid(false);
scoreTable.setBounds(292, 200, 220, 160);
scoreTable.setEnabled(false);
this.add(scoreTable);
backButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
startButton.setVisible(true);
scoresButton.setVisible(true);
exitButton.setVisible(true);
backButton.setVisible(false);
scoreTable.setVisible(false);
}
});
}
void addHighscore(String Namee, String TimeString) {
try {
String query = "INSERT INTO `Score` ( `Name`, `Score`) VALUES ('" + Namee + "','" + TimeString + "')";
stmt = con.prepareStatement(query);
stmt.executeUpdate(query);
} catch (Exception e) {
System.err.println("Error at Score");
e.printStackTrace();
}
}
public enum STATE {
MENU,
GAME
}
}
|
[
"[email protected]"
] | |
096370fff278b7691ac1bf0f53117f5ae9813a94
|
2b2cade0d454ca05ec2e1dbdb7e5812ca0b31762
|
/storm-realtime-analytics/src/main/java/org/shirdrn/storm/analytics/RealtimeAnalyticsTopology.java
|
3f5510bfc201ca9203a13ffc140ae357f393c64f
|
[
"Apache-2.0"
] |
permissive
|
shirdrn/storm-realtime
|
2105b5d252efe59b456a0b26db048d747fe01a9d
|
9c238b10f62665190a622a8eff288a7a5403ad1d
|
refs/heads/master
| 2016-09-06T04:14:01.692835 | 2015-11-09T02:06:01 | 2015-11-09T02:06:01 | 29,582,044 | 4 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,704 |
java
|
package org.shirdrn.storm.analytics;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.shirdrn.storm.analytics.bolts.EventFilterBolt;
import org.shirdrn.storm.analytics.bolts.EventStatBolt;
import org.shirdrn.storm.analytics.bolts.EventStatResultPersistBolt;
import org.shirdrn.storm.analytics.constants.StatFields;
import org.shirdrn.storm.analytics.utils.RealtimeUtils;
import org.shirdrn.storm.analytics.utils.TestUtils;
import org.shirdrn.storm.commons.constants.Keys;
import org.shirdrn.storm.commons.utils.TopologyUtils;
import storm.kafka.KafkaSpout;
import backtype.storm.Config;
import backtype.storm.LocalCluster;
import backtype.storm.StormSubmitter;
import backtype.storm.topology.TopologyBuilder;
import backtype.storm.topology.base.BaseRichSpout;
import backtype.storm.tuple.Fields;
/**
* Real-time event analytics, the topology definition stream graph is depict as follows:
* <pre>
* +------------+ +-----------------+ +---------------------+ +----------------------------+
* | KafkaSpout | --> | EventFilterBolt | --> | EventStatisticsBolt | --> | EventStatResultPersistBolt |
* +------------+ +-----------------+ +---------------------+ +----------------------------+
* </pre>
* <ol>
* <li>{@link KafkaSpout} </li> : Read event data from Kafka MQ(topic: topic_json_event)
* <li>{@link EventFilterBolt} </li> : Filter and distribute events.
* <li>{@link EventStatBolt} </li> : Event statistics.
* <li>{@link EventStatResultPersistBolt} </li> : Persist result to Redis.
* </ol>
*
* @author Yanjun
*/
public class RealtimeAnalyticsTopology {
private static final Log LOG = LogFactory.getLog(RealtimeAnalyticsTopology.class);
private static TopologyBuilder buildTopology(Configuration conf, String topic) {
return buildTopology(false, conf, topic);
}
/**
* Configure a topology based on known Storm components(Spout, Bolt).
* @param conf
* @return
*/
private static TopologyBuilder buildTopology(boolean isDebug, Configuration conf, String topic) {
LOG.info("Building topology...");
TopologyBuilder builder = new TopologyBuilder();
// naming Storm components
String kafkaEventReader = "kafka-event-reader";
String eventFilter = "event-filter";
String eventStatistics = "event-statistics";
String eventStatPersistence = "event-stat-persistence";
// configure Kafka spout
BaseRichSpout kafkaSpout = null;
if(isDebug) {
kafkaSpout = TestUtils.getTestSpout();
} else {
kafkaSpout = RealtimeUtils.newKafkaSpout(topic, conf);
}
builder.setSpout(kafkaEventReader, kafkaSpout, 1);
// configure filter bolt
builder
.setBolt(eventFilter, new EventFilterBolt(), 1)
.shuffleGrouping(kafkaEventReader)
.setNumTasks(1);
// configure statistics bolt
builder
.setBolt(eventStatistics, new EventStatBolt(), 2)
.shuffleGrouping(eventFilter)
.setNumTasks(2);
// configure persistence bolt
builder
.setBolt(eventStatPersistence, new EventStatResultPersistBolt(), 2)
.fieldsGrouping(eventStatistics, new Fields(StatFields.STAT_INDICATOR))
.setNumTasks(2);
LOG.info("Topology built: " + TopologyUtils.toString(
RealtimeAnalyticsTopology.class.getSimpleName(),
kafkaEventReader, eventFilter, eventStatistics, eventStatPersistence));
return builder;
}
public static void main(String[] args) throws Exception {
Configuration externalConf = RealtimeUtils.getDefaultConfiguration();
String topic = externalConf.getString(Keys.KAFKA_BROKER_TOPICS);
// submit topology
String nimbus = externalConf.getString(Keys.STORM_NIMBUS_HOST);
Config stormConf = new Config();
String name = RealtimeAnalyticsTopology.class.getSimpleName();
// configure topology
TopologyBuilder builder = null;
if(args.length == 0) {
builder = buildTopology(true, externalConf, topic);
} else {
builder = buildTopology(externalConf, topic);
}
// production use
if (args != null && args.length > 0) {
name = args[0];
stormConf.put(Config.NIMBUS_HOST, nimbus);
stormConf.setNumWorkers(4);
StormSubmitter.submitTopologyWithProgressBar(name, stormConf, builder.createTopology());
} else {
// debugging using local cluster
stormConf.setDebug(true);
LocalCluster cluster = new LocalCluster();
cluster.submitTopology(name, stormConf, builder.createTopology());
int sleep = 60 * 60 * 1000;
Thread.sleep(sleep);
cluster.shutdown();
}
}
}
|
[
"[email protected]"
] | |
f32a3a4f5bcc23dfb5baadae3b647dbda5720984
|
7f28e8fca2b493f193c3746caa2e16be8620d6c5
|
/dadao_pointsrebate_consumer/dadao_pointsrebate_consumer_api/dadao_pointsrebate_consumer_userinterface/src/main/java/com/dadao/shop/controller/ShopController.java
|
761cd36f1d6ed97ff7b0d57b40daed682333e652
|
[] |
no_license
|
xiaoniu0813/dadao_pointsrebate_parent
|
3704eb4ef89f5cd1a5204a74e8bc75baa4db9e8d
|
c53325886402b126bf7b86eb3f54b187fc456620
|
refs/heads/master
| 2021-05-11T22:18:49.704024 | 2018-01-15T02:46:34 | 2018-01-15T02:46:34 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,090 |
java
|
package com.dadao.shop.controller;
import com.dadao.pub.utils.DADAO;
import com.dadao.shop.entity.RecommendPosition;
import com.dadao.shop.entity.ShopPO;
import com.dadao.shop.service.ShopService;
import com.dadao.utils.QueryResult;
import com.dadao.utils.Result;
import com.dadao.utils.ResultCode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Created by yangrui on 2017/7/16.
*/
@RestController
public class ShopController {
private Logger logger = LoggerFactory.getLogger(ShopController.class);
@Autowired
private ShopService shopService;
/**
* @Author: yangrui
* @Description: 轮播图、推荐位商户列表
* @Date: 上午9:24 2017/7/14
*/
@PostMapping(value = "listRecommendPositions")
public Object listActivities(@RequestParam(value = "pageNum", required = false, defaultValue = "1") int pageNum, RecommendPosition recommendPosition, HttpServletRequest request, HttpServletResponse response) {
recommendPosition.setBeginIndex((pageNum - 1) * recommendPosition.getPageSize());
QueryResult result = shopService.findByPage(recommendPosition);
result.setPageNum(pageNum);
return DADAO.encryption(request, response, new Result(ResultCode.SYS_SUCCESS, result));
}
@PostMapping(value = "/findShopById")
public Object findShopById(Integer shopId,HttpServletRequest request, HttpServletResponse response){
return DADAO.encryption(request, response, shopService.findShopById(shopId));
}
@PostMapping(value = "/findShopByConditions")
public Object listShops(ShopPO shopPO,@RequestParam(value = "pageNum",defaultValue = "1") Integer pageNum, Integer type,HttpServletRequest request, HttpServletResponse response){
return DADAO.encryption(request, response, shopService.getShopByConditions(shopPO, pageNum, type));
}
@PostMapping(value = "/findStartupShop")
public Object listShops(HttpServletRequest request, HttpServletResponse response){
return DADAO.encryption(request, response, shopService.findStartupShop());
}
@PostMapping(value = "/findShopsByRankType")
public Object findShopsByRankType(String longitude, String latitude, Long categoryId, Integer rankType, Integer pageNum, Integer pageSize,HttpServletRequest request, HttpServletResponse response){
return DADAO.encryption(request, response, shopService.findShopsByRankType(longitude, latitude, categoryId, rankType, pageNum, pageSize));
}
@PostMapping(value = "/findStore")
public Object findStore(ShopPO shopPO,HttpServletRequest request, HttpServletResponse response){
return DADAO.encryption(request, response,new Result(ResultCode.SYS_SUCCESS, shopService.list(shopPO)));
}
}
|
[
"[email protected]"
] | |
c62df082d18ab57d7791fd9ce30cb0e6d138983a
|
0e02393f6d9c09f2453c3e7bc729052ff74f922f
|
/hBPostal/src/main/java/com/ksource/hbpostal/activity/ConfirmOrder.java
|
caacea3bb33a6f0d1ad00567c60f2c61a0fc909d
|
[] |
no_license
|
eaglelhq/HBPostal
|
fbcb6765d082940cb3511c2312ab9b1cbe8c3180
|
76df376aed3022506bbb1eacc598dbc1377242ba
|
refs/heads/master
| 2021-05-05T19:55:44.299097 | 2018-11-12T02:49:23 | 2018-11-12T02:49:23 | 103,887,994 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 26,017 |
java
|
package com.ksource.hbpostal.activity;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
import android.content.Intent;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.google.gson.Gson;
import com.ksource.hbpostal.R;
import com.ksource.hbpostal.adapter.DefaultBaseAdapter;
import com.ksource.hbpostal.bean.DefAddrResaultBean;
import com.ksource.hbpostal.bean.GoodsResultBean.GoodsInfoBean;
import com.ksource.hbpostal.bean.PostalResultBean;
import com.ksource.hbpostal.bean.PostalResultBean.PostalBean;
import com.ksource.hbpostal.bean.SubOrderResultBean;
import com.ksource.hbpostal.config.ConstantValues;
import com.ksource.hbpostal.util.DataUtil;
import com.ksource.hbpostal.util.ImageLoaderUtil;
import com.ksource.hbpostal.widgets.MyListView;
import com.yitao.dialog.LoadDialog;
import com.yitao.util.ConvertUtil;
import com.yitao.util.DialogUtil;
import com.yitao.util.NumberUtil;
import com.yitao.util.ToastUtil;
import com.zhy.http.okhttp.callback.StringCallback;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import okhttp3.Call;
/**
* 单件商品直接购买-确认订单
*/
public class ConfirmOrder extends BaseActivity {
private static final int REQUEST_CODE = 100;
private TextView tv_title;
private ImageView iv_back;
private TextView tv_sh_name, tv_phone, tv_addr, tv_delivery_mode,
tv_postal, tv_count, tv_money, tv_jifen, tv_postal_money;
private EditText et_message;
private RelativeLayout iv_more;
private MyListView lv_goods_list;
private Button btn_submit;
private LinearLayout ll_chioce_postal;
private BaseAdapter adapter;
private List<GoodsInfoBean> datas;
private double money;
private double sendPrice;
private int jifen;
private GoodsInfoBean goodsBean;
private int number;
private LoadDialog mLoadDialog;
private String[] postals;
private List<PostalBean> postaslList;
private String sendType = "";
private String goodIds = "";
private String buyNums = "";
private String addressId = "";
private String provinceId = "";
private String postalName = "";
private String postalId = "";
private String orderNote = "";
private String deliveryMode = "";
private String token;
@Override
public int getLayoutResId() {
return R.layout.activity_confirm_order;
}
@Override
public void initView() {
// 头部
tv_title = (TextView) findViewById(R.id.tv_title);
tv_title.setText("确认订单");
iv_back = (ImageView) findViewById(R.id.iv_back);
// 内容
iv_more = (RelativeLayout) findViewById(R.id.ll_addr);
tv_sh_name = (TextView) findViewById(R.id.tv_sh_name);
tv_phone = (TextView) findViewById(R.id.tv_phone);
tv_addr = (TextView) findViewById(R.id.tv_addr);
tv_delivery_mode = (TextView) findViewById(R.id.tv_delivery_mode);
tv_postal = (TextView) findViewById(R.id.tv_postal);
tv_postal_money = (TextView) findViewById(R.id.tv_postal_money);
et_message = (EditText) findViewById(R.id.et_message);
lv_goods_list = (MyListView) findViewById(R.id.lv_goods_list);
ll_chioce_postal = (LinearLayout) findViewById(R.id.ll_chioce_postal);
// 底部
tv_count = (TextView) findViewById(R.id.tv_count);
tv_money = (TextView) findViewById(R.id.tv_money);
// tv_jifen = (TextView) findViewById(R.id.tv_jifen);
btn_submit = (Button) findViewById(R.id.btn_submit);
}
@Override
public void initListener() {
iv_back.setOnClickListener(this);
iv_more.setOnClickListener(this);
tv_delivery_mode.setOnClickListener(this);
tv_postal.setOnClickListener(this);
btn_submit.setOnClickListener(this);
}
@Override
public void initData() {
token = sp.getString(ConstantValues.TOKEN, null);
goodsBean = (GoodsInfoBean) getIntent().getSerializableExtra(
"goodsBean");
number = getIntent().getIntExtra("number", 1);
getDefaultAddr();
//默认配送方式
tv_delivery_mode.setText("网点自提");
ll_chioce_postal.setVisibility(View.VISIBLE);
tv_postal_money.setText("免邮费");
getPostal();
// tv_postal.setText("");
datas = new ArrayList<>();
datas.add(goodsBean);
adapter = new MyAdapter(datas);
lv_goods_list.setAdapter(adapter);
tv_count.setText(number + "件");
// tv_postal_money.setText(sendPrice + "元");
money = ConvertUtil.obj2Double(goodsBean.PRICE);
money = NumberUtil.mul(money, ConvertUtil.obj2Double(number));
// DecimalFormat f = new DecimalFormat("0.00");
// money = Float.parseFloat(f.format(money));
jifen = ConvertUtil.obj2Int(goodsBean.INTEGRAL) * number;
// tv_jifen.setText("" + jifen);
setMoney();
deliveryMode = tv_delivery_mode.getText().toString().trim();
}
//设置支付共计
private void setMoney() {
if (money == 0) {
tv_money.setText(jifen + "积分");
} else if (jifen == 0) {
tv_money.setText("¥" + NumberUtil.toDecimal2(money));
} else {
tv_money.setText("¥" + NumberUtil.toDecimal2(money) + "+" + jifen + "积分");
}
}
// private void setDefaultAddr() {
// // tv_sh_name.setText(sp.getString(ConstantValues.DEFAULT_NAME, ""));
// // tv_phone.setText(sp.getString(ConstantValues.DEFAULT_PHONE, ""));
// // tv_addr.setText(sp.getString(ConstantValues.DEFAULT_ADDR, ""));
// // addressId = sp.getString(ConstantValues.DEFAULT_ADDR_ID, "");
// // provinceId = sp.getString(ConstantValues.PROVINCE_ID, "");
// if (!TextUtils.isEmpty(provinceId)) {
// getPostMoney();
// }
// }
// 回调方法,从第二个页面回来的时候会执行这个方法
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (data == null) {
return;
}
String addr = data.getStringExtra("addr");
String userName = data.getStringExtra("userName");
String phone = data.getStringExtra("phone");
String addrId = data.getStringExtra("addrId");
String provinceId = data.getStringExtra("provinceId");
// 根据上面发送过去的请求吗来区别
if (requestCode == this.REQUEST_CODE) {
setAddr(userName, phone, addr, addrId, provinceId);
}
}
private void setAddr(String userName, String phone, String addr,
String addrId, String provinceId) {
tv_sh_name.setText(userName);
tv_phone.setText(phone);
tv_addr.setText(addr);
this.addressId = addrId;
this.provinceId = provinceId;
if ("邮政配送".equals(deliveryMode)) {
ll_chioce_postal.setVisibility(View.GONE);
getPostMoney();
} else if ("网点自提".equals(deliveryMode)) {
ll_chioce_postal.setVisibility(View.VISIBLE);
tv_postal_money.setText("免邮费");
getPostal();
}
}
private void getText() {
sendType = "网点自提".equals(deliveryMode) ? "2" : "1";
goodIds = goodsBean.ID;
buyNums = number + "";
orderNote = et_message.getText().toString().trim();
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.iv_back:
finish();
break;
case R.id.ll_addr:
// ToastUtil.showTextToast(context, "去设置收货地址");
Intent intent = new Intent(context, ChioceAddrActivity.class);
startActivityForResult(intent, REQUEST_CODE);
break;
case R.id.btn_submit:
if (TextUtils.isEmpty(token)) {
// finish();
startActivity(new Intent(context, LoginActivity.class));
}
if (TextUtils.isEmpty(addressId)) {
// new SweetAlertDialog(context).setTitleText("请先选择收货地址!").show();
ToastUtil.showTextToast(context, "请先选择收货地址!");
return;
}
if ("网点自提".equals(deliveryMode)
&& TextUtils.isEmpty(tv_postal.getText().toString().trim())) {
// new SweetAlertDialog(context).setTitleText("请选择自提网点!").show();
ToastUtil.showTextToast(context, "请选择自提网点!");
return;
}
getText();
submitOrder();
break;
case R.id.tv_delivery_mode:
// ToastUtil.showTextToast(context, "选择配送方式");
chioceMode();
break;
case R.id.tv_postal:
// ToastUtil.showTextToast(context, "选择邮局");
chiocePostal(postals);
break;
default:
break;
}
}
// 提交订单
private void submitOrder() {
mLoadDialog = DialogUtil.getInstance().showLoadDialog(context,
"提交订单中...");
Map<String, String> params = new HashMap<String, String>();
params.put("token", token);
params.put("send_type", sendType);
params.put("goodIds", goodIds);
params.put("buyNums", buyNums);
params.put("addressId", addressId);
if ("2".equals(sendType)) {
params.put("take_place", postalName);
params.put("take_place_id", postalId);
}else{
params.put("take_place", "");
params.put("take_place_id", "");
}
params.put("order_note", orderNote);
params.put("send_price", sendPrice + "");
StringCallback callback = new StringCallback() {
@Override
public void onResponse(String arg0, int arg1) {
DialogUtil.getInstance().dialogDismiss(mLoadDialog);
Gson gson = new Gson();
SubOrderResultBean subResult = null;
try {
subResult = gson.fromJson(arg0,
SubOrderResultBean.class);
} catch (Exception e) {
e.printStackTrace();
}
if (subResult == null) {
ToastUtil.showTextToast(context, "提交订单失败!");
return;
}
if (subResult.success) {
final String orderId = subResult.orderId;
ToastUtil.showTextToast(context, "提交订单成功!");
btn_submit
.setEnabled(false);
Intent intent = new Intent(
context,
PayActivity.class);
intent.putExtra("orderId",
orderId);
intent.putExtra("money",
money + sendPrice
+ "");
intent.putExtra("jifen",
jifen + "");
intent.putExtra(
"goodsName",
datas.get(0).NAME);
intent.putExtra(
"image",
datas.get(0).goodsImgList
.get(0).FILE_PATH);
startActivity(intent);
} else if (subResult.flag == 10) {
mApplication.login();
// submitOrder();
} else {
ToastUtil.showTextToast(context, "提交订单失败!");
}
}
@Override
public void onError(Call arg0, Exception arg1, int arg2) {
DialogUtil.getInstance().dialogDismiss(mLoadDialog);
ToastUtil.showTextToast(context, "提交订单失败!");
}
};
DataUtil.doPostAESData(mLoadDialog, context, ConstantValues.SUBMIT_ORDER_URL, params, callback);
}
class MyAdapter extends DefaultBaseAdapter<GoodsInfoBean> {
private ViewHolder holder;
public MyAdapter(List<GoodsInfoBean> datas) {
super(datas);
}
@SuppressWarnings("finally")
@Override
public View getView(final int position, View convertView,
ViewGroup parent) {
holder = null;
if (convertView == null) {
convertView = View.inflate(context, R.layout.item_cart_goods,
null);
holder = new ViewHolder();
holder.cb_chioce = (CheckBox) convertView
.findViewById(R.id.cb_chioce);
holder.tv_name_list_item = (TextView) convertView
.findViewById(R.id.tv_name_list_item);
holder.iv_goods_icon = (ImageView) convertView
.findViewById(R.id.iv_goods_icon);
holder.tv_goods_jifen = (TextView) convertView
.findViewById(R.id.tv_goods_jifen);
holder.tv_jifen_name = (TextView) convertView
.findViewById(R.id.tv_jifen_name);
holder.tv_goods_price = (TextView) convertView
.findViewById(R.id.tv_goods_price);
holder.tv_add = (TextView) convertView
.findViewById(R.id.tv_add);
holder.tv_goods_number = (TextView) convertView
.findViewById(R.id.tv_goods_number);
holder.tv_cate_name = (TextView) convertView
.findViewById(R.id.tv_cate_name);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
// 填数据
holder.cb_chioce.setVisibility(View.GONE);
holder.tv_name_list_item.setText(datas.get(position).NAME);
holder.tv_cate_name.setText(datas.get(position).LV1_NAME + " "
+ datas.get(position).LV2_NAME + " "
+ datas.get(position).LV3_NAME);
double useMoney = ConvertUtil.obj2Double(datas.get(position).PRICE);
int useScore = ConvertUtil.obj2Int(datas.get(position).INTEGRAL);
int type = 0;
if (useMoney == 0.0){
type = 3;
}else if (useScore == 0){
type = 1;
}else{
type = 2;
}
switch (type) {
case 1:
holder.tv_goods_price.setText("¥" + NumberUtil.toDecimal2(useMoney));
holder.tv_add.setVisibility(View.GONE);
holder.tv_jifen_name.setVisibility(View.GONE);
holder.tv_goods_jifen.setVisibility(View.GONE);
break;
case 2:
holder.tv_goods_price.setText("¥" + NumberUtil.toDecimal2(useMoney));
holder.tv_add.setVisibility(View.VISIBLE);
holder.tv_goods_jifen.setVisibility(View.VISIBLE);
holder.tv_goods_jifen.setText(useScore + "");
holder.tv_jifen_name.setVisibility(View.VISIBLE);
break;
case 3:
holder.tv_goods_price.setVisibility(View.GONE);
holder.tv_add.setVisibility(View.GONE);
holder.tv_goods_jifen.setText(useScore + "");
holder.tv_goods_jifen.setVisibility(View.VISIBLE);
holder.tv_jifen_name.setVisibility(View.VISIBLE);
break;
default:
break;
}
holder.tv_goods_number.setText("×" + number);
try {
ImageLoaderUtil
.loadNetPic(
ConstantValues.BASE_URL
+ datas.get(position).goodsImgList
.get(0).FILE_PATH,
holder.iv_goods_icon);
} catch (Exception e) {
System.out.println(e.getMessage());
} finally {
return convertView;
}
}
}
class ViewHolder {
private CheckBox cb_chioce;
private ImageView iv_goods_icon;
private TextView tv_name_list_item;
private TextView tv_goods_price;
private TextView tv_add;
private TextView tv_goods_jifen;
private TextView tv_jifen_name;
private TextView tv_cate_name;
private TextView tv_goods_number;
}
public void chioceMode() {
Builder builder = new Builder(this);
builder.setTitle("请选择配送方式");
final String[] cities = new String[]{"网点自提", "邮政配送"};
builder.setItems(cities, new DialogInterface.OnClickListener() {
/*
* 第一个参数代表对话框对象 第二个参数是点击对象的索引
*/
@Override
public void onClick(DialogInterface dialog, int which) {
tv_delivery_mode.setText(cities[which]);
switch (which) {
case 0:
deliveryMode = cities[0];
ll_chioce_postal.setVisibility(View.VISIBLE);
tv_postal_money.setText("免邮费");
sendPrice = 0;
tv_money.setText("¥" + money);
getPostal();
break;
case 1:
deliveryMode = cities[1];
ll_chioce_postal.setVisibility(View.GONE);
if (!TextUtils.isEmpty(provinceId)) {
getPostMoney();
} else {
ToastUtil.showTextToast(context, "请选择收货地址!");
}
break;
default:
break;
}
}
});
builder.show();
}
// 获取邮费
private void getPostMoney() {
Map<String, String> params = new HashMap<String, String>();
params.put("id", provinceId);
StringCallback callback = new StringCallback() {
@Override
public void onResponse(String arg0, int arg1) {
DialogUtil.getInstance().dialogDismiss(mLoadDialog);
PostalResultBean postalResult = null;
try {
Gson gson = new Gson();
postalResult = gson.fromJson(arg0,
PostalResultBean.class);
} catch (Exception e) {
e.printStackTrace();
}
if (postalResult == null) {
ToastUtil.showTextToast(context, "获取邮费失败!");
return;
}
if (postalResult.success) {
tv_postal_money.setText(NumberUtil.toDecimal2(postalResult.money) + "元");
sendPrice = postalResult.money;
tv_money.setText("¥" + NumberUtil.add(money, sendPrice));
} else {
ToastUtil.showTextToast(context, postalResult.msg);
}
}
@Override
public void onError(Call arg0, Exception arg1, int arg2) {
DialogUtil.getInstance().dialogDismiss(mLoadDialog);
ToastUtil.showTextToast(context, "获取邮费失败!");
}
};
DataUtil.doPostAESData(mLoadDialog, context, ConstantValues.GET_POST_MONEY_URL, params, callback);
}
// 获取默认收货地址
private void getDefaultAddr() {
Map<String, String> params = new HashMap<String, String>();
params.put("token", token);
params.put("type", "1");
StringCallback callback = new StringCallback() {
@Override
public void onResponse(String arg0, int arg1) {
DialogUtil.getInstance().dialogDismiss(mLoadDialog);
DefAddrResaultBean addrResult = null;
try {
Gson gson = new Gson();
addrResult = gson.fromJson(arg0,
DefAddrResaultBean.class);
} catch (Exception e) {
e.printStackTrace();
}
if (addrResult == null) {
ToastUtil.showTextToast(context, "获取默认收货地址失败!");
return;
}
if (addrResult.success) {
if (!TextUtils.isEmpty(addrResult.address.NAME)) {
tv_sh_name.setText(addrResult.address.NAME);
}
if (!TextUtils.isEmpty(addrResult.address.MOBILE)) {
tv_phone.setText(addrResult.address.MOBILE);
}
if (!TextUtils
.isEmpty(addrResult.address.PROVINCE_NAME)
&& !TextUtils
.isEmpty(addrResult.address.ADDRESS)) {
tv_addr.setText(addrResult.address.PROVINCE_NAME
+ addrResult.address.CITY_NAME
+ addrResult.address.AREA_NAME
+ addrResult.address.ADDRESS);
}
if (!TextUtils.isEmpty(addrResult.address.ID)) {
addressId = addrResult.address.ID;
}
if (!TextUtils
.isEmpty(addrResult.address.PROVINCE_ID)) {
provinceId = addrResult.address.PROVINCE_ID;
}
if (!TextUtils.isEmpty(provinceId) && "1".equals(sendType)) {
getPostMoney();
}
} else {
ToastUtil.showTextToast(context, addrResult.msg);
}
}
@Override
public void onError(Call arg0, Exception arg1, int arg2) {
DialogUtil.getInstance().dialogDismiss(mLoadDialog);
ToastUtil.showTextToast(context, "获取默认收货地址失败!");
}
};
DataUtil.doPostAESData(mLoadDialog, context, ConstantValues.GET_DEFAULT_ADDR, params, callback);
}
// 获取邮局网点列表
private void getPostal() {
mLoadDialog = DialogUtil.getInstance().showLoadDialog(context,
"获取自提网点...");
StringCallback callback = new StringCallback() {
@Override
public void onResponse(String arg0, int arg1) {
DialogUtil.getInstance().dialogDismiss(mLoadDialog);
Gson gson = new Gson();
PostalResultBean postalResult = null;
try {
postalResult = gson.fromJson(
arg0, PostalResultBean.class);
} catch (Exception e) {
e.printStackTrace();
}
if (postalResult == null) {
ToastUtil.showTextToast(context, " 获取邮局网点失败!");
return;
}
if (postalResult.success) {
if (postalResult.branchList != null
&& postalResult.branchList.size() > 0) {
postaslList = postalResult.branchList;
postalId = postaslList.get(0).ID;
postalName = postaslList.get(0).NAME;
tv_postal.setText(postalName);
postals = new String[postaslList.size()];
for (int i = 0; i < postaslList.size(); i++) {
postals[i] = postaslList.get(i).NAME;
}
}
} else {
ToastUtil.showTextToast(context, postalResult.msg);
}
}
@Override
public void onError(Call arg0, Exception arg1, int arg2) {
DialogUtil.getInstance().dialogDismiss(mLoadDialog);
}
};
DataUtil.doGetData(mLoadDialog, context, ConstantValues.GET_STATION_URL, callback);
}
public void chiocePostal(final String[] postals) {
Builder builder = new Builder(this);
builder.setTitle("请选择自提网点");
builder.setItems(postals, new DialogInterface.OnClickListener() {
/*
* 第一个参数代表对话框对象 第二个参数是点击对象的索引
*/
@Override
public void onClick(DialogInterface dialog, int which) {
postalId = postaslList.get(which).ID;
postalName = postaslList.get(which).NAME;
tv_postal.setText(postalName);
}
});
builder.show();
}
}
|
[
"[email protected]"
] | |
481722fb4738b58bbfca4249cd58dcb3520a1a5d
|
a8a067e36c3a77dff2753a1e3c8ec5b6367428df
|
/app/src/main/java/com/example/sharedpreferences/data/LoginRepository.java
|
970348960fd97e9365cb4ffcf629bef8de22fe78
|
[] |
no_license
|
joaoanderson/exemplo-shared-preferences
|
45bf3325cc02ce91f9a6edbfa2580662518c40f4
|
0e5d9129be769ada76998ab665cc6d6717e2916b
|
refs/heads/master
| 2023-01-29T20:36:48.042239 | 2020-12-16T00:35:22 | 2020-12-16T00:35:22 | 321,821,628 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,728 |
java
|
package com.example.sharedpreferences.data;
import com.example.sharedpreferences.data.model.LoggedInUser;
/**
* Class that requests authentication and user information from the remote data source and
* maintains an in-memory cache of login status and user credentials information.
*/
public class LoginRepository {
private static volatile LoginRepository instance;
private LoginDataSource dataSource;
// If user credentials will be cached in local storage, it is recommended it be encrypted
// @see https://developer.android.com/training/articles/keystore
private LoggedInUser user = null;
// private constructor : singleton access
private LoginRepository(LoginDataSource dataSource) {
this.dataSource = dataSource;
}
public static LoginRepository getInstance(LoginDataSource dataSource) {
if (instance == null) {
instance = new LoginRepository(dataSource);
}
return instance;
}
public boolean isLoggedIn() {
return user != null;
}
public void logout() {
user = null;
dataSource.logout();
}
private void setLoggedInUser(LoggedInUser user) {
this.user = user;
// If user credentials will be cached in local storage, it is recommended it be encrypted
// @see https://developer.android.com/training/articles/keystore
}
public Result<LoggedInUser> login(String username, String password) {
// handle login
Result<LoggedInUser> result = dataSource.login(username, password);
if (result instanceof Result.Success) {
setLoggedInUser(((Result.Success<LoggedInUser>) result).getData());
}
return result;
}
}
|
[
"[email protected]"
] | |
66217218b4704fa9be78a0ed1cf3380983ec47fb
|
555c44652b99202efb0f246c17d581ccfddbd487
|
/src/test/java/org/opengis/cite/cat30/basic/VerifyBasicSearchTests.java
|
a053105f313cbadb1fd3ed54bcd6beef096b2b41
|
[
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] |
permissive
|
opengeospatial/ets-cat30
|
d7005dde9e023991d53bc3ed13fbc05360df5b97
|
48e80f49d8a2d36fddd1f6d3039c3e399ba094a3
|
refs/heads/master
| 2022-07-31T00:42:36.596493 | 2022-07-12T11:48:40 | 2022-07-12T11:48:40 | 19,789,682 | 1 | 7 |
NOASSERTION
| 2022-07-12T11:48:41 | 2014-05-14T17:45:22 |
Java
|
UTF-8
|
Java
| false | false | 6,661 |
java
|
package org.opengis.cite.cat30.basic;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static org.mockito.Matchers.*;
import java.io.IOException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.validation.Schema;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.opengis.cite.cat30.SuiteAttribute;
import org.opengis.cite.cat30.util.ValidationUtils;
import org.testng.ISuite;
import org.testng.ITestContext;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientRequest;
import com.sun.jersey.api.client.ClientResponse;
import java.net.URI;
import javax.xml.xpath.XPathExpressionException;
import org.mockito.Mockito;
import org.opengis.cite.cat30.util.XMLUtils;
import org.opengis.cite.geomatics.Extents;
import org.opengis.geometry.Envelope;
import org.opengis.referencing.operation.TransformException;
import org.opengis.util.FactoryException;
import org.w3c.dom.NodeList;
public class VerifyBasicSearchTests {
@Rule
public ExpectedException thrown = ExpectedException.none();
private static DocumentBuilder docBuilder;
private static ITestContext testContext;
private static ISuite suite;
private static Schema cswSchema;
private static Schema atomSchema;
@BeforeClass
public static void initTestFixture() throws Exception {
testContext = mock(ITestContext.class);
suite = mock(ISuite.class);
when(testContext.getSuite()).thenReturn(suite);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
docBuilder = dbf.newDocumentBuilder();
Document doc = docBuilder.parse(VerifyBasicSearchTests.class.getResourceAsStream(
"/capabilities/basic.xml"));
when(suite.getAttribute(SuiteAttribute.TEST_SUBJECT.getName())).thenReturn(doc);
cswSchema = ValidationUtils.createCSWSchema();
when(suite.getAttribute(SuiteAttribute.CSW_SCHEMA.getName()))
.thenReturn(cswSchema);
atomSchema = ValidationUtils.createAtomSchema();
when(suite.getAttribute(SuiteAttribute.ATOM_SCHEMA.getName()))
.thenReturn(atomSchema);
}
@Test
public void getBriefRecordsByBBOX_allIntersect()
throws SAXException, IOException, FactoryException, TransformException {
Client client = mock(Client.class);
when(suite.getAttribute(SuiteAttribute.CLIENT.getName()))
.thenReturn(client);
ClientResponse rsp = mock(ClientResponse.class);
when(client.handle(any(ClientRequest.class))).thenReturn(rsp);
when(rsp.getStatus()).thenReturn(
ClientResponse.Status.OK.getStatusCode());
Document rspEntity = docBuilder.parse(this.getClass().getResourceAsStream(
"/rsp/GetRecordsResponse-full.xml"));
BasicSearchTests spy = Mockito.spy(new BasicSearchTests());
Mockito.doReturn(rspEntity).when(spy).getResponseEntityAsDocument(
any(ClientResponse.class), anyString());
spy.initCommonFixture(testContext);
// BOX2D(32.5 -117.6, 34 -115) with CRS EPSG:4326
spy.setExtent(buildEnvelope(1));
spy.setGetEndpoint(URI.create("http://localhost/csw/v3"));
spy.getBriefRecordsByBBOX();
}
@Test
public void getBriefRecordsByBBOX_noneIntersect()
throws SAXException, IOException, FactoryException, TransformException {
thrown.expect(AssertionError.class);
thrown.expectMessage("The envelopes do not intersect");
Client client = mock(Client.class);
when(suite.getAttribute(SuiteAttribute.CLIENT.getName()))
.thenReturn(client);
ClientResponse rsp = mock(ClientResponse.class);
when(client.handle(any(ClientRequest.class))).thenReturn(rsp);
when(rsp.getStatus()).thenReturn(
ClientResponse.Status.OK.getStatusCode());
Document rspEntity = docBuilder.parse(this.getClass().getResourceAsStream(
"/rsp/GetRecordsResponse-full.xml"));
BasicSearchTests spy = Mockito.spy(new BasicSearchTests());
Mockito.doReturn(rspEntity).when(spy).getResponseEntityAsDocument(
any(ClientResponse.class), anyString());
spy.initCommonFixture(testContext);
// BOX2D(472944 5363287, 516011 5456383) with CRS EPSG:32610
spy.setExtent(buildEnvelope(2));
spy.setGetEndpoint(URI.create("http://localhost/csw/v3"));
spy.getBriefRecordsByBBOX();
}
@Test
public void getSummaryRecordsByWGS84BBOX_noneIntersect()
throws SAXException, IOException, FactoryException, TransformException {
thrown.expect(AssertionError.class);
thrown.expectMessage("The envelopes do not intersect");
Client client = mock(Client.class);
when(suite.getAttribute(SuiteAttribute.CLIENT.getName()))
.thenReturn(client);
ClientResponse rsp = mock(ClientResponse.class);
when(client.handle(any(ClientRequest.class))).thenReturn(rsp);
when(rsp.getStatus()).thenReturn(
ClientResponse.Status.OK.getStatusCode());
Document rspEntity = docBuilder.parse(this.getClass().getResourceAsStream(
"/rsp/GetRecordsResponse-full.xml"));
BasicSearchTests spy = Mockito.spy(new BasicSearchTests());
Mockito.doReturn(rspEntity).when(spy).getResponseEntityAsDocument(
any(ClientResponse.class), anyString());
spy.initCommonFixture(testContext);
// BOX2D(472944 5363287, 516011 5456383) with CRS EPSG:32610
spy.setExtent(buildEnvelope(2));
spy.setGetEndpoint(URI.create("http://localhost/csw/v3"));
spy.getSummaryRecordsByWGS84BBOX();
}
private Envelope buildEnvelope(int id)
throws SAXException, IOException, FactoryException, TransformException {
String path = String.format("/rsp/GetRecordsResponse-%d.xml", id);
Document doc = docBuilder.parse(getClass().getResourceAsStream(path));
NodeList boxNodes = null;
try {
boxNodes = XMLUtils.evaluateXPath(doc,
"//csw:Record/ows:BoundingBox[1] | //csw:Record/ows:WGS84BoundingBox[1]", null);
} catch (XPathExpressionException ex) { // ignore--expression ok
}
return Extents.coalesceBoundingBoxes(XMLUtils.getNodeListAsList(boxNodes));
}
}
|
[
"[email protected]"
] | |
83009bf4d5b88b9ff20cc4493e5f5aaa234a518d
|
42b48a8942c44eb8c461dd575c261b59e68f8206
|
/RedPowerCore-2.0pr6.src/com/eloraam/redpower/base/GuiBag.java
|
267838fa39a7a35cafdad5b1360e67138bd58f02
|
[] |
no_license
|
CollectiveIndustries/MC-RP-MOD
|
65161b5f791cfbe4c33987f6bc41a4d9a0eb8363
|
72fcc85f10cfff7d08406c198cc4789ee0224795
|
refs/heads/master
| 2020-06-11T21:01:47.267094 | 2014-07-01T01:48:33 | 2014-07-01T01:48:33 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,534 |
java
|
/* 1: */ package com.eloraam.redpower.base;
/* 2: */
/* 3: */ import atq;
/* 4: */ import avf;
/* 5: */ import bba;
/* 6: */ import la;
/* 7: */ import net.minecraft.client.Minecraft;
/* 8: */ import org.lwjgl.opengl.GL11;
/* 9: */ import qw;
/* 10: */ import rq;
/* 11: */
/* 12: */ public class GuiBag
/* 13: */ extends avf
/* 14: */ {
/* 15: */ public GuiBag(qw pli, la td)
/* 16: */ {
/* 17:12 */ super(new ContainerBag(pli, td, null));
/* 18:13 */ this.c = 167;
/* 19: */ }
/* 20: */
/* 21: */ public GuiBag(rq cn)
/* 22: */ {
/* 23:17 */ super(cn);
/* 24:18 */ this.c = 167;
/* 25: */ }
/* 26: */
/* 27: */ protected void b(int p1, int p2)
/* 28: */ {
/* 29:23 */ this.l.b("Canvas Bag", 8, 6, 4210752);
/* 30:24 */ this.l.b("Inventory", 8, this.c - 94 + 2, 4210752);
/* 31: */ }
/* 32: */
/* 33: */ protected void a(float f, int p1, int p2)
/* 34: */ {
/* 35:30 */ int i = this.f.o.b("/eloraam/base/baggui.png");
/* 36:31 */ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
/* 37:32 */ this.f.o.b(i);
/* 38:33 */ int j = (this.g - this.b) / 2;
/* 39:34 */ int k = (this.h - this.c) / 2;
/* 40:35 */ b(j, k, 0, 0, this.b, this.c);
/* 41: */ }
/* 42: */ }
/* Location: C:\Users\Admiral\Desktop\REDPOWER CODE\RedPowerCore-2.0pr6.zip
* Qualified Name: com.eloraam.redpower.base.GuiBag
* JD-Core Version: 0.7.0.1
*/
|
[
"[email protected]"
] | |
f9f6e64766e7f64b4f0b9bb72da98fbbbd77561d
|
fa500013c0e82c54ae387ad0fc6f736ea96001ed
|
/PART 2/CH06/example code/Trader.java
|
a2f844cd7a3606cb761315174845a6bf0387d5e4
|
[] |
no_license
|
PANGTUDY/Modern-Java-in-Action
|
eb9b3c8a7e91681ca8cff8d3e5585e584f7d3fe0
|
c60a1afc147a0873d57c9494c413b08f81c2af55
|
refs/heads/master
| 2023-06-30T14:45:25.292321 | 2021-08-08T12:52:06 | 2021-08-08T12:52:06 | 380,750,567 | 3 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 959 |
java
|
import java.util.Objects;
public class Trader {
private String name;
private String city;
public Trader(String n, String c) {
name = n;
city = c;
}
public String getName() {
return name;
}
public String getCity() {
return city;
}
public void setCity(String newCity) {
city = newCity;
}
@Override
public int hashCode() {
int hash = 17;
hash = hash * 31 + (name == null ? 0 : name.hashCode());
hash = hash * 31 + (city == null ? 0 : city.hashCode());
return hash;
}
@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if (!(other instanceof Trader)) {
return false;
}
Trader o = (Trader) other;
boolean eq = Objects.equals(name, o.getName());
eq = eq && Objects.equals(city, o.getCity());
return eq;
}
@Override
public String toString() {
return String.format("Trader:%s in %s", name, city);
}
}
|
[
"[email protected]"
] | |
f2d45e5ee7ded1cd090331b3c32e1e85b99f59e8
|
8da7da0e0005be8eb0f6a1d4b7083f28122cd603
|
/src/com/java/jdbc/TesteInputJdbc.java
|
ef0ec41dfe81e98c88d917ee7eff13156a6351d9
|
[] |
no_license
|
adielmo/POO
|
9e76ba275d1d30ac499817d730d2a565d109b475
|
867d4b967769290fa2324da0cc0f68de4c878299
|
refs/heads/master
| 2022-11-20T19:30:59.263332 | 2022-10-29T12:28:25 | 2022-10-29T12:28:25 | 238,902,730 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,606 |
java
|
package com.java.jdbc;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.ParseException;
import java.text.SimpleDateFormat;
public class TesteInputJdbc {
public static void main(String[] args) {
SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
Connection connection = null;
PreparedStatement preparedStatement = null;
try {
//preparedStatement.setDate(3, new java.sql.Date(df.parse("23/12/1984").getTime()));
connection = DB.getConnection();
preparedStatement = connection.prepareStatement("INSERT INTO seller(name, email, birthDate, baseSalary, departmentId)"
+ "VALUES(?, ?, ?, ?, ?)"
, Statement.RETURN_GENERATED_KEYS);
preparedStatement.setString(1, "Adielmo");
preparedStatement.setString(2, "[email protected]");
preparedStatement.setDate(3, new Date(df.parse("23/12/1984").getTime()));
preparedStatement.setDouble(4, 4500.0);
preparedStatement.setInt(5, 4);
int rows = preparedStatement.executeUpdate();
if (rows > 0) {
ResultSet rs = preparedStatement.getGeneratedKeys();
while(rs.next()) {
int id = rs.getInt(1);
System.out.println("Id salvo " + id);
}
} else {
System.out.println("Não alterado !");
}
} catch (SQLException e) {
System.out.println("Error !");
} catch (ParseException e) {
System.out.println("Error !");
} finally {
DB.closeStatement(preparedStatement);
DB.closeConnection();
}
}
}
|
[
"[email protected]"
] | |
58d8c7febbd7006120bd616bb398c3a8217117a8
|
fbf59d465193e2e34f7f7f41398e775ac4bcda58
|
/src/main/java/com/milu/vote/bean/User.java
|
9a0cca2497b59d868c18f0833e27f6f121500db6
|
[] |
no_license
|
miludedingdang/vote
|
acbca8ca8031490375955e5354684e751d7f85a2
|
c9709e63519fd443b0c763e91b40d0e62e1c0a6f
|
refs/heads/master
| 2020-04-14T23:26:02.848664 | 2019-01-27T10:59:46 | 2019-01-27T10:59:46 | 164,202,050 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 252 |
java
|
package com.milu.vote.bean;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class User {
private String id;
private String userName;
private String userPassword;
private String userPhone;
private String memo;
}
|
[
"[email protected]"
] | |
a693c049bcc97964b01b3dcec0235105186da2e5
|
53d7f4d307771ed680cbbc06da17bf4048259b9c
|
/SQLTest/sqlib/src/main/java/com/artlite/sqlib/callbacks/SQAnnotationClassCallback.java
|
f275ac7e134ff48dbb05436530440021b167614e
|
[] |
no_license
|
Artlite/SQDatabase
|
5fd949f354a861e04b542de4988a114211e2558f
|
2a8efe4c7af12a7f40de0441b4122785d9b33709
|
refs/heads/master
| 2021-01-13T03:45:49.042125 | 2019-07-14T01:51:51 | 2019-07-14T01:51:51 | 77,243,353 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 581 |
java
|
package com.artlite.sqlib.callbacks;
import android.support.annotation.NonNull;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
/**
* Annotation callback
*/
public interface SQAnnotationClassCallback {
/**
* Method which provide the action when one of the annotation class found
*
* @param annotation annotation
* @param field field with annotation
*/
void onFoundAnnotation(@NonNull final Annotation annotation,
@NonNull final Field field)
throws IllegalAccessException;
}
|
[
"[email protected]"
] | |
a630a0adfeccc8aeadca5efa67ff311c18427924
|
690868150ba18e3140b16b344aa5401d0bccf300
|
/src/main/java/spring_component_scan_example/Person.java
|
a4236dff02378566d10e81e8ac064e08aa79c373
|
[] |
no_license
|
huibaobao/SpringTutorials
|
df653755123bf413c788cabf8003ccacc0cde56f
|
5723fd51550650b8eb432da9cd24dc4f1b3b10f2
|
refs/heads/master
| 2020-03-14T13:08:50.816890 | 2017-02-03T18:44:03 | 2017-02-03T18:44:03 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 372 |
java
|
package spring_component_scan_example;
import lombok.Getter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class Person {
@Getter
@Autowired
private City city;
@Getter
@Autowired
private Wife wife;
@Getter
@Autowired
private Career career;
}
|
[
"[email protected]"
] | |
4f438a7584aab9f334940734084bb0eff05319c5
|
96c793aa1642a70d307d881b444dc028f605a3bc
|
/android/src/main/java/com/reactlibrary/RNHelpshiftModule.java
|
69461240264194a3df4ee1c5acc9e8fb15251f0c
|
[] |
no_license
|
cdamorales/react-native-helpshit-custom
|
fb99547ef352f793e8abc6a97ecd6808ed27a411
|
d586dfb6f7c28a97ea96fdd228c6b78b3f0348ce
|
refs/heads/master
| 2023-04-21T10:33:30.434691 | 2021-04-29T18:30:33 | 2021-04-29T18:30:33 | 342,080,380 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 9,381 |
java
|
package com.helpshift.reactlibrary;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMapKeySetIterator;
import java.io.File;
import java.util.Map;
import java.util.HashMap;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import com.helpshift.Core;
import com.helpshift.conversation.activeconversation.model.ActionType;
import com.helpshift.delegate.AuthenticationFailureReason;
import com.helpshift.exceptions.InstallException;
import com.helpshift.support.Support;
import com.helpshift.HelpshiftUser;
import com.helpshift.support.ApiConfig;
import com.helpshift.InstallConfig;
import com.helpshift.All;
import android.app.Activity;
import android.app.Application;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import androidx.annotation.Nullable;
public class RNHelpshiftModule extends ReactContextBaseJavaModule implements Support.Delegate {
private final Application app;
private ReactApplicationContext mReactContext;
private Handler countSuccessHandler;
private Handler countErrorHandler;
public RNHelpshiftModule(ReactApplicationContext reactContext) {
super(reactContext);
mReactContext= reactContext;
this.app = (Application)reactContext.getApplicationContext();
}
@Override
public String getName() {
return "RNHelpshift";
}
@ReactMethod
public void init(String key, String domain, String appid) throws InstallException {
InstallConfig installConfig = new InstallConfig.Builder().build();
//Support.setDelegate(this);
Core.init(All.getInstance());
try{
Core.install(this.app, key, domain, appid, installConfig);
} catch (InstallException e) {
Log.e("ERROR, ", "invalid install credentials : ", e);
}
}
@ReactMethod
public void login(ReadableMap user){
HelpshiftUser userBuilder;
String email = user.hasKey("email") ? user.getString("email") : null;
String identifier = user.hasKey("identifier") ? user.getString("identifier") : null;
if(user.hasKey("name") && user.hasKey("authToken")) {
userBuilder = new HelpshiftUser.Builder(identifier, email)
.setName(user.getString("name"))
.setAuthToken(user.getString("authToken"))
.build();
} else if (user.hasKey("name")) {
userBuilder = new HelpshiftUser.Builder(identifier, email)
.setName(user.getString("name"))
.build();
} else if (user.hasKey("authToken")) {
userBuilder = new HelpshiftUser.Builder(identifier, email)
.setAuthToken(user.getString("authToken"))
.build();
} else {
userBuilder = new HelpshiftUser.Builder(identifier, email).build();
}
Core.login(userBuilder);
}
@ReactMethod
public void logout(){
Core.logout();
}
@ReactMethod
public void showConversation(){
final Activity activity = getCurrentActivity();
Support.showConversation(activity);
}
@ReactMethod
public void showConversationWithCIFs(ReadableMap cifs){
final Activity activity = getCurrentActivity();
ApiConfig apiConfig = new ApiConfig.Builder().setCustomIssueFields(getCustomIssueFields(cifs)).build();
Support.showConversation(activity, apiConfig);
}
@ReactMethod
public void showFAQs(){
final Activity activity = getCurrentActivity();
Support.showFAQs(activity);
}
@ReactMethod
public void showFAQsWithCIFs(ReadableMap cifs){
final Activity activity = getCurrentActivity();
ApiConfig apiConfig = new ApiConfig.Builder().setCustomIssueFields(getCustomIssueFields(cifs)).build();
Support.showFAQs(activity, apiConfig);
}
@ReactMethod
public void requestUnreadMessagesCount(){
// TODO: Is the correct place to create these?
countErrorHandler = new Handler() {
public void handleMessage(Message msg) {
super.handleMessage(msg);
}
};
countSuccessHandler = new Handler() {
public void handleMessage(Message msg) {
super.handleMessage(msg);
Bundle countData = (Bundle) msg.obj;
Integer count = countData.getInt("value");
WritableMap params = Arguments.createMap();
params.putInt("count", count);
sendEvent(mReactContext, "didReceiveUnreadMessagesCount", params);
}
};
Support.getNotificationCount(countSuccessHandler, countErrorHandler);
}
@ReactMethod
public void newConversationWithMessage(String newConversationMessage, String messageError, String pantallaActual) {
String[] tags;
tags = new String[] { "Error Técnico: " + messageError, "Pantalla: " + pantallaActual };
final Activity activity = getCurrentActivity();
HashMap customMetadata = new HashMap();
customMetadata.put(Support.TagsKey, tags);
Log.d("Helpshift", "newConversationStarted");
HashMap config = new HashMap();
config.put("conversationPrefillText", newConversationMessage);
config.put(Support.CustomMetadataKey, customMetadata);
Support.showConversation(activity, config);
}
private void sendEvent(ReactContext reactContext, String eventName, @Nullable WritableMap params) {
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
.emit(eventName, params);
}
private Map<String, String[]> getCustomIssueFields(ReadableMap cifs) {
ReadableMapKeySetIterator iterator = cifs.keySetIterator();
Map<String, String[]> customIssueFields = new HashMap<>();
while (iterator.hasNextKey()) {
String key = iterator.nextKey();
ReadableArray array = cifs.getArray(key);
customIssueFields.put(key, new String[]{array.getString(0), array.getString(1)});
}
return customIssueFields;
}
@Override
public void sessionBegan() {
Log.d("Helpshift", "sessionBegan");
sendEvent(mReactContext, "Helpshift/SessionBegan", Arguments.createMap());
}
@Override
public void sessionEnded() {
Log.d("Helpshift", "sessionEnded");
sendEvent(mReactContext, "Helpshift/SessionEnded", Arguments.createMap());
}
@Override
public void newConversationStarted(String newConversationMessage) {
Log.d("Helpshift", "newConversationStarted");
WritableMap params = Arguments.createMap();
params.putString("newConversationMessage", newConversationMessage);
sendEvent(mReactContext, "Helpshift/NewConversationStarted", params);
}
@Override
public void conversationEnded() {
Log.d("Helpshift", "conversationEnded");
sendEvent(mReactContext, "Helpshift/ConversationEnded", Arguments.createMap());
}
@Override
public void userRepliedToConversation(String newMessage) {
Log.d("Helpshift", "userRepliedToConversation");
WritableMap params = Arguments.createMap();
params.putString("newMessage", newMessage);
sendEvent(mReactContext, "Helpshift/UserRepliedToConversation", params);
}
@Override
public void userClickOnAction(ActionType actionType, String label){
}
@Override
public void userCompletedCustomerSatisfactionSurvey(int rating, String feedback) {
Log.d("Helpshift", "userCompletedCustomerSatisfactionSurvey");
WritableMap params = Arguments.createMap();
params.putInt("rating", rating);
params.putString("feedback", feedback);
sendEvent(mReactContext, "Helpshift/UserCompletedCustomerSatisfactionSurvey", params);
}
//TODO: determine if File can be sent by React Native bridge
@Override
public void displayAttachmentFile(Uri attachmentFile) { }
// TODO: determine if File can be sent by React Native bridge
@Override
public void displayAttachmentFile(File attachmentFile) {}
@Override
public void didReceiveNotification(int newMessagesCount) {
Log.d("Helpshift", "didReceiveNotification");
WritableMap params = Arguments.createMap();
params.putInt("newMessagesCount", newMessagesCount);
sendEvent(mReactContext, "Helpshift/DidReceiveNotification", params);
}
@Override
public void authenticationFailed(HelpshiftUser user, AuthenticationFailureReason reason) {
Log.d("Helpshift", "authenticationFailed");
WritableMap params = Arguments.createMap();
params.putString("user", user.toString());
params.putString("reason", reason.toString());
sendEvent(mReactContext, "Helpshift/AuthenticationFailed", params);
}
}
|
[
"[email protected]"
] | |
86953941ae2591d303eebdc52dc0d600efa6588a
|
04e42fc59f012347799c04c2a28517892d9c07f3
|
/bpmn/src/main/java/com/alibaba/smart/framework/engine/modules/bpmn/assembly/multi/instance/parser/LoopDataInputRefParser.java
|
4bd7516299aa1bfccbf753e99511ee4995d6ea84
|
[
"Apache-2.0"
] |
permissive
|
lisy5/SmartEngine
|
f794504eacb2644ec278cf0ebe42a6b795513855
|
e05cac59074c4fefdeffb14331dc53450aa82971
|
refs/heads/master
| 2020-12-30T06:16:03.918924 | 2020-01-28T04:31:36 | 2020-01-28T04:31:36 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,365 |
java
|
package com.alibaba.smart.framework.engine.modules.bpmn.assembly.multi.instance.parser;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import com.alibaba.smart.framework.engine.extension.annoation.ExtensionBinding;
import com.alibaba.smart.framework.engine.extension.constant.ExtensionConstant;
import com.alibaba.smart.framework.engine.modules.bpmn.assembly.multi.instance.LoopDataInputRef;
import com.alibaba.smart.framework.engine.xml.parser.AbstractElementParser;
import com.alibaba.smart.framework.engine.xml.parser.ParseContext;
/**
* @author ettear
* Created by ettear on 15/10/2017.
*/
@ExtensionBinding(group = ExtensionConstant.ELEMENT_PARSER, bindKey = LoopDataInputRef.class)
public class LoopDataInputRefParser extends AbstractElementParser<LoopDataInputRef>
{
@Override
public QName getQname() {
return LoopDataInputRef.type;
}
@Override
public Class<LoopDataInputRef> getModelType() {
return LoopDataInputRef.class;
}
@Override
public LoopDataInputRef parseElement(XMLStreamReader reader, ParseContext context) throws XMLStreamException {
LoopDataInputRef loopDataInputRef = new LoopDataInputRef();
loopDataInputRef.setReference(reader.getElementText());
return loopDataInputRef;
}
}
|
[
"[email protected]"
] | |
de2e9732acd23e1efe2b8b97b5e00bdbaaf0990f
|
14409e9efcac4acec18cc0e7aa0db8bc5e2aba4b
|
/WSBiking/src/com/example/wsbiking/LoginActivity.java
|
6305fcfb8de7a9ba503af2e846b99de396645d44
|
[] |
no_license
|
nmsarda/Spring13-biking
|
69a38d33fff831041819fb0013e3e91d6ba2cc12
|
042a609559f6a2adb061f7704d0bb8428ad37e24
|
refs/heads/master
| 2020-12-25T06:35:30.117928 | 2013-04-07T06:28:59 | 2013-04-07T06:28:59 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 537 |
java
|
package com.example.wsbiking;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class LoginActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.login, menu);
return true;
}
}
|
[
"[email protected]"
] | |
2a78d953fc1d726cf466fd7b086e798acdfa77bc
|
be73270af6be0a811bca4f1710dc6a038e4a8fd2
|
/crash-reproduction-moho/results/XWIKI-14263-9-13-NSGA_II-LineCoverage:ExceptionType:StackTraceSimilarity/org/xwiki/sheet/internal/SheetDocumentDisplayer_ESTest_scaffolding.java
|
a3abefb145a79b2da046dde3736109f6a3a403af
|
[] |
no_license
|
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
|
cf118b23ecb87a8bf59643e42f7556b521d1f754
|
3bb39683f9c343b8ec94890a00b8f260d158dfe3
|
refs/heads/master
| 2022-07-29T14:44:00.774547 | 2020-08-10T15:14:49 | 2020-08-10T15:14:49 | 285,804,495 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 451 |
java
|
/**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Tue Apr 07 01:05:43 UTC 2020
*/
package org.xwiki.sheet.internal;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
@EvoSuiteClassExclude
public class SheetDocumentDisplayer_ESTest_scaffolding {
// Empty scaffolding for empty test suite
}
|
[
"[email protected]"
] | |
4471d3780c35bea86751f5ca282a981be83d52f4
|
348065feb2d0e84f277d52c6fee0ae3a4a2e08e0
|
/src/socketTCP/EchoClientThreadJFrameOK.java
|
0ad1963f992ac25955768e67b1479fece832c2a4
|
[] |
no_license
|
biousco/JavaLearn
|
8e485d67f3cc2bbb501e046462700541afe4dc72
|
ae600d4de3a26d30d5fcf80b08b3972e073def9b
|
refs/heads/master
| 2021-01-20T09:01:11.426153 | 2016-01-04T02:44:23 | 2016-01-04T02:44:23 | 42,170,571 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 11,330 |
java
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package socketTCP;
import java.io.IOException;
/**
*
* @author Administrator
*/
public class EchoClientThreadJFrameOK extends javax.swing.JFrame {
private EchoClient ec;//申明EchoClient对象
/**
* Creates new form EchoClientJFrame
*/
public EchoClientThreadJFrameOK() {
initComponents();
ec = null;
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
jTextField2 = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
jLabel4 = new javax.swing.JLabel();
jTextField3 = new javax.swing.JTextField();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setText("IP地址:");
jTextField1.setText("222.201.101.15");
jTextField1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField1ActionPerformed(evt);
}
});
jLabel2.setText("端口:");
jTextField2.setText("9009");
jButton1.setText("连接");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jLabel3.setText("信息显示区:");
jTextArea1.setColumns(20);
jTextArea1.setRows(5);
jScrollPane1.setViewportView(jTextArea1);
jLabel4.setText("信息录入区:");
jButton2.setText("发送");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jButton3.setText("退出");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 163, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(27, 27, 27)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 78, Short.MAX_VALUE)
.addComponent(jButton1))
.addComponent(jScrollPane1)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(jLabel4))
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(jTextField3)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jButton2)
.addGap(23, 23, 23)
.addComponent(jButton3)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 26, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton2)
.addComponent(jButton3)))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// 设定连接按钮动作
String ip = jTextField1.getText();
String port = jTextField2.getText();
try{
ec = new EchoClient(ip,port);
jTextArea1.append("服务器连接成功。\r\n");
//连接成功后,先接收服务器的返回信息
Thread receiver = new Thread(){
public void run(){
String msg = null;
while(true){
try{
msg = ec.receive();
}catch(IOException ex){
jTextArea1.append("套接字异常关闭 \n");
}
if(msg != null)
jTextArea1.append(msg+"\n");
else{
jTextArea1.append("对话已关闭 \n");
break;
}
}
}
};
receiver.start();
}
catch(IOException ex){
jTextArea1.append("服务器连接失败。\r\n");
}
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// 设定发送按钮动作
String msgSend; //用于存放发送的信息
msgSend = jTextField3.getText();
jTextField3.setText(null);
try{
ec.send(msgSend);
}
catch(IOException ex){
}
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// 设定退出按钮动作
if(ec!=null)
ec.close();
System.exit(0);
}//GEN-LAST:event_jButton3ActionPerformed
private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField1ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(EchoClientThreadJFrameOK.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(EchoClientThreadJFrameOK.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(EchoClientThreadJFrameOK.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(EchoClientThreadJFrameOK.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new EchoClientThreadJFrameOK().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
// End of variables declaration//GEN-END:variables
}
|
[
"[email protected]"
] | |
5c90e0304d0f48738d6dcb51b5522d5eec6c896f
|
1af6060fa4b0afd9eaa254266e915d4f5477713f
|
/app/src/main/java/com/example/whatstheweather/Common/Common.java
|
34d443bc33d28351a818019b81864b1f32e84b5c
|
[] |
no_license
|
realsst1/WhatsTheWeather
|
171302b14f0b548d4f0617ae84ed334f37d00c7d
|
03a6bd8389f4c1f32fabf36c9bf3b61deaa7826b
|
refs/heads/master
| 2020-05-30T11:45:53.826262 | 2019-06-03T09:47:28 | 2019-06-03T09:47:28 | 189,713,496 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 785 |
java
|
package com.example.whatstheweather.Common;
import android.location.Location;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Common {
public static final String API_ID="fb39dd1d18ab443a96b2731cbdd222ac";
public static Location currentLocation=null;
public static String convertUnixToDate(long dt) {
Date date=new Date(dt*1000L);
SimpleDateFormat sdf=new SimpleDateFormat("HH:mm dd EEE MM yyyy");
String formattedDate=sdf.format(date);
return formattedDate;
}
public static String convertUnixToHour(long sunrise) {
Date date=new Date(sunrise*1000L);
SimpleDateFormat sdf=new SimpleDateFormat("HH:mm");
String formattedDate=sdf.format(date);
return formattedDate;
}
}
|
[
"s@Nuchotu1"
] |
s@Nuchotu1
|
dc8f3607c7660854c192903d29c73f0925807e27
|
2dce20c1263f7075b47179f571c25cec8be29fe6
|
/lib_common/src/main/java/com/gykj/zhumulangma/common/mvvm/view/BaseActivity.java
|
ec80e75471aec1d54d870e042cdbf65152c4354c
|
[
"Apache-2.0"
] |
permissive
|
gaoshijie0/Zhumulangma
|
ef1e4e8b8d789857fc10731ca3ee21e85cc73f70
|
beb30f9f78d78b56198405ee97f58ccf99e328f0
|
refs/heads/master
| 2020-07-31T14:16:39.064396 | 2019-09-24T09:03:52 | 2019-09-24T09:03:52 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 18,370 |
java
|
package com.gykj.zhumulangma.common.mvvm.view;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.ColorInt;
import android.support.annotation.DrawableRes;
import android.support.annotation.IdRes;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import com.alibaba.android.arouter.launcher.ARouter;
import com.gykj.zhumulangma.common.App;
import com.gykj.zhumulangma.common.AppHelper;
import com.gykj.zhumulangma.common.R;
import com.gykj.zhumulangma.common.bean.NavigateBean;
import com.gykj.zhumulangma.common.event.EventCode;
import com.gykj.zhumulangma.common.event.common.BaseActivityEvent;
import com.gykj.zhumulangma.common.status.EmptyCallback;
import com.gykj.zhumulangma.common.status.ErrorCallback;
import com.gykj.zhumulangma.common.status.InitLoadingCallback;
import com.gykj.zhumulangma.common.status.LoadingCallback;
import com.gykj.zhumulangma.common.util.SystemUtil;
import com.kingja.loadsir.callback.Callback;
import com.kingja.loadsir.core.LoadService;
import com.kingja.loadsir.core.LoadSir;
import com.wuhenzhizao.titlebar.widget.CommonTitleBar;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
import me.yokeyword.fragmentation.ExtraTransaction;
import me.yokeyword.fragmentation.ISupportFragment;
import me.yokeyword.fragmentation.anim.DefaultHorizontalAnimator;
import me.yokeyword.fragmentation.anim.FragmentAnimator;
/**
* Description: <BaseActivity><br>
* Author: mxdl<br>
* Date: 2019/06/30<br>
* Version: V1.0.0<br>
* Update: <br>
*/
public abstract class BaseActivity extends SupportActivity implements IBaseView {
protected static final String TAG = BaseActivity.class.getSimpleName();
private CompositeDisposable mCompositeDisposable;
private Handler mLoadingHandler=new Handler();
protected LoadService mLoadService;
protected CommonTitleBar mSimpleTitleBar;
protected App mApplication;
interface BarStyle {
//左边
int LEFT_BACK = 0;
int LEFT_BACK_TEXT = 1;
int LEFT_ICON = 2;
int CENTER_TITLE = 7;
int CENTER_CUSTOME = 8;
//右边
int RIGHT_TEXT = 4;
int RIGHT_ICON = 5;
int RIGHT_CUSTOME = 6;
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mApplication= App.getInstance();
setContentView(R.layout.common_layout_root);
EventBus.getDefault().register(this);
ARouter.getInstance().inject(this);
initCommonView();
initView();
initListener();
initParam();
initData();
}
/**
* 添加订阅
*/
protected void addDisposable(Disposable mDisposable) {
if (mCompositeDisposable == null) {
mCompositeDisposable = new CompositeDisposable();
}
mCompositeDisposable.add(mDisposable);
}
/**
* 取消所有订阅
*/
private void clearDisposable() {
if (mCompositeDisposable != null) {
mCompositeDisposable.clear();
}
}
protected void initCommonView() {
ViewStub viewStubContent = findViewById(R.id.view_stub_content);
mSimpleTitleBar = findViewById(R.id.ctb_simple);
if (enableSimplebar()) {
mSimpleTitleBar.setBackgroundResource(R.drawable.shap_common_simplebar);
mSimpleTitleBar.setVisibility(View.VISIBLE);
initSimplebar();
}
viewStubContent.setLayoutResource(onBindLayout());
View contentView = viewStubContent.inflate();
LoadSir loadSir = new LoadSir.Builder()
.addCallback(new InitLoadingCallback())
.addCallback(new EmptyCallback())
.addCallback(new ErrorCallback())
.addCallback(new LoadingCallback())
.setDefaultCallback(LoadingCallback.class)
.build();
mLoadService = loadSir.register(onBindLoadSirView() == null ? contentView : onBindLoadSirView(), new Callback.OnReloadListener() {
@Override
public void onReload(View v) {
BaseActivity.this.onReload(v);
}
});
mLoadService.showSuccess();
}
protected View onBindLoadSirView() {
return null;
}
protected void initSimplebar() {
/**
* 中间
*/
if (onBindBarCenterStyle() == BarStyle.CENTER_TITLE) {
String[] strings = onBindBarTitleText();
if (strings != null && strings.length > 0) {
if (strings.length > 0 && null != strings[0] && strings[0].trim().length() > 0) {
TextView title = mSimpleTitleBar.getCenterCustomView().findViewById(R.id.tv_title);
title.setVisibility(View.VISIBLE);
title.setText(strings[0]);
}
if (strings.length > 1 && null != strings[1] && strings[1].trim().length() > 0) {
TextView subtitle = mSimpleTitleBar.getCenterCustomView().findViewById(R.id.tv_subtitle);
subtitle.setVisibility(View.VISIBLE);
subtitle.setText(strings[1]);
}
}
} else if (onBindBarCenterStyle() == BarStyle.CENTER_CUSTOME && onBindBarCenterCustome() != null) {
ViewGroup group = mSimpleTitleBar.getCenterCustomView().findViewById(R.id.fl_custome);
group.setVisibility(View.VISIBLE);
group.addView(onBindBarCenterCustome(), new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
}
/**
* 左侧
*/
if (onBindBarLeftStyle() == BarStyle.LEFT_BACK) {
View backView = mSimpleTitleBar.getLeftCustomView().findViewById(R.id.iv_back);
backView.setVisibility(View.VISIBLE);
backView.setOnClickListener(v -> finish());
} else if (onBindBarLeftStyle() == BarStyle.LEFT_BACK_TEXT) {
View backIcon = mSimpleTitleBar.getLeftCustomView().findViewById(R.id.iv_back);
backIcon.setVisibility(View.VISIBLE);
backIcon.setOnClickListener(v -> finish());
View backTv = mSimpleTitleBar.getLeftCustomView().findViewById(R.id.tv_back);
backTv.setVisibility(View.VISIBLE);
backTv.setOnClickListener(v -> finish());
} else if (onBindBarLeftStyle() == BarStyle.LEFT_ICON && onBindBarLeftIcon() != null) {
ImageView icon = mSimpleTitleBar.getLeftCustomView().findViewById(R.id.iv_left);
icon.setVisibility(View.VISIBLE);
icon.setImageResource(onBindBarLeftIcon());
icon.setOnClickListener(v -> onLeftIconClick(v));
}
/**
* 右侧
*/
switch (onBindBarRightStyle()) {
case BarStyle.RIGHT_TEXT:
String[] strings = onBindBarRightText();
if (strings == null || strings.length == 0) {
break;
}
if (strings.length > 0 && null != strings[0] && strings[0].trim().length() > 0) {
TextView tv1 = mSimpleTitleBar.getRightCustomView().findViewById(R.id.tv1_right);
tv1.setVisibility(View.VISIBLE);
tv1.setText(strings[0]);
tv1.setOnClickListener(v -> onRight1Click(v));
}
if (strings.length > 1 && null != strings[1] && strings[1].trim().length() > 0) {
TextView tv2 = mSimpleTitleBar.getRightCustomView().findViewById(R.id.tv2_right);
tv2.setVisibility(View.VISIBLE);
tv2.setText(strings[1]);
tv2.setOnClickListener(v -> onRight2Click(v));
}
break;
case BarStyle.RIGHT_ICON:
Integer[] ints = onBindBarRightIcon();
if (ints == null || ints.length == 0) {
break;
}
if (ints.length > 0 && null != ints[0]) {
ImageView iv1 = mSimpleTitleBar.getRightCustomView().findViewById(R.id.iv_left);
iv1.setVisibility(View.VISIBLE);
iv1.setImageResource(ints[0]);
iv1.setOnClickListener(v -> onRight1Click(v));
}
if (ints.length > 1 & null != ints[1]) {
ImageView iv2 = mSimpleTitleBar.getRightCustomView().findViewById(R.id.iv2_right);
iv2.setVisibility(View.VISIBLE);
iv2.setImageResource(ints[1]);
iv2.setOnClickListener(v -> onRight2Click(v));
}
break;
case BarStyle.RIGHT_CUSTOME:
if (onBindBarRightCustome() != null) {
ViewGroup group = mSimpleTitleBar.getRightCustomView().findViewById(R.id.fl_custome);
group.setVisibility(View.VISIBLE);
group.addView(onBindBarRightCustome(), new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
}
break;
}
}
protected int onBindBarRightStyle() {
return BarStyle.RIGHT_TEXT;
}
protected int onBindBarLeftStyle() {
return BarStyle.LEFT_BACK_TEXT;
}
protected int onBindBarCenterStyle() {
return BarStyle.CENTER_TITLE;
}
protected String[] onBindBarRightText() {
return null;
}
protected String[] onBindBarTitleText() {
return null;
}
protected @DrawableRes
Integer[] onBindBarRightIcon() {
return null;
}
protected @DrawableRes
Integer onBindBarLeftIcon() {
return null;
}
protected View onBindBarRightCustome() {
return null;
}
protected View onBindBarCenterCustome() {
return null;
}
protected void setSimpleBarBg(@ColorInt int color) {
mSimpleTitleBar.setBackgroundColor(color);
}
protected void setTitle(String[] strings) {
if (!enableSimplebar()) {
throw new IllegalStateException("导航栏中不可用,请设置enableSimplebar为true");
} else if (onBindBarCenterStyle() != BarStyle.CENTER_TITLE) {
throw new IllegalStateException("导航栏中间布局不为标题类型,请设置onBindBarCenterStyle(BarStyle.CENTER_TITLE)");
} else {
if (strings != null && strings.length > 0) {
if (strings.length > 0 && null != strings[0] && strings[0].trim().length() > 0) {
TextView title = mSimpleTitleBar.getCenterCustomView().findViewById(R.id.tv_title);
title.setVisibility(View.VISIBLE);
title.setText(strings[0]);
}
if (strings.length > 1 && null != strings[1] && strings[1].trim().length() > 0) {
TextView subtitle = mSimpleTitleBar.getCenterCustomView().findViewById(R.id.tv_subtitle);
subtitle.setVisibility(View.VISIBLE);
subtitle.setText(strings[1]);
}
}
}
}
protected void setBarTextColor(@ColorInt int color) {
if (!enableSimplebar()) {
throw new IllegalStateException("导航栏中不可用,请设置enableSimplebar为true");
} else {
TextView tvBack = mSimpleTitleBar.getLeftCustomView().findViewById(R.id.tv_back);
tvBack.setTextColor(color);
TextView tvTitle = mSimpleTitleBar.getCenterCustomView().findViewById(R.id.tv_title);
tvTitle.setTextColor(color);
TextView tvSubtitle = mSimpleTitleBar.getCenterCustomView().findViewById(R.id.tv_subtitle);
tvSubtitle.setTextColor(color);
TextView tv1 = mSimpleTitleBar.getRightCustomView().findViewById(R.id.tv1_right);
tv1.setTextColor(color);
TextView tv2 = mSimpleTitleBar.getRightCustomView().findViewById(R.id.tv2_right);
tv2.setTextColor(color);
}
}
protected void setBarBackIconRes(@DrawableRes int res) {
if (!enableSimplebar()) {
throw new IllegalStateException("导航栏中不可用,请设置enableSimplebar为true");
} else {
ImageView ivBack = mSimpleTitleBar.getLeftCustomView().findViewById(R.id.iv_back);
ivBack.setImageResource(res);
}
}
protected void onRight1Click(View v) {
}
protected void onRight2Click(View v) {
}
protected void onLeftIconClick(View v) {
}
@Override
protected void onTitleChanged(CharSequence title, int color) {
super.onTitleChanged(title, color);
if (!enableSimplebar()) {
return;
}
if (onBindBarCenterStyle() == BarStyle.CENTER_TITLE && !TextUtils.isEmpty(title)) {
TextView tvtitle = mSimpleTitleBar.getCenterCustomView().findViewById(R.id.tv_title);
tvtitle.setVisibility(View.VISIBLE);
tvtitle.setText(title);
}
}
@Override
protected void onDestroy() {
super.onDestroy();
EventBus.getDefault().unregister(this);
clearDisposable();
SystemUtil.fixInputMethodManagerLeak(this);
AppHelper.refWatcher.watch(this);
}
protected abstract int onBindLayout();
public abstract void initView();
public abstract void initData();
public void initListener() {
}
protected void initParam() {
}
protected boolean enableSimplebar() {
return true;
}
public void showInitView(boolean show) {
if (!show) {
mLoadService.showSuccess();
} else {
mLoadService.showCallback(InitLoadingCallback.class);
}
}
public void showNetErrView(boolean show) {
if (!show) {
mLoadService.showSuccess();
} else {
mLoadService.showCallback(ErrorCallback.class);
}
}
public void showNoDataView(boolean show) {
if (!show) {
mLoadService.showSuccess();
} else {
mLoadService.showCallback(EmptyCallback.class);
}
}
public void showLoadingView(String tip) {
if (null == tip) {
mLoadingHandler.removeCallbacksAndMessages(null);
mLoadService.showSuccess();
} else {
mLoadService.setCallBack(LoadingCallback.class, (context, view1) -> {
TextView tvTip = view1.findViewById(R.id.tv_tip);
if(tip.length()==0){
tvTip.setVisibility(View.GONE);
}else {
tvTip.setText(tip);
}
});
//延时100毫秒显示,避免闪屏
mLoadingHandler.postDelayed(() -> mLoadService.showCallback(LoadingCallback.class), 100);
}
}
protected void onReload(View v) {
// mLoadService.showCallback(InitLoadingCallback.class);
initData();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public <T> void onEvent(BaseActivityEvent<T> event) {
}
@Subscribe(threadMode = ThreadMode.MAIN,sticky = true)
public <T> void onEventSticky(BaseActivityEvent<T> event) {
}
@Override
public Context getContext() {
return this;
}
/**
* findViewById
*
* @param id
* @param <T>
* @return
*/
protected <T extends View> T fd(@IdRes int id) {
return findViewById(id);
}
@Override
public FragmentAnimator onCreateFragmentAnimator() {
return new DefaultHorizontalAnimator();
}
protected void navigateTo(String path){
Object navigation = ARouter.getInstance().build(path).navigation();
if (null != navigation) {
EventBus.getDefault().post(new BaseActivityEvent<>(EventCode.MainCode.NAVIGATE,
new NavigateBean(path, (ISupportFragment) navigation)));
}
}
protected void navigateTo(String path,int launchMode){
Object navigation = ARouter.getInstance().build(path).navigation();
NavigateBean navigateBean = new NavigateBean(path, (ISupportFragment) navigation);
navigateBean.launchMode=launchMode;
if (null != navigation) {
EventBus.getDefault().post(new BaseActivityEvent<>(EventCode.MainCode.NAVIGATE,
new NavigateBean(path, (ISupportFragment) navigation)));
}
}
protected void navigateTo(String path, ExtraTransaction extraTransaction){
Object navigation = ARouter.getInstance().build(path).navigation();
NavigateBean navigateBean = new NavigateBean(path, (ISupportFragment) navigation);
navigateBean.extraTransaction=extraTransaction;
if (null != navigation) {
EventBus.getDefault().post(new BaseActivityEvent<>(EventCode.MainCode.NAVIGATE,
new NavigateBean(path, (ISupportFragment) navigation)));
}
}
protected void navigateTo(String path, int launchMode, ExtraTransaction extraTransaction){
Object navigation = ARouter.getInstance().build(path).navigation();
NavigateBean navigateBean = new NavigateBean(path, (ISupportFragment) navigation);
navigateBean.launchMode=launchMode;
navigateBean.extraTransaction=extraTransaction;
if (null != navigation) {
EventBus.getDefault().post(new BaseActivityEvent<>(EventCode.MainCode.NAVIGATE,
new NavigateBean(path, (ISupportFragment) navigation)));
}
}
/**
* 解决键盘遮挡EditText
*/
/* @Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
KeyboardConflictCompat.assistWindow(getWindow());
}*/
}
|
[
"[email protected]"
] | |
6e31f57c9cbf0a794d516eb407cbcd09ca180691
|
190e0fcc2e2b142367a3eeda5ab3887216e789ee
|
/src/main/java/com/sgyz/utils/UrlUtils.java
|
8031a1cbc73b87fe13a8b29c62c0cc72ba35d767
|
[] |
no_license
|
shangguanyongzhong/home-api
|
2d35dde886f1b8f42b1bd497504cdb50636ed8cb
|
d080982b0abdcd4c7fa36b29715101159301c6b7
|
refs/heads/master
| 2021-01-18T18:01:04.120632 | 2017-05-12T05:01:50 | 2017-05-12T05:01:50 | 91,041,043 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 200 |
java
|
package com.sgyz.utils;
import java.net.URLEncoder;
public class UrlUtils {
public static String getUrl(String param) throws Exception{
return URLEncoder.encode(param,"UTF-8");
}
}
|
[
"[email protected]"
] | |
4414d17ad70d23701f98a6116dbf817ac53fa52b
|
562acf2d9c6e3d74dc698b422647181a27096630
|
/learning/learningfacades/src/com/learning/facades/process/email/context/OrderPartiallyRefundedEmailContext.java
|
2c07a75b6af820dd76fe224baecf222a2541e78a
|
[] |
no_license
|
rahulcoder1234/learning
|
7ed314a208026c32832eefb0aa4b79c2093d267c
|
166750ebddccfa3a2c208fcb04ace57002cede68
|
refs/heads/master
| 2020-05-17T03:22:26.613839 | 2019-05-03T09:36:47 | 2019-05-03T09:36:47 | 183,474,339 | 0 | 0 | null | 2019-05-03T09:36:49 | 2019-04-25T16:46:32 | null |
UTF-8
|
Java
| false | false | 1,832 |
java
|
/*
* [y] hybris Platform
*
* Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package com.learning.facades.process.email.context;
import de.hybris.platform.acceleratorservices.model.cms2.pages.EmailPageModel;
import de.hybris.platform.acceleratorservices.orderprocessing.model.OrderModificationProcessModel;
import de.hybris.platform.commercefacades.order.data.OrderEntryData;
import de.hybris.platform.commercefacades.product.data.PriceData;
import java.math.BigDecimal;
import java.util.List;
/**
* Velocity context for email about partially order refund
*/
public class OrderPartiallyRefundedEmailContext extends OrderPartiallyModifiedEmailContext
{
private PriceData refundAmount;
@Override
public void init(final OrderModificationProcessModel orderProcessModel, final EmailPageModel emailPageModel)
{
super.init(orderProcessModel, emailPageModel);
calculateRefundAmount();
}
protected void calculateRefundAmount()
{
BigDecimal refundAmountValue = BigDecimal.ZERO;
PriceData totalPrice = null;
for (final OrderEntryData entryData : getRefundedEntries())
{
totalPrice = entryData.getTotalPrice();
refundAmountValue = refundAmountValue.add(totalPrice.getValue());
}
if (totalPrice != null)
{
refundAmount = getPriceDataFactory().create(totalPrice.getPriceType(), refundAmountValue, totalPrice.getCurrencyIso());
}
}
public List<OrderEntryData> getRefundedEntries()
{
return super.getModifiedEntries();
}
public PriceData getRefundAmount()
{
return refundAmount;
}
}
|
[
"[email protected]"
] | |
b8001ba828a3ee9bda6038277408392445b80dcc
|
41c76671b044fbead64f491b929ae2e5f5e740cf
|
/src/main/java/designpattern/flyweight/modified/FlyweightPatternModifiedEx.java
|
91f784953965a52063f7f3febe163f490745d274
|
[] |
no_license
|
FisherChen3/Java_Core
|
fa45dd1342e442a112420deb425b5774fbf72d34
|
6a617aff98433427adab8a5f0e05b79564dead9a
|
refs/heads/master
| 2020-12-31T07:10:11.525876 | 2017-04-11T03:17:41 | 2017-04-11T03:17:41 | 80,557,591 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,631 |
java
|
package designpattern.flyweight.modified;
import java.util.Random;
/**
* Created by Fisher on 4/4/2017.
*/
public class FlyweightPatternModifiedEx {
public static void main(String[] args) throws Exception {
RobotFactory myfactory = new RobotFactory();
System.out.println("\n***Flyweight Pattern Example Modified***\n");
Robot shape;
/*Here we are trying to get 3 king type robots*/
for (int i = 0; i < 3; i++) {
shape = (Robot) myfactory.GetRobotFromFactory("King");
shape.setColor(getRandomColor());
shape.print();
}
/*Here we are trying to get 3 queen type robots*/
for (int i = 0; i < 3; i++) {
shape = (Robot) myfactory.GetRobotFromFactory("Queen");
shape.setColor(getRandomColor());
shape.print();
}
int NumOfDistinctRobots = myfactory.TotalObjectsCreated();
//System.out.println("\nDistinct Robot objects created till now ="+ NumOfDistinctRobots);
System.out.println("\n Finally no of Distinct Robot objects created: " + NumOfDistinctRobots);
}
static String getRandomColor() {
Random r = new Random();
/*You can supply any number of your choice in nextInt argument.
Chapter 16 ¡ Flyweight Patterns
107
* we are simply checking the random number generated is an even number
* or an odd number. And based on that we are choosing the color. For
simplicity, we'll use only two colors.red and green
*/
int random = r.nextInt(20);
if (random % 2 == 0) {
return "red";
} else {
return "green";
}
}
}
|
[
"[email protected]"
] | |
7617fc2ec6c5afd8a848a3d387468004acb3083e
|
ce952d0c7a4d2016b4342855b9d399f9aef4e722
|
/EmployeeMgmt/src/test/java/com/example/EmployeeMgmt/EmployeeMgmtApplicationTests.java
|
066297ef2a7a7aedbff33fea923cdcbe5e7f7870
|
[] |
no_license
|
kenal99/EmployeeManagementSystem
|
544c7c0cd435dfa82768daaea81c50af90cbfa70
|
0f4780c55682e005bad224b629cbac16116ba901
|
refs/heads/master
| 2022-04-22T23:15:16.946878 | 2020-04-26T13:42:32 | 2020-04-26T13:42:32 | 256,995,705 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 222 |
java
|
package com.example.EmployeeMgmt;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class EmployeeMgmtApplicationTests {
@Test
void contextLoads() {
}
}
|
[
"kenub@LAPTOP-PD6UMLTF"
] |
kenub@LAPTOP-PD6UMLTF
|
bdfb88cc08b24c67b5070913cf25fdd9560e4521
|
71c1e1971ee916c73a569ace3a96a80ff0a67bed
|
/src/main/java/nutan/tech/models/EnterpriseContactDetailsModel.java
|
e65a3f2034d88d41a05caa1cad87c30fd2e9a9f2
|
[] |
no_license
|
jazz2canvey/palmbusiness-master
|
2f13f18f935eda52d35c5b0cd1ecab054f396347
|
94b2db02bfadee6bd70f86744d08dd91c0c4f507
|
refs/heads/master
| 2022-07-09T21:23:08.548322 | 2019-07-17T04:42:56 | 2019-07-17T04:42:56 | 194,201,859 | 0 | 0 | null | 2022-06-21T01:21:44 | 2019-06-28T03:44:46 |
Java
|
UTF-8
|
Java
| false | false | 2,454 |
java
|
package nutan.tech.models;
public class EnterpriseContactDetailsModel {
private int phone_type_code;
private String enterprise_id, phone_type, area_code, number, email_main, email_ccc, website;
public EnterpriseContactDetailsModel() {
}
public EnterpriseContactDetailsModel(String enterprise_id, int phone_type_code, String area_code, String number, String email_main, String email_ccc, String website) {
this.enterprise_id = enterprise_id;
this.phone_type_code = phone_type_code;
this.area_code = area_code;
this.number = number;
this.email_main = email_main;
this.email_ccc = email_ccc;
this.website = website;
}
public EnterpriseContactDetailsModel(int phone_type_code, String phone_type, String area_code, String number, String email_main, String email_ccc, String website) {
this.phone_type_code = phone_type_code;
this.phone_type = phone_type;
this.area_code = area_code;
this.number = number;
this.email_main = email_main;
this.email_ccc = email_ccc;
this.website = website;
}
public String getEnterprise_id() {
return enterprise_id;
}
public void setEnterprise_id(String enterprise_id) {
this.enterprise_id = enterprise_id;
}
public String getPhone_type() {
return phone_type;
}
public void setPhone_type(String phone_type) {
this.phone_type = phone_type;
}
public int getPhone_type_code() {
return phone_type_code;
}
public void setPhone_type_code(int phone_type_code) {
this.phone_type_code = phone_type_code;
}
public String getArea_code() {
return area_code;
}
public void setArea_code(String area_code) {
this.area_code = area_code;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
public String getEmail_main() {
return email_main;
}
public void setEmail_main(String email_main) {
this.email_main = email_main;
}
public String getEmail_ccc() {
return email_ccc;
}
public void setEmail_ccc(String email_ccc) {
this.email_ccc = email_ccc;
}
public String getWebsite() {
return website;
}
public void setWebsite(String website) {
this.website = website;
}
}
|
[
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.